????? ??????? ??? 16-?? ?? ??? 32 ?? ??? Windows 95 ?Windows 98 ?Windows Me

?????? ????????? ?????? ?????????
???? ???????: 155763 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

??? ????? ?? ????? ??? ?????? ??? ??????? ???????? ?? ??? ????? ???????? ?????????? ??? 16-?? (DLL) ?? ??????? Win32. ???? ??? ?????? ???? ??? ????? ?? ??? ???? ????????? ???????? ?????? ?? DLL ???? ?????? ???? ??? Win32. ?????? ??? ??????? ?????? ???????? DLLs 16 ?? ???? DLLs 32-??. ?????? ???? thunk ??? ????? ????? ??? Microsoft Windows 95, Windows 98 ? Windows Millennium Edition ???? thunk ????.

???? ??? ??? ???? ????? ?????? ???????? ?? ????? thunk ?????:
  1. ????? ???????? ????? thunk.
  2. ????? DLL 32-??.
  3. ????? DLL 16-??.

??????? ????

????? thunk ???? ?? 32-?? DLL 16 ?? ???? ???? ????. ?????? ????? Win32 DLL 32-?? ??? DLL 32-?? ???????? ???? ?? ??????? ?? ????? ???????? ?????? ??? 16-??. ????? ???? ?????? ?? DLL 16-?? ???? ??? DLL 32-?? ???? ????? ?????? ??? ??????? Win32. 32 ?? ? 16-?? DLLs ????? ?? ???? ??????? kernels Windows 95 32 ?? ? 16-?? ??????? ???? ???????? ??? ??????? ??????? ??????? ??? ???????? ?? ??? 32 ?? ??? 16-?? ?? ???.

????? ????? thunk ????? ????? ????? ?????? ??? thunk (.thk ???). ??? ????? ??? ???????? ????? ?? ?????? ??????? ??????? Thunk ??? ??? ??? ????? ?? ??? ??????? ?????; ??? ????? ?? ?? ?? ????? ?????? - DIS_32 ?- DIS_16. ???? ?? ??? ????? ??????? ?????? 32 ?? ? 16-??. ??? ??? ??? ??????? ??????? ?????? ?? DLLs 32 ?? ? 16-?? ??? ???????. ???? ?????? ?????? ??????? ???????? ?? ????? ?????? ???????? ?????? (DLL):
                         +------------+
                         | 32to16.thk |
                         +------------+
                               |
                         +------------+
                         | 32to16.asm |
                         +------------+
                           /         \ 
                  -DIS_32 /           \ -DIS_16
                        /              \ 
                  +-----------+  +-----------+
                  | 32THK.obj |  | 16THK.obj |
                  +-----------+  +-----------+
                        /                 \ 
        +-------+    +-------+             +-------+
        | APP32 | -> | DLL32 | -- THUNK -- | DLL16 |
        +-------+    +-------+             +-------+
				

????? ????? ?????? Thunks ????

  • Microsoft ?? Visual C++ ??????? 1.5 x ?????? ??????? ??????? (16-??) ?? ???? 16-?? ?? ????? thunk. ?? ???? 16-?? thunk DLL 16-??.
  • 2.x ??????? Microsoft Visual C++ ?? ?????? ??????? ??????? ?????? ?????? 32-?? ?? thunk ?? (32-??) ????. ?? ???? 32-?? thunk DLL 32-??.
  • ??????? thunk (Thunk.exe) ?? SDK Win32 Microsoft ?????? ??? ????? thunk ??????? ??????.
  • Microsoft ????? ???? (MASM) ??????? 6.1 ?? ???? ?? ????? ????? ?????? ??????? thunk ??? ???????.
  • 16-?? ??? Rc.exe ?? ?????? BINW16 SDK Win32 Microsoft ?????? ??? ??? ????? thunk 16-?? DLL ??????? 4.0.

????? ?????? ??? Thunk

