After you compile the thunk script to create the 16-bit code for the thunk, you must create the 16-bit thunk DLL. To implement the 16-bit thunk DLL, use the following steps.
BOOL FAR PASCAL __export DllMain(DWORD dwReason, WORD hInst,
WORD wDS, WORD wHeapSize, DWORD dwReserved1,
WORD wReserved2)
{
if( !(XXX_ThunkConnect16( "DLL16.DLL", // name of 16-bit DLL
"DLL32.DLL", // name of 32-bit DLL
hInst, dwReason)) )
{
return FALSE;
}
return TRUE;
}
Note that DllMain calls the following function, which was generated by the thunk compiler:
BOOL FAR PASCAL __export XXX_ThunkConnect16(LPSTR pszDll16,
LPSTR pszDll32, WORD hInst, DWORD dwReason);
In this example, XXX is the base name — that is, the name of the thunk script file, not including the path and filename extension. If you used the /t option with the thunk compiler to specify a different base name when you compiled the thunk script, use that base name here.
EXPORTS
DllMain @1 RESIDENTNAME
XXX_ThunkData16 @2 RESIDENTNAME
IMPORTS
C16ThkSL01 = KERNEL.631
ThunkConnect16 = KERNEL.651
rc -40 DLL_Name
To ensure that your application works correctly, it is important that you use the following rules when implementing your thunks: