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.

6289 lines
226 KiB

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;
  3. ;; Copyright (c) 1998-2000 Microsoft Corporation
  4. ;;
  5. ;; Module Name:
  6. ;;
  7. ;; whwin32.tpl
  8. ;;
  9. ;; Abstract:
  10. ;;
  11. ;; This template defines the thunks for the Win32 api set.
  12. ;;
  13. ;; Author:
  14. ;;
  15. ;; 6-Oct-98 mzoran
  16. ;;
  17. ;; Revision History:
  18. ;; 5-Apr-2000 samera Thunk implementation for NtUserRawInput APIs.
  19. ;;
  20. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  21. [Macros]
  22. MacroName=CallNameFromApiName
  23. NumArgs=1
  24. Begin=
  25. @ApiName
  26. End=
  27. MacroName=ValidatecbSize
  28. NumArgs=0
  29. Begin=
  30. if (WOW64_ISPTR(@ArgHostName) && ((@ArgHostTypeInd *)(@ArgHostName))->cbSize != sizeof(@ArgHostTypeInd)) { @Indent( @NL
  31. LOGPRINT((ERRORLOG, "@ApiName: @ArgType: An cbSize of %x was passed to API, but %x was expected\n",
  32. sizeof(@ArgHostTypeInd), ((@ArgHostTypeInd *)(@ArgHostName))->cbSize)); @NL
  33. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  34. )} @NL
  35. End=
  36. [Types]
  37. ;; These types must be handled manually
  38. TemplateName=LPARAM
  39. Also=WPARAM
  40. Also=MSG
  41. Also=PMSG
  42. Also=NPMSG
  43. Also=LPMSG
  44. Locals=
  45. #error @ArgType must be handled manually. @NL
  46. End=
  47. PreCall=
  48. #error @ArgType must be handled manually. @NL
  49. End=
  50. PostCall=
  51. #error @ArgType must be handled manually. @NL
  52. End=
  53. TemplateName=KERNEL_PVOID
  54. Also=KLPWSTR
  55. Also=KLPSTR
  56. Also=KHBITMAP
  57. IndLevel=0
  58. Direction=IN
  59. PreCall=
  60. @ArgName = (KERNEL_PVOID)UlongToPtr (@ArgHostName);
  61. End=
  62. TemplateName=KERNEL_PVOID
  63. Also=KLPWSTR
  64. Also=KLPSTR
  65. Also=KHBITMAP
  66. IndLevel=0
  67. Direction=IN OUT
  68. PreCall=
  69. @ArgName = (KERNEL_PVOID)UlongToPtr (@ArgHostName);
  70. End=
  71. PostCall=
  72. @ArgHostName = PtrToUlong (@ArgName);
  73. End=
  74. TemplateName=RAWINPUTHEADER
  75. IndLevel=0
  76. Direction=OUT
  77. NoType=wParam
  78. Locals=
  79. @StructLocal
  80. End=
  81. PreCall=
  82. @StructIN
  83. @ArgName.wParam = @ArgHostName.wParam;
  84. End=
  85. PostCall=
  86. @StructOUT
  87. @ArgHostName.wParam = (NT32WPARAM)@ArgName.wParam;
  88. End=
  89. TemplateName=PRAWINPUTHEADER
  90. IndLevel=0
  91. Direction=OUT
  92. NoType=wParam
  93. Locals=
  94. @StructPtrLocal
  95. End=
  96. PreCall=
  97. @StructPtrIN
  98. @ArgName.wParam = @ArgHostName.wParam;
  99. End=
  100. PostCall=
  101. @StructPtrOUT
  102. @ArgHostName->wParam = (NT32WPARAM)@ArgName->wParam;
  103. End=
  104. TemplateName=PRAWINPUTDEVICE
  105. IndLevel=0
  106. Direction=IN
  107. Locals=
  108. @StructPtrLocal
  109. End=
  110. PreCall=
  111. @StructPtrIN
  112. End=
  113. PostCall=
  114. @StructPtrOUT
  115. End=
  116. TemplateName=LPGCP_RESULTSW
  117. IndLevel=0
  118. Direction=IN OUT
  119. Locals=
  120. // @ArgName(@ArgType) in a IN OUT LPGCP_RESULTSW @NL
  121. @TypeStructPtrINOUTLocal
  122. End=
  123. PreCall=
  124. // @ArgName(@ArgType) in a IN OUT LPGCP_RESULTSW @NL
  125. @TypeStructPtrINOUTPreCall
  126. // The size really needs to be verified, but NtGdiGetCharacterPlacementW @NL
  127. // is not verifying it. To maintain maximal compatibility, it won't to verified @NL
  128. // here either. @NL
  129. // if (WOW64_ISPTR(@ArgName)) {
  130. // if(@ArgName->lStructSize != sizeof(NT32GCP_RESULTSW)) {
  131. // RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  132. // } @NL
  133. // } @NL
  134. End=
  135. PostCall=
  136. // @ArgName(@ArgType) in a IN OUT LPGCP_RESULTSW @NL
  137. @TypeStructPtrINOUTPostCall
  138. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  139. WOWASSERT(@ArgName->lStructSize == sizeof(GCP_RESULTSW)); @NL
  140. ((NT32GCP_RESULTSW *)(@ArgHostName))->lStructSize = sizeof(NT32GCP_RESULTSW); @NL
  141. )} @NL
  142. End=
  143. TemplateName=PCURSORDATA
  144. IndLevel=0
  145. Direction=IN
  146. NoType=aspcur
  147. NoType=aicur
  148. NoType=ajifRate
  149. Locals=
  150. @TypeStructPtrINLocal
  151. End=
  152. PreCall=
  153. @TypeStructPtrINPreCall @NL
  154. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  155. SIZE_T cbData; @NL
  156. PVOID Data; @NL
  157. SIZE_T i; @NL
  158. NT32CURSORDATA *SrcCursorData; @NL
  159. PCURSORDATA DstCursorData; @NL
  160. NT32HCURSOR *SrcCursor; @NL
  161. HCURSOR *DstCursor; @NL
  162. @NL
  163. SrcCursorData = (NT32CURSORDATA *)@ArgHostName; @NL
  164. DstCursorData = (PCURSORDATA)@ArgName; @NL
  165. @NL
  166. if (SrcCursorData->CURSORF_flags & CURSORF_ACON) { @Indent( @NL
  167. // The kernel makes several checks that the data is small enough @NL
  168. // and all in the buffer. @NL
  169. // Repeat those checks here. @NL
  170. if (HIWORD(SrcCursorData->cpcur) | HIWORD(SrcCursorData->cicur)) { @Indent( @NL
  171. LOGPRINT((ERRORLOG, "@ApiName PCURSOR: Invalid PCURSOR\n")); @NL
  172. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  173. )} @NL
  174. if (((PVOID)SrcCursorData->aspcur == NULL) || @NL
  175. ((INT_PTR)SrcCursorData->ajifRate != (INT_PTR)(SrcCursorData->cpcur * sizeof(NT32HCURSOR))) || @NL
  176. ((INT_PTR)SrcCursorData->aicur != (INT_PTR)(SrcCursorData->ajifRate @NL
  177. + SrcCursorData->cicur * sizeof(NT32JIF)))) { @Indent(@NL
  178. LOGPRINT((ERRORLOG, "@ApiName PCURSOR: Invalid PCURSOR\n")); @NL
  179. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  180. )} @NL
  181. cbData = (SrcCursorData->cpcur * sizeof(HCURSOR)) + @NL
  182. (SrcCursorData->cicur * sizeof(JIF)) + @NL
  183. (SrcCursorData->cicur * sizeof(DWORD)); @NL
  184. Data = Wow64AllocateTemp(cbData); @NL
  185. // @NL
  186. // Initialize array offsets and sizes. @NL
  187. // @NL
  188. DstCursorData->cpcur = SrcCursorData->cpcur; @NL
  189. DstCursorData->cicur = SrcCursorData->cicur; @NL
  190. DstCursorData->aspcur = (PCURSOR *)Data; @NL
  191. // Even though these two fields are declared as pointers, they are @NL
  192. // actually passed to the kernel as offsets from the pointer in aspcur. @NL
  193. DstCursorData->ajifRate = (PJIF)(DstCursorData->cpcur * sizeof(HCURSOR)); @NL
  194. DstCursorData->aicur = (DWORD *)((PBYTE)DstCursorData->ajifRate + (DstCursorData->cicur * sizeof(JIF))); @NL
  195. // @NL
  196. // Copy data. @NL
  197. // @NL
  198. SrcCursor = (NT32HCURSOR *)SrcCursorData->aspcur; @NL
  199. DstCursor = (HCURSOR *)Data; @NL
  200. for(i=0; i < SrcCursorData->cpcur; i++) { @Indent( @NL
  201. DstCursor[i] = (HCURSOR)SrcCursor[i]; @NL
  202. }) @NL
  203. // These arrays are not pointer dependent. @NL
  204. WOWASSERT(sizeof(JIF) == sizeof(NT32JIF)); @NL
  205. RtlCopyMemory((PBYTE)DstCursor + (INT_PTR)DstCursorData->ajifRate, @NL
  206. (PBYTE)SrcCursor + (INT_PTR)SrcCursorData->ajifRate, @NL
  207. sizeof(JIF) * DstCursorData->cicur); @NL
  208. @NL
  209. WOWASSERT(sizeof(DWORD) == sizeof(NT32DWORD)); @NL
  210. RtlCopyMemory((PBYTE)DstCursor + (INT_PTR)DstCursorData->aicur, @NL
  211. (PBYTE)SrcCursor + (INT_PTR)SrcCursorData->aicur, @NL
  212. sizeof(DWORD) * DstCursorData->cicur); @NL
  213. @NL
  214. )} @NL
  215. else { @Indent( @NL
  216. DstCursorData->aspcur = (PCURSOR *)NULL; @NL
  217. DstCursorData->ajifRate = (PJIF)NULL; @NL
  218. DstCursorData->aicur = (DWORD *)NULL; @NL
  219. DstCursorData->cpcur = 0; @NL
  220. DstCursorData->cicur = 0; @NL
  221. )} @NL
  222. )} @NL
  223. End=
  224. PostCall=
  225. @TypeStructPtrINPostCall @NL
  226. End=
  227. TemplateName=PCURSORFIND
  228. NoType=hcur
  229. IndLevel=0
  230. Direction=IN
  231. Locals=
  232. @TypeStructPtrINLocal
  233. End=
  234. PreCall=
  235. @TypeStructPtrINPreCall
  236. //Align structure from 32bit apps. wow64 version of win32k.sys might be fixed to align the buffer @NL
  237. if (@ArgName != (@ArgType)@ArgHostName ) { @NL
  238. LARGE_INTEGER Temp = *(UNALIGNED LARGE_INTEGER *)&(((struct NT32tagCURSORFIND *)(@ArgHostName))->hcur); @NL
  239. @ArgName->hcur = *(KHCURSOR *) &Temp; @NL
  240. } @NL
  241. End=
  242. PostCall=
  243. End=
  244. TemplateName=PCLSMENUNAME
  245. NoType=pszClientAnsiMenuName
  246. NoType=pwszClientUnicodeMenuName
  247. IndLevel=0
  248. Direction=IN
  249. Locals=
  250. @TypeStructPtrINLocal
  251. End=
  252. PreCall=
  253. @TypeStructPtrINPreCall
  254. //Align structure from 32bit apps. wow64 version of win32k.sys might be fixed to align the buffer @NL
  255. if (@ArgName != (@ArgType)@ArgHostName ) { @NL
  256. LARGE_INTEGER Temp = *(UNALIGNED LARGE_INTEGER *)&(((struct NT32tagCLSMENUNAME *)(@ArgHostName))->pszClientAnsiMenuName); @NL
  257. @ArgName->pszClientAnsiMenuName = *(KLPSTR *) &Temp; @NL
  258. Temp = *(UNALIGNED LARGE_INTEGER *)&(((struct NT32tagCLSMENUNAME *)(@ArgHostName))->pwszClientUnicodeMenuName); @NL
  259. @ArgName->pwszClientUnicodeMenuName = *(KLPWSTR *) &Temp; @NL
  260. } @NL
  261. End=
  262. PostCall=
  263. End=
  264. TemplateName=PCLSMENUNAME
  265. NoType=pusMenuName
  266. IndLevel=0
  267. Direction=OUT
  268. Locals=
  269. @TypeStructPtrOUTLocal
  270. End=
  271. PreCall=
  272. @TypeStructPtrOUTPreCall
  273. End=
  274. PostCall=
  275. @TypeStructPtrOUTPostCall
  276. // The only API's to use this type as an out param are @NL
  277. // NtUserUnregisterClass and NtUserSetClassLong. @NL
  278. // These APIs always returns NULL in the pusMenuName field(except when the API fails). @NL
  279. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  280. ((NT32CLSMENUNAME*)(@ArgHostName))->pusMenuName = (NT32PUNICODE_STRING)NULL; @NL
  281. )} @NL
  282. End=
  283. TemplateName=PCLSMENUNAME
  284. NoType=pusMenuName
  285. IndLevel=0
  286. Direction=IN OUT
  287. Locals=
  288. UNICODE_STRING @ArgVal_pusMenuNameCopy; @NL
  289. @TypeStructPtrINOUTLocal
  290. End=
  291. PreCall=
  292. @TypeStructPtrINOUTPreCall
  293. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  294. if (WOW64_ISPTR(((NT32CLSMENUNAME*)(@ArgHostName))->pusMenuName)) {
  295. Wow64ShallowThunkUnicodeString32TO64(&@ArgVal_pusMenuNameCopy, ((NT32CLSMENUNAME*)(@ArgHostName))->pusMenuName); @NL
  296. @ArgName->pusMenuName = &@ArgVal_pusMenuNameCopy;
  297. }
  298. else {
  299. @ArgName->pusMenuName = NULL;
  300. }
  301. }
  302. End=
  303. PostCall=
  304. @TypeStructPtrINOUTPostCall
  305. // The only API's to use this type as an IN OUT param is NtUserSetClassLong. @NL
  306. // This APIs always returns NULL in the pusMenuName field(Except when the API fails). @NL
  307. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  308. ((NT32CLSMENUNAME*)(@ArgHostName))->pusMenuName = (NT32PUNICODE_STRING)NULL; @NL
  309. )} @NL
  310. End=
  311. TemplateName=GUID
  312. IndLevel=0
  313. PreCall=
  314. RtlCopyMemory(&@ArgName, &@ArgHostName, sizeof(GUID)); @NL
  315. End=
  316. PostCall=
  317. RtlCopyMemory(&@ArgHostName, &@ArgName, sizeof(GUID)); @NL
  318. End=
  319. TemplateName=HKL
  320. IndLevel=0
  321. Direction=IN OUT
  322. PreCall=
  323. @ArgName=(HKL)(LongToPtr(@ArgHostName)); @NL
  324. End=
  325. PostCall=
  326. @ArgHostName=(NT32HKL)(@ArgName); @NL
  327. End=
  328. TemplateName=HKL
  329. IndLevel=0
  330. Direction=IN
  331. PreCall=
  332. @ArgName=(HKL)(LongToPtr(@ArgHostName)); @NL
  333. End=
  334. TemplateName=LPVIDEOMEMORY
  335. IndLevel=0
  336. NoType=lpHeap
  337. Locals=
  338. @TypeStructPtrINOUTLocal
  339. End=
  340. PreCall=
  341. @TypeStructPtrINOUTPreCall
  342. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  343. @ArgName->lpHeap = (struct _VMEMHEAP *)((struct NT32_VIDEOMEMORY *)(@ArgHostName))->lpHeap; @NL
  344. } @NL
  345. End=
  346. PostCall=
  347. @TypeStructPtrINOUTPostCall
  348. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  349. ((struct NT32_VIDEOMEMORY *)(@ArgHostName))->lpHeap = (__int32)(@ArgName->lpHeap); @NL
  350. } @NL
  351. End=
  352. TemplateName=VIDEOMEMORY
  353. IndLevel=1
  354. NoType=lpHeap
  355. Locals=
  356. @TypeStructPtrINOUTLocal
  357. End=
  358. PreCall=
  359. @TypeStructPtrINOUTPreCall
  360. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  361. @ArgName->lpHeap = (struct _VMEMHEAP *)((struct NT32_VIDEOMEMORY *)(@ArgHostName))->lpHeap; @NL
  362. } @NL
  363. End=
  364. PostCall=
  365. @TypeStructPtrINOUTPostCall
  366. if (WOW64_ISPTR(@ArgHostName)) { @Indent( @NL
  367. ((struct NT32_VIDEOMEMORY *)(@ArgHostName))->lpHeap = (__int32)(@ArgName->lpHeap); @NL
  368. } @NL
  369. End=
  370. TemplateName=DD_SURFACE_GLOBAL
  371. IndLevel=1
  372. NoType=lpVidMemHeap
  373. PostCall=
  374. @TypeStructPtrINOUTPostCall
  375. if (WOW64_ISPTR(@ArgName)) { @NL
  376. ((struct NT32_DD_SURFACE_GLOBAL *)@ArgHostName)->dwUserMemSize = @ArgName->dwUserMemSize; @NL
  377. } @NL
  378. End=
  379. TemplateName=PFLASHWINFO
  380. IndLevel=0
  381. Direction=IN
  382. Locals=
  383. @TypeStructPtrINLocal
  384. End=
  385. PreCall=
  386. @ValidatecbSize
  387. @TypeStructPtrINPreCall
  388. // Do Extra thunking. @NL
  389. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  390. @ArgName->cbSize = sizeof(FLASHWINFO); @NL
  391. )}
  392. End=
  393. PostCall=
  394. @TypeStructPtrINPostCall
  395. End=
  396. TemplateName=LPTRACKMOUSEEVENT
  397. IndLevel=0
  398. Direction=IN OUT
  399. Locals=
  400. @TypeStructPtrINOUTLocal
  401. End=
  402. PreCall=
  403. @ValidatecbSize
  404. @TypeStructPtrINOUTPreCall
  405. // Do Extra thunking. @NL
  406. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  407. @ArgName->cbSize = sizeof(TRACKMOUSEEVENT); @NL
  408. )}
  409. End=
  410. PostCall=
  411. @TypeStructPtrINPostCall
  412. End=
  413. TemplateName=LPMENUINFO
  414. IndLevel=0
  415. Direction=IN
  416. NoType=dwMenuData
  417. Locals=
  418. @TypeStructPtrINLocal
  419. End=
  420. PreCall=
  421. @ValidatecbSize
  422. @TypeStructPtrINPreCall
  423. // Do Extra thunking. @NL
  424. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  425. @ArgName->cbSize = sizeof(MENUINFO); @NL
  426. //dwMenuData is simply a storage locatation for application data. The kernel does not @NL
  427. //look at it. This means the sign extension is irrelevant.@NL
  428. @ArgName->dwMenuData = (ULONG_PTR)((NT32MENUINFO *)(@ArgHostName))->dwMenuData; @NL
  429. )}
  430. End=
  431. PostCall=
  432. @TypeStructPtrINPostCall
  433. End=
  434. TemplateName=WNDCLASSEX
  435. IndLevel=1
  436. Direction=IN
  437. Locals=
  438. @TypeStructPtrINLocal
  439. PWCHAR pwchClassName, pwchMenuName;
  440. End=
  441. PreCall=
  442. @ValidatecbSize
  443. @TypeStructPtrINPreCall
  444. // Do Extra thunking. @NL
  445. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  446. SIZE_T Length; @NL
  447. @ArgName->cbSize = sizeof(WNDCLASSEX); @NL
  448. try { @NL
  449. if ((PtrToUlong(@ArgName->lpszClassName) & (sizeof(WCHAR)-1)) != 0) { @NL
  450. @NL
  451. if (ID(@ArgName->lpszClassName) == 0) { @NL
  452. Length = wcslen(@ArgName->lpszClassName); @NL
  453. Length <<= 1; @NL
  454. Length += sizeof(UNICODE_NULL); @NL
  455. pwchClassName = Wow64AllocateTemp(Length); @NL
  456. RtlCopyMemory(pwchClassName, @ArgName->lpszClassName, Length); @NL
  457. @ArgName->lpszClassName = pwchClassName; @NL
  458. }
  459. } @NL
  460. if ((PtrToUlong(@ArgName->lpszMenuName) & (sizeof(WCHAR)-1)) != 0) { @NL
  461. @NL
  462. if (ID(@ArgName->lpszMenuName) == 0) { @NL
  463. Length = wcslen(@ArgName->lpszMenuName); @NL
  464. Length <<= 1; @NL
  465. Length += sizeof(UNICODE_NULL); @NL
  466. pwchMenuName = Wow64AllocateTemp(Length); @NL
  467. RtlCopyMemory(pwchMenuName, @ArgName->lpszMenuName, Length); @NL
  468. @ArgName->lpszMenuName = pwchMenuName; @NL
  469. } @NL
  470. } @NL
  471. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  472. } @NL
  473. )}
  474. End=
  475. PostCall=
  476. @TypeStructPtrINPostCall
  477. End=
  478. TemplateName=WNDCLASSEX
  479. IndLevel=1
  480. Direction=IN OUT
  481. Locals=
  482. @TypeStructPtrINOUTLocal
  483. PWCHAR pwchClassName, pwchMenuName;
  484. End=
  485. PreCall=
  486. @ValidatecbSize
  487. @TypeStructPtrINOUTPreCall
  488. // Do Extra thunking. @NL
  489. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  490. SIZE_T Length; @NL
  491. @ArgName->cbSize = sizeof(WNDCLASSEX); @NL
  492. try { @NL
  493. if ((PtrToUlong(@ArgName->lpszClassName) & (sizeof(WCHAR)-1)) != 0) { @NL
  494. @NL
  495. if (ID(@ArgName->lpszClassName) == 0) { @NL
  496. Length = wcslen(@ArgName->lpszClassName); @NL
  497. Length <<= 1; @NL
  498. Length += sizeof(UNICODE_NULL); @NL
  499. pwchClassName = Wow64AllocateTemp(Length); @NL
  500. RtlCopyMemory(pwchClassName, @ArgName->lpszClassName, Length); @NL
  501. @ArgName->lpszClassName = pwchClassName; @NL
  502. } @NL
  503. } @NL
  504. if ((PtrToUlong(@ArgName->lpszMenuName) & (sizeof(WCHAR)-1)) != 0) { @NL
  505. if (ID(@ArgName->lpszMenuName) == 0) { @NL
  506. Length = wcslen(@ArgName->lpszMenuName); @NL
  507. Length <<= 1; @NL
  508. Length += sizeof(UNICODE_NULL); @NL
  509. @NL
  510. pwchMenuName = Wow64AllocateTemp(Length); @NL
  511. @NL
  512. RtlCopyMemory(pwchMenuName, @ArgName->lpszMenuName, Length); @NL
  513. @ArgName->lpszMenuName = pwchMenuName; @NL
  514. }
  515. } @NL
  516. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  517. } @NL
  518. )}
  519. End=
  520. PostCall=
  521. @TypeStructPtrINOUTPostCall
  522. if (WOW64_ISPTR(@ArgName)) {@Indent( @NL
  523. WOWASSERT(sizeof(WNDCLASSEXW) == @ArgName->cbSize); @NL
  524. ((NT32WNDCLASSEX *)(@ArgHostName))->cbSize = sizeof(NT32WNDCLASSEXW); @NL
  525. )} @NL
  526. End=
  527. TemplateName=PUNICODE_STRING
  528. IndLevel=0
  529. Direction=IN
  530. Locals=
  531. @TypeStructPtrINLocal
  532. End=
  533. PreCall=
  534. @TypeStructPtrINPreCall
  535. if ((WOW64_ISPTR (@ArgName)) && @Indent( @NL
  536. (((ULONG_PTR)@ArgName->Buffer & (sizeof (WCHAR) - 1)) != 0) && @NL
  537. (ID(@ArgName->Buffer) == 0))) { @Indent( @NL
  538. PVOID LocalBuffer; @NL
  539. LocalBuffer = Wow64AllocateTemp (@ArgName->MaximumLength); @NL
  540. RtlCopyMemory(LocalBuffer, @ArgName->Buffer, @ArgName->MaximumLength); @NL
  541. @ArgName->Buffer = LocalBuffer; @NL
  542. )} @NL
  543. End=
  544. PostCall=
  545. @TypeStructPtrINPostCall
  546. End=
  547. TemplateName=PGUITHREADINFO
  548. Also=PMENUBARINFO
  549. Also=PCOMBOBOXINFO
  550. IndLevel=0
  551. Direction=IN OUT
  552. Locals=
  553. @TypeStructPtrINOUTLocal
  554. End=
  555. PreCall=
  556. @ValidatecbSize
  557. @TypeStructPtrINOUTPreCall
  558. // Do Extra thunking. @NL
  559. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  560. @ArgName->cbSize = sizeof(@ArgTypeInd); @NL
  561. )}
  562. End=
  563. PostCall=
  564. @TypeStructPtrINOUTPostCall
  565. if (WOW64_ISPTR(@ArgName)) {@Indent( @NL
  566. WOWASSERT(sizeof(@ArgTypeInd) == @ArgName->cbSize); @NL
  567. ((@ArgHostTypeInd *)(@ArgHostName))->cbSize = sizeof(@ArgHostTypeInd); @NL
  568. )} @NL
  569. End=
  570. ;; The kernel does not set the size on the outbound side!!!
  571. TemplateName=PCURSORINFO
  572. IndLevel=0
  573. Direction=IN OUT
  574. Locals=
  575. @TypeStructPtrINOUTLocal
  576. End=
  577. PreCall=
  578. @ValidatecbSize
  579. @TypeStructPtrINOUTPreCall
  580. // Do Extra thunking. @NL
  581. if (WOW64_ISPTR(@ArgName)) { @Indent( @NL
  582. @ArgName->cbSize = sizeof(@ArgTypeInd); @NL
  583. )}
  584. End=
  585. PostCall=
  586. @TypeStructPtrINOUTPostCall
  587. End=
  588. TemplateName=LPMENUITEMINFOW
  589. IndLevel=0
  590. Direction=IN
  591. NoType=dwItemData
  592. Locals=
  593. @TypeStructPtrINLocal
  594. End=
  595. PreCall=
  596. if (WOW64_ISPTR(@ArgHostName) && @NL
  597. // User32!InsertMenu allways sets the cbSize to 0 @NL
  598. (((NT32MENUITEMINFOW*)(@ArgHostName))->cbSize != 0) && @NL
  599. ((NT32MENUITEMINFOW*)(@ArgHostName))->cbSize != sizeof(NT32MENUITEMINFOW)) { @Indent( @NL
  600. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  601. )} @NL
  602. @TypeStructPtrINPreCall
  603. // Do Extra thunking. @NL
  604. if (WOW64_ISPTR(@ArgName )) { @Indent( @NL
  605. @ArgName->cbSize = sizeof(MENUITEMINFOW); @NL
  606. // According to MSDN, dwItemData is a application defined data item. @NL
  607. // Unfortunatly, some kernel code was noticed that was testing if it is a valid handle. @NL
  608. // As a precaution, sign extend in the outbound case. @NL
  609. @ArgName->dwItemData = (ULONG_PTR)(LONG_PTR)(((NT32MENUITEMINFO *)(@ArgHostName))->dwItemData); @NL
  610. )}
  611. End=
  612. PostCall=
  613. @TypeStructPtrINPostCall
  614. End=
  615. TemplateName=PGETCLIPBDATA
  616. IndLevel=0
  617. Direction=OUT
  618. Locals=
  619. // Note: @ArgName(@ArgType) is an OUT PGETCLIPBDATA @NL
  620. GETCLIPBDATA @ArgValCopy;@NL
  621. End=
  622. PreCall=
  623. // Note: @ArgName(@ArgType) is an OUT PGETCLIPBDATA @NL
  624. // This structure is a union of type handles of the same type. @NL
  625. // Only copy one of them. @NL
  626. if (WOW64_ISPTR(@ArgHostName)) {@Indent(@NL
  627. @ArgName = (@ArgType)&(@ArgValCopy);@NL
  628. @ArgName->uFmtRet = ((NT32GETCLIPBDATA*)(@ArgHostName))->uFmtRet; @NL
  629. @ArgName->fGlobalHandle = ((NT32GETCLIPBDATA*)(@ArgHostName))->fGlobalHandle; @NL
  630. @ArgName->hPalette = (HANDLE)((NT32GETCLIPBDATA*)(@ArgHostName))->hPalette; @NL
  631. )} @NL
  632. else { @Indent( @NL
  633. @ArgName = (@ArgType)@ArgHostName; @NL
  634. }) @NL
  635. End=
  636. PostCall=
  637. // Note: @ArgName(@ArgType) is an OUT PGETCLIPBDATA @NL
  638. // This structure is a union of type handles of the same type. @NL
  639. // Only copy one of them. @NL
  640. if (WOW64_ISPTR(@ArgHostName)) {@Indent(@NL
  641. ((NT32GETCLIPBDATA*)(@ArgHostName))->uFmtRet = @ArgName->uFmtRet; @NL
  642. ((NT32GETCLIPBDATA*)(@ArgHostName))->fGlobalHandle = @ArgName->fGlobalHandle; @NL
  643. ((NT32GETCLIPBDATA*)(@ArgHostName))->hPalette = (NT32HANDLE)@ArgName->hPalette; @NL
  644. )} @NL
  645. End=
  646. TemplateName=LPCBT_CREATEWND
  647. IndLevel=0
  648. Direction=IN OUT
  649. Locals=
  650. CBT_CREATEWND @ArgValCopy; @NL
  651. @ForceType(Locals,@ArgName->lpcs,((NT32CBT_CREATEWND*)(@ArgHostName))->lpcs,LPCREATESTRUCTW,IN OUT)
  652. End=
  653. PreCall=
  654. // Note: @ArgName(@ArgType) is an IN OUT CBT_CREATEWND @NL
  655. if (WOW64_ISPTR(@ArgHostName)) {@Indent(@NL
  656. @ArgName = (@ArgType)(&@ArgValCopy); @NL
  657. @ArgName->hwndInsertAfter = (HWND)((NT32CBT_CREATEWND*)(@ArgHostName))->hwndInsertAfter; @NL
  658. @ForceType(PreCall,@ArgName->lpcs,((NT32CBT_CREATEWND*)(@ArgHostName))->lpcs,LPCREATESTRUCTW,IN OUT)
  659. )} @NL
  660. else {@Indent(
  661. @ArgName = (@ArgType)@ArgHostName;
  662. )}
  663. End=
  664. PostCall=
  665. // Note: @ArgName(@ArgType) is an IN OUT CBT_CREATEWND @NL
  666. if (WOW64_ISPTR(@ArgHostName)) {@Indent( @NL
  667. ((NT32CBT_CREATEWND*)(@ArgHostName))->hwndInsertAfter = (NT32HWND)@ArgName->hwndInsertAfter; @NL
  668. @ForceType(PostCall,@ArgName->lpcs,((NT32CBT_CREATEWND*)(@ArgHostName))->lpcs,LPCREATESTRUCTW,IN OUT)
  669. )} @NL
  670. End=
  671. TemplateName=WNDPROC
  672. IndLevel=0
  673. Direction=IN
  674. PreCall=
  675. @ArgName = (WNDPROC) NtWow64MapClientFnToKernelClientFn((PROC)@ArgHostName); @NL
  676. End=
  677. TemplateName=WNDPROC
  678. IndLevel=0
  679. Direction=IN OUT
  680. PreCall=
  681. @ArgName = (WNDPROC) NtWow64MapClientFnToKernelClientFn((PROC)@ArgHostName); @NL
  682. End=
  683. PostCall=
  684. @ArgHostName = NtWow64MapKernelClientFnToClientFn((PROC)@ArgName); @NL
  685. End=
  686. [EFunc]
  687. TemplateName=NtGdiAddRemoteFontToDC
  688. Begin=
  689. @GenPlaceHolderThunk(@ApiName)
  690. End=
  691. TemplateName=NtGdiAddFontMemResourceEx
  692. Begin=
  693. @GenPlaceHolderThunk(@ApiName)
  694. End=
  695. TemplateName=NtGdiCreateColorTransform
  696. PreCall=
  697. // The format of the data passed into this function cannot change since @NL
  698. // accoring to Nideyuki Nagase this data is a on disk memory mapped file whose @NL
  699. // format is defined by the International Color Consortium. @NL
  700. End=
  701. TemplateName=NtGdiCreateDIBSection
  702. NoType=dwColorSpace
  703. PreCall=
  704. // dwColorSpace is a pointer to PCACHED_COLORSPACE which is pointer dependent. @NL
  705. // Fortunatly, the kernel only stores the pointer without looking at it. @NL
  706. // How it is converted does not make a difference. @NL
  707. dwColorSpace = (ULONG_PTR)dwColorSpaceHost; @NL
  708. End=
  709. ;; Metafiles can't change since it is a well established file format.
  710. ;; Unfortunatly, one of the headers that defined a metafile were changed.
  711. ;; This function can be uncommented out once it it fixed.
  712. TemplateName=NtGdiCreateServerMetaFile
  713. Begin=
  714. @GenPlaceHolderThunk(@ApiName)
  715. End=
  716. TemplateName=NtGdiEnumFontChunk
  717. NoType=idEnum
  718. PreCall=
  719. // This function returns variable length data, but the data is not @NL
  720. // pointer dependent. @NL
  721. WOWASSERT(sizeof(ENUMFONTDATAW) == sizeof(NT32ENUMFONTDATAW)); @NL
  722. @NL
  723. // In reality, idEnum is a handle. Sign extend it. @NL
  724. idEnum = (ULONG_PTR)(LONG)idEnumHost; @NL
  725. End=
  726. TemplateName=NtGdiEnumFontClose
  727. NoType=idEnum
  728. PreCall=
  729. // In reality, idEnum is a handle. Sign extend it. @NL
  730. idEnum = (ULONG_PTR)(LONG)idEnumHost; @NL
  731. End=
  732. TemplateName=NtGdiEnumObjects
  733. Locals=
  734. ULONG NumObjects; @NL
  735. End=
  736. PreCall=
  737. // Thunking is only needed for LOGBRUSH @NL
  738. switch(iObjectType) { @Indent( @NL
  739. case OBJ_PEN: @NL @Indent(
  740. //LOGPEN is not pointer dependent, nothing to do @NL
  741. WOWASSERT(sizeof(LOGPEN) == sizeof(NT32LOGPEN)); @NL
  742. break; @NL
  743. )
  744. case OBJ_BRUSH: @NL @Indent(
  745. //LOGBRUSH is pointer dependent, thunking is needed. @NL
  746. if (cjBuf != 0 && NULL != pvBuf) { @Indent(
  747. NumObjects = cjBuf / sizeof(NT32LOGBRUSH); @NL
  748. cjBuf = NumObjects * sizeof(LOGBRUSH); @NL
  749. pvBuf = Wow64AllocateTemp(cjBuf); @NL
  750. )} @NL
  751. break; @NL
  752. )
  753. default: @NL @Indent(
  754. WOWASSERTMSG(FALSE, "Unknown object type\n"); @NL
  755. RtlRaiseStatus(STATUS_NOT_IMPLEMENTED); @NL
  756. )
  757. )} @NL
  758. End=
  759. PostCall=
  760. // Thunking is only needed for LOGBRUSH @NL
  761. if (iObjectType == OBJ_BRUSH && 0 != cjBuf && NULL != pvBuf) { @Indent( @NL
  762. ULONG c; @NL
  763. LOGBRUSH *Src = (LOGBRUSH *)pvBuf; @NL
  764. NT32LOGBRUSH *Dest = (NT32LOGBRUSH *)pvBufHost; @NL
  765. for(c=0; c<RetVal; c++) { @Indent( @NL
  766. @ForceType(PostCall,(Src+c),(Dest+c),PLOGBRUSH,OUT)
  767. )}
  768. )} @NL
  769. End=
  770. TemplateName=NtGdiExtCreatePen
  771. NoType=lClientHatch
  772. NoType=lHatch
  773. PreCall=
  774. // Searching the NT tree reviels that lClientHatch can only be a HBITMAP(pClient GreCreateDIBBrush) @NL
  775. // Sign extension is needed. @NL
  776. lClientHatch = (ULONG_PTR)(LONG)lClientHatchHost; @NL
  777. @NL
  778. // lHatch can be a ULONG, HBITMAP, or PBITMAPINFOHEADER. HBITMAP and PBITNAPINFOHEADER @NL
  779. // require sign extension. ULONG does matter since the size between NT64 and NT32 are identical. @NL
  780. lHatch = (ULONG_PTR)(LONG)lHatchHost; @NL
  781. End=
  782. TemplateName=NtGdiPolyTextOutW
  783. NoType=pptw
  784. Locals=
  785. NT32POLYTEXTW *pptw32 = (NT32POLYTEXTW *)pptwHost; @NL
  786. PPOLYTEXTW pptwOrg; @NL
  787. ULONG PolyCount; @NL
  788. End=
  789. PreCall=
  790. pptw = Wow64AllocateTemp (cStr * sizeof (POLYTEXTW)); @NL
  791. if (pptw == NULL) { @NL
  792. return FALSE; @NL
  793. } @NL
  794. pptwOrg = pptw; @NL
  795. for (PolyCount = 0 ; PolyCount < cStr ; PolyCount++) { @NL
  796. @NL
  797. try { @NL
  798. @ForceType(PreCall,(*pptw),(*pptw32),POLYTEXTW,IN)
  799. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  800. return FALSE; @NL
  801. } @NL
  802. pptw++; @NL
  803. pptw32++; @NL
  804. } @NL
  805. pptw = pptwOrg; @NL
  806. End=
  807. TemplateName=NtGdiExtGetObjectW
  808. Header=
  809. @NoFormat(
  810. int
  811. whNT32GreExtGetObjectW(
  812. HANDLE h,
  813. int cj,
  814. LPVOID pvOut
  815. )
  816. {
  817. int iRet;
  818. int cjNew;
  819. PVOID pvBuff;
  820. union
  821. {
  822. BITMAP bm;
  823. DIBSECTION ds;
  824. LOGBRUSH lb;
  825. } obj;
  826. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle LO_TYPE: %I64X\n", (HANDLE)LO_TYPE(h)));
  827. switch(LO_TYPE(h)) {
  828. // Handle non pointer dependent types.
  829. case LO_PALETTE_TYPE:
  830. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_PALETTE_TYPE\n"));
  831. goto nonptrdep;
  832. case LO_FONT_TYPE:
  833. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_FONT_TYPE\n"));
  834. goto nonptrdep;
  835. case LO_ICMLCS_TYPE:
  836. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_ICMLCS_TYPE\n"));
  837. nonptrdep:
  838. WOWASSERT(sizeof(NT32USHORT) == sizeof(USHORT));
  839. WOWASSERT(sizeof(NT32ENUMLOGFONTEXDVW) == sizeof(ENUMLOGFONTEXDVW));
  840. WOWASSERT(sizeof(NT32LOGCOLORSPACEEXW) == sizeof(LOGCOLORSPACEEXW));
  841. return NtGdiExtGetObjectW(h, cj, pvOut);
  842. // These types are all pointer dependent.
  843. case LO_BITMAP_TYPE:
  844. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_BITMAP_TYPE\n"));
  845. goto dibtype;
  846. case LO_DIBSECTION_TYPE:
  847. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_DIBSECTION_TYPE\n"));
  848. dibtype:
  849. // The kernel does not validate the handle if the buffer is NULL.
  850. // The kernel bases the returned information on the size of the buffer pointed in.
  851. // Fortunatly, a DIBSECTION is a BITMAP with extra information. Thus, we always
  852. // ask for the DIBSECTION, but only return the full information is both the
  853. // client provided enought space for it and the kernel provided it.
  854. if (NULL == pvOut) {
  855. return sizeof(NT32BITMAP);
  856. }
  857. iRet = NtGdiExtGetObjectW(h, sizeof(DIBSECTION), &obj);
  858. WOWASSERT(0 == iRet || sizeof(BITMAP) == iRet || sizeof(DIBSECTION) == iRet);
  859. if (0 == iRet || cj < sizeof(NT32BITMAP)) {
  860. return 0;
  861. }
  862. if (cj < sizeof(NT32DIBSECTION) || iRet == sizeof(BITMAP)) {
  863. @ForceType(PostCall,(&(obj.bm)),((NT32BITMAP *)pvOut),LPBITMAP,OUT)
  864. return sizeof(NT32BITMAP);
  865. }
  866. @ForceType(PostCall,(&(obj.ds)),((NT32DIBSECTION *)pvOut),LPDIBSECTION,OUT)
  867. return sizeof(NT32DIBSECTION);
  868. case LO_BRUSH_TYPE:
  869. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_BRUSH_TYPE\n"));
  870. // The kernel does not look at the buffer size if pvOut is NULL
  871. if (NULL == pvOut) {
  872. iRet = NtGdiExtGetObjectW(h, cj, NULL);
  873. WOWASSERT(iRet == 0 || iRet == sizeof(LOGBRUSH));
  874. return (iRet == sizeof(LOGBRUSH)) ? sizeof(NT32LOGBRUSH) : 0;
  875. }
  876. iRet = NtGdiExtGetObjectW(h, sizeof(LOGBRUSH), &obj);
  877. WOWASSERT(0 == iRet || sizeof(LOGBRUSH) == iRet);
  878. if (0 == iRet || cj < sizeof(NT32LOGBRUSH)) {
  879. return 0;
  880. }
  881. @ForceType(PostCall,(&(obj.lb)),((NT32LOGBRUSH *)pvOut),LOGBRUSH*,OUT)
  882. return sizeof(NT32LOGBRUSH);
  883. case LO_PEN_TYPE:
  884. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_PEN_TYPE\n"));
  885. goto extpentype;
  886. case LO_EXTPEN_TYPE:
  887. LOGPRINT((TRACELOG, "NtGdiExtGetObjectW: handle was a LO_EXTPEN_TYPE\n"));
  888. extpentype:
  889. WOWASSERT(sizeof(LOGPEN) == sizeof(NT32LOGPEN));
  890. // If the buffer is null, just pass the call to the kernel. The kernel does not look
  891. // at the count in this case.
  892. if (NULL == pvOut) {
  893. iRet = NtGdiExtGetObjectW(h, cj, NULL);
  894. WOWASSERT(0 == iRet || sizeof(LOGPEN) == iRet || iRet >= sizeof(EXTLOGPEN) - sizeof(DWORD));
  895. // Munge the return size if a EXTLOGPEN is being returned. This occures if
  896. // the return size is >= EXTLOGPEN
  897. if (0 == iRet || sizeof(LOGPEN) == iRet) {
  898. return iRet;
  899. }
  900. // Here we are getting back a EXTLOGPEN, the size needs to be adjusted.
  901. return iRet - (sizeof(EXTLOGPEN) - sizeof(NT32EXTLOGPEN));
  902. }
  903. // Increase the buffer size if the app buffer is capable of holding a EXTLOGPEN
  904. cjNew = (cj >= sizeof(NT32EXTLOGPEN) - sizeof(NT32DWORD)) ? (cj + (sizeof(EXTLOGPEN) - sizeof(NT32EXTLOGPEN))) : cj;
  905. pvBuff = Wow64AllocateTemp(cjNew);
  906. iRet = NtGdiExtGetObjectW(h, cjNew, pvBuff);
  907. WOWASSERT(0 == iRet || sizeof(LOGPEN) == iRet || iRet >= sizeof(EXTLOGPEN) - sizeof(DWORD));
  908. //If the app passed in an incorrect buffer size, NtGdiExtGetObjectW will fail
  909. //and return 0.
  910. if (0 == iRet) {
  911. return 0;
  912. }
  913. if (sizeof(LOGPEN) == iRet) {
  914. RtlCopyMemory(pvOut, pvBuff, sizeof(LOGPEN));
  915. return iRet;
  916. }
  917. // iRet will be >= sizeof(EXTLOGPEN) at this point. This means a EXTLOGPEN + some
  918. // extra non-pointer dependent data is being returned.
  919. {
  920. EXTLOGPEN *Src = pvBuff;
  921. NT32EXTLOGPEN *Dest = pvOut;
  922. ULONG i;
  923. WOWASSERT(cj + (sizeof(EXTLOGPEN) - sizeof(NT32EXTLOGPEN)) == iRet);
  924. if (WOW64_ISPTR(Dest)) {
  925. try{
  926. ((NT32EXTLOGPEN *)(Dest))->elpNumEntries = (NT32DWORD)Src->elpNumEntries;
  927. ((NT32EXTLOGPEN *)(Dest))->elpHatch = (NT32ULONG_PTR)Src->elpHatch;
  928. ((NT32EXTLOGPEN *)(Dest))->elpColor = (NT32COLORREF)Src->elpColor;
  929. ((NT32EXTLOGPEN *)(Dest))->elpBrushStyle = (NT32UINT)Src->elpBrushStyle;
  930. ((NT32EXTLOGPEN *)(Dest))->elpWidth = (NT32DWORD)Src->elpWidth;
  931. ((NT32EXTLOGPEN *)(Dest))->elpPenStyle = (NT32DWORD)Src->elpPenStyle;
  932. for(i=0; i < Src->elpNumEntries; i++) {
  933. ((NT32EXTLOGPEN *)(Dest))->elpStyleEntry[i] = (NT32WORD)Src->elpStyleEntry[i];
  934. }
  935. }
  936. except (EXCEPTION_EXECUTE_HANDLER) {
  937. #if defined _NTBASE_API_
  938. return GetExceptionCode();
  939. #elif defined _WIN32_API_
  940. return 0;
  941. #endif
  942. }
  943. }
  944. if (Src->elpNumEntries > 1){
  945. return sizeof(NT32EXTLOGPEN) + sizeof(NT32DWORD) * (Src->elpNumEntries-1);
  946. }
  947. return iRet - (sizeof(EXTLOGPEN) - sizeof(NT32EXTLOGPEN));
  948. }
  949. default:
  950. WOWASSERTMSG(FALSE, "Unsupported handle type passed into NtGdiExtGetObjectW\nThis should be safe to ignore\n");
  951. // ignore NULL & INVALID handles
  952. case (((1 << (TYPE_BITS + ALTTYPE_BITS)) - 1) << TYPE_SHIFT):
  953. case 0:
  954. return 0; //This is what the kernel does.
  955. }
  956. }
  957. int
  958. whNT32GdiExtGetObjectW(
  959. HANDLE h,
  960. int cj,
  961. LPVOID pvOut
  962. )
  963. {
  964. union
  965. {
  966. NT32BITMAP bm;
  967. NT32DIBSECTION ds;
  968. NT32EXTLOGPEN elp;
  969. NT32LOGPEN l;
  970. NT32LOGBRUSH lb;
  971. NT32LOGFONTW lf;
  972. NT32ENUMLOGFONTEXDVW elf;
  973. NT32LOGCOLORSPACEEXW lcsp;
  974. } obj32;
  975. int iType = LO_TYPE(h);
  976. int ci, iRet;
  977. PVOID pvBuf = pvOut;
  978. // The kernel limits the size of the returned information, thus the same will be done here.
  979. if ((cj < 0) || (cj > sizeof(obj32))) {
  980. LOGPRINT((TRACELOG, "whNT32GdiExtGetObjectW: cj too big to GetObject\n"));
  981. cj = sizeof(obj32);
  982. }
  983. ci = cj;
  984. // Copied from ntgdi.c
  985. // make the getobject call on brush
  986. // still work even the app passes in
  987. // a cj < sizeof(LOGBRUSH)
  988. //
  989. if (iType == LO_BRUSH_TYPE) {
  990. cj = sizeof(NT32LOGBRUSH);
  991. pvBuf = pvOut ? &obj32 : NULL;
  992. }
  993. iRet = whNT32GreExtGetObjectW(h, cj, pvBuf);
  994. if (iType == LO_BRUSH_TYPE && pvBuf != NULL && iRet > 0) {
  995. cj = min(cj, ci);
  996. RtlCopyMemory(pvOut, pvBuf, min(cj,iRet));
  997. }
  998. return iRet;
  999. }
  1000. )
  1001. End=
  1002. Begin=
  1003. @GenApiThunk(whNT32GdiExtGetObjectW)
  1004. End=
  1005. TemplateName=NtGdiGetFontData
  1006. PreCall=
  1007. // This function returns font data that an app can use to embed a font in a doc. @NL
  1008. // If this data changes, it is probably a bug since it would probably break word documents. @NL
  1009. End=
  1010. TemplateName=NtGdiGetFontResourceInfoInternalW
  1011. Case=(GFRI_NUMFONTS,PULONG)
  1012. Case=(GFRI_DESCRIPTION,PWCHAR)
  1013. Case=(GFRI_LOGFONTS,LOGFONTW*)
  1014. Case=(GFRI_ISTRUETYPE,PBOOL)
  1015. Case=(GFRI_ISREMOVED,PBOOL)
  1016. Begin=
  1017. @GenDebugNonPtrDepCases(@ApiName,iType)
  1018. End=
  1019. TemplateName=NtGdiGetStats
  1020. Case=(GS_NUM_OBJS_ALL,PULONG)
  1021. Case=(GS_HANDOBJ_CURRENT,PULONG)
  1022. Case=(GS_HANDOBJ_MAX,PULONG)
  1023. Case=(GS_HANDOBJ_ALLOC,PULONG)
  1024. Case=(GS_LOOKASIDE_INFO,PULONG)
  1025. Begin=
  1026. @GenDebugNonPtrDepCases(@ApiName,iIndex)
  1027. End=
  1028. TemplateName=NtGdiGetOutlineTextMetricsInternalW
  1029. NoType=potmw
  1030. Locals=
  1031. NT32OUTLINETEXTMETRIC NT32TextMetricTemp; @NL
  1032. BOOL bLengthOnly = FALSE; @NL
  1033. End=
  1034. PreCall=
  1035. // If cjotm is 0, the kernel internally sets potmw to NULL. @NL
  1036. // Important: the difference between a OUTLINETEXTMETRICW with strings and the @NL
  1037. // 32BIT OUTLINETEXTMETRICW is ALIGN4(sizeof(OUTLINETEXTMETRICW) - ALIGN4(sizeof(NT32OUTLINETEXTMETRICW) @NL
  1038. // @NL
  1039. @NL
  1040. #define OUTLINETEXTMETRICWDELTA (ALIGN4(sizeof(OUTLINETEXTMETRICW)) - ALIGN4(sizeof(NT32OUTLINETEXTMETRICW))) @NL
  1041. #define ADJUSTOTMWFIELD32M(p,f,o) (((NT32OUTLINETEXTMETRICW *)p)->f = (NT32PSTR)((PBYTE)(((NT32OUTLINETEXTMETRICW *)p)->f) - (o))) @NL
  1042. #define OTMWOFFSETTOPTR32(p,f) ((WCHAR*)((PBYTE)(p) + (ULONG)((NT32OUTLINETEXTMETRICW *)(p))->f)) @NL
  1043. #define OTMWOFFSETTOPTR64(p,f) ((WCHAR*)((PBYTE)(p) + (ULONGLONG)((OUTLINETEXTMETRICW *)(p))->f)) @NL
  1044. @NL
  1045. if (WOW64_ISPTR(potmwHost) && cjotm != 0) { @Indent(
  1046. // Increase the size of the buffer by the difference between the size @NL
  1047. // of the NT32 structures and the NT64 structures. @NL
  1048. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Caller is requesting actual data\n")); @NL
  1049. if (cjotm <= sizeof(NT32OUTLINETEXTMETRICW)) cjotm = sizeof(OUTLINETEXTMETRICW); @NL
  1050. else if (cjotm > sizeof(NT32OUTLINETEXTMETRICW) && cjotm < ALIGN4(sizeof(NT32OUTLINETEXTMETRICW))) RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1051. else cjotm += OUTLINETEXTMETRICWDELTA; @NL
  1052. potmw = Wow64AllocateTemp(cjotm); @NL
  1053. )} @NL
  1054. else {@Indent( @NL
  1055. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Caller is requesting the length only\n")); @NL
  1056. bLengthOnly = TRUE; @NL
  1057. )} @NL
  1058. End=
  1059. PostCall=
  1060. // If cjotm < OUTLINETEXTMETRIC the api will not return the strings. @NL
  1061. WOWASSERT( @Indent( @NL
  1062. (bLengthOnly && RetVal == 0) || //Error case @NL
  1063. (bLengthOnly && RetVal >= sizeof(OUTLINETEXTMETRICW)) || //Struct and strings@NL
  1064. (!bLengthOnly && RetVal == 0) || //Error case @NL
  1065. (!bLengthOnly && RetVal == sizeof(OUTLINETEXTMETRICW) && cjotmHost <= sizeof(NT32OUTLINETEXTMETRICW)) || // struct only@NL
  1066. (!bLengthOnly && RetVal >= ALIGN4(sizeof(OUTLINETEXTMETRICW)) && cjotmHost >= ALIGN4(sizeof(NT32OUTLINETEXTMETRICW))) //struct and strings @NL
  1067. )); @NL
  1068. if (RetVal != 0) { @Indent( @NL
  1069. // Need to thunk the cjotma field of the TMDIFF structure. This field contains the @NL
  1070. // size of the ANSI version of the returned info. Lucky, the kernel computes this @NL
  1071. // in cjOTMAWSize by simply adding sizeof(OUTLINETEXTMETRICA)+4 + sizeof strings. @NL
  1072. // no crazy aligmnent mechanism as with the unicode version. @NL
  1073. // Note that this is done after the standard genthnk thunking so the TMDIFF has @NL
  1074. // already been copied back to the 32bit version. @NL
  1075. if (ARGUMENT_PRESENT(ptmdHost)) { @Indent( @NL
  1076. if (((NT32TMDIFF *)ptmdHost)->cjotma > 0) { @Indent( @NL
  1077. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Munging cjotma by subtracting %X\n", (ULONG)(sizeof(OUTLINETEXTMETRICA) - sizeof(NT32OUTLINETEXTMETRICA)))); @NL
  1078. ((NT32TMDIFF *)ptmdHost)->cjotma -= sizeof(OUTLINETEXTMETRICA) - sizeof(NT32OUTLINETEXTMETRICA); @NL
  1079. )} @NL
  1080. )} @NL
  1081. // Since the buffer length was forced to be a minumum of sizeof(OUTLINETEXTMETRICW), @NL
  1082. // the returned size will always be at least sizeof(OUTLINETEXTMETRICW). @NL
  1083. // The kernel also places the strings at the end of the buffer if it has room. @NL
  1084. if (bLengthOnly) { @Indent( @NL
  1085. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Returning length - %X\n", (ULONG)OUTLINETEXTMETRICWDELTA)); @NL
  1086. RetVal -= OUTLINETEXTMETRICWDELTA; @NL
  1087. )} @NL
  1088. else { @Indent( @NL
  1089. // Since we are retrieving the actual data here, the return size will be at least @NL
  1090. // sizeof(OUTLINETEXTMETRICW) since the buffer length was forced to be it as a min. @NL
  1091. // The returned data can either be the OUTLINETEXTMETRIC structure, or the structure @NL
  1092. // followed by several string. Copy the structure to a temp since it will always be @NL
  1093. // returned. @NL
  1094. @ForceType(PostCall,potmw,&NT32TextMetricTemp,OUTLINETEXTMETRICW*,OUT)
  1095. NT32TextMetricTemp.otmSize -= OUTLINETEXTMETRICWDELTA; @NL
  1096. // Copy the structure back to the user's buffer. @NL
  1097. if (cjotmHost <= sizeof(NT32OUTLINETEXTMETRICW)) { @Indent( @NL
  1098. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Caller only wants part of main structure.\n")); @NL
  1099. RetVal = min(cjotmHost, RetVal); @NL
  1100. RtlCopyMemory((PVOID)potmwHost, &NT32TextMetricTemp, RetVal); @NL
  1101. )} @NL
  1102. else { @Indent( @NL
  1103. // Ok, here is a major trick. The kernel always returns everything in one big chunk. @NL
  1104. // The strings always follow the struct at ALIGN4(sizeof(OUTLINETEXTMETRICW)). @NL
  1105. // Thus all that is needed is paste the converted section together with the pointer @NL
  1106. // independent section and adjust the pointers by a fixed offset. @NL
  1107. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Caller want mains structure plus some data.\n")); @NL
  1108. RtlCopyMemory((PVOID)potmwHost, &NT32TextMetricTemp, sizeof(NT32OUTLINETEXTMETRICW)); @NL
  1109. // Copy the strings which are not pointer dependent. @NL
  1110. LOGPRINT((TRACELOG, "NtGdiGetOutlineTextMetricsInternalW: Copying string block.\n")); @NL
  1111. RtlCopyMemory((PBYTE)potmwHost + ALIGN4(sizeof(NT32OUTLINETEXTMETRICW)),
  1112. (PBYTE)potmw + ALIGN4(sizeof(OUTLINETEXTMETRICW)),
  1113. RetVal - ALIGN4(sizeof(OUTLINETEXTMETRICW))); @NL
  1114. // Decrease the string offsets by the deltas. @NL
  1115. WOWASSERT(((NT32OUTLINETEXTMETRICW *)potmwHost)->otmpFamilyName >= ALIGN4(sizeof(OUTLINETEXTMETRICW))); @NL
  1116. WOWASSERT(((NT32OUTLINETEXTMETRICW *)potmwHost)->otmpFaceName >= ALIGN4(sizeof(OUTLINETEXTMETRICW))); @NL
  1117. WOWASSERT(((NT32OUTLINETEXTMETRICW *)potmwHost)->otmpStyleName >= ALIGN4(sizeof(OUTLINETEXTMETRICW))); @NL
  1118. WOWASSERT(((NT32OUTLINETEXTMETRICW *)potmwHost)->otmpFullName >= ALIGN4(sizeof(OUTLINETEXTMETRICW))); @NL
  1119. ADJUSTOTMWFIELD32M(potmwHost,otmpFamilyName,OUTLINETEXTMETRICWDELTA); @NL
  1120. ADJUSTOTMWFIELD32M(potmwHost,otmpFaceName,OUTLINETEXTMETRICWDELTA); @NL
  1121. ADJUSTOTMWFIELD32M(potmwHost,otmpStyleName,OUTLINETEXTMETRICWDELTA); @NL
  1122. ADJUSTOTMWFIELD32M(potmwHost,otmpFullName,OUTLINETEXTMETRICWDELTA); @NL
  1123. RetVal -= OUTLINETEXTMETRICWDELTA; @NL
  1124. // Test to ensure that the offsets were adjusted correctly @NL
  1125. WOWASSERT(wcscmp(OTMWOFFSETTOPTR32(potmwHost,otmpFamilyName), OTMWOFFSETTOPTR64(potmw,otmpFamilyName)) == 0); @NL
  1126. WOWASSERT(wcscmp(OTMWOFFSETTOPTR32(potmwHost,otmpFaceName), OTMWOFFSETTOPTR64(potmw,otmpFaceName)) == 0); @NL
  1127. WOWASSERT(wcscmp(OTMWOFFSETTOPTR32(potmwHost,otmpStyleName), OTMWOFFSETTOPTR64(potmw,otmpStyleName)) == 0); @NL
  1128. WOWASSERT(wcscmp(OTMWOFFSETTOPTR32(potmwHost,otmpFullName), OTMWOFFSETTOPTR64(potmw,otmpFullName)) == 0); @NL
  1129. )} @NL
  1130. )} @NL
  1131. #undef OUTLINETEXTMETRICWDELTA @NL
  1132. #undef ADJUSTOTMWFIELD32 @NL
  1133. #undef OTMWOFFSETTOPTR32 @NL
  1134. #undef OTMWOFFSETTOPTR64 @NL
  1135. )} @NL
  1136. End=
  1137. TemplateName=NtGdiOpenDCW
  1138. NoType=pDriverInfo2
  1139. Locals=
  1140. @Types(Locals,pDriverInfo2,DRIVER_INFO_2W*)
  1141. End=
  1142. PreCall=
  1143. @Types(PreCall,pDriverInfo2,DRIVER_INFO_2W*)
  1144. End=
  1145. PostCall=
  1146. @Types(PostCall,pDriverInfo2,DRIVER_INFO_2W*)
  1147. End=
  1148. TemplateName=NtGdiPolyPatBlt
  1149. NoType=pPoly
  1150. PreCall=
  1151. { @Indent( @NL
  1152. SIZE_T i; @NL
  1153. LARGE_INTEGER Temp; @NL
  1154. NT32POLYPATBLT *Src = (NT32POLYPATBLT *)pPolyHost; @NL
  1155. pPoly = (PPOLYPATBLT)Wow64AllocateTemp(sizeof(POLYPATBLT) * Count); @NL
  1156. for(i=0; i < Count; i++) { @Indent( @NL
  1157. pPoly[i].x = (int)Src[i].x; @NL
  1158. pPoly[i].y = (int)Src[i].y; @NL
  1159. pPoly[i].cx = (int)Src[i].cx; @NL
  1160. pPoly[i].cy = (int)Src[i].cy; @NL
  1161. //the structure might be unaligned @NL
  1162. Temp = *(UNALIGNED LARGE_INTEGER *)&(Src[i].BrClr.hbr); @NL
  1163. pPoly[i].BrClr.hbr = *(HBRUSH *)&Temp; @NL
  1164. )} @NL
  1165. })
  1166. End=
  1167. TemplateName=NtGdiResetDC
  1168. NoType=pDriverInfo2
  1169. Locals=
  1170. @Types(Locals,pDriverInfo2,DRIVER_INFO_2W*)
  1171. End=
  1172. PreCall=
  1173. @Types(PreCall,pDriverInfo2,DRIVER_INFO_2W*)
  1174. End=
  1175. PostCall=
  1176. @Types(PostCall,pDriverInfo2,DRIVER_INFO_2W*)
  1177. End=
  1178. TemplateName=NtUserBuildHimcList
  1179. NoType=phimcFirst
  1180. PreCall=
  1181. phimcFirst = (WOW64_ISPTR(phimcFirstHost)) ? (HIMC *)Wow64AllocateTemp(sizeof(HIMC) * cHimcMax) : (HIMC *)phimcFirstHost; @NL
  1182. End=
  1183. PostCall=
  1184. if (!NT_ERROR(RetVal) && WOW64_ISPTR(phimcFirst)) { @Indent( @NL
  1185. SIZE_T i; @NL
  1186. NT32HIMC *Dest = (NT32HIMC *)phimcFirstHost; @NL
  1187. for(i = 0; i < *pcHimcNeeded; i++) { @Indent( @NL
  1188. Dest[i] = (NT32HIMC)phimcFirst[i]; @NL
  1189. )} @NL
  1190. )}@NL
  1191. End=
  1192. TemplateName=NtUserLoadKeyboardLayoutEx
  1193. IndLevel=0
  1194. Direction=IN
  1195. NoType=pKbdTableMulti
  1196. PreCall=
  1197. pKbdTableMulti = (PKBDTABLE_MULTI_INTERNAL)UlongToPtr(pKbdTableMultiHost);
  1198. End=
  1199. TemplateName=NtUserCreateWindowStation
  1200. IndLevel=0
  1201. Direction=IN
  1202. NoType=pKbdTableMulti
  1203. PreCall=
  1204. pKbdTableMulti = (PKBDTABLE_MULTI_INTERNAL)UlongToPtr(pKbdTableMultiHost);
  1205. End=
  1206. TemplateName=NtUserBuildHwndList
  1207. NoType=phwndFirst
  1208. PreCall=
  1209. phwndFirst = WOW64_ISPTR(phwndFirstHost) ? (HWND *)Wow64AllocateTemp(sizeof(HWND) * cHwndMax) : (HWND *)phwndFirstHost; @NL
  1210. End=
  1211. PostCall=
  1212. if (!NT_ERROR(RetVal) && WOW64_ISPTR(phwndFirst)) { @Indent( @NL
  1213. SIZE_T i; @NL
  1214. NT32HWND *Dest = (NT32HWND *)phwndFirstHost; @NL
  1215. for(i=0; i < *pcHwndNeeded; i++) { @Indent( @NL
  1216. Dest[i] = (NT32HWND)phwndFirst[i]; @NL
  1217. )} @NL
  1218. )} @NL
  1219. End=
  1220. TemplateName=NtUserBuildPropList
  1221. NoType=pPropSet
  1222. PreCall=
  1223. pPropSet = WOW64_ISPTR(pPropSetHost) ? (PPROPSET)Wow64AllocateTemp(sizeof(PROPSET) * cPropMax) : (PPROPSET)pPropSetHost; @NL
  1224. End=
  1225. PostCall=
  1226. if (!NT_ERROR(RetVal) && WOW64_ISPTR(pPropSet)) { @Indent( @NL
  1227. SIZE_T i; @NL
  1228. NT32PROPSET *Dest = (NT32PROPSET *)pPropSetHost; @NL
  1229. for(i=0; i < *pcPropNeeded; i++) { @Indent( @NL
  1230. Dest[i].hData = (NT32HANDLE)pPropSet[i].hData; @NL
  1231. Dest[i].atom = (NT32ATOM)pPropSet[i].atom; @NL
  1232. )} @NL
  1233. )} @NL
  1234. End=
  1235. TemplateName=NtUserInitBrushes
  1236. NoType=pahbrSystem
  1237. Locals=
  1238. // NtUserInitBrushes copies an array of brush handles into pahbrSystem @NL
  1239. HBRUSH ahbrSystem[COLOR_MAX]; @NL
  1240. End=
  1241. PreCall=
  1242. pahbrSystem = ahbrSystem; @NL
  1243. End=
  1244. PostCall=
  1245. { @Indent( @NL
  1246. int i; @NL
  1247. for (i = 0; i < COLOR_MAX; i += 1) { @Indent( @NL
  1248. ((NT32HBRUSH*)pahbrSystemHost)[i] = (NT32HBRUSH)(ahbrSystem[i]); @NL
  1249. )} @NL
  1250. )} @NL
  1251. End=
  1252. TemplateName=NtUserChangeDisplaySettings
  1253. PreCall=
  1254. // According to MSDN, lParam can point to a RECT structure which @NL
  1255. // is not pointer dependent. @NL
  1256. // But, looking at the code for user32 shows that this parameter @NL
  1257. // is currently unused. @NL
  1258. WOWASSERT(sizeof(RECT) == sizeof(NT32RECT)); @NL
  1259. End=
  1260. TemplateName=NtUserCreateWindowEx
  1261. PreCall=
  1262. // pParam points to creation parameters that are passed back @NL
  1263. // in the WM_CREATE message of the window. It does not appear @NL
  1264. // that any kernel code is looking at this data, so this @NL
  1265. // data does not need to be thunked. @NL
  1266. End=
  1267. TemplateName=NtUserGetCPD
  1268. NoType=dwData
  1269. PreCall=
  1270. // dwData is a pointer to a WndProc. Since this is a pointer, it would be sign extended. @NL
  1271. dwData = (ULONG_PTR)(LONG)dwDataHost; @NL
  1272. End=
  1273. TemplateName=NtUserGetKeyboardLayoutList
  1274. NoType=lpBuff
  1275. PreCall=
  1276. lpBuff = WOW64_ISPTR(lpBuffHost) ? (HKL *)Wow64AllocateTemp(sizeof(HKL) * nItems) : (HKL *)lpBuffHost; @NL
  1277. End=
  1278. PostCall=
  1279. if(WOW64_ISPTR(lpBuffHost)) {@Indent( @NL
  1280. SIZE_T i; @NL
  1281. NT32HKL *Dest = (NT32HKL *)lpBuffHost; @NL
  1282. for(i=0;i<nItems;i++) { @Indent( @NL
  1283. Dest[i] = (NT32HKL)lpBuff[i]; @NL
  1284. )} @NL
  1285. )} @NL
  1286. End=
  1287. TemplateName=NtUserGetObjectInformation
  1288. Case=(UOI_FLAGS,PUSEROBJECTFLAGS)
  1289. Case=(UOI_NAME,PWCHAR)
  1290. Case=(UOI_TYPE,PWCHAR)
  1291. Case=(UOI_USER_SID,PSID)
  1292. Begin=
  1293. @GenDebugNonPtrDepCases(@ApiName,nIndex)
  1294. End=
  1295. TemplateName=NtUserInitializeClientPfnArrays
  1296. Begin=
  1297. @ApiProlog
  1298. @Indent(
  1299. LOGPRINT((TRACELOG, "wh@ApiName(@ApiNum) api thunk: @IfArgs(@ArgList(@ArgName: %x@ArgMore(,)))\n"@IfArgs(, @ArgList((@ArgHostName)@ArgMore(,))))); @NL
  1300. /* @NL
  1301. * don't make the kernel call @NL
  1302. * it is only used from csrss anyhow @NL
  1303. */ @NL
  1304. apfnClientAClient = (const PFNCLIENT *)ppfnClientAHost; @NL
  1305. apfnClientWClient = (const PFNCLIENT *)ppfnClientWHost; @NL
  1306. apfnClientWorkerClient = (const PFNCLIENTWORKER *)ppfnClientWorkerHost; @NL
  1307. return STATUS_SUCCESS; @NL
  1308. )
  1309. }
  1310. End=
  1311. TemplateName=NtUserPaintDesktop
  1312. Header=
  1313. @NoFormat(
  1314. BOOL NtUserPaintDesktopInternal(
  1315. IN HDC hdc)
  1316. {
  1317. BOOL RetVal;
  1318. ULONG hdclocal;
  1319. // HACK, HACK. Try the API with sign extension first.
  1320. RetVal = NtUserPaintDesktop(hdc);
  1321. if (RetVal) {
  1322. return RetVal;
  1323. }
  1324. // Try the API with zero extension.
  1325. hdclocal = (ULONG)HandleToLong(hdc);
  1326. return NtUserPaintDesktop((HDC)hdclocal);
  1327. }
  1328. )
  1329. End=
  1330. Begin=
  1331. @GenApiThunk(NtUserPaintDesktopInternal)
  1332. End=
  1333. TemplateName=NtUserSetObjectInformation
  1334. Case=(UOI_FLAGS,PUSEROBJECTFLAGS)
  1335. Begin=
  1336. @GenDebugNonPtrDepCases(@ApiName,nIndex)
  1337. End=
  1338. TemplateName=NtUserSetClassLong
  1339. Header=
  1340. LONG whNtUserSetClassLongInternal(IN HWND hwnd,IN int nIndex,OUT LONG dwNewLong,IN BOOL bAnsi) { @Indent( @NL
  1341. if (nIndex < 0) { @Indent( @NL
  1342. ULONG_PTR RetVal64; @NL
  1343. if (nIndex == GCLP_MENUNAME) { @Indent( @NL
  1344. CLSMENUNAME *pcmn; @NL
  1345. @ForceType(Locals, pcmn, ((NT32CLSMENUNAME*)dwNewLong), PCLSMENUNAME,IN OUT) @NL
  1346. @ForceType(PreCall, pcmn, ((NT32CLSMENUNAME*)dwNewLong), PCLSMENUNAME,IN OUT) @NL
  1347. RetVal64 = NtUserSetClassLongPtr(hwnd, nIndex, (ULONG_PTR)pcmn, bAnsi); @NL
  1348. @ForceType(PostCall, pcmn, ((NT32CLSMENUNAME*)dwNewLong), PCLSMENUNAME,IN OUT) @NL
  1349. return (LONG)RetVal64; @NL
  1350. }) @NL
  1351. if (nIndex == GCLP_WNDPROC) { @Indent( @NL
  1352. dwNewLong = (LONG)NtWow64MapClientFnToKernelClientFn((KPROC)((ULONG_PTR)dwNewLong)); @NL
  1353. }) @NL
  1354. RetVal64 = NtUserSetClassLongPtr(hwnd, nIndex, (ULONG_PTR)dwNewLong, bAnsi); @NL
  1355. if (nIndex == GCLP_WNDPROC) { @Indent( @NL
  1356. RetVal64 = NtWow64MapKernelClientFnToClientFn((KPROC)RetVal64); @NL
  1357. }) @NL
  1358. return (LONG)RetVal64; @NL
  1359. }) @NL
  1360. // The default case is to just call NtUserSetCallLong @NL
  1361. return NtUserSetClassLong(hwnd,nIndex,dwNewLong,bAnsi); @NL
  1362. } @NL
  1363. ) @NL
  1364. End=
  1365. Begin=
  1366. @GenApiThunk(whNtUserSetClassLongInternal)
  1367. End=
  1368. TemplateName=NtUserSetWindowWord
  1369. Header=
  1370. @NoFormat(
  1371. #define NT32DWL_MSGRESULT 0
  1372. #define NT32DWL_DLGPROC 4
  1373. #define NT32DWL_USER 8
  1374. WORD whNtUserSetWindowWordInternal(
  1375. IN HWND hwnd,
  1376. IN int nIndex,
  1377. IN WORD wNewWord) {
  1378. // This function is needed to translate values used by the 32bit SetWindowWord into the
  1379. // values used by the 64bit SetWindowWord.
  1380. PWND pwnd;
  1381. if (nIndex >= 0) {
  1382. pwnd = Wow64ValidateHwnd(hwnd);
  1383. if (!pwnd) {
  1384. return 0;
  1385. }
  1386. if (TestWF(pwnd, WFDIALOGWINDOW)) {
  1387. LOGPRINT((TRACELOG, "NtUserSetWindowWord: Window is a dialog box\n"));
  1388. if (nIndex >= NT32DWL_USER && nIndex <= NT32DWL_USER+sizeof(WORD)) {
  1389. nIndex = (nIndex - NT32DWL_USER) + DWLP_USER;
  1390. }
  1391. else if (nIndex >= NT32DWL_DLGPROC && nIndex <= NT32DWL_DLGPROC+sizeof(WORD)) {
  1392. nIndex = (nIndex - NT32DWL_DLGPROC) + DWLP_DLGPROC;
  1393. }
  1394. else if (nIndex >= NT32DWL_MSGRESULT && nIndex <= NT32DWL_MSGRESULT+sizeof(WORD)) {
  1395. nIndex = (nIndex - NT32DWL_MSGRESULT) + DWLP_MSGRESULT;
  1396. }
  1397. else if (nIndex < DLGWINDOWEXTRA) {
  1398. LOGPRINT((ERRORLOG, "NtUserSetWindowWord: app is trying to set an invalid index for a dialog box\n"));
  1399. LOGPRINT((ERRORLOG, "NtUserSetWindowWord: calling kernel will invalid index to set the error code.\n"));
  1400. nIndex = DLGWINDOWEXTRA - 1; //This is an invalid index.
  1401. }
  1402. // Fall through and just use the specified index.
  1403. }
  1404. }
  1405. return NtUserSetWindowWord(hwnd, nIndex, wNewWord);
  1406. }
  1407. )
  1408. End=
  1409. Begin=
  1410. @GenApiThunk(whNtUserSetWindowWordInternal)
  1411. End=
  1412. TemplateName=NtUserSetWindowLong
  1413. Header=
  1414. @NoFormat(
  1415. LONG whNtUserSetWindowLongInternal(IN HWND hwnd,IN int nIndex,IN LONG dwNewLong,IN BOOL bAnsi) {
  1416. LONG RetVal;
  1417. PWND pwnd;
  1418. if (nIndex < 0) {
  1419. RetVal = (DWORD) NtUserSetWindowLongPtr(hwnd, nIndex, (ULONG_PTR)dwNewLong, bAnsi);
  1420. if (nIndex == GWLP_WNDPROC) {
  1421. RetVal = (DWORD) NtWow64MapKernelClientFnToClientFn((KPROC)RetVal);
  1422. }
  1423. return RetVal;
  1424. }
  1425. pwnd = Wow64ValidateHwnd(hwnd);
  1426. if (!pwnd) {
  1427. return 0;
  1428. }
  1429. if (GETFNID(pwnd) != 0) {
  1430. if (!TestWF(pwnd, WFDIALOGWINDOW)) {
  1431. if (nIndex >= 0 &&
  1432. (nIndex < (int)(CBFNID(pwnd->fnid)-sizeof(WND)))) {
  1433. switch (GETFNID(pwnd)) {
  1434. case FNID_BUTTON:
  1435. case FNID_COMBOBOX:
  1436. case FNID_COMBOLISTBOX:
  1437. case FNID_DIALOG:
  1438. case FNID_LISTBOX:
  1439. case FNID_STATIC:
  1440. case FNID_EDIT:
  1441. #ifdef FE_IME @NL
  1442. case FNID_IME:
  1443. #endif @NL
  1444. /*
  1445. * Allow the 0 index for controls to be set if it's
  1446. * still NULL or the window is being destroyed. This
  1447. * is where controls store their private data.
  1448. */
  1449. if (nIndex == 0) {
  1450. return (DWORD) NtUserSetWindowLongPtr(hwnd, nIndex, (ULONG_PTR)dwNewLong, bAnsi);
  1451. }
  1452. break;
  1453. case FNID_MDICLIENT:
  1454. /*
  1455. * Allow the 0 index (which is reserved) to be set/get.
  1456. * Quattro Pro 1.0 uses this index!
  1457. */
  1458. if (nIndex == 0) {
  1459. return (DWORD) NtUserSetWindowLongPtr(hwnd, nIndex, (ULONG_PTR)dwNewLong, bAnsi);
  1460. }
  1461. if (nIndex == GWLP_MDIDATA) {
  1462. return (DWORD) NtUserSetWindowLongPtr(hwnd, nIndex, (ULONG_PTR)dwNewLong, bAnsi);
  1463. }
  1464. break;
  1465. }
  1466. }
  1467. }
  1468. }
  1469. // Default case. Just call NtUserSetWindowLong
  1470. return NtUserSetWindowLong(hwnd, nIndex, dwNewLong, bAnsi);
  1471. }
  1472. )
  1473. End=
  1474. Begin=
  1475. @GenApiThunk(whNtUserSetWindowLongInternal)
  1476. End=
  1477. TemplateName=NtUserSendInput
  1478. NoType=pInputs
  1479. Locals=
  1480. UINT count; @NL
  1481. PINPUT pInput64; @NL
  1482. NT32INPUT *pInput32; @NL
  1483. PreCall=
  1484. if (cbSize != sizeof(NT32INPUT) || 0 == cInputs || !ARGUMENT_PRESENT(pInputsHost)) { @Indent( @NL
  1485. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1486. )} @NL
  1487. cbSize = sizeof(INPUT);@NL
  1488. pInputs = pInput64 = Wow64AllocateTemp(cInputs * cbSize); @NL
  1489. pInput32 = (NT32INPUT *)pInputsHost; @NL
  1490. for(count = 0; count < cInputs; count++,pInput64++,pInput32++) { @Indent( @NL
  1491. switch(pInput64->type = pInput32->type) { @NL
  1492. case INPUT_MOUSE: @NL @Indent(
  1493. @ForceType(PreCall,pInput64->mi,pInput32->mi,MOUSEINPUT,IN)
  1494. break;
  1495. ) @NL
  1496. case INPUT_KEYBOARD: @NL @Indent(
  1497. @ForceType(PreCall,pInput64->ki,pInput32->ki,KEYBDINPUT,IN)
  1498. break;
  1499. ) @NL
  1500. case INPUT_HARDWARE: @NL @Indent(
  1501. @ForceType(PreCall,pInput64->hi,pInput32->hi,HARDWAREINPUT,IN)
  1502. break;
  1503. ) @NL
  1504. default: @NL @Indent(
  1505. LOGPRINT((ERRORLOG, "NtUserSendInputs call with invalid type of %x\n", pInput64->type)); @NL
  1506. WOWASSERT(FALSE);
  1507. break; @NL
  1508. ) @NL
  1509. } @NL
  1510. )} @NL
  1511. End=
  1512. TemplateName=NtUserThunkedMenuInfo
  1513. NoType=lpmi
  1514. Locals=
  1515. @Types(Locals,lpmi,LPMENUINFO)
  1516. End=
  1517. PreCall=
  1518. @Types(PreCall,lpmi,LPMENUINFO)
  1519. End=
  1520. PostCall=
  1521. @Types(PostCall,lpmi,LPMENUINFO)
  1522. End=
  1523. ;; this list comes from windows\published\winuser.w
  1524. TemplateName=NtUserSystemParametersInfo
  1525. Header=
  1526. @NoFormat(
  1527. LPVOID
  1528. whCreateAlignedCopy(
  1529. LPVOID lpData,
  1530. UINT Alignment,
  1531. SIZE_T Size)
  1532. {
  1533. LPVOID lpAlignedData;
  1534. if (WOW64_ISPTR(lpData) && ((SIZE_T)lpData % Alignment)) {
  1535. lpAlignedData = Wow64AllocateTemp(Size);
  1536. RtlCopyMemory(lpAlignedData, lpData, Size);
  1537. }
  1538. else {
  1539. lpAlignedData = lpData;
  1540. }
  1541. return lpAlignedData;
  1542. }
  1543. VOID
  1544. whCopyBack(
  1545. LPVOID lpData,
  1546. LPVOID lpAlignedData,
  1547. SIZE_T Size)
  1548. {
  1549. if (WOW64_ISPTR(lpData) && WOW64_ISPTR(lpAlignedData) && (lpData != lpAlignedData))
  1550. RtlCopyMemory(lpData, lpAlignedData, Size);
  1551. }
  1552. )
  1553. End=
  1554. Case=(SPI_GETBEEP,GET,PBOOL)
  1555. Case=(SPI_SETBEEP,NEITHER,X)
  1556. Case=(SPI_GETMOUSE,GET,LPINT,ARRAY_OF_3)
  1557. Case=(SPI_SETMOUSE,SET,LPINT,ARRAY_OF_3)
  1558. Case=(SPI_GETBORDER,GET,LPINT)
  1559. Case=(SPI_SETBORDER,NEITHER,X)
  1560. Case=(SPI_TIMEOUTS,NEITHER,X)
  1561. Case=(SPI_KANJIMENU,NEITHER,X)
  1562. Case=(SPI_GETKEYBOARDSPEED,GET,LPINT)
  1563. Case=(SPI_SETKEYBOARDSPEED,NEITHER,X)
  1564. Case=(SPI_LANGDRIVER,NEITHER,X)
  1565. Case=(SPI_ICONHORIZONTALSPACING,GET,LPINT)
  1566. Case=(SPI_GETSCREENSAVETIMEOUT,GET,LPINT)
  1567. Case=(SPI_SETSCREENSAVETIMEOUT,NEITHER,X)
  1568. Case=(SPI_GETSCREENSAVEACTIVE,GET,LPBOOL)
  1569. Case=(SPI_SETSCREENSAVEACTIVE,NEITHER,X)
  1570. Case=(SPI_GETGRIDGRANULARITY,NEITHER,X)
  1571. Case=(SPI_SETGRIDGRANULARITY,NEITHER,X)
  1572. Case=(SPI_SETDESKWALLPAPER,SET,PUNICODE_STRING)
  1573. Case=(SPI_SETDESKPATTERN,SET,LPWSTR)
  1574. Case=(SPI_GETKEYBOARDDELAY,GET,LPINT)
  1575. Case=(SPI_SETKEYBOARDDELAY,NEITHER,X)
  1576. Case=(SPI_ICONVERTICALSPACING,GET,LPINT)
  1577. Case=(SPI_GETICONTITLEWRAP,GET,LPINT)
  1578. Case=(SPI_SETICONTITLEWRAP,NEITHER,X)
  1579. Case=(SPI_GETMENUDROPALIGNMENT,GET,int*)
  1580. Case=(SPI_SETMENUDROPALIGNMENT,NEITHER,X)
  1581. Case=(SPI_SETDOUBLECLKWIDTH,NEITHER,X)
  1582. Case=(SPI_SETDOUBLECLKHEIGHT,NEITHER,X)
  1583. Case=(SPI_GETICONTITLELOGFONT,GET,LPLOGFONTW)
  1584. Case=(SPI_SETDOUBLECLICKTIME,NEITHER,X)
  1585. Case=(SPI_SETMOUSEBUTTONSWAP,NEITHER,X)
  1586. Case=(SPI_SETICONTITLELOGFONT,SET,LPLOGFONTW)
  1587. Case=(SPI_GETFASTTASKSWITCH,GET,PINT)
  1588. Case=(SPI_SETFASTTASKSWITCH,NEITHER,X)
  1589. Case=(SPI_SETDRAGFULLWINDOWS,NEITHER,X)
  1590. Case=(SPI_GETDRAGFULLWINDOWS,GET,PINT)
  1591. Case=(SPI_UNUSED39,NEITHER,X)
  1592. Case=(SPI_UNUSED40,NEITHER,X)
  1593. Case=(SPI_GETNONCLIENTMETRICS,GET,LPNONCLIENTMETRICS)
  1594. Case=(SPI_SETNONCLIENTMETRICS,SET,LPNONCLIENTMETRICS)
  1595. Case=(SPI_GETMINIMIZEDMETRICS,GET,LPMINIMIZEDMETRICS)
  1596. Case=(SPI_SETMINIMIZEDMETRICS,SET,LPMINIMIZEDMETRICS)
  1597. Case=(SPI_GETICONMETRICS,GET,LPICONMETRICS)
  1598. Case=(SPI_SETICONMETRICS,SET,LPICONMETRICS)
  1599. Case=(SPI_GETWORKAREA,GET,LPRECT)
  1600. Case=(SPI_SETWORKAREA,SET,LPRECT)
  1601. Case=(SPI_SETPENWINDOWS,NEITHER,X)
  1602. Case=(SPI_GETHIGHCONTRAST,GET,LPHIGHCONTRAST)
  1603. Case=(SPI_SETHIGHCONTRAST,SET,LPHIGHCONTRAST)
  1604. Case=(SPI_GETKEYBOARDPREF,GET,PBOOL)
  1605. Case=(SPI_SETKEYBOARDPREF,NEITHER,X)
  1606. Case=(SPI_GETSCREENREADER,GET,PBOOL)
  1607. Case=(SPI_SETSCREENREADER,NEITHER,X)
  1608. Case=(SPI_GETANIMATION,GET,LPANIMATIONINFO)
  1609. Case=(SPI_SETANIMATION,SET,LPANIMATIONINFO)
  1610. Case=(SPI_GETFONTSMOOTHING,GET,LPINT)
  1611. Case=(SPI_SETFONTSMOOTHING,NEITHER,X)
  1612. Case=(SPI_SETDRAGWIDTH,NEITHER,X)
  1613. Case=(SPI_SETDRAGHEIGHT,NEITHER,X)
  1614. Case=(SPI_SETHANDHELD,NEITHER,X)
  1615. Case=(SPI_GETLOWPOWERTIMEOUT,GET,LPINT)
  1616. Case=(SPI_GETPOWEROFFTIMEOUT,GET,LPINT)
  1617. Case=(SPI_SETLOWPOWERTIMEOUT,NEITHER,X)
  1618. Case=(SPI_SETPOWEROFFTIMEOUT,NEITHER,X)
  1619. Case=(SPI_GETLOWPOWERACTIVE,GET,LPBOOL)
  1620. Case=(SPI_GETPOWEROFFACTIVE,GET,LPBOOL)
  1621. Case=(SPI_SETLOWPOWERACTIVE,NEITHER,X)
  1622. Case=(SPI_SETPOWEROFFACTIVE,NEITHER,X)
  1623. Case=(SPI_SETCURSORS,NEITHER,X)
  1624. Case=(SPI_SETICONS,NEITHER,X)
  1625. Case=(SPI_GETDEFAULTINPUTLANG,GET,PHKL) ; see below
  1626. Case=(SPI_SETDEFAULTINPUTLANG,SET,PHKL) ; see below
  1627. Case=(SPI_SETLANGTOGGLE,NEITHER,X)
  1628. Case=(SPI_GETWINDOWSEXTENSION,NEITHER,X)
  1629. Case=(SPI_SETMOUSETRAILS,NEITHER,X)
  1630. Case=(SPI_GETMOUSETRAILS,NEITHER,X)
  1631. Case=(SPI_SETSCREENSAVERRUNNING,NEITHER,X)
  1632. Case=(SPI_GETFILTERKEYS,GET,LPFILTERKEYS)
  1633. Case=(SPI_SETFILTERKEYS,SET,LPFILTERKEYS)
  1634. Case=(SPI_GETTOGGLEKEYS,GET,LPTOGGLEKEYS)
  1635. Case=(SPI_SETTOGGLEKEYS,SET,LPTOGGLEKEYS)
  1636. Case=(SPI_GETMOUSEKEYS,GET,LPMOUSEKEYS)
  1637. Case=(SPI_SETMOUSEKEYS,SET,LPMOUSEKEYS)
  1638. Case=(SPI_SETSHOWSOUNDS,NEITHER,X)
  1639. Case=(SPI_GETSHOWSOUNDS,GET,PINT)
  1640. Case=(SPI_GETSTICKYKEYS,GET,LPSTICKYKEYS)
  1641. Case=(SPI_SETSTICKYKEYS,SET,LPSTICKYKEYS)
  1642. Case=(SPI_GETACCESSTIMEOUT,GET,LPACCESSTIMEOUT)
  1643. Case=(SPI_SETACCESSTIMEOUT,SET,LPACCESSTIMEOUT)
  1644. Case=(SPI_GETSERIALKEYS,NEITHER,X)
  1645. Case=(SPI_SETSERIALKEYS,NEITHER,X)
  1646. Case=(SPI_GETSOUNDSENTRY,Get,LPSOUNDSENTRY) ; see below
  1647. Case=(SPI_SETSOUNDSENTRY,Set,LPSOUNDSENTRY) ; see below
  1648. Case=(SPI_GETSNAPTODEFBUTTON,GET,LPBOOL)
  1649. Case=(SPI_SETSNAPTODEFBUTTON,NEITHER,X)
  1650. Case=(SPI_GETMOUSEHOVERWIDTH,GET,UINT*)
  1651. Case=(SPI_SETMOUSEHOVERWIDTH,NEITHER,X)
  1652. Case=(SPI_GETMOUSEHOVERHEIGHT,GET,UINT*)
  1653. Case=(SPI_SETMOUSEHOVERHEIGHT,NEITHER,X)
  1654. Case=(SPI_GETMOUSEHOVERTIME,GET,UINT*)
  1655. Case=(SPI_SETMOUSEHOVERTIME,NEITHER,X)
  1656. Case=(SPI_GETWHEELSCROLLLINES,GET,LPDWORD)
  1657. Case=(SPI_SETWHEELSCROLLLINES,NEITHER,X)
  1658. Case=(SPI_GETMENUSHOWDELAY,GET,LPDWORD)
  1659. Case=(SPI_SETMENUSHOWDELAY,NEITHER,X)
  1660. Case=(SPI_UNUSED108,NEITHER,X)
  1661. Case=(SPI_UNUSED109,NEITHER,X)
  1662. Case=(SPI_SETSHOWIMEUI,NEITHER,X)
  1663. Case=(SPI_GETSHOWIMEUI,GET,LPBOOL)
  1664. Case=(SPI_SETMOUSESPEED,NEITHER,X)
  1665. Case=(SPI_GETMOUSESPEED,GET,LPINT)
  1666. Case=(SPI_GETSCREENSAVERRUNNING,GET,LPBOOL)
  1667. Case=(SPI_GETDESKWALLPAPER,GET,LPWSTR)
  1668. Case=(SPI_GETACTIVEWINDOWTRACKING,GET,LPBOOL)
  1669. Case=(SPI_SETACTIVEWINDOWTRACKING,NEITHER,X)
  1670. Case=(SPI_GETMENUANIMATION,GET,LPBOOL)
  1671. Case=(SPI_SETMENUANIMATION,NEITHER,X)
  1672. Case=(SPI_GETCOMBOBOXANIMATION,GET,LPBOOL)
  1673. Case=(SPI_SETCOMBOBOXANIMATION,NEITHER,X)
  1674. Case=(SPI_GETLISTBOXSMOOTHSCROLLING,GET,LPBOOL)
  1675. Case=(SPI_SETLISTBOXSMOOTHSCROLLING,NEITHER,X)
  1676. Case=(SPI_GETGRADIENTCAPTIONS,GET,LPBOOL)
  1677. Case=(SPI_SETGRADIENTCAPTIONS,NEITHER,X)
  1678. Case=(SPI_GETKEYBOARDCUES,GET,LPBOOL)
  1679. Case=(SPI_SETKEYBOARDCUES,NEITHER,X)
  1680. ;Case=(SPI_GETMENUUNDERLINES,GET,LPBOOL) ; alias for GETKEYBOARDCUES
  1681. ;Case=(SPI_SETMENUUNDERLINES,NEITHER,X) ; alias for SETKEYBOARDCUES
  1682. Case=(SPI_GETACTIVEWNDTRKZORDER,GET,LPBOOL)
  1683. Case=(SPI_SETACTIVEWNDTRKZORDER,NEITHER,X)
  1684. Case=(SPI_GETHOTTRACKING,GET,LPBOOL)
  1685. Case=(SPI_SETHOTTRACKING,NEITHER,X)
  1686. Case=(SPI_UNUSED1010,GET,LPBOOL)
  1687. Case=(SPI_UNUSED1011,NEITHER,X)
  1688. Case=(SPI_GETMENUFADE,GET,LPBOOL)
  1689. Case=(SPI_SETMENUFADE,NEITHER,X)
  1690. Case=(SPI_GETSELECTIONFADE,GET,LPBOOL)
  1691. Case=(SPI_SETSELECTIONFADE,NEITHER,X)
  1692. Case=(SPI_GETTOOLTIPANIMATION,GET,LPBOOL)
  1693. Case=(SPI_SETTOOLTIPANIMATION,NEITHER,X)
  1694. Case=(SPI_GETTOOLTIPFADE,GET,LPBOOL)
  1695. Case=(SPI_SETTOOLTIPFADE,NEITHER,X)
  1696. Case=(SPI_GETCURSORSHADOW,GET,LPBOOL)
  1697. Case=(SPI_SETCURSORSHADOW,NEITHER,X)
  1698. Case=(SPI_GETUIEFFECTS,GET,LPBOOL)
  1699. Case=(SPI_SETUIEFFECTS,NEITHER,X)
  1700. Case=(SPI_GETFOREGROUNDLOCKTIMEOUT,GET,LPDWORD)
  1701. Case=(SPI_SETFOREGROUNDLOCKTIMEOUT,NEITHER,X)
  1702. Case=(SPI_GETACTIVEWNDTRKTIMEOUT,GET,LPDWORD)
  1703. Case=(SPI_SETACTIVEWNDTRKTIMEOUT,NEITHER,X)
  1704. Case=(SPI_GETFOREGROUNDFLASHCOUNT,GET,LPDWORD)
  1705. Case=(SPI_SETFOREGROUNDFLASHCOUNT,NEITHER,X)
  1706. Case=(SPI_GETCARETWIDTH,GET,LPDWORD)
  1707. Case=(SPI_SETCARETWIDTH,NEITHER,X)
  1708. Case=(SPI_GETFLATMENU,GET,PBOOL)
  1709. Case=(SPI_SETFLATMENU,NEITHER,X)
  1710. Case=(SPI_GETMOUSESONAR,GET,PBOOL)
  1711. Case=(SPI_SETMOUSESONAR,NEITHER,X)
  1712. Case=(SPI_GETMOUSECLICKLOCK,GET,PBOOL)
  1713. Case=(SPI_SETMOUSECLICKLOCK,NEITHER,X)
  1714. Case=(SPI_GETMOUSEVANISH,GET,PBOOL)
  1715. Case=(SPI_SETMOUSEVANISH,NEITHER,X)
  1716. Case=(SPI_GETDROPSHADOW,GET,PBOOL)
  1717. Case=(SPI_SETDROPSHADOW,NEITHER,X)
  1718. Case=(SPI_GETMOUSECLICKLOCKTIME,GET,LPDWORD)
  1719. Case=(SPI_SETMOUSECLICKLOCKTIME,NEITHER,X)
  1720. Case=(SPI_GETFONTSMOOTHINGTYPE,GET,LPDWORD)
  1721. Case=(SPI_SETFONTSMOOTHINGTYPE,NEITHER,X)
  1722. Case=(SPI_GETFONTSMOOTHINGCONTRAST,GET,LPDWORD)
  1723. Case=(SPI_SETFONTSMOOTHINGCONTRAST,NEITHER,X)
  1724. Case=(SPI_GETFOCUSBORDERWIDTH,GET,LPINT)
  1725. Case=(SPI_SETFOCUSBORDERWIDTH,NEITHER,X)
  1726. Case=(SPI_GETFOCUSBORDERHEIGHT,GET,LPINT)
  1727. Case=(SPI_SETFOCUSBORDERHEIGHT,NEITHER,X)
  1728. PreCall=
  1729. switch(wFlag) { @Indent(@NL
  1730. case SPI_SETDEFAULTINPUTLANG: @NL @Indent(
  1731. { @Indent( @NL
  1732. if (WOW64_ISPTR(lpData)) { @Indent( @NL
  1733. lpData = Wow64AllocateTemp(sizeof(HKL)); @NL
  1734. *(HKL *)lpData = (HKL)*(NT32HKL *)lpDataHost; @NL
  1735. )} @NL
  1736. break; @NL
  1737. )} @NL
  1738. )
  1739. case SPI_GETDEFAULTINPUTLANG: @NL @Indent(
  1740. { @Indent( @NL
  1741. if (WOW64_ISPTR(lpData)) { @Indent( @NL
  1742. lpData = Wow64AllocateTemp(sizeof(HKL)); @NL
  1743. )} @NL
  1744. break; @NL
  1745. )} @NL
  1746. )
  1747. case SPI_GETSOUNDSENTRY: @NL @Indent(
  1748. if (wParam != sizeof(NT32SOUNDSENTRY) || lpData == NULL) { @Indent( @NL
  1749. LOGPRINT((ERRORLOG, "SPI_GETSOUNDSENTRY: Invalid parameters\n"); @NL
  1750. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1751. )} @NL
  1752. if (((NT32SOUNDSENTRY *)(lpData))->cbSize != sizeof(NT32SOUNDSENTRY)) { @Indent( @NL
  1753. LOGPRINT((ERRORLOG, "SPI_GETSOUNDSENTRY: PSOUNDSENTRY: An cbSize of %x was passed to API, but %x was expected\n",
  1754. sizeof(NT32SOUNDSENTRY), ((NT32SOUNDSENTRY *)(lpData))->cbSize)); @NL
  1755. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1756. )} @NL
  1757. lpData = Wow64AllocateTemp(sizeof(SOUNDSENTRY)); @NL
  1758. ((SOUNDSENTRY*)lpData)->cbSize = sizeof(SOUNDSENTRY); @NL
  1759. break; @NL
  1760. )
  1761. case SPI_SETSOUNDSENTRY: @NL @Indent(
  1762. if (wParam != sizeof(NT32SOUNDSENTRY) || lpData == NULL) { @Indent( @NL
  1763. LOGPRINT((ERRORLOG, "SPI_SETSOUNDSENTRY: Invalid parameters\n"); @NL
  1764. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1765. )} @NL
  1766. if (((NT32SOUNDSENTRY *)(lpData))->cbSize != sizeof(NT32SOUNDSENTRY)) { @Indent( @NL
  1767. LOGPRINT((ERRORLOG, "SPI_GETSOUNDSENTRY: PSOUNDSENTRY: An cbSize of %x was passed to API, but %x was expected\n",
  1768. sizeof(NT32SOUNDSENTRY), ((NT32SOUNDSENTRY *)(lpData))->cbSize)); @NL
  1769. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1770. )} @NL
  1771. { @Indent( @NL
  1772. SOUNDSENTRY *SS,*SSCopy; @NL
  1773. NT32SOUNDSENTRY *SSHost = lpData; @NL
  1774. wParam = sizeof(SOUNDSENTRY); @NL
  1775. SS = SSCopy = Wow64AllocateTemp(sizeof(SOUNDSENTRY)); @NL
  1776. @ForceType(PreCall,SS,SSHost,LPSOUNDSENTRY,IN)
  1777. SS->cbSize = sizeof(SOUNDSENTRY); @NL
  1778. lpData = (PVOID)SS; @NL
  1779. )} @NL
  1780. break; @NL
  1781. )
  1782. case SPI_SETSERIALKEYS: @NL
  1783. case SPI_GETSERIALKEYS: @NL @Indent(
  1784. if (wParam != sizeof(NT32SERIALKEYS) || lpData == NULL) { @Indent( @NL
  1785. LOGPRINT((ERRORLOG, "SPI_SETSERIALKEYS: Invalid parameters\n"); @NL
  1786. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1787. )} @NL
  1788. if (((NT32SERIALKEYS *)(lpData))->cbSize != sizeof(NT32SERIALKEYS)) { @Indent( @NL
  1789. LOGPRINT((ERRORLOG, "SPI_GETSERIALKEYS: PSERIALKEYS: An cbSize of %x was passed to API, but %x was expected\n",
  1790. sizeof(NT32SERIALKEYS), ((NT32SERIALKEYS *)(lpData))->cbSize)); @NL
  1791. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1792. )} @NL
  1793. { @Indent( @NL
  1794. SERIALKEYS *SS,*SSCopy; @NL
  1795. NT32SERIALKEYS *SSHost = lpData; @NL
  1796. wParam = sizeof(SERIALKEYS); @NL
  1797. SS = SSCopy = Wow64AllocateTemp(sizeof(SERIALKEYS)); @NL
  1798. @ForceType(PreCall,SS,SSHost,LPSERIALKEYS,IN)
  1799. SS->cbSize = sizeof(SERIALKEYS); @NL
  1800. lpData = (PVOID)SS; @NL
  1801. )} @NL
  1802. break; @NL
  1803. )
  1804. case SPI_SETDESKWALLPAPER: @NL @Indent(
  1805. { @Indent( @NL
  1806. if (WOW64_ISPTR(lpData)) { @Indent( @NL
  1807. PUNICODE_STRING lpData64 = Wow64AllocateTemp(sizeof(UNICODE_STRING)); @NL
  1808. lpData64->Buffer = UlongToPtr(((PUNICODE_STRING32)lpData)->Buffer);@NL
  1809. lpData64->Length = ((PUNICODE_STRING32)lpData)->Length;@NL
  1810. lpData64->MaximumLength = ((PUNICODE_STRING32)lpData)->MaximumLength;@NL
  1811. lpData = (PVOID)lpData64; @NL
  1812. )} @NL
  1813. break; @NL
  1814. )} @NL
  1815. )
  1816. case SPI_GETWORKAREA: @NL @Indent(
  1817. {@Indent( @NL
  1818. lpData = whCreateAlignedCopy(lpData, TYPE_ALIGNMENT(RECT), sizeof(RECT)); @NL
  1819. break; @NL
  1820. )} @NL
  1821. )
  1822. case SPI_GETHIGHCONTRAST: @NL @Indent(
  1823. if (lpData == NULL) { @Indent( @NL
  1824. LOGPRINT((ERRORLOG, "SPI_SETHIGHCONTRASTW: Invalid parameters\n"); @NL
  1825. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1826. )} @NL
  1827. if (((NT32HIGHCONTRASTW *)(lpData))->cbSize != sizeof(NT32HIGHCONTRASTW)) { @Indent( @NL
  1828. LOGPRINT((ERRORLOG, "SPI_GETHIGHCONTRASTW: PHIGHCONTRASTW: An cbSize of %x was passed to API, but %x was expected\n",
  1829. sizeof(NT32HIGHCONTRASTW), ((NT32HIGHCONTRASTW *)(lpData))->cbSize)); @NL
  1830. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1831. )} @NL
  1832. { @Indent( @NL
  1833. HIGHCONTRASTW *SS,*SSCopy; @NL
  1834. NT32HIGHCONTRASTW *SSHost = lpData; @NL
  1835. wParam = sizeof(HIGHCONTRASTW); @NL
  1836. SS = SSCopy = Wow64AllocateTemp(sizeof(HIGHCONTRASTW)); @NL
  1837. @ForceType(PreCall,SS,SSHost,LPHIGHCONTRASTW,IN)
  1838. SS->cbSize = sizeof(HIGHCONTRASTW); @NL
  1839. lpData = (PVOID)SS; @NL
  1840. )} @NL
  1841. break; @NL
  1842. )
  1843. )}@NL
  1844. End=
  1845. PostCall=
  1846. switch(wFlag) { @Indent(@NL
  1847. case SPI_GETDEFAULTINPUTLANG: @NL @Indent(
  1848. if (WOW64_ISPTR(lpData)) { @Indent( @NL
  1849. *(NT32HKL *)lpDataHost = (NT32HKL)*(HKL *)lpData; @NL
  1850. )} @NL
  1851. break; @NL
  1852. )
  1853. case SPI_GETSOUNDSENTRY: @NL @Indent(
  1854. { @Indent( @NL
  1855. SOUNDSENTRY *SS = (SOUNDSENTRY *)lpData; @NL
  1856. NT32SOUNDSENTRY *SSHost = (NT32SOUNDSENTRY *)lpDataHost; @NL
  1857. SS->cbSize = sizeof(NT32SOUNDSENTRY); @NL
  1858. @ForceType(PostCall,SS,SSHost,LPSOUNDSENTRY,OUT)
  1859. )} @NL
  1860. break; @NL
  1861. )
  1862. case SPI_GETSERIALKEYS: @NL @Indent(
  1863. { @Indent( @NL
  1864. SERIALKEYS *SS = (SERIALKEYS *)lpData; @NL
  1865. NT32SERIALKEYS *SSHost = (NT32SERIALKEYS *)lpDataHost; @NL
  1866. SS->cbSize = sizeof(NT32SERIALKEYS); @NL
  1867. @ForceType(PostCall,SS,SSHost,LPSERIALKEYS,OUT)
  1868. )} @NL
  1869. break; @NL
  1870. )
  1871. case SPI_GETWORKAREA: @NL @Indent(
  1872. { @Indent( @NL
  1873. whCopyBack((LPVOID)lpDataHost, lpData, sizeof(RECT)); @NL
  1874. )} @NL
  1875. break; @NL
  1876. )
  1877. case SPI_GETHIGHCONTRAST: @NL @Indent(
  1878. { @Indent( @NL
  1879. HIGHCONTRASTW *SS = (HIGHCONTRASTW *)lpData; @NL
  1880. NT32HIGHCONTRASTW *SSHost = (NT32HIGHCONTRASTW *)lpDataHost; @NL
  1881. SS->cbSize = sizeof(NT32HIGHCONTRASTW); @NL
  1882. @ForceType(PostCall,SS,SSHost,LPHIGHCONTRASTW,OUT)
  1883. )} @NL
  1884. break; @NL
  1885. )
  1886. )}@NL
  1887. End=
  1888. Begin=
  1889. @GenDebugNonPtrDepCases(@ApiName,wFlag)
  1890. End=
  1891. TemplateName=NtUserCreateInputContext
  1892. NoType=dwClientImcData
  1893. PreCall=
  1894. // dwClientImcData can have the special value of 0, but otherwise the kernel does not @NL
  1895. // look at the data. @NL
  1896. dwClientImcData = (ULONG_PTR)dwClientImcDataHost; @NL
  1897. End=
  1898. TemplateName=NtUserUpdateInputContext
  1899. NoType=UpdateValue
  1900. PreCall=
  1901. // UpdateType can either be a UpdateClientInputContext or a UpdateInUseImeWindow. @NL
  1902. // If UpdateType is UpdateClientInputContext, UpdateValue is an opaque type to the kernel. @NL
  1903. // Thus it is OK to sign extend or not sign extend. @NL
  1904. // If UpdateType is UpdateInUseImeWindow, UpdateValue is a HWND. Should be signed extended. @NL
  1905. // Thus, sign extend in either case. @NL
  1906. UpdateValue = (ULONG_PTR)(LONG)UpdateValueHost; @NL
  1907. End=
  1908. TemplateName=NtUserVkKeyScanEx
  1909. NoType=dwHKLorPKL
  1910. PreCall=
  1911. // dwHKLorPKL is either a HKL or a PKL. Both of these need need to be sign extended. @NL
  1912. dwHKLorPKL = (ULONG_PTR)(LONG)dwHKLorPKLHost; @NL
  1913. End=
  1914. TemplateName=NtUserMapVirtualKeyEx
  1915. NoType=dwHKLorPKL
  1916. PreCall=
  1917. // dwHKLorPKL is either a HKL or a PKL. Both of these need need to be sign extended. @NL
  1918. dwHKLorPKL = (ULONG_PTR)(LONG)dwHKLorPKLHost; @NL
  1919. End=
  1920. TemplateName=NtUserWaitForInputIdle
  1921. NoType=idProcess
  1922. PreCall=
  1923. // idProcess is a ULONG_PTR, but internally a HANDLE. @NL
  1924. // Sign extend it. @NL
  1925. idProcess = (ULONG_PTR)(LONG)idProcessHost; @NL
  1926. End=
  1927. TemplateName=NtUserECQueryInputLangChange
  1928. NoType=wParam
  1929. PreCall=
  1930. // wParam is either LANGCHANGE_FORWARD or LANGCHANGE_BACKWARD @NL
  1931. // just use the default processing @NL
  1932. wParam = (WPARAM)wParamHost; @NL
  1933. End=
  1934. TemplateName=NtUserEnumDisplayMonitors
  1935. NoType=dwData
  1936. PreCall=
  1937. // dwData is app defined data. It will be truncated back at the callback. @NL
  1938. dwData = (LPARAM)dwDataHost; @NL
  1939. End=
  1940. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1941. ;;
  1942. ;;
  1943. ;; User32 Timer related functions.
  1944. ;;
  1945. ;; A User32 Timer ID is a ULONG_PTR. Fortunatly, if the timer is associated with
  1946. ;; a window the ID is application defined. If NULL is passed for the window,
  1947. ;; the system creates a timer in the range [TIMERID_MIN,TIMERID_MAX] or [0x100, 0x7FFF].
  1948. ;; Thus it doesn't matter if the ID is sign extended or not.
  1949. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1950. TemplateName=NtUserSetTimer
  1951. NoType=nIDEvent
  1952. PreCall=
  1953. nIDEvent = (ULONG_PTR)nIDEventHost; @NL
  1954. End=
  1955. PostCall=
  1956. WOWASSERT(RetVal <= 0xFFFFFFFF); @NL
  1957. End=
  1958. TemplateName=NtUserSetSystemTimer
  1959. NoType=nIDEvent
  1960. PreCall=
  1961. nIDEvent = (ULONG_PTR)nIDEventHost; @NL
  1962. End=
  1963. PostCall=
  1964. WOWASSERT(RetVal <= 0xFFFFFFFF); @NL
  1965. End=
  1966. TemplateName=NtUserKillTimer
  1967. NoType=nIDEvent
  1968. PreCall=
  1969. nIDEvent = (ULONG_PTR)nIDEventHost; @NL
  1970. End=
  1971. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1972. ;;
  1973. ;; User32 does not define kernel entry points for several simple functions.
  1974. ;; Instead, a few entry points are defined which take a api number to call.
  1975. ;; Fortunatly, none of the functions are pointer dependent except the functions
  1976. ;; which are called only from CSRSS.
  1977. ;;
  1978. ;; According to JerrySh, all the ULONG_PTR parameters through here should be
  1979. ;; sign-extendable including the handles.
  1980. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1981. TemplateName=NtUserCallNoParam
  1982. Header=
  1983. @NL
  1984. #if defined(WOW64DOPROFILE) @NL
  1985. #undef @ApiName_PROFILE_SUBLIST @NL
  1986. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  1987. #endif @NL
  1988. @NL
  1989. End=
  1990. PreCall=
  1991. USER_LOG_SIMPLE(xpfnProc); @NL
  1992. USER_PROFILE_SIMPLE(xpfnProc); @NL
  1993. End=
  1994. TemplateName=NtUserCallOneParam
  1995. NoType=dwParam
  1996. Header=
  1997. @NoFormat(
  1998. // BUG BUG HACK HACK Remove before ship!
  1999. // This is a hack to get the sign extension right for GDI object untill
  2000. // the GDI handle manager is fixed.
  2001. ULONG_PTR NtUserCallOneParamInternal(
  2002. IN ULONG_PTR dwParam,
  2003. IN DWORD xpfnProc)
  2004. {
  2005. if (SFI__WINDOWFROMDC == xpfnProc) {
  2006. ULONG_PTR Retval;
  2007. ULONG dwParamLocal;
  2008. //Try the signed extended handle first. If it fails, do the zero extended version.
  2009. Retval = NtUserCallOneParam(dwParam, xpfnProc);
  2010. if (Retval != 0) {
  2011. // the call suceeded, return the result.
  2012. return Retval;
  2013. }
  2014. // The call failed, fall through to the zero extended case
  2015. dwParamLocal = dwParam;
  2016. return NtUserCallOneParam((ULONG_PTR)dwParamLocal, xpfnProc);
  2017. }
  2018. return NtUserCallOneParam(dwParam, xpfnProc);
  2019. })
  2020. @NL
  2021. #if defined(WOW64DOPROFILE) @NL
  2022. #undef @ApiName_PROFILE_SUBLIST @NL
  2023. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2024. #endif @NL
  2025. @NL
  2026. End=
  2027. PreCall=
  2028. USER_LOG_SIMPLE(xpfnProc); @NL
  2029. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2030. dwParam = (ULONG_PTR)(NT32LONG_PTR)dwParamHost; @NL
  2031. End=
  2032. Begin=
  2033. @GenApiThunk(NtUserCallOneParamInternal)
  2034. End=
  2035. TemplateName=NtUserCallHwnd
  2036. Also=NtUserCallHwndOpt
  2037. Header=
  2038. @NL
  2039. #if defined(WOW64DOPROFILE) @NL
  2040. #undef @ApiName_PROFILE_SUBLIST @NL
  2041. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2042. #endif @NL
  2043. @NL
  2044. End=
  2045. PreCall=
  2046. USER_LOG_SIMPLE(xpfnProc); @NL
  2047. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2048. End=
  2049. TemplateName=NtUserCallHwndParam
  2050. NoType=dwParam
  2051. Header=
  2052. @NL
  2053. #if defined(WOW64DOPROFILE) @NL
  2054. #undef @ApiName_PROFILE_SUBLIST @NL
  2055. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2056. #endif @NL
  2057. @NL
  2058. End=
  2059. PreCall=
  2060. USER_LOG_SIMPLE(xpfnProc); @NL
  2061. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2062. dwParam = (ULONG_PTR)(NT32LONG_PTR)dwParamHost; @NL
  2063. End=
  2064. TemplateName=NtUserCallHwndLock
  2065. Header=
  2066. @NL
  2067. #if defined(WOW64DOPROFILE) @NL
  2068. #undef @ApiName_PROFILE_SUBLIST @NL
  2069. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2070. #endif @NL
  2071. @NL
  2072. End=
  2073. PreCall=
  2074. USER_LOG_SIMPLE(xpfnProc); @NL
  2075. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2076. End=
  2077. TemplateName=NtUserCallHwndParamLock
  2078. NoType=dwParam
  2079. Header=
  2080. @NL
  2081. #if defined(WOW64DOPROFILE) @NL
  2082. #undef @ApiName_PROFILE_SUBLIST @NL
  2083. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2084. #endif @NL
  2085. @NL
  2086. End=
  2087. PreCall=
  2088. USER_LOG_SIMPLE(xpfnProc); @NL
  2089. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2090. dwParam = (ULONG_PTR)(NT32LONG_PTR)dwParamHost; @NL
  2091. End=
  2092. TemplateName=NtUserCallTwoParam
  2093. NoType=dwParam1
  2094. NoType=dwParam2
  2095. Header=
  2096. @NL
  2097. #if defined(WOW64DOPROFILE) @NL
  2098. #undef @ApiName_PROFILE_SUBLIST @NL
  2099. #define @ApiName_PROFILE_SUBLIST &@ApiNameProfileTable @NL
  2100. #endif @NL
  2101. @NL
  2102. End=
  2103. PreCall=
  2104. USER_LOG_SIMPLE(xpfnProc); @NL
  2105. USER_PROFILE_SIMPLE(xpfnProc); @NL
  2106. dwParam1 = (ULONG_PTR)(NT32LONG_PTR)dwParam1Host; @NL
  2107. dwParam2 = (ULONG_PTR)(NT32LONG_PTR)dwParam2Host; @NL
  2108. End=
  2109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2110. ;;
  2111. ;; These functions may need revisiting
  2112. ;;
  2113. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2114. TemplateName=NtUserSetClipboardData
  2115. Begin=
  2116. @GenApiThunk(@ApiName)
  2117. End=
  2118. TemplateName=NtUserGetClipboardData
  2119. Begin=
  2120. @GenApiThunk(@ApiName)
  2121. End=
  2122. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2123. ;;
  2124. ;; These functions are messages related APIs
  2125. ;;
  2126. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2127. TemplateName=NtUserCheckImeHotKey
  2128. NoType=lParam
  2129. PreCall=
  2130. // lParam is the LPARAM of a KEYXXX message. @NL
  2131. // So just use the default processing. @NL
  2132. lParam = (LPARAM)lParamHost; @NL
  2133. End=
  2134. TemplateName=NtUserTranslateAccelerator
  2135. NoType=lpMsg
  2136. Locals=
  2137. // Only these messages are actually accepted. @NL
  2138. // WM_SYSKEYDOWN:
  2139. // WM_KEYDOWN:
  2140. // WM_CHAR
  2141. // WM_SYSCHAR
  2142. // No special thunking is required. @NL
  2143. MSG msg; @NL
  2144. End=
  2145. PreCall=
  2146. lpMsg = Wow64ShallowThunkMSG32TO64(&msg, (NT32MSG *)lpMsgHost); @NL
  2147. End=
  2148. PostCall=
  2149. // Message is an IN Message. @NL
  2150. switch(lpMsg->message) {@Indent(
  2151. case WM_SYSKEYDOWN: @NL
  2152. case WM_KEYDOWN: @NL
  2153. case WM_CHAR: @NL
  2154. case WM_SYSCHAR: @Indent( @NL
  2155. break; @NL
  2156. )@NL
  2157. default: @Indent( @NL
  2158. WOWASSERTMSG(!RetVal, "@ApiName translated unthunked message. Possible Error."); @NL
  2159. break;
  2160. )@NL
  2161. )}@NL
  2162. End=
  2163. TemplateName=NtUserTranslateMessage
  2164. NoType=lpMsg
  2165. Locals=
  2166. // Only these messages are actually accepted. @NL
  2167. // WM_SYSKEYDOWN:
  2168. // WM_SYSKEYUP:
  2169. // WM_KEYDOWN:
  2170. // WM_KEYUP:
  2171. // No special thunking is required. @NL
  2172. MSG msg; @NL
  2173. End=
  2174. PreCall=
  2175. lpMsg = Wow64ShallowThunkMSG32TO64(&msg, (NT32MSG *)lpMsgHost); @NL
  2176. End=
  2177. PostCall=
  2178. // Message is an IN Message. @NL
  2179. switch(lpMsg->message) {@Indent(
  2180. case WM_SYSKEYDOWN: @NL
  2181. case WM_SYSKEYUP: @NL
  2182. case WM_KEYDOWN: @NL
  2183. case WM_KEYUP: @Indent( @NL
  2184. break; @NL
  2185. )@NL
  2186. default: @Indent( @NL
  2187. WOWASSERTMSG(!RetVal, "@ApiName translated unthunked message. Possible Error."); @NL
  2188. break;
  2189. )@NL
  2190. )}@NL
  2191. End=
  2192. TemplateName=NtUserCallMsgFilter
  2193. NoType=lpMsg
  2194. Locals=
  2195. //This function invokes the WH_SYSMSGFILTER and WH_MSGFILTER hooks. @NL
  2196. //The kernel never deep probes the message, and the hook is not intersendable. @NL
  2197. //Thus it doesn't matter how the message is sign extended since the extra bits @NL
  2198. //are just going to be chopped off again. @NL
  2199. MSG msg; @NL
  2200. End=
  2201. PreCall=
  2202. // Thunk lpMsg. @NL
  2203. lpMsg = Wow64ShallowThunkMSG32TO64(&msg, (NT32MSG *)lpMsgHost); // Contains NULL guards. @NL
  2204. End=
  2205. Postcall=
  2206. // Thunk lpMsg. @NL
  2207. Wow64ShallowThunkMSG64TO32((NT32MSG *)lpMsgHost, lpMsg); // Contains NULL guards. @NL
  2208. End=
  2209. Begin=
  2210. @GenApiThunk(@ApiName)
  2211. End=
  2212. TemplateName=NtUserSendMessageCallback
  2213. NoType=dwData
  2214. NoType=lParam
  2215. NoType=wParam
  2216. Header=
  2217. @NoFormat(
  2218. typedef struct _NTUSERSENDMESSAGECALLBACK_PARMS {
  2219. HWND hwnd;
  2220. UINT wMsg;
  2221. //WPARAM wParam;
  2222. //LPARAM lParam;
  2223. SENDASYNCPROC lpResultCallBack;
  2224. ULONG_PTR dwData;
  2225. } NTUSERSENDMESSAGECALLBACK_PARMS, *PNTUSERSENDMESSAGECALLBACK_PARMS;
  2226. LONG_PTR whNT32NtUserSendMessageCallbackCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2227. PNTUSERSENDMESSAGECALLBACK_PARMS params = (PNTUSERSENDMESSAGECALLBACK_PARMS)pContext;
  2228. return NtUserSendMessageCallback(params->hwnd, params->wMsg, wParam, lParam,
  2229. params->lpResultCallBack, params->dwData);
  2230. }
  2231. BOOL whNT32NtUserSendMessageCallbackCall(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam,
  2232. SENDASYNCPROC lpResultCallBack, ULONG_PTR dwData) {
  2233. NTUSERSENDMESSAGECALLBACK_PARMS params;
  2234. params.hwnd = hwnd;
  2235. params.wMsg = wMsg;
  2236. params.lpResultCallBack = lpResultCallBack;
  2237. params.dwData = dwData;
  2238. return (Wow64DoMessageThunk(whNT32NtUserSendMessageCallbackCB, wMsg, wParam, lParam, &params)!=0);
  2239. }
  2240. )
  2241. End=
  2242. PreCall=
  2243. //dwData is a application defined data that is passed to the callback. It doesn't matter @NL
  2244. //how it is sign extended. @NL
  2245. dwData = (ULONG_PTR)dwDataHost; @NL
  2246. // wParam and lParam will be thunked by message thunks. @NL
  2247. wParam = (WPARAM)wParamHost; @NL
  2248. lParam = (LPARAM)lParamHost; @NL
  2249. End=
  2250. Begin=
  2251. @GenApiThunk(whNT32NtUserSendMessageCallbackCall)
  2252. End=
  2253. TemplateName=NtUserSendNotifyMessage
  2254. NoType=wParam
  2255. NoType=lParam
  2256. Header=
  2257. @NoFormat(
  2258. typedef struct _NTUSERSENDNOTIFYMESSAGE_PARMS {
  2259. HWND hwnd;
  2260. UINT wMsg;
  2261. // WPARAM wParam;
  2262. // LPARAM lParam;
  2263. } NTUSERSENDNOTIFYMESSAGE_PARMS, *PNTUSERSENDNOTIFYMESSAGE_PARMS;
  2264. LONG_PTR whNT32NtUserSendNotifyMessageCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2265. PNTUSERSENDNOTIFYMESSAGE_PARMS parms = (PNTUSERSENDNOTIFYMESSAGE_PARMS)pContext;
  2266. return NtUserSendNotifyMessage(parms->hwnd, parms->wMsg, wParam, lParam);
  2267. }
  2268. BOOL whNT32NtUserSendNotifyMessageCall(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam) {
  2269. NTUSERSENDNOTIFYMESSAGE_PARMS params;
  2270. params.hwnd = hwnd;
  2271. params.wMsg = wMsg;
  2272. return (Wow64DoMessageThunk(whNT32NtUserSendNotifyMessageCB, wMsg, wParam, lParam, &params)!=0);
  2273. }
  2274. )
  2275. End=
  2276. PreCall=
  2277. // wParam and lParam will be thunked by message thunks. @NL
  2278. wParam = (WPARAM)wParamHost; @NL
  2279. lParam = (LPARAM)lParamHost; @NL
  2280. End=
  2281. Begin=
  2282. @GenApiThunk(whNT32NtUserSendNotifyMessageCall)
  2283. End=
  2284. TemplateName=NtUserPeekMessage
  2285. NoType=pmsg
  2286. Locals=
  2287. // Should only return posted messages which should not have any function pointers. @NL
  2288. // It is ok to just chop information. @NL
  2289. MSG msg; @NL
  2290. End=
  2291. PreCall=
  2292. // Handle pmsg(OUT PMSG) @NL
  2293. pmsg = WOW64_ISPTR(pmsgHost) ? &msg : (PMSG) pmsgHost; @NL
  2294. End=
  2295. PostCall=
  2296. // Handle pmsg(OUT PMSG) @NL
  2297. if (RetVal) Wow64ShallowThunkMSG64TO32((NT32MSG *)pmsgHost, pmsg); @NL
  2298. End=
  2299. Begin=
  2300. @GenApiThunk(@ApiName)
  2301. End=
  2302. TemplateName=NtUserPostMessage
  2303. NoType=hwnd
  2304. NoType=wParam
  2305. NoType=lParam
  2306. Header=
  2307. @NoFormat(
  2308. typedef struct _NTUSERPOSTMESSAGE_PARMS {
  2309. HWND hwnd;
  2310. UINT wMsg;
  2311. // WPARAM wParam;
  2312. // LPARAM lParam;
  2313. } NTUSERPOSTMESSAGE_PARMS, *PNTUSERPOSTMESSAGE_PARMS;
  2314. LONG_PTR whNT32NtUserPostMessageCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2315. PNTUSERPOSTMESSAGE_PARMS parms = (PNTUSERPOSTMESSAGE_PARMS)pContext;
  2316. return NtUserPostMessage(parms->hwnd, parms->wMsg, wParam, lParam);
  2317. }
  2318. BOOL whNT32NtUserPostMessageCall(HWND hwnd, UINT wMsg, WPARAM wParam, LPARAM lParam) {
  2319. NTUSERPOSTMESSAGE_PARMS params;
  2320. params.hwnd = hwnd;
  2321. params.wMsg = wMsg;
  2322. return (Wow64DoMessageThunk(whNT32NtUserPostMessageCB, wMsg, wParam, lParam, &params) != 0);
  2323. }
  2324. )
  2325. End=
  2326. PreCall=
  2327. // user has a bug where -1 is not handled correctly. @NL
  2328. hwnd = (hwndHost == (NT32HWND)0xFFFFFFFF) ? (HWND)0xFFFFFFFF : (HWND)hwndHost; @NL
  2329. // wParam and lParam will be thunked by message thunks. @NL
  2330. wParam = (WPARAM)wParamHost; @NL
  2331. lParam = (LPARAM)lParamHost; @NL
  2332. End=
  2333. Begin=
  2334. @GenApiThunk(@ApiName)
  2335. End=
  2336. TemplateName=NtUserPostThreadMessage
  2337. NoType=wParam
  2338. NoType=lParam
  2339. Header=
  2340. @NoFormat(
  2341. typedef struct _NTUSERPOSTTHREADMESSAGE_PARMS {
  2342. DWORD id;
  2343. UINT msg;
  2344. // WPARAM wParam;
  2345. // LPARAM lParam;
  2346. } NTUSERPOSTTHREADMESSAGE_PARMS, *PNTUSERPOSTTHREADMESSAGE_PARMS;
  2347. LONG_PTR whNT32NtUserPostThreadMessageCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2348. PNTUSERPOSTTHREADMESSAGE_PARMS parms = (PNTUSERPOSTTHREADMESSAGE_PARMS)pContext;
  2349. return NtUserPostThreadMessage(parms->id, parms->msg, wParam, lParam);
  2350. }
  2351. BOOL whNT32NtUserPostThreadMessageCall(DWORD id, UINT msg, WPARAM wParam, LPARAM lParam) {
  2352. NTUSERPOSTTHREADMESSAGE_PARMS params;
  2353. params.id = id;
  2354. params.msg = msg;
  2355. return (Wow64DoMessageThunk(whNT32NtUserPostThreadMessageCB, msg, wParam, lParam, &params)!=0);
  2356. }
  2357. )
  2358. End=
  2359. PreCall=
  2360. // wParam and lParam will be thunked by message thunks. @NL
  2361. wParam = (WPARAM)wParamHost; @NL
  2362. lParam = (LPARAM)lParamHost; @NL
  2363. End=
  2364. Begin=
  2365. @GenApiThunk(whNT32NtUserPostThreadMessageCall)
  2366. End=
  2367. TemplateName=NtUserQuerySendMessage
  2368. PreCall=
  2369. NoFormat(
  2370. // This private api allows the user to get a copy of the top message on the SentMessages queue.
  2371. // Fortunatly, wow appears to be the only code that uses it so it does not need to be supported.
  2372. )
  2373. End=
  2374. Begin=
  2375. @GenUnsupportedNtApiThunk
  2376. End=
  2377. TemplateName=NtUserGetMessage
  2378. NoType=pmsg
  2379. Locals=
  2380. // Should only return posted messages which should not have any function pointers. @NL
  2381. // It is ok to just chop information. @NL
  2382. MSG msg; @NL
  2383. End=
  2384. PreCall=
  2385. // Handle pmsg(OUT PMSG) @NL
  2386. pmsg = WOW64_ISPTR(pmsgHost) ? &msg : (PMSG) pmsgHost; @NL
  2387. End=
  2388. PostCall=
  2389. // Handle pmsg(OUT PMSG) @NL
  2390. // The kernel always writes out this structure, even if the API fails. @NL
  2391. // Note that this is different from NtUserPeekMessage! @NL
  2392. Wow64ShallowThunkMSG64TO32((NT32MSG *)pmsgHost, pmsg); @NL
  2393. Begin=
  2394. @GenApiThunk(@ApiName)
  2395. End=
  2396. TemplateName=NtUserRealInternalGetMessage
  2397. NoType=pmsg
  2398. Locals=
  2399. // Should only return posted messages which should not have any function pointers. @NL
  2400. // It is ok to just chop information. @NL
  2401. MSG msg; @NL
  2402. End=
  2403. PreCall=
  2404. // Handle pmsg(OUT PMSG) @NL
  2405. pmsg = WOW64_ISPTR(pmsgHost) ? &msg : (PMSG) pmsgHost; @NL
  2406. End=
  2407. PostCall=
  2408. // Handle pmsg(OUT PMSG) @NL
  2409. // The kernel always writes out this structure, even if the API fails. @NL
  2410. // Note that this is different from NtUserPeekMessage! @NL
  2411. Wow64ShallowThunkMSG64TO32((NT32MSG *)pmsgHost, pmsg); @NL
  2412. Begin=
  2413. @GenApiThunk(@ApiName)
  2414. End=
  2415. TemplateName=NtUserDispatchMessage
  2416. NoType=pmsg
  2417. Header=
  2418. @NoFormat(
  2419. LONG_PTR whNT32NtUserDispatchMessageCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2420. MSG *msg = (MSG *)pContext;
  2421. msg->wParam = wParam;
  2422. msg->lParam = lParam;
  2423. return NtUserDispatchMessage(msg);
  2424. }
  2425. LONG_PTR whNT32NtUserDispatchMessageCall(MSG *msg) {
  2426. return Wow64DoMessageThunk(whNT32NtUserDispatchMessageCB, msg->message, msg->wParam, msg->lParam, msg);
  2427. }
  2428. )
  2429. End=
  2430. Locals=
  2431. // Message is sent through the message thunks to thunk WPARAM and LPARAM. @NL
  2432. MSG msg; @NL
  2433. End=
  2434. PreCall=
  2435. // Message is an IN message. @NL
  2436. pmsg = Wow64ShallowThunkMSG32TO64(&msg, (NT32MSG *)pmsgHost); @NL
  2437. End=
  2438. PostCall=
  2439. // Message is an IN message. @NL
  2440. End=
  2441. Begin=
  2442. @GenApiThunk(whNT32NtUserDispatchMessageCall)
  2443. End=
  2444. TemplateName=NtUserMessageCall
  2445. NoType=lParam
  2446. NoType=wParam
  2447. NoType=xParam
  2448. Header=
  2449. @NoFormat(
  2450. LONG_PTR whNT32NtUserMessageCallCB(WPARAM wParam, LPARAM lParam, PVOID pContext) {
  2451. PNTUSERMESSAGECALL_PARMS parms = (PNTUSERMESSAGECALL_PARMS)pContext;
  2452. return NtUserMessageCall(parms->hwnd, parms->msg, wParam, lParam, parms->xParam,
  2453. parms->xpfnProc, parms->bAnsi);
  2454. }
  2455. // Functions that are possible from NtUserMessageCall(xParam).
  2456. // FNID(FNID_SCROLLBAR) = xxxWrapSBWndProc - unreferenced;
  2457. // FNID(FNID_ICONTITLE) = xxxWrapDefWindowProc - unreferenced
  2458. // FNID(FNID_MENU) = xxxWrapMenuWindowProc - unreferenced
  2459. // FNID(FNID_DESKTOP) = xxxWrapDesktopWndProc - unreferenced
  2460. // FNID(FNID_DEFWINDOWPROC) = xxxWrapDefWindowProc - unreferenced
  2461. // FNID(FNID_SENDMESSAGE) = xxxWrapSendMessage - unreferenced
  2462. // FNID(FNID_HKINLPCWPEXSTRUCT) = fnHkINLPCWPEXSTRUCT - unrefereced, but is actually a hook call;
  2463. // FNID(FNID_HKINLPCWPRETEXSTRUCT) = fnHkINLPCWPRETEXSTRUCT - unrefereced, but is actually a hook call;
  2464. // FNID(FNID_SENDMESSAGEFF) = xxxSendMessageFF OPTIONAL IN OUT SNDMSGTIMEOUT*(ptr dep);
  2465. // FNID(FNID_SENDMESSAGEEX) = xxxSendMessageEx OPTIONAL IN OUT SNDMSGTIMEOUT*(ptr dep);
  2466. // FNID(FNID_CALLWINDOWPROC) = xxxWrapCallWindowProc - wndproc pointer.
  2467. // FNID(FNID_SENDMESSAGEBSM) = xxxWrapSendMessageBSM - INBROADCASTSYSTEMMSGPARAMS(non ptr dep)
  2468. // This is to ensure that the valid FNID entries have not been chagned. If they are, this list will
  2469. // need to be reinspected. The list of kernel functions is in.
  2470. #if (FNID_START != 0x0000029A && 0x000002B4)
  2471. #error the FNID list needs to be reinspected for parameters that are pointer dependent.
  2472. #endif
  2473. LONG_PTR whNT32NtUserMessageCall(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, ULONG_PTR xParam,
  2474. DWORD xpfnProc, BOOL bAnsi) {
  2475. NTUSERMESSAGECALL_PARMS params;
  2476. params.hwnd = hwnd;
  2477. params.msg = msg;
  2478. params.xpfnProc = xpfnProc;
  2479. params.bAnsi = bAnsi;
  2480. // SendMessage can have a timeout structure which needs to be thunked.
  2481. // The timeout structure is optional.
  2482. if (xParam && (FNID_SENDMESSAGEFF == xpfnProc || FNID_SENDMESSAGEEX == xpfnProc)) {
  2483. SNDMSGTIMEOUT sndmsgto64; // sndmsgto is IN OUT
  2484. NT32SNDMSGTIMEOUT *psndmsgto32;
  2485. LONG_PTR retval;
  2486. psndmsgto32 = (NT32SNDMSGTIMEOUT *)xParam;
  2487. params.xParam = (ULONG_PTR)&sndmsgto64;
  2488. sndmsgto64.fuFlags = psndmsgto32->fuFlags;
  2489. sndmsgto64.uTimeout = psndmsgto32->uTimeout;
  2490. sndmsgto64.lSMTOReturn = sndmsgto64.lSMTOResult = 0;
  2491. retval = Wow64DoMessageThunk(whNT32NtUserMessageCallCB, msg, wParam, lParam, &params);
  2492. psndmsgto32->lSMTOReturn = (NT32ULONG_PTR)sndmsgto64.lSMTOReturn;
  2493. psndmsgto32->lSMTOResult = (NT32ULONG_PTR)sndmsgto64.lSMTOResult;
  2494. return retval;
  2495. }
  2496. else {
  2497. params.xParam = xParam;
  2498. return Wow64DoMessageThunk(whNT32NtUserMessageCallCB, msg, wParam, lParam, &params);
  2499. }
  2500. }
  2501. )
  2502. End=
  2503. PreCall=
  2504. if (xpfnProc == FNID_CALLWINDOWPROC) { @NL
  2505. xParam = (ULONG_PTR) NtWow64MapClientFnToKernelClientFn((PROC)xParamHost); @NL
  2506. } else { @NL
  2507. xParam = (ULONG_PTR)xParamHost; @NL
  2508. } @NL
  2509. // lParam and wParam will be handled by the message thunks. @NL
  2510. wParam = (WPARAM)wParamHost; @NL
  2511. lParam = (LPARAM)lParamHost; @NL
  2512. End=
  2513. Begin=
  2514. @GenApiThunk(whNT32NtUserMessageCall)
  2515. End=
  2516. ;; Code for NtUserCallNextHookEx
  2517. [Macros]
  2518. TemplateName=DoNtUserCallNextHookEx
  2519. NumArgs=3
  2520. Begin=
  2521. { @Indent( @NL
  2522. @MArg(1) wParamTemp; @NL
  2523. @MArg(2) lParamTemp; @NL
  2524. LPARAM RetVal; @NL
  2525. @ForceType(Locals,wParamTemp,wParam,@MArg(1),IN)
  2526. @ForceType(Locals,lParamTemp,lParam,@MArg(2),@MArg(3))
  2527. @ForceType(PreCall,lParamTemp,lParam,@MArg(2),@MArg(3))
  2528. @ForceType(PreCall,wParamTemp,wParam,@MArg(1),@MArg(3))
  2529. RetVal = NtUserCallNextHookEx(nCode, (WPARAM)wParamTemp, (LPARAM)lParamTemp, bAnsi); @NL
  2530. @ForceType(PostCall,wParamTemp,wParam,@MArg(1),IN)
  2531. @ForceType(PostCall,lParamTemp,lParam,@MArg(2),@MArg(3))
  2532. return RetVal; @NL
  2533. )} @NL
  2534. End=
  2535. [EFunc]
  2536. TemplateName=NtUserCallNextHookEx
  2537. NoType=wParam
  2538. NoType=lParam
  2539. PreCall=
  2540. // These parameters will be deep thunked in whNT32NtUserCallNextHookEx @NL
  2541. wParam = (WPARAM)wParamHost; @NL
  2542. lParam = (LPARAM)lParamHost; @NL
  2543. End=
  2544. Header=
  2545. @NL
  2546. LRESULT whNT32NtUserCallNextHookEx(int nCode, WPARAM wParam, LPARAM lParam, BOOL bAnsi) { @Indent(
  2547. // WPARAM and LPARAM are the 32BIT versions of these parameters. @NL
  2548. // This function will complete the conversion to 64BIT. @NL
  2549. @NL
  2550. PCLIENTINFO pci;
  2551. INT HookType;
  2552. // Determine the hook type that is being called. Modeled after CallNextHookEx. @NL
  2553. @NL
  2554. pci = Wow64GetClientInfo(); @NL
  2555. HookType = (INT)(SHORT)HIWORD(pci->dwHookCurrent); @NL
  2556. @NL
  2557. LOGPRINT((TRACELOG, "whNT32NtUserCallNextHookEx: Calling hook %x\n", HookType));
  2558. switch(HookType) { @Indent( @NL
  2559. @NL
  2560. case WH_CBT: @Indent( @NL
  2561. //Multiple types of CBT hooks exists! @NL
  2562. @NL
  2563. switch(nCode) { @Indent( @NL
  2564. case HCBT_CLICKSKIPPED: @NL @Indent( @NL
  2565. //This hook has the same parameters as WH_MOUSE @NL
  2566. goto MouseHook; @NL
  2567. break; @NL
  2568. ) @NL
  2569. case HCBT_CREATEWND: @NL @Indent( @NL
  2570. // LPARAM is an IN OUT LPCBT_CREATEWND @NL
  2571. // Note: the kernel never dereferences lpCreateParams. @NL
  2572. // WPARAM is a handle to the window. @NL
  2573. @DoNtUserCallNextHookEx(HWND,LPCBT_CREATEWND,IN OUT)
  2574. break; @NL
  2575. ) @NL
  2576. case HCBT_MOVESIZE: @NL @Indent( @NL
  2577. // WPARAM is an HWND @NL
  2578. // LPARAM is a IN LPRECT structure. @NL
  2579. @DoNtUserCallNextHookEx(HWND,LPRECT,IN)
  2580. break; @NL
  2581. ) @NL
  2582. case HCBT_ACTIVATE: @NL @Indent( @NL
  2583. // WPARAM is an LPCBTACTIVATESTRUCT @NL
  2584. // LPARAM is a IN LPRECT structure. @NL
  2585. @DoNtUserCallNextHookEx(HWND,LPCBTACTIVATESTRUCT,IN)
  2586. break; @NL
  2587. ) @NL
  2588. case HCBT_DESTROYWND: //(HWND, unused 0) @NL
  2589. case HCBT_QS: // (unused 0, unused 0) @NL
  2590. case HCBT_MINMAX: //(HWND, LOWORD SW_*) @NL
  2591. case HCBT_SETFOCUS: //(HWND, HWND) @Indent( @NL
  2592. // All of these hooks can have both parameters sign extended. @NL
  2593. return NtUserCallNextHookEx(nCode, (WPARAM)(LONG)wParam, (LPARAM)(LONG)lParam, bAnsi); @NL
  2594. break; @NL
  2595. ) @NL
  2596. case HCBT_KEYSKIPPED: //(UINT, UINT) @NL
  2597. case HCBT_SYSCOMMAND: //(UINT, UINT) @Indent( @NL
  2598. // Both of these should be zero extended. @NL
  2599. return NtUserCallNextHookEx(nCode, (WPARAM)(UINT)wParam, (LPARAM)(UINT)lParam, bAnsi); @NL
  2600. ) @NL
  2601. default: @NL @Indent( @NL
  2602. LOGPRINT((ERRORLOG, "NtUserCallNextHookEx: called with invalid CBT hook type %x\n")); @NL
  2603. // Fail the API, but let the service dispatcher do the failing. @NL
  2604. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  2605. return 0;
  2606. )
  2607. )} @NL
  2608. ) @NL
  2609. case WH_SHELL: @Indent( @NL
  2610. // If nCode is HSELL_ACCESSIBILITYSTATE, the wParam contains is small unsigned value. Sign @NL
  2611. // extending it will not hurt anything. In all other cases, wParam is a handle or ignored so @NL
  2612. // always sign extend. @NL
  2613. // lParam is either a BOOL, a HANDLE, or a pointer. So always sign extend lParam. @NL
  2614. WOWASSERT(sizeof(RECT) == sizeof(NT32RECT)); @NL
  2615. // These codes are documented in MSDN @NL
  2616. switch(nCode) { @Indent( @NL
  2617. case HSHELL_ACCESSIBILITYSTATE: //(UINT wParam, UNUSED lParam)@NL
  2618. case HSHELL_ACTIVATESHELLWINDOW: //(UNUSED, UNUSED)@NL
  2619. case HSHELL_GETMINRECT: //(HWND wParam, PRECT lParam)@NL
  2620. case HSHELL_LANGUAGE: //(HWND wParam, HKL lParam)@NL
  2621. case HSHELL_REDRAW: //(HWND wParam, BOOL lParam)@NL
  2622. case HSHELL_TASKMAN: //(UNUSED, UNUSED)@NL
  2623. case HSHELL_WINDOWACTIVATED: //(HWND wParam, BOOL lParam)@NL
  2624. case HSHELL_WINDOWCREATED: //(HWND wParam, BOOL lParam)@NL
  2625. case HSHELL_WINDOWDESTROYED: //(HWND wparam, BOOL lParam) @Indent( @NL
  2626. break; @NL
  2627. )
  2628. default: @Indent( @NL
  2629. LOGPRINT((ERRORLOG, "NtUserCallNextHookEx: WH_SHELL called with unknown nCode.")); @NL
  2630. break; @NL
  2631. )
  2632. )}@NL
  2633. return NtUserCallNextHookEx(nCode, (WPARAM)(LONG)wParam, (LPARAM)(LONG)lParam, bAnsi); @NL
  2634. ) @NL
  2635. case WH_FOREGROUNDIDLE: @Indent(
  2636. // WH_FORGROUNDIDEL has no parameters. @NL
  2637. // Fall through and use the thunk for WH_KEYBOARD @NL
  2638. )
  2639. case WH_KEYBOARD: @Indent( @NL
  2640. // WH_KEYBOARD represents a WM_KEYUP or a WM_KEYDOWN. @NL
  2641. // Both of them have the same prototype. @NL
  2642. // (UINT nVirtKey, UINT KeyData) @NL
  2643. return NtUserCallNextHookEx(nCode, (WPARAM)(UINT)wParam, (LPARAM)(UINT)lParam, bAnsi); @NL
  2644. break; @NL
  2645. ) @NL
  2646. case WH_MSGFILTER: @NL
  2647. case WH_SYSMSGFILTER: @NL
  2648. case WH_GETMESSAGE: @Indent( @NL
  2649. // All of these hooks take an lpMsg as their last parameter. @NL
  2650. // Since none of the messages here can have pointers, NtUserCallNextHookEx @NL
  2651. // does not deep probe the message and does not touch the lParam and wParam. @NL
  2652. // Also, none of these messages are intersendable, so we don't need to worry @NL
  2653. // about a 64bit process looking at the structures that the message points to. @NL
  2654. // The 32bit process will truncate the upper bits in the thunks when the hook gets called back @NL
  2655. // so sign extension doesn't matter either. @NL
  2656. { @Indent( @NL
  2657. MSG msg; @NL
  2658. PMSG pMsg; @NL
  2659. pMsg = Wow64ShallowThunkMSG32TO64(&msg, (NT32MSG *)lParam); @NL
  2660. return NtUserCallNextHookEx(nCode, (WPARAM)wParam, (LPARAM)pMsg, bAnsi); @NL
  2661. )} @NL
  2662. break; @NL
  2663. ) @NL
  2664. // Need to return to this.
  2665. case WH_JOURNALPLAYBACK: @NL
  2666. case WH_JOURNALRECORD: @Indent( @NL
  2667. // wParam is unused and lParam is a LPEVENTMSG, this structure is IN on a WH_JOURNALPLAYBACK @NL
  2668. // it is an OUT on a WH_JOURNALRECORD @NL
  2669. // The kernel has shared probing code here, and it copied the message as IN OUT in both @NL
  2670. // cases so the same will be done here. Also, this message has the WPARAM and LPARAM declared @NL
  2671. // as UINT in the Win32 and Win64 so their is no need to worry about signed extending vs. zero extending. @NL
  2672. { @Indent( @NL
  2673. LPARAM RetVal; @NL
  2674. EVENTMSG EventMsg; @NL
  2675. LPEVENTMSG pEventMsg; @NL
  2676. @NL
  2677. pEventMsg = Wow64ShallowThunkEVENTMSG32TO64(&EventMsg, (NT32EVENTMSG*)lParam); @NL
  2678. // WPARAM is undefined @NL
  2679. RetVal = NtUserCallNextHookEx(nCode, (ULONG64)wParam, (LPARAM)pEventMsg, bAnsi); @NL
  2680. Wow64ShallowThunkEVENTMSG64TO32((NT32EVENTMSG*)lParam, pEventMsg); @NL
  2681. return RetVal; @NL
  2682. )} @NL
  2683. break; @NL
  2684. ) @NL
  2685. case WH_DEBUG: @Indent( @NL
  2686. // Takes an IN lpDebugHookStruct. @NL
  2687. // wparam is the hook being called. It is INT because -1 is a valid value. @NL
  2688. // Currently, USER32 code for this message is not deep copying the message @NL
  2689. // into the kernel. Thus, this code doesn't either. This will need to be @NL
  2690. // revisited if user32 code changes. @NL
  2691. { @Indent( @NL
  2692. DEBUGHOOKINFO dbginfo; @NL
  2693. LPDEBUGHOOKINFO dbginfo64; @NL
  2694. NT32DEBUGHOOKINFO *dbginfo32; @NL
  2695. if (ARGUMENT_PRESENT(lParam)) {@Indent( @NL
  2696. dbginfo64 = &dbginfo; @NL
  2697. dbginfo32 = (NT32DEBUGHOOKINFO *)lParam; @NL
  2698. dbginfo64->idThread = dbginfo32->idThread; @NL
  2699. dbginfo64->idThreadInstaller = dbginfo32->idThreadInstaller; @NL
  2700. dbginfo64->lParam = (LPARAM)dbginfo32->lParam; @NL
  2701. dbginfo64->wParam = (WPARAM)dbginfo32->wParam; @NL
  2702. dbginfo64->code = dbginfo32->code; @NL
  2703. )} @NL
  2704. else { @Indent( @NL
  2705. dbginfo64 = NULL; @NL
  2706. )} @NL
  2707. return NtUserCallNextHookEx(nCode, (WPARAM)(INT)wParam, (LPARAM)dbginfo64, bAnsi); @NL
  2708. )}
  2709. break; @NL
  2710. ) @NL
  2711. case WH_KEYBOARD_LL: @Indent( @NL
  2712. // Takes an UINT messageid, and IN lpKbdllHookStruct. @NL
  2713. @DoNtUserCallNextHookEx(UINT,LPKBDLLHOOKSTRUCT,IN)
  2714. break; @NL
  2715. ) @NL
  2716. case WH_MOUSE_LL: @Indent( @NL
  2717. // Takes an UINT message id, and an IN lpMsllHookStruct. @NL
  2718. @DoNtUserCallNextHookEx(UINT,LPMSLLHOOKSTRUCT,IN)
  2719. break; @NL
  2720. ) @NL
  2721. case WH_MOUSE: @Indent( @NL
  2722. MouseHook: @NL
  2723. // This takes an UINT message id, and an lpMouseHookStruct. @NL
  2724. @DoNtUserCallNextHookEx(UINT,LPMOUSEHOOKSTRUCT,IN)
  2725. break; @NL
  2726. ) @NL
  2727. default: @Indent( @NL
  2728. LOGPRINT((ERRORLOG, "NtUserCallNextHookEx: called with invalid hook type %x\n", HookType)); @NL
  2729. // Fail the API@NL
  2730. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  2731. return 0; @NL
  2732. )@NL
  2733. @NL
  2734. )} @NL
  2735. )} @NL
  2736. @NL
  2737. End=
  2738. Begin=
  2739. @GenApiThunk(whNT32NtUserCallNextHookEx)
  2740. End=
  2741. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2742. ;;
  2743. ;; This function is only called by the spooler.
  2744. ;;
  2745. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2746. TemplateName=NtGdiGetSpoolMessage
  2747. Begin=
  2748. @GenUnsupportedNtApiThunk
  2749. End=
  2750. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2751. ;;
  2752. ;; These functions can only be called from CSR
  2753. ;;
  2754. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2755. TemplateName=NtGdiFullscreenControl
  2756. Also=NtUserHardErrorControl
  2757. Also=NtUserSetInformationThread
  2758. Also=NtUserConsoleControl
  2759. Also=NtUserRemoteConnect
  2760. Also=NtUserRemoteRedrawRectangle
  2761. Also=NtUserRemoteRedrawScreen
  2762. Also=NtUserRemoteStopScreenUpdates
  2763. Also=NtUserCtxDisplayIOCtl
  2764. Also=NtUserQueryInformationThread
  2765. Also=NtUserSetInformationProcess
  2766. Also=NtUserNotifyProcessCreate
  2767. Also=NtUserGetMediaChangeEvents
  2768. Begin=NtUserProcessConnect
  2769. @GenUnsupportedNtApiThunk
  2770. End=
  2771. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2772. ;;
  2773. ;; NtUser Generic Input APIs.
  2774. ;;
  2775. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2776. TemplateName=NtUserGetRawInputData
  2777. Locals=
  2778. UINT HeaderDiff6432;
  2779. End=
  2780. PreCall=
  2781. HeaderDiff6432 = sizeof (RAWINPUTHEADER) - sizeof (NT32RAWINPUTHEADER);
  2782. if (cbSizeHeaderHost == sizeof (NT32RAWINPUTHEADER)) { @NL
  2783. @NL
  2784. cbSizeHeader = sizeof (RAWINPUTHEADER); @NL
  2785. if (pData != NULL) { @NL
  2786. switch (uiCommand) { @NL
  2787. case RID_HEADER: @NL
  2788. *pcbSize = cbSizeHeader; @NL
  2789. pData = Wow64AllocateTemp (cbSizeHeader); @NL
  2790. break; @NL
  2791. case RID_INPUT: @NL
  2792. *pcbSize += HeaderDiff6432; @NL
  2793. pData = Wow64AllocateTemp (*pcbSize); @NL
  2794. break; @NL
  2795. } @NL
  2796. } @NL
  2797. } @NL
  2798. End=
  2799. PostCall=
  2800. if (RetVal != -1) { @NL
  2801. switch (uiCommand) { @NL
  2802. case RID_HEADER: @NL
  2803. *pcbSize = sizeof (NT32RAWINPUTHEADER); @NL
  2804. if (pData != NULL) { @NL
  2805. @ForceType(PostCall, ((PRAWINPUTHEADER)pData), ((NT32RAWINPUTHEADER *)pDataHost),PRAWINPUTHEADER,OUT)
  2806. ((NT32RAWINPUTHEADER *)pDataHost)->dwSize = sizeof (NT32RAWINPUTHEADER); @NL
  2807. } @NL
  2808. break; @NL
  2809. case RID_INPUT: @NL
  2810. @NL
  2811. *pcbSize -= HeaderDiff6432; @NL
  2812. if (pData != NULL) { @NL
  2813. @ForceType(PostCall, ((PRAWINPUTHEADER)pData), ((NT32RAWINPUTHEADER *)pDataHost),PRAWINPUTHEADER,OUT)
  2814. ((NT32RAWINPUTHEADER *)pDataHost)->dwSize = sizeof (NT32RAWINPUTHEADER); @NL
  2815. @NL
  2816. pDataHost = (UINT)((NT32RAWINPUTHEADER *)pDataHost + 1);@NL
  2817. pData = (PRAWINPUTHEADER)((PRAWINPUTHEADER)pData + 1);@NL
  2818. RtlCopyMemory ((PVOID)pDataHost, pData, @NL
  2819. RetVal - sizeof (RAWINPUTHEADER)); @NL
  2820. } @NL
  2821. @NL
  2822. break; @NL
  2823. } @NL
  2824. if (RetVal > 0) { @NL
  2825. RetVal -= HeaderDiff6432; @NL
  2826. } @NL
  2827. } @NL
  2828. End=
  2829. Begin=
  2830. @GenApiThunk(@ApiName)
  2831. End=
  2832. TemplateName=NtUserGetRawInputBuffer
  2833. NoType=pData
  2834. PreCall=
  2835. if (cbSizeHeaderHost == sizeof (NT32RAWINPUTHEADER)) { @NL
  2836. @NL
  2837. cbSizeHeader = sizeof (RAWINPUTHEADER); @NL
  2838. } @NL
  2839. pData = (PRAWINPUT)pDataHost; @NL
  2840. End=
  2841. Begin=
  2842. @GenApiThunk(@ApiName)
  2843. End=
  2844. TemplateName=NtUserGetRawInputDeviceList
  2845. Locals=
  2846. UINT nDevices; @NL
  2847. NT32RAWINPUTDEVICELIST *pRawInputDeviceList32 = (NT32RAWINPUTDEVICELIST *)pRawInputDeviceListHost; @NL
  2848. End=
  2849. PreCall=
  2850. if (cbSize == sizeof (NT32RAWINPUTDEVICELIST)) { @NL
  2851. @NL
  2852. cbSize = sizeof (RAWINPUTDEVICELIST); @NL
  2853. if (pRawInputDeviceList != NULL) { @NL
  2854. RetVal = NtUserGetRawInputDeviceList(NULL, @NL
  2855. &nDevices, @NL
  2856. sizeof (RAWINPUTDEVICELIST)); @NL
  2857. if (RetVal == -1) { @NL
  2858. LOGPRINT((ERRORLOG, "whNtUserGetRawInputDeviceList: Failed to retreive number of devices.")); @NL
  2859. return RetVal; @NL
  2860. } @NL
  2861. pRawInputDeviceList = Wow64AllocateTemp (nDevices * sizeof (RAWINPUTDEVICELIST)); @NL
  2862. } @NL
  2863. } @NL
  2864. End=
  2865. PostCall=
  2866. if (RetVal != -1) { @NL
  2867. if (pRawInputDeviceList != NULL) { @NL
  2868. for (nDevices = 0; nDevices < *puiNumDevices; nDevices++) { @NL
  2869. @ForceType(PostCall,((PRAWINPUTDEVICELIST)(&pRawInputDeviceList[nDevices])), &pRawInputDeviceList32[nDevices], PRAWINPUTDEVICELIST,OUT)
  2870. } @NL
  2871. } @NL
  2872. } @NL
  2873. End=
  2874. Begin=
  2875. @GenApiThunk(@ApiName)
  2876. End=
  2877. TemplateName=NtUserRegisterRawInputDevices
  2878. NoType=pRawInputDevices
  2879. Locals=
  2880. UINT nDevice; @NL
  2881. NT32RAWINPUTDEVICE *pRawInputDevices32; @NL
  2882. PRAWINPUTDEVICE pRawInputDevicesTemp; @NL
  2883. End=
  2884. PreCall=
  2885. pRawInputDevices = (PRAWINPUTDEVICE)pRawInputDevicesHost; @NL
  2886. if (cbSize == sizeof (NT32RAWINPUTDEVICE)) { @NL
  2887. @NL
  2888. cbSize = sizeof (RAWINPUTDEVICE); @NL
  2889. if (pRawInputDevices != NULL) { @NL
  2890. pRawInputDevices = Wow64AllocateTemp (uiNumDevices * cbSize); @NL
  2891. pRawInputDevicesTemp = pRawInputDevices; @NL
  2892. pRawInputDevices32 = (NT32RAWINPUTDEVICE *)pRawInputDevicesHost;@NL
  2893. for (nDevice = 0 ; nDevice < uiNumDevices ; nDevice++) { @NL
  2894. @ForceType(PreCall,(*pRawInputDevicesTemp),(*pRawInputDevices32),RAWINPUTDEVICE,IN)
  2895. pRawInputDevicesTemp++; @NL
  2896. pRawInputDevices32++; @NL
  2897. } @NL
  2898. } @NL
  2899. } @NL
  2900. End=
  2901. Begin=
  2902. @GenApiThunk(@ApiName)
  2903. End=
  2904. TemplateName=NtUserGetRegisteredRawInputDevices
  2905. NoType=pRawInputDevices
  2906. Locals=
  2907. UINT nDevice;
  2908. NT32RAWINPUTDEVICE *pRawInputDevices32; @NL
  2909. End=
  2910. PreCall=
  2911. pRawInputDevices = (PRAWINPUTDEVICE)pRawInputDevicesHost; @NL
  2912. if (cbSize == sizeof (NT32RAWINPUTDEVICE)) { @NL
  2913. cbSize = sizeof (RAWINPUTDEVICE); @NL
  2914. } @NL
  2915. if (pRawInputDevices != NULL) { @NL
  2916. pRawInputDevices = Wow64AllocateTemp (*puiNumDevices * sizeof (RAWINPUTDEVICE));@NL
  2917. } @NL
  2918. End=
  2919. PostCall=
  2920. if (RetVal != -1) { @NL
  2921. if (pRawInputDevices != NULL) { @NL
  2922. pRawInputDevices32 = (NT32RAWINPUTDEVICE *)pRawInputDevicesHost;@NL
  2923. for (nDevice = 0 ; nDevice < *puiNumDevices ; nDevice++) { @NL
  2924. @ForceType(PostCall,(*pRawInputDevices),(*pRawInputDevices32),RAWINPUTDEVICE,OUT)
  2925. pRawInputDevices++; @NL
  2926. pRawInputDevices32++; @NL
  2927. } @NL
  2928. } @NL
  2929. } @NL
  2930. End=
  2931. Begin=
  2932. @GenApiThunk(@ApiName)
  2933. End=
  2934. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2935. ;;
  2936. ;; WOW will not be supported on NT64 period.
  2937. ;;
  2938. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2939. TemplateName=NtUserGetWOWClass
  2940. Begin=
  2941. @GenUnsupportedNtApiThunk
  2942. End=
  2943. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2944. ;;
  2945. ;; These functions are not implemented in the kernel
  2946. ;;
  2947. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2948. TemplateName=NtGdiUnmapMemFont
  2949. Begin=
  2950. @GenUnsupportedNtApiThunk
  2951. End=
  2952. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2953. ;;
  2954. ;; DDE functions.
  2955. ;;
  2956. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2957. TemplateName=NtUserDdeGetQualityOfService
  2958. Begin=
  2959. @GenApiThunk(@ApiName)
  2960. End=
  2961. TemplateName=NtUserDdeInitialize
  2962. Begin=
  2963. @GenApiThunk(@ApiName)
  2964. End=
  2965. TemplateName=NtUserDdeSetQualityOfService
  2966. Begin=
  2967. @GenApiThunk(@ApiName)
  2968. End=
  2969. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2970. ;;
  2971. ;; DirectX will need alot more work to get it working.
  2972. ;;
  2973. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2974. TemplateName=NtGdiD3dContextCreate
  2975. NoType=hDirectDrawLocal
  2976. NoType=hSurfColor
  2977. NoType=hSurfZ
  2978. NoType=pdcci
  2979. Locals=
  2980. BYTE pdcciCopy[sizeof(D3DNTHAL_CONTEXTCREATEI)]; @NL
  2981. D3D8_CONTEXTCREATEDATA *pCCD; @NL
  2982. NT32D3D8_CONTEXTCREATEDATA *pCCDHost; @NL
  2983. pdcci = (D3DNTHAL_CONTEXTCREATEI *)pdcciCopy; @NL
  2984. pCCD=(D3D8_CONTEXTCREATEDATA *)pdcciCopy; @NL
  2985. pCCDHost=(NT32D3D8_CONTEXTCREATEDATA *)pdcciHost; @NL
  2986. End=
  2987. PreCall=
  2988. hDirectDrawLocal=(HANDLE)((unsigned)hDirectDrawLocalHost); @NL
  2989. hSurfColor=(HANDLE)((unsigned)hSurfColorHost); @NL
  2990. hSurfZ=(HANDLE)((unsigned)hSurfZHost); @NL
  2991. if(ARGUMENT_PRESENT(pdcciHost)) { @Indent( @NL
  2992. @ForceType(PreCall,pCCD->hDD,((unsigned)(pCCDHost->hDD)),HANDLE,IN)
  2993. @ForceType(PreCall,pCCD->hSurface,((unsigned)(pCCDHost->hSurface)),HANDLE,IN)
  2994. @ForceType(PreCall,pCCD->hDDSZ,((unsigned)(pCCDHost->hDDSZ)),HANDLE,IN)
  2995. @ForceType(PreCall,pCCD->dwPID,pCCDHost->dwPID,DWORD,IN)
  2996. @ForceType(PreCall,pCCD->dwhContext,pCCDHost->dwhContext,ULONG_PTR,IN)
  2997. @ForceType(PreCall,pCCD->ddrval,pCCDHost->ddrval,HRESULT,IN)
  2998. @ForceType(PreCall,pdcci->cjBuffer,pCCDHost->cjBuffer,ULONG,IN)
  2999. @ForceType(PreCall,pdcci->pvBuffer,pCCDHost->pvBuffer,PVOID,IN)
  3000. )} @NL
  3001. End=
  3002. Begin=
  3003. @GenApiThunk(@ApiName)
  3004. End=
  3005. PostCall=
  3006. if(ARGUMENT_PRESENT(pdcciHost)) { @Indent( @NL
  3007. @ForceType(PostCall,pCCD->dwhContext,pCCDHost->dwhContext,ULONG_PTR,OUT)
  3008. @ForceType(PostCall,pCCD->ddrval,pCCDHost->ddrval,HRESULT,OUT)
  3009. @ForceType(PostCall,pdcci->cjBuffer,pCCDHost->cjBuffer,ULONG,OUT)
  3010. @ForceType(PostCall,pdcci->pvBuffer,pCCDHost->pvBuffer,PVOID,OUT)
  3011. )} @NL
  3012. End=
  3013. TemplateName=NtGdiD3dContextDestroy
  3014. Begin=
  3015. @GenApiThunk(@ApiName)
  3016. End=
  3017. TemplateName=NtGdiD3dContextDestroyAll
  3018. Begin=
  3019. @GenApiThunk(@ApiName)
  3020. End=
  3021. TemplateName=NtGdiD3dValidateTextureStageState
  3022. Begin=
  3023. @GenApiThunk(@ApiName)
  3024. End=
  3025. TemplateName=NtGdiD3dDrawPrimitives2
  3026. NoType=hCmdBuf
  3027. NoType=hVBuf
  3028. NoType=pded
  3029. Header=
  3030. @NoFormat(
  3031. VOID
  3032. Wow64GdiDdThunkSurfaceHandlesPreCall(
  3033. IN OUT HANDLE **pSurface,
  3034. IN NT32HANDLE *pSurfaceHost,
  3035. IN DWORD dwCount
  3036. )
  3037. {
  3038. DWORD dwIndex;
  3039. *pSurface=NULL;
  3040. if(WOW64_ISPTR(pSurfaceHost) && (dwCount>0))
  3041. {
  3042. *pSurface=(HANDLE *)Wow64AllocateTemp(sizeof(HANDLE)*dwCount);
  3043. if(*pSurface)
  3044. {
  3045. for(dwIndex=0;dwIndex<dwCount;dwIndex++)
  3046. {
  3047. (*pSurface)[dwIndex]=(HANDLE)((unsigned)(pSurfaceHost[dwIndex]));
  3048. }
  3049. }
  3050. }
  3051. }
  3052. VOID
  3053. Wow64GdiDdThunkSurfaceDescriptionPreCall(
  3054. IN OUT DDSURFACEDESC ** pDdSurfaceDesc,
  3055. IN struct NT32_DDSURFACEDESC * pDdSurfaceDesc32,
  3056. IN DWORD bThunkAsSurfaceDesc2,
  3057. IN DWORD dwCount
  3058. )
  3059. {
  3060. DWORD dwIndex;
  3061. DDSURFACEDESC *pDDSD;
  3062. DDSURFACEDESC2 *pDDSD2;
  3063. struct NT32_DDSURFACEDESC2 *pDDSD2_32;
  3064. *pDdSurfaceDesc = NULL;
  3065. if( bThunkAsSurfaceDesc2 != 0 )
  3066. {
  3067. pDDSD2 = (DDSURFACEDESC2 *)Wow64AllocateTemp(sizeof(DDSURFACEDESC2)*dwCount);
  3068. if( pDDSD2 )
  3069. {
  3070. *pDdSurfaceDesc = (DDSURFACEDESC *)pDDSD2;
  3071. pDDSD2_32 = (struct NT32_DDSURFACEDESC2 *)pDdSurfaceDesc32;
  3072. for(dwIndex=0; dwIndex<dwCount; dwIndex++)
  3073. {
  3074. @ForceType(PreCall,pDDSD2->dwSize,pDDSD2_32->dwSize,DWORD,IN)
  3075. @ForceType(PreCall,pDDSD2->dwFlags,pDDSD2_32->dwFlags,DWORD,IN)
  3076. @ForceType(PreCall,pDDSD2->dwHeight,pDDSD2_32->dwHeight,DWORD,IN)
  3077. @ForceType(PreCall,pDDSD2->dwWidth,pDDSD2_32->dwWidth,DWORD,IN)
  3078. if( (pDDSD2_32->dwFlags & DDSD_LINEARSIZE) == DDSD_LINEARSIZE )
  3079. {
  3080. @ForceType(PreCall,pDDSD2->dwLinearSize,pDDSD2_32->dwLinearSize,DWORD,IN)
  3081. } else
  3082. {
  3083. @ForceType(PreCall,pDDSD2->lPitch,pDDSD2_32->lPitch,LONG,IN)
  3084. }
  3085. @ForceType(PreCall,pDDSD2->dwBackBufferCount,pDDSD2_32->dwBackBufferCount,DWORD,IN)
  3086. @ForceType(PreCall,pDDSD2->dwMipMapCount,pDDSD2_32->dwMipMapCount,DWORD,IN)
  3087. @ForceType(PreCall,pDDSD2->dwAlphaBitDepth,pDDSD2_32->dwAlphaBitDepth,DWORD,IN)
  3088. @ForceType(PreCall,pDDSD2->dwReserved,pDDSD2_32->dwReserved,DWORD,IN)
  3089. @ForceType(PreCall,pDDSD2->lpSurface,pDDSD2_32->lpSurface,LPVOID,IN)
  3090. if( (pDDSD2_32->dwFlags & DDSD_CKDESTOVERLAY) == DDSD_CKDESTOVERLAY )
  3091. {
  3092. @ForceType(PreCall,pDDSD2->ddckCKDestOverlay,pDDSD2_32->ddckCKDestOverlay,DDCOLORKEY,IN)
  3093. } else
  3094. {
  3095. @ForceType(PreCall,pDDSD2->dwEmptyFaceColor,pDDSD2_32->dwEmptyFaceColor,DWORD,IN)
  3096. }
  3097. @ForceType(PreCall,pDDSD2->ddckCKDestBlt,pDDSD2_32->ddckCKDestBlt,DDCOLORKEY,IN)
  3098. @ForceType(PreCall,pDDSD2->ddckCKSrcOverlay,pDDSD2_32->ddckCKSrcOverlay,DDCOLORKEY,IN)
  3099. @ForceType(PreCall,pDDSD2->ddckCKSrcBlt,pDDSD2_32->ddckCKSrcBlt,DDCOLORKEY,IN)
  3100. if( (pDDSD2_32->dwFlags & DDSD_FVF) == DDSD_FVF )
  3101. {
  3102. @ForceType(PreCall,pDDSD2->dwFVF,pDDSD2_32->dwFVF,DWORD,IN)
  3103. } else
  3104. {
  3105. @ForceType(PreCall,pDDSD2->ddpfPixelFormat,pDDSD2_32->ddpfPixelFormat,DDPIXELFORMAT,IN)
  3106. }
  3107. @ForceType(PreCall,pDDSD2->ddsCaps,pDDSD2_32->ddsCaps,DDSCAPS2,IN)
  3108. @ForceType(PreCall,pDDSD2->dwTextureStage,pDDSD2_32->dwTextureStage,DWORD,IN)
  3109. pDDSD2++;
  3110. pDDSD2_32++;
  3111. }
  3112. }
  3113. } else
  3114. {
  3115. pDDSD = (DDSURFACEDESC *)Wow64AllocateTemp(sizeof(DDSURFACEDESC)*dwCount);
  3116. if( pDDSD )
  3117. {
  3118. *pDdSurfaceDesc = (DDSURFACEDESC *)pDDSD;
  3119. for(dwIndex=0; dwIndex<dwCount; dwIndex++)
  3120. {
  3121. @ForceType(PreCall,pDDSD->dwSize,pDdSurfaceDesc32->dwSize,DWORD,IN)
  3122. @ForceType(PreCall,pDDSD->dwFlags,pDdSurfaceDesc32->dwFlags,DWORD,IN)
  3123. @ForceType(PreCall,pDDSD->dwHeight,pDdSurfaceDesc32->dwHeight,DWORD,IN)
  3124. @ForceType(PreCall,pDDSD->dwWidth,pDdSurfaceDesc32->dwWidth,DWORD,IN)
  3125. if( (pDdSurfaceDesc32->dwFlags & DDSD_LINEARSIZE) == DDSD_LINEARSIZE )
  3126. {
  3127. @ForceType(PreCall,pDDSD->dwLinearSize,pDdSurfaceDesc32->dwLinearSize,DWORD,IN)
  3128. } else
  3129. {
  3130. @ForceType(PreCall,pDDSD->lPitch,pDdSurfaceDesc32->lPitch,LONG,IN)
  3131. }
  3132. @ForceType(PreCall,pDDSD->dwBackBufferCount,pDdSurfaceDesc32->dwBackBufferCount,DWORD,IN)
  3133. @ForceType(PreCall,pDDSD->dwMipMapCount,pDdSurfaceDesc32->dwMipMapCount,DWORD,IN)
  3134. @ForceType(PreCall,pDDSD->dwAlphaBitDepth,pDdSurfaceDesc32->dwAlphaBitDepth,DWORD,IN)
  3135. @ForceType(PreCall,pDDSD->dwReserved,pDdSurfaceDesc32->dwReserved,DWORD,IN)
  3136. @ForceType(PreCall,pDDSD->lpSurface,pDdSurfaceDesc32->lpSurface,LPVOID,IN)
  3137. @ForceType(PreCall,pDDSD->ddckCKDestOverlay,pDdSurfaceDesc32->ddckCKDestOverlay,DDCOLORKEY,IN)
  3138. @ForceType(PreCall,pDDSD->ddckCKDestBlt,pDdSurfaceDesc32->ddckCKDestBlt,DDCOLORKEY,IN)
  3139. @ForceType(PreCall,pDDSD->ddckCKSrcOverlay,pDdSurfaceDesc32->ddckCKSrcOverlay,DDCOLORKEY,IN)
  3140. @ForceType(PreCall,pDDSD->ddckCKSrcBlt,pDdSurfaceDesc32->ddckCKSrcBlt,DDCOLORKEY,IN)
  3141. @ForceType(PreCall,pDDSD->ddpfPixelFormat,pDdSurfaceDesc32->ddpfPixelFormat,DDPIXELFORMAT,IN)
  3142. @ForceType(PreCall,pDDSD->ddsCaps,pDdSurfaceDesc32->ddsCaps,DDSCAPS,IN)
  3143. pDDSD++;
  3144. pDdSurfaceDesc32++;
  3145. }
  3146. }
  3147. }
  3148. }
  3149. VOID
  3150. Wow64GdiDdThunkSurfaceMorePreCall(
  3151. IN OUT PDD_SURFACE_MORE * pDdSurfaceMore,
  3152. IN struct NT32_DD_SURFACE_MORE * pDdSurfaceMore32,
  3153. IN DWORD dwCount
  3154. )
  3155. {
  3156. PDD_SURFACE_MORE pDdSurfaceMoreCopy = NULL;
  3157. if( WOW64_ISPTR(pDdSurfaceMore32) && (dwCount>0) )
  3158. {
  3159. pDdSurfaceMoreCopy = (PDD_SURFACE_MORE)Wow64AllocateTemp(sizeof(DD_SURFACE_MORE)*dwCount);
  3160. *pDdSurfaceMore = pDdSurfaceMoreCopy;
  3161. }
  3162. if( pDdSurfaceMoreCopy )
  3163. {
  3164. while((dwCount--) && (WOW64_ISPTR(pDdSurfaceMore32)))
  3165. {
  3166. // still need to thunk lpVideoPort
  3167. pDdSurfaceMoreCopy->lpVideoPort = NULL;
  3168. @ForceType(PreCall,pDdSurfaceMoreCopy->dwMipMapCount,pDdSurfaceMore32->dwMipMapCount,DWORD,IN)
  3169. @ForceType(PreCall,pDdSurfaceMoreCopy->dwOverlayFlags,pDdSurfaceMore32->dwOverlayFlags,DWORD,IN)
  3170. @ForceType(PreCall,pDdSurfaceMoreCopy->ddsCapsEx,pDdSurfaceMore32->ddsCapsEx,DDSCAPSEX,IN)
  3171. @ForceType(PreCall,pDdSurfaceMoreCopy->dwSurfaceHandle,pDdSurfaceMore32->dwSurfaceHandle,DWORD,IN)
  3172. pDdSurfaceMore32++;
  3173. pDdSurfaceMoreCopy++;
  3174. }
  3175. }
  3176. }
  3177. VOID
  3178. Wow64GdiDdThunkSurfaceGlobalPreCall(
  3179. IN OUT PDD_SURFACE_GLOBAL * pDdSurfaceGlobal,
  3180. IN struct NT32_DD_SURFACE_GLOBAL * pDdSurfaceGlobal32,
  3181. IN DWORD dwCount
  3182. )
  3183. {
  3184. PDD_SURFACE_GLOBAL pDdSurfaceGlobalCopy = NULL;
  3185. LPVIDEOMEMORY lpVidMemHeapCopy = NULL;
  3186. if( WOW64_ISPTR(pDdSurfaceGlobal32) && (dwCount>0) )
  3187. {
  3188. pDdSurfaceGlobalCopy = (PDD_SURFACE_GLOBAL)Wow64AllocateTemp(sizeof(DD_SURFACE_GLOBAL)*dwCount);
  3189. *pDdSurfaceGlobal = pDdSurfaceGlobalCopy;
  3190. }
  3191. if( pDdSurfaceGlobalCopy )
  3192. {
  3193. while((dwCount--) && WOW64_ISPTR(pDdSurfaceGlobal32))
  3194. {
  3195. if( WOW64_ISPTR(pDdSurfaceGlobal32->lpVidMemHeap) )
  3196. {
  3197. struct NT32_VIDEOMEMORY * lpVidMemHeap32 = (struct NT32_VIDEOMEMORY *)(pDdSurfaceGlobal32->lpVidMemHeap);
  3198. lpVidMemHeapCopy = (LPVIDEOMEMORY)Wow64AllocateTemp(sizeof(VIDEOMEMORY));
  3199. if(lpVidMemHeapCopy)
  3200. {
  3201. @ForceType(PreCall,lpVidMemHeapCopy->dwFlags,lpVidMemHeap32->dwFlags,DWORD,IN)
  3202. @ForceType(PreCall,lpVidMemHeapCopy->fpStart,lpVidMemHeap32->fpStart,FLATPTR,IN)
  3203. @ForceType(PreCall,lpVidMemHeapCopy->ddsCaps,lpVidMemHeap32->ddsCaps,DDSCAPS,IN)
  3204. @ForceType(PreCall,lpVidMemHeapCopy->ddsCapsAlt,lpVidMemHeap32->ddsCapsAlt,DDSCAPS,IN)
  3205. if( (lpVidMemHeapCopy->dwFlags & VIDMEM_ISRECTANGULAR) == VIDMEM_ISRECTANGULAR )
  3206. {
  3207. @ForceType(PreCall,lpVidMemHeapCopy->dwWidth,lpVidMemHeap32->dwWidth,DWORD,IN)
  3208. @ForceType(PreCall,lpVidMemHeapCopy->dwHeight,lpVidMemHeap32->dwHeight,DWORD,IN)
  3209. } else
  3210. {
  3211. @ForceType(PreCall,lpVidMemHeapCopy->fpEnd,lpVidMemHeap32->fpEnd,FLATPTR,IN)
  3212. // this actually is a pointer to a _VMEMHEAP structure and may need the structure thunked
  3213. @ForceType(PreCall,lpVidMemHeapCopy->lpHeap,lpVidMemHeap32->lpHeap,PVOID,IN)
  3214. }
  3215. }
  3216. }
  3217. pDdSurfaceGlobalCopy->lpVidMemHeap = lpVidMemHeapCopy;
  3218. @ForceType(PreCall,pDdSurfaceGlobalCopy->dwBlockSizeY,pDdSurfaceGlobal32->dwBlockSizeY,DWORD,IN)
  3219. @ForceType(PreCall,pDdSurfaceGlobalCopy->fpVidMem,pDdSurfaceGlobal32->fpVidMem,FLATPTR,IN)
  3220. @ForceType(PreCall,pDdSurfaceGlobalCopy->dwLinearSize,pDdSurfaceGlobal32->dwLinearSize,DWORD,IN)
  3221. @ForceType(PreCall,pDdSurfaceGlobalCopy->yHint,pDdSurfaceGlobal32->yHint,LONG,IN)
  3222. @ForceType(PreCall,pDdSurfaceGlobalCopy->xHint,pDdSurfaceGlobal32->xHint,LONG,IN)
  3223. @ForceType(PreCall,pDdSurfaceGlobalCopy->wHeight,pDdSurfaceGlobal32->wHeight,DWORD,IN)
  3224. @ForceType(PreCall,pDdSurfaceGlobalCopy->wWidth,pDdSurfaceGlobal32->wWidth,DWORD,IN)
  3225. @ForceType(PreCall,pDdSurfaceGlobalCopy->dwReserved1,pDdSurfaceGlobal32->dwReserved1,ULONG_PTR,IN)
  3226. @ForceType(PreCall,pDdSurfaceGlobalCopy->ddpfSurface,pDdSurfaceGlobal32->ddpfSurface,DDPIXELFORMAT,IN)
  3227. @ForceType(PreCall,pDdSurfaceGlobalCopy->fpHeapOffset,pDdSurfaceGlobal32->fpHeapOffset,FLATPTR,IN)
  3228. @ForceType(PreCall,pDdSurfaceGlobalCopy->hCreatorProcess,((unsigned)(pDdSurfaceGlobal32->hCreatorProcess)),HANDLE,IN)
  3229. pDdSurfaceGlobal32++;
  3230. pDdSurfaceGlobalCopy++;
  3231. }
  3232. }
  3233. }
  3234. VOID
  3235. Wow64GdiDdThunkSurfaceGlobalPostCall(
  3236. IN PDD_SURFACE_GLOBAL pDdSurfaceGlobal,
  3237. IN OUT struct NT32_DD_SURFACE_GLOBAL * pDdSurfaceGlobal32,
  3238. IN DWORD dwCount
  3239. )
  3240. {
  3241. if( WOW64_ISPTR(pDdSurfaceGlobal32) && (dwCount>0))
  3242. {
  3243. while( (dwCount--) && (WOW64_ISPTR(pDdSurfaceGlobal32)))
  3244. {
  3245. if( pDdSurfaceGlobal )
  3246. {
  3247. @ForceType(PostCall,pDdSurfaceGlobal->dwBlockSizeY,pDdSurfaceGlobal32->dwBlockSizeY,DWORD,OUT)
  3248. @ForceType(PostCall,pDdSurfaceGlobal->dwBlockSizeX,pDdSurfaceGlobal32->dwBlockSizeX,DWORD,OUT)
  3249. @ForceType(PostCall,pDdSurfaceGlobal->fpVidMem,pDdSurfaceGlobal32->fpVidMem,FLATPTR,OUT)
  3250. @ForceType(PostCall,pDdSurfaceGlobal->dwLinearSize,pDdSurfaceGlobal32->dwLinearSize,DWORD,OUT)
  3251. @ForceType(PostCall,pDdSurfaceGlobal->yHint,pDdSurfaceGlobal32->yHint,LONG,OUT)
  3252. @ForceType(PostCall,pDdSurfaceGlobal->xHint,pDdSurfaceGlobal32->xHint,LONG,OUT)
  3253. @ForceType(PostCall,pDdSurfaceGlobal->wHeight,pDdSurfaceGlobal32->wHeight,DWORD,OUT)
  3254. @ForceType(PostCall,pDdSurfaceGlobal->wWidth,pDdSurfaceGlobal32->wWidth,DWORD,OUT)
  3255. @ForceType(PostCall,pDdSurfaceGlobal->dwReserved1,pDdSurfaceGlobal32->dwReserved1,ULONG_PTR,OUT)
  3256. @ForceType(PostCall,pDdSurfaceGlobal->ddpfSurface,pDdSurfaceGlobal32->ddpfSurface,DDPIXELFORMAT,OUT)
  3257. @ForceType(PostCall,pDdSurfaceGlobal->fpHeapOffset,pDdSurfaceGlobal32->fpHeapOffset,FLATPTR,OUT)
  3258. @ForceType(PostCall,pDdSurfaceGlobal->hCreatorProcess,((unsigned)(pDdSurfaceGlobal32->hCreatorProcess)),HANDLE,OUT)
  3259. }
  3260. pDdSurfaceGlobal32++;
  3261. pDdSurfaceGlobal++;
  3262. }
  3263. }
  3264. }
  3265. VOID
  3266. Wow64GdiDdThunkSurfaceLocalPreCall(
  3267. IN OUT PDD_SURFACE_LOCAL * pDdSurfaceLocal,
  3268. IN struct NT32_DD_SURFACE_LOCAL * pDdSurfaceLocal32,
  3269. IN DWORD dwCount
  3270. )
  3271. {
  3272. PDD_SURFACE_LOCAL pDdSurfaceLocalCopy = NULL;
  3273. PDD_SURFACE_MORE pDdSurfaceMoreCopy = NULL;
  3274. LPVIDEOMEMORY lpVidMemCopy = NULL;
  3275. if( WOW64_ISPTR(pDdSurfaceLocal32) && (dwCount>0) )
  3276. {
  3277. pDdSurfaceLocalCopy = (PDD_SURFACE_LOCAL)Wow64AllocateTemp(sizeof(DD_SURFACE_LOCAL)*dwCount);
  3278. *pDdSurfaceLocal = pDdSurfaceLocalCopy;
  3279. }
  3280. if(pDdSurfaceLocalCopy)
  3281. {
  3282. while( (dwCount--) && WOW64_ISPTR(pDdSurfaceLocal32) )
  3283. {
  3284. if( WOW64_ISPTR(pDdSurfaceLocal32->lpGbl) )
  3285. {
  3286. Wow64GdiDdThunkSurfaceGlobalPreCall(&(pDdSurfaceLocalCopy->lpGbl),(struct NT32_DD_SURFACE_GLOBAL *)(pDdSurfaceLocal32->lpGbl),1);
  3287. } else
  3288. {
  3289. pDdSurfaceLocalCopy->lpGbl = NULL;
  3290. }
  3291. @ForceType(PreCall,pDdSurfaceLocalCopy->dwFlags,pDdSurfaceLocal32->dwFlags,DWORD,IN)
  3292. @ForceType(PreCall,pDdSurfaceLocalCopy->ddsCaps,pDdSurfaceLocal32->ddsCaps,DDSCAPS,IN)
  3293. @ForceType(PreCall,pDdSurfaceLocalCopy->dwReserved1,pDdSurfaceLocal32->dwReserved1,ULONG_PTR,IN)
  3294. @ForceType(PreCall,pDdSurfaceLocalCopy->ddckCKSrcBlt,pDdSurfaceLocal32->ddckCKSrcBlt,DDCOLORKEY,IN)
  3295. @ForceType(PreCall,pDdSurfaceLocalCopy->ddckCKDestOverlay,pDdSurfaceLocal32->ddckCKDestOverlay,DDCOLORKEY,IN)
  3296. @ForceType(PreCall,pDdSurfaceLocalCopy->ddckCKDestBlt,pDdSurfaceLocal32->ddckCKDestBlt,DDCOLORKEY,IN)
  3297. @ForceType(PreCall,pDdSurfaceLocalCopy->rcOverlaySrc,pDdSurfaceLocal32->rcOverlaySrc,RECT,IN)
  3298. @ForceType(PreCall,pDdSurfaceLocalCopy->lpSurfMore,pDdSurfaceLocal32->lpSurfMore,LPVOID,IN)
  3299. pDdSurfaceLocalCopy->lpAttachList = NULL;
  3300. #if 0
  3301. if( WOW64_ISPTR(pDdSurfaceLocal32->lpAttachList) )
  3302. {
  3303. // need to walk the attach list chain
  3304. PDD_ATTACHLIST ppCurrentAL;
  3305. PDD_ATTACHLIST *ppCurrentALptr = &(pDdSurfaceLocalCopy->lpAttachList);
  3306. struct NT32_DD_ATTACHLIST *pCurrentAL32 = (struct NT32_DD_ATTACHLIST *)(pDdSurfaceLocal32->lpAttachList);
  3307. while( NULL != pCurrentAL32 )
  3308. {
  3309. ppCurrentAL = (PDD_ATTACHLIST)Wow64AllocateTemp(sizeof(DD_ATTACHLIST));
  3310. if( NULL != ppCurrentAL )
  3311. {
  3312. ppCurrentAL->lpLink = NULL;
  3313. Wow64GdiDdThunkSurfaceLocalPreCall((PDD_SURFACE_LOCAL *)&(ppCurrentAL->lpAttached),(struct NT32_DD_SURFACE_LOCAL *)(pCurrentAL32->lpAttached),1);
  3314. *ppCurrentALptr = ppCurrentAL;
  3315. ppCurrentALptr = &(ppCurrentAL->lpLink);
  3316. pCurrentAL32 = (struct NT32_DD_ATTACHLIST *)(pCurrentAL32->lpLink);
  3317. }
  3318. }
  3319. }
  3320. #endif
  3321. pDdSurfaceLocalCopy->lpAttachListFrom = NULL;
  3322. #if 0
  3323. if( WOW64_ISPTR(pDdSurfaceLocal32->lpAttachListFrom) )
  3324. {
  3325. // need to walk the attach list from chain
  3326. PDD_ATTACHLIST ppCurrentAL;
  3327. PDD_ATTACHLIST *ppCurrentALptr = &(pDdSurfaceLocalCopy->lpAttachListFrom);
  3328. struct NT32_DD_ATTACHLIST *pCurrentAL32 = (struct NT32_DD_ATTACHLIST *)(pDdSurfaceLocal32->lpAttachListFrom);
  3329. while( NULL != pCurrentAL32 )
  3330. {
  3331. ppCurrentAL = (PDD_ATTACHLIST)Wow64AllocateTemp(sizeof(DD_ATTACHLIST));
  3332. if( NULL != ppCurrentAL )
  3333. {
  3334. ppCurrentAL->lpLink = NULL;
  3335. Wow64GdiDdThunkSurfaceLocalPreCall((PDD_SURFACE_LOCAL *)&(ppCurrentAL->lpAttached),(struct NT32_DD_SURFACE_LOCAL *)(pCurrentAL32->lpAttached),1);
  3336. *ppCurrentALptr = ppCurrentAL;
  3337. ppCurrentALptr = &(ppCurrentAL->lpLink);
  3338. pCurrentAL32 = (struct NT32_DD_ATTACHLIST *)(pCurrentAL32->lpLink);
  3339. }
  3340. }
  3341. }
  3342. #endif
  3343. pDdSurfaceLocal32++;
  3344. pDdSurfaceLocalCopy++;
  3345. }
  3346. }
  3347. }
  3348. VOID
  3349. Wow64GdiDdThunkSurfaceLocalPostCall(
  3350. IN OUT PDD_SURFACE_LOCAL pDdSurfaceLocal,
  3351. IN struct NT32_DD_SURFACE_LOCAL * pDdSurfaceLocal32,
  3352. IN DWORD dwCount
  3353. )
  3354. {
  3355. DWORD dwIndex;
  3356. if( WOW64_ISPTR(pDdSurfaceLocal32) )
  3357. {
  3358. for(dwIndex=0; dwIndex<dwCount; dwIndex++)
  3359. {
  3360. if(WOW64_ISPTR(pDdSurfaceLocal32->lpGbl))
  3361. {
  3362. Wow64GdiDdThunkSurfaceGlobalPostCall((PDD_SURFACE_GLOBAL)(&(pDdSurfaceLocal->lpGbl)),(struct NT32_DD_SURFACE_GLOBAL *)(&(pDdSurfaceLocal32->lpGbl)),1);
  3363. }
  3364. @ForceType(PostCall,pDdSurfaceLocal->dwFlags,pDdSurfaceLocal32->dwFlags,DWORD,OUT)
  3365. @ForceType(PostCall,pDdSurfaceLocal->ddsCaps,pDdSurfaceLocal32->ddsCaps,DDSCAPS,OUT)
  3366. @ForceType(PostCall,pDdSurfaceLocal->dwReserved1,pDdSurfaceLocal32->dwReserved1,ULONG_PTR,OUT)
  3367. @ForceType(PostCall,pDdSurfaceLocal->ddckCKSrcBlt,pDdSurfaceLocal32->ddckCKSrcBlt,DDCOLORKEY,OUT)
  3368. @ForceType(PostCall,pDdSurfaceLocal->ddckCKDestOverlay,pDdSurfaceLocal32->ddckCKDestOverlay,DDCOLORKEY,OUT)
  3369. @ForceType(PostCall,pDdSurfaceLocal->ddckCKDestBlt,pDdSurfaceLocal32->ddckCKDestBlt,DDCOLORKEY,OUT)
  3370. @ForceType(PostCall,pDdSurfaceLocal->rcOverlaySrc,pDdSurfaceLocal32->rcOverlaySrc,RECT,OUT)
  3371. pDdSurfaceLocal++;
  3372. pDdSurfaceLocal32++;
  3373. }
  3374. }
  3375. })
  3376. End=
  3377. Locals=
  3378. BYTE pdedCopy[sizeof(struct _D3D8_DRAWPRIMITIVES2DATA)]; @NL
  3379. struct NT32_D3DNTHAL_DRAWPRIMITIVES2DATA *pdedHostCopy; @NL
  3380. struct NT32_D3D8_DRAWPRIMITIVES2DATA *pdedXHostCopy; @NL
  3381. struct _D3D8_DRAWPRIMITIVES2DATA *pdedX; @NL
  3382. pded = (LPD3DNTHAL_DRAWPRIMITIVES2DATA)pdedCopy; @NL
  3383. pdedX = (struct _D3D8_DRAWPRIMITIVES2DATA *)pdedCopy; @NL
  3384. pdedHostCopy = (struct NT32_D3DNTHAL_DRAWPRIMITIVES2DATA *)pdedHost; @NL
  3385. pdedXHostCopy = (struct NT32_D3D8_DRAWPRIMITIVES2DATA *)pdedHost; @NL
  3386. End=
  3387. PreCall=
  3388. hCmdBuf=(HANDLE)((unsigned)hCmdBufHost); @NL
  3389. hVBuf=(HANDLE)((unsigned)hVBufHost); @NL
  3390. if(ARGUMENT_PRESENT(pdedHost)) { @Indent( @NL
  3391. @ForceType(PreCall,pded->dwhContext,pdedHostCopy->dwhContext,ULONG_PTR,IN)
  3392. @ForceType(PreCall,pded->dwFlags,pdedHostCopy->dwFlags,DWORD,IN)
  3393. @ForceType(PreCall,pded->dwVertexType,pdedHostCopy->dwVertexType,DWORD,IN)
  3394. if( (pded->dwFlags & D3DHALDP2_USERMEMVERTICES) == D3DHALDP2_USERMEMVERTICES ) { @Indent( @NL
  3395. @ForceType(PreCall,pded->lpVertices,pdedHostCopy->lpVertices,LPVOID,IN)
  3396. )} else { @Indent( @NL
  3397. @ForceType(PreCall,pded->lpDDVertex,pdedHostCopy->lpDDVertex,LPVOID,IN)
  3398. )} @NL
  3399. @ForceType(PreCall,pded->lpDDCommands,pdedHostCopy->lpDDCommands,PVOID,IN)
  3400. @ForceType(PreCall,pded->dwCommandOffset,pdedHostCopy->dwCommandOffset,DWORD,IN)
  3401. @ForceType(PreCall,pded->dwCommandLength,pdedHostCopy->dwCommandLength,DWORD,IN)
  3402. @ForceType(PreCall,pded->dwVertexOffset,pdedHostCopy->dwVertexOffset,DWORD,IN)
  3403. @ForceType(PreCall,pded->dwVertexLength,pdedHostCopy->dwVertexLength,DWORD,IN)
  3404. @ForceType(PreCall,pded->dwReqVertexBufSize,pdedHostCopy->dwReqVertexBufSize,DWORD,IN)
  3405. @ForceType(PreCall,pded->dwReqCommandBufSize,pdedHostCopy->dwReqCommandBufSize,DWORD,IN)
  3406. @ForceType(PreCall,pded->lpdwRStates,pdedHostCopy->lpdwRStates,LPDWORD,IN)
  3407. @ForceType(PreCall,pded->dwVertexSize,pdedHostCopy->dwVertexSize,DWORD,IN)
  3408. @ForceType(PreCall,pded->dwErrorOffset,pdedHostCopy->dwErrorOffset,DWORD,IN)
  3409. @ForceType(PreCall,pdedX->fpVidMem_CB,pdedXHostCopy->fpVidMem_CB,ULONG_PTR,IN)
  3410. @ForceType(PreCall,pdedX->dwLinearSize_CB,pdedXHostCopy->dwLinearSize_CB,DWORD,IN)
  3411. @ForceType(PreCall,pdedX->fpVidMem_VB,pdedXHostCopy->fpVidMem_VB,ULONG_PTR,IN)
  3412. @ForceType(PreCall,pdedX->dwLinearSize_VB,pdedXHostCopy->dwLinearSize_VB,DWORD,IN)
  3413. @NL
  3414. )} @NL
  3415. End=
  3416. Begin=
  3417. @GenApiThunk(@ApiName)
  3418. End=
  3419. PostCall=
  3420. if(ARGUMENT_PRESENT(pdedHost)) { @Indent( @NL
  3421. @ForceType(PostCall,pded->ddrval,pdedHostCopy->ddrval,HRESULT,OUT)
  3422. @ForceType(PostCall,pded->dwErrorOffset,pdedHostCopy->dwErrorOffset,DWORD,OUT)
  3423. @ForceType(PostCall,pdedX->fpVidMem_CB,pdedXHostCopy->fpVidMem_CB,ULONG_PTR,OUT)
  3424. @ForceType(PostCall,pdedX->dwLinearSize_CB,pdedXHostCopy->dwLinearSize_CB,DWORD,OUT)
  3425. @ForceType(PostCall,pdedX->fpVidMem_VB,pdedXHostCopy->fpVidMem_VB,ULONG_PTR,OUT)
  3426. @ForceType(PostCall,pdedX->dwLinearSize_VB,pdedXHostCopy->dwLinearSize_VB,DWORD,OUT)
  3427. )} @NL
  3428. End=
  3429. TemplateName=NtGdiDdGetDriverState
  3430. NoType=pdata
  3431. Locals=
  3432. BYTE pdataCopy[sizeof(DD_GETDRIVERSTATEDATA)]; @NL
  3433. pdata=(PDD_GETDRIVERSTATEDATA)pdataCopy;
  3434. End=
  3435. PreCall=
  3436. if(ARGUMENT_PRESENT(pdataHost)) { @Indent( @NL
  3437. @ForceType(PreCall,pdata->dwFlags,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->dwFlags,DWORD,IN)
  3438. @ForceType(PreCall,pdata->dwhContext,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->dwhContext,DWORD_PTR,IN)
  3439. @ForceType(PreCall,pdata->lpdwStates,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->lpdwStates,LPDWORD,IN)
  3440. @ForceType(PreCall,pdata->dwLength,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->dwLength,DWORD,IN)
  3441. @ForceType(PreCall,pdata->ddRVal,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->ddRVal,HRESULT,IN)
  3442. )} @NL
  3443. End=
  3444. Begin=
  3445. @GenApiThunk(@ApiName)
  3446. End=
  3447. PostCall=
  3448. if(ARGUMENT_PRESENT(pdataHost)) { @Indent( @NL
  3449. @ForceType(PostCall,pdata->lpdwStates,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->lpdwStates,LPDWORD,OUT)
  3450. @ForceType(PostCall,pdata->ddRVal,((struct NT32_DD_GETDRIVERSTATEDATA *)pdataHost)->ddRVal,HRESULT,OUT)
  3451. )} @NL
  3452. End=
  3453. TemplateName=NtGdiDdAddAttachedSurface
  3454. NoType=hSurface
  3455. NoType=hSurfaceAttached
  3456. NoType=puAddAttachedSurfaceData
  3457. Locals=
  3458. BYTE puAddAttachedSurfaceDataCopy[sizeof(DD_ADDATTACHEDSURFACEDATA)]; @NL
  3459. struct NT32_DD_ADDATTACHEDSURFACEDATA * puAddAttachedSurfaceDataHostCopy; @NL
  3460. puAddAttachedSurfaceData=(PDD_ADDATTACHEDSURFACEDATA)puAddAttachedSurfaceDataCopy; @NL
  3461. puAddAttachedSurfaceDataHostCopy=(struct NT32_DD_ADDATTACHEDSURFACEDATA *)puAddAttachedSurfaceDataHost; @NL
  3462. End=
  3463. PreCall=
  3464. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3465. hSurfaceAttached=(HANDLE)((unsigned)hSurfaceAttachedHost); @NL
  3466. if(ARGUMENT_PRESENT(puAddAttachedSurfaceDataHost)) { @Indent( @NL
  3467. @ForceType(PreCall,puAddAttachedSurfaceData->lpDD,puAddAttachedSurfaceDataHostCopy->lpDD,PVOID,IN)
  3468. Wow64GdiDdThunkSurfaceLocalPreCall(&(puAddAttachedSurfaceData->lpDDSurface),(struct NT32_DD_SURFACE_LOCAL *)(puAddAttachedSurfaceDataHostCopy->lpDDSurface),1); @NL
  3469. Wow64GdiDdThunkSurfaceLocalPreCall(&(puAddAttachedSurfaceData->lpSurfAttached),(struct NT32_DD_SURFACE_LOCAL *)(puAddAttachedSurfaceDataHostCopy->lpSurfAttached),1); @NL
  3470. @ForceType(PreCall,puAddAttachedSurfaceData->ddRVal,puAddAttachedSurfaceDataHostCopy->ddRVal,HRESULT,IN)
  3471. @ForceType(PreCall,puAddAttachedSurfaceData->AddAttachedSurface,puAddAttachedSurfaceDataHostCopy->AddAttachedSurface,PVOID,IN)
  3472. )} @NL
  3473. End=
  3474. Begin=
  3475. @GenApiThunk(@ApiName)
  3476. End=
  3477. PostCall=
  3478. if(ARGUMENT_PRESENT(puAddAttachedSurfaceDataHost)) { @Indent( @NL
  3479. @ForceType(PostCall,puAddAttachedSurfaceData->ddRVal,puAddAttachedSurfaceDataHostCopy->ddRVal,HRESULT,OUT)
  3480. )} @NL
  3481. End=
  3482. TemplateName=NtGdiDdAlphaBlt
  3483. NoType=hSurfaceDest
  3484. NoType=hSurfaceSrc
  3485. NoType=puBltData
  3486. Locals=
  3487. BYTE puBltDataCopy[sizeof(DD_BLTDATA)]; @NL
  3488. puBltData = (PDD_BLTDATA)puBltDataCopy; @NL
  3489. End=
  3490. PreCall=
  3491. hSurfaceDest=(HANDLE)((unsigned)hSurfaceDestHost); @NL
  3492. hSurfaceSrc=(HANDLE)((unsigned)hSurfaceSrcHost); @NL
  3493. if(ARGUMENT_PRESENT(puBltDataHost)) { @Indent( @NL
  3494. Wow64GdiDdThunkBltDataPreCall(&puBltData,(struct NT32_DD_BLTDATA *)(puBltDataHost)); @NL
  3495. )} else { @Indent( @NL
  3496. puBltData = NULL; @NL
  3497. )} @NL
  3498. End=
  3499. Begin=
  3500. @GenApiThunk(@ApiName)
  3501. End=
  3502. PostCall=
  3503. if(ARGUMENT_PRESENT(puBltDataHost)) { @Indent( @NL
  3504. @ForceType(PostCall,puBltData->ddRVal,((struct NT32_DD_BLTDATA *)puBltDataHost)->ddRVal,HRESULT,OUT)
  3505. )} @NL
  3506. End=
  3507. TemplateName=NtGdiDdAttachSurface
  3508. NoType=hSurfaceFrom
  3509. NoType=hSurfaceTo
  3510. PreCall=
  3511. hSurfaceFrom=(HANDLE)((unsigned)hSurfaceFromHost); @NL
  3512. hSurfaceTo=(HANDLE)((unsigned)hSurfaceToHost); @NL
  3513. End=
  3514. Begin=
  3515. @GenApiThunk(@ApiName)
  3516. End=
  3517. TemplateName=NtGdiDdBeginMoCompFrame
  3518. Begin=
  3519. @GenUnsupportedNtApiThunk
  3520. End=
  3521. TemplateName=NtGdiDdBlt
  3522. NoType=hSurfaceDest
  3523. NoType=hSurfaceSrc
  3524. NoType=puBltData
  3525. Header=
  3526. @NoFormat(
  3527. VOID
  3528. Wow64GdiDdThunkBltDataPreCall(
  3529. IN OUT PDD_BLTDATA * pDdBltData,
  3530. IN struct NT32_DD_BLTDATA * pDdBltData32
  3531. )
  3532. {
  3533. PDD_BLTDATA pDdBltDataCopy = NULL;
  3534. if( WOW64_ISPTR(pDdBltData32) )
  3535. {
  3536. pDdBltDataCopy = (PDD_BLTDATA)Wow64AllocateTemp(sizeof(DD_BLTDATA));
  3537. if( pDdBltDataCopy )
  3538. {
  3539. pDdBltDataCopy->lpDD=(PDD_DIRECTDRAW_GLOBAL)pDdBltData32->lpDD;
  3540. Wow64GdiDdThunkSurfaceLocalPreCall(&(pDdBltDataCopy->lpDDDestSurface),(struct NT32_DD_SURFACE_LOCAL *)(pDdBltData32->lpDDDestSurface),1);
  3541. @ForceType(PreCall,pDdBltDataCopy->rDest,pDdBltData32->rDest,RECTL,IN)
  3542. Wow64GdiDdThunkSurfaceLocalPreCall(&(pDdBltDataCopy->lpDDSrcSurface),(struct NT32_DD_SURFACE_LOCAL *)(pDdBltData32->lpDDSrcSurface),1);
  3543. @ForceType(PreCall,pDdBltDataCopy->rSrc,pDdBltData32->rSrc,RECTL,IN)
  3544. @ForceType(PreCall,pDdBltDataCopy->dwFlags,pDdBltData32->dwFlags,DWORD,IN)
  3545. @ForceType(PreCall,pDdBltDataCopy->dwROPFlags,pDdBltData32->dwROPFlags,DWORD,IN)
  3546. @ForceType(PreCall,pDdBltDataCopy->bltFX,pDdBltData32->bltFX,DDBLTFX,IN)
  3547. @ForceType(PreCall,pDdBltDataCopy->ddRVal,pDdBltData32->ddRVal,HRESULT,IN)
  3548. @ForceType(PreCall,pDdBltDataCopy->Blt,pDdBltData32->Blt,PVOID,IN)
  3549. @ForceType(PreCall,pDdBltDataCopy->IsClipped,pDdBltData32->IsClipped,BOOL,IN)
  3550. @ForceType(PreCall,pDdBltDataCopy->rOrigDest,pDdBltData32->rOrigDest,RECTL,IN)
  3551. @ForceType(PreCall,pDdBltDataCopy->rOrigSrc,pDdBltData32->rOrigSrc,RECTL,IN)
  3552. @ForceType(PreCall,pDdBltDataCopy->dwRectCnt,pDdBltData32->dwRectCnt,DWORD,IN)
  3553. @ForceType(PreCall,pDdBltDataCopy->prDestRects,pDdBltData32->prDestRects,PVOID,IN)
  3554. @ForceType(PreCall,pDdBltDataCopy->dwAFlags,pDdBltData32->dwAFlags,DWORD,IN)
  3555. @ForceType(PreCall,pDdBltDataCopy->ddargbScaleFactors,pDdBltData32->ddargbScaleFactors,DDARGB,IN)
  3556. }
  3557. }
  3558. *pDdBltData = pDdBltDataCopy;
  3559. })
  3560. End=
  3561. Locals=
  3562. BYTE puBltDataCopy[sizeof(DD_BLTDATA)]; @NL
  3563. puBltData = (PDD_BLTDATA)puBltDataCopy; @NL
  3564. End=
  3565. PreCall=
  3566. hSurfaceDest=(HANDLE)((unsigned)hSurfaceDestHost); @NL
  3567. hSurfaceSrc=(HANDLE)((unsigned)hSurfaceSrcHost); @NL
  3568. if(ARGUMENT_PRESENT(puBltDataHost)) { @Indent( @NL
  3569. Wow64GdiDdThunkBltDataPreCall(&puBltData,(struct NT32_DD_BLTDATA *)(puBltDataHost)); @NL
  3570. )} else { @Indent( @NL
  3571. puBltData = NULL; @NL
  3572. )} @NL
  3573. End=
  3574. Begin=
  3575. @GenApiThunk(@ApiName)
  3576. End=
  3577. PostCall=
  3578. if(ARGUMENT_PRESENT(puBltDataHost)) { @Indent( @NL
  3579. @ForceType(PostCall,puBltData->ddRVal,(((struct NT32_DD_BLTDATA *)puBltDataHost)->ddRVal),HRESULT,OUT)
  3580. )} @NL
  3581. End=
  3582. TemplateName=NtGdiDdCanCreateSurface
  3583. NoType=hDirectDraw
  3584. NoType=puCanCreateSurfaceData
  3585. Locals=
  3586. BYTE puCanCreateSurfaceDataCopy[sizeof(DD_CANCREATESURFACEDATA)]; @NL
  3587. NT32DD_CANCREATESURFACEDATA *puCanCreateSurfaceDataHostCopy; @NL
  3588. LPDDSURFACEDESC2 pDDS2; @NL
  3589. struct NT32_DDSURFACEDESC2 *pDDS2Host; @NL
  3590. @ForceType(Locals,pDDS2,pDDS2Host,LPDDSURFACEDESC2,IN)
  3591. puCanCreateSurfaceData=(DD_CANCREATESURFACEDATA *)puCanCreateSurfaceDataCopy; @NL
  3592. puCanCreateSurfaceDataHostCopy=(NT32DD_CANCREATESURFACEDATA *)puCanCreateSurfaceDataHost; @NL
  3593. End=
  3594. PreCall=
  3595. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3596. if(ARGUMENT_PRESENT(puCanCreateSurfaceDataHost)) { @Indent( @NL
  3597. @ForceType(PreCall,puCanCreateSurfaceData->lpDD,puCanCreateSurfaceDataHostCopy->lpDD,PVOID,IN)
  3598. pDDS2Host=(struct NT32_DDSURFACEDESC2 *)(puCanCreateSurfaceDataHostCopy->lpDDSurfaceDesc); @NL
  3599. @ForceType(PreCall,pDDS2,pDDS2Host,LPDDSURFACEDESC2,IN)
  3600. puCanCreateSurfaceData->lpDDSurfaceDesc=(PDD_SURFACEDESC)pDDS2;
  3601. @ForceType(PreCall,puCanCreateSurfaceData->bIsDifferentPixelFormat,puCanCreateSurfaceDataHostCopy->bIsDifferentPixelFormat,DWORD,IN)
  3602. @ForceType(PreCall,puCanCreateSurfaceData->ddRVal,puCanCreateSurfaceDataHostCopy->ddRVal,HRESULT,IN)
  3603. @ForceType(PreCall,puCanCreateSurfaceData->CanCreateSurface,puCanCreateSurfaceDataHostCopy->CanCreateSurface,PVOID,IN)
  3604. )} @NL
  3605. End=
  3606. Begin=
  3607. @GenApiThunk(@ApiName)
  3608. End=
  3609. PostCall=
  3610. if(ARGUMENT_PRESENT(puCanCreateSurfaceDataHost)) { @Indent( @NL
  3611. @ForceType(PostCall,puCanCreateSurfaceData->ddRVal,puCanCreateSurfaceDataHostCopy->ddRVal,HRESULT,OUT)
  3612. @ForceType(PostCall,pDDS2,pDDS2Host,LPDDSURFACEDESC2,OUT)
  3613. )} @NL
  3614. End=
  3615. TemplateName=NtGdiDdCanCreateD3DBuffer
  3616. NoType=hDirectDraw
  3617. NoType=puCanCreateSurfaceData
  3618. Locals=
  3619. BYTE puCanCreateSurfaceDataCopy[sizeof(DD_CANCREATESURFACEDATA)]; @NL
  3620. NT32DD_CANCREATESURFACEDATA *puCanCreateSurfaceDataHostCopy; @NL
  3621. LPDDSURFACEDESC2 pDDS2; @NL
  3622. struct NT32_DDSURFACEDESC2 *pDDS2Host; @NL
  3623. @ForceType(Locals,pDDS2,pDDS2Host,LPDDSURFACEDESC2,IN)
  3624. puCanCreateSurfaceData=(DD_CANCREATESURFACEDATA *)puCanCreateSurfaceDataCopy; @NL
  3625. puCanCreateSurfaceDataHostCopy=(NT32DD_CANCREATESURFACEDATA *)puCanCreateSurfaceDataHost; @NL
  3626. End=
  3627. PreCall=
  3628. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3629. if(ARGUMENT_PRESENT(puCanCreateSurfaceDataHost)) { @Indent( @NL
  3630. @ForceType(PreCall,puCanCreateSurfaceData->lpDD,puCanCreateSurfaceDataHostCopy->lpDD,PVOID,IN)
  3631. pDDS2Host=(struct NT32_DDSURFACEDESC2 *)(puCanCreateSurfaceDataHostCopy->lpDDSurfaceDesc); @NL
  3632. @ForceType(PreCall,pDDS2,pDDS2Host,LPDDSURFACEDESC2,IN)
  3633. puCanCreateSurfaceData->lpDDSurfaceDesc=(PDD_SURFACEDESC)pDDS2;
  3634. @ForceType(PreCall,puCanCreateSurfaceData->bIsDifferentPixelFormat,puCanCreateSurfaceDataHostCopy->bIsDifferentPixelFormat,DWORD,IN)
  3635. @ForceType(PreCall,puCanCreateSurfaceData->ddRVal,puCanCreateSurfaceDataHostCopy->ddRVal,HRESULT,IN)
  3636. @ForceType(PreCall,puCanCreateSurfaceData->CanCreateSurface,puCanCreateSurfaceDataHostCopy->CanCreateSurface,PVOID,IN)
  3637. )} @NL
  3638. End=
  3639. Begin=
  3640. @GenApiThunk(@ApiName)
  3641. End=
  3642. PostCall=
  3643. if(ARGUMENT_PRESENT(puCanCreateSurfaceDataHost)) { @Indent( @NL
  3644. @ForceType(PostCall,puCanCreateSurfaceData->ddRVal,puCanCreateSurfaceDataHostCopy->ddRVal,HRESULT,OUT)
  3645. )} @NL
  3646. End=
  3647. TemplateName=NtGdiDdColorControl
  3648. NoType=hSurface
  3649. NoType=puColorControlData
  3650. Locals=
  3651. BYTE puColorControlDataCopy[sizeof(DD_COLORCONTROLDATA)]; @NL
  3652. struct NT32_DD_COLORCONTROLDATA *puColorControlDataHostCopy; @NL
  3653. End=
  3654. PreCall=
  3655. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3656. if(ARGUMENT_PRESENT(puColorControlDataHost)) { @Indent( @NL
  3657. puColorControlData=(PDD_COLORCONTROLDATA)puColorControlDataCopy; @NL
  3658. puColorControlDataHostCopy=(struct NT32_DD_COLORCONTROLDATA *)puColorControlDataHost; @NL
  3659. @ForceType(PreCall,puColorControlData->lpDD,puColorControlDataHostCopy->lpDD,LPVOID,IN)
  3660. @ForceType(PreCall,puColorControlData->lpDDSurface,puColorControlDataHostCopy->lpDDSurface,LPVOID,IN)
  3661. @ForceType(PreCall,puColorControlData->dwFlags,puColorControlDataHostCopy->dwFlags,DWORD,IN)
  3662. if( (puColorControlDataHostCopy->dwFlags & DDRAWI_SETCOLOR) == DDRAWI_SETCOLOR ) { @Indent( @NL
  3663. @ForceType(PreCall,puColorControlData->lpColorData,puColorControlDataHostCopy->lpColorData,LPDDCOLORCONTROL,IN)
  3664. )} @NL
  3665. @ForceType(PreCall,puColorControlData->ddRVal,puColorControlDataHostCopy->ddRVal,HRESULT,IN)
  3666. @ForceType(PreCall,puColorControlData->ColorControl,puColorControlDataHostCopy->ColorControl,LPVOID,IN)
  3667. )} else { @Indent( @NL
  3668. puColorControlData=NULL; @NL
  3669. )} @NL
  3670. End=
  3671. Begin=
  3672. @GenApiThunk(@ApiName)
  3673. End=
  3674. PostCall=
  3675. if(ARGUMENT_PRESENT(puColorControlDataHost)) { @Indent( @NL
  3676. if( (puColorControlDataHostCopy->dwFlags & DDRAWI_GETCOLOR) == DDRAWI_GETCOLOR ) { @Indent( @NL
  3677. @ForceType(PostCall,puColorControlData->lpColorData,puColorControlDataHostCopy->lpColorData,LPDDCOLORCONTROL,OUT)
  3678. )} @NL
  3679. @ForceType(PostCall,puColorControlData->ddRVal,puColorControlDataHostCopy->ddRVal,HRESULT,OUT)
  3680. )} @NL
  3681. End=
  3682. TemplateName=NtGdiDdCreateDirectDrawObject
  3683. Begin=
  3684. @GenApiThunk(@ApiName)
  3685. End=
  3686. TemplateName=NtGdiDdCreateSurface
  3687. NoType=hDirectDraw
  3688. NoType=hSurface
  3689. NoType=puSurfaceDescription
  3690. NoType=puSurfaceGlobalData
  3691. NoType=puSurfaceLocalData
  3692. NoType=puSurfaceMoreData
  3693. NoType=puCreateSurfaceData
  3694. NoType=puhSurface
  3695. Locals=
  3696. BYTE CreateSurfaceDataCopy[sizeof(DD_CREATESURFACEDATA)]; @NL
  3697. NT32HANDLE *puhSurfaceHostCopy;
  3698. DWORD dwCount;
  3699. End=
  3700. PreCall=
  3701. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3702. if(ARGUMENT_PRESENT(puCreateSurfaceDataHost)) { @Indent( @NL
  3703. puCreateSurfaceData = (DD_CREATESURFACEDATA *)CreateSurfaceDataCopy; @NL
  3704. RtlZeroMemory(puCreateSurfaceData, sizeof(DD_CREATESURFACEDATA)); @NL
  3705. puCreateSurfaceData->dwSCnt = ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->dwSCnt; @NL
  3706. puCreateSurfaceData->ddRVal = ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->ddRVal; @NL
  3707. dwCount=puCreateSurfaceData->dwSCnt; @NL
  3708. Wow64GdiDdThunkSurfaceHandlesPreCall(&hSurface,(NT32HANDLE *)hSurfaceHost,dwCount); @NL
  3709. Wow64GdiDdThunkSurfaceDescriptionPreCall(&puSurfaceDescription,(struct NT32_DDSURFACEDESC *)puSurfaceDescriptionHost,1,dwCount); @NL
  3710. Wow64GdiDdThunkSurfaceGlobalPreCall(&(puSurfaceGlobalData),((struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost),dwCount); @NL
  3711. Wow64GdiDdThunkSurfaceLocalPreCall(&(puSurfaceLocalData),((struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost),dwCount); @NL
  3712. Wow64GdiDdThunkSurfaceMorePreCall(&(puSurfaceMoreData),((struct NT32_DD_SURFACE_MORE *)puSurfaceMoreDataHost),dwCount); @NL
  3713. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3714. puhSurface=(HANDLE *)Wow64AllocateTemp(sizeof(HANDLE)*dwCount); @NL
  3715. )} else { @Indent( @NL
  3716. puhSurface=NULL; @NL
  3717. )} @NL
  3718. )} else { @Indent( @NL
  3719. puCreateSurfaceData=NULL; @NL
  3720. Wow64GdiDdThunkSurfaceHandlesPreCall(&hSurface,(NT32HANDLE *)hSurfaceHost,1); @NL
  3721. Wow64GdiDdThunkSurfaceDescriptionPreCall(&puSurfaceDescription,(struct NT32_DDSURFACEDESC *)puSurfaceDescriptionHost,1,1); @NL
  3722. Wow64GdiDdThunkSurfaceGlobalPreCall(&(puSurfaceGlobalData),((struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost),1); @NL
  3723. Wow64GdiDdThunkSurfaceLocalPreCall(&(puSurfaceLocalData),((struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost),1); @NL
  3724. Wow64GdiDdThunkSurfaceMorePreCall(&(puSurfaceMoreData),((struct NT32_DD_SURFACE_MORE *)puSurfaceMoreDataHost),1); @NL
  3725. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3726. puhSurface=(HANDLE *)Wow64AllocateTemp(sizeof(HANDLE)); @NL
  3727. )} else { @Indent( @NL
  3728. puhSurface=NULL; @NL
  3729. )} @NL
  3730. )} @NL
  3731. End=
  3732. Begin=
  3733. @GenApiThunk(@ApiName)
  3734. End=
  3735. PostCall=
  3736. if(ARGUMENT_PRESENT(puCreateSurfaceDataHost)) { @Indent( @NL
  3737. ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->ddRVal = puCreateSurfaceData->ddRVal; @NL
  3738. Wow64GdiDdThunkSurfaceGlobalPostCall(puSurfaceGlobalData,(struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost,dwCount); @NL
  3739. Wow64GdiDdThunkSurfaceLocalPostCall(puSurfaceLocalData,(struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost,dwCount);
  3740. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3741. puhSurfaceHostCopy=(NT32HANDLE *)puhSurfaceHost; @NL
  3742. while(dwCount--) { @Indent( @NL
  3743. *puhSurfaceHostCopy=(NT32HANDLE)(*puhSurface); @NL
  3744. puhSurfaceHostCopy++;
  3745. puhSurface++;
  3746. )} @NL
  3747. )} @NL
  3748. )} else { @Indent( @NL
  3749. Wow64GdiDdThunkSurfaceGlobalPostCall(puSurfaceGlobalData,(struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost,1); @NL
  3750. Wow64GdiDdThunkSurfaceLocalPostCall(puSurfaceLocalData,(struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost,1);
  3751. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3752. puhSurfaceHostCopy=(NT32HANDLE *)puhSurfaceHost; @NL
  3753. *puhSurfaceHostCopy=(NT32HANDLE)(*puhSurface); @NL
  3754. )} @NL
  3755. )} @NL
  3756. End=
  3757. TemplateName=NtGdiDdCreateSurfaceEx
  3758. NoType=hDirectDraw
  3759. NoType=hSurface
  3760. PreCall=
  3761. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3762. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3763. End=
  3764. Begin=
  3765. @GenApiThunk(@ApiName)
  3766. End=
  3767. TemplateName=NtGdiDdCreateD3DBuffer
  3768. NoType=hDirectDraw
  3769. NoType=hSurface
  3770. NoType=puSurfaceDescription
  3771. NoType=puSurfaceGlobalData
  3772. NoType=puSurfaceLocalData
  3773. NoType=puSurfaceMoreData
  3774. NoType=puCreateSurfaceData
  3775. NoType=puhSurface
  3776. Locals=
  3777. BYTE CreateSurfaceDataCopy[sizeof(DD_CREATESURFACEDATA)]; @NL
  3778. NT32HANDLE *puhSurfaceHostCopy;
  3779. DWORD dwCount;
  3780. End=
  3781. PreCall=
  3782. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3783. if(ARGUMENT_PRESENT(puCreateSurfaceDataHost)) { @Indent( @NL
  3784. puCreateSurfaceData = (DD_CREATESURFACEDATA *)CreateSurfaceDataCopy; @NL
  3785. RtlZeroMemory(puCreateSurfaceData, sizeof(DD_CREATESURFACEDATA)); @NL
  3786. puCreateSurfaceData->dwSCnt = ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->dwSCnt; @NL
  3787. puCreateSurfaceData->ddRVal = ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->ddRVal; @NL
  3788. dwCount=puCreateSurfaceData->dwSCnt; @NL
  3789. Wow64GdiDdThunkSurfaceHandlesPreCall(&hSurface,(NT32HANDLE *)hSurfaceHost,dwCount); @NL
  3790. Wow64GdiDdThunkSurfaceDescriptionPreCall(&puSurfaceDescription,(struct NT32_DDSURFACEDESC *)puSurfaceDescriptionHost,1,dwCount); @NL
  3791. Wow64GdiDdThunkSurfaceGlobalPreCall(&(puSurfaceGlobalData),((struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost),dwCount); @NL
  3792. Wow64GdiDdThunkSurfaceLocalPreCall(&(puSurfaceLocalData),((struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost),dwCount); @NL
  3793. Wow64GdiDdThunkSurfaceMorePreCall(&(puSurfaceMoreData),((struct NT32_DD_SURFACE_MORE *)puSurfaceMoreDataHost),dwCount); @NL
  3794. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3795. puhSurface=(HANDLE *)Wow64AllocateTemp(sizeof(HANDLE)*dwCount); @NL
  3796. )} else { @Indent( @NL
  3797. puhSurface=NULL; @NL
  3798. )} @NL
  3799. )} else { @Indent( @NL
  3800. puCreateSurfaceData=NULL; @NL
  3801. Wow64GdiDdThunkSurfaceHandlesPreCall(&hSurface,(NT32HANDLE *)hSurfaceHost,1); @NL
  3802. Wow64GdiDdThunkSurfaceDescriptionPreCall(&puSurfaceDescription,(struct NT32_DDSURFACEDESC *)puSurfaceDescriptionHost,1,1); @NL
  3803. Wow64GdiDdThunkSurfaceGlobalPreCall(&(puSurfaceGlobalData),((struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost),1); @NL
  3804. Wow64GdiDdThunkSurfaceLocalPreCall(&(puSurfaceLocalData),((struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost),1); @NL
  3805. Wow64GdiDdThunkSurfaceMorePreCall(&(puSurfaceMoreData),((struct NT32_DD_SURFACE_MORE *)puSurfaceMoreDataHost),1); @NL
  3806. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3807. puhSurface=(HANDLE *)Wow64AllocateTemp(sizeof(HANDLE)); @NL
  3808. )} else { @Indent( @NL
  3809. puhSurface=NULL; @NL
  3810. )} @NL
  3811. )} @NL
  3812. End=
  3813. Begin=
  3814. @GenApiThunk(@ApiName)
  3815. End=
  3816. PostCall=
  3817. if(ARGUMENT_PRESENT(puCreateSurfaceDataHost)) { @Indent( @NL
  3818. ((struct NT32_DD_CREATESURFACEDATA *)puCreateSurfaceDataHost)->ddRVal = puCreateSurfaceData->ddRVal; @NL
  3819. Wow64GdiDdThunkSurfaceGlobalPostCall(puSurfaceGlobalData,(struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost,dwCount); @NL
  3820. Wow64GdiDdThunkSurfaceLocalPostCall(puSurfaceLocalData,(struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost,dwCount);
  3821. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3822. puhSurfaceHostCopy=(NT32HANDLE *)puhSurfaceHost; @NL
  3823. while(dwCount--) { @Indent( @NL
  3824. *puhSurfaceHostCopy=(NT32HANDLE)(*puhSurface); @NL
  3825. puhSurfaceHostCopy++;
  3826. puhSurface++;
  3827. )} @NL
  3828. )} @NL
  3829. )} else { @Indent( @NL
  3830. Wow64GdiDdThunkSurfaceGlobalPostCall(puSurfaceGlobalData,(struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalDataHost,1); @NL
  3831. Wow64GdiDdThunkSurfaceLocalPostCall(puSurfaceLocalData,(struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalDataHost,1);
  3832. if(ARGUMENT_PRESENT(puhSurfaceHost)) { @Indent( @NL
  3833. puhSurfaceHostCopy=(NT32HANDLE *)puhSurfaceHost; @NL
  3834. *puhSurfaceHostCopy=(NT32HANDLE)(*puhSurface); @NL
  3835. )} @NL
  3836. )} @NL
  3837. End=
  3838. TemplateName=NtGdiDdCreateMoComp
  3839. Begin=
  3840. @GenUnsupportedNtApiThunk
  3841. End=
  3842. TemplateName=NtGdiDdCreateSurfaceObject
  3843. NoType=hDirectDrawLocal
  3844. NoType=hSurface
  3845. NoType=puSurfaceGlobal
  3846. NoType=puSurfaceLocal
  3847. NoType=puSurfaceMore
  3848. PreCall=
  3849. hDirectDrawLocal=(HANDLE)((unsigned)hDirectDrawLocalHost); @NL
  3850. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3851. Wow64GdiDdThunkSurfaceGlobalPreCall(&(puSurfaceGlobal),((struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalHost),1); @NL
  3852. Wow64GdiDdThunkSurfaceLocalPreCall(&(puSurfaceLocal),((struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalHost),1); @NL
  3853. Wow64GdiDdThunkSurfaceMorePreCall(&(puSurfaceMore),((struct NT32_DD_SURFACE_MORE *)puSurfaceMoreHost),1); @NL
  3854. End=
  3855. Begin=
  3856. @GenApiThunk(@ApiName)
  3857. End=
  3858. PostCall=
  3859. Wow64GdiDdThunkSurfaceGlobalPostCall(puSurfaceGlobal,(struct NT32_DD_SURFACE_GLOBAL *)puSurfaceGlobalHost,1); @NL
  3860. Wow64GdiDdThunkSurfaceLocalPostCall(puSurfaceLocal,(struct NT32_DD_SURFACE_LOCAL *)puSurfaceLocalHost,1);
  3861. End=
  3862. TemplateName=NtGdiDdDeleteDirectDrawObject
  3863. NoType=hDirectDrawLocal
  3864. PreCall=
  3865. hDirectDrawLocal=(HANDLE)((unsigned)hDirectDrawLocalHost); @NL
  3866. Begin=
  3867. @GenApiThunk(@ApiName)
  3868. End=
  3869. TemplateName=NtGdiDdDeleteSurfaceObject
  3870. NoType=hSurface
  3871. PreCall=
  3872. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3873. End=
  3874. Begin=
  3875. @GenApiThunk(@ApiName)
  3876. End=
  3877. TemplateName=NtGdiDdDestroyMoComp
  3878. Begin=
  3879. @GenUnsupportedNtApiThunk
  3880. End=
  3881. TemplateName=NtGdiDdDestroySurface
  3882. NoType=hSurface
  3883. PreCall=
  3884. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3885. End=
  3886. Begin=
  3887. @GenApiThunk(@ApiName)
  3888. End=
  3889. TemplateName=NtGdiDdDestroyD3DBuffer
  3890. NoType=hSurface
  3891. PreCall=
  3892. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  3893. End=
  3894. Begin=
  3895. @GenApiThunk(@ApiName)
  3896. End=
  3897. TemplateName=NtGdiDdEndMoCompFrame
  3898. Begin=
  3899. @GenUnsupportedNtApiThunk
  3900. End=
  3901. TemplateName=NtGdiDdFlip
  3902. NoType=hSurfaceCurrent
  3903. NoType=hSurfaceTarget
  3904. NoType=hSurfaceCurrentLeft
  3905. NoType=hSurfaceTargetLeft
  3906. NoType=puFlipData
  3907. Locals=
  3908. BYTE puFlipDataCopy[sizeof(DD_FLIPDATA)]; @NL
  3909. struct NT32_DD_FLIPDATA *puFlipDataHostCopy;
  3910. puFlipData=(PDD_FLIPDATA)puFlipDataCopy; @NL
  3911. puFlipDataHostCopy=(struct NT32_DD_FLIPDATA *)puFlipDataHost; @NL
  3912. End=
  3913. PreCall=
  3914. hSurfaceCurrent=(HANDLE)((unsigned)hSurfaceCurrentHost); @NL
  3915. hSurfaceTarget=(HANDLE)((unsigned)hSurfaceTargetHost); @NL
  3916. hSurfaceCurrentLeft=(HANDLE)((unsigned)hSurfaceCurrentLeftHost); @NL
  3917. hSurfaceTargetLeft=(HANDLE)((unsigned)hSurfaceTargetLeftHost); @NL
  3918. if(ARGUMENT_PRESENT(puFlipDataHost)) { @Indent( @NL
  3919. RtlZeroMemory(puFlipDataCopy,sizeof(DD_FLIPDATA)); @NL
  3920. @ForceType(PreCall,puFlipData->dwFlags,puFlipDataHostCopy->dwFlags,DWORD,IN)
  3921. @ForceType(PreCall,puFlipData->ddRVal,puFlipDataHostCopy->ddRVal,HRESULT,IN)
  3922. @ForceType(PreCall,puFlipData->Flip,puFlipDataHostCopy->Flip,PVOID,IN)
  3923. )} else { @Indent( @NL
  3924. puFlipData=NULL; @NL
  3925. )} @NL
  3926. End=
  3927. Begin=
  3928. @GenApiThunk(@ApiName)
  3929. End=
  3930. PostCall=
  3931. @ForceType(PostCall,puFlipData->ddRVal,puFlipDataHostCopy->ddRVal,HRESULT,OUT)
  3932. @ForceType(PostCall,puFlipData->Flip,puFlipDataHostCopy->Flip,PVOID,OUT)
  3933. End=
  3934. TemplateName=NtGdiDdFlipToGDISurface
  3935. NoType=hDirectDraw
  3936. NoType=puFlipToGDISurfaceData
  3937. Locals=
  3938. BYTE puFlipToGDISurfaceDataCopy[sizeof(DD_FLIPTOGDISURFACEDATA)]; @NL
  3939. struct NT32_DD_FLIPTOGDISURFACEDATA *puFlipToGDISurfaceDataHostCopy; @NL
  3940. End=
  3941. PreCall=
  3942. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3943. if(ARGUMENT_PRESENT(puFlipToGDISurfaceDataHost)) { @Indent( @NL
  3944. puFlipToGDISurfaceData=(PDD_FLIPTOGDISURFACEDATA)puFlipToGDISurfaceDataCopy; @NL
  3945. puFlipToGDISurfaceDataHostCopy=(struct NT32_DD_FLIPTOGDISURFACEDATA *)puFlipToGDISurfaceDataHost; @NL
  3946. @ForceType(PreCall,puFlipToGDISurfaceData->lpDD,puFlipToGDISurfaceDataHostCopy->lpDD,LPVOID,IN)
  3947. @ForceType(PreCall,puFlipToGDISurfaceData->dwToGDI,puFlipToGDISurfaceDataHostCopy->dwToGDI,DWORD,IN)
  3948. @ForceType(PreCall,puFlipToGDISurfaceData->dwReserved,puFlipToGDISurfaceDataHostCopy->dwReserved,DWORD,IN)
  3949. @ForceType(PreCall,puFlipToGDISurfaceData->ddRVal,puFlipToGDISurfaceDataHostCopy->ddRVal,HRESULT,IN)
  3950. @ForceType(PreCall,puFlipToGDISurfaceData->FlipToGDISurface,puFlipToGDISurfaceDataHostCopy->FlipToGDISurface,LPVOID,IN)
  3951. )} else { @Indent( @NL
  3952. puFlipToGDISurfaceData=NULL; @NL
  3953. )} @NL
  3954. End=
  3955. Begin=
  3956. @GenApiThunk(@ApiName)
  3957. End=
  3958. PostCall=
  3959. if(ARGUMENT_PRESENT(puFlipToGDISurfaceDataHost)) { @Indent( @NL
  3960. @ForceType(PostCall,puFlipToGDISurfaceData->ddRVal,puFlipToGDISurfaceDataHostCopy->ddRVal,HRESULT,OUT)
  3961. @ForceType(PostCall,puFlipToGDISurfaceData->FlipToGDISurface,puFlipToGDISurfaceDataHostCopy->FlipToGDISurface,LPVOID,OUT)
  3962. )} @NL
  3963. End=
  3964. TemplateName=NtGdiDdGetAvailDriverMemory
  3965. NoType=hDirectDraw
  3966. NoType=puGetAvailDriverMemoryData
  3967. Locals=
  3968. BYTE puGetAvailDriverMemoryDataCopy[sizeof(DD_GETAVAILDRIVERMEMORYDATA)]; @NL
  3969. struct NT32_DD_GETAVAILDRIVERMEMORYDATA *puGetAvailDriverMemoryDataHostCopy;
  3970. End=
  3971. PreCall=
  3972. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  3973. if(ARGUMENT_PRESENT(puGetAvailDriverMemoryDataHost)) { @Indent( @NL
  3974. puGetAvailDriverMemoryData=(PDD_GETAVAILDRIVERMEMORYDATA)puGetAvailDriverMemoryDataCopy; @NL
  3975. puGetAvailDriverMemoryDataHostCopy=(struct NT32_DD_GETAVAILDRIVERMEMORYDATA *)puGetAvailDriverMemoryDataHost; @NL
  3976. @ForceType(PreCall,puGetAvailDriverMemoryData->lpDD,puGetAvailDriverMemoryDataHostCopy->lpDD,LPVOID,IN)
  3977. @ForceType(PreCall,puGetAvailDriverMemoryData->DDSCaps,puGetAvailDriverMemoryDataHostCopy->DDSCaps,DDSCAPS,IN)
  3978. @ForceType(PreCall,puGetAvailDriverMemoryData->dwTotal,puGetAvailDriverMemoryDataHostCopy->dwTotal,DWORD,IN)
  3979. @ForceType(PreCall,puGetAvailDriverMemoryData->dwFree,puGetAvailDriverMemoryDataHostCopy->dwFree,DWORD,IN)
  3980. @ForceType(PreCall,puGetAvailDriverMemoryData->ddRVal,puGetAvailDriverMemoryDataHostCopy->ddRVal,HRESULT,IN)
  3981. @ForceType(PreCall,puGetAvailDriverMemoryData->GetAvailDriverMemory,puGetAvailDriverMemoryDataHostCopy->GetAvailDriverMemory,LPVOID,IN)
  3982. )} else { @Indent( @NL
  3983. puGetAvailDriverMemoryData=NULL; @NL
  3984. )} @NL
  3985. End=
  3986. Begin=
  3987. @GenApiThunk(@ApiName)
  3988. End=
  3989. PostCall=
  3990. if(ARGUMENT_PRESENT(puGetAvailDriverMemoryDataHost)) { @Indent( @NL
  3991. @ForceType(PostCall,puGetAvailDriverMemoryData->DDSCaps,puGetAvailDriverMemoryDataHostCopy->DDSCaps,DDSCAPS,OUT)
  3992. @ForceType(PostCall,puGetAvailDriverMemoryData->dwTotal,puGetAvailDriverMemoryDataHostCopy->dwTotal,DWORD,OUT)
  3993. @ForceType(PostCall,puGetAvailDriverMemoryData->dwFree,puGetAvailDriverMemoryDataHostCopy->dwFree,DWORD,OUT)
  3994. @ForceType(PostCall,puGetAvailDriverMemoryData->ddRVal,puGetAvailDriverMemoryDataHostCopy->ddRVal,HRESULT,OUT)
  3995. @ForceType(PostCall,puGetAvailDriverMemoryData->GetAvailDriverMemory,puGetAvailDriverMemoryDataHostCopy->GetAvailDriverMemory,LPVOID,OUT)
  3996. )} @NL
  3997. End=
  3998. TemplateName=NtGdiDdGetBltStatus
  3999. NoType=hSurface
  4000. NoType=puGetBltStatusData
  4001. Locals=
  4002. BYTE puGetBltStatusDataCopy[sizeof(DD_GETBLTSTATUSDATA)]; @NL
  4003. struct NT32_DD_GETBLTSTATUSDATA *puGetBltStatusDataHostCopy; @NL
  4004. puGetBltStatusData=(PDD_GETBLTSTATUSDATA)puGetBltStatusDataCopy; @NL
  4005. puGetBltStatusDataHostCopy=(struct NT32_DD_GETBLTSTATUSDATA *)puGetBltStatusDataHost; @NL
  4006. End=
  4007. PreCall=
  4008. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4009. if(ARGUMENT_PRESENT(puGetBltStatusDataHost)) { @Indent( @NL
  4010. RtlZeroMemory(puGetBltStatusDataCopy,sizeof(DD_GETBLTSTATUSDATA)); @NL
  4011. @ForceType(PreCall,puGetBltStatusData->dwFlags,puGetBltStatusDataHostCopy->dwFlags,DWORD,IN)
  4012. @ForceType(PreCall,puGetBltStatusData->ddRVal,puGetBltStatusDataHostCopy->ddRVal,DWORD,IN)
  4013. @ForceType(PreCall,puGetBltStatusData->GetBltStatus,puGetBltStatusDataHostCopy->GetBltStatus,PVOID,IN)
  4014. )} else { @Indent( @NL
  4015. puGetBltStatusData=NULL;
  4016. )} @NL
  4017. End=
  4018. Begin=
  4019. @GenApiThunk(@ApiName)
  4020. End=
  4021. PostCall=
  4022. @ForceType(PostCall,puGetBltStatusData->ddRVal,puGetBltStatusDataHostCopy->ddRVal,DWORD,OUT)
  4023. @ForceType(PostCall,puGetBltStatusData->GetBltStatus,puGetBltStatusDataHostCopy->GetBltStatus,PVOID,OUT)
  4024. End=
  4025. TemplateName=NtGdiDdGetDC
  4026. NoType=hSurface
  4027. PreCall=
  4028. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4029. End=
  4030. Begin=
  4031. @GenApiThunk(@ApiName)
  4032. End=
  4033. TemplateName=NtGdiDdGetDriverInfo
  4034. NoType=hDirectDraw
  4035. Header=
  4036. @NoFormat(
  4037. DWORD
  4038. whNtGdiDdGetDriverInfoInternal(
  4039. IN HANDLE hDirectDraw,
  4040. IN OUT PDD_GETDRIVERINFODATA pGetDriverInfoData)
  4041. {
  4042. DWORD dwRet;
  4043. DD_GETDRIVERINFODATA GetDriverInfoData;
  4044. GetDriverInfoData = *pGetDriverInfoData;
  4045. if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_VideoPortCallbacks))
  4046. {
  4047. DD_VIDEOPORTCALLBACKS VideoPortCallBacks;
  4048. LPDDHAL_DDVIDEOPORTCALLBACKS lpVideoPortCallBacks;
  4049. lpVideoPortCallBacks = pGetDriverInfoData->lpvData;
  4050. GetDriverInfoData.lpvData = &VideoPortCallBacks;
  4051. GetDriverInfoData.dwExpectedSize = sizeof(VideoPortCallBacks);
  4052. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4053. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4054. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4055. @ForceType(PostCall,((PDD_VIDEOPORTCALLBACKS)(GetDriverInfoData.lpvData)),((struct NT32_DD_VIDEOPORTCALLBACKS *)(lpVideoPortCallBacks)),PDD_VIDEOPORTCALLBACKS,OUT)
  4056. }
  4057. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_ColorControlCallbacks))
  4058. {
  4059. DD_COLORCONTROLCALLBACKS ColorControlCallBacks;
  4060. LPDDHAL_DDCOLORCONTROLCALLBACKS lpColorControlCallBacks;
  4061. // Translate ColorControl call-backs to user-mode:
  4062. lpColorControlCallBacks = pGetDriverInfoData->lpvData;
  4063. GetDriverInfoData.lpvData = &ColorControlCallBacks;
  4064. GetDriverInfoData.dwExpectedSize = sizeof(ColorControlCallBacks);
  4065. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4066. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4067. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4068. ((struct NT32_DD_COLORCONTROLCALLBACKS *)(lpColorControlCallBacks))->dwSize = ColorControlCallBacks.dwSize;
  4069. ((struct NT32_DD_COLORCONTROLCALLBACKS *)(lpColorControlCallBacks))->dwFlags = ColorControlCallBacks.dwFlags;
  4070. ((struct NT32_DD_COLORCONTROLCALLBACKS *)(lpColorControlCallBacks))->ColorControl = (_int32)ColorControlCallBacks.ColorControl;
  4071. }
  4072. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_MiscellaneousCallbacks))
  4073. {
  4074. DD_MISCELLANEOUSCALLBACKS MiscellaneousCallBacks;
  4075. LPDDHAL_DDMISCELLANEOUSCALLBACKS lpMiscellaneousCallBacks;
  4076. // Translate miscellaneous call-backs to user-mode:
  4077. lpMiscellaneousCallBacks = pGetDriverInfoData->lpvData;
  4078. GetDriverInfoData.lpvData = &MiscellaneousCallBacks;
  4079. GetDriverInfoData.dwExpectedSize = sizeof(MiscellaneousCallBacks);
  4080. lpMiscellaneousCallBacks->dwFlags = 0;
  4081. // Don't return what the driver returns because we always want this
  4082. // to suceed
  4083. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4084. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4085. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4086. ((struct NT32_DD_MISCELLANEOUSCALLBACKS *)(lpMiscellaneousCallBacks))->dwSize = MiscellaneousCallBacks.dwSize;
  4087. ((struct NT32_DD_MISCELLANEOUSCALLBACKS *)(lpMiscellaneousCallBacks))->dwFlags = MiscellaneousCallBacks.dwFlags;
  4088. ((struct NT32_DD_MISCELLANEOUSCALLBACKS *)(lpMiscellaneousCallBacks))->GetAvailDriverMemory = (_int32)MiscellaneousCallBacks.GetAvailDriverMemory;
  4089. }
  4090. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_Miscellaneous2Callbacks))
  4091. {
  4092. DD_MISCELLANEOUS2CALLBACKS Miscellaneous2CallBacks;
  4093. LPDDHAL_DDMISCELLANEOUS2CALLBACKS lpMiscellaneous2CallBacks;
  4094. // Translate miscellaneous call-backs to user-mode:
  4095. lpMiscellaneous2CallBacks = pGetDriverInfoData->lpvData;
  4096. GetDriverInfoData.lpvData = &Miscellaneous2CallBacks;
  4097. GetDriverInfoData.dwExpectedSize = sizeof(Miscellaneous2CallBacks);
  4098. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4099. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4100. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4101. ((struct NT32_DD_MISCELLANEOUS2CALLBACKS *)(lpMiscellaneous2CallBacks))->dwSize = Miscellaneous2CallBacks.dwSize;
  4102. ((struct NT32_DD_MISCELLANEOUS2CALLBACKS *)(lpMiscellaneous2CallBacks))->dwFlags = Miscellaneous2CallBacks.dwFlags;
  4103. ((struct NT32_DD_MISCELLANEOUS2CALLBACKS *)(lpMiscellaneous2CallBacks))->AlphaBlt = (__int32)Miscellaneous2CallBacks.AlphaBlt;
  4104. ((struct NT32_DD_MISCELLANEOUS2CALLBACKS *)(lpMiscellaneous2CallBacks))->CreateSurfaceEx = (__int32)Miscellaneous2CallBacks.CreateSurfaceEx;
  4105. ((struct NT32_DD_MISCELLANEOUS2CALLBACKS *)(lpMiscellaneous2CallBacks))->GetDriverState = (__int32)Miscellaneous2CallBacks.GetDriverState;
  4106. }
  4107. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_NTCallbacks))
  4108. {
  4109. DD_NTCALLBACKS NTCallBacks;
  4110. LPDDHAL_DDNTCALLBACKS lpNTCallBacks;
  4111. // Translate NT call-backs to user-mode:
  4112. lpNTCallBacks = pGetDriverInfoData->lpvData;
  4113. GetDriverInfoData.lpvData = &NTCallBacks;
  4114. GetDriverInfoData.dwExpectedSize = sizeof(NTCallBacks);
  4115. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4116. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4117. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4118. ((struct NT32_DD_NTCALLBACKS *)(lpNTCallBacks))->dwSize = NTCallBacks.dwSize;
  4119. ((struct NT32_DD_NTCALLBACKS *)(lpNTCallBacks))->dwFlags = NTCallBacks.dwFlags;
  4120. ((struct NT32_DD_NTCALLBACKS *)(lpNTCallBacks))->FreeDriverMemory = (__int32)NTCallBacks.FreeDriverMemory;
  4121. ((struct NT32_DD_NTCALLBACKS *)(lpNTCallBacks))->SetExclusiveMode = (__int32)NTCallBacks.SetExclusiveMode;
  4122. ((struct NT32_DD_NTCALLBACKS *)(lpNTCallBacks))->FlipToGDISurface = (__int32)NTCallBacks.FlipToGDISurface;
  4123. }
  4124. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_D3DCallbacks))
  4125. {
  4126. D3DNTHAL_CALLBACKS D3dCallbacks;
  4127. LPD3DHAL_CALLBACKS lpD3dCallbacks;
  4128. // Translate D3DNTHAL_CALLBACKS to user-mode.
  4129. lpD3dCallbacks = pGetDriverInfoData->lpvData;
  4130. GetDriverInfoData.lpvData = &D3dCallbacks;
  4131. GetDriverInfoData.dwExpectedSize = sizeof(D3dCallbacks);
  4132. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4133. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4134. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4135. @ForceType(PostCall,((LPD3DNTHAL_CALLBACKS)(GetDriverInfoData.lpvData)),((struct NT32_D3DNTHAL_CALLBACKS *)(lpD3dCallbacks)),LPD3DNTHAL_CALLBACKS,OUT)
  4136. }
  4137. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_D3DCallbacks3))
  4138. {
  4139. D3DNTHAL_CALLBACKS3 D3dCallbacks3;
  4140. LPD3DHAL_CALLBACKS3 lpD3dCallbacks3;
  4141. // Translate D3DNTHAL_CALLBACKS3 to user-mode.
  4142. lpD3dCallbacks3 = pGetDriverInfoData->lpvData;
  4143. GetDriverInfoData.lpvData = &D3dCallbacks3;
  4144. GetDriverInfoData.dwExpectedSize = sizeof(D3dCallbacks3);
  4145. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4146. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4147. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4148. @ForceType(PostCall,((LPD3DNTHAL_CALLBACKS3)(GetDriverInfoData.lpvData)),((struct NT32_D3DNTHAL_CALLBACKS3 *)(lpD3dCallbacks3)),LPD3DNTHAL_CALLBACKS3,OUT)
  4149. }
  4150. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_KernelCallbacks))
  4151. {
  4152. DD_KERNELCALLBACKS DdKernelCallbacks;
  4153. LPDDHAL_DDKERNELCALLBACKS lpDdKernelCallbacks;
  4154. // Translate KernelCallbacks to user-mode.
  4155. lpDdKernelCallbacks = pGetDriverInfoData->lpvData;
  4156. GetDriverInfoData.lpvData = &DdKernelCallbacks;
  4157. GetDriverInfoData.dwExpectedSize = sizeof(DdKernelCallbacks);
  4158. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4159. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4160. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4161. ((struct NT32DD_KERNELCALLBACKS *)(lpDdKernelCallbacks))->dwSize = DdKernelCallbacks.dwSize;
  4162. ((struct NT32DD_KERNELCALLBACKS *)(lpDdKernelCallbacks))->dwFlags = DdKernelCallbacks.dwFlags;
  4163. ((struct NT32DD_KERNELCALLBACKS *)(lpDdKernelCallbacks))->SyncSurfaceData = (__int32)DdKernelCallbacks.SyncSurfaceData;
  4164. ((struct NT32DD_KERNELCALLBACKS *)(lpDdKernelCallbacks))->SyncVideoPortData = (__int32)DdKernelCallbacks.SyncVideoPortData;
  4165. }
  4166. else if (IsEqualIID(&pGetDriverInfoData->guidInfo, &GUID_MotionCompCallbacks))
  4167. {
  4168. DD_MOTIONCOMPCALLBACKS MotionCompCallbacks;
  4169. LPDDHAL_DDMOTIONCOMPCALLBACKS lpMotionCompCallbacks;
  4170. // Translate Video call-backs to user-mode:
  4171. lpMotionCompCallbacks = pGetDriverInfoData->lpvData;
  4172. GetDriverInfoData.lpvData = &MotionCompCallbacks;
  4173. GetDriverInfoData.dwExpectedSize = sizeof(MotionCompCallbacks);
  4174. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, &GetDriverInfoData);
  4175. pGetDriverInfoData->dwActualSize = GetDriverInfoData.dwActualSize;
  4176. pGetDriverInfoData->ddRVal = GetDriverInfoData.ddRVal;
  4177. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->dwSize = MotionCompCallbacks.dwSize;
  4178. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->dwFlags = MotionCompCallbacks.dwFlags;
  4179. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->GetMoCompGuids = (__int32)MotionCompCallbacks.GetMoCompGuids;
  4180. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->GetMoCompFormats = (__int32)MotionCompCallbacks.GetMoCompFormats;
  4181. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->GetMoCompBuffInfo = (__int32)MotionCompCallbacks.GetMoCompBuffInfo;
  4182. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->GetInternalMoCompInfo = (__int32)MotionCompCallbacks.GetInternalMoCompInfo;
  4183. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->BeginMoCompFrame = (__int32)MotionCompCallbacks.BeginMoCompFrame;
  4184. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->EndMoCompFrame = (__int32)MotionCompCallbacks.EndMoCompFrame;
  4185. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->RenderMoComp = (__int32)MotionCompCallbacks.RenderMoComp;
  4186. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->QueryMoCompStatus = (__int32)MotionCompCallbacks.QueryMoCompStatus;
  4187. ((struct NT32DD_MOTIONCOMPCALLBACKS *)(lpMotionCompCallbacks))->DestroyMoComp = (__int32)MotionCompCallbacks.DestroyMoComp;
  4188. }
  4189. else
  4190. {
  4191. dwRet = NtGdiDdGetDriverInfo(hDirectDraw, pGetDriverInfoData);
  4192. }
  4193. return dwRet;
  4194. }
  4195. )
  4196. End=
  4197. PreCall=
  4198. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4199. End=
  4200. Begin=
  4201. @GenApiThunk(whNtGdiDdGetDriverInfoInternal)
  4202. End=
  4203. TemplateName=NtGdiDdGetDxHandle
  4204. NoType=hDirectDraw
  4205. NoType=hSurface
  4206. PreCall=
  4207. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4208. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4209. End=
  4210. Begin=
  4211. @GenApiThunk(@ApiName)
  4212. End=
  4213. PostCall=
  4214. hDirectDrawHost=(unsigned)hDirectDraw; @NL
  4215. hSurfaceHost=(unsigned)hSurface; @NL
  4216. End=
  4217. TemplateName=NtGdiDdGetFlipStatus
  4218. NoType=hSurface
  4219. NoType=puGetFlipStatusData
  4220. Locals=
  4221. BYTE puGetFlipStatusDataCopy[sizeof(DD_GETFLIPSTATUSDATA)]; @NL
  4222. struct NT32_DD_GETFLIPSTATUSDATA *puGetFlipStatusDataHostCopy; @NL
  4223. puGetFlipStatusData=(PDD_GETFLIPSTATUSDATA)puGetFlipStatusDataCopy; @NL
  4224. puGetFlipStatusDataHostCopy=(struct NT32_DD_GETFLIPSTATUSDATA *)puGetFlipStatusDataHost; @NL
  4225. End=
  4226. PreCall=
  4227. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4228. if(ARGUMENT_PRESENT(puGetFlipStatusDataHost)) { @Indent( @NL
  4229. RtlZeroMemory(puGetFlipStatusDataCopy,sizeof(DD_GETFLIPSTATUSDATA)); @NL
  4230. @ForceType(PreCall,puGetFlipStatusData->dwFlags,puGetFlipStatusDataHostCopy->dwFlags,DWORD,IN)
  4231. @ForceType(PreCall,puGetFlipStatusData->ddRVal,puGetFlipStatusDataHostCopy->ddRVal,DWORD,IN)
  4232. @ForceType(PreCall,puGetFlipStatusData->GetFlipStatus,puGetFlipStatusDataHostCopy->GetFlipStatus,PVOID,IN)
  4233. )} else { @Indent( @NL
  4234. puGetFlipStatusData=NULL;
  4235. )} @NL
  4236. End=
  4237. Begin=
  4238. @GenApiThunk(@ApiName)
  4239. End=
  4240. PostCall=
  4241. @ForceType(PostCall,puGetFlipStatusData->ddRVal,puGetFlipStatusDataHostCopy->ddRVal,DWORD,OUT)
  4242. @ForceType(PostCall,puGetFlipStatusData->GetFlipStatus,puGetFlipStatusDataHostCopy->GetFlipStatus,PVOID,OUT)
  4243. End=
  4244. TemplateName=NtGdiDdGetInternalMoCompInfo
  4245. NoType=hDirectDraw
  4246. NoType=puGetInternalData
  4247. Locals=
  4248. BYTE puGetInternalDataCopy[sizeof(DD_GETINTERNALMOCOMPDATA)]; @NL
  4249. struct NT32_DD_GETINTERNALMOCOMPDATA *puGetInternalDataHostCopy; @NL
  4250. End=
  4251. PreCall=
  4252. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4253. if(ARGUMENT_PRESENT(puGetInternalDataHost)) { @Indent( @NL
  4254. puGetInternalData=(PDD_GETINTERNALMOCOMPDATA)puGetInternalDataCopy; @NL
  4255. puGetInternalDataHostCopy=(struct NT32_DD_GETINTERNALMOCOMPDATA *)puGetInternalDataHost; @NL
  4256. @ForceType(PreCall,puGetInternalData->lpDD,puGetInternalDataHostCopy->lpDD,LPVOID,IN)
  4257. @ForceType(PreCall,puGetInternalData->lpGuid,puGetInternalDataHostCopy->lpGuid,LPGUID,IN)
  4258. @ForceType(PreCall,puGetInternalData->dwWidth,puGetInternalDataHostCopy->dwWidth,DWORD,IN)
  4259. @ForceType(PreCall,puGetInternalData->dwHeight,puGetInternalDataHostCopy->dwHeight,DWORD,IN)
  4260. @ForceType(PreCall,puGetInternalData->ddPixelFormat,puGetInternalDataHostCopy->ddPixelFormat,DDPIXELFORMAT,IN)
  4261. @ForceType(PreCall,puGetInternalData->dwScratchMemAlloc,puGetInternalDataHostCopy->dwScratchMemAlloc,DWORD,IN)
  4262. @ForceType(PreCall,puGetInternalData->ddRVal,puGetInternalDataHostCopy->ddRVal,HRESULT,IN)
  4263. )} else { @Indent( @NL
  4264. puGetInternalData=NULL; @NL
  4265. )} @NL
  4266. End=
  4267. Begin=
  4268. @GenApiThunk(@ApiName)
  4269. End=
  4270. PostCall=
  4271. if(ARGUMENT_PRESENT(puGetInternalDataHost)) { @Indent( @NL
  4272. @ForceType(PostCall,puGetInternalData->dwWidth,puGetInternalDataHostCopy->dwWidth,DWORD,OUT)
  4273. @ForceType(PostCall,puGetInternalData->dwHeight,puGetInternalDataHostCopy->dwHeight,DWORD,OUT)
  4274. @ForceType(PostCall,puGetInternalData->ddPixelFormat,puGetInternalDataHostCopy->ddPixelFormat,DDPIXELFORMAT,OUT)
  4275. @ForceType(PostCall,puGetInternalData->dwScratchMemAlloc,puGetInternalDataHostCopy->dwScratchMemAlloc,DWORD,OUT)
  4276. @ForceType(PostCall,puGetInternalData->ddRVal,puGetInternalDataHostCopy->ddRVal,HRESULT,OUT)
  4277. )} @NL
  4278. End=
  4279. TemplateName=NtGdiDdGetMoCompBuffInfo
  4280. NoType=hDirectDraw
  4281. NoType=puGetBuffData
  4282. Locals=
  4283. BYTE puGetBuffDataCopy[sizeof(DD_GETMOCOMPCOMPBUFFDATA)]; @NL
  4284. struct NT32_DD_GETMOCOMPCOMPBUFFDATA *puGetBuffDataHostCopy; @NL
  4285. End=
  4286. PreCall=
  4287. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4288. if(ARGUMENT_PRESENT(puGetBuffDataHost)) { @Indent( @NL
  4289. puGetBuffData=(PDD_GETMOCOMPCOMPBUFFDATA)puGetBuffDataCopy; @NL
  4290. puGetBuffDataHostCopy=(struct NT32_DD_GETMOCOMPCOMPBUFFDATA *)puGetBuffDataHost; @NL
  4291. @ForceType(PreCall,puGetBuffData->lpDD,puGetBuffDataHostCopy->lpDD,LPVOID,IN)
  4292. @ForceType(PreCall,puGetBuffData->lpGuid,puGetBuffDataHostCopy->lpGuid,LPGUID,IN)
  4293. @ForceType(PreCall,puGetBuffData->dwWidth,puGetBuffDataHostCopy->dwWidth,DWORD,IN)
  4294. @ForceType(PreCall,puGetBuffData->dwHeight,puGetBuffDataHostCopy->dwHeight,DWORD,IN)
  4295. @ForceType(PreCall,puGetBuffData->ddPixelFormat,puGetBuffDataHostCopy->ddPixelFormat,DDPIXELFORMAT,IN)
  4296. @ForceType(PreCall,puGetBuffData->dwNumTypesCompBuffs,puGetBuffDataHostCopy->dwNumTypesCompBuffs,DWORD,IN)
  4297. @ForceType(PreCall,puGetBuffData->lpCompBuffInfo,puGetBuffDataHostCopy->lpCompBuffInfo,LPDDCOMPBUFFERINFO,IN)
  4298. @ForceType(PreCall,puGetBuffData->ddRVal,puGetBuffDataHostCopy->ddRVal,HRESULT,IN)
  4299. )} else { @Indent( @NL
  4300. puGetBuffData=NULL; @NL
  4301. )} @NL
  4302. End=
  4303. Begin=
  4304. @GenApiThunk(@ApiName)
  4305. End=
  4306. PostCall=
  4307. if(ARGUMENT_PRESENT(puGetBuffDataHost)) { @Indent( @NL
  4308. @ForceType(PostCall,puGetBuffData->dwWidth,puGetBuffDataHostCopy->dwWidth,DWORD,OUT)
  4309. @ForceType(PostCall,puGetBuffData->dwHeight,puGetBuffDataHostCopy->dwHeight,DWORD,OUT)
  4310. @ForceType(PostCall,puGetBuffData->ddPixelFormat,puGetBuffDataHostCopy->ddPixelFormat,DDPIXELFORMAT,OUT)
  4311. @ForceType(PostCall,puGetBuffData->dwNumTypesCompBuffs,puGetBuffDataHostCopy->dwNumTypesCompBuffs,DWORD,OUT)
  4312. @ForceType(PostCall,puGetBuffData->lpCompBuffInfo,puGetBuffDataHostCopy->lpCompBuffInfo,LPDDCOMPBUFFERINFO,OUT)
  4313. @ForceType(PostCall,puGetBuffData->ddRVal,puGetBuffDataHostCopy->ddRVal,HRESULT,OUT)
  4314. )} @NL
  4315. End=
  4316. TemplateName=NtGdiDdGetMoCompGuids
  4317. NoType=hDirectDraw
  4318. NoType=puGetMoCompGuidsData
  4319. Locals=
  4320. BYTE puGetMoCompGuidsDataCopy[sizeof(DD_GETMOCOMPGUIDSDATA)]; @NL
  4321. struct NT32_DD_GETMOCOMPGUIDSDATA *puGetMoCompGuidsDataHostCopy; @NL
  4322. End=
  4323. PreCall=
  4324. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4325. if(ARGUMENT_PRESENT(puGetMoCompGuidsDataHost)) { @Indent( @NL
  4326. puGetMoCompGuidsData=(PDD_GETMOCOMPGUIDSDATA)puGetMoCompGuidsDataCopy; @NL
  4327. puGetMoCompGuidsDataHostCopy=(struct NT32_DD_GETMOCOMPGUIDSDATA *)puGetMoCompGuidsDataHost; @NL
  4328. @ForceType(PreCall,puGetMoCompGuidsData->lpDD,puGetMoCompGuidsDataHostCopy->lpDD,LPVOID,IN)
  4329. @ForceType(PreCall,puGetMoCompGuidsData->dwNumGuids,puGetMoCompGuidsDataHostCopy->dwNumGuids,DWORD,IN)
  4330. @ForceType(PreCall,puGetMoCompGuidsData->lpGuids,puGetMoCompGuidsDataHostCopy->lpGuids,LPGUID,IN)
  4331. @ForceType(PreCall,puGetMoCompGuidsData->ddRVal,puGetMoCompGuidsDataHostCopy->ddRVal,HRESULT,IN)
  4332. )} else { @Indent( @NL
  4333. puGetMoCompGuidsData=NULL; @NL
  4334. )} @NL
  4335. End=
  4336. Begin=
  4337. @GenApiThunk(@ApiName)
  4338. End=
  4339. PostCall=
  4340. if(ARGUMENT_PRESENT(puGetMoCompGuidsDataHost)) { @Indent( @NL
  4341. @ForceType(PostCall,puGetMoCompGuidsData->dwNumGuids,puGetMoCompGuidsDataHostCopy->dwNumGuids,DWORD,OUT)
  4342. @ForceType(PostCall,puGetMoCompGuidsData->lpGuids,puGetMoCompGuidsDataHostCopy->lpGuids,LPGUID,OUT)
  4343. @ForceType(PostCall,puGetMoCompGuidsData->ddRVal,puGetMoCompGuidsDataHostCopy->ddRVal,HRESULT,OUT)
  4344. )} @NL
  4345. End=
  4346. TemplateName=NtGdiDdGetMoCompFormats
  4347. NoType=hDirectDraw
  4348. NoType=puGetMoCompFormatsData
  4349. Locals=
  4350. BYTE puGetMoCompFormatsDataCopy[sizeof(DD_GETMOCOMPFORMATSDATA)]; @NL
  4351. struct NT32_DD_GETMOCOMPFORMATSDATA *puGetMoCompFormatsDataHostCopy; @NL
  4352. End=
  4353. PreCall=
  4354. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4355. if(ARGUMENT_PRESENT(puGetMoCompFormatsDataHost)) { @Indent( @NL
  4356. puGetMoCompFormatsData=(PDD_GETMOCOMPFORMATSDATA)puGetMoCompFormatsDataCopy; @NL
  4357. puGetMoCompFormatsDataHostCopy=(struct NT32_DD_GETMOCOMPFORMATSDATA *)puGetMoCompFormatsDataHost; @NL
  4358. @ForceType(PreCall,puGetMoCompFormatsData->lpDD,puGetMoCompFormatsDataHostCopy->lpDD,LPVOID,IN)
  4359. @ForceType(PreCall,puGetMoCompFormatsData->lpGuid,puGetMoCompFormatsDataHostCopy->lpGuid,LPVOID,IN)
  4360. @ForceType(PreCall,puGetMoCompFormatsData->dwNumFormats,puGetMoCompFormatsDataHostCopy->dwNumFormats,DWORD,IN)
  4361. @ForceType(PreCall,puGetMoCompFormatsData->lpFormats,puGetMoCompFormatsDataHostCopy->lpFormats,LPDDPIXELFORMAT,IN)
  4362. @ForceType(PreCall,puGetMoCompFormatsData->ddRVal,puGetMoCompFormatsDataHostCopy->ddRVal,HRESULT,IN)
  4363. )} else { @Indent( @NL
  4364. puGetMoCompFormatsData=NULL; @NL
  4365. )} @NL
  4366. End=
  4367. Begin=
  4368. @GenApiThunk(@ApiName)
  4369. End=
  4370. PostCall=
  4371. if(ARGUMENT_PRESENT(puGetMoCompFormatsDataHost)) { @Indent( @NL
  4372. @ForceType(PostCall,puGetMoCompFormatsData->dwNumFormats,puGetMoCompFormatsDataHostCopy->dwNumFormats,DWORD,OUT)
  4373. @ForceType(PostCall,puGetMoCompFormatsData->lpFormats,puGetMoCompFormatsDataHostCopy->lpFormats,LPDDPIXELFORMAT,OUT)
  4374. @ForceType(PostCall,puGetMoCompFormatsData->ddRVal,puGetMoCompFormatsDataHostCopy->ddRVal,HRESULT,OUT)
  4375. )} @NL
  4376. End=
  4377. TemplateName=NtGdiDdGetScanLine
  4378. NoType=hDirectDraw
  4379. NoType=puGetScanLineData
  4380. Locals=
  4381. BYTE puGetScanLineDataCopy[sizeof(DD_GETSCANLINEDATA)]; @NL
  4382. struct NT32_DD_GETSCANLINEDATA *puGetScanLineDataHostCopy; @NL
  4383. End=
  4384. PreCall=
  4385. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4386. if(ARGUMENT_PRESENT(puGetScanLineDataHost)) { @Indent( @NL
  4387. puGetScanLineData=(PDD_GETSCANLINEDATA)puGetScanLineDataCopy; @NL
  4388. puGetScanLineDataHostCopy=(struct NT32_DD_GETSCANLINEDATA *)puGetScanLineDataHost; @NL
  4389. @ForceType(PreCall,puGetScanLineData->lpDD,puGetScanLineDataHostCopy->lpDD,LPVOID,IN)
  4390. @ForceType(PreCall,puGetScanLineData->dwScanLine,puGetScanLineDataHostCopy->dwScanLine,DWORD,IN)
  4391. @ForceType(PreCall,puGetScanLineData->ddRVal,puGetScanLineDataHostCopy->ddRVal,HRESULT,IN)
  4392. @ForceType(PreCall,puGetScanLineData->GetScanLine,puGetScanLineDataHostCopy->GetScanLine,LPVOID,IN)
  4393. )} else { @Indent( @NL
  4394. puGetScanLineData=NULL; @NL
  4395. )} @NL
  4396. End=
  4397. Begin=
  4398. @GenApiThunk(@ApiName)
  4399. End=
  4400. PostCall=
  4401. if(ARGUMENT_PRESENT(puGetScanLineDataHost)) { @Indent( @NL
  4402. @ForceType(PostCall,puGetScanLineData->dwScanLine,puGetScanLineDataHostCopy->dwScanLine,DWORD,OUT)
  4403. @ForceType(PostCall,puGetScanLineData->ddRVal,puGetScanLineDataHostCopy->ddRVal,HRESULT,OUT)
  4404. @ForceType(PostCall,puGetScanLineData->GetScanLine,puGetScanLineDataHostCopy->GetScanLine,LPVOID,OUT)
  4405. )} @NL
  4406. End=
  4407. TemplateName=NtGdiDdLock
  4408. NoType=hSurface
  4409. NoType=puLockData
  4410. Locals=
  4411. BYTE puLockDataCopy[sizeof(DD_LOCKDATA)]; @NL
  4412. struct NT32_DD_LOCKDATA *puLockDataHostCopy; @NL
  4413. puLockData=(PDD_LOCKDATA)puLockDataCopy; @NL
  4414. puLockDataHostCopy=(struct NT32_DD_LOCKDATA *)puLockDataHost; @NL
  4415. End=
  4416. PreCall=
  4417. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4418. if(ARGUMENT_PRESENT(puLockDataHost)) { @Indent( @NL
  4419. RtlZeroMemory(puLockDataCopy,sizeof(DD_LOCKDATA)); @NL
  4420. @ForceType(PreCall,puLockData->bHasRect,puLockDataHostCopy->bHasRect,DWORD,IN)
  4421. @ForceType(PreCall,puLockData->rArea,puLockDataHostCopy->rArea,RECTL,IN)
  4422. @ForceType(PreCall,puLockData->ddRVal,puLockDataHostCopy->ddRVal,HRESULT,IN)
  4423. @ForceType(PreCall,puLockData->dwFlags,puLockDataHostCopy->dwFlags,DWORD,IN)
  4424. )} @NL
  4425. End=
  4426. Begin=
  4427. @GenApiThunk(@ApiName)
  4428. End=
  4429. PostCall=
  4430. if(ARGUMENT_PRESENT(puLockDataHost)) { @Indent( @NL
  4431. @ForceType(PostCall,puLockData->lpSurfData,puLockDataHostCopy->lpSurfData,LPVOID,OUT)
  4432. @ForceType(PostCall,puLockData->ddRVal,puLockDataHostCopy->ddRVal,HRESULT,OUT)
  4433. )} @NL
  4434. End=
  4435. TemplateName=NtGdiDdLockD3D
  4436. NoType=hSurface
  4437. NoType=puLockData
  4438. Locals=
  4439. BYTE puLockDataCopy[sizeof(DD_LOCKDATA)]; @NL
  4440. struct NT32_DD_LOCKDATA *puLockDataHostCopy; @NL
  4441. puLockData=(PDD_LOCKDATA)puLockDataCopy; @NL
  4442. puLockDataHostCopy=(struct NT32_DD_LOCKDATA *)puLockDataHost; @NL
  4443. End=
  4444. PreCall=
  4445. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4446. if(ARGUMENT_PRESENT(puLockDataHost)) { @Indent( @NL
  4447. RtlZeroMemory(puLockDataCopy,sizeof(DD_LOCKDATA)); @NL
  4448. @ForceType(PreCall,puLockData->bHasRect,puLockDataHostCopy->bHasRect,DWORD,IN)
  4449. @ForceType(PreCall,puLockData->rArea,puLockDataHostCopy->rArea,RECTL,IN)
  4450. @ForceType(PreCall,puLockData->ddRVal,puLockDataHostCopy->ddRVal,HRESULT,IN)
  4451. @ForceType(PreCall,puLockData->dwFlags,puLockDataHostCopy->dwFlags,DWORD,IN)
  4452. )} @NL
  4453. End=
  4454. Begin=
  4455. @GenApiThunk(@ApiName)
  4456. End=
  4457. PostCall=
  4458. if(ARGUMENT_PRESENT(puLockDataHost)) { @Indent( @NL
  4459. @ForceType(PostCall,puLockData->lpSurfData,puLockDataHostCopy->lpSurfData,LPVOID,OUT)
  4460. @ForceType(PostCall,puLockData->ddRVal,puLockDataHostCopy->ddRVal,HRESULT,OUT)
  4461. )} @NL
  4462. End=
  4463. TemplateName=NtGdiDdQueryDirectDrawObject
  4464. NoType=_noname0
  4465. NoType=_noname4
  4466. NoType=_noname5
  4467. NoType=_noname6
  4468. NoType=_noname8
  4469. Locals=
  4470. BYTE _noname4Copy[sizeof(D3DNTHAL_GLOBALDRIVERDATA)]; @NL
  4471. BYTE _noname8Copy[sizeof(VIDEOMEMORY)]; @NL
  4472. BYTE temp[sizeof (DD_D3DBUFCALLBACKS)]; @NL
  4473. LPDDSURFACEDESC TextureFormats64 = NULL; @NL
  4474. DWORD TextureFormatsCount = 0; @NL
  4475. struct NT32_DDSURFACEDESC *TextureFormats32; @NL
  4476. struct NT32_D3DNTHAL_GLOBALDRIVERDATA *_noname4HostCopy; @NL
  4477. struct NT32_VIDEOMEMORY *_noname8HostCopy; @NL
  4478. DWORD i; @NL
  4479. End=
  4480. PreCall=
  4481. _noname0=(HANDLE)((unsigned)_noname0Host); @NL
  4482. if(ARGUMENT_PRESENT(_noname4Host)) { @Indent( @NL
  4483. _noname4=(LPD3DNTHAL_GLOBALDRIVERDATA)_noname4Copy; @NL
  4484. _noname4HostCopy=(struct NT32_D3DNTHAL_GLOBALDRIVERDATA *)_noname4Host; @NL
  4485. RtlZeroMemory(_noname4,sizeof(D3DNTHAL_GLOBALDRIVERDATA)); @NL
  4486. _noname4->dwSize=sizeof(D3DNTHAL_GLOBALDRIVERDATA); @NL
  4487. _noname4->dwNumTextureFormats=_noname4HostCopy->dwNumTextureFormats; @NL
  4488. )} else { @Indent( @NL
  4489. _noname4=NULL; @NL
  4490. )} @NL
  4491. _noname5 = (PDD_D3DBUFCALLBACKS)temp; @NL
  4492. _noname5->dwSize = sizeof (*_noname5); @NL
  4493. TextureFormats32 = (struct NT32_DDSURFACEDESC *)_noname6Host;@NL
  4494. @NL
  4495. if(ARGUMENT_PRESENT(TextureFormats32)) { @Indent( @NL
  4496. if(ARGUMENT_PRESENT(_noname4Host) && (_noname4HostCopy->dwNumTextureFormats>0)) { @Indent( @NL
  4497. TextureFormatsCount=_noname4HostCopy->dwNumTextureFormats; @NL
  4498. TextureFormats64=Wow64AllocateTemp(sizeof(DDSURFACEDESC)*TextureFormatsCount); @NL
  4499. if(NULL==TextureFormats64) { @Indent( @NL
  4500. TextureFormatsCount=0; @NL
  4501. )} @NL
  4502. )} @NL
  4503. )} @NL
  4504. @NL
  4505. _noname6 = TextureFormats64; @NL
  4506. @NL
  4507. _noname8=(VIDEOMEMORY *)_noname8Copy; @NL
  4508. _noname8HostCopy=(struct NT32_VIDEOMEMORY *)_noname8Host; @NL
  4509. End=
  4510. Begin=
  4511. #define _WIN32_API_
  4512. @GenApiThunk(@ApiName)
  4513. #undef _WIN32_API_
  4514. End=
  4515. PostCall=
  4516. if(ARGUMENT_PRESENT(_noname4Host)) { @Indent( @NL
  4517. _noname4HostCopy->dwSize=sizeof(struct NT32_D3DNTHAL_GLOBALDRIVERDATA); @NL
  4518. @ForceType(PostCall,_noname4->hwCaps,_noname4HostCopy->hwCaps,D3DNTHALDEVICEDESC_V1,OUT)
  4519. @ForceType(PostCall,_noname4->dwNumVertices,_noname4HostCopy->dwNumVertices,DWORD,OUT)
  4520. @ForceType(PostCall,_noname4->dwNumClipVertices,_noname4HostCopy->dwNumClipVertices,DWORD,OUT)
  4521. @ForceType(PostCall,_noname4->dwNumTextureFormats,_noname4HostCopy->dwNumTextureFormats,DWORD,OUT)
  4522. )} @NL
  4523. //@NL
  4524. // It would difficult to thunk where kernel returning some structure containing pointer to function.@NL
  4525. // And need to revisit this issue.@NL
  4526. //@NL
  4527. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->dwSize = _noname5->dwSize; @NL
  4528. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->dwFlags = _noname5->dwFlags; @NL
  4529. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->CanCreateD3DBuffer = (DWORD)_noname5->CanCreateD3DBuffer; @NL
  4530. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->CreateD3DBuffer = (DWORD)_noname5->CreateD3DBuffer; @NL
  4531. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->DestroyD3DBuffer = (DWORD)_noname5->DestroyD3DBuffer; @NL
  4532. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->LockD3DBuffer = (DWORD)_noname5->LockD3DBuffer; @NL
  4533. ((NT32DD_D3DBUFCALLBACKS *)_noname5Host)->UnlockD3DBuffer = (DWORD)_noname5->UnlockD3DBuffer; @NL
  4534. if (ARGUMENT_PRESENT (TextureFormats32) != 0) { @NL
  4535. @NL
  4536. for (i = 0 ; i < TextureFormatsCount ; i++) { @NL
  4537. @NL
  4538. @ForceType(PostCall,TextureFormats64,TextureFormats32,LPDDSURFACEDESC,OUT)
  4539. TextureFormats64++; @NL
  4540. TextureFormats32++; @NL
  4541. } @NL
  4542. } @NL
  4543. if(ARGUMENT_PRESENT(_noname8Host)) { @Indent( @NL
  4544. @ForceType(PostCall,_noname8->dwFlags,_noname8HostCopy->dwFlags,DWORD,OUT)
  4545. @ForceType(PostCall,_noname8->fpStart,_noname8HostCopy->fpStart,FLATPTR,OUT)
  4546. @ForceType(PostCall,_noname8->ddsCaps,_noname8HostCopy->ddsCaps,DDSCAPS,OUT)
  4547. @ForceType(PostCall,_noname8->ddsCapsAlt,_noname8HostCopy->ddsCapsAlt,DDSCAPS,OUT)
  4548. if( (_noname8->dwFlags & VIDMEM_ISRECTANGULAR) == VIDMEM_ISRECTANGULAR ) { @Indent( @NL
  4549. @ForceType(PostCall,_noname8->dwWidth,_noname8HostCopy->dwWidth,DWORD,OUT)
  4550. @ForceType(PostCall,_noname8->dwHeight,_noname8HostCopy->dwHeight,DWORD,OUT)
  4551. )} else { @Indent( @NL
  4552. @ForceType(PostCall,_noname8->fpEnd,_noname8HostCopy->fpEnd,FLATPTR,OUT)
  4553. @ForceType(PostCall,_noname8->lpHeap,_noname8HostCopy->lpHeap,LPVOID,OUT)
  4554. )} @NL
  4555. )} @NL
  4556. End=
  4557. TemplateName=NtGdiDdQueryMoCompStatus
  4558. Begin=
  4559. @GenUnsupportedNtApiThunk
  4560. End=
  4561. TemplateName=NtGdiDdReenableDirectDrawObject
  4562. NoType=hDirectDrawLocal
  4563. PreCall=
  4564. hDirectDrawLocal=(HANDLE)((unsigned)hDirectDrawLocalHost); @NL
  4565. Begin=
  4566. @GenApiThunk(@ApiName)
  4567. End=
  4568. TemplateName=NtGdiDdReleaseDC
  4569. NoType=hSurface
  4570. PreCall=
  4571. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4572. Begin=
  4573. @GenApiThunk(@ApiName)
  4574. End=
  4575. TemplateName=NtGdiDdRenderMoComp
  4576. Begin=
  4577. @GenUnsupportedNtApiThunk
  4578. End=
  4579. TemplateName=NtGdiDdResetVisrgn
  4580. NoType=hSurface
  4581. PreCall=
  4582. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4583. Begin=
  4584. @GenApiThunk(@ApiName)
  4585. End=
  4586. TemplateName=NtGdiDdResize
  4587. Begin=
  4588. @GenUnsupportedNtApiThunk
  4589. End=
  4590. TemplateName=NtGdiDdSetColorKey
  4591. NoType=hSurface
  4592. NoType=puSetColorKeyData
  4593. Locals=
  4594. BYTE puSetColorKeyDataCopy[sizeof(DD_SETCOLORKEYDATA)]; @NL
  4595. struct NT32_DD_SETCOLORKEYDATA *puSetColorKeyDataHostCopy; @NL
  4596. End=
  4597. PreCall=
  4598. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4599. if(ARGUMENT_PRESENT(puSetColorKeyDataHost)) { @Indent( @NL
  4600. puSetColorKeyData=(PDD_SETCOLORKEYDATA)puSetColorKeyDataCopy; @NL
  4601. puSetColorKeyDataHostCopy=(struct NT32_DD_SETCOLORKEYDATA *)puSetColorKeyDataHost; @NL
  4602. @ForceType(PreCall,puSetColorKeyData->lpDD,puSetColorKeyDataHostCopy->lpDD,LPVOID,IN)
  4603. @ForceType(PreCall,puSetColorKeyData->lpDDSurface,puSetColorKeyDataHostCopy->lpDDSurface,LPVOID,IN)
  4604. @ForceType(PreCall,puSetColorKeyData->dwFlags,puSetColorKeyDataHostCopy->dwFlags,DWORD,IN)
  4605. @ForceType(PreCall,puSetColorKeyData->ckNew,puSetColorKeyDataHostCopy->ckNew,DDCOLORKEY,IN)
  4606. @ForceType(PreCall,puSetColorKeyData->ddRVal,puSetColorKeyDataHostCopy->ddRVal,HRESULT,IN)
  4607. @ForceType(PreCall,puSetColorKeyData->SetColorKey,puSetColorKeyDataHostCopy->SetColorKey,LPVOID,IN)
  4608. )} else { @Indent( @NL
  4609. puSetColorKeyData=NULL; @NL
  4610. )} @NL
  4611. End=
  4612. Begin=
  4613. @GenApiThunk(@ApiName)
  4614. End=
  4615. PostCall=
  4616. if(ARGUMENT_PRESENT(puSetColorKeyDataHost)) { @Indent( @NL
  4617. @ForceType(PostCall,puSetColorKeyData->ddRVal,puSetColorKeyDataHostCopy->ddRVal,HRESULT,OUT)
  4618. )} @NL
  4619. End=
  4620. TemplateName=NtGdiDdSetExclusiveMode
  4621. NoType=hDirectDraw
  4622. NoType=puSetExclusiveModeData
  4623. Locals=
  4624. BYTE puSetExclusiveModeDataCopy[sizeof(DD_SETEXCLUSIVEMODEDATA)]; @NL
  4625. struct NT32_DD_SETEXCLUSIVEMODEDATA *puSetExclusiveModeDataHostCopy; @NL
  4626. End=
  4627. PreCall=
  4628. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4629. if(ARGUMENT_PRESENT(puSetExclusiveModeDataHost)) { @Indent( @NL
  4630. puSetExclusiveModeData=(PDD_SETEXCLUSIVEMODEDATA)puSetExclusiveModeDataCopy; @NL
  4631. puSetExclusiveModeDataHostCopy=(struct NT32_DD_SETEXCLUSIVEMODEDATA *)puSetExclusiveModeDataHost; @NL
  4632. @ForceType(PreCall,puSetExclusiveModeData->lpDD,puSetExclusiveModeDataHostCopy->lpDD,LPVOID,IN)
  4633. @ForceType(PreCall,puSetExclusiveModeData->dwEnterExcl,puSetExclusiveModeDataHostCopy->dwEnterExcl,DWORD,IN)
  4634. @ForceType(PreCall,puSetExclusiveModeData->dwReserved,puSetExclusiveModeDataHostCopy->dwReserved,DWORD,IN)
  4635. @ForceType(PreCall,puSetExclusiveModeData->ddRVal,puSetExclusiveModeDataHostCopy->ddRVal,HRESULT,IN)
  4636. @ForceType(PreCall,puSetExclusiveModeData->SetExclusiveMode,puSetExclusiveModeDataHostCopy->SetExclusiveMode,LPVOID,IN)
  4637. )} else { @Indent( @NL
  4638. puSetExclusiveModeData=NULL;
  4639. )} @NL
  4640. End=
  4641. Begin=
  4642. @GenApiThunk(@ApiName)
  4643. End=
  4644. PostCall=
  4645. @ForceType(PostCall,puSetExclusiveModeData->ddRVal,puSetExclusiveModeDataHostCopy->ddRVal,HRESULT,OUT)
  4646. @ForceType(PostCall,puSetExclusiveModeData->SetExclusiveMode,puSetExclusiveModeDataHostCopy->SetExclusiveMode,LPVOID,OUT)
  4647. End=
  4648. TemplateName=NtGdiDdSetGammaRamp
  4649. NoType=hDirectDraw
  4650. PreCall=
  4651. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4652. Begin=
  4653. @GenApiThunk(@ApiName)
  4654. End=
  4655. TemplateName=NtGdiDdSetOverlayPosition
  4656. NoType=hSurfaceSource
  4657. NoType=hSurfaceDestination
  4658. NoType=puSetOverlayPositionData
  4659. Locals=
  4660. BYTE puSetOverlayPositionDataCopy[sizeof(DD_SETOVERLAYPOSITIONDATA)]; @NL
  4661. struct NT32_DD_SETOVERLAYPOSITIONDATA *puSetOverlayPositionDataHostCopy; @NL
  4662. End=
  4663. PreCall=
  4664. hSurfaceSource=(HANDLE)((unsigned)hSurfaceSourceHost); @NL
  4665. hSurfaceDestination=(HANDLE)((unsigned)hSurfaceDestinationHost); @NL
  4666. if(ARGUMENT_PRESENT(puSetOverlayPositionDataHost)) { @Indent( @NL
  4667. puSetOverlayPositionData=(PDD_SETOVERLAYPOSITIONDATA)puSetOverlayPositionDataCopy; @NL
  4668. puSetOverlayPositionDataHostCopy=(struct NT32_DD_SETOVERLAYPOSITIONDATA *)puSetOverlayPositionDataHost; @NL
  4669. @ForceType(PreCall,puSetOverlayPositionData->lpDD,puSetOverlayPositionDataHostCopy->lpDD,LPVOID,IN)
  4670. @ForceType(PreCall,puSetOverlayPositionData->lpDDSrcSurface,puSetOverlayPositionDataHostCopy->lpDDSrcSurface,LPVOID,IN)
  4671. @ForceType(PreCall,puSetOverlayPositionData->lpDDDestSurface,puSetOverlayPositionDataHostCopy->lpDDDestSurface,LPVOID,IN)
  4672. @ForceType(PreCall,puSetOverlayPositionData->lXPos,puSetOverlayPositionDataHostCopy->lXPos,LONG,IN)
  4673. @ForceType(PreCall,puSetOverlayPositionData->lYPos,puSetOverlayPositionDataHostCopy->lYPos,LONG,IN)
  4674. @ForceType(PreCall,puSetOverlayPositionData->ddRVal,puSetOverlayPositionDataHostCopy->ddRVal,HRESULT,IN)
  4675. @ForceType(PreCall,puSetOverlayPositionData->SetOverlayPosition,puSetOverlayPositionDataHostCopy->SetOverlayPosition,LPVOID,IN)
  4676. )} else { @Indent( @NL
  4677. puSetOverlayPositionData=NULL; @NL
  4678. )} @NL
  4679. End=
  4680. Begin=
  4681. @GenApiThunk(@ApiName)
  4682. End=
  4683. PostCall=
  4684. if(ARGUMENT_PRESENT(puSetOverlayPositionDataHost)) { @Indent( @NL
  4685. @ForceType(PostCall,puSetOverlayPositionData->ddRVal,puSetOverlayPositionDataHostCopy->ddRVal,HRESULT,OUT)
  4686. )} @NL
  4687. End=
  4688. TemplateName=NtGdiDdSetSpriteDisplayList
  4689. Begin=
  4690. @GenUnsupportedNtApiThunk
  4691. End=
  4692. TemplateName=NtGdiDdUnattachSurface
  4693. NoType=hSurface
  4694. NoType=hSurfaceAttached
  4695. PreCall=
  4696. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4697. hSurfaceAttached=(HANDLE)((unsigned)hSurfaceAttachedHost); @NL
  4698. Begin=
  4699. @GenApiThunk(@ApiName)
  4700. End=
  4701. TemplateName=NtGdiDdUnlock
  4702. NoType=hSurface
  4703. NoType=puUnlockData
  4704. Locals=
  4705. BYTE puUnlockDataCopy[sizeof(DD_UNLOCKDATA)]; @NL
  4706. struct NT32_DD_UNLOCKDATA *puUnlockDataHostCopy; @NL
  4707. puUnlockData=(PDD_UNLOCKDATA)puUnlockDataCopy; @NL
  4708. puUnlockDataHostCopy=(struct NT32_DD_UNLOCKDATA *)puUnlockDataHost; @NL
  4709. End=
  4710. PreCall=
  4711. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4712. if(ARGUMENT_PRESENT(puUnlockDataHost)) { @Indent( @NL
  4713. RtlZeroMemory(puUnlockDataCopy,sizeof(DD_UNLOCKDATA)); @NL
  4714. @ForceType(PreCall,puUnlockData->ddRVal,puUnlockDataHostCopy->ddRVal,HRESULT,IN)
  4715. )} @NL
  4716. End=
  4717. Begin=
  4718. @GenApiThunk(@ApiName)
  4719. End=
  4720. PostCall=
  4721. @ForceType(PostCall,puUnlockData->ddRVal,puUnlockDataHostCopy->ddRVal,HRESULT,OUT)
  4722. End=
  4723. TemplateName=NtGdiDdUnlockD3D
  4724. NoType=hSurface
  4725. NoType=puUnlockData
  4726. Locals=
  4727. BYTE puUnlockDataCopy[sizeof(DD_UNLOCKDATA)]; @NL
  4728. struct NT32_DD_UNLOCKDATA *puUnlockDataHostCopy; @NL
  4729. puUnlockData=(PDD_UNLOCKDATA)puUnlockDataCopy; @NL
  4730. puUnlockDataHostCopy=(struct NT32_DD_UNLOCKDATA *)puUnlockDataHost; @NL
  4731. End=
  4732. PreCall=
  4733. hSurface=(HANDLE)((unsigned)hSurfaceHost); @NL
  4734. if(ARGUMENT_PRESENT(puUnlockDataHost)) { @Indent( @NL
  4735. RtlZeroMemory(puUnlockDataCopy,sizeof(DD_UNLOCKDATA)); @NL
  4736. @ForceType(PreCall,puUnlockData->ddRVal,puUnlockDataHostCopy->ddRVal,HRESULT,IN)
  4737. )} @NL
  4738. End=
  4739. Begin=
  4740. @GenApiThunk(@ApiName)
  4741. End=
  4742. PostCall=
  4743. @ForceType(PostCall,puUnlockData->ddRVal,puUnlockDataHostCopy->ddRVal,HRESULT,OUT)
  4744. End=
  4745. TemplateName=NtGdiDdUpdateOverlay
  4746. NoType=hSurfaceDestination
  4747. NoType=hSurfaceSource
  4748. NoType=puUpdateOverlayData
  4749. Locals=
  4750. BYTE puUpdateOverlayDataCopy[sizeof(DD_UPDATEOVERLAYDATA)]; @NL
  4751. struct NT32_DD_UPDATEOVERLAYDATA *puUpdateOverlayDataHostCopy; @NL
  4752. End=
  4753. PreCall=
  4754. hSurfaceDestination=(HANDLE)((unsigned)hSurfaceDestinationHost); @NL
  4755. hSurfaceSource=(HANDLE)((unsigned)hSurfaceSourceHost); @NL
  4756. if(ARGUMENT_PRESENT(puUpdateOverlayDataHost)) { @Indent( @NL
  4757. puUpdateOverlayData=(PDD_UPDATEOVERLAYDATA)puUpdateOverlayDataCopy; @NL
  4758. puUpdateOverlayDataHostCopy=(struct NT32_DD_UPDATEOVERLAYDATA *)puUpdateOverlayDataHost; @NL
  4759. @ForceType(PreCall,puUpdateOverlayData->lpDD,puUpdateOverlayDataHostCopy->lpDD,LPVOID,IN)
  4760. @ForceType(PreCall,puUpdateOverlayData->rDest,puUpdateOverlayDataHostCopy->rDest,RECTL,IN)
  4761. @ForceType(PreCall,puUpdateOverlayData->rSrc,puUpdateOverlayDataHostCopy->rSrc,RECTL,IN)
  4762. @ForceType(PreCall,puUpdateOverlayData->dwFlags,puUpdateOverlayDataHostCopy->dwFlags,DWORD,IN)
  4763. @ForceType(PreCall,puUpdateOverlayData->overlayFX,puUpdateOverlayDataHostCopy->overlayFX,DDOVERLAYFX,IN)
  4764. @ForceType(PreCall,puUpdateOverlayData->ddRVal,puUpdateOverlayDataHostCopy->ddRVal,HRESULT,IN)
  4765. @ForceType(PreCall,puUpdateOverlayData->UpdateOverlay,puUpdateOverlayDataHostCopy->UpdateOverlay,LPVOID,IN)
  4766. if(WOW64_ISPTR(puUpdateOverlayDataHostCopy->lpDDDestSurface)) { @Indent( @NL
  4767. Wow64GdiDdThunkSurfaceLocalPreCall(&(puUpdateOverlayData->lpDDDestSurface),(struct NT32_DD_SURFACE_LOCAL *)(puUpdateOverlayDataHostCopy->lpDDDestSurface),1); @NL
  4768. )} else { @Indent( @NL
  4769. puUpdateOverlayData->lpDDDestSurface=NULL; @NL
  4770. )} @NL
  4771. if(WOW64_ISPTR(puUpdateOverlayDataHostCopy->lpDDSrcSurface)) { @Indent( @NL
  4772. Wow64GdiDdThunkSurfaceLocalPreCall(&(puUpdateOverlayData->lpDDSrcSurface),(struct NT32_DD_SURFACE_LOCAL *)(puUpdateOverlayDataHostCopy->lpDDSrcSurface),1); @NL
  4773. )} else { @Indent( @NL
  4774. puUpdateOverlayData->lpDDDestSurface=NULL; @NL
  4775. )} @NL
  4776. )} else { @Indent( @NL
  4777. puUpdateOverlayData=NULL; @NL
  4778. )} @NL
  4779. End=
  4780. Begin=
  4781. @GenApiThunk(@ApiName)
  4782. End=
  4783. PostCall=
  4784. if(ARGUMENT_PRESENT(puUpdateOverlayDataHost)) { @Indent( @NL
  4785. @ForceType(PostCall,puUpdateOverlayData->ddRVal,puUpdateOverlayDataHostCopy->ddRVal,HRESULT,OUT)
  4786. )} @NL
  4787. End=
  4788. TemplateName=NtGdiDdWaitForVerticalBlank
  4789. NoType=hDirectDraw
  4790. NoType=puWaitForVerticalBlankData
  4791. Locals=
  4792. BYTE puWaitForVerticalBlankDataCopy[sizeof(DD_WAITFORVERTICALBLANKDATA)]; @NL
  4793. struct NT32_DD_WAITFORVERTICALBLANKDATA *puWaitForVerticalBlankDataHostCopy; @NL
  4794. puWaitForVerticalBlankData=(PDD_WAITFORVERTICALBLANKDATA)puWaitForVerticalBlankDataCopy; @NL
  4795. puWaitForVerticalBlankDataHostCopy=(struct NT32_DD_WAITFORVERTICALBLANKDATA *)puWaitForVerticalBlankDataHost; @NL
  4796. End=
  4797. PreCall=
  4798. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4799. if(ARGUMENT_PRESENT(puWaitForVerticalBlankDataHost)) { @Indent( @NL
  4800. puWaitForVerticalBlankData->lpDD=NULL; @NL
  4801. @ForceType(PreCall,puWaitForVerticalBlankData->dwFlags,puWaitForVerticalBlankDataHostCopy->dwFlags,DWORD,IN)
  4802. @ForceType(PreCall,puWaitForVerticalBlankData->bIsInVB,puWaitForVerticalBlankDataHostCopy->bIsInVB,DWORD,IN)
  4803. @ForceType(PreCall,puWaitForVerticalBlankData->hEvent,puWaitForVerticalBlankDataHostCopy->hEvent,DWORD,IN)
  4804. @ForceType(PreCall,puWaitForVerticalBlankData->ddRVal,puWaitForVerticalBlankDataHostCopy->ddRVal,HRESULT,IN)
  4805. @ForceType(PreCall,puWaitForVerticalBlankData->WaitForVerticalBlank,puWaitForVerticalBlankDataHostCopy->WaitForVerticalBlank,LPVOID,IN)
  4806. )} else { @Indent( @NL
  4807. puWaitForVerticalBlankData=NULL; @NL
  4808. )} @NL
  4809. End=
  4810. Begin=
  4811. @GenApiThunk(@ApiName)
  4812. End=
  4813. PostCall=
  4814. @ForceType(PostCall,puWaitForVerticalBlankData->dwFlags,puWaitForVerticalBlankDataHostCopy->dwFlags,DWORD,OUT)
  4815. @ForceType(PostCall,puWaitForVerticalBlankData->bIsInVB,puWaitForVerticalBlankDataHostCopy->bIsInVB,DWORD,OUT)
  4816. @ForceType(PostCall,puWaitForVerticalBlankData->hEvent,puWaitForVerticalBlankDataHostCopy->hEvent,DWORD,OUT)
  4817. @ForceType(PostCall,puWaitForVerticalBlankData->ddRVal,puWaitForVerticalBlankDataHostCopy->ddRVal,HRESULT,OUT)
  4818. @ForceType(PostCall,puWaitForVerticalBlankData->WaitForVerticalBlank,puWaitForVerticalBlankDataHostCopy->WaitForVerticalBlank,LPVOID,OUT)
  4819. End=
  4820. TemplateName=NtGdiDvpCanCreateVideoPort
  4821. NoType=hDirectDraw
  4822. NoType=puCanCreateVPortData
  4823. Locals=
  4824. BYTE puCanCreateVPortDataCopy[sizeof(DD_CANCREATEVPORTDATA)]; @NL
  4825. struct NT32_DD_CANCREATEVPORTDATA *puCanCreateVPortDataHostCopy; @NL
  4826. @ForceType(Locals,puCanCreateVPortData->lpDDVideoPortDesc,puCanCreateVPortDataHostCopy->lpDDVideoPortDesc,LPDDVIDEOPORTDESC,IN)
  4827. End=
  4828. PreCall=
  4829. hDirectDraw=(HANDLE)((unsigned)hDirectDrawHost); @NL
  4830. if(ARGUMENT_PRESENT(puCanCreateVPortDataHost)) { @Indent( @NL
  4831. puCanCreateVPortData=(PDD_CANCREATEVPORTDATA)puCanCreateVPortDataCopy; @NL
  4832. puCanCreateVPortDataHostCopy=(struct NT32_DD_CANCREATEVPORTDATA *)puCanCreateVPortDataHost; @NL
  4833. @ForceType(PreCall,puCanCreateVPortData->lpDD,puCanCreateVPortDataHostCopy->lpDD,LPVOID,IN)
  4834. @ForceType(PreCall,puCanCreateVPortData->lpDDVideoPortDesc,puCanCreateVPortDataHostCopy->lpDDVideoPortDesc,LPDDVIDEOPORTDESC,IN)
  4835. @ForceType(PreCall,puCanCreateVPortData->ddRVal,puCanCreateVPortDataHostCopy->ddRVal,HRESULT,IN)
  4836. @ForceType(PreCall,puCanCreateVPortData->CanCreateVideoPort,puCanCreateVPortDataHostCopy->CanCreateVideoPort,LPVOID,IN)
  4837. )} else { @Indent( @NL
  4838. puCanCreateVPortData=NULL; @NL
  4839. )} @NL
  4840. End=
  4841. Begin=
  4842. @GenApiThunk(@ApiName)
  4843. End=
  4844. PostCall=
  4845. @ForceType(PostCall,puCanCreateVPortData->lpDDVideoPortDesc,puCanCreateVPortDataHostCopy->lpDDVideoPortDesc,LPDDVIDEOPORTDESC,OUT)
  4846. @ForceType(PostCall,puCanCreateVPortData->ddRVal,puCanCreateVPortDataHostCopy->ddRVal,HRESULT,OUT)
  4847. End=
  4848. TemplateName=NtGdiDvpColorControl
  4849. Begin=
  4850. @GenUnsupportedNtApiThunk
  4851. End=
  4852. TemplateName=NtGdiDvpCreateVideoPort
  4853. Begin=
  4854. @GenUnsupportedNtApiThunk
  4855. End=
  4856. TemplateName=NtGdiDvpDestroyVideoPort
  4857. Begin=
  4858. @GenUnsupportedNtApiThunk
  4859. End=
  4860. TemplateName=NtGdiDvpFlipVideoPort
  4861. Begin=
  4862. @GenUnsupportedNtApiThunk
  4863. End=
  4864. TemplateName=NtGdiDvpGetVideoPortBandwidth
  4865. Begin=
  4866. @GenUnsupportedNtApiThunk
  4867. End=
  4868. TemplateName=NtGdiDvpGetVideoPortField
  4869. Begin=
  4870. @GenUnsupportedNtApiThunk
  4871. End=
  4872. TemplateName=NtGdiDvpGetVideoPortFlipStatus
  4873. Begin=
  4874. @GenUnsupportedNtApiThunk
  4875. End=
  4876. TemplateName=NtGdiDvpGetVideoPortInputFormats
  4877. Begin=
  4878. @GenUnsupportedNtApiThunk
  4879. End=
  4880. TemplateName=NtGdiDvpGetVideoPortLine
  4881. Begin=
  4882. @GenUnsupportedNtApiThunk
  4883. End=
  4884. TemplateName=NtGdiDvpGetVideoPortOutputFormats
  4885. Begin=
  4886. @GenUnsupportedNtApiThunk
  4887. End=
  4888. TemplateName=NtGdiDvpGetVideoPortConnectInfo
  4889. Begin=
  4890. @GenUnsupportedNtApiThunk
  4891. End=
  4892. TemplateName=NtGdiDvpGetVideoSignalStatus
  4893. Begin=
  4894. @GenUnsupportedNtApiThunk
  4895. End=
  4896. TemplateName=NtGdiDvpUpdateVideoPort
  4897. Begin=
  4898. @GenUnsupportedNtApiThunk
  4899. End=
  4900. TemplateName=NtGdiDvpWaitForVideoPortSync
  4901. Begin=
  4902. @GenUnsupportedNtApiThunk
  4903. End=
  4904. TemplateName=NtGdiDvpAcquireNotification
  4905. Begin=
  4906. @GenUnsupportedNtApiThunk
  4907. End=
  4908. TemplateName=NtGdiDvpReleaseNotification
  4909. Begin=
  4910. @GenUnsupportedNtApiThunk
  4911. End=
  4912. TemplateName=NtGdiAlphaBlend
  4913. Begin=
  4914. @GenApiThunk(@ApiName)
  4915. End=
  4916. TemplateName=NtGdiGradientFill
  4917. Begin=
  4918. @GenApiThunk(@ApiName)
  4919. End=
  4920. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4921. ;;
  4922. ;; These functions are only called from device drivers
  4923. ;;
  4924. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  4925. TemplateName=NtGdiEngCreateBitmap
  4926. Begin=
  4927. @GenUnsupportedNtApiThunk
  4928. End=
  4929. TemplateName=NtGdiEngCreateDeviceSurface
  4930. Begin=
  4931. @GenUnsupportedNtApiThunk
  4932. End=
  4933. TemplateName=NtGdiEngCreateDeviceBitmap
  4934. Begin=
  4935. @GenUnsupportedNtApiThunk
  4936. End=
  4937. TemplateName=NtGdiEngCreatePalette
  4938. Begin=
  4939. @GenUnsupportedNtApiThunk
  4940. End=
  4941. TemplateName=NtGdiEngComputeGlyphSet
  4942. Begin=
  4943. @GenUnsupportedNtApiThunk
  4944. End=
  4945. TemplateName=NtGdiEngCopyBits
  4946. Begin=
  4947. @GenUnsupportedNtApiThunk
  4948. End=
  4949. TemplateName=NtGdiEngDeletePalette
  4950. Begin=
  4951. @GenUnsupportedNtApiThunk
  4952. End=
  4953. TemplateName=NtGdiEngDeleteSurface
  4954. Begin=
  4955. @GenUnsupportedNtApiThunk
  4956. End=
  4957. TemplateName=NtGdiEngEraseSurface
  4958. Begin=
  4959. @GenUnsupportedNtApiThunk
  4960. End=
  4961. TemplateName=NtGdiEngUnlockSurface
  4962. Begin=
  4963. @GenUnsupportedNtApiThunk
  4964. End=
  4965. TemplateName=NtGdiEngLockSurface
  4966. Begin=
  4967. @GenUnsupportedNtApiThunk
  4968. End=
  4969. TemplateName=NtGdiEngBitBlt
  4970. Begin=
  4971. @GenUnsupportedNtApiThunk
  4972. End=
  4973. TemplateName=NtGdiEngStretchBlt
  4974. Begin=
  4975. @GenUnsupportedNtApiThunk
  4976. End=
  4977. TemplateName=NtGdiEngPlgBlt
  4978. Begin=
  4979. @GenUnsupportedNtApiThunk
  4980. End=
  4981. TemplateName=NtGdiEngMarkBandingSurface
  4982. Begin=
  4983. @GenUnsupportedNtApiThunk
  4984. End=
  4985. TemplateName=NtGdiEngStrokePath
  4986. Begin=
  4987. @GenUnsupportedNtApiThunk
  4988. End=
  4989. TemplateName=NtGdiEngFillPath
  4990. Begin=
  4991. @GenUnsupportedNtApiThunk
  4992. End=
  4993. TemplateName=NtGdiEngStrokeAndFillPath
  4994. Begin=
  4995. @GenUnsupportedNtApiThunk
  4996. End=
  4997. TemplateName=NtGdiEngPaint
  4998. Begin=
  4999. @GenUnsupportedNtApiThunk
  5000. End=
  5001. TemplateName=NtGdiEngLineTo
  5002. Begin=
  5003. @GenUnsupportedNtApiThunk
  5004. End=
  5005. TemplateName=NtGdiEngAlphaBlend
  5006. Begin=
  5007. @GenUnsupportedNtApiThunk
  5008. End=
  5009. TemplateName=NtGdiEngGradientFill
  5010. Begin=
  5011. @GenUnsupportedNtApiThunk
  5012. End=
  5013. TemplateName=NtGdiEngTransparentBlt
  5014. Begin=
  5015. @GenUnsupportedNtApiThunk
  5016. End=
  5017. TemplateName=NtGdiEngTextOut
  5018. Begin=
  5019. @GenUnsupportedNtApiThunk
  5020. End=
  5021. TemplateName=NtGdiEngStretchBltROP
  5022. Begin=
  5023. @GenUnsupportedNtApiThunk
  5024. End=
  5025. TemplateName=NtGdiEngDeletePath
  5026. Begin=
  5027. @GenUnsupportedNtApiThunk
  5028. End=
  5029. TemplateName=NtGdiEngCreateClip
  5030. Begin=
  5031. @GenUnsupportedNtApiThunk
  5032. End=
  5033. TemplateName=NtGdiEngDeleteClip
  5034. Begin=
  5035. @GenUnsupportedNtApiThunk
  5036. End=
  5037. TemplateName=NtGdiEngCheckAbort
  5038. Begin=
  5039. @GenUnsupportedNtApiThunk
  5040. End=
  5041. TemplateName=NtGdiXLATEOBJ_cGetPalette
  5042. Begin=
  5043. @GenUnsupportedNtApiThunk
  5044. End=
  5045. TemplateName=NtGdiXLATEOBJ_iXlate
  5046. Begin=
  5047. @GenUnsupportedNtApiThunk
  5048. End=
  5049. TemplateName=NtGdiXLATEOBJ_hGetColorTransform
  5050. Begin=
  5051. @GenUnsupportedNtApiThunk
  5052. End=
  5053. TemplateName=NtGdiCLIPOBJ_bEnum
  5054. Begin=
  5055. @GenUnsupportedNtApiThunk
  5056. End=
  5057. TemplateName=NtGdiCLIPOBJ_cEnumStart
  5058. Begin=
  5059. @GenUnsupportedNtApiThunk
  5060. End=
  5061. TemplateName=NtGdiCLIPOBJ_ppoGetPath
  5062. Begin=
  5063. @GenUnsupportedNtApiThunk
  5064. End=
  5065. TemplateName=NtGdiBRUSHOBJ_ulGetBrushColor
  5066. Begin=
  5067. @GenUnsupportedNtApiThunk
  5068. End=
  5069. TemplateName=NtGdiBRUSHOBJ_pvAllocRbrush
  5070. Begin=
  5071. @GenUnsupportedNtApiThunk
  5072. End=
  5073. TemplateName=NtGdiBRUSHOBJ_pvGetRbrush
  5074. Begin=
  5075. @GenUnsupportedNtApiThunk
  5076. End=
  5077. TemplateName=NtGdiBRUSHOBJ_hGetColorTransform
  5078. Begin=
  5079. @GenUnsupportedNtApiThunk
  5080. End=
  5081. TemplateName=NtGdiXFORMOBJ_bApplyXform
  5082. Begin=
  5083. @GenUnsupportedNtApiThunk
  5084. End=
  5085. TemplateName=NtGdiXFORMOBJ_iGetXform
  5086. Begin=
  5087. @GenUnsupportedNtApiThunk
  5088. End=
  5089. TemplateName=NtGdiFONTOBJ_vGetInfo
  5090. Begin=
  5091. @GenUnsupportedNtApiThunk
  5092. End=
  5093. TemplateName=NtGdiFONTOBJ_pxoGetXform
  5094. Begin=
  5095. @GenUnsupportedNtApiThunk
  5096. End=
  5097. TemplateName=NtGdiFONTOBJ_cGetGlyphs
  5098. Begin=
  5099. @GenUnsupportedNtApiThunk
  5100. End=
  5101. TemplateName=NtGdiFONTOBJ_pifi
  5102. Begin=
  5103. @GenUnsupportedNtApiThunk
  5104. End=
  5105. TemplateName=NtGdiFONTOBJ_pfdg
  5106. Begin=
  5107. @GenUnsupportedNtApiThunk
  5108. End=
  5109. TemplateName=NtGdiFONTOBJ_pQueryGlyphAttrs
  5110. Begin=
  5111. @GenUnsupportedNtApiThunk
  5112. End=
  5113. TemplateName=NtGdiFONTOBJ_pvTrueTypeFontFile
  5114. Begin=
  5115. @GenUnsupportedNtApiThunk
  5116. End=
  5117. TemplateName=NtGdiFONTOBJ_cGetAllGlyphHandles
  5118. Begin=
  5119. @GenUnsupportedNtApiThunk
  5120. End=
  5121. TemplateName=NtGdiSTROBJ_bEnum
  5122. Begin=
  5123. @GenUnsupportedNtApiThunk
  5124. End=
  5125. TemplateName=NtGdiSTROBJ_bEnumPositionsOnly
  5126. Begin=
  5127. @GenUnsupportedNtApiThunk
  5128. End=
  5129. TemplateName=NtGdiSTROBJ_bGetAdvanceWidths
  5130. Begin=
  5131. @GenUnsupportedNtApiThunk
  5132. End=
  5133. TemplateName=NtGdiSTROBJ_vEnumStart
  5134. Begin=
  5135. @GenUnsupportedNtApiThunk
  5136. End=
  5137. TemplateName=NtGdiSTROBJ_dwGetCodePage
  5138. Begin=
  5139. @GenUnsupportedNtApiThunk
  5140. End=
  5141. TemplateName=NtGdiPATHOBJ_vGetBounds
  5142. Begin=
  5143. @GenUnsupportedNtApiThunk
  5144. End=
  5145. TemplateName=NtGdiPATHOBJ_bEnum
  5146. Begin=
  5147. @GenUnsupportedNtApiThunk
  5148. End=
  5149. TemplateName=NtGdiPATHOBJ_vEnumStart
  5150. Begin=
  5151. @GenUnsupportedNtApiThunk
  5152. End=
  5153. TemplateName=NtGdiPATHOBJ_vEnumStartClipLines
  5154. Begin=
  5155. @GenUnsupportedNtApiThunk
  5156. End=
  5157. TemplateName=NtGdiPATHOBJ_bEnumClipLines
  5158. Begin=
  5159. @GenUnsupportedNtApiThunk
  5160. End=
  5161. [Code]
  5162. TemplateName=whwin32
  5163. CGenBegin=
  5164. @NoFormat(
  5165. /*
  5166. * genthunk generated code: Do Not Modify
  5167. * Thunks for console functions.
  5168. *
  5169. */
  5170. #include "whwin32p.h"
  5171. #include <wow.h>
  5172. ASSERTNAME;
  5173. #pragma warning(disable : 4311) //Disable pointer truncation warning
  5174. #pragma warning(disable : 4242) //Truncation warning
  5175. #pragma warning(disable : 4244) //Truncation warning
  5176. #if defined(WOW64DOPROFILE)
  5177. #define APIPROFILE(apinum) (ptewhwin32[(apinum)].HitCount++)
  5178. #else
  5179. #define APIPROFILE(apinum)
  5180. #endif
  5181. #if defined(WOW64DOPROFILE)
  5182. WOW64SERVICE_PROFILE_TABLE_ELEMENT ptewhwin32[];
  5183. #endif
  5184. )
  5185. #if defined(WOW64DOPROFILE) @NL
  5186. @ApiList(#define @ApiName_PROFILE_SUBLIST NULL @NL)
  5187. #endif @NL
  5188. @NoFormat(
  5189. #if DBG
  5190. // Log api calls for simple user functions.
  5191. #define USER_LOG_SIMPLE(apinum) \
  5192. if((apinum) >= ulMaxSimpleCall) { \
  5193. WOWASSERTMSG(FALSE, "Unknown simple api called.\n"); \
  5194. RtlRaiseStatus(STATUS_INVALID_PARAMETER); \
  5195. } \
  5196. LOGPRINT((TRACELOG, "Calling simple user function %s\n", apszSimpleCallNames[(apinum)]));
  5197. #else
  5198. // Log api calls for simple user functions.
  5199. #define USER_LOG_SIMPLE(apinum)
  5200. #endif
  5201. #if defined(WOW64DOPROFILE)
  5202. #define USER_PROFILE_SIMPLE(apinum) \
  5203. if (apinum < ulMaxSimpleCall) { \
  5204. SimpleCallProfileElements[apinum].HitCount++; \
  5205. } \
  5206. #else
  5207. #define USER_PROFILE_SIMPLE(apinum)
  5208. #endif
  5209. // WM_SYSTIMER messages have a kernel mode proc address
  5210. // stuffed in the lParam. Forunately the address will
  5211. // allways be in win32k.sys so the hi bits will be the same
  5212. // for all kprocs. On the first WM_SYSTIMER message
  5213. DWORD gdwWM_SYSTIMERProcHiBits;
  5214. // These functions must be used with extreme care since the LPARAM
  5215. // and WPARAM are not fully thunked. They are ment for cases where the
  5216. // the messsage can't have a pointer to another structure or the kernel
  5217. // does not really look at the message.
  5218. PMSG Wow64ShallowThunkMSG32TO64(PMSG pMsg64, NT32MSG *pMsg32) {
  5219. if (ARGUMENT_PRESENT(pMsg32)) {
  5220. pMsg64->hwnd = (HWND)pMsg32->hwnd;
  5221. pMsg64->message = pMsg32->message;
  5222. pMsg64->wParam = (WPARAM)pMsg32->wParam;
  5223. pMsg64->lParam = (LPARAM)pMsg32->lParam;
  5224. pMsg64->time = pMsg32->time;
  5225. pMsg64->pt.x = pMsg32->pt.x;
  5226. pMsg64->pt.y = pMsg32->pt.y;
  5227. if (WM_SYSTIMER == pMsg32->message && pMsg32->lParam != 0) {
  5228. WOWASSERT(gdwWM_SYSTIMERProcHiBits != 0); @NL
  5229. pMsg64->lParam = (LPARAM)(((UINT64)gdwWM_SYSTIMERProcHiBits << 32) | (UINT64)(UINT)pMsg32->lParam);
  5230. }
  5231. return pMsg64;
  5232. }
  5233. return NULL;
  5234. }
  5235. NT32MSG *Wow64ShallowThunkMSG64TO32(NT32MSG *pMsg32, PMSG pMsg64) {
  5236. if (ARGUMENT_PRESENT(pMsg64)) {
  5237. pMsg32->hwnd = (NT32HWND)pMsg64->hwnd;
  5238. pMsg32->message = pMsg64->message;
  5239. pMsg32->wParam = (NT32WPARAM)pMsg64->wParam;
  5240. pMsg32->lParam = (NT32LPARAM)pMsg64->lParam;
  5241. pMsg32->time = pMsg64->time;
  5242. pMsg32->pt.x = pMsg64->pt.x;
  5243. pMsg32->pt.y = pMsg64->pt.y;
  5244. if (pMsg64->message == WM_SYSTIMER && pMsg64->lParam != 0) {
  5245. if (gdwWM_SYSTIMERProcHiBits == 0) {
  5246. gdwWM_SYSTIMERProcHiBits = (DWORD) (pMsg64->lParam >> 32);
  5247. }
  5248. WOWASSERT(gdwWM_SYSTIMERProcHiBits == (DWORD) (pMsg64->lParam >> 32));
  5249. WOWASSERT(pMsg32->lParam != 0);
  5250. }
  5251. return pMsg32;
  5252. }
  5253. return NULL;
  5254. }
  5255. PEVENTMSG Wow64ShallowThunkEVENTMSG32TO64(PEVENTMSG pMsg64, NT32EVENTMSG *pMsg32) {
  5256. if (ARGUMENT_PRESENT(pMsg32)) {
  5257. pMsg64->message = pMsg32->message;
  5258. pMsg64->paramL = pMsg32->paramL;
  5259. pMsg64->paramH = pMsg32->paramH;
  5260. pMsg64->time = pMsg32->time;
  5261. pMsg64->hwnd = (HWND)pMsg32->hwnd;
  5262. return pMsg64;
  5263. }
  5264. return NULL;
  5265. }
  5266. NT32EVENTMSG *Wow64ShallowThunkEVENTMSG64TO32(NT32EVENTMSG *pMsg32, PEVENTMSG pMsg64) {
  5267. if (ARGUMENT_PRESENT(pMsg64)) {
  5268. pMsg32->message = pMsg64->message;
  5269. pMsg32->paramL = pMsg64->paramL;
  5270. pMsg32->paramH = pMsg64->paramH;
  5271. pMsg32->time = pMsg64->time;
  5272. pMsg32->hwnd = (NT32HWND)pMsg64->hwnd;
  5273. return pMsg32;
  5274. }
  5275. return NULL;
  5276. }
  5277. LPHELPINFO Wow64ShallowAllocThunkHELPINFO32TO64(NT32HELPINFO *pHelp32) {
  5278. LPHELPINFO pHelp64;
  5279. if (!ARGUMENT_PRESENT(pHelp32)) {
  5280. return (LPHELPINFO)pHelp32;
  5281. }
  5282. // Do not handle the case where the cbSize is less then the header.
  5283. // The kernel will either throw an exception or grab bad data in this case.
  5284. if (pHelp32->cbSize < sizeof(NT32HELPINFO)) {
  5285. LOGPRINT((ERRORLOG, "Wow64ShallowAllocThunkHELPINFO32TO64 pHelp32->cbSize:%x < sizeof(NT32HELPINFO):%x\n",
  5286. pHelp32->cbSize, sizeof(NT32HELPINFO)));
  5287. RtlRaiseStatus(STATUS_INVALID_PARAMETER);
  5288. }
  5289. pHelp64 = Wow64AllocateTemp(pHelp32->cbSize + sizeof(HELPINFO) - sizeof(NT32HELPINFO));
  5290. // Thunk the header and then copy the data after the header. We can only assume it
  5291. // is pointer independent.
  5292. pHelp64->cbSize = pHelp32->cbSize + sizeof(HELPINFO) - sizeof(NT32HELPINFO);
  5293. pHelp64->iContextType = pHelp32->iContextType;
  5294. pHelp64->iCtrlId = pHelp32->iCtrlId;
  5295. pHelp64->hItemHandle = (HANDLE)pHelp32->hItemHandle;
  5296. pHelp64->dwContextId = (DWORD_PTR)pHelp32->dwContextId;
  5297. RtlCopyMemory(&pHelp64->MousePos, &pHelp32->MousePos, sizeof(POINT));
  5298. //Copy the remainder of the structure.
  5299. RtlCopyMemory(((PBYTE)pHelp64) + sizeof(HELPINFO),
  5300. ((PBYTE)pHelp32) + sizeof(NT32HELPINFO),
  5301. pHelp32->cbSize - sizeof(NT32HELPINFO));
  5302. return pHelp64;
  5303. }
  5304. NT32HELPINFO *Wow64ShallowAllocThunkHELPINFO64TO32(LPHELPINFO pHelp64) {
  5305. NT32HELPINFO *pHelp32;
  5306. if (!ARGUMENT_PRESENT(pHelp64)) {
  5307. return (NT32HELPINFO *)pHelp64;
  5308. }
  5309. // Do not handle the case where the cbSize is less then the header.
  5310. if (pHelp64->cbSize < sizeof(HELPINFO)) {
  5311. LOGPRINT((ERRORLOG, "Wow64ShallowAllocThunkHELPINFO64TO32 pHelp64->cbSize:%x < sizeof(HELPINFO):%x\n",
  5312. pHelp64->cbSize, sizeof(HELPINFO)));
  5313. RtlRaiseStatus(STATUS_INVALID_PARAMETER);
  5314. }
  5315. pHelp32 = Wow64AllocateTemp(pHelp64->cbSize - sizeof(HELPINFO) + sizeof(NT32HELPINFO));
  5316. // Thunk the header and then copy the data after the header. We can only assume it
  5317. // is pointer independent.
  5318. pHelp32->cbSize = pHelp64->cbSize - sizeof(HELPINFO) + sizeof(NT32HELPINFO);
  5319. pHelp32->iContextType = pHelp64->iContextType;
  5320. pHelp32->iCtrlId = pHelp64->iCtrlId;
  5321. pHelp32->hItemHandle = (NT32HANDLE)pHelp64->hItemHandle;
  5322. pHelp32->dwContextId = (DWORD_PTR)pHelp64->dwContextId;
  5323. RtlCopyMemory(&pHelp32->MousePos, &pHelp64->MousePos, sizeof(POINT));
  5324. //Copy the remainder of the structure.
  5325. RtlCopyMemory(((PBYTE)pHelp32) + sizeof(NT32HELPINFO),
  5326. ((PBYTE)pHelp64) + sizeof(HELPINFO),
  5327. pHelp64->cbSize - sizeof(HELPINFO));
  5328. return pHelp32;
  5329. }
  5330. /* The HLP struct is defined as follows:
  5331. typedef struct {
  5332. WORD cbData; Size of data
  5333. WORD usCommand; Command to execute
  5334. ULONG_PTR ulTopic; Topic/context number (if needed)
  5335. DWORD ulReserved; Reserved (internal use)
  5336. WORD offszHelpFile; Offset to help file in block
  5337. WORD offabData; Offset to other data in block
  5338. } HLP, *LPHLP;
  5339. This structure is followed but a HelpFile string at an offset of offszHelpFile
  5340. and either a second string or a structure at offabData. The two structure that
  5341. can follow are either a MULTIKEYHELP or a HELPWININFO. Neither one is pointer dependent.
  5342. */
  5343. LPHLP Wow64ShallowAllocThunkHLP32TO64(NT32HLP *pHlp32) {
  5344. LPHLP pHlp64;
  5345. CONST WORD SizeDelta = sizeof(HLP) - sizeof(NT32HLP); // Diff 64 - 32.
  5346. if (!ARGUMENT_PRESENT(pHlp32)) {
  5347. return (LPHLP)pHlp32;
  5348. }
  5349. if (pHlp32->cbData < sizeof(NT32HLP)) {
  5350. LOGPRINT((ERRORLOG, "Wow64ShallowAllocThunkHLP32TO64 pHlp32->cbData:%x < sizeof(NT32HLP):%x\n",
  5351. pHlp32->cbData, sizeof(NT32HLP)));
  5352. RtlRaiseStatus(STATUS_INVALID_PARAMETER);
  5353. }
  5354. pHlp64 = Wow64AllocateTemp(pHlp32->cbData + SizeDelta);
  5355. // Copy the header then adjust the offsets.
  5356. pHlp64->cbData = pHlp32->cbData + SizeDelta;
  5357. pHlp64->usCommand = pHlp32->usCommand;
  5358. pHlp64->ulTopic = (ULONG_PTR)pHlp32->ulTopic;
  5359. pHlp64->ulReserved = pHlp32->ulReserved;
  5360. pHlp64->offszHelpFile = pHlp32->offszHelpFile ? pHlp32->offszHelpFile + SizeDelta : 0;
  5361. pHlp64->offabData = pHlp32->offabData ? pHlp32->offabData + SizeDelta : 0;
  5362. // Copy the remaining structures.
  5363. RtlCopyMemory(((PBYTE)pHlp64) + sizeof(HLP),
  5364. ((PBYTE)pHlp32) + sizeof(NT32HLP),
  5365. pHlp32->cbData - sizeof(NT32HLP));
  5366. return pHlp64;
  5367. }
  5368. NT32HLP *Wow64ShallowAllocThunkHLP64TO32(LPHLP pHlp64) {
  5369. NT32HLP *pHlp32;
  5370. CONST WORD SizeDelta = sizeof(HLP) - sizeof(NT32HLP); // Diff 64 - 32.
  5371. if (!ARGUMENT_PRESENT(pHlp64)) {
  5372. return (NT32HLP *)pHlp64;
  5373. }
  5374. if (pHlp64->cbData < sizeof(HLP)) {
  5375. LOGPRINT((ERRORLOG, "Wow64ShallowAllocThunkHLP64TO32 pHlp64->cbData:%x < sizeof(HLP):%x\n",
  5376. pHlp64->cbData, sizeof(HLP)));
  5377. RtlRaiseStatus(STATUS_INVALID_PARAMETER);
  5378. }
  5379. pHlp32 = Wow64AllocateTemp(pHlp64->cbData - SizeDelta);
  5380. // Copy the header then adjust the offsets.
  5381. pHlp32->cbData = pHlp64->cbData - SizeDelta;
  5382. pHlp32->usCommand = pHlp64->usCommand;
  5383. pHlp32->ulTopic = (ULONG_PTR)pHlp64->ulTopic;
  5384. pHlp32->ulReserved = pHlp64->ulReserved;
  5385. pHlp32->offszHelpFile = pHlp64->offszHelpFile ? pHlp64->offszHelpFile - SizeDelta : 0;
  5386. pHlp32->offabData = pHlp64->offabData ? pHlp64->offabData - SizeDelta : 0;
  5387. // Copy the remaining structures.
  5388. RtlCopyMemory(((PBYTE)pHlp32) + sizeof(NT32HLP),
  5389. ((PBYTE)pHlp64) + sizeof(HLP),
  5390. pHlp64->cbData - sizeof(HLP));
  5391. return pHlp32;
  5392. }
  5393. /*
  5394. * These two sets of function pointer arrays
  5395. * are used to map what the kernel thinks
  5396. * addresses in user32.dll are and what the real
  5397. * addresses are in user32.dll.
  5398. *
  5399. * We grab the Kernel's view of things from
  5400. * CsrClientConnect() called from user32 DLL_PROCESS_ATTACH
  5401. *
  5402. * We grab the Client's view of things from
  5403. * NtUserInitializeClientPfnArrays()
  5404. */
  5405. const PFNCLIENT * apfnClientAKernel;
  5406. const PFNCLIENT * apfnClientWKernel;
  5407. const PFNCLIENTWORKER *apfnClientWorkerKernel;
  5408. const PFNCLIENT * apfnClientAClient;
  5409. const PFNCLIENT * apfnClientWClient;
  5410. const PFNCLIENTWORKER *apfnClientWorkerClient;
  5411. PSERVERINFO gpsi;
  5412. SHAREDINFO gSharedInfo;
  5413. VOID
  5414. NtWow64UserConnectHook(
  5415. PVOID ConnectionInformation,
  5416. PULONG ConnectionInformationLength
  5417. )
  5418. /*
  5419. * This grabs the ClientPFNArrays that the kernel has
  5420. * stored from the CsrClientConnect() call done by user32.dll's
  5421. * DLL_PROCESS_ATTACH.
  5422. */
  5423. {
  5424. WOWASSERT(*ConnectionInformationLength == sizeof(USERCONNECT));
  5425. gSharedInfo = ((USERCONNECT*)ConnectionInformation)->siClient;
  5426. gpsi = gSharedInfo.psi;
  5427. apfnClientAKernel = &gpsi->apfnClientA;
  5428. apfnClientWKernel = &gpsi->apfnClientW;
  5429. apfnClientWorkerKernel = &gpsi->apfnClientWorker;
  5430. }
  5431. #define Wow64GetClientInfo() ((PCLIENTINFO)((NtCurrentTeb())->Win32ClientInfo))
  5432. #define WOW64DESKTOPVALIDATE(pci, pobj) \
  5433. if ( pci->pDeskInfo && \
  5434. pobj >= pci->pDeskInfo->pvDesktopBase && \
  5435. pobj < pci->pDeskInfo->pvDesktopLimit) { \
  5436. pobj = (PVOID)((ULONG_PTR)pobj - pci->ulClientDelta); \
  5437. } else { \
  5438. pobj = (PVOID)NtUserCallOneParam((ULONG_PTR)h, \
  5439. SFI__MAPDESKTOPOBJECT); \
  5440. } \
  5441. #define ClientSharedInfo() (&gSharedInfo)
  5442. #define ServerInfo() (gpsi)
  5443. PWND Wow64ValidateHwnd(HWND h) {
  5444. PCLIENTINFO pci;
  5445. PVOID pobj = NULL;
  5446. pci = Wow64GetClientInfo();
  5447. StartValidateHandleMacro(h)
  5448. BeginTypeValidateHandleMacro(pobj, TYPE_WINDOW)
  5449. WOW64DESKTOPVALIDATE(pci, pobj)
  5450. EndTypeValidateHandleMacro
  5451. EndValidateHandleMacro
  5452. if (!pobj) {
  5453. NtCurrentTeb()->LastErrorValue = ERROR_INVALID_WINDOW_HANDLE;
  5454. LOGPRINT((ERRORLOG, "Wow64ValidateHwnd: %p is an invalid handle\n", h));
  5455. }
  5456. return pobj;
  5457. }
  5458. PROC
  5459. NtWow64MapClientFnToKernelClientFn(
  5460. PROC proc
  5461. )
  5462. {
  5463. PROC *pp;
  5464. for (pp = (PROC*)apfnClientAClient; pp < (PROC*) (apfnClientAClient+1); pp ++) {
  5465. if (proc == *pp) {
  5466. LOGPRINT((TRACELOG, "NtWow64MapClientFnToKernelClientFn: mapping A from %p to %p\n", proc, ((PROC*) apfnClientAKernel) [ (pp - (PROC*)apfnClientAClient) ]));
  5467. return ((PROC*) apfnClientAKernel) [ (pp - (PROC*)apfnClientAClient) ];
  5468. }
  5469. }
  5470. for (pp = (PROC*)apfnClientWClient; pp < (PROC*) (apfnClientWClient+1); pp ++) {
  5471. if (proc == *pp) {
  5472. LOGPRINT((TRACELOG, "NtWow64MapClientFnToKernelClientFn: mapping W from %p to %p\n", proc, ((PROC*) apfnClientWKernel) [ (pp - (PROC*)apfnClientWClient) ]));
  5473. return ((PROC*) apfnClientWKernel) [ (pp - (PROC*)apfnClientWClient) ];
  5474. }
  5475. }
  5476. for (pp = (PROC*)apfnClientWorkerClient; pp < (PROC*) (apfnClientWorkerClient+1); pp ++) {
  5477. if (proc == *pp) {
  5478. LOGPRINT((TRACELOG, "NtWow64MapClientFnToKernelClientFn: mapping Worker from %p to %p\n", proc, ((PROC*) apfnClientWorkerKernel) [ (pp - (PROC*)apfnClientWorkerClient) ]));
  5479. return ((PROC*) apfnClientWorkerKernel) [ (pp - (PROC*)apfnClientWorkerClient) ];
  5480. }
  5481. }
  5482. return (PROC)proc;
  5483. }
  5484. _int32
  5485. NtWow64MapKernelClientFnToClientFn(
  5486. PROC kproc
  5487. )
  5488. {
  5489. PROC *pp;
  5490. for (pp = (PROC*)apfnClientAKernel; pp < (PROC*) (apfnClientAKernel+1); pp ++) {
  5491. if (kproc == *pp) {
  5492. LOGPRINT((TRACELOG, "NtWow64MapKernelClientFnToClientFn: mapping A from %p to %x\n", kproc, (_int32)((PROC*) apfnClientAClient) [ (pp - (PROC*)apfnClientAKernel) ]));
  5493. return (_int32)((PROC*) apfnClientAClient) [ (pp - (PROC*)apfnClientAKernel) ];
  5494. }
  5495. }
  5496. for (pp = (PROC*)apfnClientWKernel; pp < (PROC*) (apfnClientWKernel+1); pp ++) {
  5497. if (kproc == *pp) {
  5498. LOGPRINT((TRACELOG, "NtWow64MapKernelClientFnToClientFn: mapping W from %p to %x\n", kproc, (_int32)((PROC*) apfnClientWClient) [ (pp - (PROC*)apfnClientWKernel) ]));
  5499. return (_int32)((PROC*) apfnClientWClient) [ (pp - (PROC*)apfnClientWKernel) ];
  5500. }
  5501. }
  5502. for (pp = (PROC*)apfnClientWorkerKernel; pp < (PROC*) (apfnClientWorkerKernel+1); pp ++) {
  5503. if (kproc == *pp) {
  5504. LOGPRINT((TRACELOG, "NtWow64MapKernelClientFnToClientFn: mapping Worker from %p to %x\n", kproc, (_int32)((PROC*) apfnClientWorkerClient) [ (pp - (PROC*)apfnClientWorkerKernel) ]));
  5505. return (_int32)((PROC*) apfnClientWorkerClient) [ (pp - (PROC*)apfnClientWorkerKernel) ];
  5506. }
  5507. }
  5508. return (_int32)kproc;
  5509. }
  5510. )
  5511. @Template(Thunks)
  5512. @NL
  5513. // Each of the WIN32 NT APIs has different return values for error cases. @NL
  5514. // Since no standard exists, a case list is needed.
  5515. @NL
  5516. // Not used. @NL
  5517. #define WOW64_DEFAULT_ERROR_ACTION ApiErrorNTSTATUS @NL
  5518. @NL
  5519. // This parameter is unused. @NL
  5520. #define WOW64_DEFAULT_ERROR_PARAM 0 @NL
  5521. @NL
  5522. // A case list is needed for these APIs. @NL
  5523. extern WOW64_SERVICE_ERROR_CASE sdwhwin32ErrorCase[]; @NL
  5524. #define WOW64_API_ERROR_CASES sdwhwin32ErrorCase @NL
  5525. @NL
  5526. @GenDispatchTable(sdwhwin32)
  5527. @NL
  5528. #if defined(WOW64DOPROFILE) @NL
  5529. @NL
  5530. WOW64SERVICE_PROFILE_TABLE_ELEMENT ptewhwin32[] = { @Indent( @NL
  5531. @ApiList({L"@ApiName", 0, @ApiName_PROFILE_SUBLIST, TRUE}, @NL)
  5532. {NULL, 0, NULL, FALSE} //For debugging @NL
  5533. )};@NL
  5534. @NL
  5535. @NL
  5536. WOW64SERVICE_PROFILE_TABLE ptwhwin32 = {L"WHWIN32", L"Win32k Function Thunks", ptewhwin32,
  5537. (sizeof(ptewhwin32)/sizeof(WOW64SERVICE_PROFILE_TABLE_ELEMENT))-1}; @NL
  5538. @NL
  5539. #endif @NL
  5540. CGenEnd=