Source code of Windows XP (NT5)
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.

1548 lines
52 KiB

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;
  3. ;; Copyright (c) 1998-2001 Microsoft Corporation
  4. ;;
  5. ;; Module Name:
  6. ;;
  7. ;; whnt32t.tpl
  8. ;;
  9. ;; Abstract:
  10. ;;
  11. ;; This template defines the type templates for the NT api set.
  12. ;;
  13. ;; Author:
  14. ;;
  15. ;; 2-DEC-98 mzoran
  16. ;;
  17. ;; Revision History:
  18. ;;
  19. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  20. [Types]
  21. ;; This code needs to be coordinated with the code for the ASYNCHRONOUS IO APIs.
  22. ;; Since this structure can be asynchronously written by the kernel, this structure
  23. ;; will sometimes be thunked in the kernel. In the cases where this block will be thunked
  24. ;; in the kernel, the thunk will set ArgName to be equal to ArgHostName after the precall
  25. ;; section of this type.
  26. TemplateName=PIO_STATUS_BLOCK
  27. IndLevel=0
  28. Direction=OUT
  29. Locals=
  30. // Note: @ArgName(@ArgType) is an OUT PIO_STATUS_BLOCK @NL
  31. IO_STATUS_BLOCK @ArgValCopy; @NL
  32. @NL
  33. End=
  34. PreCall=
  35. // Note: @ArgName(@ArgType) is an OUT PIO_STATUS_BLOCK @NL
  36. if (ARGUMENT_PRESENT(@ArgHostName)) { @NL
  37. @Indent(
  38. @ArgName = (@ArgType)&@ArgValCopy; @NL
  39. try {
  40. @ArgName->Status = (NTSTATUS)((NT32IO_STATUS_BLOCK *)(@ArgHostName))->Status; @NL
  41. @ArgName->Information = (ULONG_PTR)((NT32IO_STATUS_BLOCK *)(@ArgHostName))->Information; @NL
  42. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  43. return GetExceptionCode (); @NL
  44. } @NL
  45. )
  46. } @NL
  47. else { @NL
  48. @Indent(
  49. @ArgName = (PIO_STATUS_BLOCK)@ArgHostName; @NL
  50. ) @NL
  51. } @NL
  52. End=
  53. PostCall=
  54. // Note: @ArgName(@ArgType) is an OUT PIO_STATUS_BLOCK @NL
  55. if (@ArgName != (PIO_STATUS_BLOCK)@ArgHostName) { @Indent( @NL
  56. try { @NL
  57. ((NT32IO_STATUS_BLOCK *)(@ArgHostName))->Status = (NT32NTSTATUS)@ArgName->Status; @NL
  58. ((NT32IO_STATUS_BLOCK *)(@ArgHostName))->Information = (NT32ULONG_PTR)@ArgName->Information; @NL
  59. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  60. return GetExceptionCode (); @NL
  61. } @NL
  62. )
  63. } @NL
  64. End=
  65. TemplateName=PFILE_SEGMENT_ELEMENT
  66. IndLevel=0
  67. Direction=IN
  68. Locals=
  69. // Nothing to do for PFILE_SEGMENT_ELEMENT @NL
  70. End=
  71. PreCall=
  72. @ArgName = (PFILE_SEGMENT_ELEMENT)@ArgHostName; @NL
  73. End=
  74. PostCall=
  75. // Nothing to do for PFILE_SEGMENT_ELEMENT @NL
  76. End=
  77. TemplateName=PFILE_SEGMENT_ELEMENT
  78. IndLevel=0
  79. Direction=OUT
  80. Locals=
  81. // Nothing to do for PFILE_SEGMENT_ELEMENT @NL
  82. End=
  83. PreCall=
  84. @ArgName = (PFILE_SEGMENT_ELEMENT)@ArgHostName; @NL
  85. End=
  86. PostCall=
  87. // Nothing to do for PFILE_SEGMENT_ELEMENT @NL
  88. End=
  89. TemplateName=PSYSTEM_MEMORY_INFORMATION
  90. IndLevel=0
  91. Direction=OUT
  92. AllocSize=
  93. // Note: @ArgName(@ArgType) is a PSYSTEM_MEMORY_INFORMATION. @NL
  94. AllocSize += LENGTH; @NL
  95. End=
  96. RetSize=
  97. // Note: @ArgName(@ArgType) is a PSYSTEM_MEMORY_INFORMATION. @NL
  98. { @NL @Indent(
  99. // Walk the datastructure determining the required memory size @NL
  100. PSYSTEM_MEMORY_INFORMATION MemInfo; @NL
  101. PSYSTEM_MEMORY_INFO Info; @NL
  102. PSYSTEM_MEMORY_INFO InfoEnd; @NL
  103. SIZE_T c; @NL
  104. @NL
  105. MemInfo = @ArgName; @NL
  106. Info = &MemInfo->Memory[0]; @NL
  107. InfoEnd = (PSYSTEM_MEMORY_INFO)MemInfo->StringStart; @NL
  108. RetInfoLen += sizeof(NT32SYSTEM_MEMORY_INFORMATION); @NL
  109. @NL
  110. c = 0;@NL
  111. while(Info < InfoEnd) { @NL @Indent(
  112. c++; @NL
  113. if (NULL != Info->StringOffset) { @NL @Indent(
  114. // This is the hack that everyone uses to distinguish between UNICODE and ANSI @NL
  115. if (*(PUCHAR)(Info->StringOffset + 1) != 0) { @Indent( @NL
  116. RetInfoLen += wcslen((WCHAR*)Info->StringOffset) + sizeof(UNICODE_NULL); @NL
  117. )} @NL
  118. else { @Indent( @NL
  119. RetInfoLen += strlen(Info->StringOffset) + 1; @NL
  120. )} @NL
  121. )}@NL
  122. Info++;
  123. )}@NL
  124. RetInfoLen += sizeof(NT32SYSTEM_MEMORY_INFO) * c;@NL
  125. )}@NL
  126. @NL
  127. End=
  128. PreCall=
  129. // Error: This should not be called with this type. @NL
  130. End=
  131. PostCall=
  132. // Note: @ArgName(@ArgType) is a PSYSTEM_MEMORY_INFORMATION. @NL
  133. { @NL @Indent(
  134. // Copy the structures first, them copy the strings. @NL
  135. PSYSTEM_MEMORY_INFORMATION MemInfo; @NL
  136. PSYSTEM_MEMORY_INFO Info; @NL
  137. PSYSTEM_MEMORY_INFO InfoEnd; @NL
  138. NT32SYSTEM_MEMORY_INFORMATION *MemInfoDest; @NL
  139. NT32SYSTEM_MEMORY_INFO *InfoDest; @NL
  140. PUCHAR pStringDest; @NL
  141. SIZE_T c; @NL
  142. @NL
  143. MemInfo = @ArgName; @NL
  144. MemInfoDest = (NT32SYSTEM_MEMORY_INFORMATION *)@ArgHostName; @NL
  145. Info = &MemInfo->Memory[0]; @NL
  146. InfoEnd = (PSYSTEM_MEMORY_INFO)MemInfo->StringStart; @NL
  147. InfoDest = (NT32SYSTEM_MEMORY_INFO *)(&MemInfoDest->Memory[0]);@NL
  148. @NL
  149. while(Info < InfoEnd) { @NL @Indent(
  150. @ForceType(PostCall,Info,InfoDest,PSYSTEM_MEMORY_INFO,OUT)
  151. Info++; @NL
  152. InfoDest++; @NL
  153. )} @NL
  154. pStringDest = (PUCHAR)InfoDest; @NL
  155. MemInfoDest->StringStart = (NT32ULONG)pStringDest; @NL
  156. MemInfoDest->InfoSize = (NT32ULONG)RetInfoLen; @NL
  157. Info = &MemInfo->Memory[0]; @NL
  158. InfoDest = (NT32SYSTEM_MEMORY_INFO *)(&MemInfoDest->Memory[0]);@NL
  159. @NL
  160. while(Info < InfoEnd) { @NL @Indent(
  161. if (Info->StringOffset) { @Indent( @NL
  162. // This is the hack that everyone uses to distinguish between UNICODE and ANSI @NL
  163. if (*(PUCHAR)(Info->StringOffset + 1) != 0) { @Indent( @NL
  164. c = wcslen((WCHAR*)Info->StringOffset) + sizeof(UNICODE_NULL); @NL
  165. )} @NL
  166. else { @Indent( @NL
  167. c = strlen(Info->StringOffset) + 1; @NL
  168. )} @NL
  169. RtlCopyMemory(pStringDest, Info->StringOffset, c); @NL
  170. InfoDest->StringOffset = (NT32PUCHAR)pStringDest; @NL
  171. pStringDest += c; @NL
  172. )} @NL
  173. else { @Indent( @NL
  174. InfoDest->StringOffset = (NT32PUCHAR)NULL; @NL
  175. )} @NL
  176. )}@NL
  177. )}@NL
  178. End=
  179. TemplateName=PSYSTEM_HANDLE_INFORMATION
  180. IndLevel=0
  181. Direction=OUT
  182. AllocSize=
  183. // Note: @ArgName(@ArgType) is a PSYSTEM_HANDLE_INFORMATION. @NL
  184. AllocSize += LENGTH; @NL
  185. End=
  186. RetSize=
  187. // Note: @ArgName(@ArgType) is a PSYSTEM_HANDLE_INFORMATION. @NL
  188. { @NL @Indent(
  189. // Walk the datastructure determining the required memory size @NL
  190. PSYSTEM_HANDLE_INFORMATION HandleInfo; @NL
  191. @NL
  192. HandleInfo = @ArgName; @NL
  193. RetInfoLen += sizeof(NT32SYSTEM_HANDLE_TABLE_ENTRY_INFO) * HandleInfo->NumberOfHandles;@NL
  194. )}@NL
  195. @NL
  196. End=
  197. PreCall=
  198. // Error: This should not be called with this type. @NL
  199. End=
  200. PostCall=
  201. // Note: @ArgName(@ArgType) is a PSYSTEM_HANDLE_INFORMATION. @NL
  202. { @NL @Indent(
  203. // Copy the structures. @NL
  204. PSYSTEM_HANDLE_INFORMATION HandleInfo; @NL
  205. PSYSTEM_HANDLE_TABLE_ENTRY_INFO HandleInfoEntry; @NL
  206. NT32SYSTEM_HANDLE_INFORMATION *HandleInfoDest; @NL
  207. NT32SYSTEM_HANDLE_TABLE_ENTRY_INFO *HandleInfoEntryDest; @NL
  208. @NL
  209. HandleInfo = @ArgName; @NL
  210. HandleInfoDest = (NT32SYSTEM_HANDLE_INFORMATION *)@ArgHostName; @NL
  211. HandleInfoDest->NumberOfHandles = HandleInfo->NumberOfHandles;
  212. @NL
  213. HandleInfoEntry = (PSYSTEM_HANDLE_TABLE_ENTRY_INFO)&(HandleInfo->Handles[0]); @NL
  214. HandleInfoEntryDest = (NT32SYSTEM_HANDLE_TABLE_ENTRY_INFO *)&(HandleInfoDest->Handles[0]); @NL
  215. @NL
  216. while(HandleInfo->NumberOfHandles > 0) {@NL @Indent(
  217. @ForceType(PostCall,HandleInfoEntry,HandleInfoEntryDest,PSYSTEM_HANDLE_TABLE_ENTRY_INFO,OUT)
  218. @NL
  219. HandleInfoEntry++; @NL
  220. HandleInfoDest++; @NL
  221. HandleInfo->NumberOfHandles -= 1;
  222. )}@NL
  223. )}@NL
  224. End=
  225. TemplateName=PRTL_PROCESS_LOCKS
  226. IndLevel=0
  227. Direction=OUT
  228. Locals=
  229. // Error: This should not be called with this type. @NL
  230. End=
  231. AllocSize=
  232. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_LOCKS. @NL
  233. AllocSize += LENGTH; @NL
  234. End=
  235. RetSize=
  236. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_LOCKS. @NL
  237. { @NL @Indent(
  238. // Walk the datastructure determining the required memory size @NL
  239. PRTL_PROCESS_LOCKS RtlProcessLocks; @NL
  240. @NL
  241. RtlProcessLocks = @ArgName; @NL
  242. RetInfoLen += sizeof(NT32RTL_PROCESS_LOCK_INFORMATION) * RtlProcessLocks->NumberOfLocks;@NL
  243. )}@NL
  244. @NL
  245. End=
  246. PreCall=
  247. // Error: This should not be called with this type. @NL
  248. End=
  249. PostCall=
  250. // Note: @ArgName(@ArgType) is a PSYSTEM_HANDLE_INFORMATION. @NL
  251. { @NL @Indent(
  252. // Copy the structures. @NL
  253. PRTL_PROCESS_LOCKS RtlProcessLocks; @NL
  254. NT32RTL_PROCESS_LOCKS *RtlProcessLocksDest; @NL
  255. SIZE_T c;
  256. @NL
  257. RtlProcessLocks = @ArgName; @NL
  258. RtlProcessLocksDest = (NT32RTL_PROCESS_LOCKS *)@ArgHostName; @NL
  259. RtlProcessLocksDest->NumberOfLocks = RtlProcessLocks->NumberOfLocks; @NL
  260. @NL
  261. for(c=0; c < RtlProcessLocks->NumberOfLocks; c++) { @NL @Indent(
  262. @ForceType(PostCall,RtlProcessLocks->Locks[c],RtlProcessLocksDest->Locks[c],RTL_PROCESS_LOCK_INFORMATION,OUT)
  263. )}@NL
  264. )}@NL
  265. End=
  266. TemplateName=PRTL_PROCESS_MODULES
  267. IndLevel=0
  268. Direction=OUT
  269. Locals=
  270. // Error: This should not be called with this type. @NL
  271. End=
  272. AllocSize=
  273. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_MODULES. @NL
  274. AllocSize += LENGTH; @NL
  275. End=
  276. RetSize=
  277. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_MODULES. @NL
  278. { @NL @Indent(
  279. // Walk the datastructure determining the required memory size @NL
  280. PRTL_PROCESS_MODULES RtlModules; @NL
  281. @NL
  282. RtlModules = @ArgName; @NL
  283. RetInfoLen += sizeof(NT32RTL_PROCESS_MODULE_INFORMATION) * RtlModules->NumberOfModules;@NL
  284. )}@NL
  285. @NL
  286. End=
  287. PreCall=
  288. // Error: This should not be called with this type. @NL
  289. End=
  290. PostCall=
  291. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_MODULES. @NL
  292. { @NL @Indent(
  293. // Copy the structures. @NL
  294. PRTL_PROCESS_MODULES RtlProcessModules; @NL
  295. NT32RTL_PROCESS_MODULES *RtlProcessModulesDest; @NL
  296. SIZE_T c;
  297. @NL
  298. RtlProcessModules = @ArgName; @NL
  299. RtlProcessModulesDest = (NT32RTL_PROCESS_MODULES *)@ArgHostName; @NL
  300. RtlProcessModulesDest->NumberOfModules = RtlProcessModules->NumberOfModules; @NL
  301. @NL
  302. for(c=0; c < RtlProcessModules->NumberOfModules; c++) { @NL @Indent(
  303. @ForceType(PostCall,RtlProcessModules->Modules[c],RtlProcessModulesDest->Modules[c],RTL_PROCESS_MODULE_INFORMATION,OUT)
  304. )}@NL
  305. )}@NL
  306. End=
  307. TemplateName=PSYSTEM_PROCESS_INFORMATION
  308. IndLevel=0
  309. Direction=OUT
  310. Locals=
  311. // Error: This should not be called with this type. @NL
  312. End=
  313. AllocSize=
  314. // Note: @ArgName(@ArgType) is a PSYSTEM_PROCESS_INFORMATION. @NL
  315. AllocSize += LENGTH * 2; @NL
  316. End=
  317. RetSize=
  318. @NoFormat(
  319. // Note: @ArgName(@ArgType) is a PSYSTEM_PROCESS_INFORMATION.
  320. {
  321. // Walk the datastructure determining the required memory size.
  322. PSYSTEM_PROCESS_INFORMATION ProcessInfo;
  323. ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)@ArgName;
  324. while(1) {
  325. RetInfoLen += sizeof(NT32SYSTEM_PROCESS_INFORMATION);
  326. RetInfoLen += sizeof(NT32SYSTEM_THREAD_INFORMATION) * ProcessInfo->NumberOfThreads;
  327. RetInfoLen += ROUND_UP(ProcessInfo->ImageName.MaximumLength, sizeof(ULONGLONG));
  328. if(!ProcessInfo->NextEntryOffset) {
  329. break;
  330. }
  331. ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((PCHAR)ProcessInfo + ProcessInfo->NextEntryOffset);
  332. }
  333. }
  334. )
  335. @NL
  336. End=
  337. PreCall=
  338. // Error: This should not be called with this type. @NL
  339. End=
  340. PostCall=
  341. @NoFormat(
  342. // Note: @ArgName(@ArgType) is a PSYSTEM_PROCESS_INFORMATION.
  343. {
  344. // Walk the datastructure determining the required memory size.
  345. PSYSTEM_PROCESS_INFORMATION ProcessInfo;
  346. PSYSTEM_THREAD_INFORMATION ThreadInfo;
  347. NT32SYSTEM_PROCESS_INFORMATION *ProcessInfoDest;
  348. NT32SYSTEM_THREAD_INFORMATION *ThreadInfoDest;
  349. ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)@ArgName;
  350. ProcessInfoDest = (NT32SYSTEM_PROCESS_INFORMATION *)@ArgHostName;
  351. while(1) {
  352. ULONG NumberThreads;
  353. @ForceType(PostCall,ProcessInfo,ProcessInfoDest,SYSTEM_PROCESS_INFORMATION*,OUT)
  354. for(ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(ProcessInfo + 1),
  355. ThreadInfoDest = (NT32SYSTEM_THREAD_INFORMATION *)(ProcessInfoDest + 1),
  356. NumberThreads = ProcessInfo->NumberOfThreads;
  357. NumberThreads > 0; NumberThreads--, ThreadInfo++, ThreadInfoDest++) {
  358. @ForceType(PostCall,ThreadInfo,ThreadInfoDest,PSYSTEM_THREAD_INFORMATION,OUT)
  359. }
  360. // Have the image name immediatly follow the thread information(if available).
  361. if (ProcessInfo->ImageName.Buffer) {
  362. ProcessInfoDest->ImageName.Buffer = (NT32PWSTR)ThreadInfoDest;
  363. RtlCopyMemory(ThreadInfoDest, ProcessInfo->ImageName.Buffer,
  364. ProcessInfo->ImageName.MaximumLength);
  365. }
  366. else {
  367. ProcessInfoDest->ImageName.Buffer = (NT32PWSTR)NULL;
  368. }
  369. //Compute the offset for the next process
  370. ProcessInfoDest->NextEntryOffset = sizeof(NT32SYSTEM_PROCESS_INFORMATION) +
  371. sizeof(NT32SYSTEM_THREAD_INFORMATION) * ProcessInfo->NumberOfThreads +
  372. ROUND_UP(ProcessInfo->ImageName.MaximumLength, sizeof(ULONGLONG));
  373. if(!ProcessInfo->NextEntryOffset) {
  374. break;
  375. }
  376. ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)((PCHAR)ProcessInfo + ProcessInfo->NextEntryOffset);
  377. ProcessInfoDest = (NT32SYSTEM_PROCESS_INFORMATION *)((PCHAR)ProcessInfoDest + ProcessInfoDest->NextEntryOffset);
  378. }
  379. ProcessInfoDest->NextEntryOffset = 0;
  380. }
  381. )
  382. End=
  383. TemplateName=PSYSTEM_PERFORMANCE_INFORMATION
  384. IndLevel=0
  385. Direction=OUT
  386. PostCall=
  387. //
  388. // Thunk the page-size dependent fields
  389. //
  390. @ArgName->AvailablePages = Wow64GetNumberOfX86Pages (@ArgName->AvailablePages);
  391. @ArgName->CommittedPages = Wow64GetNumberOfX86Pages (@ArgName->CommittedPages);
  392. @ArgName->CommitLimit = Wow64GetNumberOfX86Pages (@ArgName->CommitLimit);
  393. @ArgName->PeakCommitment = Wow64GetNumberOfX86Pages (@ArgName->PeakCommitment);
  394. @ArgName->PagedPoolPages = Wow64GetNumberOfX86Pages (@ArgName->PagedPoolPages);
  395. @ArgName->NonPagedPoolPages = Wow64GetNumberOfX86Pages (@ArgName->NonPagedPoolPages);
  396. @ArgName->FreeSystemPtes = Wow64GetNumberOfX86Pages (@ArgName->FreeSystemPtes);
  397. @ArgName->TotalSystemDriverPages = Wow64GetNumberOfX86Pages (@ArgName->TotalSystemDriverPages);
  398. @ArgName->TotalSystemCodePages = Wow64GetNumberOfX86Pages (@ArgName->TotalSystemCodePages);
  399. @ArgName->AvailablePagedPoolPages = Wow64GetNumberOfX86Pages (@ArgName->AvailablePagedPoolPages);
  400. @ArgName->CcLazyWritePages = Wow64GetNumberOfX86Pages (@ArgName->CcLazyWritePages);
  401. @ArgName->CcDataPages = Wow64GetNumberOfX86Pages (@ArgName->CcDataPages);
  402. @TypeStructPtrOUTPostCall
  403. End=
  404. TemplateName=PSYSTEM_PAGEFILE_INFORMATION
  405. IndLevel=0
  406. Direction=OUT
  407. Locals=
  408. // Error: This should not be called with this type. @NL
  409. End=
  410. AllocSize=
  411. // Note: @ArgName(@ArgType) is a PSYSTEM_PAGEFILE_INFORMATION. @NL
  412. AllocSize += LENGTH * 2; @NL
  413. End=
  414. RetSize=
  415. @NoFormat(
  416. // Note: @ArgName(@ArgType) is a PSYSTEM_PAGEFILE_INFORMATION.
  417. {
  418. // Walk the datastructure determining the required memory size.
  419. PSYSTEM_PAGEFILE_INFORMATION PageFileInfo;
  420. LOGPRINT((TRACELOG, "Determing the required size for SYSTEM_PAGEFILE_INFORMATION\n"));
  421. PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)@ArgName;
  422. while(1) {
  423. RetInfoLen += sizeof(NT32SYSTEM_PAGEFILE_INFORMATION) +
  424. ROUND_UP(PageFileInfo->PageFileName.MaximumLength, sizeof(ULONGLONG));
  425. if (!PageFileInfo->NextEntryOffset) {
  426. break;
  427. }
  428. PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)((PCHAR)PageFileInfo + PageFileInfo->NextEntryOffset);
  429. }
  430. LOGPRINT((TRACELOG, "The required size for SYSTEM_PAGEFILE_INFORMATION was %I64x, (ULONGLONG)RetInfoLen\n"));
  431. }
  432. )
  433. @NL
  434. End=
  435. PreCall=
  436. // Error: This should not be called with this type. @NL
  437. End=
  438. PostCall=
  439. @NoFormat(
  440. // Note: @ArgName(@ArgType) is a PSYSTEM_PAGEFILE_INFORMATION.
  441. {
  442. // Walk the datastructure determining the required memory size.
  443. PSYSTEM_PAGEFILE_INFORMATION PageFileInfo;
  444. NT32SYSTEM_PAGEFILE_INFORMATION *PageFileInfoDest;
  445. LOGPRINT((TRACELOG, "Copying pagefile information\n"));
  446. PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)@ArgName;
  447. PageFileInfoDest = (NT32SYSTEM_PAGEFILE_INFORMATION *)@ArgHostName;
  448. while(1) {
  449. @ForceType(PostCall,PageFileInfo,PageFileInfoDest,SYSTEM_PAGEFILE_INFORMATION*,OUT)
  450. // Have the file name immediatly follow.
  451. if (PageFileInfo->PageFileName.Buffer) {
  452. PageFileInfoDest->PageFileName.Buffer = (NT32PWSTR)(PageFileInfoDest + 1);
  453. RtlCopyMemory((PWSTR)(PageFileInfoDest + 1),
  454. PageFileInfo->PageFileName.Buffer,
  455. PageFileInfo->PageFileName.MaximumLength);
  456. }
  457. else {
  458. PageFileInfoDest->PageFileName.Buffer = (NT32PWSTR)NULL;
  459. }
  460. //Compute the offset for the next pagefile
  461. PageFileInfoDest->NextEntryOffset = sizeof(NT32SYSTEM_PAGEFILE_INFORMATION) +
  462. ROUND_UP(PageFileInfo->PageFileName.MaximumLength,
  463. sizeof(ULONGLONG));
  464. if(!PageFileInfo->NextEntryOffset) {
  465. break;
  466. }
  467. PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)((PCHAR)PageFileInfo + PageFileInfo->NextEntryOffset);
  468. PageFileInfoDest = (NT32SYSTEM_PAGEFILE_INFORMATION *)((PCHAR)PageFileInfoDest + PageFileInfoDest->NextEntryOffset);
  469. }
  470. PageFileInfoDest->NextEntryOffset = 0;
  471. LOGPRINT((TRACELOG, "Done copying pagefile information\n"));
  472. }
  473. )
  474. End=
  475. TemplateName=PRTL_PROCESS_BACKTRACES
  476. IndLevel=0
  477. Direction=OUT
  478. Locals=
  479. // Error: This should not be called with this type. @NL
  480. End=
  481. AllocSize=
  482. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_BACKTRACES. @NL
  483. AllocSize += LENGTH * 2; @NL
  484. End=
  485. RetSize=
  486. @NoFormat(
  487. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_BACKTRACES.
  488. {
  489. // Walk the datastructure determining the required memory size.
  490. PRTL_PROCESS_BACKTRACES BacktracesInfo;
  491. BacktracesInfo = (PRTL_PROCESS_BACKTRACES)@ArgName;
  492. RetInfoLen += sizeof(NT32RTL_PROCESS_BACKTRACES) +
  493. sizeof(NT32RTL_PROCESS_BACKTRACE_INFORMATION) * BacktracesInfo->NumberOfBackTraces;
  494. }
  495. )
  496. @NL
  497. End=
  498. PreCall=
  499. // Error: This should not be called with this type. @NL
  500. End=
  501. PostCall=
  502. @NoFormat(
  503. // Note: @ArgName(@ArgType) is a PRTL_PROCESS_BACKTRACES.
  504. {
  505. // Copy the datastructure.
  506. PRTL_PROCESS_BACKTRACE_INFORMATION BackTraceInfo;
  507. NT32RTL_PROCESS_BACKTRACE_INFORMATION *BackTraceInfoDest;
  508. PRTL_PROCESS_BACKTRACES BackTracesInfo;
  509. NT32RTL_PROCESS_BACKTRACES *BackTracesInfoDest;
  510. ULONG NumberOfTraces;
  511. BackTracesInfo = (PRTL_PROCESS_BACKTRACES)@ArgName;
  512. BackTracesInfoDest = ( NT32RTL_PROCESS_BACKTRACES *)@ArgHostName;
  513. BackTracesInfoDest->CommittedMemory = BackTracesInfo->CommittedMemory;
  514. BackTracesInfoDest->ReservedMemory = BackTracesInfo->ReservedMemory;
  515. BackTracesInfoDest->NumberOfBackTraceLookups = BackTracesInfo->NumberOfBackTraceLookups;
  516. BackTracesInfoDest->NumberOfBackTraces = BackTracesInfo->NumberOfBackTraces;
  517. //Copy the individual traces.
  518. for(NumberOfTraces = BackTracesInfo->NumberOfBackTraces,
  519. BackTraceInfo = BackTracesInfo->BackTraces,
  520. BackTraceInfoDest = (NT32RTL_PROCESS_BACKTRACE_INFORMATION *)BackTracesInfoDest->BackTraces;
  521. NumberOfTraces > 0;
  522. NumberOfTraces++, BackTraceInfo++, BackTraceInfoDest++) {
  523. ULONG c;
  524. // SymbolicBackTrace is not filled in.
  525. BackTraceInfoDest->SymbolicBackTrace = (NT32PCHAR)BackTraceInfo->SymbolicBackTrace;
  526. BackTraceInfoDest->TraceCount = BackTraceInfo->TraceCount;
  527. BackTraceInfoDest->Index = BackTraceInfo->Index;
  528. BackTraceInfoDest->Depth = BackTraceInfo->Depth;
  529. for(c=0; c < MAX_STACK_DEPTH; c++) {
  530. BackTraceInfoDest->BackTrace[c] = (NT32PVOID)BackTraceInfo->BackTrace[c];
  531. }
  532. }
  533. }
  534. )
  535. End=
  536. TemplateName=PSYSTEM_OBJECT_INFORMATION
  537. NoType=NameInfo
  538. Direction=OUT
  539. TemplateName=PSYSTEM_OBJECTTYPE_INFORMATION
  540. IndLevel=0
  541. Direction=OUT
  542. Locals=
  543. // Error: This should not be called with this type. @NL
  544. End=
  545. AllocSize=
  546. // Note: @ArgName(@ArgType) is a PSYSTEM_OBJECTTYPE_INFORMATION. @NL
  547. AllocSize += LENGTH * 2; @NL
  548. End=
  549. RetSize=
  550. @NoFormat(
  551. // Note: @ArgName(@ArgType) is a PSYSTEM_OBJECTTYPE_INFORMATION.
  552. {
  553. // Walk the datastructure determining the required memory size.
  554. PSYSTEM_OBJECTTYPE_INFORMATION ObjectTypeInfo;
  555. PSYSTEM_OBJECT_INFORMATION ObjectInfo;
  556. ObjectTypeInfo = (PSYSTEM_OBJECTTYPE_INFORMATION)@ArgName;
  557. while(1) {
  558. ULONG ObjectOffset;
  559. ObjectOffset = sizeof(SYSTEM_OBJECTTYPE_INFORMATION) + ObjectTypeInfo->TypeName.MaximumLength;
  560. RetInfoLen += ObjectOffset;
  561. if (ObjectTypeInfo->NumberOfObjects > 0) {
  562. ObjectInfo = (PSYSTEM_OBJECT_INFORMATION)((PCHAR)ObjectTypeInfo + ObjectOffset);
  563. while(1) {
  564. RetInfoLen += ROUND_UP(sizeof(NT32SYSTEM_OBJECT_INFORMATION) + ObjectInfo->NameInfo.Name.MaximumLength,4);
  565. if(!ObjectInfo->NextEntryOffset) {
  566. break;
  567. }
  568. ObjectInfo = (PSYSTEM_OBJECT_INFORMATION)((PCHAR)ObjectInfo + ObjectInfo->NextEntryOffset);
  569. }
  570. }
  571. if (!ObjectTypeInfo->NextEntryOffset) {
  572. break;
  573. }
  574. ObjectTypeInfo = (PSYSTEM_OBJECTTYPE_INFORMATION)((PCHAR)ObjectTypeInfo + ObjectTypeInfo->NextEntryOffset);
  575. }
  576. }
  577. )
  578. @NL
  579. End=
  580. PreCall=
  581. // Error: This should not be called with this type. @NL
  582. End=
  583. PostCall=
  584. @NoFormat(
  585. // Note: @ArgName(@ArgType) is a PSYSTEM_OBJECTTYPE_INFORMATION
  586. {
  587. // Copy the datastructure.
  588. PSYSTEM_OBJECTTYPE_INFORMATION ObjectTypeInfo;
  589. NT32SYSTEM_OBJECTTYPE_INFORMATION *ObjectTypeInfoDest;
  590. PSYSTEM_OBJECT_INFORMATION ObjectInfo;
  591. NT32SYSTEM_OBJECT_INFORMATION *ObjectInfoDest;
  592. ObjectTypeInfo = (PSYSTEM_OBJECTTYPE_INFORMATION)@ArgName;
  593. ObjectTypeInfoDest = (NT32SYSTEM_OBJECTTYPE_INFORMATION *)@ArgHostName;
  594. while(1) {
  595. ULONG NextEntryOffsetDest;
  596. @ForceType(PostCall,ObjectTypeInfo,ObjectTypeInfoDest,SYSTEM_OBJECTTYPE_INFORMATION*,OUT)
  597. //Copy the typename. It should immediatly follow the type.
  598. if (ObjectTypeInfo->TypeName.Buffer) {
  599. ObjectTypeInfoDest->TypeName.Buffer = (NT32PWSTR)(ObjectTypeInfoDest + 1);
  600. RtlCopyMemory(ObjectTypeInfoDest + 1,
  601. ObjectTypeInfo->TypeName.Buffer,
  602. ObjectTypeInfo->TypeName.MaximumLength);
  603. }
  604. else {
  605. ObjectTypeInfoDest->TypeName.Buffer = (NT32PWSTR)NULL;
  606. }
  607. NextEntryOffsetDest = sizeof(NT32SYSTEM_OBJECTTYPE_INFORMATION) + ObjectTypeInfo->TypeName.MaximumLength;
  608. WOWASSERT(ROUND_UP(NextEntryOffsetDest,4) == NextEntryOffsetDest);
  609. if (ObjectTypeInfo->NumberOfObjects) {
  610. ObjectInfo = (PSYSTEM_OBJECT_INFORMATION)((PCHAR)ObjectTypeInfo +
  611. ROUND_UP(sizeof(SYSTEM_OBJECTTYPE_INFORMATION) +
  612. ObjectTypeInfo->TypeName.MaximumLength,4));
  613. ObjectInfoDest = (NT32SYSTEM_OBJECT_INFORMATION *)((PCHAR)ObjectTypeInfoDest + NextEntryOffsetDest);
  614. LOGPRINT((INFOLOG, "ObjectInfo %x, ObjectInfoDest %x\n", ObjectInfo, ObjectInfoDest));
  615. while(1) {
  616. @ForceType(PostCall,ObjectInfo,ObjectInfoDest,PSYSTEM_OBJECT_INFORMATION,OUT)
  617. if (ObjectInfo->NameInfo.Name.Buffer) {
  618. ObjectInfoDest->NameInfo.Name.Buffer = (NT32PWSTR)(ObjectInfo + 1);
  619. //Copy the name, let immediatly follow.
  620. RtlCopyMemory(ObjectInfoDest + 1,
  621. ObjectInfo->NameInfo.Name.Buffer,
  622. ObjectInfo->NameInfo.Name.MaximumLength);
  623. }
  624. else {
  625. ObjectInfoDest->NameInfo.Name.Buffer = (NT32PWSTR)NULL;
  626. }
  627. NextEntryOffsetDest +=
  628. (ObjectInfoDest->NextEntryOffset = ROUND_UP(sizeof(NT32SYSTEM_OBJECT_INFORMATION) +
  629. ObjectInfo->NameInfo.Name.MaximumLength,4));
  630. if(!ObjectInfo->NextEntryOffset) {
  631. break;
  632. }
  633. ObjectInfoDest = (NT32SYSTEM_OBJECT_INFORMATION*)((PCHAR)ObjectInfoDest + ObjectInfoDest->NextEntryOffset);
  634. ObjectInfo = (PSYSTEM_OBJECT_INFORMATION)((PCHAR)ObjectInfo + ObjectInfo->NextEntryOffset);
  635. }
  636. ObjectInfoDest->NextEntryOffset = 0;
  637. }
  638. if (!ObjectTypeInfo->NextEntryOffset) {
  639. break;
  640. }
  641. ObjectTypeInfoDest = (NT32SYSTEM_OBJECTTYPE_INFORMATION *)((PCHAR)ObjectTypeInfoDest + NextEntryOffsetDest);
  642. ObjectTypeInfo = (PSYSTEM_OBJECTTYPE_INFORMATION)((PCHAR)ObjectTypeInfo + ObjectTypeInfo->NextEntryOffset);
  643. }
  644. ObjectTypeInfoDest->NextEntryOffset = 0;
  645. }
  646. )
  647. End=
  648. TemplateName=PSYSTEM_POOLTAG_INFORMATION
  649. IndLevel=0
  650. Direction=OUT
  651. Locals=
  652. // Error: This should not be called with this type. @NL
  653. End=
  654. AllocSize=
  655. // Note: @ArgName(@ArgType) is a PSYSTEM_POOLTAG_INFORMATION. @NL
  656. AllocSize += LENGTH * 2; @NL
  657. End=
  658. RetSize=
  659. @NoFormat(
  660. // Note: @ArgName(@ArgType) is a PSYSTEM_POOLTAG_INFORMATION.
  661. {
  662. // Walk the datastructure determining the required memory size.
  663. PSYSTEM_POOLTAG_INFORMATION PoolTagInfo;
  664. PoolTagInfo = (PSYSTEM_POOLTAG_INFORMATION)@ArgName;
  665. RetInfoLen += sizeof(NT32SYSTEM_POOLTAG_INFORMATION);
  666. if (PoolTagInfo->Count > 0) {
  667. RetInfoLen += (PoolTagInfo->Count - 1) * sizeof(NT32SYSTEM_POOLTAG);
  668. }
  669. }
  670. )
  671. @NL
  672. End=
  673. PreCall=
  674. // Error: This should not be called with this type. @NL
  675. End=
  676. PostCall=
  677. @NoFormat(
  678. // Note: @ArgName(@ArgType) is a PSYSTEM_POOL_INFORMATION
  679. {
  680. // Copy the datastructure.
  681. PSYSTEM_POOLTAG_INFORMATION PoolTagInfo;
  682. NT32SYSTEM_POOLTAG_INFORMATION* PoolTagInfoDest;
  683. ULONG c;
  684. PoolTagInfo = (PSYSTEM_POOLTAG_INFORMATION)@ArgName;
  685. PoolTagInfoDest = (NT32SYSTEM_POOLTAG_INFORMATION*)@ArgHostName;
  686. PoolTagInfoDest->Count = (NT32ULONG)PoolTagInfo->Count;
  687. for(c=0; c<PoolTagInfoDest->Count; c++) {
  688. PoolTagInfoDest->TagInfo[c].TagUlong = (NT32ULONG)PoolTagInfo->TagInfo[c].TagUlong;
  689. PoolTagInfoDest->TagInfo[c].PagedAllocs = (NT32ULONG)PoolTagInfo->TagInfo[c].PagedAllocs;
  690. PoolTagInfoDest->TagInfo[c].PagedFrees = (NT32ULONG)PoolTagInfo->TagInfo[c].PagedFrees;
  691. PoolTagInfoDest->TagInfo[c].PagedUsed = Wow64ThunkSIZE_T64TO32(PoolTagInfo->TagInfo[c].PagedUsed);
  692. PoolTagInfoDest->TagInfo[c].NonPagedAllocs = (NT32ULONG)PoolTagInfo->TagInfo[c].NonPagedAllocs;
  693. PoolTagInfoDest->TagInfo[c].NonPagedFrees = (NT32ULONG)PoolTagInfo->TagInfo[c].NonPagedFrees;
  694. PoolTagInfoDest->TagInfo[c].NonPagedUsed = Wow64ThunkSIZE_T64TO32(PoolTagInfo->TagInfo[c].NonPagedUsed);
  695. }
  696. }
  697. )
  698. End=
  699. TemplateName=PSYSTEM_POOL_INFORMATION
  700. IndLevel=0
  701. Direction=OUT
  702. Locals=
  703. // Error: This should not be called with this type. @NL
  704. End=
  705. AllocSize=
  706. // Note: @ArgName(@ArgType) is a PSYSTEM_POOL_INFORMATION. @NL
  707. AllocSize += LENGTH * 2; @NL
  708. End=
  709. RetSize=
  710. @NoFormat(
  711. // Note: @ArgName(@ArgType) is a PSYSTEM_POOL_INFORMATION.
  712. {
  713. // Walk the datastructure determining the required memory size.
  714. PSYSTEM_POOL_INFORMATION PoolInfo;
  715. PoolInfo = (PSYSTEM_POOL_INFORMATION)@ArgName;
  716. RetInfoLen += sizeof(NT32SYSTEM_POOL_INFORMATION);
  717. if (PoolInfo->NumberOfEntries > 0) {
  718. RetInfoLen += (PoolInfo->NumberOfEntries - 1) * sizeof(NT32SYSTEM_POOL_ENTRY);
  719. }
  720. }
  721. )
  722. @NL
  723. End=
  724. PreCall=
  725. // Error: This should not be called with this type. @NL
  726. End=
  727. PostCall=
  728. @NoFormat(
  729. // Note: @ArgName(@ArgType) is a PSYSTEM_POOL_INFORMATION
  730. {
  731. // Copy the datastructure.
  732. PSYSTEM_POOL_INFORMATION PoolInfo;
  733. NT32SYSTEM_POOL_INFORMATION* PoolInfoDest;
  734. ULONG c;
  735. PoolInfo = (PSYSTEM_POOL_INFORMATION)@ArgName;
  736. PoolInfoDest = (NT32SYSTEM_POOL_INFORMATION*)@ArgHostName;
  737. PoolInfoDest->TotalSize = Wow64ThunkSIZE_T64TO32(PoolInfo->TotalSize);
  738. PoolInfoDest->FirstEntry = (NT32PVOID)PoolInfo->FirstEntry;
  739. PoolInfoDest->EntryOverhead = (NT32USHORT)PoolInfo->EntryOverhead;
  740. PoolInfoDest->PoolTagPresent = (NT32BOOLEAN)PoolInfo->PoolTagPresent;
  741. PoolInfoDest->Spare0 = (NT32BOOLEAN)PoolInfo->Spare0;
  742. PoolInfoDest->NumberOfEntries = (NT32ULONG)PoolInfo->NumberOfEntries;
  743. for(c=0; c<PoolInfo->NumberOfEntries; c++) {
  744. PoolInfoDest->Entries[c].Allocated = (NT32BOOLEAN)PoolInfo->Entries[c].Allocated;
  745. PoolInfoDest->Entries[c].Spare0 = (NT32BOOLEAN)PoolInfo->Entries[c].Spare0;
  746. PoolInfoDest->Entries[c].AllocatorBackTraceIndex = (NT32USHORT)PoolInfo->Entries[c].AllocatorBackTraceIndex;
  747. PoolInfoDest->Entries[c].Size = (NT32ULONG)PoolInfo->Entries[c].Size;
  748. PoolInfoDest->Entries[c].ProcessChargedQuota = (NT32PVOID)PoolInfoDest->Entries[c].ProcessChargedQuota;
  749. }
  750. }
  751. )
  752. End=
  753. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  754. ;;
  755. ;; Types for NtQueryVirtualMemory(64)
  756. ;;
  757. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  758. TemplateName=MEMORY_WORKING_SET_BLOCK
  759. IndLevel=0
  760. Direction=OUT
  761. PostCall=
  762. // Note: @ArgName(@ArgType) is a MEMORY_WORKING_SET_BLOCK
  763. @MemberTypes(PostCall,.)
  764. End=
  765. TemplateName=PMEMORY_WORKING_SET_INFORMATION
  766. IndLevel=0
  767. Direction=OUT
  768. AllocSize=
  769. // Note: @ArgName(@ArgType) is a PMEMORY_WORKING_SET_INFORMATION. @NL
  770. AllocSize += LENGTH; @NL
  771. AllocSize += (FIELD_OFFSET (MEMORY_WORKING_SET_INFORMATION,WorkingSetInfo) - FIELD_OFFSET (NT32MEMORY_WORKING_SET_INFORMATION,WorkingSetInfo));
  772. End=
  773. RetSize=
  774. // Note: @ArgName(@ArgType) is a PMEMORY_WORKING_SET_INFORMATION. @NL
  775. { @NL @Indent(
  776. // Walk the datastructure determining the required memory size @NL
  777. PMEMORY_WORKING_SET_INFORMATION WorkingSet; @NL
  778. @NL
  779. WorkingSet = @ArgName; @NL
  780. RetInfoLen += sizeof(NT32MEMORY_WORKING_SET_INFORMATION) * WorkingSet->NumberOfEntries;@NL
  781. )}@NL
  782. @NL
  783. End=
  784. PreCall=
  785. // Error: This should not be called with this type. @NL
  786. End=
  787. PostCall=
  788. // Note: @ArgName(@ArgType) is a PMEMORY_WORKING_SET_INFORMATION. @NL
  789. { @NL @Indent(
  790. // Copy the structures. @NL
  791. PMEMORY_WORKING_SET_INFORMATION WorkingSet; @NL
  792. NT32MEMORY_WORKING_SET_INFORMATION *WorkingSetDest; @NL
  793. SIZE_T c;
  794. @NL
  795. WorkingSet = @ArgName; @NL
  796. WorkingSetDest = (NT32MEMORY_WORKING_SET_INFORMATION *)@ArgHostName;@NL
  797. WorkingSetDest->NumberOfEntries = WorkingSet->NumberOfEntries; @NL
  798. @NL
  799. for(c=0; c < WorkingSet->NumberOfEntries; c++) { @NL @Indent(
  800. @ForceType(PostCall,WorkingSet->WorkingSetInfo[c],WorkingSetDest->WorkingSetInfo[c],MEMORY_WORKING_SET_BLOCK,OUT)
  801. )}@NL
  802. )}@NL
  803. End=
  804. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  805. ;;
  806. ;; Types for NtQueryObject
  807. ;;
  808. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  809. TemplateName=POBJECT_NAME_INFORMATION
  810. IndLevel=0
  811. Direction=OUT
  812. AllocSize=
  813. // Note: @ArgName(@ArgType) is a POBJECT_NAME_INFORMATION. @NL
  814. AllocSize += LENGTH + sizeof(OBJECT_NAME_INFORMATION) - sizeof(NT32OBJECT_NAME_INFORMATION); @NL
  815. End=
  816. RetSize=
  817. // Note: @ArgName(@ArgType) is a POBJECT_NAME_INFORMATION. @NL
  818. { @NL @Indent(
  819. // Walk the datastructure determining the required memory size @NL
  820. RetInfoLen += sizeof(NT32OBJECT_NAME_INFORMATION) + @ArgName->Name.MaximumLength;@NL
  821. )}@NL
  822. @NL
  823. End=
  824. PostCall=
  825. // Note: @ArgName(@ArgType) is an POBJECT_NAME_INFORMATION @NL
  826. { @NL @Indent(
  827. PUCHAR pStr; @NL
  828. @NL
  829. @MemberTypes(PostCall)
  830. if (@ArgName->Name.Buffer) { @Indent( @NL
  831. pStr = ((PUCHAR)@ArgHostName) + sizeof(NT32OBJECT_NAME_INFORMATION);@NL
  832. RtlCopyMemory(pStr, @ArgName->Name.Buffer, @ArgName->Name.MaximumLength);@NL
  833. ((NT32OBJECT_NAME_INFORMATION *)@ArgHostName)->Name.Buffer = (NT32PWSTR)pStr; @NL
  834. )} @NL
  835. else { @Indent( @NL
  836. ((NT32OBJECT_NAME_INFORMATION *)@ArgHostName)->Name.Buffer = (NT32PWSTR)NULL; @NL
  837. )} @NL
  838. })@NL
  839. End=
  840. TemplateName=POBJECT_TYPE_INFORMATION
  841. IndLevel=0
  842. Direction=OUT
  843. AllocSize=
  844. // Note: @ArgName(@ArgType) is a POBJECT_TYPE_INFORMATION. @NL
  845. AllocSize += LENGTH + sizeof(OBJECT_TYPE_INFORMATION) - sizeof(NT32OBJECT_TYPE_INFORMATION); @NL
  846. End=
  847. RetSize=
  848. // Note: @ArgName(@ArgType) is a POBJECT_TYPE_INFORMATION. @NL
  849. { @NL @Indent(
  850. // Walk the datastructure determining the required memory size @NL
  851. RetInfoLen += sizeof(NT32OBJECT_TYPE_INFORMATION) + @ArgName->TypeName.MaximumLength;@NL
  852. )}@NL
  853. @NL
  854. End=
  855. PostCall=
  856. // Note: @ArgName(@ArgType) is an POBJECT_TYPE_INFORMATION @NL
  857. { @NL @Indent(
  858. PUCHAR pStr; @NL
  859. @NL
  860. @MemberTypes(PostCall)
  861. if (@ArgName->TypeName.Buffer) { @Indent( @NL
  862. pStr = ((PUCHAR)@ArgHostName) + sizeof(NT32OBJECT_TYPE_INFORMATION);@NL
  863. RtlCopyMemory(pStr, @ArgName->TypeName.Buffer, @ArgName->TypeName.MaximumLength);@NL
  864. ((NT32OBJECT_TYPE_INFORMATION *)@ArgHostName)->TypeName.Buffer = (NT32PWSTR)pStr; @NL
  865. )} @NL
  866. else { @Indent( @NL
  867. ((NT32OBJECT_TYPE_INFORMATION *)@ArgHostName)->TypeName.Buffer = (NT32PWSTR)NULL; @NL
  868. )} @NL
  869. })@NL
  870. End=
  871. TemplateName=POBJECT_TYPES_INFORMATION
  872. IndLevel=0
  873. Direction=OUT
  874. AllocSize=
  875. // Note: @ArgName(@ArgType) is a POBJECT_TYPES_INFORMATION. @NL
  876. AllocSize += LENGTH; @NL
  877. End=
  878. RetSize=
  879. // Note: @ArgName(@ArgType) is a POBJECT_TYPES_INFORMATION. @NL
  880. { @NL @Indent(
  881. // Walk the datastructure determining the required memory size @NL
  882. POBJECT_TYPE_INFORMATION ObjectType; @NL
  883. SIZE_T c; @NL
  884. RetInfoLen += sizeof(NT32OBJECT_TYPES_INFORMATION); @NL
  885. @NL
  886. c = @ArgName->NumberOfTypes; @NL
  887. ObjectType = (POBJECT_TYPE_INFORMATION)(@ArgName + 1); @NL
  888. @NL
  889. while(c > 0) { @NL @Indent(
  890. RetInfoLen += sizeof(NT32OBJECT_TYPE_INFORMATION) + ObjectType->TypeName.MaximumLength; @NL
  891. ObjectType++; @NL
  892. c--; @NL
  893. )} @NL
  894. )}@NL
  895. @NL
  896. End=
  897. PostCall=
  898. // Note: @ArgName(@ArgType) is an POBJECT_TYPES_INFORMATION @NL
  899. { @NL @Indent(
  900. // Copy the OBJECT_TYPE_INFORMATION structures first, then copy the names. @NL
  901. POBJECT_TYPE_INFORMATION ObjectType; @NL
  902. NT32OBJECT_TYPE_INFORMATION *ObjectTypeDest; @NL
  903. SIZE_T c; @NL
  904. PUCHAR pStr; @NL
  905. @NL
  906. // Copy the header. @NL
  907. @MemberTypes(PostCall)
  908. @NL
  909. // Copy the main structures. @NL
  910. c = @ArgName->NumberOfTypes; @NL
  911. ObjectType = (POBJECT_TYPE_INFORMATION)(@ArgName + 1); @NL
  912. ObjectTypeDest = (NT32OBJECT_TYPE_INFORMATION *)(((PUCHAR)@ArgHostName) + sizeof(NT32OBJECT_TYPE_INFORMATION)); @NL
  913. @NL
  914. while(c > 0) { @NL @Indent(
  915. @ForceType(PostCall,(*ObjectType),(*ObjectTypeDest),OBJECT_TYPE_INFORMATION,OUT)
  916. ObjectType++; @NL
  917. ObjectTypeDest++; @NL
  918. c--;
  919. )}@NL
  920. @NL
  921. // Copy the strings. @NL
  922. pStr = (PUCHAR)ObjectTypeDest; @NL
  923. c = @ArgName->NumberOfTypes; @NL
  924. ObjectType = (POBJECT_TYPE_INFORMATION)(@ArgName + 1); @NL
  925. ObjectTypeDest = (NT32OBJECT_TYPE_INFORMATION *)(((PUCHAR)@ArgHostName) + sizeof(NT32OBJECT_TYPE_INFORMATION)); @NL
  926. @NL
  927. while(c > 0) { @NL @Indent(
  928. if (ObjectType->TypeName.Buffer) { @Indent( @NL
  929. RtlCopyMemory(pStr, ObjectType->TypeName.Buffer, ObjectType->TypeName.MaximumLength);@NL
  930. ObjectTypeDest->TypeName.Buffer = (NT32PWSTR)pStr; @NL
  931. pStr += ObjectType->TypeName.MaximumLength; @NL
  932. )} @NL
  933. else { @Indent( @NL
  934. ObjectTypeDest->TypeName.Buffer = (NT32PWSTR)NULL; @NL
  935. )} @NL
  936. ObjectType++; @NL
  937. ObjectTypeDest++; @NL
  938. c--;
  939. )}@NL
  940. })@NL
  941. End=
  942. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  943. ;;
  944. ;; Generic security types
  945. ;;
  946. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  947. TemplateName=PTOKEN_GROUPS
  948. IndLevel=0
  949. Direction=IN
  950. Locals=
  951. // @ArgName(@ArgType) is an IN PTOKEN_GROUPS. Nothing to do. @NL
  952. End=
  953. PreCall=
  954. // @ArgName(@ArgType) is an IN PTOKEN_GROUPS. @NL
  955. @ArgName = whNT32ShallowThunkAllocTokenGroups32TO64((NT32TOKEN_GROUPS *)@ArgHostName); @NL
  956. End=
  957. PostCall=
  958. // @ArgName(@ArgType) is an IN PTOKEN_GROUPS. Nothing to do. @NL
  959. End=
  960. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  961. ;;
  962. ;; Types for NtQueryInformationToken
  963. ;;
  964. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  965. TemplateName=PTOKEN_USER
  966. IndLevel=0
  967. Direction=OUT
  968. AllocSize=
  969. // Note: @ArgName(@ArgType) is a PTOKEN_USER. @NL
  970. if (LENGTH) { @NL
  971. AllocSize += LENGTH + sizeof(TOKEN_USER) - sizeof(NT32TOKEN_USER); @NL
  972. }@NL
  973. End=
  974. RetSize=
  975. // Note: @ArgName(@ArgType) is a PTOKEN_USER. @NL
  976. if (LENGTH) { @NL
  977. // Walk the datastructure determining the required memory size @NL
  978. RetInfoLen += whNT32DeepThunkSidAndAttributesArray64TO32Length(1, &(@ArgName->User)); @NL
  979. } @NL
  980. End=
  981. PostCall=
  982. // Note: @ArgName(@ArgType) is a PTOKEN_USER. @NL
  983. if (LENGTH ) { @NL
  984. whNT32DeepThunkSidAndAttributesArray64TO32(1, (NT32SID_AND_ATTRIBUTES *)@ArgHostName, &(@ArgName->User)); @NL
  985. } else { @NL
  986. // Return the 64-bit length since the user queried the length and we can't @NL
  987. // figure out how much memory is needed based only on the 64-bit length @NL
  988. RetInfoLen += ApiReturnLength; @NL
  989. } @NL
  990. End=
  991. TemplateName=PTOKEN_GROUPS
  992. IndLevel=0
  993. Direction=OUT
  994. AllocSize=
  995. // Note: @ArgName(@ArgType) is a PTOKEN_GROUPS. @NL
  996. if (LENGTH) { @NL
  997. AllocSize += LENGTH + sizeof(TOKEN_GROUPS) - sizeof(NT32TOKEN_GROUPS); @NL
  998. } @NL
  999. End=
  1000. RetSize=
  1001. // Note: @ArgName(@ArgType) is a PTOKEN_GROUPS. @NL
  1002. if (LENGTH) { @NL
  1003. RetInfoLen += whNT32DeepThunkTokenGroups64TO32Length(@ArgName); @NL
  1004. } @NL
  1005. End=
  1006. PostCall=
  1007. // Note: @ArgName(@ArgType) is a PTOKEN_GROUPS. @NL
  1008. if (LENGTH) { @NL
  1009. whNT32DeepThunkTokenGroups64TO32((NT32TOKEN_GROUPS *)@ArgHostName, @ArgName); @NL
  1010. } else { @NL
  1011. // Return the 64-bit length since the user queried the length and we can't @NL
  1012. // figure out how much memory is needed based only on the 64-bit length @NL
  1013. RetInfoLen += ApiReturnLength; @NL
  1014. } @NL
  1015. End=
  1016. TemplateName=PTOKEN_OWNER
  1017. IndLevel=0
  1018. Direction=OUT
  1019. AllocSize=
  1020. // Note: @ArgName(@ArgType) is a PTOKEN_OWNER. @NL
  1021. if (LENGTH) { @NL
  1022. AllocSize += LENGTH + sizeof(TOKEN_OWNER) - sizeof(NT32TOKEN_OWNER); @NL
  1023. } @NL
  1024. End=
  1025. RetSize=
  1026. // Note: @ArgName(@ArgType) is a PTOKEN_OWNER. @NL
  1027. if (LENGTH) { @NL
  1028. // Walk the datastructure determining the required memory size @NL
  1029. RetInfoLen += sizeof(TOKEN_OWNER) + RtlLengthSid(@ArgName->Owner); @NL
  1030. }@NL
  1031. End=
  1032. PostCall=
  1033. // Note: @ArgName(@ArgType) is a PTOKEN_OWNER. @NL
  1034. if (LENGTH) { @NL
  1035. ((NT32TOKEN_OWNER*)@ArgHostName)->Owner = (NT32PSID)(((NT32TOKEN_OWNER*)@ArgHostName) + 1); @NL
  1036. RtlCopySid(RtlLengthSid(@ArgName->Owner), (PSID)((NT32TOKEN_OWNER*)@ArgHostName)->Owner, @ArgName->Owner); @NL
  1037. } else { @NL
  1038. // Return the 64-bit length since the user queried the length and we can't @NL
  1039. // figure out how much memory is needed based only on the 64-bit length @NL
  1040. RetInfoLen += ApiReturnLength; @NL
  1041. } @NL
  1042. End=
  1043. TemplateName=PTOKEN_PRIMARY_GROUP
  1044. IndLevel=0
  1045. Direction=OUT
  1046. AllocSize=
  1047. // Note: @ArgName(@ArgType) is a PTOKEN_PRIMARY_GROUP. @NL
  1048. if (LENGTH) { @NL
  1049. AllocSize += LENGTH + sizeof(TOKEN_PRIMARY_GROUP) - sizeof(NT32TOKEN_PRIMARY_GROUP); @NL
  1050. } @NL
  1051. End=
  1052. RetSize=
  1053. // Note: @ArgName(@ArgType) is a PTOKEN_PRIMARY_GROUP. @NL
  1054. if (LENGTH) { @NL
  1055. // Walk the datastructure determining the required memory size @NL
  1056. RetInfoLen += sizeof(TOKEN_PRIMARY_GROUP) + RtlLengthSid(@ArgName->PrimaryGroup); @NL
  1057. }@NL
  1058. End=
  1059. PostCall=
  1060. // Note: @ArgName(@ArgType) is a PTOKEN_PRIMARY_GROUP. @NL
  1061. if (LENGTH) { @NL
  1062. ((NT32TOKEN_PRIMARY_GROUP*)@ArgHostName)->PrimaryGroup = (NT32PSID)(((NT32TOKEN_PRIMARY_GROUP*)@ArgHostName) + 1); @NL
  1063. RtlCopySid(RtlLengthSid(@ArgName->PrimaryGroup), (PSID)((NT32TOKEN_PRIMARY_GROUP*)@ArgHostName)->PrimaryGroup, @ArgName->PrimaryGroup); @NL
  1064. } else { @NL
  1065. // Return the 64-bit length since the user queried the length and we can't @NL
  1066. // figure out how much memory is needed based only on the 64-bit length @NL
  1067. RetInfoLen += ApiReturnLength; @NL
  1068. } @NL
  1069. End=
  1070. TemplateName=PTOKEN_DEFAULT_DACL
  1071. IndLevel=0
  1072. Direction=OUT
  1073. AllocSize=
  1074. // Note: @ArgName(@ArgType) is a PTOKEN_DEFAULT_DACL. @NL
  1075. if (LENGTH) { @NL
  1076. AllocSize += LENGTH + sizeof(TOKEN_DEFAULT_DACL) - sizeof(NT32TOKEN_DEFAULT_DACL); @NL
  1077. } @NL
  1078. End=
  1079. RetSize=
  1080. // Note: @ArgName(@ArgType) is a PTOKEN_DEFAULT_DACL. @NL
  1081. if (LENGTH) { @NL
  1082. // Walk the datastructure determining the required memory size @NL
  1083. RetInfoLen += sizeof(TOKEN_DEFAULT_DACL); @NL
  1084. if (NULL != @ArgName->DefaultDacl) { @NL @Indent(
  1085. RetInfoLen =+ @ArgName->DefaultDacl->AclSize;@NL
  1086. )}@NL
  1087. }@NL
  1088. End=
  1089. PostCall=
  1090. // Note: @ArgName(@ArgType) is a PTOKEN_DEFAULT_DACL. @NL
  1091. if (LENGTH) { @NL
  1092. if (NULL != @ArgName->DefaultDacl) { @NL @Indent(
  1093. ((NT32TOKEN_DEFAULT_DACL*)@ArgHostName)->DefaultDacl = (NT32PSID)(((NT32TOKEN_DEFAULT_DACL*)@ArgHostName) + 1); @NL
  1094. RtlCopyMemory((PSID)((NT32TOKEN_DEFAULT_DACL*)@ArgHostName)->DefaultDacl, @ArgName->DefaultDacl, @ArgName->DefaultDacl->AclSize); @NL
  1095. )}@NL
  1096. else { @NL @Indent(
  1097. ((NT32TOKEN_DEFAULT_DACL*)@ArgHostName)->DefaultDacl = (NT32PSID)NULL; @NL
  1098. )}@NL
  1099. } else { @NL
  1100. // Return the 64-bit length since the user queried the length and we can't @NL
  1101. // figure out how much memory is needed based only on the 64-bit length @NL
  1102. RetInfoLen += ApiReturnLength; @NL
  1103. } @NL
  1104. End=
  1105. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1106. ;;
  1107. ;; Types for NtQueryInformationJobObject
  1108. ;;
  1109. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1110. TemplateName=PJOBOBJECT_BASIC_PROCESS_ID_LIST
  1111. IndLevel=0
  1112. Direction=OUT
  1113. AllocSize=
  1114. // Note: @ArgName(@ArgType) is a PJOBOBJECT_BASIC_PROCESS_ID_LIST. @NL
  1115. AllocSize += LENGTH * 2; @NL
  1116. End=
  1117. RetSize=
  1118. // Note: @ArgName(@ArgType) is a PJOBOBJECT_BASIC_PROCESS_ID_LIST. @NL
  1119. RetInfoLen += sizeof(ULONG) + sizeof(ULONG) + sizeof(ULONG) * @ArgName->NumberOfProcessIdsInList; @NL
  1120. End=
  1121. PostCall=
  1122. // Note: @ArgName(@ArgType) is a PJOBOBJECT_BASIC_PROCESS_ID_LIST. @NL
  1123. { @NL @Indent(
  1124. ULONG c;
  1125. NT32JOBOBJECT_BASIC_PROCESS_ID_LIST *Dest = (NT32JOBOBJECT_BASIC_PROCESS_ID_LIST *)@ArgHostName; @NL
  1126. Dest->NumberOfAssignedProcesses = @ArgName->NumberOfAssignedProcesses; @NL
  1127. c = Dest->NumberOfProcessIdsInList = @ArgName->NumberOfProcessIdsInList; @NL
  1128. for(;c > 0; c--) {@Indent( @NL
  1129. Dest->ProcessIdList[c] = (ULONG)@ArgName->ProcessIdList[c]; @NL
  1130. )} @NL
  1131. )}@NL
  1132. End=
  1133. TemplateName=PJOBOBJECT_BASIC_LIMIT_INFORMATION
  1134. NoType=Affinity
  1135. IndLevel=0
  1136. Direction=OUT
  1137. PostCall=
  1138. @TypeStructPtrOUTPostCall
  1139. if (@ArgHostName) { @Indent( @NL
  1140. ((@ArgHostTypeInd *)@ArgHostName)->Affinity = Wow64ThunkAffinityMask64TO32(@ArgName->Affinity); @NL
  1141. )} @NL
  1142. End=
  1143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1144. ;;
  1145. ;; Types for NtSetInformationJobObject
  1146. ;;
  1147. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1148. TemplateName=PJOBOBJECT_BASIC_LIMIT_INFORMATION
  1149. NoType=Affinity
  1150. IndLevel=0
  1151. Direction=IN
  1152. PostCall=
  1153. @TypeStructPtrINPreCall
  1154. if (@ArgHostName) { @Indent( @NL
  1155. @ArgName->Affinity = Wow64ThunkAffinityMask32TO64(((@ArgHostTypeInd *)@ArgHostName)->Affinity); @NL
  1156. )} @NL
  1157. End=
  1158. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1159. ;;
  1160. ;; Types for NtQuerySection
  1161. ;;
  1162. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1163. TemplateName=PSECTION_IMAGE_INFORMATION
  1164. NoType=SubSystemVersion
  1165. IndLevel=0
  1166. Direction=OUT
  1167. AllocSize=
  1168. // Note: @ArgName(@ArgType) is a PSECTION_IMAGE_INFORMATION. @NL
  1169. AllocSize += LENGTH + sizeof(SECTION_IMAGE_INFORMATION) - sizeof(NT32SECTION_IMAGE_INFORMATION); @NL
  1170. End=
  1171. RetSize=
  1172. // Note: @ArgName(@ArgType) is a PSECTION_IMAGE_INFORMATION. @NL
  1173. RetInfoLen += sizeof(NT32SECTION_IMAGE_INFORMATION); @NL
  1174. End=
  1175. PostCall=
  1176. // Note: @ArgName(@ArgType) is a PSECTION_IMAGE_INFORMATION. @NL
  1177. @TypeStructPtrOUTPostCall
  1178. @ForceType(PostCall,@ArgName->SubSystemVersion,((NT32SECTION_IMAGE_INFORMATION *)(@ArgHostName))->SubSystemVersion,ULONG,OUT)
  1179. End=
  1180. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1181. ;;
  1182. ;; Types for NtSetInformationProcess
  1183. ;;
  1184. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1185. TemplateName=PPROCESS_DEVICEMAP_INFORMATION
  1186. IndLevel=0
  1187. Direction=IN
  1188. Locals=
  1189. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1190. // Nothing to do. @NL
  1191. End=
  1192. PreCall=
  1193. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1194. @ArgName->Set.DirectoryHandle = (HANDLE)((NT32PROCESS_DEVICEMAP_INFORMATION *)(@ArgHostName))->Set.DirectoryHandle; @NL
  1195. End=
  1196. PostCall=
  1197. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1198. // Nothing to do. @NL
  1199. End=
  1200. TemplateName=PQUOTA_LIMITS
  1201. IndLevel=0
  1202. Direction=IN
  1203. Locals=
  1204. End=
  1205. PreCall=
  1206. @TypeStructPtrINPreCall
  1207. //
  1208. // Sign-extend the working set size
  1209. //
  1210. if (WOW64_ISPTR (@ArgHostName)) {
  1211. if (@ArgName->MinimumWorkingSetSize == 0xffffffff) {
  1212. @ArgName->MinimumWorkingSetSize = (SIZE_T) -1;
  1213. }
  1214. if (@ArgName->MaximumWorkingSetSize == 0xffffffff) {
  1215. @ArgName->MaximumWorkingSetSize = (SIZE_T) -1;
  1216. }
  1217. }
  1218. End=
  1219. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1220. ;;
  1221. ;; Types for NtQueryInformationProcess
  1222. ;;
  1223. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1224. TemplateName=PPROCESS_DEVICEMAP_INFORMATION
  1225. IndLevel=0
  1226. Direction=OUT
  1227. AllocSize=
  1228. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION.Query @NL
  1229. AllocSize += LENGTH + sizeof(((PPROCESS_DEVICEMAP_INFORMATION)ProcessInformation)->Query)
  1230. - sizeof(((NT32PROCESS_DEVICEMAP_INFORMATION*)ProcessInformation)->Query); @NL
  1231. End=
  1232. RetSize=
  1233. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1234. RetInfoLen += sizeof(((NT32PROCESS_DEVICEMAP_INFORMATION*)ProcessInformation)->Query); @NL
  1235. End=
  1236. Locals=
  1237. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1238. // Nothing to do. @NL
  1239. End=
  1240. PreCall=
  1241. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1242. // Nothing to do. @NL
  1243. End=
  1244. PostCall=
  1245. // Note: @ArgName(@ArgType) is a PPROCESS_DEVICEMAP_INFORMATION. @NL
  1246. { @NL @Indent(
  1247. // The query side of this structure is not pointer dependent. @NL
  1248. // This it is ok to just copy it over. @NL
  1249. RtlCopyMemory((PVOID)@ArgHostName,(PVOID)@ArgName,sizeof(((NT32PROCESS_DEVICEMAP_INFORMATION*)ProcessInformation)->Query)); @NL
  1250. )}@NL
  1251. End=
  1252. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1253. ;;
  1254. ;; Types for NtQueryInformationThread
  1255. ;;
  1256. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1257. TemplateName=PTHREAD_BASIC_INFORMATION
  1258. NoType=TebBaseAddress
  1259. IndLevel=0
  1260. Direction=OUT
  1261. Locals=
  1262. @TypeStructPtrOUTLocal
  1263. End=
  1264. PreCall=
  1265. @TypeStructPtrOUTPreCall
  1266. if (ARGUMENT_PRESENT(@ArgHostName)) { @Indent(@NL
  1267. @ArgName->TebBaseAddress = (PTEB)((NT32THREAD_BASIC_INFORMATION *)@ArgHostName)->TebBaseAddress; @NL
  1268. )} @NL
  1269. End=
  1270. PostCall=
  1271. @TypeStructPtrOUTPostCall
  1272. if (ARGUMENT_PRESENT(@ArgHostName)) { @Indent(@NL
  1273. ((NT32THREAD_BASIC_INFORMATION *)@ArgHostName)->TebBaseAddress = (NT32PTEB)@ArgName->TebBaseAddress; @NL
  1274. )} @NL
  1275. End=
  1276. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1277. ;;
  1278. ;; Types for NtSetInformationFile
  1279. ;;
  1280. ;;
  1281. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  1282. TemplateName=PFILE_RENAME_INFORMATION
  1283. Also=PFILE_LINK_INFORMATION
  1284. Direction=IN
  1285. IndLevel=0
  1286. Locals=
  1287. // @ArgName(@ArgType) is an IN PFILE_RENAME_INFORMATION or PFILE_LINK_INFORMATION. Nothing to do. @NL
  1288. #if !defined(SETLENGTH) @NL
  1289. #error May only be called from a set thunk @NL
  1290. #endif @NL
  1291. End=
  1292. PreCall=
  1293. // @ArgName(@ArgType) is an IN PFILE_RENAME_INFORMATION or PFILE_LINK_INFORMATION. @NL
  1294. Length = LengthHost;@NL
  1295. if (ARGUMENT_PRESENT(@ArgHostName) && SETLENGTH >= sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1296. if (SETLENGTH < sizeof(@ArgHostTypeInd) ||
  1297. SETLENGTH < ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength + sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1298. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1299. }) @NL
  1300. SETLENGTH = max(sizeof(FILE_LINK_INFORMATION), ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength + FIELD_OFFSET(@ArgTypeInd,FileName)); @NL
  1301. @ArgName = Wow64AllocateTemp(SETLENGTH); @NL
  1302. @ArgName->ReplaceIfExists = ((@ArgHostTypeInd *)@ArgHostName)->ReplaceIfExists; @NL
  1303. @ArgName->RootDirectory = (HANDLE)((@ArgHostTypeInd *)@ArgHostName)->RootDirectory; @NL
  1304. @ArgName->FileNameLength = ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength; @NL
  1305. // Copy the remainder which is not pointer dependent. @NL
  1306. RtlCopyMemory(&@ArgName->FileName,&((@ArgHostTypeInd *)@ArgHostName)->FileName,
  1307. @ArgName->FileNameLength); @NL
  1308. // Thunk the destination filename @NL
  1309. Wow64RedirectFileName(@ArgName->FileName, &@ArgName->FileNameLength);@NL
  1310. )} @NL
  1311. else { @Indent( @NL
  1312. @ArgName = (@ArgType)@ArgHostName; @NL
  1313. )} @NL
  1314. End=
  1315. PostCall=
  1316. // @ArgName(@ArgType) is an IN PFILE_RENAME_INFORMATION. Nothing to do. @NL
  1317. End=
  1318. TemplateName=PFILE_TRACKING_INFORMATION
  1319. Direction=IN
  1320. IndLevel=0
  1321. Locals=
  1322. // @ArgName(@ArgType) is an IN PFILE_TRACKING_INFORMATION. Nothing to do. @NL
  1323. #if !defined(SETLENGTH) @NL
  1324. #error May only be called from a set thunk @NL
  1325. #endif @NL
  1326. End=
  1327. PreCall=
  1328. // @ArgName(@ArgType) is an IN PFILE_TRACKING_INFORMATION. @NL
  1329. Length = LengthHost;@NL
  1330. if (ARGUMENT_PRESENT(@ArgHostName) && SETLENGTH >= sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1331. if (SETLENGTH < sizeof(@ArgHostTypeInd) ||
  1332. SETLENGTH < ((@ArgHostTypeInd *)@ArgHostName)->ObjectInformationLength + sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1333. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1334. }) @NL
  1335. SETLENGTH = max(sizeof(NT32FILE_TRACKING_INFORMATION), ((@ArgHostTypeInd *)@ArgHostName)->ObjectInformationLength + sizeof(@ArgHostTypeInd)); @NL
  1336. @ArgName = Wow64AllocateTemp(SETLENGTH); @NL
  1337. @ArgName->DestinationFile = (HANDLE)((@ArgHostTypeInd *)@ArgHostName)->DestinationFile; @NL
  1338. @ArgName->ObjectInformationLength = ((@ArgHostTypeInd *)@ArgHostName)->ObjectInformationLength; @NL
  1339. // Copy the remainder which is not pointer dependent. @NL
  1340. RtlCopyMemory(&@ArgName->ObjectInformation,&((@ArgHostTypeInd *)@ArgHostName)->ObjectInformation,
  1341. @ArgName->ObjectInformationLength); @NL
  1342. )} @NL
  1343. else { @Indent( @NL
  1344. @ArgName = (@ArgType)@ArgHostName; @NL
  1345. )} @NL
  1346. End=
  1347. PostCall=
  1348. // @ArgName(@ArgType) is an IN PFILE_TRACKING_INFORMATION. Nothing to do. @NL
  1349. End=
  1350. TemplateName=PFILE_MOVE_CLUSTER_INFORMATION
  1351. Direction=IN
  1352. Locals=
  1353. // @ArgName(@ArgType) is an IN PFILE_MOVE_CLUSTER_INFORMATION. Nothing to do. @NL
  1354. #if !defined(SETLENGTH) @NL
  1355. #error May only be called from a set thunk @NL
  1356. #endif @NL
  1357. End=
  1358. PreCall=
  1359. // @ArgName(@ArgType) is an IN PFILE_MOVE_CLUSTER_INFORMATION. @NL
  1360. Length = LengthHost;@NL
  1361. if (ARGUMENT_PRESENT(@ArgHostName) && SETLENGTH >= sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1362. try { @NL
  1363. if (SETLENGTH < sizeof(@ArgHostTypeInd) ||
  1364. SETLENGTH < ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength + sizeof(@ArgHostTypeInd)) { @Indent( @NL
  1365. RtlRaiseStatus(STATUS_INVALID_PARAMETER); @NL
  1366. }) @NL
  1367. SETLENGTH = sizeof(FILE_MOVE_CLUSTER_INFORMATION) + ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength ; @NL
  1368. @ArgName = Wow64AllocateTemp(SETLENGTH); @NL
  1369. @ArgName->ClusterCount = ((@ArgHostTypeInd *)@ArgHostName)->ClusterCount; @NL
  1370. @ArgName->RootDirectory = (HANDLE)((@ArgHostTypeInd *)@ArgHostName)->RootDirectory; @NL
  1371. @ArgName->FileNameLength = ((@ArgHostTypeInd *)@ArgHostName)->FileNameLength; @NL
  1372. // Copy the remainder which is not pointer dependent. @NL
  1373. RtlCopyMemory(&@ArgName->FileName,&((@ArgHostTypeInd *)@ArgHostName)->FileName,
  1374. @ArgName->FileNameLength); @NL
  1375. } except (EXCEPTION_EXECUTE_HANDLER) { @NL
  1376. return GetExceptionCode (); @NL
  1377. }
  1378. )} @NL
  1379. else { @Indent( @NL
  1380. @ArgName = (@ArgType)@ArgHostName; @NL
  1381. )} @NL
  1382. End=
  1383. PostCall=
  1384. // @ArgName(@ArgType) is an IN PFILE_MOVE_CLUSTER_INFORMATION. Nothing to do. @NL
  1385. End=
  1386. TemplateName=PPORT_MESSAGE
  1387. Direction=IN
  1388. Locals=
  1389. // We assume that the 32-bit caller is wow64-aware (like rpcrt4) and is @NL
  1390. // passing 64-bit PPORT_MESSAGES already. @NL
  1391. End=
  1392. PreCall=
  1393. @ArgName = (PPORT_MESSAGE)@ArgNameHost;
  1394. End=
  1395. PostCall=
  1396. // PPORT_MESSAGE already handled
  1397. End=
  1398. TemplateName=PPORT_MESSAGE
  1399. Direction=OUT
  1400. Locals=
  1401. // We assume that the 32-bit caller is wow64-aware (like rpcrt4) and is @NL
  1402. // passing 64-bit PPORT_MESSAGES already. @NL
  1403. End=
  1404. PreCall=
  1405. @ArgName = (PPORT_MESSAGE)@ArgNameHost;
  1406. End=
  1407. PostCall=
  1408. // PPORT_MESSAGE already handled
  1409. End=
  1410. TemplateName=PPORT_MESSAGE
  1411. Direction=IN OUT
  1412. Locals=
  1413. // We assume that the 32-bit caller is wow64-aware (like rpcrt4) and is @NL
  1414. // passing 64-bit PPORT_MESSAGES already. @NL
  1415. End=
  1416. PreCall=
  1417. @ArgName = (PPORT_MESSAGE)@ArgNameHost;
  1418. End=
  1419. PostCall=
  1420. // PPORT_MESSAGE already handled
  1421. End=