????? ??? ????? ?????? ??? ????????? ?? ??? ?????? ??????? ??????? Thunk ?????? thunk. ?????? ??? thunk ?? ??? ????? ???? ????? ??? ??????? ????? ??????? ??????? ???? ?? ??????? ???? ???? ?? ??????? ??? thunks ??????? ????? ???????? ?? ??? ?? ????. ??? ???? ??????? ????? ??? ??????? ?????? ?? ??????? ? ??????? ????? ??????? ?? ????? ?????? ??????? ???. ????? ???? thunk ??????? ???? ???? ??? ???? ?? ??? ??? ??? ????? ?????? ??????? ? ?? ?? ???????? ????????.

???? ?????? ??? thunk 32-> 16 thunks ?? ??????? ???????:
enablemapdirect3216 = true;
????? ?????? ??????? ??????? Thunk ????? ???? 32-?? thunk ?? __stdcall ??? ???? 16-?? __far __pascal. (????? WINAPI ????? ????? ??? ??? ??? ?????.) __cdecl ? __fastcall ??????? ???????? ??? ?????? ?? ??? ?????? ??????? ??????? Thunk. ??? ???? ???? ?? ?? ???? ?????? ??????? ??????? Thunk ?????? ???? ??????? ???????? __far __pascal ?? __stdcall; ??? ??????.

???? ?????? ?????? ???????? ??? thunk ?????? ??? ?? ??????:
   enablemapdirect3216 = true;

   void MyThunk16()
   {
   }
				
????? ????? ???????:
   C   language:  void WINAPI MyThunk16(void);
   C++ language:  extern "C" void WINAPI MyThunk16();
				
??? ???????? ????? ?????? ?????? ???? ???? ???? ??????? ????? ?????? ????. ??????? ??????? ?? ????? ????? ????? ??? ???? ???? ?? ?????? ??? DLL 32-??.
   enablemapdirect3216 = true;

   typedef int   BOOL;
   typedef char *LPSTR;

   BOOL MyThunk16(LPSTR lpstrInput, LPSTR lpstrOutput)
   {
      lpstrInput  = input;    // optional; input is default
      lpstrOutput = output;
   }
				
??????? "lpstrOutput = ???????" ?????? ?????? ??????? ??????? Thunk ???? ?????? 16-?? ????? ????? ??? ????? ?? ???? ????: ????? ??? ????? ??? 32-??.

?????? ???????? ????? ?????? thunk ????? ???????? ???? ??????? ??? ?????. ???? ??? ?????? ????? ????? ????? ?????? ???????.
   enablemapdirect1632 = true;

   typedef unsigned int UINT;
   typedef char *LPSTR;

   typedef struct _POINT {
      UINT x;
      UINT y;
   }POINT, *LPPOINT;

   typedef struct _CIRCLE {
      POINT center;
      UINT  radius;
   }CIRCLE, *LPCIRCLE;

   void MyThunk32( LPCIRCLE lpCircleInOut)
   {
      lpCircleInOut = inout;
   }
				
??????? "lpCircleInOut = inout" ?????? ?????? ??????? ??????? ???????? ????? ????? ??? ?????? ?????? ????????? ?? ??? ??????? ????????. ???? ??? ?????? ??????? Thunk ????? lpCircleInOut ?? ????? ??? ?? ?? ??? ???? ????: ????? ????? ??? ??????? ?????? ??? ?? ?????? ??? ????? ?? ?? ??? ????? ???? ??????. ??? ?????? ??????? ??? thunk ??????? ?????? ?????? ??????? ??????? Thunk.

???????? ?????? ??????? Thunk

