Retrieve current function address

Oct 13, 2009 at 6:28pm
I'm currently working on a project. It requires me to get the address of the current function. The problem is my function is a loader function, it is injected to another process's space. I know this can be done in VC2005 using _ReturnAddress() or something. But I'm using VC6 and it seems no way to do it. So if it is possible please teach me. Thanks.
Last edited on Oct 13, 2009 at 6:29pm
Oct 15, 2009 at 10:53pm
1
2
3
4
inline ULONG_PTR* GetAddressOfThisFunction()
{
  return (ULONG_PTR*)((ULONG_PTR)GetAddressOfThisFunction);
}


?
Last edited on Oct 15, 2009 at 10:54pm
Oct 16, 2009 at 12:44am
That won't work on injected code.

You have to do some pointer arithmetic, I think...
Topic archived. No new replies allowed.