From: Don on
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
through
Windows XP. These Lessons also need to exchange information with
remote
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,
strings
and status between the 16-bit Lessons and the 32-bit DLLs. The Legacy
16-bit
Lessons can link with 16-bit DLLs. I have tested this and it works OK.
But
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
then
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,
Windows
98, or Windows Millennium Edition" in building the 16-bit DLLs,
thunking
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
DLLs.
I am not sure what data format the thunk script is using in its
declarations.

I am using VC++ 1.52 to build the 16-bit DLLs. I am using VC++ 6.0 to
build
the 32-bit DLLs. I am using thunk.exe, rc.exe and ml.exe found in the
Win98
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
int,
WORD, DWORD, LONG or LPSTR from the 32 bit DLL to the 16 bit DLL. ALL
values
from the 32 bit DLL seem to be corrupted no matter the data type. I am
not
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
Professional
system for testing.

Does anyone know why this method described in the KB article does not
work?
Does anyone know how to exchange data between 16-bit DLLs and 32 Bit
DLLs
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
From: Pavel A. on
Wrong newsgroup. Sorry. Try to run this win98 app under VMware Player.

--PA


"Don" <dbaechtel(a)gmail.com> wrote in message
news:4a62c328-fcef-4cdb-99fa-4a9350ddad92(a)a22g2000hsc.googlegroups.com...
> 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
> through
> Windows XP. These Lessons also need to exchange information with
> remote
> 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,
> strings
> and status between the 16-bit Lessons and the 32-bit DLLs. The Legacy
> 16-bit
> Lessons can link with 16-bit DLLs. I have tested this and it works OK.
> But
> 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
> then
> 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,
> Windows
> 98, or Windows Millennium Edition" in building the 16-bit DLLs,
> thunking
> 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
> DLLs.
> I am not sure what data format the thunk script is using in its
> declarations.
>
> I am using VC++ 1.52 to build the 16-bit DLLs. I am using VC++ 6.0 to
> build
> the 32-bit DLLs. I am using thunk.exe, rc.exe and ml.exe found in the
> Win98
> 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
> int,
> WORD, DWORD, LONG or LPSTR from the 32 bit DLL to the 16 bit DLL. ALL
> values
> from the 32 bit DLL seem to be corrupted no matter the data type. I am
> not
> 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
> Professional
> system for testing.
>
> Does anyone know why this method described in the KB article does not
> work?
> Does anyone know how to exchange data between 16-bit DLLs and 32 Bit
> DLLs
> 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

From: Lynn McGuire on
> I have a Legacy 16-bit application that generates Lessons for
> Education. The
> Lessons generated need to run on school computers from Windows 98
> through
> Windows XP. These Lessons also need to exchange information with
> remote
> 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,
> strings
> and status between the 16-bit Lessons and the 32-bit DLLs. The Legacy
> 16-bit
> Lessons can link with 16-bit DLLs. I have tested this and it works OK.
> But
> the 16-bit Lessons are not able to link to 32-bit DLLs directly.

First, I would port the Win16 code to Win32 today. Dont
even waste your time doing this. However, if you must ...

Thunking only works on Windows 95 / 98 and ME. Not on
Windows 2K , XP or Vista (due to protected memory spaces).

We used to have a Win16 portion of our app. So, we had
a Win16 EXE and a Win32 EXE. The two EXE programs talked
to each other using WM_COPYDATA. Google it. The Win32
program will need to be the master and tell the Win16 what
to do and when to kill itself.

Lynn
From: Chris Hill on
On Fri, 11 Apr 2008 16:43:56 -0500, Lynn McGuire <lmc(a)winsim.com>
wrote:

>> I have a Legacy 16-bit application that generates Lessons for
>> Education. The
>> Lessons generated need to run on school computers from Windows 98
>> through
>> Windows XP. These Lessons also need to exchange information with
>> remote
>> 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,
>> strings
>> and status between the 16-bit Lessons and the 32-bit DLLs. The Legacy
>> 16-bit
>> Lessons can link with 16-bit DLLs. I have tested this and it works OK.
>> But
>> the 16-bit Lessons are not able to link to 32-bit DLLs directly.
>
>First, I would port the Win16 code to Win32 today. Dont
>even waste your time doing this. However, if you must ...
>
>Thunking only works on Windows 95 / 98 and ME. Not on
>Windows 2K , XP or Vista (due to protected memory spaces).
>
>We used to have a Win16 portion of our app. So, we had
>a Win16 EXE and a Win32 EXE. The two EXE programs talked
>to each other using WM_COPYDATA. Google it. The Win32
>program will need to be the master and tell the Win16 what
>to do and when to kill itself.
>
>Lynn

Thunking 16->32 (using a 32-bit DLL from a 16-bit code) works on
95/98/ME and NT/2K/XP. Thunking 32->16 (using a 16-bit DLL from
32-bit code) does not work on the NT family. If you are committed to
using the Win16 code to call 32-bit DLLs, look at generic thunks.

http://support.microsoft.com/kb/q104009/

Chris