Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Does GetProcAddress return an absolute 32-bit address?

66 views
Skip to first unread message

Paul Dent

unread,
May 24, 2012, 6:00:59 PM5/24/12
to
In Compaq Visual Fortran with USE DFWIN all the Windows APIs are imported and can be used.

I have a DLL developed in an unknown language, probably 'C', whose library functions I wish to use.

Lets say the dll is called "special.DLL" and one of its functions I want to use is called "function_one"

So I first use this Windows API to get the address of the dll:

LIBADD=LOADLIBRARY('special.DLL')

Then I pass it to a second Windows API along with the name of the function whose call address I want to get:

IADDR=GetProcAddress(LIBADD,"function_one")

These calls seem to return believable values.

The question is, does GetProcAddress return an absolute address or an offset from something?
MSFT is ambivalent on whether GetProcAddress returns an absolute address or an offset. They sometimes use the words "absolute offset" which is very confusing!

Assuming I now have an absolute address in IADDR, there is no way I know of in FORTRAN that I can call a function whose address is in a variable! So, I move into assembler, pass the variable IADDR in as an argument, get the value into register EAX and then do

CALL EAX ;Call routine at absolute address in EAX.

Does this look right?

Now, CALL [EAX] also assembles error free, and I assume this would be A doublY indirect CALL, (which I don't think is what I want here)

All variations I have tried so far terminate with "access violation" which is usually a good indication that it's jumping off into space somewhere.

Now, if GetProcAddress does not return an absolute address, but rather an offset, to what base must this be added (i.e. what register holds the base)?







0 new messages