page ,132
;Thunk Compiler Version 1.8 May 11 1995 13:16:19
;File Compiled Tue Sep 05 12:53:22 2000
;Command Line: thunk.exe CPL32.thk -o CPL32.asm
TITLE $CPL32.asm
.386
OPTION READONLY
OPTION OLDSTRUCTS
IFNDEF IS_16
IFNDEF IS_32
%out command line error: specify one of -DIS_16, -DIS_32
.err
ENDIF ;IS_32
ENDIF ;IS_16
IFDEF IS_32
IFDEF IS_16
%out command line error: you can't specify both -DIS_16 and -DIS_32
.err
ENDIF ;IS_16
;************************* START OF 32-BIT CODE *************************
.model FLAT,STDCALL
;-- Import common flat thunk routines (in k32)
externDef MapHInstLS :near32
externDef MapHInstLS_PN :near32
externDef MapHInstSL :near32
externDef MapHInstSL_PN :near32
externDef FT_Prolog :near32
externDef FT_Thunk :near32
externDef QT_Thunk :near32
externDef FT_Exit0 :near32
externDef FT_Exit4 :near32
externDef FT_Exit8 :near32
externDef FT_Exit12 :near32
externDef FT_Exit16 :near32
externDef FT_Exit20 :near32
externDef FT_Exit24 :near32
externDef FT_Exit28 :near32
externDef FT_Exit32 :near32
externDef FT_Exit36 :near32
externDef FT_Exit40 :near32
externDef FT_Exit44 :near32
externDef FT_Exit48 :near32
externDef FT_Exit52 :near32
externDef FT_Exit56 :near32
externDef SMapLS :near32
externDef SUnMapLS :near32
externDef SMapLS_IP_EBP_8 :near32
externDef SUnMapLS_IP_EBP_8 :near32
externDef SMapLS_IP_EBP_12 :near32
externDef SUnMapLS_IP_EBP_12 :near32
externDef SMapLS_IP_EBP_16 :near32
externDef SUnMapLS_IP_EBP_16 :near32
externDef SMapLS_IP_EBP_20 :near32
externDef SUnMapLS_IP_EBP_20 :near32
externDef SMapLS_IP_EBP_24 :near32
externDef SUnMapLS_IP_EBP_24 :near32
externDef SMapLS_IP_EBP_28 :near32
externDef SUnMapLS_IP_EBP_28 :near32
externDef SMapLS_IP_EBP_32 :near32
externDef SUnMapLS_IP_EBP_32 :near32
externDef SMapLS_IP_EBP_36 :near32
externDef SUnMapLS_IP_EBP_36 :near32
externDef SMapLS_IP_EBP_40 :near32
externDef SUnMapLS_IP_EBP_40 :near32
MapSL PROTO NEAR STDCALL p32:DWORD
.code
;************************* COMMON PER-MODULE ROUTINES *************************
.data
public CPL32_ThunkData32 ;This symbol must be exported.
CPL32_ThunkData32 label dword
dd 3130534ch ;Protocol 'LS01'
dd 0377dh ;Checksum
dd 0 ;Jump table address.
dd 3130424ch ;'LB01'
dd 0 ;Flags
dd 0 ;Reserved (MUST BE 0)
dd 0 ;Reserved (MUST BE 0)
dd offset QT_Thunk_CPL32 - offset CPL32_ThunkData32
dd offset FT_Prolog_CPL32 - offset CPL32_ThunkData32
.code
externDef ThunkConnect32@24:near32
public CPL32_ThunkConnect32@16
CPL32_ThunkConnect32@16:
pop edx
push offset CPL32_ThkData16
push offset CPL32_ThunkData32
push edx
jmp ThunkConnect32@24
CPL32_ThkData16 label byte
db "CPL32_ThunkData16",0
pfnQT_Thunk_CPL32 dd offset QT_Thunk_CPL32
pfnFT_Prolog_CPL32 dd offset FT_Prolog_CPL32
.data
QT_Thunk_CPL32 label byte
db 32 dup(0cch) ;Patch space.
FT_Prolog_CPL32 label byte
db 32 dup(0cch) ;Patch space.
.code
;************************ START OF THUNK BODIES************************
;
public GetProcAddress16@4
GetProcAddress16@4:
mov cl,2
jmp IIGetProcAddress16@4
public LoadLibrary16@4
LoadLibrary16@4:
mov cl,4
jmp IIGetProcAddress16@4
public FreeLibrary16@4
FreeLibrary16@4:
mov cl,3
; GetProcAddress16(16) = GetProcAddress16(32) {}
;
; dword ptr [ebp+8]: hInst
;
public IIGetProcAddress16@4
IIGetProcAddress16@4:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call dword ptr [pfnQT_Thunk_CPL32]
shl eax,16
shrd eax,edx,16
call SUnMapLS_IP_EBP_8
leave
retn 4
;
public CPlApplet16@20
CPlApplet16@20:
mov cl,1
; CPlApplet16(16) = CPlApplet16(32) {}
;
; dword ptr [ebp+8]: lpfnCPlApplet
; dword ptr [ebp+12]: hWndCPL
; dword ptr [ebp+16]: uMsg
; dword ptr [ebp+20]: lParam1
; dword ptr [ebp+24]: lParam2
;
public IICPlApplet16@20
IICPlApplet16@20:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call SMapLS_IP_EBP_12
push eax
call SMapLS_IP_EBP_16
push eax
call SMapLS_IP_EBP_20
push eax
call SMapLS_IP_EBP_24
push eax
call dword ptr [pfnQT_Thunk_CPL32]
shl eax,16
shrd eax,edx,16
call SUnMapLS_IP_EBP_8
call SUnMapLS_IP_EBP_12
call SUnMapLS_IP_EBP_16
call SUnMapLS_IP_EBP_20
call SUnMapLS_IP_EBP_24
leave
retn 20
;
public LoadString16@16
LoadString16@16:
mov cl,0
; LoadString16(16) = LoadString16(32) {}
;
; dword ptr [ebp+8]: hInst
; dword ptr [ebp+12]: idResource
; dword ptr [ebp+16]: lpszBuffer
; dword ptr [ebp+20]: cbBuffer
;
public IILoadString16@16
IILoadString16@16:
push ebp
mov ebp,esp
push ecx
sub esp,60
call SMapLS_IP_EBP_8
push eax
call SMapLS_IP_EBP_12
push eax
call SMapLS_IP_EBP_16
push eax
call SMapLS_IP_EBP_20
push eax
call dword ptr [pfnQT_Thunk_CPL32]
shl eax,16
shrd eax,edx,16
call SUnMapLS_IP_EBP_8
call SUnMapLS_IP_EBP_12
call SUnMapLS_IP_EBP_16
call SUnMapLS_IP_EBP_20
leave
retn 16
ELSE
;************************* START OF 16-BIT CODE *************************
OPTION SEGMENT:USE16
.model LARGE,PASCAL
.code
externDef LoadString16:far16
externDef CPlApplet16:far16
externDef GetProcAddress16:far16
externDef FreeLibrary16:far16
externDef LoadLibrary16:far16
FT_CPL32TargetTable label word
dw offset LoadString16
dw seg LoadString16
dw offset CPlApplet16
dw seg CPlApplet16
dw offset GetProcAddress16
dw seg GetProcAddress16
dw offset FreeLibrary16
dw seg FreeLibrary16
dw offset LoadLibrary16
dw seg LoadLibrary16
.data
public CPL32_ThunkData16 ;This symbol must be exported.
CPL32_ThunkData16 dd 3130534ch ;Protocol 'LS01'
dd 0377dh ;Checksum
dw offset FT_CPL32TargetTable
dw seg FT_CPL32TargetTable
dd 0 ;First-time flag.
.code
externDef ThunkConnect16:far16
public CPL32_ThunkConnect16
CPL32_ThunkConnect16:
pop ax
pop dx
push seg CPL32_ThunkData16
push offset CPL32_ThunkData16
push seg CPL32_ThkData32
push offset CPL32_ThkData32
push cs
push dx
push ax
jmp ThunkConnect16
CPL32_ThkData32 label byte
db "CPL32_ThunkData32",0
ENDIF
END