confused: Getting Thumped trying to Thunk.

I have a Legacy 16-bit application that generates Lessons for
Education. The
Lessons generated need to run on school computers from Windows 98
Windows XP. These Lessons also need to exchange information with
servers using XMLHTTP. I have 32-bit DLLs that can do the data
exchange using
XMLHTTP tested out OK. I need to be able to exchange integer values,
and status between the 16-bit Lessons and the 32-bit DLLs. The Legacy
Lessons can link with 16-bit DLLs. I have tested this and it works OK.
the 16-bit Lessons are not able to link to 32-bit DLLs directly.

The plan is to build 16-bit DLLs that link with the 16-bit Lessons and
use flat thunks between the 16-bit DLLs and 32-bit DLLs to get the
communication functions that are needed. I am using the methods
described in
KB154093 "How To Call 32-bit Code from 16-bit Code Under Windows 95,
98, or Windows Millennium Edition" in building the 16-bit DLLs,
script and 32-bit DLLs.

Quite a bit of information is missing. There does not seem to be any
documentation on thunk.exe, the thunking compiler. There does not seem
to be
any documentation on the thunking script language. The formats for the
integer and other variable types changed between the 16-bit and 32-bit
I am not sure what data format the thunk script is using in its

I am using VC++ 1.52 to build the 16-bit DLLs. I am using VC++ 6.0 to
the 32-bit DLLs. I am using thunk.exe, rc.exe and ml.exe found in the
DDK to build the flat thunk as instructed. I have scraped up enough
information on the web to build the DLLs and the flat thunk. It
compiles and
links OK but any information received by the 16 bit DLL from the 32
bit DLL
appears to be corrupted by the flat thunk. I can not send constants as
WORD, DWORD, LONG or LPSTR from the 32 bit DLL to the 16 bit DLL. ALL
from the 32 bit DLL seem to be corrupted no matter the data type. I am
yet able to test data from the 16-bit DLL to the 32-bit DLL until I
can get
the correct data returned. I am trying very simple and straight
forward tests.

I am building and running these components on a Windows XP
system for testing.

Does anyone know why this method described in the KB article does not
Does anyone know how to exchange data between 16-bit DLLs and 32 Bit
that will work on Win98 through WinXP systems?
Does flat thunks as described not work on WinXP systems?
Does anyone know where I can find documentation on the thunk.exe and
thunking script?

I greatly appreciate any assistance.

Don Baechtel