Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

618 lines
13 KiB

  1. page ,132
  2. ;Thunk Compiler Version 1.8 Dec 14 1994 14:53:05
  3. ;File Compiled Thu Apr 01 11:42:56 1999
  4. ;Command Line: d:\projects\cayman\dev\bin\misc\i386\thunk.exe -t thk -o asthkls.asm ..\thk\asthkls.thk
  5. TITLE $asthkls.asm
  6. .386
  7. OPTION READONLY
  8. OPTION OLDSTRUCTS
  9. IFNDEF IS_16
  10. IFNDEF IS_32
  11. %out command line error: specify one of -DIS_16, -DIS_32
  12. .err
  13. ENDIF ;IS_32
  14. ENDIF ;IS_16
  15. IFDEF IS_32
  16. IFDEF IS_16
  17. %out command line error: you can't specify both -DIS_16 and -DIS_32
  18. .err
  19. ENDIF ;IS_16
  20. ;************************* START OF 32-BIT CODE *************************
  21. .model FLAT,STDCALL
  22. ;-- Import common flat thunk routines (in k32)
  23. externDef AllocMappedBuffer :near32
  24. externDef FreeMappedBuffer :near32
  25. externDef MapHInstLS :near32
  26. externDef MapHInstLS_PN :near32
  27. externDef MapHInstSL :near32
  28. externDef MapHInstSL_PN :near32
  29. externDef FT_PrologPrime :near32
  30. externDef FT_Prolog :near32
  31. externDef FT_Thunk :near32
  32. externDef QT_Thunk :near32
  33. externDef QT_ThunkPrime :near32
  34. externDef FT_Exit0 :near32
  35. externDef FT_Exit4 :near32
  36. externDef FT_Exit8 :near32
  37. externDef FT_Exit12 :near32
  38. externDef FT_Exit16 :near32
  39. externDef FT_Exit20 :near32
  40. externDef FT_Exit24 :near32
  41. externDef FT_Exit28 :near32
  42. externDef FT_Exit32 :near32
  43. externDef FT_Exit36 :near32
  44. externDef FT_Exit40 :near32
  45. externDef FT_Exit44 :near32
  46. externDef FT_Exit48 :near32
  47. externDef FT_Exit52 :near32
  48. externDef FT_Exit56 :near32
  49. externDef SMapLS :near32
  50. externDef SUnMapLS :near32
  51. externDef SMapLS_IP_EBP_8 :near32
  52. externDef SUnMapLS_IP_EBP_8 :near32
  53. externDef SMapLS_IP_EBP_12 :near32
  54. externDef SUnMapLS_IP_EBP_12 :near32
  55. externDef SMapLS_IP_EBP_16 :near32
  56. externDef SUnMapLS_IP_EBP_16 :near32
  57. externDef SMapLS_IP_EBP_20 :near32
  58. externDef SUnMapLS_IP_EBP_20 :near32
  59. externDef SMapLS_IP_EBP_24 :near32
  60. externDef SUnMapLS_IP_EBP_24 :near32
  61. externDef SMapLS_IP_EBP_28 :near32
  62. externDef SUnMapLS_IP_EBP_28 :near32
  63. externDef SMapLS_IP_EBP_32 :near32
  64. externDef SUnMapLS_IP_EBP_32 :near32
  65. externDef SMapLS_IP_EBP_36 :near32
  66. externDef SUnMapLS_IP_EBP_36 :near32
  67. externDef SMapLS_IP_EBP_40 :near32
  68. externDef SUnMapLS_IP_EBP_40 :near32
  69. MapLS PROTO NEAR STDCALL :DWORD
  70. UnMapLS PROTO NEAR STDCALL :DWORD
  71. MapSL PROTO NEAR STDCALL p32:DWORD
  72. ;***************** START OF KERNEL32-ONLY SECTION ******************
  73. ; Hacks for kernel32 initialization.
  74. IFDEF FT_DEFINEFTCOMMONROUTINES
  75. .data
  76. public FT_thkTargetTable ;Flat address of target table in 16-bit module.
  77. public FT_thkChecksum32
  78. FT_thkChecksum32 dd 016bddh
  79. ENDIF ;FT_DEFINEFTCOMMONROUTINES
  80. ;***************** END OF KERNEL32-ONLY SECTION ******************
  81. .code
  82. ;************************* COMMON PER-MODULE ROUTINES *************************
  83. .data
  84. ;---------------------------------------------------------------
  85. ;Flat address of target table in 16-bit module name.
  86. ;Filled in by the initial handshaking routine: FT_thkConnectToFlatThkPeer
  87. ;---------------------------------------------------------------
  88. FT_thkTargetTable dd 0 ;Flat address of target table in 16-bit module.
  89. .code
  90. FT_thkDynaName db 'FT_thkThkConnectionData',0
  91. ;------------------------------------------------------------
  92. ;FT_thkConnectToFlatThkPeer:;
  93. ; The 32-bit dll must call this routine once at initialization
  94. ; time. It will load the 16-bit library and fetch the pointers
  95. ; needed to make the flat thunk run.
  96. ;
  97. ; Calling sequence:
  98. ;
  99. ; FT_thkConnectToFlatThkPeer proto near stdcall, dll16:dword, dll32:dword
  100. ;
  101. ; Name16 db 'mumble16.dll',0 ;Name of 16-bit library
  102. ; Name32 db 'mumble32.dll',0 ;Name of 32-bit library
  103. ;
  104. ; invoke FT_thkConnectToFlatThkPeer offset Name16, offset Name32
  105. ; or eax,eax
  106. ; jz failed
  107. ; ;success
  108. ;
  109. ;------------------------------------------------------------
  110. public FT_thkConnectToFlatThkPeer@8
  111. FT_thkConnectToFlatThkPeer@8:
  112. extern ThunkInitLSF@20:near32
  113. pop edx ;Pop return address
  114. push offset 016bddh ;Checksum
  115. push offset FT_thkDynaName ;Symbol exported from peer.
  116. push offset FT_thkTargetTable ;Address of destination.
  117. push edx
  118. jmp ThunkInitLSF@20
  119. pfnQT_Thunk_thk dd offset QT_Thunk_thk
  120. pfnFT_Prolog_thk dd offset FT_Prolog_thk
  121. .data
  122. QT_Thunk_thk db 0ebh, 30
  123. db 30 dup(0cch) ;Patch space.
  124. db 0e8h,0,0,0,0 ;CALL NEAR32 $
  125. db 58h ;POP EAX
  126. db 2dh,32+5,0,0,0 ;SUB EAX, IMM32
  127. db 0bah ;MOV EDX, IMM32
  128. dd offset FT_thkTargetTable - offset QT_Thunk_thk
  129. db 068h ;PUSH IMM32
  130. dd offset QT_ThunkPrime
  131. db 0c3h ;RETN
  132. FT_Prolog_thk db 0ebh, 30
  133. db 30 dup(0cch) ;Patch space.
  134. db 0e8h,0,0,0,0 ;CALL NEAR32 $
  135. db 5ah ;POP EDX
  136. db 81h,0eah, 32+5,0,0,0 ;SUB EDX, IMM32
  137. db 52h ;PUSH EDX
  138. db 068h ;PUSH IMM32
  139. dd offset FT_thkTargetTable - offset FT_Prolog_thk
  140. db 068h ;PUSH IMM32
  141. dd offset FT_PrologPrime
  142. db 0c3h ;RETN
  143. .code
  144. ebp_top equ <[ebp + 8]> ;First api parameter
  145. ebp_retval equ <[ebp + -64]> ;Api return value
  146. FT_ESPFIXUP macro dwSpOffset
  147. or dword ptr [ebp + -20], 1 SHL ((dwSpOffset) SHR 1)
  148. endm
  149. ebp_qttop equ <[ebp + 8]>
  150. include fltthk.inc ;Support definitions
  151. include asthkls.inc
  152. ;************************ START OF THUNK BODIES************************
  153. ;
  154. public OSILoad16@4
  155. OSILoad16@4:
  156. FAPILOG16 270
  157. mov cl,11
  158. ; OSILoad16(16) = OSILoad16(32) {}
  159. ;
  160. ; dword ptr [ebp+8]: phInstance
  161. ;
  162. public IIOSILoad16@4
  163. IIOSILoad16@4:
  164. push ebp
  165. mov ebp,esp
  166. push ecx
  167. sub esp,60
  168. call SMapLS_IP_EBP_8
  169. push eax
  170. call dword ptr [pfnQT_Thunk_thk]
  171. call SUnMapLS_IP_EBP_8
  172. leave
  173. retn 4
  174. ;
  175. public OSIInit16@36
  176. OSIInit16@36:
  177. FAPILOG16 256
  178. mov cl,10
  179. ; OSIInit16(16) = OSIInit16(32) {}
  180. ;
  181. ; dword ptr [ebp+8]: version
  182. ; dword ptr [ebp+12]: hwnd
  183. ; dword ptr [ebp+16]: atom
  184. ; dword ptr [ebp+20]: ppShared
  185. ; dword ptr [ebp+24]: ppoaShared
  186. ; dword ptr [ebp+28]: pimShared
  187. ; dword ptr [ebp+32]: psbcEnabled
  188. ; dword ptr [ebp+36]: psbcShunt
  189. ; dword ptr [ebp+40]: pBitmasks
  190. ;
  191. public IIOSIInit16@36
  192. IIOSIInit16@36:
  193. push ebp
  194. mov ebp,esp
  195. push ecx
  196. sub esp,60
  197. push dword ptr [ebp+8] ;version: dword->dword
  198. push word ptr [ebp+12] ;hwnd: dword->word
  199. push word ptr [ebp+16] ;atom: dword->word
  200. call SMapLS_IP_EBP_20
  201. push eax
  202. call SMapLS_IP_EBP_24
  203. push eax
  204. call SMapLS_IP_EBP_28
  205. push eax
  206. call SMapLS_IP_EBP_32
  207. push eax
  208. call SMapLS_IP_EBP_36
  209. push eax
  210. call SMapLS_IP_EBP_40
  211. push eax
  212. call dword ptr [pfnQT_Thunk_thk]
  213. cwde
  214. call SUnMapLS_IP_EBP_20
  215. call SUnMapLS_IP_EBP_24
  216. call SUnMapLS_IP_EBP_28
  217. call SUnMapLS_IP_EBP_32
  218. call SUnMapLS_IP_EBP_36
  219. call SUnMapLS_IP_EBP_40
  220. leave
  221. retn 36
  222. ;
  223. public OSITerm16@4
  224. OSITerm16@4:
  225. FAPILOG16 242
  226. mov cl,9
  227. ; OSITerm16(16) = OSITerm16(32) {}
  228. ;
  229. ; dword ptr [ebp+8]: fUnloading
  230. ;
  231. public IIOSITerm16@4
  232. IIOSITerm16@4:
  233. push ebp
  234. mov ebp,esp
  235. push ecx
  236. sub esp,60
  237. push word ptr [ebp+8] ;fUnloading: dword->word
  238. call dword ptr [pfnQT_Thunk_thk]
  239. leave
  240. retn 4
  241. ;
  242. public OSIFunctionRequest16@12
  243. OSIFunctionRequest16@12:
  244. FAPILOG16 217
  245. mov cl,8
  246. ; OSIFunctionRequest16(16) = OSIFunctionRequest16(32) {}
  247. ;
  248. ; dword ptr [ebp+8]: escape
  249. ; dword ptr [ebp+12]: lpvEsc
  250. ; dword ptr [ebp+16]: cbEsc
  251. ;
  252. public IIOSIFunctionRequest16@12
  253. IIOSIFunctionRequest16@12:
  254. push ebp
  255. mov ebp,esp
  256. push ecx
  257. sub esp,60
  258. push dword ptr [ebp+8] ;escape: dword->dword
  259. call SMapLS_IP_EBP_12
  260. push eax
  261. push dword ptr [ebp+16] ;cbEsc: dword->dword
  262. call dword ptr [pfnQT_Thunk_thk]
  263. cwde
  264. call SUnMapLS_IP_EBP_12
  265. leave
  266. retn 12
  267. ;
  268. public OSIStartWindowTracking16@0
  269. OSIStartWindowTracking16@0:
  270. FAPILOG16 188
  271. mov cl,7
  272. ; OSIStartWindowTracking16(16) = OSIStartWindowTracking16(32) {}
  273. ;
  274. ;
  275. public IIOSIStartWindowTracking16@0
  276. IIOSIStartWindowTracking16@0:
  277. push ebp
  278. mov ebp,esp
  279. push ecx
  280. sub esp,60
  281. call dword ptr [pfnQT_Thunk_thk]
  282. cwde
  283. leave
  284. retn
  285. ;
  286. public OSIStopWindowTracking16@0
  287. OSIStopWindowTracking16@0:
  288. FAPILOG16 160
  289. mov cl,6
  290. ; OSIStopWindowTracking16(16) = OSIStopWindowTracking16(32) {}
  291. ;
  292. ;
  293. public IIOSIStopWindowTracking16@0
  294. IIOSIStopWindowTracking16@0:
  295. push ebp
  296. mov ebp,esp
  297. push ecx
  298. sub esp,60
  299. call dword ptr [pfnQT_Thunk_thk]
  300. leave
  301. retn
  302. ;
  303. public OSIShareWindow16@16
  304. OSIShareWindow16@16:
  305. FAPILOG16 139
  306. mov cl,5
  307. ; OSIShareWindow16(16) = OSIShareWindow16(32) {}
  308. ;
  309. ; dword ptr [ebp+8]: hwnd
  310. ; dword ptr [ebp+12]: uType
  311. ; dword ptr [ebp+16]: fRedraw
  312. ; dword ptr [ebp+20]: fUpdate
  313. ;
  314. public IIOSIShareWindow16@16
  315. IIOSIShareWindow16@16:
  316. push ebp
  317. mov ebp,esp
  318. push ecx
  319. sub esp,60
  320. push word ptr [ebp+8] ;hwnd: dword->word
  321. push word ptr [ebp+12] ;uType: dword->word
  322. push word ptr [ebp+16] ;fRedraw: dword->word
  323. push word ptr [ebp+20] ;fUpdate: dword->word
  324. call dword ptr [pfnQT_Thunk_thk]
  325. cwde
  326. leave
  327. retn 16
  328. ;
  329. public OSIIsWindowScreenSaver16@4
  330. OSIIsWindowScreenSaver16@4:
  331. FAPILOG16 87
  332. mov cl,3
  333. ; OSIIsWindowScreenSaver16(16) = OSIIsWindowScreenSaver16(32) {}
  334. ;
  335. ; dword ptr [ebp+8]: hwnd
  336. ;
  337. public IIOSIIsWindowScreenSaver16@4
  338. IIOSIIsWindowScreenSaver16@4:
  339. push ebp
  340. mov ebp,esp
  341. push ecx
  342. sub esp,60
  343. push word ptr [ebp+8] ;hwnd: dword->word
  344. call dword ptr [pfnQT_Thunk_thk]
  345. cwde
  346. leave
  347. retn 4
  348. ;
  349. public OSIInstallControlledHooks16@8
  350. OSIInstallControlledHooks16@8:
  351. FAPILOG16 55
  352. mov cl,2
  353. jmp IIOSIInstallControlledHooks16@8
  354. public OSIUnshareWindow16@8
  355. OSIUnshareWindow16@8:
  356. FAPILOG16 116
  357. mov cl,4
  358. ; OSIInstallControlledHooks16(16) = OSIInstallControlledHooks16(32) {}
  359. ;
  360. ; dword ptr [ebp+8]: fInstall
  361. ; dword ptr [ebp+12]: fDesktop
  362. ;
  363. public IIOSIInstallControlledHooks16@8
  364. IIOSIInstallControlledHooks16@8:
  365. push ebp
  366. mov ebp,esp
  367. push ecx
  368. sub esp,60
  369. push word ptr [ebp+8] ;fInstall: dword->word
  370. push word ptr [ebp+12] ;fDesktop: dword->word
  371. call dword ptr [pfnQT_Thunk_thk]
  372. cwde
  373. leave
  374. retn 8
  375. ;
  376. public OSIInjectMouseEvent16@20
  377. OSIInjectMouseEvent16@20:
  378. FAPILOG16 29
  379. mov cl,1
  380. ; OSIInjectMouseEvent16(16) = OSIInjectMouseEvent16(32) {}
  381. ;
  382. ; dword ptr [ebp+8]: param1
  383. ; dword ptr [ebp+12]: param2
  384. ; dword ptr [ebp+16]: param3
  385. ; dword ptr [ebp+20]: param4
  386. ; dword ptr [ebp+24]: param5
  387. ;
  388. public IIOSIInjectMouseEvent16@20
  389. IIOSIInjectMouseEvent16@20:
  390. push ebp
  391. mov ebp,esp
  392. push ecx
  393. sub esp,60
  394. push word ptr [ebp+8] ;param1: dword->word
  395. push word ptr [ebp+12] ;param2: dword->word
  396. push word ptr [ebp+16] ;param3: dword->word
  397. push word ptr [ebp+20] ;param4: dword->word
  398. push dword ptr [ebp+24] ;param5: dword->dword
  399. call dword ptr [pfnQT_Thunk_thk]
  400. leave
  401. retn 20
  402. ;
  403. public OSIInjectKeyboardEvent16@16
  404. OSIInjectKeyboardEvent16@16:
  405. FAPILOG16 0
  406. mov cl,0
  407. ; OSIInjectKeyboardEvent16(16) = OSIInjectKeyboardEvent16(32) {}
  408. ;
  409. ; dword ptr [ebp+8]: param1
  410. ; dword ptr [ebp+12]: param2
  411. ; dword ptr [ebp+16]: param3
  412. ; dword ptr [ebp+20]: param4
  413. ;
  414. public IIOSIInjectKeyboardEvent16@16
  415. IIOSIInjectKeyboardEvent16@16:
  416. push ebp
  417. mov ebp,esp
  418. push ecx
  419. sub esp,60
  420. push word ptr [ebp+8] ;param1: dword->word
  421. push word ptr [ebp+12] ;param2: dword->word
  422. push word ptr [ebp+16] ;param3: dword->word
  423. push dword ptr [ebp+20] ;param4: dword->dword
  424. call dword ptr [pfnQT_Thunk_thk]
  425. leave
  426. retn 16
  427. ;-----------------------------------------------------------
  428. ifdef DEBUG
  429. FT_ThunkLogNames label byte
  430. db '[F] OSIInjectKeyboardEvent16',0
  431. db '[F] OSIInjectMouseEvent16',0
  432. db '[F] OSIInstallControlledHooks16',0
  433. db '[F] OSIIsWindowScreenSaver16',0
  434. db '[F] OSIUnshareWindow16',0
  435. db '[F] OSIShareWindow16',0
  436. db '[F] OSIStopWindowTracking16',0
  437. db '[F] OSIStartWindowTracking16',0
  438. db '[F] OSIFunctionRequest16',0
  439. db '[F] OSITerm16',0
  440. db '[F] OSIInit16',0
  441. db '[F] OSILoad16',0
  442. endif ;DEBUG
  443. ;-----------------------------------------------------------
  444. ELSE
  445. ;************************* START OF 16-BIT CODE *************************
  446. OPTION SEGMENT:USE16
  447. .model LARGE,PASCAL
  448. .code
  449. externDef OSIInjectKeyboardEvent16:far16
  450. externDef OSIInjectMouseEvent16:far16
  451. externDef OSIInstallControlledHooks16:far16
  452. externDef OSIIsWindowScreenSaver16:far16
  453. externDef OSIUnshareWindow16:far16
  454. externDef OSIShareWindow16:far16
  455. externDef OSIStopWindowTracking16:far16
  456. externDef OSIStartWindowTracking16:far16
  457. externDef OSIFunctionRequest16:far16
  458. externDef OSITerm16:far16
  459. externDef OSIInit16:far16
  460. externDef OSILoad16:far16
  461. FT_thkTargetTable label word
  462. dw offset OSIInjectKeyboardEvent16
  463. dw seg OSIInjectKeyboardEvent16
  464. dw offset OSIInjectMouseEvent16
  465. dw seg OSIInjectMouseEvent16
  466. dw offset OSIInstallControlledHooks16
  467. dw seg OSIInstallControlledHooks16
  468. dw offset OSIIsWindowScreenSaver16
  469. dw seg OSIIsWindowScreenSaver16
  470. dw offset OSIUnshareWindow16
  471. dw seg OSIUnshareWindow16
  472. dw offset OSIShareWindow16
  473. dw seg OSIShareWindow16
  474. dw offset OSIStopWindowTracking16
  475. dw seg OSIStopWindowTracking16
  476. dw offset OSIStartWindowTracking16
  477. dw seg OSIStartWindowTracking16
  478. dw offset OSIFunctionRequest16
  479. dw seg OSIFunctionRequest16
  480. dw offset OSITerm16
  481. dw seg OSITerm16
  482. dw offset OSIInit16
  483. dw seg OSIInit16
  484. dw offset OSILoad16
  485. dw seg OSILoad16
  486. ; The following symbol must be exported in the .def file.
  487. public FT_thkThkConnectionData
  488. FT_thkThkConnectionData label dword
  489. dd 016bddh ;Checksum
  490. dw offset FT_thkTargetTable
  491. dw seg FT_thkTargetTable
  492. ENDIF
  493. END