??????? ?????? ??????? ??????? Thunk ??? ???:
thunk.exe/?????? <inputfile>-o <outputfile>
???? ??? ??????? ?????? ????? ????? 32-> ???????? ????? thunk 16. ??? ???? ???? ??? thunk ?????? 32to16.thk ?? ???? ??? ??? ????? ?????? 32to16.asm.
thunk 32to16.asm -o 32to16.thk thk -t
"-t thk" ????? ?????? ?????? ??????? ??????? Thunk ??????? ??????? thunk ?? ??? ??? ??????? ?? "thk_." ??? ??????? ??? ??? ??? ????? ???? thunk ?? ??? ?? DLLs ??? ????? ?????? ??? ?? DLLs ???? ????? ??? ??? 32-> 16 ? 16-> 32 thunks. ??? ?? ???? ??? ?? ?????? ??? thunk ????? ?????.

????? DLL 32-??

  1. ??? ????? ??????? ???? ??????? ?????? ?????? ??????? ??????? Thunk ?????? thk_ThunkConnect32 ?? ???? ?? ??? (dwReason) DllMain ??? ?? ???? ??? ?? ???? DllMain DLL 32-?? ("thk" ?? ??????? ?? ??? ??????? -t ?????? ??????? ??????? Thunk):
          // prototype for function in .obj file from the thunk script
          BOOL WINAPI thk_ThunkConnect32(LPSTR     lpDll16,
                                         LPSTR     lpDll32,
                                         HINSTANCE hDllInst,
                                         DWORD     dwReason);
    
          BOOL WINAPI DllMain(HINSTANCE hDLLInst,
                              DWORD     dwReason,
                              LPVOID    lpvReserved)
          {
             if (!thk_ThunkConnect32("DLL16.DLL", "DLL32.DLL",
                                     hDLLInst, dwReason))
             {
                return FALSE;
             }
             switch (dwReason)
             {
                case DLL_PROCESS_ATTACH:
                   break;
    
                case DLL_PROCESS_DETACH:
                   break;
    
                case DLL_THREAD_ATTACH:
                   break;
    
                case DLL_THREAD_DETACH:
                   break;
             }
             return TRUE;
          }
    						
  2. ?? ?????? ?????? ??????? ?? ?????? ????? ??? ????? (.def) ?????? ??????? ?? DLL 32-??. ??? ???? ??????:
          
       thk_ThunkData32
    						
  3. ????? ????? ???? ?????? ??????? Win32. ????? ??? ??????? ??? ????? (.def) ?????? ??????? DLL 32 ?? ?? ?????? ???????? __declspec(dllexport). ???? ?? ?? ??? ??????? ?? ??????? ???????? __stdcall (?? WINAPI). ??? ??? ????? DLL 32-?? ?? C++ ? ???? ?? ????? ??????? ??? extern "C" ?????.
  4. ????? ???????? ????? thunk ??? ??? (??? ??? ?????? ??????? ???????):
          thunk -t thk 32to16.thk -o 32to16.asm
    						
  5. ?? ?????? ??? ??? ??????? ??????? ?? ??? ?????? ??????? ??????? Thunk ????? ????? 32-?? ????. ??? ???? ??????:
          ml /DIS_32 /c /W3 /nologo /coff /Fo thk32.obj 32to16.asm
    						
  6. ??? ??? ?????? ??????? ?????? ???? ?? DLL 32-??.
  7. ?????? ??????? Thunk32.lib ???? ?? DLL 32-??. ??? ?? ????? ????????? 32-?? ???????? ?? SDK Win32 ???? ????? ??? ????? ??? APIs thunking 32-?? ???? ?????? ????????? ???????? ??????? ?????? ?????? ??????? ??????? Thunk.

