Address of functions in Visual C++

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

This is absolutely bizarre.

All I want is a simple address of a function... simple enough right.

extern "C" int WINAPI _tWinMain(
...
unsigned int ax;
...
ax = (unsigned int)(FunctionIWant);

...
}

In other modules FunctionIWant is declared as
extern void "C" FunctionIWant(void);

and is compiled as
void FunctionIWant(void){ }

Looks good so far... but in debug mode the following happens:
ax = (unsigned int)(FunctionIWant);

In the Autos tab FunctionIWant shows up as 0x004b9850
But ax shows up as 0x00474d82
WTF? How did the right side not make it to the left side?
If I look in memory, a function header showup as expected at 0x004b9850 and
there is garbage at 0x00474d82.

All I want is address of my function.... Im experimenting with some basic
security mesaures (self-encrypting code, wrappers, etc...) and getting the
address of functions is very important.

Shannon
 
Back
Top