Getting Thumped trying to Thunk.

D

dbaechtel

: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
 
M

MEB

You asked this in another forum, and were directed to MS TechNet/MSDN which
was a good idea, however, give it a bit and someone will likely have a few
more questions for you... such as:

When compiling {on XP} did you allow for the differences in the two target
environments?

Did you post this in one of the public.vc and/or public.ddk forums?

--
MEB http://peoplescounsel.orgfree.com
--
_________


"dbaechtel" <dbaechtel@nospam.nospam> wrote in message
news:FE851711-06C5-45A2-A30A-76C21608B9F0@microsoft.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
 
D

Don

On Apr 10, 2:38 pm, "MEB" <meb@not h...@hotmail.com> wrote:
> You asked this in another forum, and were directed to MS TechNet/MSDN which
> was a good idea, however, give it a bit and someone will likely have a few
> more questions for you... such as:
>
> When compiling {on XP} did you allow for the differences in the two target
> environments?
>


What do you mean by "did you allow for the differences in the two
target environments?"
How do I do this?
The flat thunk makes a conversion between the 16-bit and the 32-bit
worlds. That's its job.
What else do I have to do?
Remember this application, 16-bit DLL and 32-bit DLL will all run on
one machine and one OS.
The OS may be anything from Win98 to WinXP.
 
9

98 Guy

dbaechtel wrote:

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


Have a look here:

http://home.att.net/~raffles1/win32_faq.htm

Note the following:

"Thunking (in Windows) was designed to ease porting from 16 to 32 bit
code by allowing 16 bit apps to call 32 bit DLLs it's designed
primarily for thunking upward (which isn't too difficult, actually).
The same mechanisms can be used to call from 32 bit applications to 16
bit DLLs, but it isn't documented that way, and MS provides no samples
or support."

I think your primary problem is that Win-NT/2K/XP does not support
flat thunks.
 
M

MEB

"Don" <dbaechtel@gmail.com> wrote in message
news:c2741e7c-159b-472e-9024-0292a5430940@b1g2000hsg.googlegroups.com...
| On Apr 10, 2:38 pm, "MEB" <meb@not h...@hotmail.com> wrote:
| > You asked this in another forum, and were directed to MS TechNet/MSDN
which
| > was a good idea, however, give it a bit and someone will likely have a
few
| > more questions for you... such as:
| >
| > When compiling {on XP} did you allow for the differences in the two
target
| > environments?
| >
|
| What do you mean by "did you allow for the differences in the two
| target environments?"
| How do I do this?
| The flat thunk makes a conversion between the 16-bit and the 32-bit
| worlds. That's its job.
| What else do I have to do?
| Remember this application, 16-bit DLL and 32-bit DLL will all run on
| one machine and one OS.
| The OS may be anything from Win98 to WinXP.
|


You are right, Microsoft is devoid of much ready information on its
programming envos, but support and coding forums, and MSDN and/or TechNet
may help with certain issues.
Much of the information that is available is outdated, at times by
Microsoft's own changes in its files, updates, and MFCs.

As a reason for why I indicated the:
"When compiling {on XP} did you allow for the differences in the two target
environments?"
Though not explaining what you asked, these articles will give you
indications of WHY transporting issues and differing Windows version DLL
calls must be accounted for [if you're an experienced VC programmer then
don't bother with them, look at the thunk links instead]..

http://support.microsoft.com/kb/117552/en-us
http://support.microsoft.com/kb/184332/en-us
http://support.microsoft.com/kb/241848/en-us
http://support.microsoft.com/kb/238972/en-us
http://support.microsoft.com/kb/139801/en-us
http://support.microsoft.com/kb/280803/en-us
http://support.microsoft.com/kb/139801/en-us
Though VS:
http://support.microsoft.com/kb/172610/en-us

----

http://www.codeproject.com/KB/cpp/thunk32.aspx
Thunking in Win32
http://www.duckware.com/bugfreec/chapter2.html
http://www.google.com/search?hl=en&q=thunk+coding&btnG=Search

You MAY also be having issues with two different XMLHTTP [XML]versions,
UNICODE, and other system specific variables, i.e., XP/NT verses DOS/9X
coding, API, and/or other 32bit handling. You are compiling on the XP for 9X
16bit/32bit, right? And your intent is to do the initial work/translation
[16bit app to some 32bit app] on the 9X system, then pass this to XP?

http://msdn2.microsoft.com/en-us/visualc/default.aspx

Perhaps thunk isn't the way to go... or your coding isn't passing the exact
information you think it is. Anyway, I haven't done this for years so this
is not my element, hopefully someone else can help you.
I just thought I would also direct you to the proper help areas in my first
post and perhaps this one.

I would be interested in how you get it worked out though, it might have a
general 16bit to 32bit usage....

- - -
MEB http://peoplescounsel.orgfree.com
--
_________
 
L

Lee

On Apr 10, 6:36 am, dbaechtel <dbaech...@nospam.nospam> wrote:
> :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


How To Debug Flat Thunks
http://support.microsoft.com/kb/q133722
 
Back
Top Bottom