????? DLL 16-??

  1. ???? ????? DLL 16-?? ???? "DllEntryPoint." ??? ?? ??? ?????? ?????? ??????? ???? ??????? ?????? ?????? ??????? ??????? Thunk ?????? thk__ThunkConnect16 ("thk" ?? ??????? ?? ??? ??????? -t ?????? ??????? ??????? Thunk) ?? ??? ??? ??????? DllEntryPoint:
          // prototype for function in .obj file from the thunk script
          BOOL WINAPI __export thk_ThunkConnect16(LPSTR lpDll16,
                                                  LPSTR lpDll32,
                                                  WORD  hInst,
                                                  DWORD dwReason);
    
          BOOL WINAPI __export DllEntryPoint(DWORD dwReason,
                                             WORD  hInst,
                                             WORD  wDS,
                                             WORD  wHeapSize,
                                             DWORD dwReserved1,
                                             WORD  wReserved 2)
          {
             if (!thk_ThunkConnect16("DLL16.DLL",
                                     "DLL32.DLL",
                                     hInst,
                                     dwReason))
             {
                return FALSE;
             }
             return TRUE;
          }
    						
  2. ?? ?????? ?????? ??????? ?? ?????? ??????? ?? ??? ????? (.def) ?????? ??????? ?? DLL 16-??. ??? ???? ??????:
          C16ThkSL01      = KERNEL.631
          ThunkConnect16  = KERNEL.651
    						
  3. ?? ?????? ?????? ??????? ?? ?????? ????? ??? ????? (.def) ?????? ??????? ?? DLL 16-??. ??? ????? THK_THUNKDATA16 ?? ??? ?????? ???? ??? ??????? ?? ????? ?????? ??????? Thunk. ?? ?? ??? ?????? ??? ?? ?????? ???????? RESIDENTNAME ??? ???? ?? ???? ?? ??? ??????.
          THK_THUNKDATA16 @1  RESIDENTNAME
          DllEntryPoint   @2  RESIDENTNAME
    						
  4. ????? ????? thunk ???? ????? ??? ????? (.def) ?????? ??????? DLL 16-??. ???? ?? ?? ??? ????? ? __export __far __pascal (?? __export WINAPI). ??? ??? ????? DLL ?? C++ ? ???? ?? ????? ?? extern "C" ?????. ????????? ???? 32-?? thunk ??? ???????.
  5. ????? ???????? ????? thunk ??? ??? (??? ??? ?????? ??????? ???????):
          thunk -t thk 32to16.thk -o 32to16.asm
    						
  6. ?? ?????? ??? ??? ??????? ??????? ?? ??? ?????? ??????? ??????? Thunk ????? ????? 16-?? ????. ??? ???? ??????:
          ml /DIS_16 /c /W3 /nologo /Fo thk16.obj 32to16.asm
    						
  7. ??? ??? ?????? ??????? ?????? ???? ?? DLL 16-??.
  8. ??? ????? DLL 16-?? ??????? 4.0. ?????? ????? ?????? ?????? ??????? ??????? ?????? (Rc.exe). ???? ????? ?????? ???? ??????:
    rc-40 < ??? DLL >
    ????? ??? ??????-40 ?? ?????? "??????? ???????" ???? ??? ??????? ?? SDK Win32.

    ??????: ???? ?? ??????? ??? Rc.exe ?? ?????? BINW16 ???? ??? ??? ????? DLL ?? ??????? 4.0. ??? ????? Rc.exe ???? ???? ?? ??????? Microsoft Visual C++ 16-?? ????? DLL ??????? 4.0.

?????

?????? ??? ??????? ??? ????? ????? thunks ???? ?????? ?????? ??? ??????? ??????? ?? "????? ??????? ?? Microsoft:
133722????? ????? Thunks ????

???????

???? ???????: 155763 - ????? ??? ??????: 05/????? ???????/1426 - ??????: 2.3
????? ???
  • Microsoft Win32 ????? ????? ???????, ????? ?????? ??:
    • Microsoft Windows 95
    • Microsoft Windows 98 Standard Edition
    • Microsoft Windows Millennium Edition
    • Microsoft Platform Software Development Kit-January 2000 Edition
????? ??????: 
kbmt kbapi kbhowto kbkernbase kbnetwork kbprogramming kbthunks kbtshoot KB155763 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????155763

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com