📚 OpenRCE is preserved as a read-only archive. Launched at RECon Montreal in 2005. Registration and posting are disabled.








Flag: Tornado! Hurricane!

 Forums >>  IDA Pro  >>  IDA Get Name of Current Working Segment

Topic created on: January 29, 2007 18:40 CST by northdemon .

Initiate and run my plugin in mode of debug: ida create a lot of segments (debug and not only). Into plugin use compare with EIP:

// Get EIP register value
get_reg_val("eip", &eip);

for (run over all segments)
{
  if ((eip.ival > (seg->startEA))
                   && (eip.ival < (seg->endEA)))
  msg("EIP=%a from segment %d at %a to %a is named %s ",
           eip.ival, i, seg->startEA, seg->endEA, segName);
}

But don't work :( Write name of non-existent segments.
Help, please, decide a question...
Quite possible, error in addressing of segments or no :(

  fileoffset     January 29, 2007 23:57.54 CST
I am not sure the exact function names in the SDK to use to do this, but in IDC I would do the following:

auto s, ea, segnum;

// set ea to the address you want to find

s = FirstSeg();
segnum = 1;  // adjust this as neccessary

while (ea < SegStart(s) && ea > SegEnd(s))
{
  s = NextSeg(s);
  segnum++;
}

Message("ea found in segment %d\n", segnum);

  sp     January 30, 2007 02:05.23 CST
Can you do something like this:

ea_t eip = 0x1005234;

segment_t* seg = getseg(eip);

if (seg)
{
  char foo[20];
  get_true_segm_name(seg, foo, 20);
  msg(...}
}


?

  northdemon     January 30, 2007 03:42.39 CST
> fileoffset: but in IDC I would do the following:

Thanks, but large ( relational :) ) IDC-scripts problematically build in to plugin :(

> sp: Can you do something like this...

Thanks, interesting approach!
But is it possible to convert structures from "regval_t" to "ea_t"?  :(

  dennis     February 14, 2007 12:50.07 CST
struct regval_t
{
#ifndef __WATCOMC__     // bad compiler
  union
  {
#endif
    ulonglong ival;     // 8:  integer value
    ushort    fval[6];  // 12: floating point value in the internal representation (see ieee.h)
#ifndef __WATCOMC__
  };
#endif
  regval_t(void) : ival(~ulonglong(0)) {}
};


ea_t ea;
regval_t reg;

reg = ...

ea = (ea_t)reg.ival;

  northdemon     February 24, 2007 12:30.18 CST
> dennis
Thanks! Use many of your very good plugins! :)

Or may get simpler with no type conversion, work too.

Note: Registration is required to post to the forums.

There are 31,328 total registered users.


Recently Created Topics
[help] Unpacking VMP...
Mar/12
Reverse Engineering ...
Jul/06
let 'IDAPython' impo...
Sep/24
set 'IDAPython' as t...
Sep/24
GuessType return une...
Sep/20
About retrieving the...
Sep/07
How to find specific...
Aug/15
How to get data depe...
Jul/07
Identify RVA data in...
May/06
Question about memor...
Dec/12


Recent Forum Posts
Finding the procedur...
rolEYder
Question about debbu...
rolEYder
Identify RVA data in...
sohlow
let 'IDAPython' impo...
sohlow
How to find specific...
hackgreti
Problem with ollydbg
sh3dow
How can I write olly...
sh3dow
New LoadMAP plugin v...
mefisto...
Intel pin in loaded ...
djnemo
OOP_RE tool available?
Bl4ckm4n


Recent Blog Entries
halsten
Mar/14
Breaking IonCUBE VM

oleavr
Oct/24
Anatomy of a code tracer

hasherezade
Sep/24
IAT Patcher - new tool for ...

oleavr
Aug/27
CryptoShark: code tracer ba...

oleavr
Jun/25
Build a debugger in 5 minutes

More ...


Recent Blog Comments
nieo on:
Mar/22
IAT Patcher - new tool for ...

djnemo on:
Nov/17
Kernel debugger vs user mod...

acel on:
Nov/14
Kernel debugger vs user mod...

pedram on:
Dec/21
frida.github.io: scriptable...

capadleman on:
Jun/19
Using NtCreateThreadEx for ...

More ...


Imagery
SoySauce Blueprint
Jun 6, 2008

[+] expand

View Gallery (11) / Submit