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.

2696 lines
67 KiB

  1. /*++ BUILD Version: 0008 // Increment this if a change has global effects
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntexapi.h
  5. Abstract:
  6. This module is the header file for the all the system services that
  7. are contained in the "ex" directory.
  8. Author:
  9. David N. Cutler (davec) 5-May-1989
  10. Revision History:
  11. --*/
  12. #ifndef _NTEXAPI_
  13. #define _NTEXAPI_
  14. #if _MSC_VER > 1000
  15. #pragma once
  16. #endif
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. //
  21. // Delay thread execution.
  22. //
  23. NTSYSCALLAPI
  24. NTSTATUS
  25. NTAPI
  26. NtDelayExecution (
  27. IN BOOLEAN Alertable,
  28. IN PLARGE_INTEGER DelayInterval
  29. );
  30. //
  31. // Query and set system environment variables.
  32. //
  33. NTSYSCALLAPI
  34. NTSTATUS
  35. NTAPI
  36. NtQuerySystemEnvironmentValue (
  37. IN PUNICODE_STRING VariableName,
  38. OUT PWSTR VariableValue,
  39. IN USHORT ValueLength,
  40. OUT PUSHORT ReturnLength OPTIONAL
  41. );
  42. NTSYSCALLAPI
  43. NTSTATUS
  44. NTAPI
  45. NtSetSystemEnvironmentValue (
  46. IN PUNICODE_STRING VariableName,
  47. IN PUNICODE_STRING VariableValue
  48. );
  49. NTSYSCALLAPI
  50. NTSTATUS
  51. NTAPI
  52. NtQuerySystemEnvironmentValueEx (
  53. IN PUNICODE_STRING VariableName,
  54. IN LPGUID VendorGuid,
  55. OUT PVOID Value,
  56. IN OUT PULONG ValueLength,
  57. OUT PULONG Attributes OPTIONAL
  58. );
  59. NTSYSCALLAPI
  60. NTSTATUS
  61. NTAPI
  62. NtSetSystemEnvironmentValueEx (
  63. IN PUNICODE_STRING VariableName,
  64. IN LPGUID VendorGuid,
  65. IN PVOID Value,
  66. IN ULONG ValueLength,
  67. IN ULONG Attributes
  68. );
  69. NTSYSCALLAPI
  70. NTSTATUS
  71. NTAPI
  72. NtEnumerateSystemEnvironmentValuesEx (
  73. IN ULONG InformationClass,
  74. OUT PVOID Buffer,
  75. IN OUT PULONG BufferLength
  76. );
  77. // begin_nthal
  78. #define VARIABLE_ATTRIBUTE_NON_VOLATILE 0x00000001
  79. #define VARIABLE_INFORMATION_NAMES 1
  80. #define VARIABLE_INFORMATION_VALUES 2
  81. typedef struct _VARIABLE_NAME {
  82. ULONG NextEntryOffset;
  83. GUID VendorGuid;
  84. WCHAR Name[ANYSIZE_ARRAY];
  85. } VARIABLE_NAME, *PVARIABLE_NAME;
  86. typedef struct _VARIABLE_NAME_AND_VALUE {
  87. ULONG NextEntryOffset;
  88. ULONG ValueOffset;
  89. ULONG ValueLength;
  90. ULONG Attributes;
  91. GUID VendorGuid;
  92. WCHAR Name[ANYSIZE_ARRAY];
  93. //UCHAR Value[ANYSIZE_ARRAY];
  94. } VARIABLE_NAME_AND_VALUE, *PVARIABLE_NAME_AND_VALUE;
  95. // end_nthal
  96. //
  97. // Boot entry management APIs.
  98. //
  99. typedef struct _FILE_PATH {
  100. ULONG Version;
  101. ULONG Length;
  102. ULONG Type;
  103. UCHAR FilePath[ANYSIZE_ARRAY];
  104. } FILE_PATH, *PFILE_PATH;
  105. #define FILE_PATH_VERSION 1
  106. #define FILE_PATH_TYPE_ARC 1
  107. #define FILE_PATH_TYPE_ARC_SIGNATURE 2
  108. #define FILE_PATH_TYPE_NT 3
  109. #define FILE_PATH_TYPE_EFI 4
  110. #define FILE_PATH_TYPE_MIN FILE_PATH_TYPE_ARC
  111. #define FILE_PATH_TYPE_MAX FILE_PATH_TYPE_EFI
  112. typedef struct _WINDOWS_OS_OPTIONS {
  113. UCHAR Signature[8];
  114. ULONG Version;
  115. ULONG Length;
  116. ULONG OsLoadPathOffset;
  117. WCHAR OsLoadOptions[ANYSIZE_ARRAY];
  118. //FILE_PATH OsLoadPath;
  119. } WINDOWS_OS_OPTIONS, *PWINDOWS_OS_OPTIONS;
  120. #define WINDOWS_OS_OPTIONS_SIGNATURE "WINDOWS"
  121. #define WINDOWS_OS_OPTIONS_VERSION 1
  122. typedef struct _BOOT_ENTRY {
  123. ULONG Version;
  124. ULONG Length;
  125. ULONG Id;
  126. ULONG Attributes;
  127. ULONG FriendlyNameOffset;
  128. ULONG BootFilePathOffset;
  129. ULONG OsOptionsLength;
  130. UCHAR OsOptions[ANYSIZE_ARRAY];
  131. //WCHAR FriendlyName[ANYSIZE_ARRAY];
  132. //FILE_PATH BootFilePath;
  133. } BOOT_ENTRY, *PBOOT_ENTRY;
  134. #define BOOT_ENTRY_VERSION 1
  135. #define BOOT_ENTRY_ATTRIBUTE_ACTIVE 0x00000001
  136. #define BOOT_ENTRY_ATTRIBUTE_DEFAULT 0x00000002
  137. #define BOOT_ENTRY_ATTRIBUTE_WINDOWS 0x00000004
  138. #define BOOT_ENTRY_ATTRIBUTE_REMOVABLE_MEDIA 0x00000008
  139. #define BOOT_ENTRY_ATTRIBUTE_VALID_BITS ( \
  140. BOOT_ENTRY_ATTRIBUTE_ACTIVE | \
  141. BOOT_ENTRY_ATTRIBUTE_DEFAULT \
  142. )
  143. typedef struct _BOOT_OPTIONS {
  144. ULONG Version;
  145. ULONG Length;
  146. ULONG Timeout;
  147. ULONG CurrentBootEntryId;
  148. ULONG NextBootEntryId;
  149. WCHAR HeadlessRedirection[ANYSIZE_ARRAY];
  150. } BOOT_OPTIONS, *PBOOT_OPTIONS;
  151. #define BOOT_OPTIONS_VERSION 1
  152. #define BOOT_OPTIONS_FIELD_TIMEOUT 0x00000001
  153. #define BOOT_OPTIONS_FIELD_NEXT_BOOT_ENTRY_ID 0x00000002
  154. #define BOOT_OPTIONS_FIELD_HEADLESS_REDIRECTION 0x00000004
  155. NTSYSCALLAPI
  156. NTSTATUS
  157. NTAPI
  158. NtAddBootEntry (
  159. IN PBOOT_ENTRY BootEntry,
  160. OUT PULONG Id OPTIONAL
  161. );
  162. NTSYSCALLAPI
  163. NTSTATUS
  164. NTAPI
  165. NtDeleteBootEntry (
  166. IN ULONG Id
  167. );
  168. NTSYSCALLAPI
  169. NTSTATUS
  170. NTAPI
  171. NtModifyBootEntry (
  172. IN PBOOT_ENTRY BootEntry
  173. );
  174. NTSYSCALLAPI
  175. NTSTATUS
  176. NTAPI
  177. NtEnumerateBootEntries (
  178. OUT PVOID Buffer,
  179. IN OUT PULONG BufferLength
  180. );
  181. typedef struct _BOOT_ENTRY_LIST {
  182. ULONG NextEntryOffset;
  183. BOOT_ENTRY BootEntry;
  184. } BOOT_ENTRY_LIST, *PBOOT_ENTRY_LIST;
  185. NTSYSCALLAPI
  186. NTSTATUS
  187. NTAPI
  188. NtQueryBootEntryOrder (
  189. OUT PULONG Ids,
  190. IN OUT PULONG Count
  191. );
  192. NTSYSCALLAPI
  193. NTSTATUS
  194. NTAPI
  195. NtSetBootEntryOrder (
  196. IN PULONG Ids,
  197. IN ULONG Count
  198. );
  199. NTSYSCALLAPI
  200. NTSTATUS
  201. NTAPI
  202. NtQueryBootOptions (
  203. OUT PBOOT_OPTIONS BootOptions,
  204. IN OUT PULONG BootOptionsLength
  205. );
  206. NTSYSCALLAPI
  207. NTSTATUS
  208. NTAPI
  209. NtSetBootOptions (
  210. IN PBOOT_OPTIONS BootOptions,
  211. IN ULONG FieldsToChange
  212. );
  213. #define BOOT_OPTIONS_FIELD_COUNTDOWN 0x00000001
  214. #define BOOT_OPTIONS_FIELD_NEXT_BOOT_ENTRY_ID 0x00000002
  215. #define BOOT_OPTIONS_FIELD_HEADLESS_REDIRECTION 0x00000004
  216. NTSYSCALLAPI
  217. NTSTATUS
  218. NTAPI
  219. NtTranslateFilePath (
  220. IN PFILE_PATH InputFilePath,
  221. IN ULONG OutputType,
  222. OUT PFILE_PATH OutputFilePath,
  223. IN OUT PULONG OutputFilePathLength
  224. );
  225. //
  226. // Driver entry management APIs.
  227. //
  228. typedef struct _EFI_DRIVER_ENTRY {
  229. ULONG Version;
  230. ULONG Length;
  231. ULONG Id;
  232. ULONG FriendlyNameOffset;
  233. ULONG DriverFilePathOffset;
  234. //WCHAR FriendlyName[ANYSIZE_ARRAY];
  235. //FILE_PATH DriverFilePath;
  236. } EFI_DRIVER_ENTRY, *PEFI_DRIVER_ENTRY;
  237. typedef struct _EFI_DRIVER_ENTRY_LIST {
  238. ULONG NextEntryOffset;
  239. EFI_DRIVER_ENTRY DriverEntry;
  240. } EFI_DRIVER_ENTRY_LIST, *PEFI_DRIVER_ENTRY_LIST;
  241. #define EFI_DRIVER_ENTRY_VERSION 1
  242. NTSYSCALLAPI
  243. NTSTATUS
  244. NTAPI
  245. NtAddDriverEntry (
  246. IN PEFI_DRIVER_ENTRY DriverEntry,
  247. OUT PULONG Id OPTIONAL
  248. );
  249. NTSYSCALLAPI
  250. NTSTATUS
  251. NTAPI
  252. NtDeleteDriverEntry (
  253. IN ULONG Id
  254. );
  255. NTSYSCALLAPI
  256. NTSTATUS
  257. NTAPI
  258. NtModifyDriverEntry (
  259. IN PEFI_DRIVER_ENTRY DriverEntry
  260. );
  261. NTSYSCALLAPI
  262. NTSTATUS
  263. NTAPI
  264. NtEnumerateDriverEntries (
  265. OUT PVOID Buffer,
  266. IN OUT PULONG BufferLength
  267. );
  268. NTSYSCALLAPI
  269. NTSTATUS
  270. NTAPI
  271. NtQueryDriverEntryOrder (
  272. OUT PULONG Ids,
  273. IN OUT PULONG Count
  274. );
  275. NTSYSCALLAPI
  276. NTSTATUS
  277. NTAPI
  278. NtSetDriverEntryOrder (
  279. IN PULONG Ids,
  280. IN ULONG Count
  281. );
  282. // begin_ntifs begin_wdm begin_ntddk
  283. //
  284. // Event Specific Access Rights.
  285. //
  286. #define EVENT_QUERY_STATE 0x0001
  287. #define EVENT_MODIFY_STATE 0x0002 // winnt
  288. #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) // winnt
  289. // end_ntifs end_wdm end_ntddk
  290. //
  291. // Event Information Classes.
  292. //
  293. typedef enum _EVENT_INFORMATION_CLASS {
  294. EventBasicInformation
  295. } EVENT_INFORMATION_CLASS;
  296. //
  297. // Event Information Structures.
  298. //
  299. typedef struct _EVENT_BASIC_INFORMATION {
  300. EVENT_TYPE EventType;
  301. LONG EventState;
  302. } EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
  303. //
  304. // Event object function definitions.
  305. //
  306. NTSYSCALLAPI
  307. NTSTATUS
  308. NTAPI
  309. NtClearEvent (
  310. IN HANDLE EventHandle
  311. );
  312. NTSYSCALLAPI
  313. NTSTATUS
  314. NTAPI
  315. NtCreateEvent (
  316. OUT PHANDLE EventHandle,
  317. IN ACCESS_MASK DesiredAccess,
  318. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  319. IN EVENT_TYPE EventType,
  320. IN BOOLEAN InitialState
  321. );
  322. NTSYSCALLAPI
  323. NTSTATUS
  324. NTAPI
  325. NtOpenEvent (
  326. OUT PHANDLE EventHandle,
  327. IN ACCESS_MASK DesiredAccess,
  328. IN POBJECT_ATTRIBUTES ObjectAttributes
  329. );
  330. NTSYSCALLAPI
  331. NTSTATUS
  332. NTAPI
  333. NtPulseEvent (
  334. IN HANDLE EventHandle,
  335. OUT PLONG PreviousState OPTIONAL
  336. );
  337. NTSYSCALLAPI
  338. NTSTATUS
  339. NTAPI
  340. NtQueryEvent (
  341. IN HANDLE EventHandle,
  342. IN EVENT_INFORMATION_CLASS EventInformationClass,
  343. OUT PVOID EventInformation,
  344. IN ULONG EventInformationLength,
  345. OUT PULONG ReturnLength OPTIONAL
  346. );
  347. NTSYSCALLAPI
  348. NTSTATUS
  349. NTAPI
  350. NtResetEvent (
  351. IN HANDLE EventHandle,
  352. OUT PLONG PreviousState OPTIONAL
  353. );
  354. NTSYSCALLAPI
  355. NTSTATUS
  356. NTAPI
  357. NtSetEvent (
  358. IN HANDLE EventHandle,
  359. OUT PLONG PreviousState OPTIONAL
  360. );
  361. NTSYSCALLAPI
  362. NTSTATUS
  363. NTAPI
  364. NtSetEventBoostPriority (
  365. IN HANDLE EventHandle
  366. );
  367. //
  368. // Event Specific Access Rights.
  369. //
  370. #define EVENT_PAIR_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE)
  371. //
  372. // Event pair object function definitions.
  373. //
  374. NTSYSCALLAPI
  375. NTSTATUS
  376. NTAPI
  377. NtCreateEventPair (
  378. OUT PHANDLE EventPairHandle,
  379. IN ACCESS_MASK DesiredAccess,
  380. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL
  381. );
  382. NTSYSCALLAPI
  383. NTSTATUS
  384. NTAPI
  385. NtOpenEventPair(
  386. OUT PHANDLE EventPairHandle,
  387. IN ACCESS_MASK DesiredAccess,
  388. IN POBJECT_ATTRIBUTES ObjectAttributes
  389. );
  390. NTSYSCALLAPI
  391. NTSTATUS
  392. NTAPI
  393. NtWaitLowEventPair(
  394. IN HANDLE EventPairHandle
  395. );
  396. NTSYSCALLAPI
  397. NTSTATUS
  398. NTAPI
  399. NtWaitHighEventPair(
  400. IN HANDLE EventPairHandle
  401. );
  402. NTSYSCALLAPI
  403. NTSTATUS
  404. NTAPI
  405. NtSetLowWaitHighEventPair(
  406. IN HANDLE EventPairHandle
  407. );
  408. NTSYSCALLAPI
  409. NTSTATUS
  410. NTAPI
  411. NtSetHighWaitLowEventPair(
  412. IN HANDLE EventPairHandle
  413. );
  414. NTSYSCALLAPI
  415. NTSTATUS
  416. NTAPI
  417. NtSetLowEventPair(
  418. IN HANDLE EventPairHandle
  419. );
  420. NTSYSCALLAPI
  421. NTSTATUS
  422. NTAPI
  423. NtSetHighEventPair(
  424. IN HANDLE EventPairHandle
  425. );
  426. //
  427. // Mutant Specific Access Rights.
  428. //
  429. // begin_winnt
  430. #define MUTANT_QUERY_STATE 0x0001
  431. #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\
  432. MUTANT_QUERY_STATE)
  433. // end_winnt
  434. //
  435. // Mutant Information Classes.
  436. //
  437. typedef enum _MUTANT_INFORMATION_CLASS {
  438. MutantBasicInformation
  439. } MUTANT_INFORMATION_CLASS;
  440. //
  441. // Mutant Information Structures.
  442. //
  443. typedef struct _MUTANT_BASIC_INFORMATION {
  444. LONG CurrentCount;
  445. BOOLEAN OwnedByCaller;
  446. BOOLEAN AbandonedState;
  447. } MUTANT_BASIC_INFORMATION, *PMUTANT_BASIC_INFORMATION;
  448. //
  449. // Mutant object function definitions.
  450. //
  451. NTSYSCALLAPI
  452. NTSTATUS
  453. NTAPI
  454. NtCreateMutant (
  455. OUT PHANDLE MutantHandle,
  456. IN ACCESS_MASK DesiredAccess,
  457. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  458. IN BOOLEAN InitialOwner
  459. );
  460. NTSYSCALLAPI
  461. NTSTATUS
  462. NTAPI
  463. NtOpenMutant (
  464. OUT PHANDLE MutantHandle,
  465. IN ACCESS_MASK DesiredAccess,
  466. IN POBJECT_ATTRIBUTES ObjectAttributes
  467. );
  468. NTSYSCALLAPI
  469. NTSTATUS
  470. NTAPI
  471. NtQueryMutant (
  472. IN HANDLE MutantHandle,
  473. IN MUTANT_INFORMATION_CLASS MutantInformationClass,
  474. OUT PVOID MutantInformation,
  475. IN ULONG MutantInformationLength,
  476. OUT PULONG ReturnLength OPTIONAL
  477. );
  478. NTSYSCALLAPI
  479. NTSTATUS
  480. NTAPI
  481. NtReleaseMutant (
  482. IN HANDLE MutantHandle,
  483. OUT PLONG PreviousCount OPTIONAL
  484. );
  485. // begin_ntifs begin_wdm begin_ntddk
  486. //
  487. // Semaphore Specific Access Rights.
  488. //
  489. #define SEMAPHORE_QUERY_STATE 0x0001
  490. #define SEMAPHORE_MODIFY_STATE 0x0002 // winnt
  491. #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) // winnt
  492. // end_ntifs end_wdm end_ntddk
  493. //
  494. // Semaphore Information Classes.
  495. //
  496. typedef enum _SEMAPHORE_INFORMATION_CLASS {
  497. SemaphoreBasicInformation
  498. } SEMAPHORE_INFORMATION_CLASS;
  499. //
  500. // Semaphore Information Structures.
  501. //
  502. typedef struct _SEMAPHORE_BASIC_INFORMATION {
  503. LONG CurrentCount;
  504. LONG MaximumCount;
  505. } SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
  506. //
  507. // Semaphore object function definitions.
  508. //
  509. NTSYSCALLAPI
  510. NTSTATUS
  511. NTAPI
  512. NtCreateSemaphore (
  513. OUT PHANDLE SemaphoreHandle,
  514. IN ACCESS_MASK DesiredAccess,
  515. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  516. IN LONG InitialCount,
  517. IN LONG MaximumCount
  518. );
  519. NTSYSCALLAPI
  520. NTSTATUS
  521. NTAPI
  522. NtOpenSemaphore(
  523. OUT PHANDLE SemaphoreHandle,
  524. IN ACCESS_MASK DesiredAccess,
  525. IN POBJECT_ATTRIBUTES ObjectAttributes
  526. );
  527. NTSYSCALLAPI
  528. NTSTATUS
  529. NTAPI
  530. NtQuerySemaphore (
  531. IN HANDLE SemaphoreHandle,
  532. IN SEMAPHORE_INFORMATION_CLASS SemaphoreInformationClass,
  533. OUT PVOID SemaphoreInformation,
  534. IN ULONG SemaphoreInformationLength,
  535. OUT PULONG ReturnLength OPTIONAL
  536. );
  537. NTSYSCALLAPI
  538. NTSTATUS
  539. NTAPI
  540. NtReleaseSemaphore(
  541. IN HANDLE SemaphoreHandle,
  542. IN LONG ReleaseCount,
  543. OUT PLONG PreviousCount OPTIONAL
  544. );
  545. // begin_winnt
  546. //
  547. // Timer Specific Access Rights.
  548. //
  549. #define TIMER_QUERY_STATE 0x0001
  550. #define TIMER_MODIFY_STATE 0x0002
  551. #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\
  552. TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
  553. // end_winnt
  554. //
  555. // Timer Information Classes.
  556. //
  557. typedef enum _TIMER_INFORMATION_CLASS {
  558. TimerBasicInformation
  559. } TIMER_INFORMATION_CLASS;
  560. //
  561. // Timer Information Structures.
  562. //
  563. typedef struct _TIMER_BASIC_INFORMATION {
  564. LARGE_INTEGER RemainingTime;
  565. BOOLEAN TimerState;
  566. } TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
  567. // begin_ntddk
  568. //
  569. // Timer APC routine definition.
  570. //
  571. typedef
  572. VOID
  573. (*PTIMER_APC_ROUTINE) (
  574. IN PVOID TimerContext,
  575. IN ULONG TimerLowValue,
  576. IN LONG TimerHighValue
  577. );
  578. // end_ntddk
  579. //
  580. // Timer object function definitions.
  581. //
  582. NTSYSCALLAPI
  583. NTSTATUS
  584. NTAPI
  585. NtCreateTimer (
  586. OUT PHANDLE TimerHandle,
  587. IN ACCESS_MASK DesiredAccess,
  588. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  589. IN TIMER_TYPE TimerType
  590. );
  591. NTSYSCALLAPI
  592. NTSTATUS
  593. NTAPI
  594. NtOpenTimer (
  595. OUT PHANDLE TimerHandle,
  596. IN ACCESS_MASK DesiredAccess,
  597. IN POBJECT_ATTRIBUTES ObjectAttributes
  598. );
  599. NTSYSCALLAPI
  600. NTSTATUS
  601. NTAPI
  602. NtCancelTimer (
  603. IN HANDLE TimerHandle,
  604. OUT PBOOLEAN CurrentState OPTIONAL
  605. );
  606. NTSYSCALLAPI
  607. NTSTATUS
  608. NTAPI
  609. NtQueryTimer (
  610. IN HANDLE TimerHandle,
  611. IN TIMER_INFORMATION_CLASS TimerInformationClass,
  612. OUT PVOID TimerInformation,
  613. IN ULONG TimerInformationLength,
  614. OUT PULONG ReturnLength OPTIONAL
  615. );
  616. NTSYSCALLAPI
  617. NTSTATUS
  618. NTAPI
  619. NtSetTimer (
  620. IN HANDLE TimerHandle,
  621. IN PLARGE_INTEGER DueTime,
  622. IN PTIMER_APC_ROUTINE TimerApcRoutine OPTIONAL,
  623. IN PVOID TimerContext OPTIONAL,
  624. IN BOOLEAN ResumeTimer,
  625. IN LONG Period OPTIONAL,
  626. OUT PBOOLEAN PreviousState OPTIONAL
  627. );
  628. //
  629. // System Time and Timer function definitions
  630. //
  631. NTSYSCALLAPI
  632. NTSTATUS
  633. NTAPI
  634. NtQuerySystemTime (
  635. OUT PLARGE_INTEGER SystemTime
  636. );
  637. NTSYSCALLAPI
  638. NTSTATUS
  639. NTAPI
  640. NtSetSystemTime (
  641. IN PLARGE_INTEGER SystemTime,
  642. OUT PLARGE_INTEGER PreviousTime OPTIONAL
  643. );
  644. NTSYSCALLAPI
  645. NTSTATUS
  646. NTAPI
  647. NtQueryTimerResolution (
  648. OUT PULONG MaximumTime,
  649. OUT PULONG MinimumTime,
  650. OUT PULONG CurrentTime
  651. );
  652. NTSYSCALLAPI
  653. NTSTATUS
  654. NTAPI
  655. NtSetTimerResolution (
  656. IN ULONG DesiredTime,
  657. IN BOOLEAN SetResolution,
  658. OUT PULONG ActualTime
  659. );
  660. //
  661. // Locally Unique Identifier (LUID) allocation
  662. //
  663. NTSYSCALLAPI
  664. NTSTATUS
  665. NTAPI
  666. NtAllocateLocallyUniqueId(
  667. OUT PLUID Luid
  668. );
  669. //
  670. // Universally Unique Identifier (UUID) time allocation
  671. //
  672. NTSYSCALLAPI
  673. NTSTATUS
  674. NTAPI
  675. NtSetUuidSeed (
  676. IN PCHAR Seed
  677. );
  678. NTSYSCALLAPI
  679. NTSTATUS
  680. NTAPI
  681. NtAllocateUuids(
  682. OUT PULARGE_INTEGER Time,
  683. OUT PULONG Range,
  684. OUT PULONG Sequence,
  685. OUT PCHAR Seed
  686. );
  687. //
  688. // Profile Object Definitions
  689. //
  690. #define PROFILE_CONTROL 0x0001
  691. #define PROFILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | PROFILE_CONTROL)
  692. NTSYSCALLAPI
  693. NTSTATUS
  694. NTAPI
  695. NtCreateProfile (
  696. OUT PHANDLE ProfileHandle,
  697. IN HANDLE Process OPTIONAL,
  698. IN PVOID ProfileBase,
  699. IN SIZE_T ProfileSize,
  700. IN ULONG BucketSize,
  701. IN PULONG Buffer,
  702. IN ULONG BufferSize,
  703. IN KPROFILE_SOURCE ProfileSource,
  704. IN KAFFINITY Affinity
  705. );
  706. NTSYSCALLAPI
  707. NTSTATUS
  708. NTAPI
  709. NtStartProfile (
  710. IN HANDLE ProfileHandle
  711. );
  712. NTSYSCALLAPI
  713. NTSTATUS
  714. NTAPI
  715. NtStopProfile (
  716. IN HANDLE ProfileHandle
  717. );
  718. NTSYSCALLAPI
  719. NTSTATUS
  720. NTAPI
  721. NtSetIntervalProfile (
  722. IN ULONG Interval,
  723. IN KPROFILE_SOURCE Source
  724. );
  725. NTSYSCALLAPI
  726. NTSTATUS
  727. NTAPI
  728. NtQueryIntervalProfile (
  729. IN KPROFILE_SOURCE ProfileSource,
  730. OUT PULONG Interval
  731. );
  732. //
  733. // Performance Counter Definitions
  734. //
  735. NTSYSCALLAPI
  736. NTSTATUS
  737. NTAPI
  738. NtQueryPerformanceCounter (
  739. OUT PLARGE_INTEGER PerformanceCounter,
  740. OUT PLARGE_INTEGER PerformanceFrequency OPTIONAL
  741. );
  742. #define KEYEDEVENT_WAIT 0x0001
  743. #define KEYEDEVENT_WAKE 0x0002
  744. #define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | KEYEDEVENT_WAIT | KEYEDEVENT_WAKE)
  745. NTSYSCALLAPI
  746. NTSTATUS
  747. NTAPI
  748. NtCreateKeyedEvent (
  749. OUT PHANDLE KeyedEventHandle,
  750. IN ACCESS_MASK DesiredAccess,
  751. IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
  752. IN ULONG Flags
  753. );
  754. NTSYSCALLAPI
  755. NTSTATUS
  756. NTAPI
  757. NtOpenKeyedEvent (
  758. OUT PHANDLE KeyedEventHandle,
  759. IN ACCESS_MASK DesiredAccess,
  760. IN POBJECT_ATTRIBUTES ObjectAttributes
  761. );
  762. NTSYSCALLAPI
  763. NTSTATUS
  764. NTAPI
  765. NtReleaseKeyedEvent (
  766. IN HANDLE KeyedEventHandle,
  767. IN PVOID KeyValue,
  768. IN BOOLEAN Alertable,
  769. IN PLARGE_INTEGER Timeout OPTIONAL
  770. );
  771. NTSYSCALLAPI
  772. NTSTATUS
  773. NTAPI
  774. NtWaitForKeyedEvent (
  775. IN HANDLE KeyedEventHandle,
  776. IN PVOID KeyValue,
  777. IN BOOLEAN Alertable,
  778. IN PLARGE_INTEGER Timeout OPTIONAL
  779. );
  780. //
  781. // Nt Api Profile Definitions
  782. //
  783. //
  784. // Nt Api Profiling data structure
  785. //
  786. typedef struct _NAPDATA {
  787. ULONG NapLock;
  788. ULONG Calls;
  789. ULONG TimingErrors;
  790. LARGE_INTEGER TotalTime;
  791. LARGE_INTEGER FirstTime;
  792. LARGE_INTEGER MaxTime;
  793. LARGE_INTEGER MinTime;
  794. } NAPDATA, *PNAPDATA;
  795. NTSTATUS
  796. NapClearData (
  797. VOID
  798. );
  799. NTSTATUS
  800. NapRetrieveData (
  801. OUT NAPDATA *NapApiData,
  802. OUT PCHAR **NapApiNames,
  803. OUT PLARGE_INTEGER *NapCounterFrequency
  804. );
  805. NTSTATUS
  806. NapGetApiCount (
  807. OUT PULONG NapApiCount
  808. );
  809. NTSTATUS
  810. NapPause (
  811. VOID
  812. );
  813. NTSTATUS
  814. NapResume (
  815. VOID
  816. );
  817. // begin_ntifs begin_ntddk
  818. //
  819. // Driver Verifier Definitions
  820. //
  821. typedef ULONG_PTR (*PDRIVER_VERIFIER_THUNK_ROUTINE) (
  822. IN PVOID Context
  823. );
  824. //
  825. // This structure is passed in by drivers that want to thunk callers of
  826. // their exports.
  827. //
  828. typedef struct _DRIVER_VERIFIER_THUNK_PAIRS {
  829. PDRIVER_VERIFIER_THUNK_ROUTINE PristineRoutine;
  830. PDRIVER_VERIFIER_THUNK_ROUTINE NewRoutine;
  831. } DRIVER_VERIFIER_THUNK_PAIRS, *PDRIVER_VERIFIER_THUNK_PAIRS;
  832. //
  833. // Driver Verifier flags.
  834. //
  835. #define DRIVER_VERIFIER_SPECIAL_POOLING 0x0001
  836. #define DRIVER_VERIFIER_FORCE_IRQL_CHECKING 0x0002
  837. #define DRIVER_VERIFIER_INJECT_ALLOCATION_FAILURES 0x0004
  838. #define DRIVER_VERIFIER_TRACK_POOL_ALLOCATIONS 0x0008
  839. #define DRIVER_VERIFIER_IO_CHECKING 0x0010
  840. // end_ntifs end_ntddk
  841. #define DRIVER_VERIFIER_DEADLOCK_DETECTION 0x0020
  842. #define DRIVER_VERIFIER_ENHANCED_IO_CHECKING 0x0040
  843. #define DRIVER_VERIFIER_DMA_VERIFIER 0x0080
  844. #define DRIVER_VERIFIER_HARDWARE_VERIFICATION 0x0100
  845. #define DRIVER_VERIFIER_SYSTEM_BIOS_VERIFICATION 0x0200
  846. #define DRIVER_VERIFIER_EXPOSE_IRP_HISTORY 0x0400
  847. //
  848. // System Information Classes.
  849. //
  850. typedef enum _SYSTEM_INFORMATION_CLASS {
  851. SystemBasicInformation,
  852. SystemProcessorInformation, // obsolete...delete
  853. SystemPerformanceInformation,
  854. SystemTimeOfDayInformation,
  855. SystemPathInformation,
  856. SystemProcessInformation,
  857. SystemCallCountInformation,
  858. SystemDeviceInformation,
  859. SystemProcessorPerformanceInformation,
  860. SystemFlagsInformation,
  861. SystemCallTimeInformation,
  862. SystemModuleInformation,
  863. SystemLocksInformation,
  864. SystemStackTraceInformation,
  865. SystemPagedPoolInformation,
  866. SystemNonPagedPoolInformation,
  867. SystemHandleInformation,
  868. SystemObjectInformation,
  869. SystemPageFileInformation,
  870. SystemVdmInstemulInformation,
  871. SystemVdmBopInformation,
  872. SystemFileCacheInformation,
  873. SystemPoolTagInformation,
  874. SystemInterruptInformation,
  875. SystemDpcBehaviorInformation,
  876. SystemFullMemoryInformation,
  877. SystemLoadGdiDriverInformation,
  878. SystemUnloadGdiDriverInformation,
  879. SystemTimeAdjustmentInformation,
  880. SystemSummaryMemoryInformation,
  881. SystemMirrorMemoryInformation,
  882. SystemPerformanceTraceInformation,
  883. SystemObsolete0,
  884. SystemExceptionInformation,
  885. SystemCrashDumpStateInformation,
  886. SystemKernelDebuggerInformation,
  887. SystemContextSwitchInformation,
  888. SystemRegistryQuotaInformation,
  889. SystemExtendServiceTableInformation,
  890. SystemPrioritySeperation,
  891. SystemVerifierAddDriverInformation,
  892. SystemVerifierRemoveDriverInformation,
  893. SystemProcessorIdleInformation,
  894. SystemLegacyDriverInformation,
  895. SystemCurrentTimeZoneInformation,
  896. SystemLookasideInformation,
  897. SystemTimeSlipNotification,
  898. SystemSessionCreate,
  899. SystemSessionDetach,
  900. SystemSessionInformation,
  901. SystemRangeStartInformation,
  902. SystemVerifierInformation,
  903. SystemVerifierThunkExtend,
  904. SystemSessionProcessInformation,
  905. SystemLoadGdiDriverInSystemSpace,
  906. SystemNumaProcessorMap,
  907. SystemPrefetcherInformation,
  908. SystemExtendedProcessInformation,
  909. SystemRecommendedSharedDataAlignment,
  910. SystemComPlusPackage,
  911. SystemNumaAvailableMemory,
  912. SystemProcessorPowerInformation,
  913. SystemEmulationBasicInformation,
  914. SystemEmulationProcessorInformation,
  915. SystemExtendedHandleInformation,
  916. SystemLostDelayedWriteInformation,
  917. SystemBigPoolInformation,
  918. SystemSessionPoolTagInformation,
  919. SystemSessionMappedViewInformation,
  920. SystemHotpatchInformation,
  921. SystemObjectSecurityMode,
  922. SystemWatchdogTimerHandler,
  923. SystemWatchdogTimerInformation,
  924. SystemLogicalProcessorInformation,
  925. MaxSystemInfoClass // MaxSystemInfoClass should always be the last enum
  926. } SYSTEM_INFORMATION_CLASS;
  927. //
  928. // System Information Structures.
  929. //
  930. // begin_winnt
  931. #define TIME_ZONE_ID_UNKNOWN 0
  932. #define TIME_ZONE_ID_STANDARD 1
  933. #define TIME_ZONE_ID_DAYLIGHT 2
  934. // end_winnt
  935. typedef struct _SYSTEM_VDM_INSTEMUL_INFO {
  936. ULONG SegmentNotPresent ;
  937. ULONG VdmOpcode0F ;
  938. ULONG OpcodeESPrefix ;
  939. ULONG OpcodeCSPrefix ;
  940. ULONG OpcodeSSPrefix ;
  941. ULONG OpcodeDSPrefix ;
  942. ULONG OpcodeFSPrefix ;
  943. ULONG OpcodeGSPrefix ;
  944. ULONG OpcodeOPER32Prefix;
  945. ULONG OpcodeADDR32Prefix;
  946. ULONG OpcodeINSB ;
  947. ULONG OpcodeINSW ;
  948. ULONG OpcodeOUTSB ;
  949. ULONG OpcodeOUTSW ;
  950. ULONG OpcodePUSHF ;
  951. ULONG OpcodePOPF ;
  952. ULONG OpcodeINTnn ;
  953. ULONG OpcodeINTO ;
  954. ULONG OpcodeIRET ;
  955. ULONG OpcodeINBimm ;
  956. ULONG OpcodeINWimm ;
  957. ULONG OpcodeOUTBimm ;
  958. ULONG OpcodeOUTWimm ;
  959. ULONG OpcodeINB ;
  960. ULONG OpcodeINW ;
  961. ULONG OpcodeOUTB ;
  962. ULONG OpcodeOUTW ;
  963. ULONG OpcodeLOCKPrefix ;
  964. ULONG OpcodeREPNEPrefix ;
  965. ULONG OpcodeREPPrefix ;
  966. ULONG OpcodeHLT ;
  967. ULONG OpcodeCLI ;
  968. ULONG OpcodeSTI ;
  969. ULONG BopCount ;
  970. } SYSTEM_VDM_INSTEMUL_INFO, *PSYSTEM_VDM_INSTEMUL_INFO;
  971. typedef struct _SYSTEM_TIMEOFDAY_INFORMATION {
  972. LARGE_INTEGER BootTime;
  973. LARGE_INTEGER CurrentTime;
  974. LARGE_INTEGER TimeZoneBias;
  975. ULONG TimeZoneId;
  976. ULONG Reserved;
  977. ULONGLONG BootTimeBias;
  978. ULONGLONG SleepTimeBias;
  979. } SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;
  980. #if defined(_IA64_)
  981. typedef ULONG SYSINF_PAGE_COUNT;
  982. #else
  983. typedef SIZE_T SYSINF_PAGE_COUNT;
  984. #endif
  985. typedef struct _SYSTEM_BASIC_INFORMATION {
  986. ULONG Reserved;
  987. ULONG TimerResolution;
  988. ULONG PageSize;
  989. SYSINF_PAGE_COUNT NumberOfPhysicalPages;
  990. SYSINF_PAGE_COUNT LowestPhysicalPageNumber;
  991. SYSINF_PAGE_COUNT HighestPhysicalPageNumber;
  992. ULONG AllocationGranularity;
  993. ULONG_PTR MinimumUserModeAddress;
  994. ULONG_PTR MaximumUserModeAddress;
  995. ULONG_PTR ActiveProcessorsAffinityMask;
  996. CCHAR NumberOfProcessors;
  997. } SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
  998. typedef struct _SYSTEM_PROCESSOR_INFORMATION {
  999. USHORT ProcessorArchitecture;
  1000. USHORT ProcessorLevel;
  1001. USHORT ProcessorRevision;
  1002. USHORT Reserved;
  1003. ULONG ProcessorFeatureBits;
  1004. } SYSTEM_PROCESSOR_INFORMATION, *PSYSTEM_PROCESSOR_INFORMATION;
  1005. typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
  1006. LARGE_INTEGER IdleTime;
  1007. LARGE_INTEGER KernelTime;
  1008. LARGE_INTEGER UserTime;
  1009. LARGE_INTEGER DpcTime; // DEVL only
  1010. LARGE_INTEGER InterruptTime; // DEVL only
  1011. ULONG InterruptCount;
  1012. } SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
  1013. typedef struct _SYSTEM_PROCESSOR_IDLE_INFORMATION {
  1014. ULONGLONG IdleTime;
  1015. ULONGLONG C1Time;
  1016. ULONGLONG C2Time;
  1017. ULONGLONG C3Time;
  1018. ULONG C1Transitions;
  1019. ULONG C2Transitions;
  1020. ULONG C3Transitions;
  1021. ULONG Padding;
  1022. } SYSTEM_PROCESSOR_IDLE_INFORMATION, *PSYSTEM_PROCESSOR_IDLE_INFORMATION;
  1023. #define MAXIMUM_NUMA_NODES 16
  1024. typedef struct _SYSTEM_NUMA_INFORMATION {
  1025. ULONG HighestNodeNumber;
  1026. ULONG Reserved;
  1027. union {
  1028. ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES];
  1029. ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES];
  1030. };
  1031. } SYSTEM_NUMA_INFORMATION, *PSYSTEM_NUMA_INFORMATION;
  1032. // begin_winnt
  1033. typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
  1034. RelationProcessorCore,
  1035. RelationNumaNode
  1036. } LOGICAL_PROCESSOR_RELATIONSHIP;
  1037. #define LTP_PC_SMT 0x1
  1038. typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
  1039. ULONG_PTR ProcessorMask;
  1040. LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
  1041. union {
  1042. struct {
  1043. UCHAR Flags;
  1044. } ProcessorCore;
  1045. struct {
  1046. ULONG NodeNumber;
  1047. } NumaNode;
  1048. ULONGLONG Reserved[2];
  1049. };
  1050. } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
  1051. // end_winnt
  1052. typedef struct _SYSTEM_PROCESSOR_POWER_INFORMATION {
  1053. UCHAR CurrentFrequency;
  1054. UCHAR ThermalLimitFrequency;
  1055. UCHAR ConstantThrottleFrequency;
  1056. UCHAR DegradedThrottleFrequency;
  1057. UCHAR LastBusyFrequency;
  1058. UCHAR LastC3Frequency;
  1059. UCHAR LastAdjustedBusyFrequency;
  1060. UCHAR ProcessorMinThrottle;
  1061. UCHAR ProcessorMaxThrottle;
  1062. ULONG NumberOfFrequencies;
  1063. ULONG PromotionCount;
  1064. ULONG DemotionCount;
  1065. ULONG ErrorCount;
  1066. ULONG RetryCount;
  1067. ULONGLONG CurrentFrequencyTime;
  1068. ULONGLONG CurrentProcessorTime;
  1069. ULONGLONG CurrentProcessorIdleTime;
  1070. ULONGLONG LastProcessorTime;
  1071. ULONGLONG LastProcessorIdleTime;
  1072. } SYSTEM_PROCESSOR_POWER_INFORMATION, *PSYSTEM_PROCESSOR_POWER_INFORMATION;
  1073. typedef struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION {
  1074. ULONG TimeAdjustment;
  1075. ULONG TimeIncrement;
  1076. BOOLEAN Enable;
  1077. } SYSTEM_QUERY_TIME_ADJUST_INFORMATION, *PSYSTEM_QUERY_TIME_ADJUST_INFORMATION;
  1078. typedef struct _SYSTEM_SET_TIME_ADJUST_INFORMATION {
  1079. ULONG TimeAdjustment;
  1080. BOOLEAN Enable;
  1081. } SYSTEM_SET_TIME_ADJUST_INFORMATION, *PSYSTEM_SET_TIME_ADJUST_INFORMATION;
  1082. typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
  1083. LARGE_INTEGER IdleProcessTime;
  1084. LARGE_INTEGER IoReadTransferCount;
  1085. LARGE_INTEGER IoWriteTransferCount;
  1086. LARGE_INTEGER IoOtherTransferCount;
  1087. ULONG IoReadOperationCount;
  1088. ULONG IoWriteOperationCount;
  1089. ULONG IoOtherOperationCount;
  1090. ULONG AvailablePages;
  1091. SYSINF_PAGE_COUNT CommittedPages;
  1092. SYSINF_PAGE_COUNT CommitLimit;
  1093. SYSINF_PAGE_COUNT PeakCommitment;
  1094. ULONG PageFaultCount;
  1095. ULONG CopyOnWriteCount;
  1096. ULONG TransitionCount;
  1097. ULONG CacheTransitionCount;
  1098. ULONG DemandZeroCount;
  1099. ULONG PageReadCount;
  1100. ULONG PageReadIoCount;
  1101. ULONG CacheReadCount;
  1102. ULONG CacheIoCount;
  1103. ULONG DirtyPagesWriteCount;
  1104. ULONG DirtyWriteIoCount;
  1105. ULONG MappedPagesWriteCount;
  1106. ULONG MappedWriteIoCount;
  1107. ULONG PagedPoolPages;
  1108. ULONG NonPagedPoolPages;
  1109. ULONG PagedPoolAllocs;
  1110. ULONG PagedPoolFrees;
  1111. ULONG NonPagedPoolAllocs;
  1112. ULONG NonPagedPoolFrees;
  1113. ULONG FreeSystemPtes;
  1114. ULONG ResidentSystemCodePage;
  1115. ULONG TotalSystemDriverPages;
  1116. ULONG TotalSystemCodePages;
  1117. ULONG NonPagedPoolLookasideHits;
  1118. ULONG PagedPoolLookasideHits;
  1119. ULONG AvailablePagedPoolPages;
  1120. ULONG ResidentSystemCachePage;
  1121. ULONG ResidentPagedPoolPage;
  1122. ULONG ResidentSystemDriverPage;
  1123. ULONG CcFastReadNoWait;
  1124. ULONG CcFastReadWait;
  1125. ULONG CcFastReadResourceMiss;
  1126. ULONG CcFastReadNotPossible;
  1127. ULONG CcFastMdlReadNoWait;
  1128. ULONG CcFastMdlReadWait;
  1129. ULONG CcFastMdlReadResourceMiss;
  1130. ULONG CcFastMdlReadNotPossible;
  1131. ULONG CcMapDataNoWait;
  1132. ULONG CcMapDataWait;
  1133. ULONG CcMapDataNoWaitMiss;
  1134. ULONG CcMapDataWaitMiss;
  1135. ULONG CcPinMappedDataCount;
  1136. ULONG CcPinReadNoWait;
  1137. ULONG CcPinReadWait;
  1138. ULONG CcPinReadNoWaitMiss;
  1139. ULONG CcPinReadWaitMiss;
  1140. ULONG CcCopyReadNoWait;
  1141. ULONG CcCopyReadWait;
  1142. ULONG CcCopyReadNoWaitMiss;
  1143. ULONG CcCopyReadWaitMiss;
  1144. ULONG CcMdlReadNoWait;
  1145. ULONG CcMdlReadWait;
  1146. ULONG CcMdlReadNoWaitMiss;
  1147. ULONG CcMdlReadWaitMiss;
  1148. ULONG CcReadAheadIos;
  1149. ULONG CcLazyWriteIos;
  1150. ULONG CcLazyWritePages;
  1151. ULONG CcDataFlushes;
  1152. ULONG CcDataPages;
  1153. ULONG ContextSwitches;
  1154. ULONG FirstLevelTbFills;
  1155. ULONG SecondLevelTbFills;
  1156. ULONG SystemCalls;
  1157. } SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
  1158. typedef struct _SYSTEM_PROCESS_INFORMATION {
  1159. ULONG NextEntryOffset;
  1160. ULONG NumberOfThreads;
  1161. LARGE_INTEGER SpareLi1;
  1162. LARGE_INTEGER SpareLi2;
  1163. LARGE_INTEGER SpareLi3;
  1164. LARGE_INTEGER CreateTime;
  1165. LARGE_INTEGER UserTime;
  1166. LARGE_INTEGER KernelTime;
  1167. UNICODE_STRING ImageName;
  1168. KPRIORITY BasePriority;
  1169. HANDLE UniqueProcessId;
  1170. HANDLE InheritedFromUniqueProcessId;
  1171. ULONG HandleCount;
  1172. ULONG SessionId;
  1173. ULONG_PTR PageDirectoryBase;
  1174. SIZE_T PeakVirtualSize;
  1175. SIZE_T VirtualSize;
  1176. ULONG PageFaultCount;
  1177. SIZE_T PeakWorkingSetSize;
  1178. SIZE_T WorkingSetSize;
  1179. SIZE_T QuotaPeakPagedPoolUsage;
  1180. SIZE_T QuotaPagedPoolUsage;
  1181. SIZE_T QuotaPeakNonPagedPoolUsage;
  1182. SIZE_T QuotaNonPagedPoolUsage;
  1183. SIZE_T PagefileUsage;
  1184. SIZE_T PeakPagefileUsage;
  1185. SIZE_T PrivatePageCount;
  1186. LARGE_INTEGER ReadOperationCount;
  1187. LARGE_INTEGER WriteOperationCount;
  1188. LARGE_INTEGER OtherOperationCount;
  1189. LARGE_INTEGER ReadTransferCount;
  1190. LARGE_INTEGER WriteTransferCount;
  1191. LARGE_INTEGER OtherTransferCount;
  1192. } SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
  1193. typedef struct _SYSTEM_SESSION_PROCESS_INFORMATION {
  1194. ULONG SessionId;
  1195. ULONG SizeOfBuf;
  1196. PVOID Buffer;
  1197. } SYSTEM_SESSION_PROCESS_INFORMATION, *PSYSTEM_SESSION_PROCESS_INFORMATION;
  1198. typedef struct _SYSTEM_THREAD_INFORMATION {
  1199. LARGE_INTEGER KernelTime;
  1200. LARGE_INTEGER UserTime;
  1201. LARGE_INTEGER CreateTime;
  1202. ULONG WaitTime;
  1203. PVOID StartAddress;
  1204. CLIENT_ID ClientId;
  1205. KPRIORITY Priority;
  1206. LONG BasePriority;
  1207. ULONG ContextSwitches;
  1208. ULONG ThreadState;
  1209. ULONG WaitReason;
  1210. } SYSTEM_THREAD_INFORMATION, *PSYSTEM_THREAD_INFORMATION;
  1211. typedef struct _SYSTEM_EXTENDED_THREAD_INFORMATION {
  1212. SYSTEM_THREAD_INFORMATION ThreadInfo;
  1213. PVOID StackBase;
  1214. PVOID StackLimit;
  1215. PVOID Win32StartAddress;
  1216. ULONG_PTR Reserved1;
  1217. ULONG_PTR Reserved2;
  1218. ULONG_PTR Reserved3;
  1219. ULONG_PTR Reserved4;
  1220. } SYSTEM_EXTENDED_THREAD_INFORMATION, *PSYSTEM_EXTENDED_THREAD_INFORMATION;
  1221. typedef struct _SYSTEM_MEMORY_INFO {
  1222. PUCHAR StringOffset;
  1223. USHORT ValidCount;
  1224. USHORT TransitionCount;
  1225. USHORT ModifiedCount;
  1226. USHORT PageTableCount;
  1227. } SYSTEM_MEMORY_INFO, *PSYSTEM_MEMORY_INFO;
  1228. typedef struct _SYSTEM_MEMORY_INFORMATION {
  1229. ULONG InfoSize;
  1230. ULONG_PTR StringStart;
  1231. SYSTEM_MEMORY_INFO Memory[1];
  1232. } SYSTEM_MEMORY_INFORMATION, *PSYSTEM_MEMORY_INFORMATION;
  1233. typedef struct _SYSTEM_CALL_COUNT_INFORMATION {
  1234. ULONG Length;
  1235. ULONG NumberOfTables;
  1236. //ULONG NumberOfEntries[NumberOfTables];
  1237. //ULONG CallCounts[NumberOfTables][NumberOfEntries];
  1238. } SYSTEM_CALL_COUNT_INFORMATION, *PSYSTEM_CALL_COUNT_INFORMATION;
  1239. typedef struct _SYSTEM_DEVICE_INFORMATION {
  1240. ULONG NumberOfDisks;
  1241. ULONG NumberOfFloppies;
  1242. ULONG NumberOfCdRoms;
  1243. ULONG NumberOfTapes;
  1244. ULONG NumberOfSerialPorts;
  1245. ULONG NumberOfParallelPorts;
  1246. } SYSTEM_DEVICE_INFORMATION, *PSYSTEM_DEVICE_INFORMATION;
  1247. typedef struct _SYSTEM_EXCEPTION_INFORMATION {
  1248. ULONG AlignmentFixupCount;
  1249. ULONG ExceptionDispatchCount;
  1250. ULONG FloatingEmulationCount;
  1251. ULONG ByteWordEmulationCount;
  1252. } SYSTEM_EXCEPTION_INFORMATION, *PSYSTEM_EXCEPTION_INFORMATION;
  1253. typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
  1254. BOOLEAN KernelDebuggerEnabled;
  1255. BOOLEAN KernelDebuggerNotPresent;
  1256. } SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
  1257. typedef struct _SYSTEM_REGISTRY_QUOTA_INFORMATION {
  1258. ULONG RegistryQuotaAllowed;
  1259. ULONG RegistryQuotaUsed;
  1260. SIZE_T PagedPoolSize;
  1261. } SYSTEM_REGISTRY_QUOTA_INFORMATION, *PSYSTEM_REGISTRY_QUOTA_INFORMATION;
  1262. typedef struct _SYSTEM_GDI_DRIVER_INFORMATION {
  1263. UNICODE_STRING DriverName;
  1264. PVOID ImageAddress;
  1265. PVOID SectionPointer;
  1266. PVOID EntryPoint;
  1267. PIMAGE_EXPORT_DIRECTORY ExportSectionPointer;
  1268. ULONG ImageLength;
  1269. } SYSTEM_GDI_DRIVER_INFORMATION, *PSYSTEM_GDI_DRIVER_INFORMATION;
  1270. #if DEVL
  1271. typedef struct _SYSTEM_FLAGS_INFORMATION {
  1272. ULONG Flags;
  1273. } SYSTEM_FLAGS_INFORMATION, *PSYSTEM_FLAGS_INFORMATION;
  1274. typedef struct _SYSTEM_CALL_TIME_INFORMATION {
  1275. ULONG Length;
  1276. ULONG TotalCalls;
  1277. LARGE_INTEGER TimeOfCalls[1];
  1278. } SYSTEM_CALL_TIME_INFORMATION, *PSYSTEM_CALL_TIME_INFORMATION;
  1279. typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO {
  1280. USHORT UniqueProcessId;
  1281. USHORT CreatorBackTraceIndex;
  1282. UCHAR ObjectTypeIndex;
  1283. UCHAR HandleAttributes;
  1284. USHORT HandleValue;
  1285. PVOID Object;
  1286. ULONG GrantedAccess;
  1287. } SYSTEM_HANDLE_TABLE_ENTRY_INFO, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO;
  1288. typedef struct _SYSTEM_HANDLE_INFORMATION {
  1289. ULONG NumberOfHandles;
  1290. SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[ 1 ];
  1291. } SYSTEM_HANDLE_INFORMATION, *PSYSTEM_HANDLE_INFORMATION;
  1292. typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX {
  1293. PVOID Object;
  1294. ULONG_PTR UniqueProcessId;
  1295. ULONG_PTR HandleValue;
  1296. ULONG GrantedAccess;
  1297. USHORT CreatorBackTraceIndex;
  1298. USHORT ObjectTypeIndex;
  1299. ULONG HandleAttributes;
  1300. ULONG Reserved;
  1301. } SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX, *PSYSTEM_HANDLE_TABLE_ENTRY_INFO_EX;
  1302. typedef struct _SYSTEM_HANDLE_INFORMATION_EX {
  1303. ULONG_PTR NumberOfHandles;
  1304. ULONG_PTR Reserved;
  1305. SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handles[ 1 ];
  1306. } SYSTEM_HANDLE_INFORMATION_EX, *PSYSTEM_HANDLE_INFORMATION_EX;
  1307. typedef struct _SYSTEM_OBJECTTYPE_INFORMATION {
  1308. ULONG NextEntryOffset;
  1309. ULONG NumberOfObjects;
  1310. ULONG NumberOfHandles;
  1311. ULONG TypeIndex;
  1312. ULONG InvalidAttributes;
  1313. GENERIC_MAPPING GenericMapping;
  1314. ULONG ValidAccessMask;
  1315. ULONG PoolType;
  1316. BOOLEAN SecurityRequired;
  1317. BOOLEAN WaitableObject;
  1318. UNICODE_STRING TypeName;
  1319. } SYSTEM_OBJECTTYPE_INFORMATION, *PSYSTEM_OBJECTTYPE_INFORMATION;
  1320. typedef struct _SYSTEM_OBJECT_INFORMATION {
  1321. ULONG NextEntryOffset;
  1322. PVOID Object;
  1323. HANDLE CreatorUniqueProcess;
  1324. USHORT CreatorBackTraceIndex;
  1325. USHORT Flags;
  1326. LONG PointerCount;
  1327. LONG HandleCount;
  1328. ULONG PagedPoolCharge;
  1329. ULONG NonPagedPoolCharge;
  1330. HANDLE ExclusiveProcessId;
  1331. PVOID SecurityDescriptor;
  1332. OBJECT_NAME_INFORMATION NameInfo;
  1333. } SYSTEM_OBJECT_INFORMATION, *PSYSTEM_OBJECT_INFORMATION;
  1334. typedef struct _SYSTEM_PAGEFILE_INFORMATION {
  1335. ULONG NextEntryOffset;
  1336. ULONG TotalSize;
  1337. ULONG TotalInUse;
  1338. ULONG PeakUsage;
  1339. UNICODE_STRING PageFileName;
  1340. } SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
  1341. typedef struct _SYSTEM_VERIFIER_INFORMATION {
  1342. ULONG NextEntryOffset;
  1343. ULONG Level;
  1344. UNICODE_STRING DriverName;
  1345. ULONG RaiseIrqls;
  1346. ULONG AcquireSpinLocks;
  1347. ULONG SynchronizeExecutions;
  1348. ULONG AllocationsAttempted;
  1349. ULONG AllocationsSucceeded;
  1350. ULONG AllocationsSucceededSpecialPool;
  1351. ULONG AllocationsWithNoTag;
  1352. ULONG TrimRequests;
  1353. ULONG Trims;
  1354. ULONG AllocationsFailed;
  1355. ULONG AllocationsFailedDeliberately;
  1356. ULONG Loads;
  1357. ULONG Unloads;
  1358. ULONG UnTrackedPool;
  1359. ULONG CurrentPagedPoolAllocations;
  1360. ULONG CurrentNonPagedPoolAllocations;
  1361. ULONG PeakPagedPoolAllocations;
  1362. ULONG PeakNonPagedPoolAllocations;
  1363. SIZE_T PagedPoolUsageInBytes;
  1364. SIZE_T NonPagedPoolUsageInBytes;
  1365. SIZE_T PeakPagedPoolUsageInBytes;
  1366. SIZE_T PeakNonPagedPoolUsageInBytes;
  1367. } SYSTEM_VERIFIER_INFORMATION, *PSYSTEM_VERIFIER_INFORMATION;
  1368. typedef struct _SYSTEM_FILECACHE_INFORMATION {
  1369. SIZE_T CurrentSize;
  1370. SIZE_T PeakSize;
  1371. ULONG PageFaultCount;
  1372. SIZE_T MinimumWorkingSet;
  1373. SIZE_T MaximumWorkingSet;
  1374. SIZE_T CurrentSizeIncludingTransitionInPages;
  1375. SIZE_T PeakSizeIncludingTransitionInPages;
  1376. ULONG TransitionRePurposeCount;
  1377. ULONG spare[1];
  1378. } SYSTEM_FILECACHE_INFORMATION, *PSYSTEM_FILECACHE_INFORMATION;
  1379. #define FLG_HOTPATCH_KERNEL 0x80000000
  1380. #define FLG_HOTPATCH_RELOAD_NTDLL 0x40000000
  1381. #define FLG_HOTPATCH_NAME_INFO 0x20000000
  1382. #define FLG_HOTPATCH_RENAME_INFO 0x10000000
  1383. #define FLG_HOTPATCH_MAP_ATOMIC_SWAP 0x08000000
  1384. #define FLG_HOTPATCH_ACTIVE 0x00000001
  1385. #define FLG_HOTPATCH_STATUS_FLAGS FLG_HOTPATCH_ACTIVE
  1386. #define FLG_HOTPATCH_VERIFICATION_ERROR 0x00800000
  1387. typedef struct _HOTPATCH_HOOK_DESCRIPTOR{
  1388. ULONG_PTR TargetAddress;
  1389. PVOID MappedAddress;
  1390. ULONG CodeOffset;
  1391. ULONG CodeSize;
  1392. ULONG OrigCodeOffset;
  1393. ULONG ValidationOffset;
  1394. ULONG ValidationSize;
  1395. }HOTPATCH_HOOK_DESCRIPTOR, *PHOTPATCH_HOOK_DESCRIPTOR;
  1396. typedef struct _SYSTEM_HOTPATCH_CODE_INFORMATION {
  1397. ULONG Flags;
  1398. ULONG InfoSize;
  1399. union {
  1400. struct {
  1401. ULONG DescriptorsCount;
  1402. HOTPATCH_HOOK_DESCRIPTOR CodeDescriptors[1]; // variable size structure
  1403. } CodeInfo;
  1404. struct {
  1405. USHORT NameOffset;
  1406. USHORT NameLength;
  1407. } KernelInfo;
  1408. struct {
  1409. USHORT NameOffset;
  1410. USHORT NameLength;
  1411. USHORT TargetNameOffset;
  1412. USHORT TargetNameLength;
  1413. } UserModeInfo;
  1414. struct {
  1415. HANDLE FileHandle1;
  1416. PIO_STATUS_BLOCK IoStatusBlock1;
  1417. PFILE_RENAME_INFORMATION RenameInformation1;
  1418. ULONG RenameInformationLength1;
  1419. HANDLE FileHandle2;
  1420. PIO_STATUS_BLOCK IoStatusBlock2;
  1421. PFILE_RENAME_INFORMATION RenameInformation2;
  1422. ULONG RenameInformationLength2;
  1423. } RenameInfo;
  1424. struct {
  1425. HANDLE ParentDirectory;
  1426. HANDLE ObjectHandle1;
  1427. HANDLE ObjectHandle2;
  1428. } AtomicSwap;
  1429. };
  1430. //
  1431. // NOTE Do not add anything after CodeDescriptors array as
  1432. // it is assumed to have a variable size
  1433. //
  1434. } SYSTEM_HOTPATCH_CODE_INFORMATION, *PSYSTEM_HOTPATCH_CODE_INFORMATION;
  1435. //
  1436. // Watchdog Timer
  1437. //
  1438. typedef enum _WATCHDOG_HANDLER_ACTION {
  1439. WdActionSetTimeoutValue,
  1440. WdActionQueryTimeoutValue,
  1441. WdActionResetTimer,
  1442. WdActionStopTimer,
  1443. WdActionStartTimer,
  1444. WdActionSetTriggerAction,
  1445. WdActionQueryTriggerAction,
  1446. WdActionQueryState
  1447. } WATCHDOG_HANDLER_ACTION;
  1448. typedef enum _WATCHDOG_INFORMATION_CLASS {
  1449. WdInfoTimeoutValue,
  1450. WdInfoResetTimer,
  1451. WdInfoStopTimer,
  1452. WdInfoStartTimer,
  1453. WdInfoTriggerAction,
  1454. WdInfoState
  1455. } WATCHDOG_INFORMATION_CLASS;
  1456. typedef
  1457. NTSTATUS
  1458. (*PWD_HANDLER)(
  1459. IN WATCHDOG_HANDLER_ACTION Action,
  1460. IN PVOID Context,
  1461. IN OUT PULONG DataValue,
  1462. IN BOOLEAN NoLocks
  1463. );
  1464. typedef struct _SYSTEM_WATCHDOG_HANDLER_INFORMATION {
  1465. PWD_HANDLER WdHandler;
  1466. PVOID Context;
  1467. } SYSTEM_WATCHDOG_HANDLER_INFORMATION, *PSYSTEM_WATCHDOG_HANDLER_INFORMATION;
  1468. #define WDSTATE_FIRED 0x00000001
  1469. #define WDSTATE_HARDWARE_ENABLED 0x00000002
  1470. #define WDSTATE_STARTED 0x00000004
  1471. #define WDSTATE_HARDWARE_PRESENT 0x00000008
  1472. typedef struct _SYSTEM_WATCHDOG_TIMER_INFORMATION {
  1473. WATCHDOG_INFORMATION_CLASS WdInfoClass;
  1474. ULONG DataValue;
  1475. } SYSTEM_WATCHDOG_TIMER_INFORMATION, *PSYSTEM_WATCHDOG_TIMER_INFORMATION;
  1476. #if _MSC_VER >= 1200
  1477. #pragma warning(push)
  1478. #endif
  1479. #pragma warning(disable:4201) // unnamed struct/union
  1480. typedef struct _SYSTEM_POOL_ENTRY {
  1481. BOOLEAN Allocated;
  1482. BOOLEAN Spare0;
  1483. USHORT AllocatorBackTraceIndex;
  1484. ULONG Size;
  1485. union {
  1486. UCHAR Tag[4];
  1487. ULONG TagUlong;
  1488. PVOID ProcessChargedQuota;
  1489. };
  1490. } SYSTEM_POOL_ENTRY, *PSYSTEM_POOL_ENTRY;
  1491. typedef struct _SYSTEM_POOL_INFORMATION {
  1492. SIZE_T TotalSize;
  1493. PVOID FirstEntry;
  1494. USHORT EntryOverhead;
  1495. BOOLEAN PoolTagPresent;
  1496. BOOLEAN Spare0;
  1497. ULONG NumberOfEntries;
  1498. SYSTEM_POOL_ENTRY Entries[1];
  1499. } SYSTEM_POOL_INFORMATION, *PSYSTEM_POOL_INFORMATION;
  1500. typedef struct _SYSTEM_POOLTAG {
  1501. union {
  1502. UCHAR Tag[4];
  1503. ULONG TagUlong;
  1504. };
  1505. ULONG PagedAllocs;
  1506. ULONG PagedFrees;
  1507. SIZE_T PagedUsed;
  1508. ULONG NonPagedAllocs;
  1509. ULONG NonPagedFrees;
  1510. SIZE_T NonPagedUsed;
  1511. } SYSTEM_POOLTAG, *PSYSTEM_POOLTAG;
  1512. typedef struct _SYSTEM_BIGPOOL_ENTRY {
  1513. union {
  1514. PVOID VirtualAddress;
  1515. ULONG_PTR NonPaged : 1; // Set to 1 if entry is nonpaged.
  1516. };
  1517. SIZE_T SizeInBytes;
  1518. union {
  1519. UCHAR Tag[4];
  1520. ULONG TagUlong;
  1521. };
  1522. } SYSTEM_BIGPOOL_ENTRY, *PSYSTEM_BIGPOOL_ENTRY;
  1523. #if _MSC_VER >= 1200
  1524. #pragma warning(pop)
  1525. #else
  1526. #pragma warning( default : 4201 )
  1527. #endif
  1528. typedef struct _SYSTEM_POOLTAG_INFORMATION {
  1529. ULONG Count;
  1530. SYSTEM_POOLTAG TagInfo[1];
  1531. } SYSTEM_POOLTAG_INFORMATION, *PSYSTEM_POOLTAG_INFORMATION;
  1532. typedef struct _SYSTEM_SESSION_POOLTAG_INFORMATION {
  1533. SIZE_T NextEntryOffset;
  1534. ULONG SessionId;
  1535. ULONG Count;
  1536. SYSTEM_POOLTAG TagInfo[1];
  1537. } SYSTEM_SESSION_POOLTAG_INFORMATION, *PSYSTEM_SESSION_POOLTAG_INFORMATION;
  1538. typedef struct _SYSTEM_BIGPOOL_INFORMATION {
  1539. ULONG Count;
  1540. SYSTEM_BIGPOOL_ENTRY AllocatedInfo[1];
  1541. } SYSTEM_BIGPOOL_INFORMATION, *PSYSTEM_BIGPOOL_INFORMATION;
  1542. typedef struct _SYSTEM_SESSION_MAPPED_VIEW_INFORMATION {
  1543. SIZE_T NextEntryOffset;
  1544. ULONG SessionId;
  1545. ULONG ViewFailures;
  1546. SIZE_T NumberOfBytesAvailable;
  1547. SIZE_T NumberOfBytesAvailableContiguous;
  1548. } SYSTEM_SESSION_MAPPED_VIEW_INFORMATION, *PSYSTEM_SESSION_MAPPED_VIEW_INFORMATION;
  1549. typedef struct _SYSTEM_CONTEXT_SWITCH_INFORMATION {
  1550. ULONG ContextSwitches;
  1551. ULONG FindAny;
  1552. ULONG FindLast;
  1553. ULONG FindIdeal;
  1554. ULONG IdleAny;
  1555. ULONG IdleCurrent;
  1556. ULONG IdleLast;
  1557. ULONG IdleIdeal;
  1558. ULONG PreemptAny;
  1559. ULONG PreemptCurrent;
  1560. ULONG PreemptLast;
  1561. ULONG SwitchToIdle;
  1562. } SYSTEM_CONTEXT_SWITCH_INFORMATION, *PSYSTEM_CONTEXT_SWITCH_INFORMATION;
  1563. typedef struct _SYSTEM_INTERRUPT_INFORMATION {
  1564. ULONG ContextSwitches;
  1565. ULONG DpcCount;
  1566. ULONG DpcRate;
  1567. ULONG TimeIncrement;
  1568. ULONG DpcBypassCount;
  1569. ULONG ApcBypassCount;
  1570. } SYSTEM_INTERRUPT_INFORMATION, *PSYSTEM_INTERRUPT_INFORMATION;
  1571. typedef struct _SYSTEM_DPC_BEHAVIOR_INFORMATION {
  1572. ULONG Spare;
  1573. ULONG DpcQueueDepth;
  1574. ULONG MinimumDpcRate;
  1575. ULONG AdjustDpcThreshold;
  1576. ULONG IdealDpcRate;
  1577. } SYSTEM_DPC_BEHAVIOR_INFORMATION, *PSYSTEM_DPC_BEHAVIOR_INFORMATION;
  1578. #endif // DEVL
  1579. typedef struct _SYSTEM_LOOKASIDE_INFORMATION {
  1580. USHORT CurrentDepth;
  1581. USHORT MaximumDepth;
  1582. ULONG TotalAllocates;
  1583. ULONG AllocateMisses;
  1584. ULONG TotalFrees;
  1585. ULONG FreeMisses;
  1586. ULONG Type;
  1587. ULONG Tag;
  1588. ULONG Size;
  1589. } SYSTEM_LOOKASIDE_INFORMATION, *PSYSTEM_LOOKASIDE_INFORMATION;
  1590. typedef struct _SYSTEM_LEGACY_DRIVER_INFORMATION {
  1591. ULONG VetoType;
  1592. UNICODE_STRING VetoList;
  1593. } SYSTEM_LEGACY_DRIVER_INFORMATION, *PSYSTEM_LEGACY_DRIVER_INFORMATION;
  1594. // begin_winnt
  1595. #define PROCESSOR_INTEL_386 386
  1596. #define PROCESSOR_INTEL_486 486
  1597. #define PROCESSOR_INTEL_PENTIUM 586
  1598. #define PROCESSOR_INTEL_IA64 2200
  1599. #define PROCESSOR_AMD_X8664 8664
  1600. #define PROCESSOR_MIPS_R4000 4000 // incl R4101 & R3910 for Windows CE
  1601. #define PROCESSOR_ALPHA_21064 21064
  1602. #define PROCESSOR_PPC_601 601
  1603. #define PROCESSOR_PPC_603 603
  1604. #define PROCESSOR_PPC_604 604
  1605. #define PROCESSOR_PPC_620 620
  1606. #define PROCESSOR_HITACHI_SH3 10003 // Windows CE
  1607. #define PROCESSOR_HITACHI_SH3E 10004 // Windows CE
  1608. #define PROCESSOR_HITACHI_SH4 10005 // Windows CE
  1609. #define PROCESSOR_MOTOROLA_821 821 // Windows CE
  1610. #define PROCESSOR_SHx_SH3 103 // Windows CE
  1611. #define PROCESSOR_SHx_SH4 104 // Windows CE
  1612. #define PROCESSOR_STRONGARM 2577 // Windows CE - 0xA11
  1613. #define PROCESSOR_ARM720 1824 // Windows CE - 0x720
  1614. #define PROCESSOR_ARM820 2080 // Windows CE - 0x820
  1615. #define PROCESSOR_ARM920 2336 // Windows CE - 0x920
  1616. #define PROCESSOR_ARM_7TDMI 70001 // Windows CE
  1617. #define PROCESSOR_OPTIL 0x494f // MSIL
  1618. #define PROCESSOR_ARCHITECTURE_INTEL 0
  1619. #define PROCESSOR_ARCHITECTURE_MIPS 1
  1620. #define PROCESSOR_ARCHITECTURE_ALPHA 2
  1621. #define PROCESSOR_ARCHITECTURE_PPC 3
  1622. #define PROCESSOR_ARCHITECTURE_SHX 4
  1623. #define PROCESSOR_ARCHITECTURE_ARM 5
  1624. #define PROCESSOR_ARCHITECTURE_IA64 6
  1625. #define PROCESSOR_ARCHITECTURE_ALPHA64 7
  1626. #define PROCESSOR_ARCHITECTURE_MSIL 8
  1627. #define PROCESSOR_ARCHITECTURE_AMD64 9
  1628. #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
  1629. #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
  1630. // end_winnt
  1631. NTSYSCALLAPI
  1632. NTSTATUS
  1633. NTAPI
  1634. NtQuerySystemInformation (
  1635. IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
  1636. OUT PVOID SystemInformation,
  1637. IN ULONG SystemInformationLength,
  1638. OUT PULONG ReturnLength OPTIONAL
  1639. );
  1640. NTSYSCALLAPI
  1641. NTSTATUS
  1642. NTAPI
  1643. NtSetSystemInformation (
  1644. IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
  1645. IN PVOID SystemInformation,
  1646. IN ULONG SystemInformationLength
  1647. );
  1648. //
  1649. // SysDbg APIs are available to user-mode processes via
  1650. // NtSystemDebugControl.
  1651. //
  1652. typedef enum _SYSDBG_COMMAND {
  1653. SysDbgQueryModuleInformation,
  1654. SysDbgQueryTraceInformation,
  1655. SysDbgSetTracepoint,
  1656. SysDbgSetSpecialCall,
  1657. SysDbgClearSpecialCalls,
  1658. SysDbgQuerySpecialCalls,
  1659. SysDbgBreakPoint,
  1660. SysDbgQueryVersion,
  1661. SysDbgReadVirtual,
  1662. SysDbgWriteVirtual,
  1663. SysDbgReadPhysical,
  1664. SysDbgWritePhysical,
  1665. SysDbgReadControlSpace,
  1666. SysDbgWriteControlSpace,
  1667. SysDbgReadIoSpace,
  1668. SysDbgWriteIoSpace,
  1669. SysDbgReadMsr,
  1670. SysDbgWriteMsr,
  1671. SysDbgReadBusData,
  1672. SysDbgWriteBusData,
  1673. SysDbgCheckLowMemory,
  1674. SysDbgEnableKernelDebugger,
  1675. SysDbgDisableKernelDebugger,
  1676. SysDbgGetAutoKdEnable,
  1677. SysDbgSetAutoKdEnable,
  1678. SysDbgGetPrintBufferSize,
  1679. SysDbgSetPrintBufferSize,
  1680. SysDbgGetKdUmExceptionEnable,
  1681. SysDbgSetKdUmExceptionEnable,
  1682. } SYSDBG_COMMAND, *PSYSDBG_COMMAND;
  1683. typedef struct _SYSDBG_VIRTUAL {
  1684. PVOID Address;
  1685. PVOID Buffer;
  1686. ULONG Request;
  1687. } SYSDBG_VIRTUAL, *PSYSDBG_VIRTUAL;
  1688. typedef struct _SYSDBG_PHYSICAL {
  1689. PHYSICAL_ADDRESS Address;
  1690. PVOID Buffer;
  1691. ULONG Request;
  1692. } SYSDBG_PHYSICAL, *PSYSDBG_PHYSICAL;
  1693. typedef struct _SYSDBG_CONTROL_SPACE {
  1694. ULONG64 Address;
  1695. PVOID Buffer;
  1696. ULONG Request;
  1697. ULONG Processor;
  1698. } SYSDBG_CONTROL_SPACE, *PSYSDBG_CONTROL_SPACE;
  1699. typedef struct _SYSDBG_IO_SPACE {
  1700. ULONG64 Address;
  1701. PVOID Buffer;
  1702. ULONG Request;
  1703. INTERFACE_TYPE InterfaceType;
  1704. ULONG BusNumber;
  1705. ULONG AddressSpace;
  1706. } SYSDBG_IO_SPACE, *PSYSDBG_IO_SPACE;
  1707. typedef struct _SYSDBG_MSR {
  1708. ULONG Msr;
  1709. ULONG64 Data;
  1710. } SYSDBG_MSR, *PSYSDBG_MSR;
  1711. typedef struct _SYSDBG_BUS_DATA {
  1712. ULONG Address;
  1713. PVOID Buffer;
  1714. ULONG Request;
  1715. BUS_DATA_TYPE BusDataType;
  1716. ULONG BusNumber;
  1717. ULONG SlotNumber;
  1718. } SYSDBG_BUS_DATA, *PSYSDBG_BUS_DATA;
  1719. NTSYSCALLAPI
  1720. NTSTATUS
  1721. NTAPI
  1722. NtSystemDebugControl (
  1723. IN SYSDBG_COMMAND Command,
  1724. IN PVOID InputBuffer,
  1725. IN ULONG InputBufferLength,
  1726. OUT PVOID OutputBuffer,
  1727. IN ULONG OutputBufferLength,
  1728. OUT PULONG ReturnLength
  1729. );
  1730. typedef enum _HARDERROR_RESPONSE_OPTION {
  1731. OptionAbortRetryIgnore,
  1732. OptionOk,
  1733. OptionOkCancel,
  1734. OptionRetryCancel,
  1735. OptionYesNo,
  1736. OptionYesNoCancel,
  1737. OptionShutdownSystem,
  1738. OptionOkNoWait,
  1739. OptionCancelTryContinue
  1740. } HARDERROR_RESPONSE_OPTION;
  1741. typedef enum _HARDERROR_RESPONSE {
  1742. ResponseReturnToCaller,
  1743. ResponseNotHandled,
  1744. ResponseAbort,
  1745. ResponseCancel,
  1746. ResponseIgnore,
  1747. ResponseNo,
  1748. ResponseOk,
  1749. ResponseRetry,
  1750. ResponseYes,
  1751. ResponseTryAgain,
  1752. ResponseContinue
  1753. } HARDERROR_RESPONSE;
  1754. #define HARDERROR_PARAMETERS_FLAGSPOS 4
  1755. #define HARDERROR_FLAGS_DEFDESKTOPONLY 0x00020000
  1756. #define MAXIMUM_HARDERROR_PARAMETERS 5
  1757. #define HARDERROR_OVERRIDE_ERRORMODE 0x10000000
  1758. typedef struct _HARDERROR_MSG {
  1759. PORT_MESSAGE h;
  1760. NTSTATUS Status;
  1761. LARGE_INTEGER ErrorTime;
  1762. ULONG ValidResponseOptions;
  1763. ULONG Response;
  1764. ULONG NumberOfParameters;
  1765. ULONG UnicodeStringParameterMask;
  1766. ULONG_PTR Parameters[MAXIMUM_HARDERROR_PARAMETERS];
  1767. } HARDERROR_MSG, *PHARDERROR_MSG;
  1768. NTSYSCALLAPI
  1769. NTSTATUS
  1770. NTAPI
  1771. NtRaiseHardError(
  1772. IN NTSTATUS ErrorStatus,
  1773. IN ULONG NumberOfParameters,
  1774. IN ULONG UnicodeStringParameterMask,
  1775. IN PULONG_PTR Parameters,
  1776. IN ULONG ValidResponseOptions,
  1777. OUT PULONG Response
  1778. );
  1779. // begin_wdm begin_ntddk begin_nthal begin_ntifs
  1780. //
  1781. // Defined processor features
  1782. //
  1783. #define PF_FLOATING_POINT_PRECISION_ERRATA 0 // winnt
  1784. #define PF_FLOATING_POINT_EMULATED 1 // winnt
  1785. #define PF_COMPARE_EXCHANGE_DOUBLE 2 // winnt
  1786. #define PF_MMX_INSTRUCTIONS_AVAILABLE 3 // winnt
  1787. #define PF_PPC_MOVEMEM_64BIT_OK 4 // winnt
  1788. #define PF_ALPHA_BYTE_INSTRUCTIONS 5 // winnt
  1789. #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 // winnt
  1790. #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 // winnt
  1791. #define PF_RDTSC_INSTRUCTION_AVAILABLE 8 // winnt
  1792. #define PF_PAE_ENABLED 9 // winnt
  1793. #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 // winnt
  1794. typedef enum _ALTERNATIVE_ARCHITECTURE_TYPE {
  1795. StandardDesign, // None == 0 == standard design
  1796. NEC98x86, // NEC PC98xx series on X86
  1797. EndAlternatives // past end of known alternatives
  1798. } ALTERNATIVE_ARCHITECTURE_TYPE;
  1799. // correctly define these run-time definitions for non X86 machines
  1800. #ifndef _X86_
  1801. #ifndef IsNEC_98
  1802. #define IsNEC_98 (FALSE)
  1803. #endif
  1804. #ifndef IsNotNEC_98
  1805. #define IsNotNEC_98 (TRUE)
  1806. #endif
  1807. #ifndef SetNEC_98
  1808. #define SetNEC_98
  1809. #endif
  1810. #ifndef SetNotNEC_98
  1811. #define SetNotNEC_98
  1812. #endif
  1813. #endif
  1814. #define PROCESSOR_FEATURE_MAX 64
  1815. // end_wdm
  1816. #if defined(REMOTE_BOOT)
  1817. //
  1818. // Defined system flags.
  1819. //
  1820. /* the following two lines should be tagged with "winnt" when REMOTE_BOOT is on. */
  1821. #define SYSTEM_FLAG_REMOTE_BOOT_CLIENT 0x00000001
  1822. #define SYSTEM_FLAG_DISKLESS_CLIENT 0x00000002
  1823. #endif // defined(REMOTE_BOOT)
  1824. //
  1825. // Define data shared between kernel and user mode.
  1826. //
  1827. // N.B. User mode has read only access to this data
  1828. //
  1829. #ifdef _MAC
  1830. #pragma warning( disable : 4121)
  1831. #endif
  1832. //
  1833. // WARNING: This structure must have exactly the same layout for 32- and
  1834. // 64-bit systems. The layout of this structure cannot change and new
  1835. // fields can only be added to the end of the structure. Deprecated
  1836. // fields cannot be deleted. Platform specific fields are included on
  1837. // all systems.
  1838. //
  1839. // Layout exactness is required for Wow64 support of 32bit applications
  1840. // on Win64 systems.
  1841. //
  1842. // The layout itself cannot change since this sturcture has been exported
  1843. // in ntddk, ntifs.h, and nthal.h for some time.
  1844. //
  1845. typedef struct _KUSER_SHARED_DATA {
  1846. //
  1847. // Current low 32-bit of tick count and tick count multiplier.
  1848. //
  1849. // N.B. The tick count is updated each time the clock ticks.
  1850. //
  1851. ULONG TickCountLowDeprecated;
  1852. ULONG TickCountMultiplier;
  1853. //
  1854. // Current 64-bit interrupt time in 100ns units.
  1855. //
  1856. volatile KSYSTEM_TIME InterruptTime;
  1857. //
  1858. // Current 64-bit system time in 100ns units.
  1859. //
  1860. volatile KSYSTEM_TIME SystemTime;
  1861. //
  1862. // Current 64-bit time zone bias.
  1863. //
  1864. volatile KSYSTEM_TIME TimeZoneBias;
  1865. //
  1866. // Support image magic number range for the host system.
  1867. //
  1868. // N.B. This is an inclusive range.
  1869. //
  1870. USHORT ImageNumberLow;
  1871. USHORT ImageNumberHigh;
  1872. //
  1873. // Copy of system root in Unicode
  1874. //
  1875. WCHAR NtSystemRoot[ 260 ];
  1876. //
  1877. // Maximum stack trace depth if tracing enabled.
  1878. //
  1879. ULONG MaxStackTraceDepth;
  1880. //
  1881. // Crypto Exponent
  1882. //
  1883. ULONG CryptoExponent;
  1884. //
  1885. // TimeZoneId
  1886. //
  1887. ULONG TimeZoneId;
  1888. ULONG LargePageMinimum;
  1889. ULONG Reserved2[ 7 ];
  1890. //
  1891. // product type
  1892. //
  1893. NT_PRODUCT_TYPE NtProductType;
  1894. BOOLEAN ProductTypeIsValid;
  1895. //
  1896. // NT Version. Note that each process sees a version from its PEB, but
  1897. // if the process is running with an altered view of the system version,
  1898. // the following two fields are used to correctly identify the version
  1899. //
  1900. ULONG NtMajorVersion;
  1901. ULONG NtMinorVersion;
  1902. //
  1903. // Processor Feature Bits
  1904. //
  1905. BOOLEAN ProcessorFeatures[PROCESSOR_FEATURE_MAX];
  1906. //
  1907. // Reserved fields - do not use
  1908. //
  1909. ULONG Reserved1;
  1910. ULONG Reserved3;
  1911. //
  1912. // Time slippage while in debugger
  1913. //
  1914. volatile ULONG TimeSlip;
  1915. //
  1916. // Alternative system architecture. Example: NEC PC98xx on x86
  1917. //
  1918. ALTERNATIVE_ARCHITECTURE_TYPE AlternativeArchitecture;
  1919. //
  1920. // If the system is an evaluation unit, the following field contains the
  1921. // date and time that the evaluation unit expires. A value of 0 indicates
  1922. // that there is no expiration. A non-zero value is the UTC absolute time
  1923. // that the system expires.
  1924. //
  1925. LARGE_INTEGER SystemExpirationDate;
  1926. //
  1927. // Suite Support
  1928. //
  1929. ULONG SuiteMask;
  1930. //
  1931. // TRUE if a kernel debugger is connected/enabled
  1932. //
  1933. BOOLEAN KdDebuggerEnabled;
  1934. //
  1935. // Current console session Id. Always zero on non-TS systems
  1936. //
  1937. volatile ULONG ActiveConsoleId;
  1938. //
  1939. // Force-dismounts cause handles to become invalid. Rather than
  1940. // always probe handles, we maintain a serial number of
  1941. // dismounts that clients can use to see if they need to probe
  1942. // handles.
  1943. //
  1944. volatile ULONG DismountCount;
  1945. //
  1946. // This field indicates the status of the 64-bit COM+ package on the system.
  1947. // It indicates whether the Itermediate Language (IL) COM+ images need to
  1948. // use the 64-bit COM+ runtime or the 32-bit COM+ runtime.
  1949. //
  1950. ULONG ComPlusPackage;
  1951. //
  1952. // Time in tick count for system-wide last user input across all
  1953. // terminal sessions. For MP performance, it is not updated all
  1954. // the time (e.g. once a minute per session). It is used for idle
  1955. // detection.
  1956. //
  1957. ULONG LastSystemRITEventTickCount;
  1958. //
  1959. // Number of physical pages in the system. This can dynamically
  1960. // change as physical memory can be added or removed from a running
  1961. // system.
  1962. //
  1963. ULONG NumberOfPhysicalPages;
  1964. //
  1965. // True if the system was booted in safe boot mode.
  1966. //
  1967. BOOLEAN SafeBootMode;
  1968. //
  1969. // The following field is used for Heap and CritSec Tracing
  1970. // The last bit is set for Critical Sec Collision tracing and
  1971. // second Last bit is for Heap Tracing
  1972. // Also the first 16 bits are used as counter.
  1973. //
  1974. ULONG TraceLogging;
  1975. //
  1976. // Depending on the processor, the code for fast system call
  1977. // will differ, the following buffer is filled with the appropriate
  1978. // code sequence and user mode code will branch through it.
  1979. //
  1980. // (32 bytes, using ULONGLONG for alignment).
  1981. //
  1982. // N.B. The following two fields are only used on 32-bit systems.
  1983. //
  1984. ULONGLONG Fill0; // alignment
  1985. ULONGLONG SystemCall[4];
  1986. //
  1987. // The 64-bit tick count.
  1988. //
  1989. union {
  1990. volatile KSYSTEM_TIME TickCount;
  1991. volatile ULONG64 TickCountQuad;
  1992. };
  1993. } KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
  1994. #ifdef _MAC
  1995. #pragma warning( default : 4121 )
  1996. #endif
  1997. // end_ntddk end_nthal end_ntifs
  1998. #define DOSDEVICE_DRIVE_UNKNOWN 0
  1999. #define DOSDEVICE_DRIVE_CALCULATE 1
  2000. #define DOSDEVICE_DRIVE_REMOVABLE 2
  2001. #define DOSDEVICE_DRIVE_FIXED 3
  2002. #define DOSDEVICE_DRIVE_REMOTE 4
  2003. #define DOSDEVICE_DRIVE_CDROM 5
  2004. #define DOSDEVICE_DRIVE_RAMDISK 6
  2005. #if defined(USER_SHARED_DATA) && !defined(MIDL_PASS) && !defined(SORTPP_PASS)
  2006. FORCEINLINE
  2007. ULONGLONG
  2008. NtGetTickCount64(
  2009. VOID
  2010. )
  2011. {
  2012. ULARGE_INTEGER TickCount;
  2013. #if defined(_WIN64)
  2014. TickCount.QuadPart = USER_SHARED_DATA->TickCountQuad;
  2015. #else
  2016. for (;;) {
  2017. TickCount.HighPart = (ULONG) USER_SHARED_DATA->TickCount.High1Time;
  2018. TickCount.LowPart = USER_SHARED_DATA->TickCount.LowPart;
  2019. if (TickCount.HighPart == (ULONG) USER_SHARED_DATA->TickCount.High2Time) {
  2020. break;
  2021. }
  2022. #if defined(_X86_)
  2023. _asm { rep nop }
  2024. #endif
  2025. }
  2026. #endif
  2027. return ((UInt32x32To64(TickCount.LowPart,
  2028. USER_SHARED_DATA->TickCountMultiplier) >> 24)
  2029. + (UInt32x32To64(TickCount.HighPart,
  2030. USER_SHARED_DATA->TickCountMultiplier) << 8));
  2031. }
  2032. FORCEINLINE
  2033. ULONG
  2034. NtGetTickCount(
  2035. VOID
  2036. )
  2037. {
  2038. #if defined(_WIN64)
  2039. return (ULONG) ((USER_SHARED_DATA->TickCountQuad
  2040. * USER_SHARED_DATA->TickCountMultiplier)
  2041. >> 24);
  2042. #else
  2043. ULARGE_INTEGER TickCount;
  2044. for (;;) {
  2045. TickCount.HighPart = (ULONG) USER_SHARED_DATA->TickCount.High1Time;
  2046. TickCount.LowPart = USER_SHARED_DATA->TickCount.LowPart;
  2047. if (TickCount.HighPart == (ULONG) USER_SHARED_DATA->TickCount.High2Time) {
  2048. break;
  2049. }
  2050. #if defined(_X86_)
  2051. _asm { rep nop }
  2052. #endif
  2053. }
  2054. return (ULONG) ((UInt32x32To64(TickCount.LowPart,
  2055. USER_SHARED_DATA->TickCountMultiplier) >> 24)
  2056. + UInt32x32To64(TickCount.HighPart << 8,
  2057. USER_SHARED_DATA->TickCountMultiplier));
  2058. #endif
  2059. }
  2060. #endif // (defined(USER_SHARED_DATA) && !defined(MIDL_PASS) && !defined(SORTPP_PASS))
  2061. NTSYSCALLAPI
  2062. NTSTATUS
  2063. NTAPI
  2064. NtQueryDefaultLocale(
  2065. IN BOOLEAN UserProfile,
  2066. OUT PLCID DefaultLocaleId
  2067. );
  2068. NTSYSCALLAPI
  2069. NTSTATUS
  2070. NTAPI
  2071. NtSetDefaultLocale(
  2072. IN BOOLEAN UserProfile,
  2073. IN LCID DefaultLocaleId
  2074. );
  2075. NTSYSCALLAPI
  2076. NTSTATUS
  2077. NTAPI
  2078. NtQueryInstallUILanguage(
  2079. OUT LANGID *InstallUILanguageId
  2080. );
  2081. NTSYSCALLAPI
  2082. NTSTATUS
  2083. NTAPI
  2084. NtQueryDefaultUILanguage(
  2085. OUT LANGID *DefaultUILanguageId
  2086. );
  2087. NTSYSCALLAPI
  2088. NTSTATUS
  2089. NTAPI
  2090. NtSetDefaultUILanguage(
  2091. IN LANGID DefaultUILanguageId
  2092. );
  2093. NTSYSCALLAPI
  2094. NTSTATUS
  2095. NTAPI
  2096. NtSetDefaultHardErrorPort(
  2097. IN HANDLE DefaultHardErrorPort
  2098. );
  2099. typedef enum _SHUTDOWN_ACTION {
  2100. ShutdownNoReboot,
  2101. ShutdownReboot,
  2102. ShutdownPowerOff
  2103. } SHUTDOWN_ACTION;
  2104. NTSYSCALLAPI
  2105. NTSTATUS
  2106. NTAPI
  2107. NtShutdownSystem(
  2108. IN SHUTDOWN_ACTION Action
  2109. );
  2110. NTSYSCALLAPI
  2111. NTSTATUS
  2112. NTAPI
  2113. NtDisplayString(
  2114. IN PUNICODE_STRING String
  2115. );
  2116. //
  2117. // Global flags that can be set to control system behavior.
  2118. // Flag word is 32 bits.
  2119. //
  2120. #define FLG_STOP_ON_EXCEPTION 0x00000001 // user and kernel mode
  2121. #define FLG_SHOW_LDR_SNAPS 0x00000002 // user and kernel mode
  2122. #define FLG_DEBUG_INITIAL_COMMAND 0x00000004 // kernel mode only up until WINLOGON started
  2123. #define FLG_STOP_ON_HUNG_GUI 0x00000008 // kernel mode only while running
  2124. #define FLG_HEAP_ENABLE_TAIL_CHECK 0x00000010 // user mode only
  2125. #define FLG_HEAP_ENABLE_FREE_CHECK 0x00000020 // user mode only
  2126. #define FLG_HEAP_VALIDATE_PARAMETERS 0x00000040 // user mode only
  2127. #define FLG_HEAP_VALIDATE_ALL 0x00000080 // user mode only
  2128. #define FLG_APPLICATION_VERIFIER 0x00000100 // user mode only
  2129. #define FLG_POOL_ENABLE_TAGGING 0x00000400 // kernel mode only
  2130. #define FLG_HEAP_ENABLE_TAGGING 0x00000800 // user mode only
  2131. #define FLG_USER_STACK_TRACE_DB 0x00001000 // x86 user mode only
  2132. #define FLG_KERNEL_STACK_TRACE_DB 0x00002000 // x86 kernel mode only at boot time
  2133. #define FLG_MAINTAIN_OBJECT_TYPELIST 0x00004000 // kernel mode only at boot time
  2134. #define FLG_HEAP_ENABLE_TAG_BY_DLL 0x00008000 // user mode only
  2135. #define FLG_DISABLE_STACK_EXTENSION 0x00010000 // user mode only
  2136. #define FLG_ENABLE_CSRDEBUG 0x00020000 // kernel mode only at boot time
  2137. #define FLG_ENABLE_KDEBUG_SYMBOL_LOAD 0x00040000 // kernel mode only
  2138. #define FLG_DISABLE_PAGE_KERNEL_STACKS 0x00080000 // kernel mode only at boot time
  2139. #define FLG_ENABLE_SYSTEM_CRIT_BREAKS 0x00100000 // user mode only
  2140. #define FLG_HEAP_DISABLE_COALESCING 0x00200000 // user mode only
  2141. #define FLG_ENABLE_CLOSE_EXCEPTIONS 0x00400000 // kernel mode only
  2142. #define FLG_ENABLE_EXCEPTION_LOGGING 0x00800000 // kernel mode only
  2143. #define FLG_ENABLE_HANDLE_TYPE_TAGGING 0x01000000 // kernel mode only
  2144. #define FLG_HEAP_PAGE_ALLOCS 0x02000000 // user mode only
  2145. #define FLG_DEBUG_INITIAL_COMMAND_EX 0x04000000 // kernel mode only up until WINLOGON started
  2146. #define FLG_DISABLE_DBGPRINT 0x08000000 // kernel mode only
  2147. #define FLG_CRITSEC_EVENT_CREATION 0x10000000 // user mode only, Force early creation of resource events
  2148. #define FLG_LDR_TOP_DOWN 0x20000000 // user mode only, win64 only
  2149. #define FLG_ENABLE_HANDLE_EXCEPTIONS 0x40000000 // kernel mode only
  2150. #define FLG_DISABLE_PROTDLLS 0x80000000 // user mode only (smss/winlogon)
  2151. #define FLG_VALID_BITS 0xFFFFFDFF
  2152. #define FLG_USERMODE_VALID_BITS (FLG_STOP_ON_EXCEPTION | \
  2153. FLG_SHOW_LDR_SNAPS | \
  2154. FLG_HEAP_ENABLE_TAIL_CHECK | \
  2155. FLG_HEAP_ENABLE_FREE_CHECK | \
  2156. FLG_HEAP_VALIDATE_PARAMETERS | \
  2157. FLG_HEAP_VALIDATE_ALL | \
  2158. FLG_APPLICATION_VERIFIER | \
  2159. FLG_HEAP_ENABLE_TAGGING | \
  2160. FLG_USER_STACK_TRACE_DB | \
  2161. FLG_HEAP_ENABLE_TAG_BY_DLL | \
  2162. FLG_DISABLE_STACK_EXTENSION | \
  2163. FLG_ENABLE_SYSTEM_CRIT_BREAKS | \
  2164. FLG_HEAP_DISABLE_COALESCING | \
  2165. FLG_DISABLE_PROTDLLS | \
  2166. FLG_HEAP_PAGE_ALLOCS | \
  2167. FLG_CRITSEC_EVENT_CREATION | \
  2168. FLG_LDR_TOP_DOWN)
  2169. #define FLG_BOOTONLY_VALID_BITS (FLG_KERNEL_STACK_TRACE_DB | \
  2170. FLG_MAINTAIN_OBJECT_TYPELIST | \
  2171. FLG_ENABLE_CSRDEBUG | \
  2172. FLG_DEBUG_INITIAL_COMMAND | \
  2173. FLG_DEBUG_INITIAL_COMMAND_EX | \
  2174. FLG_DISABLE_PAGE_KERNEL_STACKS)
  2175. #define FLG_KERNELMODE_VALID_BITS (FLG_STOP_ON_EXCEPTION | \
  2176. FLG_SHOW_LDR_SNAPS | \
  2177. FLG_STOP_ON_HUNG_GUI | \
  2178. FLG_POOL_ENABLE_TAGGING | \
  2179. FLG_ENABLE_KDEBUG_SYMBOL_LOAD | \
  2180. FLG_ENABLE_CLOSE_EXCEPTIONS | \
  2181. FLG_ENABLE_EXCEPTION_LOGGING | \
  2182. FLG_ENABLE_HANDLE_TYPE_TAGGING | \
  2183. FLG_DISABLE_DBGPRINT | \
  2184. FLG_ENABLE_HANDLE_EXCEPTIONS \
  2185. )
  2186. //
  2187. // Routines for manipulating global atoms stored in kernel space
  2188. //
  2189. typedef USHORT RTL_ATOM, *PRTL_ATOM;
  2190. NTSYSCALLAPI
  2191. NTSTATUS
  2192. NTAPI
  2193. NtAddAtom(
  2194. IN PWSTR AtomName OPTIONAL,
  2195. IN ULONG Length OPTIONAL,
  2196. OUT PRTL_ATOM Atom OPTIONAL
  2197. );
  2198. NTSYSCALLAPI
  2199. NTSTATUS
  2200. NTAPI
  2201. NtFindAtom(
  2202. IN PWSTR AtomName,
  2203. IN ULONG Length,
  2204. OUT PRTL_ATOM Atom OPTIONAL
  2205. );
  2206. NTSYSCALLAPI
  2207. NTSTATUS
  2208. NTAPI
  2209. NtDeleteAtom(
  2210. IN RTL_ATOM Atom
  2211. );
  2212. typedef enum _ATOM_INFORMATION_CLASS {
  2213. AtomBasicInformation,
  2214. AtomTableInformation
  2215. } ATOM_INFORMATION_CLASS;
  2216. typedef struct _ATOM_BASIC_INFORMATION {
  2217. USHORT UsageCount;
  2218. USHORT Flags;
  2219. USHORT NameLength;
  2220. WCHAR Name[ 1 ];
  2221. } ATOM_BASIC_INFORMATION, *PATOM_BASIC_INFORMATION;
  2222. typedef struct _ATOM_TABLE_INFORMATION {
  2223. ULONG NumberOfAtoms;
  2224. RTL_ATOM Atoms[ 1 ];
  2225. } ATOM_TABLE_INFORMATION, *PATOM_TABLE_INFORMATION;
  2226. NTSYSCALLAPI
  2227. NTSTATUS
  2228. NTAPI
  2229. NtQueryInformationAtom(
  2230. IN RTL_ATOM Atom,
  2231. IN ATOM_INFORMATION_CLASS AtomInformationClass,
  2232. OUT PVOID AtomInformation,
  2233. IN ULONG AtomInformationLength,
  2234. OUT PULONG ReturnLength OPTIONAL
  2235. );
  2236. #ifdef __cplusplus
  2237. }
  2238. #endif
  2239. #endif // _NTEXAPI_