News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Questions about forwarding DLL functions with GoLink

Started by Ben321, October 08, 2021, 05:45:58 PM

Previous topic - Next topic

Ben321

Is it possible to create a forwarder export in a DLL's export table, by using GoLink? The way forwarding a function works, is it has to do with the entries in the Export Address Table. The MS documentation at https://docs.microsoft.com/en-us/windows/win32/debug/pe-format explains it.

The entries in the EAT (Export Address Table) can either be normal export entries
QuoteThe address of the exported symbol when loaded into memory, relative to the image base. For example, the address of an exported function.
or forwarding entries
QuoteThe pointer to a null-terminated ASCII string in the export section. This string must be within the range that is given by the export table data directory entry. See Optional Header Data Directories (Image Only). This string gives the DLL name and the name of the export (for example, "MYDLL.expfunc") or the DLL name and the ordinal number of the export (for example, "MYDLL.#27").

So basically, if a given EAT entry is the first type of entry (it points to a location outside of the exports directory) then it is treated as pointing to an exported function from within the current DLL file.

However, if a given EAT entry is the second type of entry (it points to a location inside of the exports directory), then it is treated as pointing to a string which must be in the following format. The string names a DLL file (without the ".dll" at the end of the filename), followed by a period, followed by the name or ordinal of the function (if it's an ordinal, it must have the # symbol immediately before the ordinal number).

If at all possible, I would like GoLink to support generating the second type of EAT entry, so that I can make my DLL forward useful functions from other DLLs, that are related to the functionality of the DLL that I'm making.

If this is not currently possible with GoLink. Please add this feature.

wjr

GoLink currently does not support a forwarded export entry.

I have dealt with these before in my PEview program. Some further details to look into, but so far this seems possible to add as a feature to GoLink (and then GoAsm which can be used to pass EXPORT information to GoLink). The syntax probably will extend the /EXPORT option as in the following more common variations mentioned:

/EXPORT Name=LibraryName.ForwardedName
/EXPORT Name=LibraryName.#OrdinalNumber