DOS 16 bit application to call a Win32 DLL.

I am trying to get a DOS application (16 bit, written in assembly with TASM) calls my Win32 DLL exported functions. I am new to windows system programming, but I think that Generic thunks will do the job. I am wrong? If not could some one help me with steps to follow, hints etc.
Thank you in advance,
[305 byte] By [telghali] at [2007-11-20 5:37:29]
# 1 Re: DOS 16 bit application to call a Win32 DLL.
You should track the EAT (Export Address Table), ENT (Export Name Table) and EOT (Export Ordinal Table).

If memory serves me right, you should be able to get there by iterating through the ENT - an array of pointers to zero-terminated function name strings - until you found the function you need, then reading the ordinal value from the associated entry in the parallel EOT and using that as an index into the EAT to find the linear offset of the required function.

Don't shoot me if I'm wrong though, it's been a while since I did this kind of thing.
Anyway, you'll have to get the offsets to these arrays from the export table.

To get there, you can use the e_lfanew RVA in the IMAGE_DOS_HEADER structure and, subsequently, the export table RVA from IMAGE_NT_HEADERS.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].

For details, see these articles:
An In-Depth Look into the Win32 Portable Executable File Format (http://msdn.microsoft.com/msdnmag/issues/02/02/PE/)
An In-Depth Look into the Win32 Portable Executable File Format, Part 2 (http://msdn.microsoft.com/msdnmag/issues/02/03/PE2/)
Lars-NL at 2007-11-10 3:55:13 >