THIPX.ASM 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. ;
  2. ; Command & Conquer Red Alert(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. page ,132
  19. ;Thunk Compiler Version 1.8 May 11 1995 13:16:19
  20. ;File Compiled Fri Jan 26 16:12:04 1996
  21. ;Command Line: C:\BIN\THUNK.EXE Thipx.thk
  22. TITLE $Thipx.asm
  23. .386
  24. OPTION READONLY
  25. OPTION OLDSTRUCTS
  26. IFNDEF IS_16
  27. IFNDEF IS_32
  28. %out command line error: specify one of -DIS_16, -DIS_32
  29. .err
  30. ENDIF ;IS_32
  31. ENDIF ;IS_16
  32. IFDEF IS_32
  33. IFDEF IS_16
  34. %out command line error: you can't specify both -DIS_16 and -DIS_32
  35. .err
  36. ENDIF ;IS_16
  37. ;************************* START OF 32-BIT CODE *************************
  38. .model FLAT,STDCALL
  39. ;-- Import common flat thunk routines (in k32)
  40. externDef MapHInstLS :near32
  41. externDef MapHInstLS_PN :near32
  42. externDef MapHInstSL :near32
  43. externDef MapHInstSL_PN :near32
  44. externDef FT_Prolog :near32
  45. externDef FT_Thunk :near32
  46. externDef QT_Thunk :near32
  47. externDef FT_Exit0 :near32
  48. externDef FT_Exit4 :near32
  49. externDef FT_Exit8 :near32
  50. externDef FT_Exit12 :near32
  51. externDef FT_Exit16 :near32
  52. externDef FT_Exit20 :near32
  53. externDef FT_Exit24 :near32
  54. externDef FT_Exit28 :near32
  55. externDef FT_Exit32 :near32
  56. externDef FT_Exit36 :near32
  57. externDef FT_Exit40 :near32
  58. externDef FT_Exit44 :near32
  59. externDef FT_Exit48 :near32
  60. externDef FT_Exit52 :near32
  61. externDef FT_Exit56 :near32
  62. externDef SMapLS :near32
  63. externDef SUnMapLS :near32
  64. externDef SMapLS_IP_EBP_8 :near32
  65. externDef SUnMapLS_IP_EBP_8 :near32
  66. externDef SMapLS_IP_EBP_12 :near32
  67. externDef SUnMapLS_IP_EBP_12 :near32
  68. externDef SMapLS_IP_EBP_16 :near32
  69. externDef SUnMapLS_IP_EBP_16 :near32
  70. externDef SMapLS_IP_EBP_20 :near32
  71. externDef SUnMapLS_IP_EBP_20 :near32
  72. externDef SMapLS_IP_EBP_24 :near32
  73. externDef SUnMapLS_IP_EBP_24 :near32
  74. externDef SMapLS_IP_EBP_28 :near32
  75. externDef SUnMapLS_IP_EBP_28 :near32
  76. externDef SMapLS_IP_EBP_32 :near32
  77. externDef SUnMapLS_IP_EBP_32 :near32
  78. externDef SMapLS_IP_EBP_36 :near32
  79. externDef SUnMapLS_IP_EBP_36 :near32
  80. externDef SMapLS_IP_EBP_40 :near32
  81. externDef SUnMapLS_IP_EBP_40 :near32
  82. MapSL PROTO NEAR STDCALL p32:DWORD
  83. .code
  84. ;************************* COMMON PER-MODULE ROUTINES *************************
  85. .data
  86. public Thipx_ThunkData32 ;This symbol must be exported.
  87. Thipx_ThunkData32 label dword
  88. dd 3130534ch ;Protocol 'LS01'
  89. dd 0228d3h ;Checksum
  90. dd 0 ;Jump table address.
  91. dd 3130424ch ;'LB01'
  92. dd 0 ;Flags
  93. dd 0 ;Reserved (MUST BE 0)
  94. dd 0 ;Reserved (MUST BE 0)
  95. dd offset QT_Thunk_Thipx - offset Thipx_ThunkData32
  96. dd offset FT_Prolog_Thipx - offset Thipx_ThunkData32
  97. .code
  98. externDef ThunkConnect32@24:near32
  99. public Thipx_ThunkConnect32@16
  100. Thipx_ThunkConnect32@16:
  101. pop edx
  102. push offset Thipx_ThkData16
  103. push offset Thipx_ThunkData32
  104. push edx
  105. jmp ThunkConnect32@24
  106. Thipx_ThkData16 label byte
  107. db "Thipx_ThunkData16",0
  108. pfnQT_Thunk_Thipx dd offset QT_Thunk_Thipx
  109. pfnFT_Prolog_Thipx dd offset FT_Prolog_Thipx
  110. .data
  111. QT_Thunk_Thipx label byte
  112. db 32 dup(0cch) ;Patch space.
  113. FT_Prolog_Thipx label byte
  114. db 32 dup(0cch) ;Patch space.
  115. .code
  116. ;************************ START OF THUNK BODIES************************
  117. ;
  118. public _IPX_Close_Socket95@4
  119. _IPX_Close_Socket95@4:
  120. mov cl,9
  121. jmp II_IPX_Close_Socket95@4
  122. public _IPX_Initialise@4
  123. _IPX_Initialise@4:
  124. mov cl,12
  125. jmp II_IPX_Close_Socket95@4
  126. public _IPX_Open_Socket95@4
  127. _IPX_Open_Socket95@4:
  128. mov cl,10
  129. ; _IPX_Close_Socket95(16) = _IPX_Close_Socket95(32) {}
  130. ;
  131. ; dword ptr [ebp+8]: param1
  132. ;
  133. public II_IPX_Close_Socket95@4
  134. II_IPX_Close_Socket95@4:
  135. push ebp
  136. mov ebp,esp
  137. push ecx
  138. sub esp,60
  139. push word ptr [ebp+8] ;param1: dword->word
  140. call dword ptr [pfnQT_Thunk_Thipx]
  141. cwde
  142. leave
  143. retn 4
  144. ;
  145. public _IPX_Get_Internet_Address95@12
  146. _IPX_Get_Internet_Address95@12:
  147. mov cl,7
  148. ; _IPX_Get_Internet_Address95(16) = _IPX_Get_Internet_Address95(32) {}
  149. ;
  150. ; dword ptr [ebp+8]: param1
  151. ; dword ptr [ebp+12]: netnum
  152. ; dword ptr [ebp+16]: node
  153. ;
  154. public II_IPX_Get_Internet_Address95@12
  155. II_IPX_Get_Internet_Address95@12:
  156. push ebp
  157. mov ebp,esp
  158. push ecx
  159. sub esp,60
  160. push word ptr [ebp+8] ;param1: dword->word
  161. call SMapLS_IP_EBP_12
  162. push eax
  163. call SMapLS_IP_EBP_16
  164. push eax
  165. call dword ptr [pfnQT_Thunk_Thipx]
  166. cwde
  167. call SUnMapLS_IP_EBP_12
  168. call SUnMapLS_IP_EBP_16
  169. leave
  170. retn 12
  171. ;
  172. public _IPX_Get_User_ID95@8
  173. _IPX_Get_User_ID95@8:
  174. mov cl,6
  175. ; _IPX_Get_User_ID95(16) = _IPX_Get_User_ID95(32) {}
  176. ;
  177. ; dword ptr [ebp+8]: param1
  178. ; dword ptr [ebp+12]: user_id
  179. ;
  180. public II_IPX_Get_User_ID95@8
  181. II_IPX_Get_User_ID95@8:
  182. push ebp
  183. mov ebp,esp
  184. push ecx
  185. sub esp,60
  186. push word ptr [ebp+8] ;param1: dword->word
  187. call SMapLS_IP_EBP_12
  188. push eax
  189. call dword ptr [pfnQT_Thunk_Thipx]
  190. cwde
  191. call SUnMapLS_IP_EBP_12
  192. leave
  193. retn 8
  194. ;
  195. public _IPX_Send_Packet95@12
  196. _IPX_Send_Packet95@12:
  197. mov cl,5
  198. ; _IPX_Send_Packet95(16) = _IPX_Send_Packet95(32) {}
  199. ;
  200. ; dword ptr [ebp+8]: address
  201. ; dword ptr [ebp+12]: buffer
  202. ; dword ptr [ebp+16]: param3
  203. ;
  204. public II_IPX_Send_Packet95@12
  205. II_IPX_Send_Packet95@12:
  206. push ebp
  207. mov ebp,esp
  208. push ecx
  209. sub esp,60
  210. call SMapLS_IP_EBP_8
  211. push eax
  212. call SMapLS_IP_EBP_12
  213. push eax
  214. push word ptr [ebp+16] ;param3: dword->word
  215. call dword ptr [pfnQT_Thunk_Thipx]
  216. cwde
  217. call SUnMapLS_IP_EBP_8
  218. call SUnMapLS_IP_EBP_12
  219. leave
  220. retn 12
  221. ;
  222. public _IPX_Broadcast_Packet95@8
  223. _IPX_Broadcast_Packet95@8:
  224. mov cl,4
  225. ; _IPX_Broadcast_Packet95(16) = _IPX_Broadcast_Packet95(32) {}
  226. ;
  227. ; dword ptr [ebp+8]: buffer
  228. ; dword ptr [ebp+12]: param2
  229. ;
  230. public II_IPX_Broadcast_Packet95@8
  231. II_IPX_Broadcast_Packet95@8:
  232. push ebp
  233. mov ebp,esp
  234. push ecx
  235. sub esp,60
  236. call SMapLS_IP_EBP_8
  237. push eax
  238. push word ptr [ebp+12] ;param2: dword->word
  239. call dword ptr [pfnQT_Thunk_Thipx]
  240. cwde
  241. call SUnMapLS_IP_EBP_8
  242. leave
  243. retn 8
  244. ;
  245. public _IPX_Get_Local_Target95@16
  246. _IPX_Get_Local_Target95@16:
  247. mov cl,3
  248. ; _IPX_Get_Local_Target95(16) = _IPX_Get_Local_Target95(32) {}
  249. ;
  250. ; dword ptr [ebp+8]: netnum
  251. ; dword ptr [ebp+12]: node
  252. ; dword ptr [ebp+16]: param3
  253. ; dword ptr [ebp+20]: address
  254. ;
  255. public II_IPX_Get_Local_Target95@16
  256. II_IPX_Get_Local_Target95@16:
  257. push ebp
  258. mov ebp,esp
  259. push ecx
  260. sub esp,60
  261. call SMapLS_IP_EBP_8
  262. push eax
  263. call SMapLS_IP_EBP_12
  264. push eax
  265. push word ptr [ebp+16] ;param3: dword->word
  266. call SMapLS_IP_EBP_20
  267. push eax
  268. call dword ptr [pfnQT_Thunk_Thipx]
  269. cwde
  270. call SUnMapLS_IP_EBP_8
  271. call SUnMapLS_IP_EBP_12
  272. call SUnMapLS_IP_EBP_20
  273. leave
  274. retn 16
  275. ;
  276. public _IPX_Shut_Down95@0
  277. _IPX_Shut_Down95@0:
  278. mov cl,1
  279. jmp II_IPX_Shut_Down95@0
  280. public _IPX_Uninitialise@0
  281. _IPX_Uninitialise@0:
  282. mov cl,11
  283. jmp II_IPX_Shut_Down95@0
  284. public _IPX_Get_Connection_Number95@0
  285. _IPX_Get_Connection_Number95@0:
  286. mov cl,8
  287. jmp II_IPX_Shut_Down95@0
  288. public _IPX_Start_Listening95@0
  289. _IPX_Start_Listening95@0:
  290. mov cl,2
  291. ; _IPX_Shut_Down95(16) = _IPX_Shut_Down95(32) {}
  292. ;
  293. ;
  294. public II_IPX_Shut_Down95@0
  295. II_IPX_Shut_Down95@0:
  296. push ebp
  297. mov ebp,esp
  298. push ecx
  299. sub esp,60
  300. call dword ptr [pfnQT_Thunk_Thipx]
  301. cwde
  302. leave
  303. retn
  304. ;
  305. public _IPX_Get_Outstanding_Buffer95@4
  306. _IPX_Get_Outstanding_Buffer95@4:
  307. mov cl,0
  308. ; _IPX_Get_Outstanding_Buffer95(16) = _IPX_Get_Outstanding_Buffer95(32) {}
  309. ;
  310. ; dword ptr [ebp+8]: buffer
  311. ;
  312. public II_IPX_Get_Outstanding_Buffer95@4
  313. II_IPX_Get_Outstanding_Buffer95@4:
  314. push ebp
  315. mov ebp,esp
  316. push ecx
  317. sub esp,60
  318. call SMapLS_IP_EBP_8
  319. push eax
  320. call dword ptr [pfnQT_Thunk_Thipx]
  321. cwde
  322. call SUnMapLS_IP_EBP_8
  323. leave
  324. retn 4
  325. ELSE
  326. ;************************* START OF 16-BIT CODE *************************
  327. OPTION SEGMENT:USE16
  328. .model LARGE,PASCAL
  329. .code
  330. externDef _IPX_Get_Outstanding_Buffer95:far16
  331. externDef _IPX_Shut_Down95:far16
  332. externDef _IPX_Start_Listening95:far16
  333. externDef _IPX_Get_Local_Target95:far16
  334. externDef _IPX_Broadcast_Packet95:far16
  335. externDef _IPX_Send_Packet95:far16
  336. externDef _IPX_Get_User_ID95:far16
  337. externDef _IPX_Get_Internet_Address95:far16
  338. externDef _IPX_Get_Connection_Number95:far16
  339. externDef _IPX_Close_Socket95:far16
  340. externDef _IPX_Open_Socket95:far16
  341. externDef _IPX_Uninitialise:far16
  342. externDef _IPX_Initialise:far16
  343. FT_ThipxTargetTable label word
  344. dw offset _IPX_Get_Outstanding_Buffer95
  345. dw seg _IPX_Get_Outstanding_Buffer95
  346. dw offset _IPX_Shut_Down95
  347. dw seg _IPX_Shut_Down95
  348. dw offset _IPX_Start_Listening95
  349. dw seg _IPX_Start_Listening95
  350. dw offset _IPX_Get_Local_Target95
  351. dw seg _IPX_Get_Local_Target95
  352. dw offset _IPX_Broadcast_Packet95
  353. dw seg _IPX_Broadcast_Packet95
  354. dw offset _IPX_Send_Packet95
  355. dw seg _IPX_Send_Packet95
  356. dw offset _IPX_Get_User_ID95
  357. dw seg _IPX_Get_User_ID95
  358. dw offset _IPX_Get_Internet_Address95
  359. dw seg _IPX_Get_Internet_Address95
  360. dw offset _IPX_Get_Connection_Number95
  361. dw seg _IPX_Get_Connection_Number95
  362. dw offset _IPX_Close_Socket95
  363. dw seg _IPX_Close_Socket95
  364. dw offset _IPX_Open_Socket95
  365. dw seg _IPX_Open_Socket95
  366. dw offset _IPX_Uninitialise
  367. dw seg _IPX_Uninitialise
  368. dw offset _IPX_Initialise
  369. dw seg _IPX_Initialise
  370. .data
  371. public Thipx_ThunkData16 ;This symbol must be exported.
  372. Thipx_ThunkData16 dd 3130534ch ;Protocol 'LS01'
  373. dd 0228d3h ;Checksum
  374. dw offset FT_ThipxTargetTable
  375. dw seg FT_ThipxTargetTable
  376. dd 0 ;First-time flag.
  377. .code
  378. externDef ThunkConnect16:far16
  379. public Thipx_ThunkConnect16
  380. Thipx_ThunkConnect16:
  381. pop ax
  382. pop dx
  383. push seg Thipx_ThunkData16
  384. push offset Thipx_ThunkData16
  385. push seg Thipx_ThkData32
  386. push offset Thipx_ThkData32
  387. push cs
  388. push dx
  389. push ax
  390. jmp ThunkConnect16
  391. Thipx_ThkData32 label byte
  392. db "Thipx_ThunkData32",0
  393. ENDIF
  394. END