1 // Licensed under the Apache License, Version 2.0
2 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
4 // All files in the project carrying such notice may not be copied, modified, or distributed
5 // except according to those terms.
6 //! This module defines the 32-Bit Windows types and constants that are defined by NT, but exposed
7 //! through the Win32 API.
8 use ctypes::{__int64, __uint64, c_char, c_int, c_long, c_short, c_uint, c_ulong, c_void, wchar_t};
9 use shared::basetsd::{
10     DWORD64, KAFFINITY, LONG64, LONG_PTR, PDWORD64, PLONG64, SIZE_T, ULONG64, ULONG_PTR,
11 };
12 use shared::guiddef::{CLSID, GUID};
13 use shared::ktmtypes::UOW;
14 use shared::minwindef::{BYTE, DWORD, FALSE, PDWORD, TRUE, ULONG, USHORT, WORD};
15 #[cfg(target_arch = "aarch64")]
16 use shared::minwindef::PBYTE;
17 use vc::excpt::EXCEPTION_DISPOSITION;
18 use vc::vcruntime::size_t;
19 pub const ANYSIZE_ARRAY: usize = 1;
20 #[cfg(target_pointer_width = "32")]
21 IFDEF!{
22 pub const MAX_NATURAL_ALIGNMENT: usize = 4;
23 pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 8;
24 }
25 #[cfg(target_pointer_width = "64")]
26 IFDEF!{
27 pub const MAX_NATURAL_ALIGNMENT: usize = 8;
28 pub const MEMORY_ALLOCATION_ALIGNMENT: usize = 16;
29 }
30 pub const SYSTEM_CACHE_ALIGNMENT_SIZE: usize = 64;
31 pub type PVOID = *mut c_void;
32 pub type PVOID64 = u64; // This is a 64-bit pointer, even when in 32-bit
33 pub type VOID = c_void;
34 pub type CHAR = c_char;
35 pub type SHORT = c_short;
36 pub type LONG = c_long;
37 pub type INT = c_int;
38 pub type WCHAR = wchar_t;
39 pub type PWCHAR = *mut WCHAR;
40 pub type LPWCH = *mut WCHAR;
41 pub type PWCH = *mut WCHAR;
42 pub type LPCWCH = *const WCHAR;
43 pub type PCWCH = *const WCHAR;
44 pub type NWPSTR = *mut WCHAR;
45 pub type LPWSTR = *mut WCHAR;
46 pub type PWSTR = *mut WCHAR;
47 pub type PZPWSTR = *mut PWSTR;
48 pub type PCZPWSTR = *const PWSTR;
49 pub type LPUWSTR = *mut WCHAR; // Unaligned pointer
50 pub type PUWSTR = *mut WCHAR; // Unaligned pointer
51 pub type LPCWSTR = *const WCHAR;
52 pub type PCWSTR = *const WCHAR;
53 pub type PZPCWSTR = *mut PCWSTR;
54 pub type PCZPCWSTR = *const PCWSTR;
55 pub type LPCUWSTR = *const WCHAR; // Unaligned pointer
56 pub type PCUWSTR = *const WCHAR; // Unaligned pointer
57 pub type PZZWSTR = *mut WCHAR;
58 pub type PCZZWSTR = *const WCHAR;
59 pub type PUZZWSTR = *mut WCHAR; // Unaligned pointer
60 pub type PCUZZWSTR = *const WCHAR; // Unaligned pointer
61 pub type PNZWCH = *mut WCHAR;
62 pub type PCNZWCH = *const WCHAR;
63 pub type PUNZWCH = *mut WCHAR; // Unaligned pointer
64 pub type PCUNZWCH = *const WCHAR; // Unaligned pointer
65 pub type LPCWCHAR = *const WCHAR;
66 pub type PCWCHAR = *const WCHAR;
67 pub type LPCUWCHAR = *const WCHAR; // Unaligned pointer
68 pub type PCUWCHAR = *const WCHAR; // Unaligned pointer
69 pub type UCSCHAR = c_ulong;
70 pub const UCSCHAR_INVALID_CHARACTER: UCSCHAR = 0xffffffff;
71 pub const MIN_UCSCHAR: UCSCHAR = 0;
72 pub const MAX_UCSCHAR: UCSCHAR = 0x0010FFFF;
73 pub type PUCSCHAR = *mut UCSCHAR;
74 pub type PCUCSCHAR = *const UCSCHAR;
75 pub type PUCSSTR = *mut UCSCHAR;
76 pub type PUUCSSTR = *mut UCSCHAR; // Unaligned pointer
77 pub type PCUCSSTR = *const UCSCHAR;
78 pub type PCUUCSSTR = *const UCSCHAR; // Unaligned pointer
79 pub type PUUCSCHAR = *mut UCSCHAR; // Unaligned pointer
80 pub type PCUUCSCHAR = *const UCSCHAR; // Unaligned pointer
81 pub type PCHAR = *mut CHAR;
82 pub type LPCH = *mut CHAR;
83 pub type PCH = *mut CHAR;
84 pub type LPCCH = *const CHAR;
85 pub type PCCH = *const CHAR;
86 pub type NPSTR = *mut CHAR;
87 pub type LPSTR = *mut CHAR;
88 pub type PSTR = *mut CHAR;
89 pub type PZPSTR = *mut PSTR;
90 pub type PCZPSTR = *const PSTR;
91 pub type LPCSTR = *const CHAR;
92 pub type PCSTR = *const CHAR;
93 pub type PZPCSTR = *mut PCSTR;
94 pub type PCZPCSTR = *const PCSTR;
95 pub type PZZSTR = *mut CHAR;
96 pub type PCZZSTR = *const CHAR;
97 pub type PNZCH = *mut CHAR;
98 pub type PCNZCH = *const CHAR;
99 // Skipping TCHAR things
100 pub type PSHORT = *mut SHORT;
101 pub type PLONG = *mut LONG;
102 pub const ALL_PROCESSOR_GROUPS: WORD = 0xffff;
103 STRUCT!{struct PROCESSOR_NUMBER {
104     Group: WORD,
105     Number: BYTE,
106     Reserved: BYTE,
107 }}
108 pub type PPROCESSOR_NUMBER = *mut PROCESSOR_NUMBER;
109 STRUCT!{struct GROUP_AFFINITY {
110     Mask: KAFFINITY,
111     Group: WORD,
112     Reserved: [WORD; 3],
113 }}
114 pub type PGROUP_AFFINITY = *mut GROUP_AFFINITY;
115 #[cfg(target_pointer_width = "32")]
116 pub const MAXIMUM_PROC_PER_GROUP: BYTE = 32;
117 #[cfg(target_pointer_width = "64")]
118 pub const MAXIMUM_PROC_PER_GROUP: BYTE = 64;
119 pub const MAXIMUM_PROCESSORS: BYTE = MAXIMUM_PROC_PER_GROUP;
120 pub type HANDLE = *mut c_void;
121 pub type PHANDLE = *mut HANDLE;
122 pub type FCHAR = BYTE;
123 pub type FSHORT = WORD;
124 pub type FLONG = DWORD;
125 pub type HRESULT = c_long;
126 pub type CCHAR = c_char;
127 pub type LCID = DWORD;
128 pub type PLCID = PDWORD;
129 pub type LANGID = WORD;
130 ENUM!{enum COMPARTMENT_ID {
131     UNSPECIFIED_COMPARTMENT_ID = 0,
132     DEFAULT_COMPARTMENT_ID,
133 }}
134 pub type PCOMPARTMENT_ID = *mut COMPARTMENT_ID;
135 pub const APPLICATION_ERROR_MASK: DWORD = 0x20000000;
136 pub const ERROR_SEVERITY_SUCCESS: DWORD = 0x00000000;
137 pub const ERROR_SEVERITY_INFORMATIONAL: DWORD = 0x40000000;
138 pub const ERROR_SEVERITY_WARNING: DWORD = 0x80000000;
139 pub const ERROR_SEVERITY_ERROR: DWORD = 0xC0000000;
140 STRUCT!{struct FLOAT128 {
141     LowPart: __int64,
142     HighPart: __int64,
143 }}
144 pub type PFLOAT128 = *mut FLOAT128;
145 pub type LONGLONG = __int64;
146 pub type ULONGLONG = __uint64;
147 pub const MAXLONGLONG: LONGLONG = 0x7fffffffffffffff;
148 pub type PLONGLONG = *mut LONGLONG;
149 pub type PULONGLONG = *mut ULONGLONG;
150 pub type USN = LONGLONG;
151 pub use shared::ntdef::LARGE_INTEGER;
152 pub type PLARGE_INTEGER = *mut LARGE_INTEGER;
153 pub use shared::ntdef::ULARGE_INTEGER;
154 pub type PULARGE_INTEGER = *mut ULARGE_INTEGER;
155 pub type RTL_REFERENCE_COUNT = LONG_PTR;
156 pub type PRTL_REFERENCE_COUNT = *mut LONG_PTR;
157 pub type RTL_REFERENCE_COUNT32 = LONG;
158 pub type PRTL_REFERENCE_COUNT32 = *mut LONG;
159 pub use shared::ntdef::LUID;
160 pub type PLUID = *mut LUID;
161 pub type DWORDLONG = ULONGLONG;
162 pub type PDWORDLONG = *mut DWORDLONG;
163 pub const ANSI_NULL: CHAR = 0;
164 pub const UNICODE_NULL: WCHAR = 0;
165 pub const UNICODE_STRING_MAX_BYTES: WORD = 65534;
166 pub const UNICODE_STRING_MAX_CHARS: WORD = 32767;
167 pub type BOOLEAN = BYTE;
168 pub type PBOOLEAN = *mut BOOLEAN;
169 STRUCT!{struct LIST_ENTRY {
170     Flink: *mut LIST_ENTRY,
171     Blink: *mut LIST_ENTRY,
172 }}
173 pub type PLIST_ENTRY = *mut LIST_ENTRY;
174 pub type PRLIST_ENTRY = *mut LIST_ENTRY; // Restricted pointer
175 STRUCT!{struct SINGLE_LIST_ENTRY {
176     Next: *mut SINGLE_LIST_ENTRY,
177 }}
178 pub type PSINGLE_LIST_ENTRY = *mut SINGLE_LIST_ENTRY;
179 STRUCT!{struct LIST_ENTRY32 {
180     Flink: DWORD,
181     Blink: DWORD,
182 }}
183 pub type PLIST_ENTRY32 = *mut LIST_ENTRY32;
184 STRUCT!{struct LIST_ENTRY64 {
185     Flink: ULONGLONG,
186     Blink: ULONGLONG,
187 }}
188 pub type PLIST_ENTRY64 = *mut LIST_ENTRY64;
189 STRUCT!{struct OBJECTID {
190     Lineage: GUID,
191     Uniquifier: DWORD,
192 }}
193 pub const MINCHAR: CHAR = 0x80;
194 pub const MAXCHAR: CHAR = 0x7f;
195 pub const MINSHORT: SHORT = 0x8000;
196 pub const MAXSHORT: SHORT = 0x7fff;
197 pub const MINLONG: LONG = 0x80000000;
198 pub const MAXLONG: LONG = 0x7fffffff;
199 pub const MAXBYTE: BYTE = 0xff;
200 pub const MAXWORD: WORD = 0xffff;
201 pub const MAXDWORD: DWORD = 0xffffffff;
202 FN!{stdcall PEXCEPTION_ROUTINE(
203     ExceptionRecord: *mut EXCEPTION_RECORD,
204     EstablisherFrame: PVOID,
205     ContextRecord: *mut CONTEXT,
206     DispatcherContext: PVOID,
207 ) -> EXCEPTION_DISPOSITION}
208 pub const VER_SERVER_NT: DWORD = 0x80000000;
209 pub const VER_WORKSTATION_NT: DWORD = 0x40000000;
210 pub const VER_SUITE_SMALLBUSINESS: DWORD = 0x00000001;
211 pub const VER_SUITE_ENTERPRISE: DWORD = 0x00000002;
212 pub const VER_SUITE_BACKOFFICE: DWORD = 0x00000004;
213 pub const VER_SUITE_COMMUNICATIONS: DWORD = 0x00000008;
214 pub const VER_SUITE_TERMINAL: DWORD = 0x00000010;
215 pub const VER_SUITE_SMALLBUSINESS_RESTRICTED: DWORD = 0x00000020;
216 pub const VER_SUITE_EMBEDDEDNT: DWORD = 0x00000040;
217 pub const VER_SUITE_DATACENTER: DWORD = 0x00000080;
218 pub const VER_SUITE_SINGLEUSERTS: DWORD = 0x00000100;
219 pub const VER_SUITE_PERSONAL: DWORD = 0x00000200;
220 pub const VER_SUITE_BLADE: DWORD = 0x00000400;
221 pub const VER_SUITE_EMBEDDED_RESTRICTED: DWORD = 0x00000800;
222 pub const VER_SUITE_SECURITY_APPLIANCE: DWORD = 0x00001000;
223 pub const VER_SUITE_STORAGE_SERVER: DWORD = 0x00002000;
224 pub const VER_SUITE_COMPUTE_SERVER: DWORD = 0x00004000;
225 pub const VER_SUITE_WH_SERVER: DWORD = 0x00008000;
226 pub const PRODUCT_UNDEFINED: DWORD = 0x00000000;
227 pub const PRODUCT_ULTIMATE: DWORD = 0x00000001;
228 pub const PRODUCT_HOME_BASIC: DWORD = 0x00000002;
229 pub const PRODUCT_HOME_PREMIUM: DWORD = 0x00000003;
230 pub const PRODUCT_ENTERPRISE: DWORD = 0x00000004;
231 pub const PRODUCT_HOME_BASIC_N: DWORD = 0x00000005;
232 pub const PRODUCT_BUSINESS: DWORD = 0x00000006;
233 pub const PRODUCT_STANDARD_SERVER: DWORD = 0x00000007;
234 pub const PRODUCT_DATACENTER_SERVER: DWORD = 0x00000008;
235 pub const PRODUCT_SMALLBUSINESS_SERVER: DWORD = 0x00000009;
236 pub const PRODUCT_ENTERPRISE_SERVER: DWORD = 0x0000000A;
237 pub const PRODUCT_STARTER: DWORD = 0x0000000B;
238 pub const PRODUCT_DATACENTER_SERVER_CORE: DWORD = 0x0000000C;
239 pub const PRODUCT_STANDARD_SERVER_CORE: DWORD = 0x0000000D;
240 pub const PRODUCT_ENTERPRISE_SERVER_CORE: DWORD = 0x0000000E;
241 pub const PRODUCT_ENTERPRISE_SERVER_IA64: DWORD = 0x0000000F;
242 pub const PRODUCT_BUSINESS_N: DWORD = 0x00000010;
243 pub const PRODUCT_WEB_SERVER: DWORD = 0x00000011;
244 pub const PRODUCT_CLUSTER_SERVER: DWORD = 0x00000012;
245 pub const PRODUCT_HOME_SERVER: DWORD = 0x00000013;
246 pub const PRODUCT_STORAGE_EXPRESS_SERVER: DWORD = 0x00000014;
247 pub const PRODUCT_STORAGE_STANDARD_SERVER: DWORD = 0x00000015;
248 pub const PRODUCT_STORAGE_WORKGROUP_SERVER: DWORD = 0x00000016;
249 pub const PRODUCT_STORAGE_ENTERPRISE_SERVER: DWORD = 0x00000017;
250 pub const PRODUCT_SERVER_FOR_SMALLBUSINESS: DWORD = 0x00000018;
251 pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: DWORD = 0x00000019;
252 pub const PRODUCT_HOME_PREMIUM_N: DWORD = 0x0000001A;
253 pub const PRODUCT_ENTERPRISE_N: DWORD = 0x0000001B;
254 pub const PRODUCT_ULTIMATE_N: DWORD = 0x0000001C;
255 pub const PRODUCT_WEB_SERVER_CORE: DWORD = 0x0000001D;
256 pub const PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT: DWORD = 0x0000001E;
257 pub const PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY: DWORD = 0x0000001F;
258 pub const PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING: DWORD = 0x00000020;
259 pub const PRODUCT_SERVER_FOUNDATION: DWORD = 0x00000021;
260 pub const PRODUCT_HOME_PREMIUM_SERVER: DWORD = 0x00000022;
261 pub const PRODUCT_SERVER_FOR_SMALLBUSINESS_V: DWORD = 0x00000023;
262 pub const PRODUCT_STANDARD_SERVER_V: DWORD = 0x00000024;
263 pub const PRODUCT_DATACENTER_SERVER_V: DWORD = 0x00000025;
264 pub const PRODUCT_ENTERPRISE_SERVER_V: DWORD = 0x00000026;
265 pub const PRODUCT_DATACENTER_SERVER_CORE_V: DWORD = 0x00000027;
266 pub const PRODUCT_STANDARD_SERVER_CORE_V: DWORD = 0x00000028;
267 pub const PRODUCT_ENTERPRISE_SERVER_CORE_V: DWORD = 0x00000029;
268 pub const PRODUCT_HYPERV: DWORD = 0x0000002A;
269 pub const PRODUCT_STORAGE_EXPRESS_SERVER_CORE: DWORD = 0x0000002B;
270 pub const PRODUCT_STORAGE_STANDARD_SERVER_CORE: DWORD = 0x0000002C;
271 pub const PRODUCT_STORAGE_WORKGROUP_SERVER_CORE: DWORD = 0x0000002D;
272 pub const PRODUCT_STORAGE_ENTERPRISE_SERVER_CORE: DWORD = 0x0000002E;
273 pub const PRODUCT_STARTER_N: DWORD = 0x0000002F;
274 pub const PRODUCT_PROFESSIONAL: DWORD = 0x00000030;
275 pub const PRODUCT_PROFESSIONAL_N: DWORD = 0x00000031;
276 pub const PRODUCT_SB_SOLUTION_SERVER: DWORD = 0x00000032;
277 pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS: DWORD = 0x00000033;
278 pub const PRODUCT_STANDARD_SERVER_SOLUTIONS: DWORD = 0x00000034;
279 pub const PRODUCT_STANDARD_SERVER_SOLUTIONS_CORE: DWORD = 0x00000035;
280 pub const PRODUCT_SB_SOLUTION_SERVER_EM: DWORD = 0x00000036;
281 pub const PRODUCT_SERVER_FOR_SB_SOLUTIONS_EM: DWORD = 0x00000037;
282 pub const PRODUCT_SOLUTION_EMBEDDEDSERVER: DWORD = 0x00000038;
283 pub const PRODUCT_SOLUTION_EMBEDDEDSERVER_CORE: DWORD = 0x00000039;
284 pub const PRODUCT_PROFESSIONAL_EMBEDDED: DWORD = 0x0000003A;
285 pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMT: DWORD = 0x0000003B;
286 pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDL: DWORD = 0x0000003C;
287 pub const PRODUCT_ESSENTIALBUSINESS_SERVER_MGMTSVC: DWORD = 0x0000003D;
288 pub const PRODUCT_ESSENTIALBUSINESS_SERVER_ADDLSVC: DWORD = 0x0000003E;
289 pub const PRODUCT_SMALLBUSINESS_SERVER_PREMIUM_CORE: DWORD = 0x0000003F;
290 pub const PRODUCT_CLUSTER_SERVER_V: DWORD = 0x00000040;
291 pub const PRODUCT_EMBEDDED: DWORD = 0x00000041;
292 pub const PRODUCT_STARTER_E: DWORD = 0x00000042;
293 pub const PRODUCT_HOME_BASIC_E: DWORD = 0x00000043;
294 pub const PRODUCT_HOME_PREMIUM_E: DWORD = 0x00000044;
295 pub const PRODUCT_PROFESSIONAL_E: DWORD = 0x00000045;
296 pub const PRODUCT_ENTERPRISE_E: DWORD = 0x00000046;
297 pub const PRODUCT_ULTIMATE_E: DWORD = 0x00000047;
298 pub const PRODUCT_ENTERPRISE_EVALUATION: DWORD = 0x00000048;
299 pub const PRODUCT_MULTIPOINT_STANDARD_SERVER: DWORD = 0x0000004C;
300 pub const PRODUCT_MULTIPOINT_PREMIUM_SERVER: DWORD = 0x0000004D;
301 pub const PRODUCT_STANDARD_EVALUATION_SERVER: DWORD = 0x0000004F;
302 pub const PRODUCT_DATACENTER_EVALUATION_SERVER: DWORD = 0x00000050;
303 pub const PRODUCT_ENTERPRISE_N_EVALUATION: DWORD = 0x00000054;
304 pub const PRODUCT_EMBEDDED_AUTOMOTIVE: DWORD = 0x00000055;
305 pub const PRODUCT_EMBEDDED_INDUSTRY_A: DWORD = 0x00000056;
306 pub const PRODUCT_THINPC: DWORD = 0x00000057;
307 pub const PRODUCT_EMBEDDED_A: DWORD = 0x00000058;
308 pub const PRODUCT_EMBEDDED_INDUSTRY: DWORD = 0x00000059;
309 pub const PRODUCT_EMBEDDED_E: DWORD = 0x0000005A;
310 pub const PRODUCT_EMBEDDED_INDUSTRY_E: DWORD = 0x0000005B;
311 pub const PRODUCT_EMBEDDED_INDUSTRY_A_E: DWORD = 0x0000005C;
312 pub const PRODUCT_STORAGE_WORKGROUP_EVALUATION_SERVER: DWORD = 0x0000005F;
313 pub const PRODUCT_STORAGE_STANDARD_EVALUATION_SERVER: DWORD = 0x00000060;
314 pub const PRODUCT_CORE_ARM: DWORD = 0x00000061;
315 pub const PRODUCT_CORE_N: DWORD = 0x00000062;
316 pub const PRODUCT_CORE_COUNTRYSPECIFIC: DWORD = 0x00000063;
317 pub const PRODUCT_CORE_SINGLELANGUAGE: DWORD = 0x00000064;
318 pub const PRODUCT_CORE: DWORD = 0x00000065;
319 pub const PRODUCT_PROFESSIONAL_WMC: DWORD = 0x00000067;
320 pub const PRODUCT_MOBILE_CORE: DWORD = 0x00000068;
321 pub const PRODUCT_EMBEDDED_INDUSTRY_EVAL: DWORD = 0x00000069;
322 pub const PRODUCT_EMBEDDED_INDUSTRY_E_EVAL: DWORD = 0x0000006A;
323 pub const PRODUCT_EMBEDDED_EVAL: DWORD = 0x0000006B;
324 pub const PRODUCT_EMBEDDED_E_EVAL: DWORD = 0x0000006C;
325 pub const PRODUCT_NANO_SERVER: DWORD = 0x0000006D;
326 pub const PRODUCT_CLOUD_STORAGE_SERVER: DWORD = 0x0000006E;
327 pub const PRODUCT_CORE_CONNECTED: DWORD = 0x0000006F;
328 pub const PRODUCT_PROFESSIONAL_STUDENT: DWORD = 0x00000070;
329 pub const PRODUCT_CORE_CONNECTED_N: DWORD = 0x00000071;
330 pub const PRODUCT_PROFESSIONAL_STUDENT_N: DWORD = 0x00000072;
331 pub const PRODUCT_CORE_CONNECTED_SINGLELANGUAGE: DWORD = 0x00000073;
332 pub const PRODUCT_CORE_CONNECTED_COUNTRYSPECIFIC: DWORD = 0x00000074;
333 pub const PRODUCT_CONNECTED_CAR: DWORD = 0x00000075;
334 pub const PRODUCT_INDUSTRY_HANDHELD: DWORD = 0x00000076;
335 pub const PRODUCT_PPI_PRO: DWORD = 0x00000077;
336 pub const PRODUCT_ARM64_SERVER: DWORD = 0x00000078;
337 pub const PRODUCT_EDUCATION: DWORD = 0x00000079;
338 pub const PRODUCT_EDUCATION_N: DWORD = 0x0000007A;
339 pub const PRODUCT_IOTUAP: DWORD = 0x0000007B;
340 pub const PRODUCT_CLOUD_HOST_INFRASTRUCTURE_SERVER: DWORD = 0x0000007C;
341 pub const PRODUCT_ENTERPRISE_S: DWORD = 0x0000007D;
342 pub const PRODUCT_ENTERPRISE_S_N: DWORD = 0x0000007E;
343 pub const PRODUCT_PROFESSIONAL_S: DWORD = 0x0000007F;
344 pub const PRODUCT_PROFESSIONAL_S_N: DWORD = 0x00000080;
345 pub const PRODUCT_ENTERPRISE_S_EVALUATION: DWORD = 0x00000081;
346 pub const PRODUCT_ENTERPRISE_S_N_EVALUATION: DWORD = 0x00000082;
347 pub const PRODUCT_HOLOGRAPHIC: DWORD = 0x00000087;
348 pub const PRODUCT_PRO_SINGLE_LANGUAGE: DWORD = 0x0000008A;
349 pub const PRODUCT_PRO_CHINA: DWORD = 0x0000008B;
350 pub const PRODUCT_ENTERPRISE_SUBSCRIPTION: DWORD = 0x0000008C;
351 pub const PRODUCT_ENTERPRISE_SUBSCRIPTION_N: DWORD = 0x0000008D;
352 pub const PRODUCT_DATACENTER_NANO_SERVER: DWORD = 0x0000008F;
353 pub const PRODUCT_STANDARD_NANO_SERVER: DWORD = 0x00000090;
354 pub const PRODUCT_DATACENTER_A_SERVER_CORE: DWORD = 0x00000091;
355 pub const PRODUCT_STANDARD_A_SERVER_CORE: DWORD = 0x00000092;
356 pub const PRODUCT_DATACENTER_WS_SERVER_CORE: DWORD = 0x00000093;
357 pub const PRODUCT_STANDARD_WS_SERVER_CORE: DWORD = 0x00000094;
358 pub const PRODUCT_UTILITY_VM: DWORD = 0x00000095;
359 pub const PRODUCT_DATACENTER_EVALUATION_SERVER_CORE: DWORD = 0x0000009F;
360 pub const PRODUCT_STANDARD_EVALUATION_SERVER_CORE: DWORD = 0x000000A0;
361 pub const PRODUCT_PRO_WORKSTATION: DWORD = 0x000000A1;
362 pub const PRODUCT_PRO_WORKSTATION_N: DWORD = 0x000000A2;
363 pub const PRODUCT_PRO_FOR_EDUCATION: DWORD = 0x000000A4;
364 pub const PRODUCT_PRO_FOR_EDUCATION_N: DWORD = 0x000000A5;
365 pub const PRODUCT_AZURE_SERVER_CORE: DWORD = 0x000000A8;
366 pub const PRODUCT_AZURE_NANO_SERVER: DWORD = 0x000000A9;
367 pub const PRODUCT_ENTERPRISEG: DWORD = 0x000000AB;
368 pub const PRODUCT_ENTERPRISEGN: DWORD = 0x000000AC;
369 pub const PRODUCT_CLOUD: DWORD = 0x000000B2;
370 pub const PRODUCT_CLOUDN: DWORD = 0x000000B3;
371 pub const PRODUCT_UNLICENSED: DWORD = 0xABCDABCD;
372 pub const LANG_NEUTRAL: WORD = 0x00;
373 pub const LANG_INVARIANT: WORD = 0x7f;
374 pub const LANG_AFRIKAANS: WORD = 0x36;
375 pub const LANG_ALBANIAN: WORD = 0x1c;
376 pub const LANG_ALSATIAN: WORD = 0x84;
377 pub const LANG_AMHARIC: WORD = 0x5e;
378 pub const LANG_ARABIC: WORD = 0x01;
379 pub const LANG_ARMENIAN: WORD = 0x2b;
380 pub const LANG_ASSAMESE: WORD = 0x4d;
381 pub const LANG_AZERI: WORD = 0x2c;
382 pub const LANG_AZERBAIJANI: WORD = 0x2c;
383 pub const LANG_BANGLA: WORD = 0x45;
384 pub const LANG_BASHKIR: WORD = 0x6d;
385 pub const LANG_BASQUE: WORD = 0x2d;
386 pub const LANG_BELARUSIAN: WORD = 0x23;
387 pub const LANG_BENGALI: WORD = 0x45;
388 pub const LANG_BRETON: WORD = 0x7e;
389 pub const LANG_BOSNIAN: WORD = 0x1a;
390 pub const LANG_BOSNIAN_NEUTRAL: WORD = 0x781a;
391 pub const LANG_BULGARIAN: WORD = 0x02;
392 pub const LANG_CATALAN: WORD = 0x03;
393 pub const LANG_CENTRAL_KURDISH: WORD = 0x92;
394 pub const LANG_CHEROKEE: WORD = 0x5c;
395 pub const LANG_CHINESE: WORD = 0x04;
396 pub const LANG_CHINESE_SIMPLIFIED: WORD = 0x04;
397 pub const LANG_CHINESE_TRADITIONAL: WORD = 0x7c04;
398 pub const LANG_CORSICAN: WORD = 0x83;
399 pub const LANG_CROATIAN: WORD = 0x1a;
400 pub const LANG_CZECH: WORD = 0x05;
401 pub const LANG_DANISH: WORD = 0x06;
402 pub const LANG_DARI: WORD = 0x8c;
403 pub const LANG_DIVEHI: WORD = 0x65;
404 pub const LANG_DUTCH: WORD = 0x13;
405 pub const LANG_ENGLISH: WORD = 0x09;
406 pub const LANG_ESTONIAN: WORD = 0x25;
407 pub const LANG_FAEROESE: WORD = 0x38;
408 pub const LANG_FARSI: WORD = 0x29;
409 pub const LANG_FILIPINO: WORD = 0x64;
410 pub const LANG_FINNISH: WORD = 0x0b;
411 pub const LANG_FRENCH: WORD = 0x0c;
412 pub const LANG_FRISIAN: WORD = 0x62;
413 pub const LANG_FULAH: WORD = 0x67;
414 pub const LANG_GALICIAN: WORD = 0x56;
415 pub const LANG_GEORGIAN: WORD = 0x37;
416 pub const LANG_GERMAN: WORD = 0x07;
417 pub const LANG_GREEK: WORD = 0x08;
418 pub const LANG_GREENLANDIC: WORD = 0x6f;
419 pub const LANG_GUJARATI: WORD = 0x47;
420 pub const LANG_HAUSA: WORD = 0x68;
421 pub const LANG_HAWAIIAN: WORD = 0x75;
422 pub const LANG_HEBREW: WORD = 0x0d;
423 pub const LANG_HINDI: WORD = 0x39;
424 pub const LANG_HUNGARIAN: WORD = 0x0e;
425 pub const LANG_ICELANDIC: WORD = 0x0f;
426 pub const LANG_IGBO: WORD = 0x70;
427 pub const LANG_INDONESIAN: WORD = 0x21;
428 pub const LANG_INUKTITUT: WORD = 0x5d;
429 pub const LANG_IRISH: WORD = 0x3c;
430 pub const LANG_ITALIAN: WORD = 0x10;
431 pub const LANG_JAPANESE: WORD = 0x11;
432 pub const LANG_KANNADA: WORD = 0x4b;
433 pub const LANG_KASHMIRI: WORD = 0x60;
434 pub const LANG_KAZAK: WORD = 0x3f;
435 pub const LANG_KHMER: WORD = 0x53;
436 pub const LANG_KICHE: WORD = 0x86;
437 pub const LANG_KINYARWANDA: WORD = 0x87;
438 pub const LANG_KONKANI: WORD = 0x57;
439 pub const LANG_KOREAN: WORD = 0x12;
440 pub const LANG_KYRGYZ: WORD = 0x40;
441 pub const LANG_LAO: WORD = 0x54;
442 pub const LANG_LATVIAN: WORD = 0x26;
443 pub const LANG_LITHUANIAN: WORD = 0x27;
444 pub const LANG_LOWER_SORBIAN: WORD = 0x2e;
445 pub const LANG_LUXEMBOURGISH: WORD = 0x6e;
446 pub const LANG_MACEDONIAN: WORD = 0x2f;
447 pub const LANG_MALAY: WORD = 0x3e;
448 pub const LANG_MALAYALAM: WORD = 0x4c;
449 pub const LANG_MALTESE: WORD = 0x3a;
450 pub const LANG_MANIPURI: WORD = 0x58;
451 pub const LANG_MAORI: WORD = 0x81;
452 pub const LANG_MAPUDUNGUN: WORD = 0x7a;
453 pub const LANG_MARATHI: WORD = 0x4e;
454 pub const LANG_MOHAWK: WORD = 0x7c;
455 pub const LANG_MONGOLIAN: WORD = 0x50;
456 pub const LANG_NEPALI: WORD = 0x61;
457 pub const LANG_NORWEGIAN: WORD = 0x14;
458 pub const LANG_OCCITAN: WORD = 0x82;
459 pub const LANG_ODIA: WORD = 0x48;
460 pub const LANG_ORIYA: WORD = 0x48;
461 pub const LANG_PASHTO: WORD = 0x63;
462 pub const LANG_PERSIAN: WORD = 0x29;
463 pub const LANG_POLISH: WORD = 0x15;
464 pub const LANG_PORTUGUESE: WORD = 0x16;
465 pub const LANG_PULAR: WORD = 0x67;
466 pub const LANG_PUNJABI: WORD = 0x46;
467 pub const LANG_QUECHUA: WORD = 0x6b;
468 pub const LANG_ROMANIAN: WORD = 0x18;
469 pub const LANG_ROMANSH: WORD = 0x17;
470 pub const LANG_RUSSIAN: WORD = 0x19;
471 pub const LANG_SAKHA: WORD = 0x85;
472 pub const LANG_SAMI: WORD = 0x3b;
473 pub const LANG_SANSKRIT: WORD = 0x4f;
474 pub const LANG_SCOTTISH_GAELIC: WORD = 0x91;
475 pub const LANG_SERBIAN: WORD = 0x1a;
476 pub const LANG_SERBIAN_NEUTRAL: WORD = 0x7c1a;
477 pub const LANG_SINDHI: WORD = 0x59;
478 pub const LANG_SINHALESE: WORD = 0x5b;
479 pub const LANG_SLOVAK: WORD = 0x1b;
480 pub const LANG_SLOVENIAN: WORD = 0x24;
481 pub const LANG_SOTHO: WORD = 0x6c;
482 pub const LANG_SPANISH: WORD = 0x0a;
483 pub const LANG_SWAHILI: WORD = 0x41;
484 pub const LANG_SWEDISH: WORD = 0x1d;
485 pub const LANG_SYRIAC: WORD = 0x5a;
486 pub const LANG_TAJIK: WORD = 0x28;
487 pub const LANG_TAMAZIGHT: WORD = 0x5f;
488 pub const LANG_TAMIL: WORD = 0x49;
489 pub const LANG_TATAR: WORD = 0x44;
490 pub const LANG_TELUGU: WORD = 0x4a;
491 pub const LANG_THAI: WORD = 0x1e;
492 pub const LANG_TIBETAN: WORD = 0x51;
493 pub const LANG_TIGRIGNA: WORD = 0x73;
494 pub const LANG_TIGRINYA: WORD = 0x73;
495 pub const LANG_TSWANA: WORD = 0x32;
496 pub const LANG_TURKISH: WORD = 0x1f;
497 pub const LANG_TURKMEN: WORD = 0x42;
498 pub const LANG_UIGHUR: WORD = 0x80;
499 pub const LANG_UKRAINIAN: WORD = 0x22;
500 pub const LANG_UPPER_SORBIAN: WORD = 0x2e;
501 pub const LANG_URDU: WORD = 0x20;
502 pub const LANG_UZBEK: WORD = 0x43;
503 pub const LANG_VALENCIAN: WORD = 0x03;
504 pub const LANG_VIETNAMESE: WORD = 0x2a;
505 pub const LANG_WELSH: WORD = 0x52;
506 pub const LANG_WOLOF: WORD = 0x88;
507 pub const LANG_XHOSA: WORD = 0x34;
508 pub const LANG_YAKUT: WORD = 0x85;
509 pub const LANG_YI: WORD = 0x78;
510 pub const LANG_YORUBA: WORD = 0x6a;
511 pub const LANG_ZULU: WORD = 0x35;
512 pub const SUBLANG_NEUTRAL: WORD = 0x00;
513 pub const SUBLANG_DEFAULT: WORD = 0x01;
514 pub const SUBLANG_SYS_DEFAULT: WORD = 0x02;
515 pub const SUBLANG_CUSTOM_DEFAULT: WORD = 0x03;
516 pub const SUBLANG_CUSTOM_UNSPECIFIED: WORD = 0x04;
517 pub const SUBLANG_UI_CUSTOM_DEFAULT: WORD = 0x05;
518 pub const SUBLANG_AFRIKAANS_SOUTH_AFRICA: WORD = 0x01;
519 pub const SUBLANG_ALBANIAN_ALBANIA: WORD = 0x01;
520 pub const SUBLANG_ALSATIAN_FRANCE: WORD = 0x01;
521 pub const SUBLANG_AMHARIC_ETHIOPIA: WORD = 0x01;
522 pub const SUBLANG_ARABIC_SAUDI_ARABIA: WORD = 0x01;
523 pub const SUBLANG_ARABIC_IRAQ: WORD = 0x02;
524 pub const SUBLANG_ARABIC_EGYPT: WORD = 0x03;
525 pub const SUBLANG_ARABIC_LIBYA: WORD = 0x04;
526 pub const SUBLANG_ARABIC_ALGERIA: WORD = 0x05;
527 pub const SUBLANG_ARABIC_MOROCCO: WORD = 0x06;
528 pub const SUBLANG_ARABIC_TUNISIA: WORD = 0x07;
529 pub const SUBLANG_ARABIC_OMAN: WORD = 0x08;
530 pub const SUBLANG_ARABIC_YEMEN: WORD = 0x09;
531 pub const SUBLANG_ARABIC_SYRIA: WORD = 0x0a;
532 pub const SUBLANG_ARABIC_JORDAN: WORD = 0x0b;
533 pub const SUBLANG_ARABIC_LEBANON: WORD = 0x0c;
534 pub const SUBLANG_ARABIC_KUWAIT: WORD = 0x0d;
535 pub const SUBLANG_ARABIC_UAE: WORD = 0x0e;
536 pub const SUBLANG_ARABIC_BAHRAIN: WORD = 0x0f;
537 pub const SUBLANG_ARABIC_QATAR: WORD = 0x10;
538 pub const SUBLANG_ARMENIAN_ARMENIA: WORD = 0x01;
539 pub const SUBLANG_ASSAMESE_INDIA: WORD = 0x01;
540 pub const SUBLANG_AZERI_LATIN: WORD = 0x01;
541 pub const SUBLANG_AZERI_CYRILLIC: WORD = 0x02;
542 pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_LATIN: WORD = 0x01;
543 pub const SUBLANG_AZERBAIJANI_AZERBAIJAN_CYRILLIC: WORD = 0x02;
544 pub const SUBLANG_BANGLA_INDIA: WORD = 0x01;
545 pub const SUBLANG_BANGLA_BANGLADESH: WORD = 0x02;
546 pub const SUBLANG_BASHKIR_RUSSIA: WORD = 0x01;
547 pub const SUBLANG_BASQUE_BASQUE: WORD = 0x01;
548 pub const SUBLANG_BELARUSIAN_BELARUS: WORD = 0x01;
549 pub const SUBLANG_BENGALI_INDIA: WORD = 0x01;
550 pub const SUBLANG_BENGALI_BANGLADESH: WORD = 0x02;
551 pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x05;
552 pub const SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC: WORD = 0x08;
553 pub const SUBLANG_BRETON_FRANCE: WORD = 0x01;
554 pub const SUBLANG_BULGARIAN_BULGARIA: WORD = 0x01;
555 pub const SUBLANG_CATALAN_CATALAN: WORD = 0x01;
556 pub const SUBLANG_CENTRAL_KURDISH_IRAQ: WORD = 0x01;
557 pub const SUBLANG_CHEROKEE_CHEROKEE: WORD = 0x01;
558 pub const SUBLANG_CHINESE_TRADITIONAL: WORD = 0x01;
559 pub const SUBLANG_CHINESE_SIMPLIFIED: WORD = 0x02;
560 pub const SUBLANG_CHINESE_HONGKONG: WORD = 0x03;
561 pub const SUBLANG_CHINESE_SINGAPORE: WORD = 0x04;
562 pub const SUBLANG_CHINESE_MACAU: WORD = 0x05;
563 pub const SUBLANG_CORSICAN_FRANCE: WORD = 0x01;
564 pub const SUBLANG_CZECH_CZECH_REPUBLIC: WORD = 0x01;
565 pub const SUBLANG_CROATIAN_CROATIA: WORD = 0x01;
566 pub const SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x04;
567 pub const SUBLANG_DANISH_DENMARK: WORD = 0x01;
568 pub const SUBLANG_DARI_AFGHANISTAN: WORD = 0x01;
569 pub const SUBLANG_DIVEHI_MALDIVES: WORD = 0x01;
570 pub const SUBLANG_DUTCH: WORD = 0x01;
571 pub const SUBLANG_DUTCH_BELGIAN: WORD = 0x02;
572 pub const SUBLANG_ENGLISH_US: WORD = 0x01;
573 pub const SUBLANG_ENGLISH_UK: WORD = 0x02;
574 pub const SUBLANG_ENGLISH_AUS: WORD = 0x03;
575 pub const SUBLANG_ENGLISH_CAN: WORD = 0x04;
576 pub const SUBLANG_ENGLISH_NZ: WORD = 0x05;
577 pub const SUBLANG_ENGLISH_EIRE: WORD = 0x06;
578 pub const SUBLANG_ENGLISH_SOUTH_AFRICA: WORD = 0x07;
579 pub const SUBLANG_ENGLISH_JAMAICA: WORD = 0x08;
580 pub const SUBLANG_ENGLISH_CARIBBEAN: WORD = 0x09;
581 pub const SUBLANG_ENGLISH_BELIZE: WORD = 0x0a;
582 pub const SUBLANG_ENGLISH_TRINIDAD: WORD = 0x0b;
583 pub const SUBLANG_ENGLISH_ZIMBABWE: WORD = 0x0c;
584 pub const SUBLANG_ENGLISH_PHILIPPINES: WORD = 0x0d;
585 pub const SUBLANG_ENGLISH_INDIA: WORD = 0x10;
586 pub const SUBLANG_ENGLISH_MALAYSIA: WORD = 0x11;
587 pub const SUBLANG_ENGLISH_SINGAPORE: WORD = 0x12;
588 pub const SUBLANG_ESTONIAN_ESTONIA: WORD = 0x01;
589 pub const SUBLANG_FAEROESE_FAROE_ISLANDS: WORD = 0x01;
590 pub const SUBLANG_FILIPINO_PHILIPPINES: WORD = 0x01;
591 pub const SUBLANG_FINNISH_FINLAND: WORD = 0x01;
592 pub const SUBLANG_FRENCH: WORD = 0x01;
593 pub const SUBLANG_FRENCH_BELGIAN: WORD = 0x02;
594 pub const SUBLANG_FRENCH_CANADIAN: WORD = 0x03;
595 pub const SUBLANG_FRENCH_SWISS: WORD = 0x04;
596 pub const SUBLANG_FRENCH_LUXEMBOURG: WORD = 0x05;
597 pub const SUBLANG_FRENCH_MONACO: WORD = 0x06;
598 pub const SUBLANG_FRISIAN_NETHERLANDS: WORD = 0x01;
599 pub const SUBLANG_FULAH_SENEGAL: WORD = 0x02;
600 pub const SUBLANG_GALICIAN_GALICIAN: WORD = 0x01;
601 pub const SUBLANG_GEORGIAN_GEORGIA: WORD = 0x01;
602 pub const SUBLANG_GERMAN: WORD = 0x01;
603 pub const SUBLANG_GERMAN_SWISS: WORD = 0x02;
604 pub const SUBLANG_GERMAN_AUSTRIAN: WORD = 0x03;
605 pub const SUBLANG_GERMAN_LUXEMBOURG: WORD = 0x04;
606 pub const SUBLANG_GERMAN_LIECHTENSTEIN: WORD = 0x05;
607 pub const SUBLANG_GREEK_GREECE: WORD = 0x01;
608 pub const SUBLANG_GREENLANDIC_GREENLAND: WORD = 0x01;
609 pub const SUBLANG_GUJARATI_INDIA: WORD = 0x01;
610 pub const SUBLANG_HAUSA_NIGERIA_LATIN: WORD = 0x01;
611 pub const SUBLANG_HAWAIIAN_US: WORD = 0x01;
612 pub const SUBLANG_HEBREW_ISRAEL: WORD = 0x01;
613 pub const SUBLANG_HINDI_INDIA: WORD = 0x01;
614 pub const SUBLANG_HUNGARIAN_HUNGARY: WORD = 0x01;
615 pub const SUBLANG_ICELANDIC_ICELAND: WORD = 0x01;
616 pub const SUBLANG_IGBO_NIGERIA: WORD = 0x01;
617 pub const SUBLANG_INDONESIAN_INDONESIA: WORD = 0x01;
618 pub const SUBLANG_INUKTITUT_CANADA: WORD = 0x01;
619 pub const SUBLANG_INUKTITUT_CANADA_LATIN: WORD = 0x02;
620 pub const SUBLANG_IRISH_IRELAND: WORD = 0x02;
621 pub const SUBLANG_ITALIAN: WORD = 0x01;
622 pub const SUBLANG_ITALIAN_SWISS: WORD = 0x02;
623 pub const SUBLANG_JAPANESE_JAPAN: WORD = 0x01;
624 pub const SUBLANG_KANNADA_INDIA: WORD = 0x01;
625 pub const SUBLANG_KASHMIRI_SASIA: WORD = 0x02;
626 pub const SUBLANG_KASHMIRI_INDIA: WORD = 0x02;
627 pub const SUBLANG_KAZAK_KAZAKHSTAN: WORD = 0x01;
628 pub const SUBLANG_KHMER_CAMBODIA: WORD = 0x01;
629 pub const SUBLANG_KICHE_GUATEMALA: WORD = 0x01;
630 pub const SUBLANG_KINYARWANDA_RWANDA: WORD = 0x01;
631 pub const SUBLANG_KONKANI_INDIA: WORD = 0x01;
632 pub const SUBLANG_KOREAN: WORD = 0x01;
633 pub const SUBLANG_KYRGYZ_KYRGYZSTAN: WORD = 0x01;
634 pub const SUBLANG_LAO_LAO: WORD = 0x01;
635 pub const SUBLANG_LATVIAN_LATVIA: WORD = 0x01;
636 pub const SUBLANG_LITHUANIAN: WORD = 0x01;
637 pub const SUBLANG_LOWER_SORBIAN_GERMANY: WORD = 0x02;
638 pub const SUBLANG_LUXEMBOURGISH_LUXEMBOURG: WORD = 0x01;
639 pub const SUBLANG_MACEDONIAN_MACEDONIA: WORD = 0x01;
640 pub const SUBLANG_MALAY_MALAYSIA: WORD = 0x01;
641 pub const SUBLANG_MALAY_BRUNEI_DARUSSALAM: WORD = 0x02;
642 pub const SUBLANG_MALAYALAM_INDIA: WORD = 0x01;
643 pub const SUBLANG_MALTESE_MALTA: WORD = 0x01;
644 pub const SUBLANG_MAORI_NEW_ZEALAND: WORD = 0x01;
645 pub const SUBLANG_MAPUDUNGUN_CHILE: WORD = 0x01;
646 pub const SUBLANG_MARATHI_INDIA: WORD = 0x01;
647 pub const SUBLANG_MOHAWK_MOHAWK: WORD = 0x01;
648 pub const SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA: WORD = 0x01;
649 pub const SUBLANG_MONGOLIAN_PRC: WORD = 0x02;
650 pub const SUBLANG_NEPALI_INDIA: WORD = 0x02;
651 pub const SUBLANG_NEPALI_NEPAL: WORD = 0x01;
652 pub const SUBLANG_NORWEGIAN_BOKMAL: WORD = 0x01;
653 pub const SUBLANG_NORWEGIAN_NYNORSK: WORD = 0x02;
654 pub const SUBLANG_OCCITAN_FRANCE: WORD = 0x01;
655 pub const SUBLANG_ODIA_INDIA: WORD = 0x01;
656 pub const SUBLANG_ORIYA_INDIA: WORD = 0x01;
657 pub const SUBLANG_PASHTO_AFGHANISTAN: WORD = 0x01;
658 pub const SUBLANG_PERSIAN_IRAN: WORD = 0x01;
659 pub const SUBLANG_POLISH_POLAND: WORD = 0x01;
660 pub const SUBLANG_PORTUGUESE: WORD = 0x02;
661 pub const SUBLANG_PORTUGUESE_BRAZILIAN: WORD = 0x01;
662 pub const SUBLANG_PULAR_SENEGAL: WORD = 0x02;
663 pub const SUBLANG_PUNJABI_INDIA: WORD = 0x01;
664 pub const SUBLANG_PUNJABI_PAKISTAN: WORD = 0x02;
665 pub const SUBLANG_QUECHUA_BOLIVIA: WORD = 0x01;
666 pub const SUBLANG_QUECHUA_ECUADOR: WORD = 0x02;
667 pub const SUBLANG_QUECHUA_PERU: WORD = 0x03;
668 pub const SUBLANG_ROMANIAN_ROMANIA: WORD = 0x01;
669 pub const SUBLANG_ROMANSH_SWITZERLAND: WORD = 0x01;
670 pub const SUBLANG_RUSSIAN_RUSSIA: WORD = 0x01;
671 pub const SUBLANG_SAKHA_RUSSIA: WORD = 0x01;
672 pub const SUBLANG_SAMI_NORTHERN_NORWAY: WORD = 0x01;
673 pub const SUBLANG_SAMI_NORTHERN_SWEDEN: WORD = 0x02;
674 pub const SUBLANG_SAMI_NORTHERN_FINLAND: WORD = 0x03;
675 pub const SUBLANG_SAMI_LULE_NORWAY: WORD = 0x04;
676 pub const SUBLANG_SAMI_LULE_SWEDEN: WORD = 0x05;
677 pub const SUBLANG_SAMI_SOUTHERN_NORWAY: WORD = 0x06;
678 pub const SUBLANG_SAMI_SOUTHERN_SWEDEN: WORD = 0x07;
679 pub const SUBLANG_SAMI_SKOLT_FINLAND: WORD = 0x08;
680 pub const SUBLANG_SAMI_INARI_FINLAND: WORD = 0x09;
681 pub const SUBLANG_SANSKRIT_INDIA: WORD = 0x01;
682 pub const SUBLANG_SCOTTISH_GAELIC: WORD = 0x01;
683 pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN: WORD = 0x06;
684 pub const SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC: WORD = 0x07;
685 pub const SUBLANG_SERBIAN_MONTENEGRO_LATIN: WORD = 0x0b;
686 pub const SUBLANG_SERBIAN_MONTENEGRO_CYRILLIC: WORD = 0x0c;
687 pub const SUBLANG_SERBIAN_SERBIA_LATIN: WORD = 0x09;
688 pub const SUBLANG_SERBIAN_SERBIA_CYRILLIC: WORD = 0x0a;
689 pub const SUBLANG_SERBIAN_CROATIA: WORD = 0x01;
690 pub const SUBLANG_SERBIAN_LATIN: WORD = 0x02;
691 pub const SUBLANG_SERBIAN_CYRILLIC: WORD = 0x03;
692 pub const SUBLANG_SINDHI_INDIA: WORD = 0x01;
693 pub const SUBLANG_SINDHI_PAKISTAN: WORD = 0x02;
694 pub const SUBLANG_SINDHI_AFGHANISTAN: WORD = 0x02;
695 pub const SUBLANG_SINHALESE_SRI_LANKA: WORD = 0x01;
696 pub const SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA: WORD = 0x01;
697 pub const SUBLANG_SLOVAK_SLOVAKIA: WORD = 0x01;
698 pub const SUBLANG_SLOVENIAN_SLOVENIA: WORD = 0x01;
699 pub const SUBLANG_SPANISH: WORD = 0x01;
700 pub const SUBLANG_SPANISH_MEXICAN: WORD = 0x02;
701 pub const SUBLANG_SPANISH_MODERN: WORD = 0x03;
702 pub const SUBLANG_SPANISH_GUATEMALA: WORD = 0x04;
703 pub const SUBLANG_SPANISH_COSTA_RICA: WORD = 0x05;
704 pub const SUBLANG_SPANISH_PANAMA: WORD = 0x06;
705 pub const SUBLANG_SPANISH_DOMINICAN_REPUBLIC: WORD = 0x07;
706 pub const SUBLANG_SPANISH_VENEZUELA: WORD = 0x08;
707 pub const SUBLANG_SPANISH_COLOMBIA: WORD = 0x09;
708 pub const SUBLANG_SPANISH_PERU: WORD = 0x0a;
709 pub const SUBLANG_SPANISH_ARGENTINA: WORD = 0x0b;
710 pub const SUBLANG_SPANISH_ECUADOR: WORD = 0x0c;
711 pub const SUBLANG_SPANISH_CHILE: WORD = 0x0d;
712 pub const SUBLANG_SPANISH_URUGUAY: WORD = 0x0e;
713 pub const SUBLANG_SPANISH_PARAGUAY: WORD = 0x0f;
714 pub const SUBLANG_SPANISH_BOLIVIA: WORD = 0x10;
715 pub const SUBLANG_SPANISH_EL_SALVADOR: WORD = 0x11;
716 pub const SUBLANG_SPANISH_HONDURAS: WORD = 0x12;
717 pub const SUBLANG_SPANISH_NICARAGUA: WORD = 0x13;
718 pub const SUBLANG_SPANISH_PUERTO_RICO: WORD = 0x14;
719 pub const SUBLANG_SPANISH_US: WORD = 0x15;
720 pub const SUBLANG_SWAHILI_KENYA: WORD = 0x01;
721 pub const SUBLANG_SWEDISH: WORD = 0x01;
722 pub const SUBLANG_SWEDISH_FINLAND: WORD = 0x02;
723 pub const SUBLANG_SYRIAC_SYRIA: WORD = 0x01;
724 pub const SUBLANG_TAJIK_TAJIKISTAN: WORD = 0x01;
725 pub const SUBLANG_TAMAZIGHT_ALGERIA_LATIN: WORD = 0x02;
726 pub const SUBLANG_TAMAZIGHT_MOROCCO_TIFINAGH: WORD = 0x04;
727 pub const SUBLANG_TAMIL_INDIA: WORD = 0x01;
728 pub const SUBLANG_TAMIL_SRI_LANKA: WORD = 0x02;
729 pub const SUBLANG_TATAR_RUSSIA: WORD = 0x01;
730 pub const SUBLANG_TELUGU_INDIA: WORD = 0x01;
731 pub const SUBLANG_THAI_THAILAND: WORD = 0x01;
732 pub const SUBLANG_TIBETAN_PRC: WORD = 0x01;
733 pub const SUBLANG_TIGRIGNA_ERITREA: WORD = 0x02;
734 pub const SUBLANG_TIGRINYA_ERITREA: WORD = 0x02;
735 pub const SUBLANG_TIGRINYA_ETHIOPIA: WORD = 0x01;
736 pub const SUBLANG_TSWANA_BOTSWANA: WORD = 0x02;
737 pub const SUBLANG_TSWANA_SOUTH_AFRICA: WORD = 0x01;
738 pub const SUBLANG_TURKISH_TURKEY: WORD = 0x01;
739 pub const SUBLANG_TURKMEN_TURKMENISTAN: WORD = 0x01;
740 pub const SUBLANG_UIGHUR_PRC: WORD = 0x01;
741 pub const SUBLANG_UKRAINIAN_UKRAINE: WORD = 0x01;
742 pub const SUBLANG_UPPER_SORBIAN_GERMANY: WORD = 0x01;
743 pub const SUBLANG_URDU_PAKISTAN: WORD = 0x01;
744 pub const SUBLANG_URDU_INDIA: WORD = 0x02;
745 pub const SUBLANG_UZBEK_LATIN: WORD = 0x01;
746 pub const SUBLANG_UZBEK_CYRILLIC: WORD = 0x02;
747 pub const SUBLANG_VALENCIAN_VALENCIA: WORD = 0x02;
748 pub const SUBLANG_VIETNAMESE_VIETNAM: WORD = 0x01;
749 pub const SUBLANG_WELSH_UNITED_KINGDOM: WORD = 0x01;
750 pub const SUBLANG_WOLOF_SENEGAL: WORD = 0x01;
751 pub const SUBLANG_XHOSA_SOUTH_AFRICA: WORD = 0x01;
752 pub const SUBLANG_YAKUT_RUSSIA: WORD = 0x01;
753 pub const SUBLANG_YI_PRC: WORD = 0x01;
754 pub const SUBLANG_YORUBA_NIGERIA: WORD = 0x01;
755 pub const SUBLANG_ZULU_SOUTH_AFRICA: WORD = 0x01;
756 pub const SORT_DEFAULT: WORD = 0x0;
757 pub const SORT_INVARIANT_MATH: WORD = 0x1;
758 pub const SORT_JAPANESE_XJIS: WORD = 0x0;
759 pub const SORT_JAPANESE_UNICODE: WORD = 0x1;
760 pub const SORT_JAPANESE_RADICALSTROKE: WORD = 0x4;
761 pub const SORT_CHINESE_BIG5: WORD = 0x0;
762 pub const SORT_CHINESE_PRCP: WORD = 0x0;
763 pub const SORT_CHINESE_UNICODE: WORD = 0x1;
764 pub const SORT_CHINESE_PRC: WORD = 0x2;
765 pub const SORT_CHINESE_BOPOMOFO: WORD = 0x3;
766 pub const SORT_CHINESE_RADICALSTROKE: WORD = 0x4;
767 pub const SORT_KOREAN_KSC: WORD = 0x0;
768 pub const SORT_KOREAN_UNICODE: WORD = 0x1;
769 pub const SORT_GERMAN_PHONE_BOOK: WORD = 0x1;
770 pub const SORT_HUNGARIAN_DEFAULT: WORD = 0x0;
771 pub const SORT_HUNGARIAN_TECHNICAL: WORD = 0x1;
772 pub const SORT_GEORGIAN_TRADITIONAL: WORD = 0x0;
773 pub const SORT_GEORGIAN_MODERN: WORD = 0x1;
774 macro_rules! MAKELANGID { ($p:expr, $s:expr) => (($s << 10) | $p) }
775 #[inline]
MAKELANGID(p: WORD, s: WORD) -> LANGID776 pub fn MAKELANGID(p: WORD, s: WORD) -> LANGID {
777     (s << 10) | p
778 }
779 #[inline]
PRIMARYLANGID(lgid: LANGID) -> WORD780 pub fn PRIMARYLANGID(lgid: LANGID) -> WORD {
781     lgid & 0x3ff
782 }
783 #[inline]
SUBLANGID(lgid: LANGID) -> WORD784 pub fn SUBLANGID(lgid: LANGID) -> WORD {
785     lgid >> 10
786 }
787 pub const NLS_VALID_LOCALE_MASK: DWORD = 0x000fffff;
788 macro_rules! MAKELCID {
789     ($lgid:expr, $srtid:expr) => ((($srtid as DWORD) << 16) | ($lgid as DWORD))
790 }
791 #[inline]
MAKELCID(lgid: LANGID, srtid: WORD) -> LCID792 pub fn MAKELCID(lgid: LANGID, srtid: WORD) -> LCID {
793     ((srtid as DWORD) << 16) | (lgid as DWORD)
794 }
795 #[inline]
MAKESORTLCID(lgid: LANGID, srtid: WORD, ver: WORD) -> LCID796 pub fn MAKESORTLCID(lgid: LANGID, srtid: WORD, ver: WORD) -> LCID {
797     MAKELCID(lgid, srtid) | ((ver as DWORD) << 20)
798 }
799 #[inline]
LANGIDFROMLCID(lcid: LCID) -> LANGID800 pub fn LANGIDFROMLCID(lcid: LCID) -> LANGID {
801     lcid as LANGID
802 }
803 #[inline]
SORTIDFROMLCID(lcid: LCID) -> WORD804 pub fn SORTIDFROMLCID(lcid: LCID) -> WORD {
805     ((lcid >> 16) & 0xf) as WORD
806 }
807 #[inline]
SORTVERSIONFROMLCID(lcid: LCID) -> WORD808 pub fn SORTVERSIONFROMLCID(lcid: LCID) -> WORD {
809     ((lcid >> 16) & 0xf) as WORD
810 }
811 pub const LOCALE_NAME_MAX_LENGTH: usize = 85;
812 pub const LANG_SYSTEM_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT);
813 pub const LANG_USER_DEFAULT: LANGID = MAKELANGID!(LANG_NEUTRAL, SUBLANG_DEFAULT);
814 pub const LOCALE_SYSTEM_DEFAULT: LCID = MAKELCID!(LANG_SYSTEM_DEFAULT, SORT_DEFAULT);
815 pub const LOCALE_USER_DEFAULT: LCID = MAKELCID!(LANG_USER_DEFAULT, SORT_DEFAULT);
816 pub const LOCALE_CUSTOM_DEFAULT: LCID
817     = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT);
818 pub const LOCALE_CUSTOM_UNSPECIFIED: LCID
819     = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT);
820 pub const LOCALE_CUSTOM_UI_DEFAULT: LCID
821     = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_UI_CUSTOM_DEFAULT), SORT_DEFAULT);
822 pub const LOCALE_NEUTRAL: LCID
823     = MAKELCID!(MAKELANGID!(LANG_NEUTRAL, SUBLANG_NEUTRAL), SORT_DEFAULT);
824 pub const LOCALE_INVARIANT: LCID
825     = MAKELCID!(MAKELANGID!(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT);
826 pub const LOCALE_TRANSIENT_KEYBOARD1: LCID = 0x2000;
827 pub const LOCALE_TRANSIENT_KEYBOARD2: LCID = 0x2400;
828 pub const LOCALE_TRANSIENT_KEYBOARD3: LCID = 0x2800;
829 pub const LOCALE_TRANSIENT_KEYBOARD4: LCID = 0x2c00;
830 pub const LOCALE_UNASSIGNED_LCID: LCID = LOCALE_CUSTOM_UNSPECIFIED;
831 pub const STATUS_WAIT_0: DWORD = 0x00000000;
832 pub const STATUS_ABANDONED_WAIT_0: DWORD = 0x00000080;
833 pub const STATUS_USER_APC: DWORD = 0x000000C0;
834 pub const STATUS_TIMEOUT: DWORD = 0x00000102;
835 pub const STATUS_PENDING: DWORD = 0x00000103;
836 pub const DBG_EXCEPTION_HANDLED: DWORD = 0x00010001;
837 pub const DBG_CONTINUE: DWORD = 0x00010002;
838 pub const STATUS_SEGMENT_NOTIFICATION: DWORD = 0x40000005;
839 pub const STATUS_FATAL_APP_EXIT: DWORD = 0x40000015;
840 pub const DBG_REPLY_LATER: DWORD = 0x40010001;
841 pub const DBG_TERMINATE_THREAD: DWORD = 0x40010003;
842 pub const DBG_TERMINATE_PROCESS: DWORD = 0x40010004;
843 pub const DBG_CONTROL_C: DWORD = 0x40010005;
844 pub const DBG_PRINTEXCEPTION_C: DWORD = 0x40010006;
845 pub const DBG_RIPEXCEPTION: DWORD = 0x40010007;
846 pub const DBG_CONTROL_BREAK: DWORD = 0x40010008;
847 pub const DBG_COMMAND_EXCEPTION: DWORD = 0x40010009;
848 pub const DBG_PRINTEXCEPTION_WIDE_C: DWORD = 0x4001000A;
849 pub const STATUS_GUARD_PAGE_VIOLATION: DWORD = 0x80000001;
850 pub const STATUS_DATATYPE_MISALIGNMENT: DWORD = 0x80000002;
851 pub const STATUS_BREAKPOINT: DWORD = 0x80000003;
852 pub const STATUS_SINGLE_STEP: DWORD = 0x80000004;
853 pub const STATUS_LONGJUMP: DWORD = 0x80000026;
854 pub const STATUS_UNWIND_CONSOLIDATE: DWORD = 0x80000029;
855 pub const DBG_EXCEPTION_NOT_HANDLED: DWORD = 0x80010001;
856 pub const STATUS_ACCESS_VIOLATION: DWORD = 0xC0000005;
857 pub const STATUS_IN_PAGE_ERROR: DWORD = 0xC0000006;
858 pub const STATUS_INVALID_HANDLE: DWORD = 0xC0000008;
859 pub const STATUS_INVALID_PARAMETER: DWORD = 0xC000000D;
860 pub const STATUS_NO_MEMORY: DWORD = 0xC0000017;
861 pub const STATUS_ILLEGAL_INSTRUCTION: DWORD = 0xC000001D;
862 pub const STATUS_NONCONTINUABLE_EXCEPTION: DWORD = 0xC0000025;
863 pub const STATUS_INVALID_DISPOSITION: DWORD = 0xC0000026;
864 pub const STATUS_ARRAY_BOUNDS_EXCEEDED: DWORD = 0xC000008C;
865 pub const STATUS_FLOAT_DENORMAL_OPERAND: DWORD = 0xC000008D;
866 pub const STATUS_FLOAT_DIVIDE_BY_ZERO: DWORD = 0xC000008E;
867 pub const STATUS_FLOAT_INEXACT_RESULT: DWORD = 0xC000008F;
868 pub const STATUS_FLOAT_INVALID_OPERATION: DWORD = 0xC0000090;
869 pub const STATUS_FLOAT_OVERFLOW: DWORD = 0xC0000091;
870 pub const STATUS_FLOAT_STACK_CHECK: DWORD = 0xC0000092;
871 pub const STATUS_FLOAT_UNDERFLOW: DWORD = 0xC0000093;
872 pub const STATUS_INTEGER_DIVIDE_BY_ZERO: DWORD = 0xC0000094;
873 pub const STATUS_INTEGER_OVERFLOW: DWORD = 0xC0000095;
874 pub const STATUS_PRIVILEGED_INSTRUCTION: DWORD = 0xC0000096;
875 pub const STATUS_STACK_OVERFLOW: DWORD = 0xC00000FD;
876 pub const STATUS_DLL_NOT_FOUND: DWORD = 0xC0000135;
877 pub const STATUS_ORDINAL_NOT_FOUND: DWORD = 0xC0000138;
878 pub const STATUS_ENTRYPOINT_NOT_FOUND: DWORD = 0xC0000139;
879 pub const STATUS_CONTROL_C_EXIT: DWORD = 0xC000013A;
880 pub const STATUS_DLL_INIT_FAILED: DWORD = 0xC0000142;
881 pub const STATUS_FLOAT_MULTIPLE_FAULTS: DWORD = 0xC00002B4;
882 pub const STATUS_FLOAT_MULTIPLE_TRAPS: DWORD = 0xC00002B5;
883 pub const STATUS_REG_NAT_CONSUMPTION: DWORD = 0xC00002C9;
884 pub const STATUS_HEAP_CORRUPTION: DWORD = 0xC0000374;
885 pub const STATUS_STACK_BUFFER_OVERRUN: DWORD = 0xC0000409;
886 pub const STATUS_INVALID_CRUNTIME_PARAMETER: DWORD = 0xC0000417;
887 pub const STATUS_ASSERTION_FAILURE: DWORD = 0xC0000420;
888 pub const STATUS_SXS_EARLY_DEACTIVATION: DWORD = 0xC015000F;
889 pub const STATUS_SXS_INVALID_DEACTIVATION: DWORD = 0xC0150010;
890 pub const MAXIMUM_WAIT_OBJECTS: DWORD = 64;
891 pub const MAXIMUM_SUSPEND_COUNT: CHAR = MAXCHAR;
892 pub type KSPIN_LOCK = ULONG_PTR;
893 pub type PKSPIN_LOCK = *mut KSPIN_LOCK;
894 STRUCT!{struct M128A { // FIXME align 16
895     Low: ULONGLONG,
896     High: LONGLONG,
897 }}
898 pub type PM128A = *mut M128A;
899 #[cfg(target_pointer_width = "32")]
900 STRUCT!{struct XSAVE_FORMAT { // FIXME align 16
901     ControlWord: WORD,
902     StatusWord: WORD,
903     TagWord: BYTE,
904     Reserved1: BYTE,
905     ErrorOpcode: WORD,
906     ErrorOffset: DWORD,
907     ErrorSelector: WORD,
908     Reserved2: WORD,
909     DataOffset: DWORD,
910     DataSelector: WORD,
911     Reserved3: WORD,
912     MxCsr: DWORD,
913     MxCsr_Mask: DWORD,
914     FloatRegisters: [M128A; 8],
915     XmmRegisters: [M128A; 8],
916     Reserved4: [BYTE; 224],
917 }}
918 #[cfg(target_pointer_width = "64")]
919 STRUCT!{struct XSAVE_FORMAT { // FIXME align 16
920     ControlWord: WORD,
921     StatusWord: WORD,
922     TagWord: BYTE,
923     Reserved1: BYTE,
924     ErrorOpcode: WORD,
925     ErrorOffset: DWORD,
926     ErrorSelector: WORD,
927     Reserved2: WORD,
928     DataOffset: DWORD,
929     DataSelector: WORD,
930     Reserved3: WORD,
931     MxCsr: DWORD,
932     MxCsr_Mask: DWORD,
933     FloatRegisters: [M128A; 8],
934     XmmRegisters: [M128A; 16],
935     Reserved4: [BYTE; 96],
936 }}
937 #[cfg(target_arch = "x86")]
938 STRUCT!{struct XSTATE_CONTEXT {
939     Mask: DWORD64,
940     Length: DWORD,
941     Reserved1: DWORD,
942     Area: PXSAVE_AREA,
943     Reserved2: DWORD,
944     Buffer: PVOID,
945     Reserved3: DWORD,
946 }}
947 #[cfg(not(target_arch = "x86"))]
948 STRUCT!{struct XSTATE_CONTEXT {
949     Mask: DWORD64,
950     Length: DWORD,
951     Reserved1: DWORD,
952     Area: PXSAVE_AREA,
953     Buffer: PVOID,
954 }}
955 pub type PXSAVE_FORMAT = *mut XSAVE_FORMAT;
956 STRUCT!{struct XSAVE_AREA_HEADER { // FIXME align 8
957     Mask: DWORD64,
958     CompactionMask: DWORD64,
959     Reserved2: [DWORD64; 6],
960 }}
961 pub type PXSAVE_AREA_HEADER = *mut XSAVE_AREA_HEADER;
962 STRUCT!{struct XSAVE_AREA { // FIXME align 16
963     LegacyState: XSAVE_FORMAT,
964     Header: XSAVE_AREA_HEADER,
965 }}
966 pub type PXSAVE_AREA = *mut XSAVE_AREA;
967 pub type PXSTATE_CONTEXT = *mut XSTATE_CONTEXT;
968 STRUCT!{struct SCOPE_TABLE_AMD64 {
969     Count: DWORD,
970     ScopeRecord: [SCOPE_TABLE_AMD64_ScopeRecord; 1],
971 }}
972 STRUCT!{struct SCOPE_TABLE_AMD64_ScopeRecord {
973     BeginAddress: DWORD,
974     EndAddress: DWORD,
975     HandlerAddress: DWORD,
976     JumpTarget: DWORD,
977 }}
978 pub type PSCOPE_TABLE_AMD64 = *mut SCOPE_TABLE_AMD64;
979 STRUCT!{struct SCOPE_TABLE_ARM64 {
980     Count: DWORD,
981     ScopeRecord: [SCOPE_TABLE_ARM64_ScopeRecord; 1],
982 }}
983 STRUCT!{struct SCOPE_TABLE_ARM64_ScopeRecord {
984     BeginAddress: DWORD,
985     EndAddress: DWORD,
986     HandlerAddress: DWORD,
987     JumpTarget: DWORD,
988 }}
989 pub type PSCOPE_TABLE_ARM64 = *mut SCOPE_TABLE_ARM64;
990 // Skip interlocked and bit manipulation stuff because it is all intrinsics
991 // Use the native Rust equivalents instead
992 #[cfg(target_arch = "x86_64")]
993 IFDEF!{
994 pub const EXCEPTION_READ_FAULT: DWORD = 0;
995 pub const EXCEPTION_WRITE_FAULT: DWORD = 1;
996 pub const EXCEPTION_EXECUTE_FAULT: DWORD = 8;
997 pub const CONTEXT_AMD64: DWORD = 0x00100000;
998 pub const CONTEXT_CONTROL: DWORD = CONTEXT_AMD64 | 0x00000001;
999 pub const CONTEXT_INTEGER: DWORD = CONTEXT_AMD64 | 0x00000002;
1000 pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_AMD64 | 0x00000004;
1001 pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_AMD64 | 0x00000008;
1002 pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_AMD64 | 0x00000010;
1003 pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT;
1004 pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS
1005     | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS;
1006 pub const CONTEXT_XSTATE: DWORD = CONTEXT_AMD64 | 0x00000040;
1007 pub const CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000;
1008 pub const CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000;
1009 pub const CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000;
1010 pub const CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000;
1011 pub const INITIAL_MXCSR: DWORD = 0x1f80;
1012 pub const INITIAL_FPCSR: DWORD = 0x027f;
1013 pub type XMM_SAVE_AREA32 = XSAVE_FORMAT;
1014 pub type PXMM_SAVE_AREA32 = *mut XSAVE_FORMAT;
1015 STRUCT!{struct CONTEXT_u_s {
1016     Header: [M128A; 2],
1017     Legacy: [M128A; 8],
1018     Xmm0: M128A,
1019     Xmm1: M128A,
1020     Xmm2: M128A,
1021     Xmm3: M128A,
1022     Xmm4: M128A,
1023     Xmm5: M128A,
1024     Xmm6: M128A,
1025     Xmm7: M128A,
1026     Xmm8: M128A,
1027     Xmm9: M128A,
1028     Xmm10: M128A,
1029     Xmm11: M128A,
1030     Xmm12: M128A,
1031     Xmm13: M128A,
1032     Xmm14: M128A,
1033     Xmm15: M128A,
1034 }}
1035 UNION!{union CONTEXT_u {
1036     [u64; 64],
1037     FltSave FltSave_mut: XMM_SAVE_AREA32,
1038     s s_mut: CONTEXT_u_s,
1039 }}
1040 STRUCT!{struct CONTEXT { // FIXME align 16
1041     P1Home: DWORD64,
1042     P2Home: DWORD64,
1043     P3Home: DWORD64,
1044     P4Home: DWORD64,
1045     P5Home: DWORD64,
1046     P6Home: DWORD64,
1047     ContextFlags: DWORD,
1048     MxCsr: DWORD,
1049     SegCs: WORD,
1050     SegDs: WORD,
1051     SegEs: WORD,
1052     SegFs: WORD,
1053     SegGs: WORD,
1054     SegSs: WORD,
1055     EFlags: DWORD,
1056     Dr0: DWORD64,
1057     Dr1: DWORD64,
1058     Dr2: DWORD64,
1059     Dr3: DWORD64,
1060     Dr6: DWORD64,
1061     Dr7: DWORD64,
1062     Rax: DWORD64,
1063     Rcx: DWORD64,
1064     Rdx: DWORD64,
1065     Rbx: DWORD64,
1066     Rsp: DWORD64,
1067     Rbp: DWORD64,
1068     Rsi: DWORD64,
1069     Rdi: DWORD64,
1070     R8: DWORD64,
1071     R9: DWORD64,
1072     R10: DWORD64,
1073     R11: DWORD64,
1074     R12: DWORD64,
1075     R13: DWORD64,
1076     R14: DWORD64,
1077     R15: DWORD64,
1078     Rip: DWORD64,
1079     u: CONTEXT_u,
1080     VectorRegister: [M128A; 26],
1081     VectorControl: DWORD64,
1082     DebugControl: DWORD64,
1083     LastBranchToRip: DWORD64,
1084     LastBranchFromRip: DWORD64,
1085     LastExceptionToRip: DWORD64,
1086     LastExceptionFromRip: DWORD64,
1087 }}
1088 pub type PCONTEXT = *mut CONTEXT;
1089 pub type RUNTIME_FUNCTION = IMAGE_RUNTIME_FUNCTION_ENTRY;
1090 pub type PRUNTIME_FUNCTION = *mut IMAGE_RUNTIME_FUNCTION_ENTRY;
1091 pub type SCOPE_TABLE = SCOPE_TABLE_AMD64;
1092 pub type PSCOPE_TABLE = *mut SCOPE_TABLE_AMD64;
1093 pub const RUNTIME_FUNCTION_INDIRECT: DWORD = 0x1;
1094 pub const UNW_FLAG_NHANDLER: DWORD = 0x0;
1095 pub const UNW_FLAG_EHANDLER: DWORD = 0x1;
1096 pub const UNW_FLAG_UHANDLER: DWORD = 0x2;
1097 pub const UNW_FLAG_CHAININFO: DWORD = 0x4;
1098 pub const UNW_FLAG_NO_EPILOGUE: DWORD = 0x80000000;
1099 pub const UNWIND_HISTORY_TABLE_SIZE: usize = 12;
1100 STRUCT!{struct UNWIND_HISTORY_TABLE_ENTRY {
1101     ImageBase: DWORD64,
1102     FunctionEntry: PRUNTIME_FUNCTION,
1103 }}
1104 pub type PUNWIND_HISTORY_TABLE_ENTRY = *mut UNWIND_HISTORY_TABLE_ENTRY;
1105 STRUCT!{struct UNWIND_HISTORY_TABLE {
1106     Count: DWORD,
1107     LocalHint: BYTE,
1108     GlobalHint: BYTE,
1109     Search: BYTE,
1110     Once: BYTE,
1111     LowAddress: DWORD64,
1112     HighAddress: DWORD64,
1113     Entry: [UNWIND_HISTORY_TABLE_ENTRY; UNWIND_HISTORY_TABLE_SIZE],
1114 }}
1115 pub type PUNWIND_HISTORY_TABLE = *mut UNWIND_HISTORY_TABLE;
1116 FN!{cdecl PGET_RUNTIME_FUNCTION_CALLBACK(
1117     ControlPc: DWORD64,
1118     Context: PVOID,
1119 ) -> PRUNTIME_FUNCTION}
1120 FN!{cdecl POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK(
1121     Process: HANDLE,
1122     TableAddress: PVOID,
1123     Entries: PDWORD,
1124     Functions: *mut PRUNTIME_FUNCTION,
1125 ) -> DWORD}
1126 pub const OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME: &'static str
1127     = "OutOfProcessFunctionTableCallback";
1128 STRUCT!{struct DISPATCHER_CONTEXT {
1129     ControlPc: DWORD64,
1130     ImageBase: DWORD64,
1131     FunctionEntry: PRUNTIME_FUNCTION,
1132     EstablisherFrame: DWORD64,
1133     TargetIp: DWORD64,
1134     ContextRecord: PCONTEXT,
1135     LanguageHandler: PEXCEPTION_ROUTINE,
1136     HandlerData: PVOID,
1137     HistoryTable: PUNWIND_HISTORY_TABLE,
1138     ScopeIndex: DWORD,
1139     Fill0: DWORD,
1140 }}
1141 pub type PDISPATCHER_CONTEXT = *mut DISPATCHER_CONTEXT;
1142 FN!{cdecl PEXCEPTION_FILTER(
1143     ExceptionPointers: *mut EXCEPTION_POINTERS,
1144     EstablisherFrame: PVOID,
1145 ) -> LONG}
1146 FN!{cdecl PTERMINATION_HANDLER(
1147     AbnormalTermination: BOOLEAN,
1148     EstablisherFrame: PVOID,
1149 ) -> ()}
1150 STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u1_s {
1151     Xmm0: PM128A,
1152     Xmm1: PM128A,
1153     Xmm2: PM128A,
1154     Xmm3: PM128A,
1155     Xmm4: PM128A,
1156     Xmm5: PM128A,
1157     Xmm6: PM128A,
1158     Xmm7: PM128A,
1159     Xmm8: PM128A,
1160     Xmm9: PM128A,
1161     Xmm10: PM128A,
1162     Xmm11: PM128A,
1163     Xmm12: PM128A,
1164     Xmm13: PM128A,
1165     Xmm14: PM128A,
1166     Xmm15: PM128A,
1167 }}
1168 UNION!{union KNONVOLATILE_CONTEXT_POINTERS_u1 {
1169     [u64; 16],
1170     FloatingContext FloatingContext_mut: [PM128A; 16],
1171     s s_mut: KNONVOLATILE_CONTEXT_POINTERS_u1_s,
1172 }}
1173 STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS_u2_s {
1174     Rax: PDWORD64,
1175     Rcx: PDWORD64,
1176     Rdx: PDWORD64,
1177     Rbx: PDWORD64,
1178     Rsp: PDWORD64,
1179     Rbp: PDWORD64,
1180     Rsi: PDWORD64,
1181     Rdi: PDWORD64,
1182     R8: PDWORD64,
1183     R9: PDWORD64,
1184     R10: PDWORD64,
1185     R11: PDWORD64,
1186     R12: PDWORD64,
1187     R13: PDWORD64,
1188     R14: PDWORD64,
1189     R15: PDWORD64,
1190 }}
1191 UNION!{union KNONVOLATILE_CONTEXT_POINTERS_u2 {
1192     [u64; 16],
1193     IntegerContext IntegerContext_mut: [PDWORD64; 16],
1194     s s_mut: KNONVOLATILE_CONTEXT_POINTERS_u2_s,
1195 }}
1196 STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS {
1197     u1: KNONVOLATILE_CONTEXT_POINTERS_u1,
1198     u2: KNONVOLATILE_CONTEXT_POINTERS_u2,
1199 }}
1200 pub type PKNONVOLATILE_CONTEXT_POINTERS = *mut KNONVOLATILE_CONTEXT_POINTERS;
1201 } // IFDEF(x86_64)
1202 #[cfg(target_arch = "x86")]
1203 IFDEF!{
1204 pub const EXCEPTION_READ_FAULT: DWORD = 0;
1205 pub const EXCEPTION_WRITE_FAULT: DWORD = 1;
1206 pub const EXCEPTION_EXECUTE_FAULT: DWORD = 8;
1207 pub const SIZE_OF_80387_REGISTERS: usize = 80;
1208 pub const CONTEXT_i386: DWORD = 0x00010000;
1209 pub const CONTEXT_i486: DWORD = 0x00010000;
1210 pub const CONTEXT_CONTROL: DWORD = CONTEXT_i386 | 0x00000001;
1211 pub const CONTEXT_INTEGER: DWORD = CONTEXT_i386 | 0x00000002;
1212 pub const CONTEXT_SEGMENTS: DWORD = CONTEXT_i386 | 0x00000004;
1213 pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_i386 | 0x00000008;
1214 pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_i386 | 0x00000010;
1215 pub const CONTEXT_EXTENDED_REGISTERS: DWORD = CONTEXT_i386 | 0x00000020;
1216 pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS;
1217 pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS
1218     | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS;
1219 pub const CONTEXT_XSTATE: DWORD = CONTEXT_i386 | 0x00000040;
1220 pub const CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000;
1221 pub const CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000;
1222 pub const CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000;
1223 pub const CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000;
1224 STRUCT!{struct FLOATING_SAVE_AREA {
1225     ControlWord: DWORD,
1226     StatusWord: DWORD,
1227     TagWord: DWORD,
1228     ErrorOffset: DWORD,
1229     ErrorSelector: DWORD,
1230     DataOffset: DWORD,
1231     DataSelector: DWORD,
1232     RegisterArea: [BYTE; SIZE_OF_80387_REGISTERS],
1233     Spare0: DWORD,
1234 }}
1235 pub type PFLOATING_SAVE_AREA = *mut FLOATING_SAVE_AREA;
1236 pub const MAXIMUM_SUPPORTED_EXTENSION: usize = 512;
1237 STRUCT!{struct CONTEXT {
1238     ContextFlags: DWORD,
1239     Dr0: DWORD,
1240     Dr1: DWORD,
1241     Dr2: DWORD,
1242     Dr3: DWORD,
1243     Dr6: DWORD,
1244     Dr7: DWORD,
1245     FloatSave: FLOATING_SAVE_AREA,
1246     SegGs: DWORD,
1247     SegFs: DWORD,
1248     SegEs: DWORD,
1249     SegDs: DWORD,
1250     Edi: DWORD,
1251     Esi: DWORD,
1252     Ebx: DWORD,
1253     Edx: DWORD,
1254     Ecx: DWORD,
1255     Eax: DWORD,
1256     Ebp: DWORD,
1257     Eip: DWORD,
1258     SegCs: DWORD,
1259     EFlags: DWORD,
1260     Esp: DWORD,
1261     SegSs: DWORD,
1262     ExtendedRegisters: [BYTE; MAXIMUM_SUPPORTED_EXTENSION],
1263 }}
1264 pub type PCONTEXT = *mut CONTEXT;
1265 } // IFDEF(x86)
1266 STRUCT!{struct LDT_ENTRY_Bytes {
1267     BaseMid: BYTE,
1268     Flags1: BYTE,
1269     Flags2: BYTE,
1270     BaseHi: BYTE,
1271 }}
1272 STRUCT!{struct LDT_ENTRY_Bits {
1273     Bitfield: DWORD,
1274 }}
1275 BITFIELD!{LDT_ENTRY_Bits Bitfield: DWORD [
1276     BaseMid set_BaseMid[0..8],
1277     Type set_Type[8..13],
1278     Dpl set_Dpl[13..15],
1279     Pres set_Pres[15..16],
1280     LimitHi set_LimitHi[16..20],
1281     Sys set_Sys[20..21],
1282     Reserved_0 set_Reserved_0[21..22],
1283     Default_Big set_Default_Big[22..23],
1284     Granularity set_Granularity[23..24],
1285     BaseHi set_BaseHi[24..32],
1286 ]}
1287 UNION!{union LDT_ENTRY_HighWord {
1288     [u32; 1],
1289     Bytes Bytes_mut: LDT_ENTRY_Bytes,
1290     Bits Bits_mut: LDT_ENTRY_Bits,
1291 }}
1292 STRUCT!{struct LDT_ENTRY {
1293     LimitLow: WORD,
1294     BaseLow: WORD,
1295     HighWord: LDT_ENTRY_HighWord,
1296 }}
1297 pub type PLDT_ENTRY = *mut LDT_ENTRY;
1298 #[cfg(target_arch = "aarch64")]
1299 IFDEF!{
1300 pub const ARM64_MAX_BREAKPOINTS: usize = 8;
1301 pub const ARM64_MAX_WATCHPOINTS: usize = 2;
1302 pub const EXCEPTION_READ_FAULT: DWORD = 0;
1303 pub const EXCEPTION_WRITE_FAULT: DWORD = 1;
1304 pub const EXCEPTION_EXECUTE_FAULT: DWORD = 8;
1305 pub const CONTEXT_ARM64: DWORD = 0x00400000;
1306 pub const CONTEXT_CONTROL: DWORD = CONTEXT_ARM64 | 0x00000001;
1307 pub const CONTEXT_INTEGER: DWORD = CONTEXT_ARM64 | 0x00000002;
1308 pub const CONTEXT_FLOATING_POINT: DWORD = CONTEXT_ARM64 | 0x00000004;
1309 pub const CONTEXT_DEBUG_REGISTERS: DWORD = CONTEXT_ARM64 | 0x00000008;
1310 pub const CONTEXT_X18: DWORD = CONTEXT_ARM64 | 0x00000010;
1311 pub const CONTEXT_FULL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT;
1312 pub const CONTEXT_ALL: DWORD = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT
1313         | CONTEXT_DEBUG_REGISTERS | CONTEXT_X18;
1314 pub const CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000;
1315 pub const CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000;
1316 pub const CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000;
1317 pub const CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000;
1318 STRUCT!{struct CONTEXT_u_s {
1319     X0: DWORD64,
1320     X1: DWORD64,
1321     X2: DWORD64,
1322     X3: DWORD64,
1323     X4: DWORD64,
1324     X5: DWORD64,
1325     X6: DWORD64,
1326     X7: DWORD64,
1327     X8: DWORD64,
1328     X9: DWORD64,
1329     X10: DWORD64,
1330     X11: DWORD64,
1331     X12: DWORD64,
1332     X13: DWORD64,
1333     X14: DWORD64,
1334     X15: DWORD64,
1335     X16: DWORD64,
1336     X17: DWORD64,
1337     X18: DWORD64,
1338     X19: DWORD64,
1339     X20: DWORD64,
1340     X21: DWORD64,
1341     X22: DWORD64,
1342     X23: DWORD64,
1343     X24: DWORD64,
1344     X25: DWORD64,
1345     X26: DWORD64,
1346     X27: DWORD64,
1347     X28: DWORD64,
1348     Fp: DWORD64,
1349     Lr: DWORD64,
1350 }}
1351 UNION!{union CONTEXT_u {
1352     [u64; 31],
1353     s s_mut: CONTEXT_u_s,
1354 }}
1355 STRUCT!{struct ARM64_NT_NEON128_s {
1356     Low: ULONGLONG,
1357     High: LONGLONG,
1358 }}
1359 UNION!{union ARM64_NT_NEON128 {
1360     [u64; 2],
1361     s s_mut: ARM64_NT_NEON128_s,
1362     D D_mut: [f64; 2],
1363     S S_mut: [f32; 4],
1364     H H_mut: [WORD; 8],
1365     B B_mut: [BYTE; 16],
1366 }}
1367 STRUCT!{struct CONTEXT { // FIXME align 16
1368     ContextFlags: DWORD,
1369     Cpsr: DWORD,
1370     u: CONTEXT_u,
1371     Sp: DWORD64,
1372     Pc: DWORD64,
1373     V: [ARM64_NT_NEON128; 32],
1374     Fpcr: DWORD,
1375     Fpsr: DWORD,
1376     Bcr: [DWORD; ARM64_MAX_BREAKPOINTS],
1377     Bvr: [DWORD64; ARM64_MAX_BREAKPOINTS],
1378     Wcr: [DWORD; ARM64_MAX_WATCHPOINTS],
1379     Wvr: [DWORD64; ARM64_MAX_WATCHPOINTS],
1380 }}
1381 pub type PCONTEXT = *mut CONTEXT;
1382 pub type RUNTIME_FUNCTION = IMAGE_RUNTIME_FUNCTION_ENTRY;
1383 pub type PRUNTIME_FUNCTION = *mut IMAGE_RUNTIME_FUNCTION_ENTRY;
1384 pub type SCOPE_TABLE = SCOPE_TABLE_ARM64;
1385 pub type PSCOPE_TABLE = *mut SCOPE_TABLE_ARM64;
1386 pub const RUNTIME_FUNCTION_INDIRECT: DWORD = 0x1;
1387 pub const UNW_FLAG_NHANDLER: DWORD = 0x0;
1388 pub const UNW_FLAG_EHANDLER: DWORD = 0x1;
1389 pub const UNW_FLAG_UHANDLER: DWORD = 0x2;
1390 pub const UNWIND_HISTORY_TABLE_SIZE: usize = 12;
1391 STRUCT!{struct UNWIND_HISTORY_TABLE_ENTRY {
1392     ImageBase: DWORD64,
1393     FunctionEntry: PRUNTIME_FUNCTION,
1394 }}
1395 pub type PUNWIND_HISTORY_TABLE_ENTRY = *mut UNWIND_HISTORY_TABLE_ENTRY;
1396 STRUCT!{struct UNWIND_HISTORY_TABLE {
1397     Count: DWORD,
1398     LocalHint: BYTE,
1399     GlobalHint: BYTE,
1400     Search: BYTE,
1401     Once: BYTE,
1402     LowAddress: DWORD64,
1403     HighAddress: DWORD64,
1404     Entry: [UNWIND_HISTORY_TABLE_ENTRY; UNWIND_HISTORY_TABLE_SIZE],
1405 }}
1406 pub type PUNWIND_HISTORY_TABLE = *mut UNWIND_HISTORY_TABLE;
1407 FN!{cdecl PGET_RUNTIME_FUNCTION_CALLBACK(
1408     ControlPc: DWORD64,
1409     Context: PVOID,
1410 ) -> PRUNTIME_FUNCTION}
1411 FN!{cdecl POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK(
1412     Process: HANDLE,
1413     TableAddress: PVOID,
1414     Entries: PDWORD,
1415     Functions: *mut PRUNTIME_FUNCTION,
1416 ) -> DWORD}
1417 pub const OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME: &'static str
1418     = "OutOfProcessFunctionTableCallback";
1419 STRUCT!{struct DISPATCHER_CONTEXT {
1420     ControlPc: ULONG_PTR,
1421     ImageBase: ULONG_PTR,
1422     FunctionEntry: PRUNTIME_FUNCTION,
1423     EstablisherFrame: ULONG_PTR,
1424     TargetPc: ULONG_PTR,
1425     ContextRecord: PCONTEXT,
1426     LanguageHandler: PEXCEPTION_ROUTINE,
1427     HandlerData: PVOID,
1428     HistoryTable: PUNWIND_HISTORY_TABLE,
1429     ScopeIndex: DWORD,
1430     ControlPcIsUnwound: BOOLEAN,
1431     NonVolatileRegisters: PBYTE,
1432 }}
1433 pub type PDISPATCHER_CONTEXT = *mut DISPATCHER_CONTEXT;
1434 FN!{cdecl PEXCEPTION_FILTER(
1435     ExceptionPointers: *mut EXCEPTION_POINTERS,
1436     EstablisherFrame: DWORD64,
1437 ) -> LONG}
1438 FN!{cdecl PTERMINATION_HANDLER(
1439     AbnormalTermination: BOOLEAN,
1440     EstablisherFrame: DWORD64,
1441 ) -> ()}
1442 STRUCT!{struct KNONVOLATILE_CONTEXT_POINTERS {
1443     X19: PDWORD64,
1444     X20: PDWORD64,
1445     X21: PDWORD64,
1446     X22: PDWORD64,
1447     X23: PDWORD64,
1448     X24: PDWORD64,
1449     X25: PDWORD64,
1450     X26: PDWORD64,
1451     X27: PDWORD64,
1452     X28: PDWORD64,
1453     Fp: PDWORD64,
1454     Lr: PDWORD64,
1455     D8: PDWORD64,
1456     D9: PDWORD64,
1457     D10: PDWORD64,
1458     D11: PDWORD64,
1459     D12: PDWORD64,
1460     D13: PDWORD64,
1461     D14: PDWORD64,
1462     D15: PDWORD64,
1463 }}
1464 pub type PKNONVOLATILE_CONTEXT_POINTERS = *mut KNONVOLATILE_CONTEXT_POINTERS;
1465 } // IFDEF(aarch64)
1466 #[cfg(target_arch = "arm")]
1467 IFDEF!{
1468 pub const ARM_MAX_BREAKPOINTS: usize = 8;
1469 pub const ARM_MAX_WATCHPOINTS: usize = 1;
1470 STRUCT!{struct NEON128 {
1471     Low: ULONGLONG,
1472     High: LONGLONG,
1473 }}
1474 pub type PNEON128 = *mut NEON128;
1475 UNION!{union CONTEXT_u {
1476     [u64; 32],
1477     Q Q_mut: [NEON128; 16],
1478     D D_mut: [ULONGLONG; 32],
1479     S S_mut: [DWORD; 32],
1480 }}
1481 STRUCT!{struct CONTEXT {
1482     ContextFlags: DWORD,
1483     R0: DWORD,
1484     R1: DWORD,
1485     R2: DWORD,
1486     R3: DWORD,
1487     R4: DWORD,
1488     R5: DWORD,
1489     R6: DWORD,
1490     R7: DWORD,
1491     R8: DWORD,
1492     R9: DWORD,
1493     R10: DWORD,
1494     R11: DWORD,
1495     R12: DWORD,
1496     Sp: DWORD,
1497     Lr: DWORD,
1498     Pc: DWORD,
1499     Cpsr: DWORD,
1500     Fpsrc: DWORD,
1501     Padding: DWORD,
1502     u: CONTEXT_u,
1503     Bvr: [DWORD; ARM_MAX_BREAKPOINTS],
1504     Bcr: [DWORD; ARM_MAX_BREAKPOINTS],
1505     Wvr: [DWORD; ARM_MAX_WATCHPOINTS],
1506     Wcr: [DWORD; ARM_MAX_WATCHPOINTS],
1507     Padding2: [DWORD; 2],
1508 }}
1509 pub type PCONTEXT = *mut CONTEXT;
1510 } // IFDEF(arm)
1511 pub const WOW64_CONTEXT_i386: DWORD = 0x00010000;
1512 pub const WOW64_CONTEXT_i486: DWORD = 0x00010000;
1513 pub const WOW64_CONTEXT_CONTROL: DWORD = WOW64_CONTEXT_i386 | 0x00000001;
1514 pub const WOW64_CONTEXT_INTEGER: DWORD = WOW64_CONTEXT_i386 | 0x00000002;
1515 pub const WOW64_CONTEXT_SEGMENTS: DWORD = WOW64_CONTEXT_i386 | 0x00000004;
1516 pub const WOW64_CONTEXT_FLOATING_POINT: DWORD = WOW64_CONTEXT_i386 | 0x00000008;
1517 pub const WOW64_CONTEXT_DEBUG_REGISTERS: DWORD = WOW64_CONTEXT_i386 | 0x00000010;
1518 pub const WOW64_CONTEXT_EXTENDED_REGISTERS: DWORD = WOW64_CONTEXT_i386 | 0x00000020;
1519 pub const WOW64_CONTEXT_FULL: DWORD = WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER
1520     | WOW64_CONTEXT_SEGMENTS;
1521 pub const WOW64_CONTEXT_ALL: DWORD = WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER
1522     | WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | WOW64_CONTEXT_DEBUG_REGISTERS
1523     | WOW64_CONTEXT_EXTENDED_REGISTERS;
1524 pub const WOW64_CONTEXT_XSTATE: DWORD = WOW64_CONTEXT_i386 | 0x00000040;
1525 pub const WOW64_CONTEXT_EXCEPTION_ACTIVE: DWORD = 0x08000000;
1526 pub const WOW64_CONTEXT_SERVICE_ACTIVE: DWORD = 0x10000000;
1527 pub const WOW64_CONTEXT_EXCEPTION_REQUEST: DWORD = 0x40000000;
1528 pub const WOW64_CONTEXT_EXCEPTION_REPORTING: DWORD = 0x80000000;
1529 pub const WOW64_SIZE_OF_80387_REGISTERS: usize = 80;
1530 pub const WOW64_MAXIMUM_SUPPORTED_EXTENSION: usize = 512;
1531 STRUCT!{struct WOW64_FLOATING_SAVE_AREA {
1532     ControlWord: DWORD,
1533     StatusWord: DWORD,
1534     TagWord: DWORD,
1535     ErrorOffset: DWORD,
1536     ErrorSelector: DWORD,
1537     DataOffset: DWORD,
1538     DataSelector: DWORD,
1539     RegisterArea: [BYTE; WOW64_SIZE_OF_80387_REGISTERS],
1540     Cr0NpxState: DWORD,
1541 }}
1542 pub type PWOW64_FLOATING_SAVE_AREA = *mut WOW64_FLOATING_SAVE_AREA;
1543 STRUCT!{struct WOW64_CONTEXT {
1544     ContextFlags: DWORD,
1545     Dr0: DWORD,
1546     Dr1: DWORD,
1547     Dr2: DWORD,
1548     Dr3: DWORD,
1549     Dr6: DWORD,
1550     Dr7: DWORD,
1551     FloatSave: WOW64_FLOATING_SAVE_AREA,
1552     SegGs: DWORD,
1553     SegFs: DWORD,
1554     SegEs: DWORD,
1555     SegDs: DWORD,
1556     Edi: DWORD,
1557     Esi: DWORD,
1558     Ebx: DWORD,
1559     Edx: DWORD,
1560     Ecx: DWORD,
1561     Eax: DWORD,
1562     Ebp: DWORD,
1563     Eip: DWORD,
1564     SegCs: DWORD,
1565     EFlags: DWORD,
1566     Esp: DWORD,
1567     SegSs: DWORD,
1568     ExtendedRegisters: [BYTE; WOW64_MAXIMUM_SUPPORTED_EXTENSION],
1569 }}
1570 pub type PWOW64_CONTEXT = *mut WOW64_CONTEXT;
1571 STRUCT!{struct WOW64_LDT_ENTRY_Bytes {
1572     BaseMid: BYTE,
1573     Flags1: BYTE,
1574     Flags2: BYTE,
1575     BaseHi: BYTE,
1576 }}
1577 STRUCT!{struct WOW64_LDT_ENTRY_Bits {
1578     BitFields: DWORD,
1579 }}
1580 BITFIELD!{WOW64_LDT_ENTRY_Bits BitFields: DWORD [
1581     BaseMid set_BaseMid[0..8],
1582     Type set_Type[8..13],
1583     Dpl set_Dpl[13..15],
1584     Pres set_Pres[15..16],
1585     LimitHi set_LimitHi[16..20],
1586     Sys set_Sys[20..21],
1587     Reserved_0 set_Reserved_0[21..22],
1588     Default_Big set_Default_Big[22..23],
1589     Granularity set_Granularity[23..24],
1590     BaseHi set_BaseHi[24..32],
1591 ]}
1592 UNION!{union WOW64_LDT_ENTRY_HighWord {
1593     [u32; 1],
1594     Bytes Bytes_mut: WOW64_LDT_ENTRY_Bytes,
1595     Bits Bits_mut: WOW64_LDT_ENTRY_Bits,
1596 }}
1597 STRUCT!{struct WOW64_LDT_ENTRY {
1598     LimitLow: WORD,
1599     BaseLow: WORD,
1600     HighWord: WOW64_LDT_ENTRY_HighWord,
1601 }}
1602 pub type PWOW64_LDT_ENTRY = *mut WOW64_LDT_ENTRY;
1603 STRUCT!{struct WOW64_DESCRIPTOR_TABLE_ENTRY {
1604     Selector: DWORD,
1605     Descriptor: WOW64_LDT_ENTRY,
1606 }}
1607 pub type PWOW64_DESCRIPTOR_TABLE_ENTRY = *mut WOW64_DESCRIPTOR_TABLE_ENTRY;
1608 pub const EXCEPTION_NONCONTINUABLE: DWORD = 0x1;
1609 pub const EXCEPTION_UNWINDING: DWORD = 0x2;
1610 pub const EXCEPTION_EXIT_UNWIND: DWORD = 0x4;
1611 pub const EXCEPTION_STACK_INVALID: DWORD = 0x8;
1612 pub const EXCEPTION_NESTED_CALL: DWORD = 0x10;
1613 pub const EXCEPTION_TARGET_UNWIND: DWORD = 0x20;
1614 pub const EXCEPTION_COLLIDED_UNWIND: DWORD = 0x40;
1615 pub const EXCEPTION_UNWIND: DWORD = EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND
1616     | EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND;
1617 #[inline]
IS_UNWINDING(Flag: DWORD) -> bool1618 pub fn IS_UNWINDING(Flag: DWORD) -> bool {
1619     (Flag & EXCEPTION_UNWIND) != 0
1620 }
1621 #[inline]
IS_DISPATCHING(Flag: DWORD) -> bool1622 pub fn IS_DISPATCHING(Flag: DWORD) -> bool {
1623     (Flag & EXCEPTION_UNWIND) == 0
1624 }
1625 #[inline]
IS_TARGET_UNWIND(Flag: DWORD) -> bool1626 pub fn IS_TARGET_UNWIND(Flag: DWORD) -> bool {
1627     (Flag & EXCEPTION_TARGET_UNWIND) != 0
1628 }
1629 pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15;
1630 STRUCT!{struct EXCEPTION_RECORD {
1631     ExceptionCode: DWORD,
1632     ExceptionFlags: DWORD,
1633     ExceptionRecord: *mut EXCEPTION_RECORD,
1634     ExceptionAddress: PVOID,
1635     NumberParameters: DWORD,
1636     ExceptionInformation: [ULONG_PTR; EXCEPTION_MAXIMUM_PARAMETERS],
1637 }}
1638 pub type PEXCEPTION_RECORD = *mut EXCEPTION_RECORD;
1639 STRUCT!{struct EXCEPTION_RECORD32 {
1640     ExceptionCode: DWORD,
1641     ExceptionFlags: DWORD,
1642     ExceptionRecord: DWORD,
1643     ExceptionAddress: DWORD,
1644     NumberParameters: DWORD,
1645     ExceptionInformation: [DWORD; EXCEPTION_MAXIMUM_PARAMETERS],
1646 }}
1647 pub type PEXCEPTION_RECORD32 = *mut EXCEPTION_RECORD32;
1648 STRUCT!{struct EXCEPTION_RECORD64 {
1649     ExceptionCode: DWORD,
1650     ExceptionFlags: DWORD,
1651     ExceptionRecord: DWORD64,
1652     ExceptionAddress: DWORD64,
1653     NumberParameters: DWORD,
1654     __unusedAlignment: DWORD,
1655     ExceptionInformation: [DWORD64; EXCEPTION_MAXIMUM_PARAMETERS],
1656 }}
1657 pub type PEXCEPTION_RECORD64 = *mut EXCEPTION_RECORD64;
1658 STRUCT!{struct EXCEPTION_POINTERS {
1659     ExceptionRecord: PEXCEPTION_RECORD,
1660     ContextRecord: PCONTEXT,
1661 }}
1662 pub type PEXCEPTION_POINTERS = *mut EXCEPTION_POINTERS;
1663 pub type PACCESS_TOKEN = PVOID;
1664 pub type PSECURITY_DESCRIPTOR = PVOID;
1665 pub type PSID = PVOID;
1666 pub type PCLAIMS_BLOB = PVOID;
1667 pub type ACCESS_MASK = DWORD;
1668 pub type PACCESS_MASK = *mut ACCESS_MASK;
1669 pub const DELETE: DWORD = 0x00010000;
1670 pub const READ_CONTROL: DWORD = 0x00020000;
1671 pub const WRITE_DAC: DWORD = 0x00040000;
1672 pub const WRITE_OWNER: DWORD = 0x00080000;
1673 pub const SYNCHRONIZE: DWORD = 0x00100000;
1674 pub const STANDARD_RIGHTS_REQUIRED: DWORD = 0x000F0000;
1675 pub const STANDARD_RIGHTS_READ: DWORD = READ_CONTROL;
1676 pub const STANDARD_RIGHTS_WRITE: DWORD = READ_CONTROL;
1677 pub const STANDARD_RIGHTS_EXECUTE: DWORD = READ_CONTROL;
1678 pub const STANDARD_RIGHTS_ALL: DWORD = 0x001F0000;
1679 pub const SPECIFIC_RIGHTS_ALL: DWORD = 0x0000FFFF;
1680 pub const ACCESS_SYSTEM_SECURITY: DWORD = 0x01000000;
1681 pub const MAXIMUM_ALLOWED: DWORD = 0x02000000;
1682 pub const GENERIC_READ: DWORD = 0x80000000;
1683 pub const GENERIC_WRITE: DWORD = 0x40000000;
1684 pub const GENERIC_EXECUTE: DWORD = 0x20000000;
1685 pub const GENERIC_ALL: DWORD = 0x10000000;
1686 STRUCT!{struct GENERIC_MAPPING {
1687     GenericRead: ACCESS_MASK,
1688     GenericWrite: ACCESS_MASK,
1689     GenericExecute: ACCESS_MASK,
1690     GenericAll: ACCESS_MASK,
1691 }}
1692 pub type PGENERIC_MAPPING = *mut GENERIC_MAPPING;
1693 STRUCT!{struct LUID_AND_ATTRIBUTES {
1694     Luid: LUID,
1695     Attributes: DWORD,
1696 }}
1697 pub type PLUID_AND_ATTRIBUTES = *mut LUID_AND_ATTRIBUTES;
1698 pub type LUID_AND_ATTRIBUTES_ARRAY = LUID_AND_ATTRIBUTES;
1699 pub type PLUID_AND_ATTRIBUTES_ARRAY = *mut LUID_AND_ATTRIBUTES;
1700 STRUCT!{struct SID_IDENTIFIER_AUTHORITY {
1701     Value: [BYTE; 6],
1702 }}
1703 pub type PSID_IDENTIFIER_AUTHORITY = *mut SID_IDENTIFIER_AUTHORITY;
1704 STRUCT!{struct SID {
1705     Revision: BYTE,
1706     SubAuthorityCount: BYTE,
1707     IdentifierAuthority: SID_IDENTIFIER_AUTHORITY,
1708     SubAuthority: [DWORD; 1],
1709 }}
1710 pub type PISID = *mut SID;
1711 pub const SID_REVISION: BYTE = 1;
1712 pub const SID_MAX_SUB_AUTHORITIES: BYTE = 15;
1713 pub const SID_RECOMMENDED_SUB_AUTHORITIES: BYTE = 1;
1714 pub const SECURITY_MAX_SID_SIZE: usize = 12 - 4 + (SID_MAX_SUB_AUTHORITIES as usize * 4);
1715 pub const SECURITY_MAX_SID_STRING_CHARACTERS: BYTE = 2 + 4 + 15 + (11 * SID_MAX_SUB_AUTHORITIES)
1716     + 1;
1717 UNION!{union SE_SID {
1718     [u32; 17],
1719     Sid Sid_mut: SID,
1720     Buffer Buffer_mut: [BYTE; SECURITY_MAX_SID_SIZE],
1721 }}
1722 pub type PSE_SID = *mut SE_SID;
1723 ENUM!{enum SID_NAME_USE {
1724     SidTypeUser = 1,
1725     SidTypeGroup,
1726     SidTypeDomain,
1727     SidTypeAlias,
1728     SidTypeWellKnownGroup,
1729     SidTypeDeletedAccount,
1730     SidTypeInvalid,
1731     SidTypeUnknown,
1732     SidTypeComputer,
1733     SidTypeLabel,
1734     SidTypeLogonSession,
1735 }}
1736 pub type PSID_NAME_USE = *mut SID_NAME_USE;
1737 STRUCT!{struct SID_AND_ATTRIBUTES {
1738     Sid: PSID,
1739     Attributes: DWORD,
1740 }}
1741 pub type PSID_AND_ATTRIBUTES = *mut SID_AND_ATTRIBUTES;
1742 pub type SID_AND_ATTRIBUTES_ARRAY = SID_AND_ATTRIBUTES;
1743 pub type PSID_AND_ATTRIBUTES_ARRAY = *mut SID_AND_ATTRIBUTES;
1744 pub const SID_HASH_SIZE: usize = 32;
1745 pub type SID_HASH_ENTRY = ULONG_PTR;
1746 pub type PSID_HASH_ENTRY = *mut ULONG_PTR;
1747 STRUCT!{struct SID_AND_ATTRIBUTES_HASH {
1748     SidCount: DWORD,
1749     SidAttr: PSID_AND_ATTRIBUTES,
1750     Hash: [SID_HASH_ENTRY; SID_HASH_SIZE],
1751 }}
1752 pub type PSID_AND_ATTRIBUTES_HASH = *mut SID_AND_ATTRIBUTES_HASH;
1753 pub const SECURITY_NULL_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 0];
1754 pub const SECURITY_WORLD_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 1];
1755 pub const SECURITY_LOCAL_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 2];
1756 pub const SECURITY_CREATOR_SID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 3];
1757 pub const SECURITY_NON_UNIQUE_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 4];
1758 pub const SECURITY_RESOURCE_MANAGER_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 9];
1759 pub const SECURITY_NULL_RID: DWORD = 0x00000000;
1760 pub const SECURITY_WORLD_RID: DWORD = 0x00000000;
1761 pub const SECURITY_LOCAL_RID: DWORD = 0x00000000;
1762 pub const SECURITY_LOCAL_LOGON_RID: DWORD = 0x00000001;
1763 pub const SECURITY_CREATOR_OWNER_RID: DWORD = 0x00000000;
1764 pub const SECURITY_CREATOR_GROUP_RID: DWORD = 0x00000001;
1765 pub const SECURITY_CREATOR_OWNER_SERVER_RID: DWORD = 0x00000002;
1766 pub const SECURITY_CREATOR_GROUP_SERVER_RID: DWORD = 0x00000003;
1767 pub const SECURITY_CREATOR_OWNER_RIGHTS_RID: DWORD = 0x00000004;
1768 pub const SECURITY_NT_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 5];
1769 pub const SECURITY_DIALUP_RID: DWORD = 0x00000001;
1770 pub const SECURITY_NETWORK_RID: DWORD = 0x00000002;
1771 pub const SECURITY_BATCH_RID: DWORD = 0x00000003;
1772 pub const SECURITY_INTERACTIVE_RID: DWORD = 0x00000004;
1773 pub const SECURITY_LOGON_IDS_RID: DWORD = 0x00000005;
1774 pub const SECURITY_LOGON_IDS_RID_COUNT: DWORD = 3;
1775 pub const SECURITY_SERVICE_RID: DWORD = 0x00000006;
1776 pub const SECURITY_ANONYMOUS_LOGON_RID: DWORD = 0x00000007;
1777 pub const SECURITY_PROXY_RID: DWORD = 0x00000008;
1778 pub const SECURITY_ENTERPRISE_CONTROLLERS_RID: DWORD = 0x00000009;
1779 pub const SECURITY_SERVER_LOGON_RID: DWORD = SECURITY_ENTERPRISE_CONTROLLERS_RID;
1780 pub const SECURITY_PRINCIPAL_SELF_RID: DWORD = 0x0000000A;
1781 pub const SECURITY_AUTHENTICATED_USER_RID: DWORD = 0x0000000B;
1782 pub const SECURITY_RESTRICTED_CODE_RID: DWORD = 0x0000000C;
1783 pub const SECURITY_TERMINAL_SERVER_RID: DWORD = 0x0000000D;
1784 pub const SECURITY_REMOTE_LOGON_RID: DWORD = 0x0000000E;
1785 pub const SECURITY_THIS_ORGANIZATION_RID: DWORD = 0x0000000F;
1786 pub const SECURITY_IUSER_RID: DWORD = 0x00000011;
1787 pub const SECURITY_LOCAL_SYSTEM_RID: DWORD = 0x00000012;
1788 pub const SECURITY_LOCAL_SERVICE_RID: DWORD = 0x00000013;
1789 pub const SECURITY_NETWORK_SERVICE_RID: DWORD = 0x00000014;
1790 pub const SECURITY_NT_NON_UNIQUE: DWORD = 0x00000015;
1791 pub const SECURITY_NT_NON_UNIQUE_SUB_AUTH_COUNT: DWORD = 3;
1792 pub const SECURITY_ENTERPRISE_READONLY_CONTROLLERS_RID: DWORD = 0x00000016;
1793 pub const SECURITY_BUILTIN_DOMAIN_RID: DWORD = 0x00000020;
1794 pub const SECURITY_WRITE_RESTRICTED_CODE_RID: DWORD = 0x00000021;
1795 pub const SECURITY_PACKAGE_BASE_RID: DWORD = 0x00000040;
1796 pub const SECURITY_PACKAGE_RID_COUNT: DWORD = 2;
1797 pub const SECURITY_PACKAGE_NTLM_RID: DWORD = 0x0000000A;
1798 pub const SECURITY_PACKAGE_SCHANNEL_RID: DWORD = 0x0000000E;
1799 pub const SECURITY_PACKAGE_DIGEST_RID: DWORD = 0x00000015;
1800 pub const SECURITY_CRED_TYPE_BASE_RID: DWORD = 0x00000041;
1801 pub const SECURITY_CRED_TYPE_RID_COUNT: DWORD = 2;
1802 pub const SECURITY_CRED_TYPE_THIS_ORG_CERT_RID: DWORD = 0x00000001;
1803 pub const SECURITY_MIN_BASE_RID: DWORD = 0x00000050;
1804 pub const SECURITY_SERVICE_ID_BASE_RID: DWORD = 0x00000050;
1805 pub const SECURITY_SERVICE_ID_RID_COUNT: DWORD = 6;
1806 pub const SECURITY_RESERVED_ID_BASE_RID: DWORD = 0x00000051;
1807 pub const SECURITY_APPPOOL_ID_BASE_RID: DWORD = 0x00000052;
1808 pub const SECURITY_APPPOOL_ID_RID_COUNT: DWORD = 6;
1809 pub const SECURITY_VIRTUALSERVER_ID_BASE_RID: DWORD = 0x00000053;
1810 pub const SECURITY_VIRTUALSERVER_ID_RID_COUNT: DWORD = 6;
1811 pub const SECURITY_USERMODEDRIVERHOST_ID_BASE_RID: DWORD = 0x00000054;
1812 pub const SECURITY_USERMODEDRIVERHOST_ID_RID_COUNT: DWORD = 6;
1813 pub const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_BASE_RID: DWORD = 0x00000055;
1814 pub const SECURITY_CLOUD_INFRASTRUCTURE_SERVICES_ID_RID_COUNT: DWORD = 6;
1815 pub const SECURITY_WMIHOST_ID_BASE_RID: DWORD = 0x00000056;
1816 pub const SECURITY_WMIHOST_ID_RID_COUNT: DWORD = 6;
1817 pub const SECURITY_TASK_ID_BASE_RID: DWORD = 0x00000057;
1818 pub const SECURITY_NFS_ID_BASE_RID: DWORD = 0x00000058;
1819 pub const SECURITY_COM_ID_BASE_RID: DWORD = 0x00000059;
1820 pub const SECURITY_WINDOW_MANAGER_BASE_RID: DWORD = 0x0000005A;
1821 pub const SECURITY_RDV_GFX_BASE_RID: DWORD = 0x0000005B;
1822 pub const SECURITY_DASHOST_ID_BASE_RID: DWORD = 0x0000005C;
1823 pub const SECURITY_DASHOST_ID_RID_COUNT: DWORD = 6;
1824 pub const SECURITY_USERMANAGER_ID_BASE_RID: DWORD = 0x0000005D;
1825 pub const SECURITY_USERMANAGER_ID_RID_COUNT: DWORD = 6;
1826 pub const SECURITY_WINRM_ID_BASE_RID: DWORD = 0x0000005E;
1827 pub const SECURITY_WINRM_ID_RID_COUNT: DWORD = 6;
1828 pub const SECURITY_CCG_ID_BASE_RID: DWORD = 0x0000005F;
1829 pub const SECURITY_UMFD_BASE_RID: DWORD = 0x00000060;
1830 pub const SECURITY_VIRTUALACCOUNT_ID_RID_COUNT: DWORD = 6;
1831 pub const SECURITY_MAX_BASE_RID: DWORD = 0x0000006F;
1832 pub const SECURITY_MAX_ALWAYS_FILTERED: DWORD = 0x000003E7;
1833 pub const SECURITY_MIN_NEVER_FILTERED: DWORD = 0x000003E8;
1834 pub const SECURITY_OTHER_ORGANIZATION_RID: DWORD = 0x000003E8;
1835 pub const SECURITY_WINDOWSMOBILE_ID_BASE_RID: DWORD = 0x00000070;
1836 pub const SECURITY_INSTALLER_GROUP_CAPABILITY_BASE: DWORD = 0x20;
1837 pub const SECURITY_INSTALLER_GROUP_CAPABILITY_RID_COUNT: DWORD = 9;
1838 pub const SECURITY_INSTALLER_CAPABILITY_RID_COUNT: DWORD = 10;
1839 pub const SECURITY_LOCAL_ACCOUNT_RID: DWORD = 0x00000071;
1840 pub const SECURITY_LOCAL_ACCOUNT_AND_ADMIN_RID: DWORD = 0x00000072;
1841 pub const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_IS_COMPOUNDED: DWORD = 0x000001F0;
1842 pub const DOMAIN_GROUP_RID_AUTHORIZATION_DATA_CONTAINS_CLAIMS: DWORD = 0x000001F1;
1843 pub const DOMAIN_GROUP_RID_ENTERPRISE_READONLY_DOMAIN_CONTROLLERS: DWORD = 0x000001F2;
1844 pub const FOREST_USER_RID_MAX: DWORD = 0x000001F3;
1845 pub const DOMAIN_USER_RID_ADMIN: DWORD = 0x000001F4;
1846 pub const DOMAIN_USER_RID_GUEST: DWORD = 0x000001F5;
1847 pub const DOMAIN_USER_RID_KRBTGT: DWORD = 0x000001F6;
1848 pub const DOMAIN_USER_RID_DEFAULT_ACCOUNT: DWORD = 0x000001F7;
1849 pub const DOMAIN_USER_RID_MAX: DWORD = 0x000003E7;
1850 pub const DOMAIN_GROUP_RID_ADMINS: DWORD = 0x00000200;
1851 pub const DOMAIN_GROUP_RID_USERS: DWORD = 0x00000201;
1852 pub const DOMAIN_GROUP_RID_GUESTS: DWORD = 0x00000202;
1853 pub const DOMAIN_GROUP_RID_COMPUTERS: DWORD = 0x00000203;
1854 pub const DOMAIN_GROUP_RID_CONTROLLERS: DWORD = 0x00000204;
1855 pub const DOMAIN_GROUP_RID_CERT_ADMINS: DWORD = 0x00000205;
1856 pub const DOMAIN_GROUP_RID_SCHEMA_ADMINS: DWORD = 0x00000206;
1857 pub const DOMAIN_GROUP_RID_ENTERPRISE_ADMINS: DWORD = 0x00000207;
1858 pub const DOMAIN_GROUP_RID_POLICY_ADMINS: DWORD = 0x00000208;
1859 pub const DOMAIN_GROUP_RID_READONLY_CONTROLLERS: DWORD = 0x00000209;
1860 pub const DOMAIN_GROUP_RID_CLONEABLE_CONTROLLERS: DWORD = 0x0000020A;
1861 pub const DOMAIN_GROUP_RID_CDC_RESERVED: DWORD = 0x0000020C;
1862 pub const DOMAIN_GROUP_RID_PROTECTED_USERS: DWORD = 0x0000020D;
1863 pub const DOMAIN_GROUP_RID_KEY_ADMINS: DWORD = 0x0000020E;
1864 pub const DOMAIN_GROUP_RID_ENTERPRISE_KEY_ADMINS: DWORD = 0x0000020F;
1865 pub const DOMAIN_ALIAS_RID_ADMINS: DWORD = 0x00000220;
1866 pub const DOMAIN_ALIAS_RID_USERS: DWORD = 0x00000221;
1867 pub const DOMAIN_ALIAS_RID_GUESTS: DWORD = 0x00000222;
1868 pub const DOMAIN_ALIAS_RID_POWER_USERS: DWORD = 0x00000223;
1869 pub const DOMAIN_ALIAS_RID_ACCOUNT_OPS: DWORD = 0x00000224;
1870 pub const DOMAIN_ALIAS_RID_SYSTEM_OPS: DWORD = 0x00000225;
1871 pub const DOMAIN_ALIAS_RID_PRINT_OPS: DWORD = 0x00000226;
1872 pub const DOMAIN_ALIAS_RID_BACKUP_OPS: DWORD = 0x00000227;
1873 pub const DOMAIN_ALIAS_RID_REPLICATOR: DWORD = 0x00000228;
1874 pub const DOMAIN_ALIAS_RID_RAS_SERVERS: DWORD = 0x00000229;
1875 pub const DOMAIN_ALIAS_RID_PREW2KCOMPACCESS: DWORD = 0x0000022A;
1876 pub const DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS: DWORD = 0x0000022B;
1877 pub const DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS: DWORD = 0x0000022C;
1878 pub const DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS: DWORD = 0x0000022D;
1879 pub const DOMAIN_ALIAS_RID_MONITORING_USERS: DWORD = 0x0000022E;
1880 pub const DOMAIN_ALIAS_RID_LOGGING_USERS: DWORD = 0x0000022F;
1881 pub const DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS: DWORD = 0x00000230;
1882 pub const DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS: DWORD = 0x00000231;
1883 pub const DOMAIN_ALIAS_RID_DCOM_USERS: DWORD = 0x00000232;
1884 pub const DOMAIN_ALIAS_RID_IUSERS: DWORD = 0x00000238;
1885 pub const DOMAIN_ALIAS_RID_CRYPTO_OPERATORS: DWORD = 0x00000239;
1886 pub const DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP: DWORD = 0x0000023B;
1887 pub const DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP: DWORD = 0x0000023C;
1888 pub const DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP: DWORD = 0x0000023D;
1889 pub const DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP: DWORD = 0x0000023E;
1890 pub const DOMAIN_ALIAS_RID_RDS_REMOTE_ACCESS_SERVERS: DWORD = 0x0000023F;
1891 pub const DOMAIN_ALIAS_RID_RDS_ENDPOINT_SERVERS: DWORD = 0x00000240;
1892 pub const DOMAIN_ALIAS_RID_RDS_MANAGEMENT_SERVERS: DWORD = 0x00000241;
1893 pub const DOMAIN_ALIAS_RID_HYPER_V_ADMINS: DWORD = 0x00000242;
1894 pub const DOMAIN_ALIAS_RID_ACCESS_CONTROL_ASSISTANCE_OPS: DWORD = 0x00000243;
1895 pub const DOMAIN_ALIAS_RID_REMOTE_MANAGEMENT_USERS: DWORD = 0x00000244;
1896 pub const DOMAIN_ALIAS_RID_DEFAULT_ACCOUNT: DWORD = 0x00000245;
1897 pub const DOMAIN_ALIAS_RID_STORAGE_REPLICA_ADMINS: DWORD = 0x00000246;
1898 pub const SECURITY_APP_PACKAGE_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 15];
1899 pub const SECURITY_APP_PACKAGE_BASE_RID: DWORD = 0x00000002;
1900 pub const SECURITY_BUILTIN_APP_PACKAGE_RID_COUNT: DWORD = 2;
1901 pub const SECURITY_APP_PACKAGE_RID_COUNT: DWORD = 8;
1902 pub const SECURITY_CAPABILITY_BASE_RID: DWORD = 0x00000003;
1903 pub const SECURITY_CAPABILITY_APP_RID: DWORD = 0x00000040;
1904 pub const SECURITY_BUILTIN_CAPABILITY_RID_COUNT: DWORD = 2;
1905 pub const SECURITY_CAPABILITY_RID_COUNT: DWORD = 5;
1906 pub const SECURITY_PARENT_PACKAGE_RID_COUNT: DWORD = SECURITY_APP_PACKAGE_RID_COUNT;
1907 pub const SECURITY_CHILD_PACKAGE_RID_COUNT: DWORD = 12;
1908 pub const SECURITY_BUILTIN_PACKAGE_ANY_PACKAGE: DWORD = 0x00000001;
1909 pub const SECURITY_BUILTIN_PACKAGE_ANY_RESTRICTED_PACKAGE: DWORD = 0x00000002;
1910 pub const SECURITY_CAPABILITY_INTERNET_CLIENT: DWORD = 0x00000001;
1911 pub const SECURITY_CAPABILITY_INTERNET_CLIENT_SERVER: DWORD = 0x00000002;
1912 pub const SECURITY_CAPABILITY_PRIVATE_NETWORK_CLIENT_SERVER: DWORD = 0x00000003;
1913 pub const SECURITY_CAPABILITY_PICTURES_LIBRARY: DWORD = 0x00000004;
1914 pub const SECURITY_CAPABILITY_VIDEOS_LIBRARY: DWORD = 0x00000005;
1915 pub const SECURITY_CAPABILITY_MUSIC_LIBRARY: DWORD = 0x00000006;
1916 pub const SECURITY_CAPABILITY_DOCUMENTS_LIBRARY: DWORD = 0x00000007;
1917 pub const SECURITY_CAPABILITY_ENTERPRISE_AUTHENTICATION: DWORD = 0x00000008;
1918 pub const SECURITY_CAPABILITY_SHARED_USER_CERTIFICATES: DWORD = 0x00000009;
1919 pub const SECURITY_CAPABILITY_REMOVABLE_STORAGE: DWORD = 0x0000000A;
1920 pub const SECURITY_CAPABILITY_APPOINTMENTS: DWORD = 0x0000000B;
1921 pub const SECURITY_CAPABILITY_CONTACTS: DWORD = 0x0000000C;
1922 pub const SECURITY_CAPABILITY_INTERNET_EXPLORER: DWORD = 0x00001000;
1923 pub const SECURITY_MANDATORY_LABEL_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 16];
1924 pub const SECURITY_MANDATORY_UNTRUSTED_RID: DWORD = 0x00000000;
1925 pub const SECURITY_MANDATORY_LOW_RID: DWORD = 0x00001000;
1926 pub const SECURITY_MANDATORY_MEDIUM_RID: DWORD = 0x00002000;
1927 pub const SECURITY_MANDATORY_MEDIUM_PLUS_RID: DWORD = SECURITY_MANDATORY_MEDIUM_RID + 0x10;
1928 pub const SECURITY_MANDATORY_HIGH_RID: DWORD = 0x00003000;
1929 pub const SECURITY_MANDATORY_SYSTEM_RID: DWORD = 0x00004000;
1930 pub const SECURITY_MANDATORY_MAXIMUM_USER_RID: DWORD = SECURITY_MANDATORY_SYSTEM_RID;
1931 #[inline]
MANDATORY_LEVEL_TO_MANDATORY_RID(IL: DWORD) -> DWORD1932 pub fn MANDATORY_LEVEL_TO_MANDATORY_RID(IL: DWORD) -> DWORD {
1933     IL * 0x1000
1934 }
1935 pub const SECURITY_SCOPED_POLICY_ID_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 17];
1936 pub const SECURITY_AUTHENTICATION_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 18];
1937 pub const SECURITY_AUTHENTICATION_AUTHORITY_RID_COUNT: DWORD = 1;
1938 pub const SECURITY_AUTHENTICATION_AUTHORITY_ASSERTED_RID: DWORD = 0x00000001;
1939 pub const SECURITY_AUTHENTICATION_SERVICE_ASSERTED_RID: DWORD = 0x00000002;
1940 pub const SECURITY_AUTHENTICATION_FRESH_KEY_AUTH_RID: DWORD = 0x00000003;
1941 pub const SECURITY_AUTHENTICATION_KEY_TRUST_RID: DWORD = 0x00000004;
1942 pub const SECURITY_AUTHENTICATION_KEY_PROPERTY_MFA_RID: DWORD = 0x00000005;
1943 pub const SECURITY_AUTHENTICATION_KEY_PROPERTY_ATTESTATION_RID: DWORD = 0x00000006;
1944 pub const SECURITY_PROCESS_TRUST_AUTHORITY: [BYTE; 6] = [0, 0, 0, 0, 0, 19];
1945 pub const SECURITY_PROCESS_TRUST_AUTHORITY_RID_COUNT: DWORD = 2;
1946 pub const SECURITY_PROCESS_PROTECTION_TYPE_FULL_RID: DWORD = 0x00000400;
1947 pub const SECURITY_PROCESS_PROTECTION_TYPE_LITE_RID: DWORD = 0x00000200;
1948 pub const SECURITY_PROCESS_PROTECTION_TYPE_NONE_RID: DWORD = 0x00000000;
1949 pub const SECURITY_PROCESS_PROTECTION_LEVEL_WINTCB_RID: DWORD = 0x00002000;
1950 pub const SECURITY_PROCESS_PROTECTION_LEVEL_WINDOWS_RID: DWORD = 0x00001000;
1951 pub const SECURITY_PROCESS_PROTECTION_LEVEL_APP_RID: DWORD = 0x00000800;
1952 pub const SECURITY_PROCESS_PROTECTION_LEVEL_NONE_RID: DWORD = 0x00000000;
1953 pub const SECURITY_TRUSTED_INSTALLER_RID1: DWORD = 95600888;
1954 pub const SECURITY_TRUSTED_INSTALLER_RID2: DWORD = 341852264;
1955 pub const SECURITY_TRUSTED_INSTALLER_RID3: DWORD = 183103804;
1956 pub const SECURITY_TRUSTED_INSTALLER_RID4: DWORD = 185329263;
1957 pub const SECURITY_TRUSTED_INSTALLER_RID5: DWORD = 227147846;
1958 ENUM!{enum WELL_KNOWN_SID_TYPE {
1959     WinNullSid = 0,
1960     WinWorldSid = 1,
1961     WinLocalSid = 2,
1962     WinCreatorOwnerSid = 3,
1963     WinCreatorGroupSid = 4,
1964     WinCreatorOwnerServerSid = 5,
1965     WinCreatorGroupServerSid = 6,
1966     WinNtAuthoritySid = 7,
1967     WinDialupSid = 8,
1968     WinNetworkSid = 9,
1969     WinBatchSid = 10,
1970     WinInteractiveSid = 11,
1971     WinServiceSid = 12,
1972     WinAnonymousSid = 13,
1973     WinProxySid = 14,
1974     WinEnterpriseControllersSid = 15,
1975     WinSelfSid = 16,
1976     WinAuthenticatedUserSid = 17,
1977     WinRestrictedCodeSid = 18,
1978     WinTerminalServerSid = 19,
1979     WinRemoteLogonIdSid = 20,
1980     WinLogonIdsSid = 21,
1981     WinLocalSystemSid = 22,
1982     WinLocalServiceSid = 23,
1983     WinNetworkServiceSid = 24,
1984     WinBuiltinDomainSid = 25,
1985     WinBuiltinAdministratorsSid = 26,
1986     WinBuiltinUsersSid = 27,
1987     WinBuiltinGuestsSid = 28,
1988     WinBuiltinPowerUsersSid = 29,
1989     WinBuiltinAccountOperatorsSid = 30,
1990     WinBuiltinSystemOperatorsSid = 31,
1991     WinBuiltinPrintOperatorsSid = 32,
1992     WinBuiltinBackupOperatorsSid = 33,
1993     WinBuiltinReplicatorSid = 34,
1994     WinBuiltinPreWindows2000CompatibleAccessSid = 35,
1995     WinBuiltinRemoteDesktopUsersSid = 36,
1996     WinBuiltinNetworkConfigurationOperatorsSid = 37,
1997     WinAccountAdministratorSid = 38,
1998     WinAccountGuestSid = 39,
1999     WinAccountKrbtgtSid = 40,
2000     WinAccountDomainAdminsSid = 41,
2001     WinAccountDomainUsersSid = 42,
2002     WinAccountDomainGuestsSid = 43,
2003     WinAccountComputersSid = 44,
2004     WinAccountControllersSid = 45,
2005     WinAccountCertAdminsSid = 46,
2006     WinAccountSchemaAdminsSid = 47,
2007     WinAccountEnterpriseAdminsSid = 48,
2008     WinAccountPolicyAdminsSid = 49,
2009     WinAccountRasAndIasServersSid = 50,
2010     WinNTLMAuthenticationSid = 51,
2011     WinDigestAuthenticationSid = 52,
2012     WinSChannelAuthenticationSid = 53,
2013     WinThisOrganizationSid = 54,
2014     WinOtherOrganizationSid = 55,
2015     WinBuiltinIncomingForestTrustBuildersSid = 56,
2016     WinBuiltinPerfMonitoringUsersSid = 57,
2017     WinBuiltinPerfLoggingUsersSid = 58,
2018     WinBuiltinAuthorizationAccessSid = 59,
2019     WinBuiltinTerminalServerLicenseServersSid = 60,
2020     WinBuiltinDCOMUsersSid = 61,
2021     WinBuiltinIUsersSid = 62,
2022     WinIUserSid = 63,
2023     WinBuiltinCryptoOperatorsSid = 64,
2024     WinUntrustedLabelSid = 65,
2025     WinLowLabelSid = 66,
2026     WinMediumLabelSid = 67,
2027     WinHighLabelSid = 68,
2028     WinSystemLabelSid = 69,
2029     WinWriteRestrictedCodeSid = 70,
2030     WinCreatorOwnerRightsSid = 71,
2031     WinCacheablePrincipalsGroupSid = 72,
2032     WinNonCacheablePrincipalsGroupSid = 73,
2033     WinEnterpriseReadonlyControllersSid = 74,
2034     WinAccountReadonlyControllersSid = 75,
2035     WinBuiltinEventLogReadersGroup = 76,
2036     WinNewEnterpriseReadonlyControllersSid = 77,
2037     WinBuiltinCertSvcDComAccessGroup = 78,
2038     WinMediumPlusLabelSid = 79,
2039     WinLocalLogonSid = 80,
2040     WinConsoleLogonSid = 81,
2041     WinThisOrganizationCertificateSid = 82,
2042     WinApplicationPackageAuthoritySid = 83,
2043     WinBuiltinAnyPackageSid = 84,
2044     WinCapabilityInternetClientSid = 85,
2045     WinCapabilityInternetClientServerSid = 86,
2046     WinCapabilityPrivateNetworkClientServerSid = 87,
2047     WinCapabilityPicturesLibrarySid = 88,
2048     WinCapabilityVideosLibrarySid = 89,
2049     WinCapabilityMusicLibrarySid = 90,
2050     WinCapabilityDocumentsLibrarySid = 91,
2051     WinCapabilitySharedUserCertificatesSid = 92,
2052     WinCapabilityEnterpriseAuthenticationSid = 93,
2053     WinCapabilityRemovableStorageSid = 94,
2054     WinBuiltinRDSRemoteAccessServersSid = 95,
2055     WinBuiltinRDSEndpointServersSid = 96,
2056     WinBuiltinRDSManagementServersSid = 97,
2057     WinUserModeDriversSid = 98,
2058     WinBuiltinHyperVAdminsSid = 99,
2059     WinAccountCloneableControllersSid = 100,
2060     WinBuiltinAccessControlAssistanceOperatorsSid = 101,
2061     WinBuiltinRemoteManagementUsersSid = 102,
2062     WinAuthenticationAuthorityAssertedSid = 103,
2063     WinAuthenticationServiceAssertedSid = 104,
2064     WinLocalAccountSid = 105,
2065     WinLocalAccountAndAdministratorSid = 106,
2066     WinAccountProtectedUsersSid = 107,
2067     WinCapabilityAppointmentsSid = 108,
2068     WinCapabilityContactsSid = 109,
2069     WinAccountDefaultSystemManagedSid = 110,
2070     WinBuiltinDefaultSystemManagedGroupSid = 111,
2071     WinBuiltinStorageReplicaAdminsSid = 112,
2072     WinAccountKeyAdminsSid = 113,
2073     WinAccountEnterpriseKeyAdminsSid = 114,
2074     WinAuthenticationKeyTrustSid = 115,
2075     WinAuthenticationKeyPropertyMFASid = 116,
2076     WinAuthenticationKeyPropertyAttestationSid = 117,
2077     WinAuthenticationFreshKeyAuthSid = 118,
2078 }}
2079 pub const SYSTEM_LUID: LUID = LUID { LowPart: 0x3e7, HighPart: 0x0 };
2080 pub const ANONYMOUS_LOGON_LUID: LUID = LUID { LowPart: 0x3e6, HighPart: 0x0 };
2081 pub const LOCALSERVICE_LUID: LUID = LUID { LowPart: 0x3e5, HighPart: 0x0 };
2082 pub const NETWORKSERVICE_LUID: LUID = LUID { LowPart: 0x3e4, HighPart: 0x0 };
2083 pub const IUSER_LUID: LUID = LUID { LowPart: 0x3e3, HighPart: 0x0 };
2084 pub const SE_GROUP_MANDATORY: DWORD = 0x00000001;
2085 pub const SE_GROUP_ENABLED_BY_DEFAULT: DWORD = 0x00000002;
2086 pub const SE_GROUP_ENABLED: DWORD = 0x00000004;
2087 pub const SE_GROUP_OWNER: DWORD = 0x00000008;
2088 pub const SE_GROUP_USE_FOR_DENY_ONLY: DWORD = 0x00000010;
2089 pub const SE_GROUP_INTEGRITY: DWORD = 0x00000020;
2090 pub const SE_GROUP_INTEGRITY_ENABLED: DWORD = 0x00000040;
2091 pub const SE_GROUP_LOGON_ID: DWORD = 0xC0000000;
2092 pub const SE_GROUP_RESOURCE: DWORD = 0x20000000;
2093 pub const SE_GROUP_VALID_ATTRIBUTES: DWORD = SE_GROUP_MANDATORY | SE_GROUP_ENABLED_BY_DEFAULT
2094     | SE_GROUP_ENABLED | SE_GROUP_OWNER | SE_GROUP_USE_FOR_DENY_ONLY | SE_GROUP_LOGON_ID
2095     | SE_GROUP_RESOURCE | SE_GROUP_INTEGRITY | SE_GROUP_INTEGRITY_ENABLED;
2096 pub const ACL_REVISION: BYTE = 2;
2097 pub const ACL_REVISION_DS: BYTE = 4;
2098 pub const ACL_REVISION1: BYTE = 1;
2099 pub const MIN_ACL_REVISION: BYTE = ACL_REVISION2;
2100 pub const ACL_REVISION2: BYTE = 2;
2101 pub const ACL_REVISION3: BYTE = 3;
2102 pub const ACL_REVISION4: BYTE = 4;
2103 pub const MAX_ACL_REVISION: BYTE = ACL_REVISION4;
2104 STRUCT!{struct ACL {
2105     AclRevision: BYTE,
2106     Sbz1: BYTE,
2107     AclSize: WORD,
2108     AceCount: WORD,
2109     Sbz2: WORD,
2110 }}
2111 pub type PACL = *mut ACL;
2112 STRUCT!{struct ACE_HEADER {
2113     AceType: BYTE,
2114     AceFlags: BYTE,
2115     AceSize: WORD,
2116 }}
2117 pub type PACE_HEADER = *mut ACE_HEADER;
2118 pub const ACCESS_MIN_MS_ACE_TYPE: BYTE = 0x0;
2119 pub const ACCESS_ALLOWED_ACE_TYPE: BYTE = 0x0;
2120 pub const ACCESS_DENIED_ACE_TYPE: BYTE = 0x1;
2121 pub const SYSTEM_AUDIT_ACE_TYPE: BYTE = 0x2;
2122 pub const SYSTEM_ALARM_ACE_TYPE: BYTE = 0x3;
2123 pub const ACCESS_MAX_MS_V2_ACE_TYPE: BYTE = 0x3;
2124 pub const ACCESS_ALLOWED_COMPOUND_ACE_TYPE: BYTE = 0x4;
2125 pub const ACCESS_MAX_MS_V3_ACE_TYPE: BYTE = 0x4;
2126 pub const ACCESS_MIN_MS_OBJECT_ACE_TYPE: BYTE = 0x5;
2127 pub const ACCESS_ALLOWED_OBJECT_ACE_TYPE: BYTE = 0x5;
2128 pub const ACCESS_DENIED_OBJECT_ACE_TYPE: BYTE = 0x6;
2129 pub const SYSTEM_AUDIT_OBJECT_ACE_TYPE: BYTE = 0x7;
2130 pub const SYSTEM_ALARM_OBJECT_ACE_TYPE: BYTE = 0x8;
2131 pub const ACCESS_MAX_MS_OBJECT_ACE_TYPE: BYTE = 0x8;
2132 pub const ACCESS_MAX_MS_V4_ACE_TYPE: BYTE = 0x8;
2133 pub const ACCESS_MAX_MS_ACE_TYPE: BYTE = 0x8;
2134 pub const ACCESS_ALLOWED_CALLBACK_ACE_TYPE: BYTE = 0x9;
2135 pub const ACCESS_DENIED_CALLBACK_ACE_TYPE: BYTE = 0xA;
2136 pub const ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xB;
2137 pub const ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xC;
2138 pub const SYSTEM_AUDIT_CALLBACK_ACE_TYPE: BYTE = 0xD;
2139 pub const SYSTEM_ALARM_CALLBACK_ACE_TYPE: BYTE = 0xE;
2140 pub const SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0xF;
2141 pub const SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE: BYTE = 0x10;
2142 pub const SYSTEM_MANDATORY_LABEL_ACE_TYPE: BYTE = 0x11;
2143 pub const SYSTEM_RESOURCE_ATTRIBUTE_ACE_TYPE: BYTE = 0x12;
2144 pub const SYSTEM_SCOPED_POLICY_ID_ACE_TYPE: BYTE = 0x13;
2145 pub const SYSTEM_PROCESS_TRUST_LABEL_ACE_TYPE: BYTE = 0x14;
2146 pub const SYSTEM_ACCESS_FILTER_ACE_TYPE: BYTE = 0x15;
2147 pub const ACCESS_MAX_MS_V5_ACE_TYPE: BYTE = 0x15;
2148 pub const OBJECT_INHERIT_ACE: BYTE = 0x1;
2149 pub const CONTAINER_INHERIT_ACE: BYTE = 0x2;
2150 pub const NO_PROPAGATE_INHERIT_ACE: BYTE = 0x4;
2151 pub const INHERIT_ONLY_ACE: BYTE = 0x8;
2152 pub const INHERITED_ACE: BYTE = 0x10;
2153 pub const VALID_INHERIT_FLAGS: BYTE = 0x1F;
2154 pub const SUCCESSFUL_ACCESS_ACE_FLAG: BYTE = 0x40;
2155 pub const FAILED_ACCESS_ACE_FLAG: BYTE = 0x80;
2156 pub const TRUST_PROTECTED_FILTER_ACE_FLAG: BYTE = 0x40;
2157 STRUCT!{struct ACCESS_ALLOWED_ACE {
2158     Header: ACE_HEADER,
2159     Mask: ACCESS_MASK,
2160     SidStart: DWORD,
2161 }}
2162 pub type PACCESS_ALLOWED_ACE = *mut ACCESS_ALLOWED_ACE;
2163 STRUCT!{struct ACCESS_DENIED_ACE {
2164     Header: ACE_HEADER,
2165     Mask: ACCESS_MASK,
2166     SidStart: DWORD,
2167 }}
2168 pub type PACCESS_DENIED_ACE = *mut ACCESS_DENIED_ACE;
2169 STRUCT!{struct SYSTEM_AUDIT_ACE {
2170     Header: ACE_HEADER,
2171     Mask: ACCESS_MASK,
2172     SidStart: DWORD,
2173 }}
2174 pub type PSYSTEM_AUDIT_ACE = *mut SYSTEM_AUDIT_ACE;
2175 STRUCT!{struct SYSTEM_ALARM_ACE {
2176     Header: ACE_HEADER,
2177     Mask: ACCESS_MASK,
2178     SidStart: DWORD,
2179 }}
2180 pub type PSYSTEM_ALARM_ACE = *mut SYSTEM_ALARM_ACE;
2181 STRUCT!{struct SYSTEM_RESOURCE_ATTRIBUTE_ACE {
2182     Header: ACE_HEADER,
2183     Mask: ACCESS_MASK,
2184     SidStart: DWORD,
2185 }}
2186 pub type PSYSTEM_RESOURCE_ATTRIBUTE_ACE = *mut SYSTEM_RESOURCE_ATTRIBUTE_ACE;
2187 STRUCT!{struct SYSTEM_SCOPED_POLICY_ID_ACE {
2188     Header: ACE_HEADER,
2189     Mask: ACCESS_MASK,
2190     SidStart: DWORD,
2191 }}
2192 pub type PSYSTEM_SCOPED_POLICY_ID_ACE = *mut SYSTEM_SCOPED_POLICY_ID_ACE;
2193 STRUCT!{struct SYSTEM_MANDATORY_LABEL_ACE {
2194     Header: ACE_HEADER,
2195     Mask: ACCESS_MASK,
2196     SidStart: DWORD,
2197 }}
2198 pub type PSYSTEM_MANDATORY_LABEL_ACE = *mut SYSTEM_MANDATORY_LABEL_ACE;
2199 STRUCT!{struct SYSTEM_PROCESS_TRUST_LABEL_ACE {
2200     Header: ACE_HEADER,
2201     Mask: ACCESS_MASK,
2202     SidStart: DWORD,
2203 }}
2204 pub type PSYSTEM_PROCESS_TRUST_LABEL_ACE = *mut SYSTEM_PROCESS_TRUST_LABEL_ACE;
2205 STRUCT!{struct SYSTEM_ACCESS_FILTER_ACE {
2206     Header: ACE_HEADER,
2207     Mask: ACCESS_MASK,
2208     SidStart: DWORD,
2209 }}
2210 pub type PSYSTEM_ACCESS_FILTER_ACE = *mut SYSTEM_ACCESS_FILTER_ACE;
2211 pub const SYSTEM_MANDATORY_LABEL_NO_WRITE_UP: ACCESS_MASK = 0x1;
2212 pub const SYSTEM_MANDATORY_LABEL_NO_READ_UP: ACCESS_MASK = 0x2;
2213 pub const SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP: ACCESS_MASK = 0x4;
2214 pub const SYSTEM_MANDATORY_LABEL_VALID_MASK: ACCESS_MASK = SYSTEM_MANDATORY_LABEL_NO_WRITE_UP
2215     | SYSTEM_MANDATORY_LABEL_NO_READ_UP | SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP;
2216 pub const SYSTEM_PROCESS_TRUST_LABEL_VALID_MASK: ACCESS_MASK = 0x00ffffff;
2217 pub const SYSTEM_PROCESS_TRUST_NOCONSTRAINT_MASK: ACCESS_MASK = 0xffffffff;
2218 pub const SYSTEM_ACCESS_FILTER_VALID_MASK: ACCESS_MASK = 0x00ffffff;
2219 pub const SYSTEM_ACCESS_FILTER_NOCONSTRAINT_MASK: ACCESS_MASK = 0xffffffff;
2220 STRUCT!{struct ACCESS_ALLOWED_OBJECT_ACE {
2221     Header: ACE_HEADER,
2222     Mask: ACCESS_MASK,
2223     Flags: DWORD,
2224     ObjectType: GUID,
2225     InheritedObjectType: GUID,
2226     SidStart: DWORD,
2227 }}
2228 pub type PACCESS_ALLOWED_OBJECT_ACE = *mut ACCESS_ALLOWED_OBJECT_ACE;
2229 STRUCT!{struct ACCESS_DENIED_OBJECT_ACE {
2230     Header: ACE_HEADER,
2231     Mask: ACCESS_MASK,
2232     Flags: DWORD,
2233     ObjectType: GUID,
2234     InheritedObjectType: GUID,
2235     SidStart: DWORD,
2236 }}
2237 pub type PACCESS_DENIED_OBJECT_ACE = *mut ACCESS_DENIED_OBJECT_ACE;
2238 STRUCT!{struct SYSTEM_AUDIT_OBJECT_ACE {
2239     Header: ACE_HEADER,
2240     Mask: ACCESS_MASK,
2241     Flags: DWORD,
2242     ObjectType: GUID,
2243     InheritedObjectType: GUID,
2244     SidStart: DWORD,
2245 }}
2246 pub type PSYSTEM_AUDIT_OBJECT_ACE = *mut SYSTEM_AUDIT_OBJECT_ACE;
2247 STRUCT!{struct SYSTEM_ALARM_OBJECT_ACE {
2248     Header: ACE_HEADER,
2249     Mask: ACCESS_MASK,
2250     Flags: DWORD,
2251     ObjectType: GUID,
2252     InheritedObjectType: GUID,
2253     SidStart: DWORD,
2254 }}
2255 pub type PSYSTEM_ALARM_OBJECT_ACE = *mut SYSTEM_ALARM_OBJECT_ACE;
2256 STRUCT!{struct ACCESS_ALLOWED_CALLBACK_ACE {
2257     Header: ACE_HEADER,
2258     Mask: ACCESS_MASK,
2259     SidStart: DWORD,
2260 }}
2261 pub type PACCESS_ALLOWED_CALLBACK_ACE = *mut ACCESS_ALLOWED_CALLBACK_ACE;
2262 STRUCT!{struct ACCESS_DENIED_CALLBACK_ACE {
2263     Header: ACE_HEADER,
2264     Mask: ACCESS_MASK,
2265     SidStart: DWORD,
2266 }}
2267 pub type PACCESS_DENIED_CALLBACK_ACE = *mut ACCESS_DENIED_CALLBACK_ACE;
2268 STRUCT!{struct SYSTEM_AUDIT_CALLBACK_ACE {
2269     Header: ACE_HEADER,
2270     Mask: ACCESS_MASK,
2271     SidStart: DWORD,
2272 }}
2273 pub type PSYSTEM_AUDIT_CALLBACK_ACE = *mut SYSTEM_AUDIT_CALLBACK_ACE;
2274 STRUCT!{struct SYSTEM_ALARM_CALLBACK_ACE {
2275     Header: ACE_HEADER,
2276     Mask: ACCESS_MASK,
2277     SidStart: DWORD,
2278 }}
2279 pub type PSYSTEM_ALARM_CALLBACK_ACE = *mut SYSTEM_ALARM_CALLBACK_ACE;
2280 STRUCT!{struct ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
2281     Header: ACE_HEADER,
2282     Mask: ACCESS_MASK,
2283     Flags: DWORD,
2284     ObjectType: GUID,
2285     InheritedObjectType: GUID,
2286     SidStart: DWORD,
2287 }}
2288 pub type PACCESS_ALLOWED_CALLBACK_OBJECT_ACE = *mut ACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2289 STRUCT!{struct ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2290     Header: ACE_HEADER,
2291     Mask: ACCESS_MASK,
2292     Flags: DWORD,
2293     ObjectType: GUID,
2294     InheritedObjectType: GUID,
2295     SidStart: DWORD,
2296 }}
2297 pub type PACCESS_DENIED_CALLBACK_OBJECT_ACE = *mut ACCESS_DENIED_CALLBACK_OBJECT_ACE;
2298 STRUCT!{struct SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2299     Header: ACE_HEADER,
2300     Mask: ACCESS_MASK,
2301     Flags: DWORD,
2302     ObjectType: GUID,
2303     InheritedObjectType: GUID,
2304     SidStart: DWORD,
2305 }}
2306 pub type PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE = *mut SYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2307 STRUCT!{struct SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2308     Header: ACE_HEADER,
2309     Mask: ACCESS_MASK,
2310     Flags: DWORD,
2311     ObjectType: GUID,
2312     InheritedObjectType: GUID,
2313     SidStart: DWORD,
2314 }}
2315 pub type PSYSTEM_ALARM_CALLBACK_OBJECT_ACE = *mut SYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2316 pub const ACE_OBJECT_TYPE_PRESENT: DWORD = 0x1;
2317 pub const ACE_INHERITED_OBJECT_TYPE_PRESENT: DWORD = 0x2;
2318 ENUM!{enum ACL_INFORMATION_CLASS {
2319     AclRevisionInformation = 1,
2320     AclSizeInformation,
2321 }}
2322 STRUCT!{struct ACL_REVISION_INFORMATION {
2323     AclRevision: DWORD,
2324 }}
2325 pub type PACL_REVISION_INFORMATION = *mut ACL_REVISION_INFORMATION;
2326 STRUCT!{struct ACL_SIZE_INFORMATION {
2327     AceCount: DWORD,
2328     AclBytesInUse: DWORD,
2329     AclBytesFree: DWORD,
2330 }}
2331 pub type PACL_SIZE_INFORMATION = *mut ACL_SIZE_INFORMATION;
2332 pub const SECURITY_DESCRIPTOR_REVISION: DWORD = 1;
2333 pub const SECURITY_DESCRIPTOR_REVISION1: DWORD = 1;
2334 #[cfg(target_pointer_width = "64")]
2335 pub const SECURITY_DESCRIPTOR_MIN_LENGTH: usize = 40;
2336 #[cfg(target_pointer_width = "32")]
2337 pub const SECURITY_DESCRIPTOR_MIN_LENGTH: usize = 20;
2338 pub type SECURITY_DESCRIPTOR_CONTROL = WORD;
2339 pub type PSECURITY_DESCRIPTOR_CONTROL = *mut WORD;
2340 pub const SE_OWNER_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0001;
2341 pub const SE_GROUP_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0002;
2342 pub const SE_DACL_PRESENT: SECURITY_DESCRIPTOR_CONTROL = 0x0004;
2343 pub const SE_DACL_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0008;
2344 pub const SE_SACL_PRESENT: SECURITY_DESCRIPTOR_CONTROL = 0x0010;
2345 pub const SE_SACL_DEFAULTED: SECURITY_DESCRIPTOR_CONTROL = 0x0020;
2346 pub const SE_DACL_AUTO_INHERIT_REQ: SECURITY_DESCRIPTOR_CONTROL = 0x0100;
2347 pub const SE_SACL_AUTO_INHERIT_REQ: SECURITY_DESCRIPTOR_CONTROL = 0x0200;
2348 pub const SE_DACL_AUTO_INHERITED: SECURITY_DESCRIPTOR_CONTROL = 0x0400;
2349 pub const SE_SACL_AUTO_INHERITED: SECURITY_DESCRIPTOR_CONTROL = 0x0800;
2350 pub const SE_DACL_PROTECTED: SECURITY_DESCRIPTOR_CONTROL = 0x1000;
2351 pub const SE_SACL_PROTECTED: SECURITY_DESCRIPTOR_CONTROL = 0x2000;
2352 pub const SE_RM_CONTROL_VALID: SECURITY_DESCRIPTOR_CONTROL = 0x4000;
2353 pub const SE_SELF_RELATIVE: SECURITY_DESCRIPTOR_CONTROL = 0x8000;
2354 STRUCT!{struct SECURITY_DESCRIPTOR_RELATIVE {
2355     Revision: BYTE,
2356     Sbz1: BYTE,
2357     Control: SECURITY_DESCRIPTOR_CONTROL,
2358     Owner: DWORD,
2359     Group: DWORD,
2360     Sacl: DWORD,
2361     Dacl: DWORD,
2362 }}
2363 pub type PISECURITY_DESCRIPTOR_RELATIVE = *mut SECURITY_DESCRIPTOR_RELATIVE;
2364 STRUCT!{struct SECURITY_DESCRIPTOR {
2365     Revision: BYTE,
2366     Sbz1: BYTE,
2367     Control: SECURITY_DESCRIPTOR_CONTROL,
2368     Owner: PSID,
2369     Group: PSID,
2370     Sacl: PACL,
2371     Dacl: PACL,
2372 }}
2373 pub type PISECURITY_DESCRIPTOR = *mut SECURITY_DESCRIPTOR;
2374 STRUCT!{struct SECURITY_OBJECT_AI_PARAMS {
2375     Size: DWORD,
2376     ConstraintMask: DWORD,
2377 }}
2378 pub type PSECURITY_OBJECT_AI_PARAMS = *mut SECURITY_OBJECT_AI_PARAMS;
2379 STRUCT!{struct OBJECT_TYPE_LIST {
2380     Level: WORD,
2381     Sbz: WORD,
2382     ObjectType: *mut GUID,
2383 }}
2384 pub type POBJECT_TYPE_LIST = *mut OBJECT_TYPE_LIST;
2385 pub const ACCESS_OBJECT_GUID: WORD = 0;
2386 pub const ACCESS_PROPERTY_SET_GUID: WORD = 1;
2387 pub const ACCESS_PROPERTY_GUID: WORD = 2;
2388 pub const ACCESS_MAX_LEVEL: WORD = 4;
2389 ENUM!{enum AUDIT_EVENT_TYPE {
2390     AuditEventObjectAccess,
2391     AuditEventDirectoryServiceAccess,
2392 }}
2393 pub const AUDIT_ALLOW_NO_PRIVILEGE: DWORD = 0x1;
2394 pub const ACCESS_DS_SOURCE: &'static str = "DS";
2395 pub const ACCESS_DS_OBJECT_TYPE_NAME: &'static str = "Directory Service Object";
2396 pub const SE_PRIVILEGE_ENABLED_BY_DEFAULT: DWORD = 0x00000001;
2397 pub const SE_PRIVILEGE_ENABLED: DWORD = 0x00000002;
2398 pub const SE_PRIVILEGE_REMOVED: DWORD = 0x00000004;
2399 pub const SE_PRIVILEGE_USED_FOR_ACCESS: DWORD = 0x80000000;
2400 pub const SE_PRIVILEGE_VALID_ATTRIBUTES: DWORD = SE_PRIVILEGE_ENABLED_BY_DEFAULT
2401     | SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS;
2402 pub const PRIVILEGE_SET_ALL_NECESSARY: DWORD = 1;
2403 STRUCT!{struct PRIVILEGE_SET {
2404     PrivilegeCount: DWORD,
2405     Control: DWORD,
2406     Privilege: [LUID_AND_ATTRIBUTES; ANYSIZE_ARRAY],
2407 }}
2408 pub type PPRIVILEGE_SET = *mut PRIVILEGE_SET;
2409 pub const ACCESS_REASON_TYPE_MASK: ACCESS_REASON = 0x00ff0000;
2410 pub const ACCESS_REASON_DATA_MASK: ACCESS_REASON = 0x0000ffff;
2411 pub const ACCESS_REASON_STAGING_MASK: ACCESS_REASON = 0x80000000;
2412 pub const ACCESS_REASON_EXDATA_MASK: ACCESS_REASON = 0x7f000000;
2413 ENUM!{enum ACCESS_REASON_TYPE {
2414     AccessReasonNone = 0x00000000,
2415     AccessReasonAllowedAce = 0x00010000,
2416     AccessReasonDeniedAce = 0x00020000,
2417     AccessReasonAllowedParentAce = 0x00030000,
2418     AccessReasonDeniedParentAce = 0x00040000,
2419     AccessReasonNotGrantedByCape = 0x00050000,
2420     AccessReasonNotGrantedByParentCape = 0x00060000,
2421     AccessReasonNotGrantedToAppContainer = 0x00070000,
2422     AccessReasonMissingPrivilege = 0x00100000,
2423     AccessReasonFromPrivilege = 0x00200000,
2424     AccessReasonIntegrityLevel = 0x00300000,
2425     AccessReasonOwnership = 0x00400000,
2426     AccessReasonNullDacl = 0x00500000,
2427     AccessReasonEmptyDacl = 0x00600000,
2428     AccessReasonNoSD = 0x00700000,
2429     AccessReasonNoGrant = 0x00800000,
2430     AccessReasonTrustLabel = 0x00900000,
2431     AccessReasonFilterAce = 0x00a00000,
2432 }}
2433 pub type ACCESS_REASON = DWORD;
2434 STRUCT!{struct ACCESS_REASONS {
2435     Data: [ACCESS_REASON; 32],
2436 }}
2437 pub type PACCESS_REASONS = *mut ACCESS_REASONS;
2438 pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_OWNER_ACE: DWORD = 0x00000001;
2439 pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_LABEL_ACE: DWORD = 0x00000002;
2440 pub const SE_SECURITY_DESCRIPTOR_FLAG_NO_ACCESS_FILTER_ACE: DWORD = 0x00000004;
2441 pub const SE_SECURITY_DESCRIPTOR_VALID_FLAGS: DWORD = 0x00000007;
2442 STRUCT!{struct SE_SECURITY_DESCRIPTOR {
2443     Size: DWORD,
2444     Flags: DWORD,
2445     SecurityDescriptor: PSECURITY_DESCRIPTOR,
2446 }}
2447 pub type PSE_SECURITY_DESCRIPTOR = *mut SE_SECURITY_DESCRIPTOR;
2448 STRUCT!{struct SE_ACCESS_REQUEST {
2449     Size: DWORD,
2450     SeSecurityDescriptor: PSE_SECURITY_DESCRIPTOR,
2451     DesiredAccess: ACCESS_MASK,
2452     PreviouslyGrantedAccess: ACCESS_MASK,
2453     PrincipalSelfSid: PSID,
2454     GenericMapping: PGENERIC_MAPPING,
2455     ObjectTypeListCount: DWORD,
2456     ObjectTypeList: POBJECT_TYPE_LIST,
2457 }}
2458 pub type PSE_ACCESS_REQUEST = *mut SE_ACCESS_REQUEST;
2459 STRUCT!{struct SE_ACCESS_REPLY {
2460     Size: DWORD,
2461     ResultListCount: DWORD,
2462     GrantedAccess: PACCESS_MASK,
2463     AccessStatus: PDWORD,
2464     AccessReason: PACCESS_REASONS,
2465     Privileges: *mut PPRIVILEGE_SET,
2466 }}
2467 pub type PSE_ACCESS_REPLY = *mut SE_ACCESS_REPLY;
2468 pub const SE_CREATE_TOKEN_NAME: &'static str = "SeCreateTokenPrivilege";
2469 pub const SE_ASSIGNPRIMARYTOKEN_NAME: &'static str = "SeAssignPrimaryTokenPrivilege";
2470 pub const SE_LOCK_MEMORY_NAME: &'static str = "SeLockMemoryPrivilege";
2471 pub const SE_INCREASE_QUOTA_NAME: &'static str = "SeIncreaseQuotaPrivilege";
2472 pub const SE_UNSOLICITED_INPUT_NAME: &'static str = "SeUnsolicitedInputPrivilege";
2473 pub const SE_MACHINE_ACCOUNT_NAME: &'static str = "SeMachineAccountPrivilege";
2474 pub const SE_TCB_NAME: &'static str = "SeTcbPrivilege";
2475 pub const SE_SECURITY_NAME: &'static str = "SeSecurityPrivilege";
2476 pub const SE_TAKE_OWNERSHIP_NAME: &'static str = "SeTakeOwnershipPrivilege";
2477 pub const SE_LOAD_DRIVER_NAME: &'static str = "SeLoadDriverPrivilege";
2478 pub const SE_SYSTEM_PROFILE_NAME: &'static str = "SeSystemProfilePrivilege";
2479 pub const SE_SYSTEMTIME_NAME: &'static str = "SeSystemtimePrivilege";
2480 pub const SE_PROF_SINGLE_PROCESS_NAME: &'static str = "SeProfileSingleProcessPrivilege";
2481 pub const SE_INC_BASE_PRIORITY_NAME: &'static str = "SeIncreaseBasePriorityPrivilege";
2482 pub const SE_CREATE_PAGEFILE_NAME: &'static str = "SeCreatePagefilePrivilege";
2483 pub const SE_CREATE_PERMANENT_NAME: &'static str = "SeCreatePermanentPrivilege";
2484 pub const SE_BACKUP_NAME: &'static str = "SeBackupPrivilege";
2485 pub const SE_RESTORE_NAME: &'static str = "SeRestorePrivilege";
2486 pub const SE_SHUTDOWN_NAME: &'static str = "SeShutdownPrivilege";
2487 pub const SE_DEBUG_NAME: &'static str = "SeDebugPrivilege";
2488 pub const SE_AUDIT_NAME: &'static str = "SeAuditPrivilege";
2489 pub const SE_SYSTEM_ENVIRONMENT_NAME: &'static str = "SeSystemEnvironmentPrivilege";
2490 pub const SE_CHANGE_NOTIFY_NAME: &'static str = "SeChangeNotifyPrivilege";
2491 pub const SE_REMOTE_SHUTDOWN_NAME: &'static str = "SeRemoteShutdownPrivilege";
2492 pub const SE_UNDOCK_NAME: &'static str = "SeUndockPrivilege";
2493 pub const SE_SYNC_AGENT_NAME: &'static str = "SeSyncAgentPrivilege";
2494 pub const SE_ENABLE_DELEGATION_NAME: &'static str = "SeEnableDelegationPrivilege";
2495 pub const SE_MANAGE_VOLUME_NAME: &'static str = "SeManageVolumePrivilege";
2496 pub const SE_IMPERSONATE_NAME: &'static str = "SeImpersonatePrivilege";
2497 pub const SE_CREATE_GLOBAL_NAME: &'static str = "SeCreateGlobalPrivilege";
2498 pub const SE_TRUSTED_CREDMAN_ACCESS_NAME: &'static str = "SeTrustedCredManAccessPrivilege";
2499 pub const SE_RELABEL_NAME: &'static str = "SeRelabelPrivilege";
2500 pub const SE_INC_WORKING_SET_NAME: &'static str = "SeIncreaseWorkingSetPrivilege";
2501 pub const SE_TIME_ZONE_NAME: &'static str = "SeTimeZonePrivilege";
2502 pub const SE_CREATE_SYMBOLIC_LINK_NAME: &'static str = "SeCreateSymbolicLinkPrivilege";
2503 pub const SE_DELEGATE_SESSION_USER_IMPERSONATE_NAME: &'static str
2504     = "SeDelegateSessionUserImpersonatePrivilege";
2505 pub const SE_ACTIVATE_AS_USER_CAPABILITY: &'static str = "activateAsUser";
2506 pub const SE_CONSTRAINED_IMPERSONATION_CAPABILITY: &'static str = "constrainedImpersonation";
2507 pub const SE_SESSION_IMPERSONATION_CAPABILITY: &'static str = "sessionImpersonation";
2508 pub const SE_MUMA_CAPABILITY: &'static str = "muma";
2509 pub const SE_DEVELOPMENT_MODE_NETWORK_CAPABILITY: &'static str = "developmentModeNetwork";
2510 ENUM!{enum SECURITY_IMPERSONATION_LEVEL {
2511     SecurityAnonymous,
2512     SecurityIdentification,
2513     SecurityImpersonation,
2514     SecurityDelegation,
2515 }}
2516 pub type PSECURITY_IMPERSONATION_LEVEL = *mut SECURITY_IMPERSONATION_LEVEL;
2517 pub const SECURITY_MAX_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityDelegation;
2518 pub const SECURITY_MIN_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityAnonymous;
2519 pub const DEFAULT_IMPERSONATION_LEVEL: SECURITY_IMPERSONATION_LEVEL = SecurityImpersonation;
2520 #[inline]
VALID_IMPERSONATION_LEVEL(L: SECURITY_IMPERSONATION_LEVEL) -> bool2521 pub fn VALID_IMPERSONATION_LEVEL(L: SECURITY_IMPERSONATION_LEVEL) -> bool {
2522     (L >= SECURITY_MIN_IMPERSONATION_LEVEL) && (L <= SECURITY_MAX_IMPERSONATION_LEVEL)
2523 }
2524 pub const TOKEN_ASSIGN_PRIMARY: DWORD = 0x0001;
2525 pub const TOKEN_DUPLICATE: DWORD = 0x0002;
2526 pub const TOKEN_IMPERSONATE: DWORD = 0x0004;
2527 pub const TOKEN_QUERY: DWORD = 0x0008;
2528 pub const TOKEN_QUERY_SOURCE: DWORD = 0x0010;
2529 pub const TOKEN_ADJUST_PRIVILEGES: DWORD = 0x0020;
2530 pub const TOKEN_ADJUST_GROUPS: DWORD = 0x0040;
2531 pub const TOKEN_ADJUST_DEFAULT: DWORD = 0x0080;
2532 pub const TOKEN_ADJUST_SESSIONID: DWORD = 0x0100;
2533 pub const TOKEN_ALL_ACCESS_P: DWORD = STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY
2534     | TOKEN_DUPLICATE | TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE
2535     | TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT;
2536 pub const TOKEN_ALL_ACCESS: DWORD = TOKEN_ALL_ACCESS_P | TOKEN_ADJUST_SESSIONID;
2537 pub const TOKEN_READ: DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY;
2538 pub const TOKEN_WRITE: DWORD = STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES
2539     | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT;
2540 pub const TOKEN_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE;
2541 pub const TOKEN_TRUST_CONSTRAINT_MASK: DWORD = STANDARD_RIGHTS_READ | TOKEN_QUERY
2542     | TOKEN_QUERY_SOURCE;
2543 pub const TOKEN_ACCESS_PSEUDO_HANDLE_WIN8: DWORD = TOKEN_QUERY | TOKEN_QUERY_SOURCE;
2544 pub const TOKEN_ACCESS_PSEUDO_HANDLE: DWORD = TOKEN_ACCESS_PSEUDO_HANDLE_WIN8;
2545 ENUM!{enum TOKEN_TYPE {
2546     TokenPrimary = 1,
2547     TokenImpersonation,
2548 }}
2549 pub type PTOKEN_TYPE = *mut TOKEN_TYPE;
2550 ENUM!{enum TOKEN_ELEVATION_TYPE {
2551     TokenElevationTypeDefault = 1,
2552     TokenElevationTypeFull,
2553     TokenElevationTypeLimited,
2554 }}
2555 pub type PTOKEN_ELEVATION_TYPE = *mut TOKEN_ELEVATION_TYPE;
2556 ENUM!{enum TOKEN_INFORMATION_CLASS {
2557     TokenUser = 1,
2558     TokenGroups,
2559     TokenPrivileges,
2560     TokenOwner,
2561     TokenPrimaryGroup,
2562     TokenDefaultDacl,
2563     TokenSource,
2564     TokenType,
2565     TokenImpersonationLevel,
2566     TokenStatistics,
2567     TokenRestrictedSids,
2568     TokenSessionId,
2569     TokenGroupsAndPrivileges,
2570     TokenSessionReference,
2571     TokenSandBoxInert,
2572     TokenAuditPolicy,
2573     TokenOrigin,
2574     TokenElevationType,
2575     TokenLinkedToken,
2576     TokenElevation,
2577     TokenHasRestrictions,
2578     TokenAccessInformation,
2579     TokenVirtualizationAllowed,
2580     TokenVirtualizationEnabled,
2581     TokenIntegrityLevel,
2582     TokenUIAccess,
2583     TokenMandatoryPolicy,
2584     TokenLogonSid,
2585     TokenIsAppContainer,
2586     TokenCapabilities,
2587     TokenAppContainerSid,
2588     TokenAppContainerNumber,
2589     TokenUserClaimAttributes,
2590     TokenDeviceClaimAttributes,
2591     TokenRestrictedUserClaimAttributes,
2592     TokenRestrictedDeviceClaimAttributes,
2593     TokenDeviceGroups,
2594     TokenRestrictedDeviceGroups,
2595     TokenSecurityAttributes,
2596     TokenIsRestricted,
2597     TokenProcessTrustLevel,
2598     TokenPrivateNameSpace,
2599     TokenSingletonAttributes,
2600     TokenBnoIsolation,
2601     MaxTokenInfoClass,
2602 }}
2603 pub type PTOKEN_INFORMATION_CLASS = *mut TOKEN_INFORMATION_CLASS;
2604 STRUCT!{struct TOKEN_USER {
2605     User: SID_AND_ATTRIBUTES,
2606 }}
2607 pub type PTOKEN_USER = *mut TOKEN_USER;
2608 UNION!{union SE_TOKEN_USER_u1 {
2609     [usize; 2],
2610     TokenUser TokenUser_mut: TOKEN_USER,
2611     User User_mut: SID_AND_ATTRIBUTES,
2612 }}
2613 UNION!{union SE_TOKEN_USER_u2 {
2614     [u32; 17],
2615     Sid Sid_mut: SID,
2616     Buffer Buffer_mut: [BYTE; SECURITY_MAX_SID_SIZE],
2617 }}
2618 STRUCT!{struct SE_TOKEN_USER {
2619     u1: SE_TOKEN_USER_u1,
2620     u2: SE_TOKEN_USER_u2,
2621 }}
2622 pub type PSE_TOKEN_USER = *mut SE_TOKEN_USER;
2623 STRUCT!{struct TOKEN_GROUPS {
2624     GroupCount: DWORD,
2625     Groups: [SID_AND_ATTRIBUTES; ANYSIZE_ARRAY],
2626 }}
2627 pub type PTOKEN_GROUPS = *mut TOKEN_GROUPS;
2628 STRUCT!{struct TOKEN_PRIVILEGES {
2629     PrivilegeCount: DWORD,
2630     Privileges: [LUID_AND_ATTRIBUTES; ANYSIZE_ARRAY],
2631 }}
2632 pub type PTOKEN_PRIVILEGES = *mut TOKEN_PRIVILEGES;
2633 STRUCT!{struct TOKEN_OWNER {
2634     Owner: PSID,
2635 }}
2636 pub type PTOKEN_OWNER = *mut TOKEN_OWNER;
2637 STRUCT!{struct TOKEN_PRIMARY_GROUP {
2638     PrimaryGroup: PSID,
2639 }}
2640 pub type PTOKEN_PRIMARY_GROUP = *mut TOKEN_PRIMARY_GROUP;
2641 STRUCT!{struct TOKEN_DEFAULT_DACL {
2642     DefaultDacl: PACL,
2643 }}
2644 pub type PTOKEN_DEFAULT_DACL = *mut TOKEN_DEFAULT_DACL;
2645 STRUCT!{struct TOKEN_USER_CLAIMS {
2646     UserClaims: PCLAIMS_BLOB,
2647 }}
2648 pub type PTOKEN_USER_CLAIMS = *mut TOKEN_USER_CLAIMS;
2649 STRUCT!{struct TOKEN_DEVICE_CLAIMS {
2650     DeviceClaims: PCLAIMS_BLOB,
2651 }}
2652 pub type PTOKEN_DEVICE_CLAIMS = *mut TOKEN_DEVICE_CLAIMS;
2653 STRUCT!{struct TOKEN_GROUPS_AND_PRIVILEGES {
2654     SidCount: DWORD,
2655     SidLength: DWORD,
2656     Sids: PSID_AND_ATTRIBUTES,
2657     RestrictedSidCount: DWORD,
2658     RestrictedSidLength: DWORD,
2659     RestrictedSids: PSID_AND_ATTRIBUTES,
2660     PrivilegeCount: DWORD,
2661     PrivilegeLength: DWORD,
2662     Privileges: PLUID_AND_ATTRIBUTES,
2663     AuthenticationId: LUID,
2664 }}
2665 pub type PTOKEN_GROUPS_AND_PRIVILEGES = *mut TOKEN_GROUPS_AND_PRIVILEGES;
2666 STRUCT!{struct TOKEN_LINKED_TOKEN {
2667     LinkedToken: HANDLE,
2668 }}
2669 pub type PTOKEN_LINKED_TOKEN = *mut TOKEN_LINKED_TOKEN;
2670 STRUCT!{struct TOKEN_ELEVATION {
2671     TokenIsElevated: DWORD,
2672 }}
2673 pub type PTOKEN_ELEVATION = *mut TOKEN_ELEVATION;
2674 STRUCT!{struct TOKEN_MANDATORY_LABEL {
2675     Label: SID_AND_ATTRIBUTES,
2676 }}
2677 pub type PTOKEN_MANDATORY_LABEL = *mut TOKEN_MANDATORY_LABEL;
2678 pub const TOKEN_MANDATORY_POLICY_OFF: DWORD = 0x0;
2679 pub const TOKEN_MANDATORY_POLICY_NO_WRITE_UP: DWORD = 0x1;
2680 pub const TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN: DWORD = 0x2;
2681 pub const TOKEN_MANDATORY_POLICY_VALID_MASK: DWORD = TOKEN_MANDATORY_POLICY_NO_WRITE_UP
2682     | TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN;
2683 STRUCT!{struct TOKEN_MANDATORY_POLICY {
2684     Policy: DWORD,
2685 }}
2686 pub type PTOKEN_MANDATORY_POLICY = *mut TOKEN_MANDATORY_POLICY;
2687 pub type PSECURITY_ATTRIBUTES_OPAQUE = PVOID;
2688 STRUCT!{struct TOKEN_ACCESS_INFORMATION {
2689     SidHash: PSID_AND_ATTRIBUTES_HASH,
2690     RestrictedSidHash: PSID_AND_ATTRIBUTES_HASH,
2691     Privileges: PTOKEN_PRIVILEGES,
2692     AuthenticationId: LUID,
2693     TokenType: TOKEN_TYPE,
2694     ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL,
2695     MandatoryPolicy: TOKEN_MANDATORY_POLICY,
2696     Flags: DWORD,
2697     AppContainerNumber: DWORD,
2698     PackageSid: PSID,
2699     CapabilitiesHash: PSID_AND_ATTRIBUTES_HASH,
2700     TrustLevelSid: PSID,
2701     SecurityAttributes: PSECURITY_ATTRIBUTES_OPAQUE,
2702 }}
2703 pub type PTOKEN_ACCESS_INFORMATION = *mut TOKEN_ACCESS_INFORMATION;
2704 pub const POLICY_AUDIT_SUBCATEGORY_COUNT: usize = 59;
2705 STRUCT!{struct TOKEN_AUDIT_POLICY {
2706     PerUserPolicy: [BYTE; (POLICY_AUDIT_SUBCATEGORY_COUNT >> 1) + 1],
2707 }}
2708 pub type PTOKEN_AUDIT_POLICY = *mut TOKEN_AUDIT_POLICY;
2709 pub const TOKEN_SOURCE_LENGTH: usize = 8;
2710 STRUCT!{struct TOKEN_SOURCE {
2711     SourceName: [CHAR; TOKEN_SOURCE_LENGTH],
2712     SourceIdentifier: LUID,
2713 }}
2714 pub type PTOKEN_SOURCE = *mut TOKEN_SOURCE;
2715 STRUCT!{struct TOKEN_STATISTICS {
2716     TokenId: LUID,
2717     AuthenticationId: LUID,
2718     ExpirationTime: LARGE_INTEGER,
2719     TokenType: TOKEN_TYPE,
2720     ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL,
2721     DynamicCharged: DWORD,
2722     DynamicAvailable: DWORD,
2723     GroupCount: DWORD,
2724     PrivilegeCount: DWORD,
2725     ModifiedId: LUID,
2726 }}
2727 pub type PTOKEN_STATISTICS = *mut TOKEN_STATISTICS;
2728 STRUCT!{struct TOKEN_CONTROL {
2729     TokenId: LUID,
2730     AuthenticationId: LUID,
2731     ModifiedId: LUID,
2732     TokenSource: TOKEN_SOURCE,
2733 }}
2734 pub type PTOKEN_CONTROL = *mut TOKEN_CONTROL;
2735 STRUCT!{struct TOKEN_ORIGIN {
2736     OriginatingLogonSession: LUID,
2737 }}
2738 pub type PTOKEN_ORIGIN = *mut TOKEN_ORIGIN;
2739 ENUM!{enum MANDATORY_LEVEL {
2740     MandatoryLevelUntrusted = 0,
2741     MandatoryLevelLow,
2742     MandatoryLevelMedium,
2743     MandatoryLevelHigh,
2744     MandatoryLevelSystem,
2745     MandatoryLevelSecureProcess,
2746     MandatoryLevelCount,
2747 }}
2748 pub type PMANDATORY_LEVEL = *mut MANDATORY_LEVEL;
2749 STRUCT!{struct TOKEN_APPCONTAINER_INFORMATION {
2750     TokenAppContainer: PSID,
2751 }}
2752 pub type PTOKEN_APPCONTAINER_INFORMATION = *mut TOKEN_APPCONTAINER_INFORMATION;
2753 STRUCT!{struct TOKEN_SID_INFORMATION {
2754     Sid: PSID,
2755 }}
2756 pub type PTOKEN_SID_INFORMATION = *mut TOKEN_SID_INFORMATION;
2757 STRUCT!{struct TOKEN_BNO_ISOLATION_INFORMATION {
2758     IsolationPrefix: PWSTR,
2759     IsolationEnabled: BOOLEAN,
2760 }}
2761 pub type PTOKEN_BNO_ISOLATION_INFORMATION = *mut TOKEN_BNO_ISOLATION_INFORMATION;
2762 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID: WORD = 0x00;
2763 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64: WORD = 0x01;
2764 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64: WORD = 0x02;
2765 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING: WORD = 0x03;
2766 STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE {
2767     Version: DWORD64,
2768     Name: PWSTR,
2769 }}
2770 pub type PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE = *mut CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE;
2771 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN: WORD = 0x04;
2772 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_SID: WORD = 0x05;
2773 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN: WORD = 0x06;
2774 STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE {
2775     pValue: PVOID,
2776     ValueLength: DWORD,
2777 }}
2778 pub type PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE =
2779     *mut CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE;
2780 pub const CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING: WORD = 0x10;
2781 pub const CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE: DWORD = 0x0001;
2782 pub const CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE: DWORD = 0x0002;
2783 pub const CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY: DWORD = 0x0004;
2784 pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT: DWORD = 0x0008;
2785 pub const CLAIM_SECURITY_ATTRIBUTE_DISABLED: DWORD = 0x0010;
2786 pub const CLAIM_SECURITY_ATTRIBUTE_MANDATORY: DWORD = 0x0020;
2787 pub const CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS: DWORD = CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE
2788     | CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE | CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY
2789     | CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT | CLAIM_SECURITY_ATTRIBUTE_DISABLED
2790     | CLAIM_SECURITY_ATTRIBUTE_MANDATORY;
2791 pub const CLAIM_SECURITY_ATTRIBUTE_CUSTOM_FLAGS: DWORD = 0xFFFF0000;
2792 UNION!{union CLAIM_SECURITY_ATTRIBUTE_V1_Values {
2793     [usize; 1],
2794     pInt64 pInt64_mut: PLONG64,
2795     pUint64 pUint64_mut: PDWORD64,
2796     ppString ppString_mut: PWSTR,
2797     pFqbn pFqbn_mut: PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE,
2798     pOctetString pOctetString_mut: PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE,
2799 }}
2800 STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_V1 {
2801     Name: PWSTR,
2802     ValueType: WORD,
2803     Reserved: WORD,
2804     Flags: DWORD,
2805     ValueCount: DWORD,
2806     Values: CLAIM_SECURITY_ATTRIBUTE_V1_Values,
2807 }}
2808 pub type PCLAIM_SECURITY_ATTRIBUTE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_V1;
2809 UNION!{union CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values {
2810     [u32; 1],
2811     pInt64 pInt64_mut: [DWORD; ANYSIZE_ARRAY],
2812     pUint64 pUint64_mut: [DWORD; ANYSIZE_ARRAY],
2813     ppString ppString_mut: [DWORD; ANYSIZE_ARRAY],
2814     pFqbn pFqbn_mut: [DWORD; ANYSIZE_ARRAY],
2815     pOctetString pOctetString_mut: [DWORD; ANYSIZE_ARRAY],
2816 }}
2817 STRUCT!{struct CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 {
2818     Name: DWORD,
2819     ValueType: WORD,
2820     Reserved: WORD,
2821     Flags: DWORD,
2822     ValueCount: DWORD,
2823     Values: CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1_Values,
2824 }}
2825 pub type PCLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1 = *mut CLAIM_SECURITY_ATTRIBUTE_RELATIVE_V1;
2826 pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1: WORD = 1;
2827 pub const CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION: WORD =
2828     CLAIM_SECURITY_ATTRIBUTES_INFORMATION_VERSION_V1;
2829 UNION!{union CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute {
2830     [usize; 1],
2831     pAttributeV1 pAttributeV1_mut: PCLAIM_SECURITY_ATTRIBUTE_V1,
2832 }}
2833 STRUCT!{struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION {
2834     Version: WORD,
2835     Reserved: WORD,
2836     AttributeCount: DWORD,
2837     Attribute: CLAIM_SECURITY_ATTRIBUTES_INFORMATION_Attribute,
2838 }}
2839 pub type PCLAIM_SECURITY_ATTRIBUTES_INFORMATION = *mut CLAIM_SECURITY_ATTRIBUTES_INFORMATION;
2840 pub const SECURITY_DYNAMIC_TRACKING: BOOLEAN = TRUE as u8;
2841 pub const SECURITY_STATIC_TRACKING: BOOLEAN = FALSE as u8;
2842 pub type SECURITY_CONTEXT_TRACKING_MODE = BOOLEAN;
2843 pub type PSECURITY_CONTEXT_TRACKING_MODE = *mut BOOLEAN;
2844 STRUCT!{struct SECURITY_QUALITY_OF_SERVICE {
2845     Length: DWORD,
2846     ImpersonationLevel: SECURITY_IMPERSONATION_LEVEL,
2847     ContextTrackingMode: SECURITY_CONTEXT_TRACKING_MODE,
2848     EffectiveOnly: BOOLEAN,
2849 }}
2850 pub type PSECURITY_QUALITY_OF_SERVICE = *mut SECURITY_QUALITY_OF_SERVICE;
2851 STRUCT!{struct SE_IMPERSONATION_STATE {
2852     Token: PACCESS_TOKEN,
2853     CopyOnOpen: BOOLEAN,
2854     EffectiveOnly: BOOLEAN,
2855     Level: SECURITY_IMPERSONATION_LEVEL,
2856 }}
2857 pub type PSE_IMPERSONATION_STATE = *mut SE_IMPERSONATION_STATE;
2858 pub const DISABLE_MAX_PRIVILEGE: DWORD = 0x1;
2859 pub const SANDBOX_INERT: DWORD = 0x2;
2860 pub const LUA_TOKEN: DWORD = 0x4;
2861 pub const WRITE_RESTRICTED: DWORD = 0x8;
2862 pub type SECURITY_INFORMATION = DWORD;
2863 pub type PSECURITY_INFORMATION = *mut DWORD;
2864 pub const OWNER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000001;
2865 pub const GROUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000002;
2866 pub const DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000004;
2867 pub const SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000008;
2868 pub const LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000010;
2869 pub const ATTRIBUTE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000020;
2870 pub const SCOPE_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000040;
2871 pub const PROCESS_TRUST_LABEL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000080;
2872 pub const ACCESS_FILTER_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00000100;
2873 pub const BACKUP_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x00010000;
2874 pub const PROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x80000000;
2875 pub const PROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x40000000;
2876 pub const UNPROTECTED_DACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x20000000;
2877 pub const UNPROTECTED_SACL_SECURITY_INFORMATION: SECURITY_INFORMATION = 0x10000000;
2878 pub type SE_SIGNING_LEVEL = BYTE;
2879 pub type PSE_SIGNING_LEVEL = *mut BYTE;
2880 pub const SE_SIGNING_LEVEL_UNCHECKED: BYTE = 0x00000000;
2881 pub const SE_SIGNING_LEVEL_UNSIGNED: BYTE = 0x00000001;
2882 pub const SE_SIGNING_LEVEL_ENTERPRISE: BYTE = 0x00000002;
2883 pub const SE_SIGNING_LEVEL_CUSTOM_1: BYTE = 0x00000003;
2884 pub const SE_SIGNING_LEVEL_AUTHENTICODE: BYTE = 0x00000004;
2885 pub const SE_SIGNING_LEVEL_CUSTOM_2: BYTE = 0x00000005;
2886 pub const SE_SIGNING_LEVEL_STORE: BYTE = 0x00000006;
2887 pub const SE_SIGNING_LEVEL_CUSTOM_3: BYTE = 0x00000007;
2888 pub const SE_SIGNING_LEVEL_ANTIMALWARE: BYTE = SE_SIGNING_LEVEL_CUSTOM_3;
2889 pub const SE_SIGNING_LEVEL_MICROSOFT: BYTE = 0x00000008;
2890 pub const SE_SIGNING_LEVEL_CUSTOM_4: BYTE = 0x00000009;
2891 pub const SE_SIGNING_LEVEL_CUSTOM_5: BYTE = 0x0000000A;
2892 pub const SE_SIGNING_LEVEL_DYNAMIC_CODEGEN: BYTE = 0x0000000B;
2893 pub const SE_SIGNING_LEVEL_WINDOWS: BYTE = 0x0000000C;
2894 pub const SE_SIGNING_LEVEL_CUSTOM_7: BYTE = 0x0000000D;
2895 pub const SE_SIGNING_LEVEL_WINDOWS_TCB: BYTE = 0x0000000E;
2896 pub const SE_SIGNING_LEVEL_CUSTOM_6: BYTE = 0x0000000F;
2897 ENUM!{enum SE_IMAGE_SIGNATURE_TYPE {
2898     SeImageSignatureNone = 0,
2899     SeImageSignatureEmbedded,
2900     SeImageSignatureCache,
2901     SeImageSignatureCatalogCached,
2902     SeImageSignatureCatalogNotCached,
2903     SeImageSignatureCatalogHint,
2904     SeImageSignaturePackageCatalog,
2905 }}
2906 pub type PSE_IMAGE_SIGNATURE_TYPE = *mut SE_IMAGE_SIGNATURE_TYPE;
2907 ENUM!{enum SE_LEARNING_MODE_DATA_TYPE {
2908     SeLearningModeInvalidType = 0,
2909     SeLearningModeSettings,
2910     SeLearningModeMax,
2911 }}
2912 STRUCT!{struct SECURITY_CAPABILITIES {
2913     AppContainerSid: PSID,
2914     Capabilities: PSID_AND_ATTRIBUTES,
2915     CapabilityCount: DWORD,
2916     Reserved: DWORD,
2917 }}
2918 pub type PSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES;
2919 pub type LPSECURITY_CAPABILITIES = *mut SECURITY_CAPABILITIES;
2920 pub const PROCESS_TERMINATE: DWORD = 0x0001;
2921 pub const PROCESS_CREATE_THREAD: DWORD = 0x0002;
2922 pub const PROCESS_SET_SESSIONID: DWORD = 0x0004;
2923 pub const PROCESS_VM_OPERATION: DWORD = 0x0008;
2924 pub const PROCESS_VM_READ: DWORD = 0x0010;
2925 pub const PROCESS_VM_WRITE: DWORD = 0x0020;
2926 pub const PROCESS_DUP_HANDLE: DWORD = 0x0040;
2927 pub const PROCESS_CREATE_PROCESS: DWORD = 0x0080;
2928 pub const PROCESS_SET_QUOTA: DWORD = 0x0100;
2929 pub const PROCESS_SET_INFORMATION: DWORD = 0x0200;
2930 pub const PROCESS_QUERY_INFORMATION: DWORD = 0x0400;
2931 pub const PROCESS_SUSPEND_RESUME: DWORD = 0x0800;
2932 pub const PROCESS_QUERY_LIMITED_INFORMATION: DWORD = 0x1000;
2933 pub const PROCESS_SET_LIMITED_INFORMATION: DWORD = 0x2000;
2934 pub const PROCESS_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF;
2935 pub const THREAD_TERMINATE: DWORD = 0x0001;
2936 pub const THREAD_SUSPEND_RESUME: DWORD = 0x0002;
2937 pub const THREAD_GET_CONTEXT: DWORD = 0x0008;
2938 pub const THREAD_SET_CONTEXT: DWORD = 0x0010;
2939 pub const THREAD_QUERY_INFORMATION: DWORD = 0x0040;
2940 pub const THREAD_SET_INFORMATION: DWORD = 0x0020;
2941 pub const THREAD_SET_THREAD_TOKEN: DWORD = 0x0080;
2942 pub const THREAD_IMPERSONATE: DWORD = 0x0100;
2943 pub const THREAD_DIRECT_IMPERSONATION: DWORD = 0x0200;
2944 pub const THREAD_SET_LIMITED_INFORMATION: DWORD = 0x0400;
2945 pub const THREAD_QUERY_LIMITED_INFORMATION: DWORD = 0x0800;
2946 pub const THREAD_RESUME: DWORD = 0x1000;
2947 pub const THREAD_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xFFFF;
2948 pub const JOB_OBJECT_ASSIGN_PROCESS: DWORD = 0x0001;
2949 pub const JOB_OBJECT_SET_ATTRIBUTES: DWORD = 0x0002;
2950 pub const JOB_OBJECT_QUERY: DWORD = 0x0004;
2951 pub const JOB_OBJECT_TERMINATE: DWORD = 0x0008;
2952 pub const JOB_OBJECT_SET_SECURITY_ATTRIBUTES: DWORD = 0x0010;
2953 pub const JOB_OBJECT_IMPERSONATE: DWORD = 0x0020;
2954 pub const JOB_OBJECT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3F;
2955 STRUCT!{struct JOB_SET_ARRAY {
2956     JobHandle: HANDLE,
2957     MemberLevel: DWORD,
2958     Flags: DWORD,
2959 }}
2960 pub type PJOB_SET_ARRAY = *mut JOB_SET_ARRAY;
2961 pub const FLS_MAXIMUM_AVAILABLE: DWORD = 128;
2962 pub const TLS_MINIMUM_AVAILABLE: DWORD = 64;
2963 STRUCT!{struct EXCEPTION_REGISTRATION_RECORD {
2964     Next: *mut EXCEPTION_REGISTRATION_RECORD,
2965     Handler: PEXCEPTION_ROUTINE,
2966 }}
2967 pub type PEXCEPTION_REGISTRATION_RECORD = *mut EXCEPTION_REGISTRATION_RECORD;
2968 UNION!{union NT_TIB_u {
2969     [usize; 1],
2970     FiberData FiberData_mut: PVOID,
2971     Version Version_mut: DWORD,
2972 }}
2973 STRUCT!{struct NT_TIB {
2974     ExceptionList: *mut EXCEPTION_REGISTRATION_RECORD,
2975     StackBase: PVOID,
2976     StackLimit: PVOID,
2977     SubSystemTib: PVOID,
2978     u: NT_TIB_u,
2979     ArbitraryUserPointer: PVOID,
2980     _Self: *mut NT_TIB,
2981 }}
2982 pub type PNT_TIB = *mut NT_TIB;
2983 UNION!{union NT_TIB32_u {
2984     [u32; 1],
2985     FiberData FiberData_mut: DWORD,
2986     Version Version_mut: DWORD,
2987 }}
2988 STRUCT!{struct NT_TIB32 {
2989     ExceptionList: DWORD,
2990     StackBase: DWORD,
2991     StackLimit: DWORD,
2992     SubSystemTib: DWORD,
2993     u: NT_TIB32_u,
2994     ArbitraryUserPointer: DWORD,
2995     Self_: DWORD,
2996 }}
2997 pub type PNT_TIB32 = *mut NT_TIB32;
2998 UNION!{union NT_TIB64_u {
2999     [u64; 1],
3000     FiberData FiberData_mut: DWORD64,
3001     Version Version_mut: DWORD,
3002 }}
3003 STRUCT!{struct NT_TIB64 {
3004     ExceptionList: DWORD64,
3005     StackBase: DWORD64,
3006     StackLimit: DWORD64,
3007     SubSystemTib: DWORD64,
3008     u: NT_TIB64_u,
3009     ArbitraryUserPointer: DWORD64,
3010     _Self: DWORD64,
3011 }}
3012 pub type PNT_TIB64 = *mut NT_TIB64;
3013 pub const THREAD_DYNAMIC_CODE_ALLOW: DWORD = 1;
3014 pub const THREAD_BASE_PRIORITY_LOWRT: DWORD = 15;
3015 pub const THREAD_BASE_PRIORITY_MAX: DWORD = 2;
3016 pub const THREAD_BASE_PRIORITY_MIN: DWORD = -2i32 as u32;
3017 pub const THREAD_BASE_PRIORITY_IDLE: DWORD = -15i32 as u32;
3018 STRUCT!{struct UMS_CREATE_THREAD_ATTRIBUTES {
3019     UmsVersion: DWORD,
3020     UmsContext: PVOID,
3021     UmsCompletionList: PVOID,
3022 }}
3023 pub type PUMS_CREATE_THREAD_ATTRIBUTES = *mut UMS_CREATE_THREAD_ATTRIBUTES;
3024 STRUCT!{struct WOW64_ARCHITECTURE_INFORMATION {
3025     BitFields: DWORD,
3026 }}
3027 pub type PWOW64_ARCHITECTURE_INFORMATION = *mut WOW64_ARCHITECTURE_INFORMATION;
3028 BITFIELD!{WOW64_ARCHITECTURE_INFORMATION BitFields: DWORD [
3029     Machine set_Machine[0..16],
3030     KernelMode set_KernelMode[16..17],
3031     UserMode set_UserMode[17..18],
3032     Native set_Native[18..19],
3033     Process set_Process[19..20],
3034     ReservedZero0 set_ReservedZero0[20..32],
3035 ]}
3036 pub const MEMORY_PRIORITY_LOWEST: ULONG = 0;
3037 pub const MEMORY_PRIORITY_VERY_LOW: ULONG = 1;
3038 pub const MEMORY_PRIORITY_LOW: ULONG = 2;
3039 pub const MEMORY_PRIORITY_MEDIUM: ULONG = 3;
3040 pub const MEMORY_PRIORITY_BELOW_NORMAL: ULONG = 4;
3041 pub const MEMORY_PRIORITY_NORMAL: ULONG = 5;
3042 STRUCT!{struct QUOTA_LIMITS {
3043     PagedPoolLimit: SIZE_T,
3044     NonPagedPoolLimit: SIZE_T,
3045     MinimumWorkingSetSize: SIZE_T,
3046     MaximumWorkingSetSize: SIZE_T,
3047     PagefileLimit: SIZE_T,
3048     TimeLimit: LARGE_INTEGER,
3049 }}
3050 pub type PQUOTA_LIMITS = *mut QUOTA_LIMITS;
3051 pub const QUOTA_LIMITS_HARDWS_MIN_ENABLE: DWORD = 0x00000001;
3052 pub const QUOTA_LIMITS_HARDWS_MIN_DISABLE: DWORD = 0x00000002;
3053 pub const QUOTA_LIMITS_HARDWS_MAX_ENABLE: DWORD = 0x00000004;
3054 pub const QUOTA_LIMITS_HARDWS_MAX_DISABLE: DWORD = 0x00000008;
3055 pub const QUOTA_LIMITS_USE_DEFAULT_LIMITS: DWORD = 0x00000010;
3056 STRUCT!{struct RATE_QUOTA_LIMIT {
3057     RateData: DWORD,
3058 }}
3059 BITFIELD!{RATE_QUOTA_LIMIT RateData: DWORD [
3060     RatePercent set_RatePercent[0..7],
3061     Reserved0 set_Reserved0[7..32],
3062 ]}
3063 pub type PRATE_QUOTA_LIMIT = *mut RATE_QUOTA_LIMIT;
3064 STRUCT!{struct QUOTA_LIMITS_EX {
3065     PagedPoolLimit: SIZE_T,
3066     NonPagedPoolLimit: SIZE_T,
3067     MinimumWorkingSetSize: SIZE_T,
3068     MaximumWorkingSetSize: SIZE_T,
3069     PagefileLimit: SIZE_T,
3070     TimeLimit: LARGE_INTEGER,
3071     WorkingSetLimit: SIZE_T,
3072     Reserved2: SIZE_T,
3073     Reserved3: SIZE_T,
3074     Reserved4: SIZE_T,
3075     Flags: DWORD,
3076     CpuRateLimit: RATE_QUOTA_LIMIT,
3077 }}
3078 pub type PQUOTA_LIMITS_EX = *mut QUOTA_LIMITS_EX;
3079 STRUCT!{struct IO_COUNTERS {
3080     ReadOperationCount: ULONGLONG,
3081     WriteOperationCount: ULONGLONG,
3082     OtherOperationCount: ULONGLONG,
3083     ReadTransferCount: ULONGLONG,
3084     WriteTransferCount: ULONGLONG,
3085     OtherTransferCount: ULONGLONG,
3086 }}
3087 pub type PIO_COUNTERS = *mut IO_COUNTERS;
3088 pub const MAX_HW_COUNTERS: usize = 16;
3089 pub const THREAD_PROFILING_FLAG_DISPATCH: DWORD = 0x00000001;
3090 ENUM!{enum HARDWARE_COUNTER_TYPE {
3091     PMCCounter,
3092     MaxHardwareCounterType,
3093 }}
3094 pub type PHARDWARE_COUNTER_TYPE = *mut HARDWARE_COUNTER_TYPE;
3095 ENUM!{enum PROCESS_MITIGATION_POLICY {
3096     ProcessDEPPolicy,
3097     ProcessASLRPolicy,
3098     ProcessDynamicCodePolicy,
3099     ProcessStrictHandleCheckPolicy,
3100     ProcessSystemCallDisablePolicy,
3101     ProcessMitigationOptionsMask,
3102     ProcessExtensionPointDisablePolicy,
3103     ProcessControlFlowGuardPolicy,
3104     ProcessSignaturePolicy,
3105     ProcessFontDisablePolicy,
3106     ProcessImageLoadPolicy,
3107     MaxProcessMitigationPolicy,
3108 }}
3109 pub type PPROCESS_MITIGATION_POLICY = *mut PROCESS_MITIGATION_POLICY;
3110 STRUCT!{struct PROCESS_MITIGATION_ASLR_POLICY {
3111     Flags: DWORD,
3112 }}
3113 BITFIELD!{PROCESS_MITIGATION_ASLR_POLICY Flags: DWORD [
3114     EnableBottomUpRandomization set_EnableBottomUpRandomization[0..1],
3115     EnableForceRelocateImages set_EnableForceRelocateImages[1..2],
3116     EnableHighEntropy set_EnableHighEntropy[2..3],
3117     DisallowStrippedImages set_DisallowStrippedImages[3..4],
3118     ReservedFlags set_ReservedFlags[4..32],
3119 ]}
3120 pub type PPROCESS_MITIGATION_ASLR_POLICY = *mut PROCESS_MITIGATION_ASLR_POLICY;
3121 STRUCT!{struct PROCESS_MITIGATION_DEP_POLICY {
3122     Flags: DWORD,
3123     Permanent: BOOLEAN,
3124 }}
3125 BITFIELD!{PROCESS_MITIGATION_DEP_POLICY Flags: DWORD [
3126     Enable set_Enable[0..1],
3127     DisableAtlThunkEmulation set_DisableAtlThunkEmulation[1..2],
3128     ReservedFlags set_ReservedFlags[2..32],
3129 ]}
3130 pub type PPROCESS_MITIGATION_DEP_POLICY = *mut PROCESS_MITIGATION_DEP_POLICY;
3131 STRUCT!{struct PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY {
3132     Flags: DWORD,
3133 }}
3134 BITFIELD!{PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY Flags: DWORD [
3135     RaiseExceptionOnInvalidHandleReference set_RaiseExceptionOnInvalidHandleReference[0..1],
3136     HandleExceptionsPermanentlyEnabled set_HandleExceptionsPermanentlyEnabled[1..2],
3137     ReservedFlags set_ReservedFlags[2..32],
3138 ]}
3139 pub type PPROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY
3140     = *mut PROCESS_MITIGATION_STRICT_HANDLE_CHECK_POLICY;
3141 STRUCT!{struct PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY {
3142     Flags: DWORD,
3143 }}
3144 BITFIELD!{PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY Flags: DWORD [
3145     DisallowWin32kSystemCalls set_DisallowWin32kSystemCalls[0..1],
3146     ReservedFlags set_ReservedFlags[1..32],
3147 ]}
3148 pub type PPROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY
3149     = *mut PROCESS_MITIGATION_SYSTEM_CALL_DISABLE_POLICY;
3150 STRUCT!{struct PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY {
3151     Flags: DWORD,
3152 }}
3153 BITFIELD!{PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY Flags: DWORD [
3154     DisableExtensionPoints set_DisableExtensionPoints[0..1],
3155     ReservedFlags set_ReservedFlags[1..32],
3156 ]}
3157 pub type PPROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY
3158     = *mut PROCESS_MITIGATION_EXTENSION_POINT_DISABLE_POLICY;
3159 STRUCT!{struct PROCESS_MITIGATION_DYNAMIC_CODE_POLICY {
3160     Flags: DWORD,
3161 }}
3162 BITFIELD!{PROCESS_MITIGATION_DYNAMIC_CODE_POLICY Flags: DWORD [
3163     ProhibitDynamicCode set_ProhibitDynamicCode[0..1],
3164     AllowThreadOptOut set_AllowThreadOptOut[1..2],
3165     AllowRemoteDowngrade set_AllowRemoteDowngrade[2..3],
3166     ReservedFlags set_ReservedFlags[3..32],
3167 ]}
3168 pub type PPROCESS_MITIGATION_DYNAMIC_CODE_POLICY = *mut PROCESS_MITIGATION_DYNAMIC_CODE_POLICY;
3169 STRUCT!{struct PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY {
3170     Flags: DWORD,
3171 }}
3172 BITFIELD!{PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY Flags: DWORD [
3173     EnableControlFlowGuard set_EnableControlFlowGuard[0..1],
3174     EnableExportSuppression set_EnableExportSuppression[1..2],
3175     StrictMode set_StrictMode[2..3],
3176     ReservedFlags set_ReservedFlags[3..32],
3177 ]}
3178 pub type PPROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY
3179     = *mut PROCESS_MITIGATION_CONTROL_FLOW_GUARD_POLICY;
3180 STRUCT!{struct PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY {
3181     Flags: DWORD,
3182 }}
3183 BITFIELD!{PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY Flags: DWORD [
3184     MicrosoftSignedOnly set_MicrosoftSignedOnly[0..1],
3185     StoreSignedOnly set_StoreSignedOnly[1..2],
3186     MitigationOptIn set_MitigationOptIn[2..3],
3187     ReservedFlags set_ReservedFlags[3..32],
3188 ]}
3189 pub type PPROCESS_MITIGATION_BINARY_SIGNATURE_POLICY
3190     = *mut PROCESS_MITIGATION_BINARY_SIGNATURE_POLICY;
3191 STRUCT!{struct PROCESS_MITIGATION_FONT_DISABLE_POLICY {
3192     Flags: DWORD,
3193 }}
3194 BITFIELD!{PROCESS_MITIGATION_FONT_DISABLE_POLICY Flags: DWORD [
3195     DisableNonSystemFonts set_DisableNonSystemFonts[0..1],
3196     AuditNonSystemFontLoading set_AuditNonSystemFontLoading[1..2],
3197     ReservedFlags set_ReservedFlags[2..32],
3198 ]}
3199 pub type PPROCESS_MITIGATION_FONT_DISABLE_POLICY = *mut PROCESS_MITIGATION_FONT_DISABLE_POLICY;
3200 STRUCT!{struct PROCESS_MITIGATION_IMAGE_LOAD_POLICY {
3201     Flags: DWORD,
3202 }}
3203 BITFIELD!{PROCESS_MITIGATION_IMAGE_LOAD_POLICY Flags: DWORD [
3204     NoRemoteImages set_NoRemoteImages[0..1],
3205     NoLowMandatoryLabelImages set_NoLowMandatoryLabelImages[1..2],
3206     PreferSystem32Images set_PreferSystem32Images[2..3],
3207     ReservedFlags set_ReservedFlags[3..32],
3208 ]}
3209 pub type PPROCESS_MITIGATION_IMAGE_LOAD_POLICY = *mut PROCESS_MITIGATION_IMAGE_LOAD_POLICY;
3210 STRUCT!{struct PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY {
3211     Flags: DWORD,
3212 }}
3213 pub type PPPROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY =
3214     *mut PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY;
3215 BITFIELD!{PROCESS_MITIGATION_SYSTEM_CALL_FILTER_POLICY Flags: DWORD [
3216     FilterId set_FilterId[0..4],
3217     ReservedFlags set_ReservedFlags[4..32],
3218 ]}
3219 STRUCT!{struct PROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY {
3220     Flags: DWORD,
3221 }}
3222 pub type PPROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY =
3223     *mut PROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY;
3224 BITFIELD!{PROCESS_MITIGATION_PAYLOAD_RESTRICTION_POLICY Flags: DWORD [
3225     EnableExportAddressFilter set_EnableExportAddressFilter[0..1],
3226     AuditExportAddressFilter set_AuditExportAddressFilter[1..2],
3227     EnableExportAddressFilterPlus set_EnableExportAddressFilterPlus[2..3],
3228     AuditExportAddressFilterPlus set_AuditExportAddressFilterPlus[3..4],
3229     EnableImportAddressFilter set_EnableImportAddressFilter[4..5],
3230     AuditImportAddressFilter set_AuditImportAddressFilter[5..6],
3231     EnableRopStackPivot set_EnableRopStackPivot[6..7],
3232     AuditRopStackPivot set_AuditRopStackPivot[7..8],
3233     EnableRopCallerCheck set_EnableRopCallerCheck[8..9],
3234     AuditRopCallerCheck set_AuditRopCallerCheck[9..10],
3235     EnableRopSimExec set_EnableRopSimExec[10..11],
3236     AuditRopSimExec set_AuditRopSimExec[11..12],
3237     ReservedFlags set_ReservedFlags[12..32],
3238 ]}
3239 STRUCT!{struct PROCESS_MITIGATION_CHILD_PROCESS_POLICY {
3240     Flags: DWORD,
3241 }}
3242 pub type PPROCESS_MITIGATION_CHILD_PROCESS_POLICY = *mut PROCESS_MITIGATION_CHILD_PROCESS_POLICY;
3243 BITFIELD!{PROCESS_MITIGATION_CHILD_PROCESS_POLICY Flags: DWORD [
3244     NoChildProcessCreation set_NoChildProcessCreation[0..1],
3245     AuditNoChildProcessCreation set_AuditNoChildProcessCreation[1..2],
3246     AllowSecureProcessCreation set_AllowSecureProcessCreation[2..3],
3247     ReservedFlags set_ReservedFlags[3..32],
3248 ]}
3249 STRUCT!{struct JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
3250     TotalUserTime: LARGE_INTEGER,
3251     TotalKernelTime: LARGE_INTEGER,
3252     ThisPeriodTotalUserTime: LARGE_INTEGER,
3253     ThisPeriodTotalKernelTime: LARGE_INTEGER,
3254     TotalPageFaultCount: DWORD,
3255     TotalProcesses: DWORD,
3256     ActiveProcesses: DWORD,
3257     TotalTerminatedProcesses: DWORD,
3258 }}
3259 pub type PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION = *mut JOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3260 STRUCT!{struct JOBOBJECT_BASIC_LIMIT_INFORMATION {
3261     PerProcessUserTimeLimit: LARGE_INTEGER,
3262     PerJobUserTimeLimit: LARGE_INTEGER,
3263     LimitFlags: DWORD,
3264     MinimumWorkingSetSize: SIZE_T,
3265     MaximumWorkingSetSize: SIZE_T,
3266     ActiveProcessLimit: DWORD,
3267     Affinity: ULONG_PTR,
3268     PriorityClass: DWORD,
3269     SchedulingClass: DWORD,
3270 }}
3271 pub type PJOBOBJECT_BASIC_LIMIT_INFORMATION = *mut JOBOBJECT_BASIC_LIMIT_INFORMATION;
3272 STRUCT!{struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
3273     BasicLimitInformation: JOBOBJECT_BASIC_LIMIT_INFORMATION,
3274     IoInfo: IO_COUNTERS,
3275     ProcessMemoryLimit: SIZE_T,
3276     JobMemoryLimit: SIZE_T,
3277     PeakProcessMemoryUsed: SIZE_T,
3278     PeakJobMemoryUsed: SIZE_T,
3279 }}
3280 pub type PJOBOBJECT_EXTENDED_LIMIT_INFORMATION = *mut JOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3281 STRUCT!{struct JOBOBJECT_BASIC_PROCESS_ID_LIST {
3282     NumberOfAssignedProcesses: DWORD,
3283     NumberOfProcessIdsInList: DWORD,
3284     ProcessIdList: [ULONG_PTR; 1],
3285 }}
3286 pub type PJOBOBJECT_BASIC_PROCESS_ID_LIST = *mut JOBOBJECT_BASIC_PROCESS_ID_LIST;
3287 STRUCT!{struct JOBOBJECT_BASIC_UI_RESTRICTIONS {
3288     UIRestrictionsClass: DWORD,
3289 }}
3290 pub type PJOBOBJECT_BASIC_UI_RESTRICTIONS = *mut JOBOBJECT_BASIC_UI_RESTRICTIONS;
3291 STRUCT!{struct JOBOBJECT_SECURITY_LIMIT_INFORMATION {
3292     SecurityLimitFlags: DWORD,
3293     JobToken: HANDLE,
3294     SidsToDisable: PTOKEN_GROUPS,
3295     PrivilegesToDelete: PTOKEN_PRIVILEGES,
3296     RestrictedSids: PTOKEN_GROUPS,
3297 }}
3298 pub type PJOBOBJECT_SECURITY_LIMIT_INFORMATION = *mut JOBOBJECT_SECURITY_LIMIT_INFORMATION;
3299 STRUCT!{struct JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
3300     EndOfJobTimeAction: DWORD,
3301 }}
3302 pub type PJOBOBJECT_END_OF_JOB_TIME_INFORMATION = *mut JOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3303 STRUCT!{struct JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
3304     CompletionKey: PVOID,
3305     CompletionPort: HANDLE,
3306 }}
3307 pub type PJOBOBJECT_ASSOCIATE_COMPLETION_PORT = *mut JOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3308 STRUCT!{struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
3309     BasicInfo: JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,
3310     IoInfo: IO_COUNTERS,
3311 }}
3312 pub type PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
3313     = *mut JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3314 STRUCT!{struct JOBOBJECT_JOBSET_INFORMATION {
3315     MemberLevel: DWORD,
3316 }}
3317 pub type PJOBOBJECT_JOBSET_INFORMATION = *mut JOBOBJECT_JOBSET_INFORMATION;
3318 ENUM!{enum JOBOBJECT_RATE_CONTROL_TOLERANCE {
3319     ToleranceLow = 1,
3320     ToleranceMedium,
3321     ToleranceHigh,
3322 }}
3323 pub type PJOBOBJECT_RATE_CONTROL_TOLERANCE = *mut JOBOBJECT_RATE_CONTROL_TOLERANCE;
3324 ENUM!{enum JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL {
3325     ToleranceIntervalShort = 1,
3326     ToleranceIntervalMedium,
3327     ToleranceIntervalLong,
3328 }}
3329 pub type PJOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL
3330     = *mut JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL;
3331 STRUCT!{struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION {
3332     IoReadBytesLimit: DWORD64,
3333     IoWriteBytesLimit: DWORD64,
3334     PerJobUserTimeLimit: LARGE_INTEGER,
3335     JobMemoryLimit: DWORD64,
3336     RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3337     RateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL,
3338     LimitFlags: DWORD,
3339 }}
3340 pub type PJOBOBJECT_NOTIFICATION_LIMIT_INFORMATION = *mut JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION;
3341 UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u1 {
3342     [u64; 1],
3343     JobHighMemoryLimit JobHighMemoryLimit_mut: DWORD64,
3344     JobMemoryLimit JobMemoryLimit_mut: DWORD64,
3345 }}
3346 UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u2 {
3347     [u32; 1],
3348     RateControlTolerance RateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3349     CpuRateControlTolerance CpuRateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3350 }}
3351 UNION!{union JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u3 {
3352     [u32; 1],
3353     RateControlToleranceInterval RateControlToleranceInterval_mut:
3354         JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL,
3355     CpuRateControlToleranceInterval CpuRateControlToleranceInterval_mut:
3356         JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL,
3357 }}
3358 STRUCT!{struct JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2 {
3359     IoReadBytesLimit: DWORD64,
3360     IoWriteBytesLimit: DWORD64,
3361     PerJobUserTimeLimit: LARGE_INTEGER,
3362     u1: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u1,
3363     u2: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u2,
3364     u3: JOBOBJECT_NOTIFICATION_LIMIT_INFORMATION_2_u3,
3365     LimitFlags: DWORD,
3366     IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3367     JobLowMemoryLimit: DWORD64,
3368     IoRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL,
3369     NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3370     NetRateControlToleranceInterval: JOBOBJECT_RATE_CONTROL_TOLERANCE_INTERVAL,
3371 }}
3372 STRUCT!{struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION {
3373     LimitFlags: DWORD,
3374     ViolationLimitFlags: DWORD,
3375     IoReadBytes: DWORD64,
3376     IoReadBytesLimit: DWORD64,
3377     IoWriteBytes: DWORD64,
3378     IoWriteBytesLimit: DWORD64,
3379     PerJobUserTime: LARGE_INTEGER,
3380     PerJobUserTimeLimit: LARGE_INTEGER,
3381     JobMemory: DWORD64,
3382     JobMemoryLimit: DWORD64,
3383     RateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3384     RateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3385 }}
3386 pub type PJOBOBJECT_LIMIT_VIOLATION_INFORMATION = *mut JOBOBJECT_LIMIT_VIOLATION_INFORMATION;
3387 UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u1 {
3388     [u64; 1],
3389     JobHighMemoryLimit JobHighMemoryLimit_mut: DWORD64,
3390     JobMemoryLimit JobMemoryLimit_mut: DWORD64,
3391 }}
3392 UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u2 {
3393     [u32; 1],
3394     RateControlTolerance RateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3395     CpuRateControlTolerance CpuRateControlTolerance_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3396 }}
3397 UNION!{union JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u3 {
3398     [u32; 1],
3399     RateControlToleranceLimit RateControlToleranceLimit_mut: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3400     CpuRateControlToleranceLimit CpuRateControlToleranceLimit_mut:
3401         JOBOBJECT_RATE_CONTROL_TOLERANCE,
3402 }}
3403 STRUCT!{struct JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2 {
3404     LimitFlags: DWORD,
3405     ViolationLimitFlags: DWORD,
3406     IoReadBytes: DWORD64,
3407     IoReadBytesLimit: DWORD64,
3408     IoWriteBytes: DWORD64,
3409     IoWriteBytesLimit: DWORD64,
3410     PerJobUserTime: LARGE_INTEGER,
3411     PerJobUserTimeLimit: LARGE_INTEGER,
3412     JobMemory: DWORD64,
3413     u1: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u1,
3414     u2: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u2,
3415     u3: JOBOBJECT_LIMIT_VIOLATION_INFORMATION_2_u3,
3416     JobLowMemoryLimit: DWORD64,
3417     IoRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3418     IoRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3419     NetRateControlTolerance: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3420     NetRateControlToleranceLimit: JOBOBJECT_RATE_CONTROL_TOLERANCE,
3421 }}
3422 STRUCT!{struct JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u_s {
3423     MinRate: WORD,
3424     MaxRate: WORD,
3425 }}
3426 UNION!{union JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u {
3427     [u32; 1],
3428     CpuRate CpuRate_mut: DWORD,
3429     Weight Weight_mut: DWORD,
3430     s s_mut: JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u_s,
3431 }}
3432 STRUCT!{struct JOBOBJECT_CPU_RATE_CONTROL_INFORMATION {
3433     ControlFlags: DWORD,
3434     u: JOBOBJECT_CPU_RATE_CONTROL_INFORMATION_u,
3435 }}
3436 pub type PJOBOBJECT_CPU_RATE_CONTROL_INFORMATION = *mut JOBOBJECT_CPU_RATE_CONTROL_INFORMATION;
3437 ENUM!{enum JOB_OBJECT_NET_RATE_CONTROL_FLAGS {
3438     JOB_OBJECT_NET_RATE_CONTROL_ENABLE = 0x1,
3439     JOB_OBJECT_NET_RATE_CONTROL_MAX_BANDWIDTH = 0x2,
3440     JOB_OBJECT_NET_RATE_CONTROL_DSCP_TAG = 0x4,
3441     JOB_OBJECT_NET_RATE_CONTROL_VALID_FLAGS = 0x7,
3442 }}
3443 pub const JOB_OBJECT_NET_RATE_CONTROL_MAX_DSCP_TAG: DWORD = 64;
3444 STRUCT!{struct JOBOBJECT_NET_RATE_CONTROL_INFORMATION {
3445     MaxBandwidth: DWORD64,
3446     ControlFlags: JOB_OBJECT_NET_RATE_CONTROL_FLAGS,
3447     DscpTag: BYTE,
3448 }}
3449 ENUM!{enum JOB_OBJECT_IO_RATE_CONTROL_FLAGS {
3450     JOB_OBJECT_IO_RATE_CONTROL_ENABLE = 0x1,
3451     JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME = 0x2,
3452     JOB_OBJECT_IO_RATE_CONTROL_VALID_FLAGS = JOB_OBJECT_IO_RATE_CONTROL_ENABLE
3453         | JOB_OBJECT_IO_RATE_CONTROL_STANDALONE_VOLUME,
3454 }}
3455 STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE {
3456     MaxIops: LONG64,
3457     MaxBandwidth: LONG64,
3458     ReservationIops: LONG64,
3459     VolumeName: PWSTR,
3460     BaseIoSize: DWORD,
3461     ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS,
3462     VolumeNameLength: WORD,
3463 }}
3464 pub type JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V1
3465     = JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE;
3466 STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V2 {
3467     MaxIops: LONG64,
3468     MaxBandwidth: LONG64,
3469     ReservationIops: LONG64,
3470     VolumeName: PWSTR,
3471     BaseIoSize: DWORD,
3472     ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS,
3473     VolumeNameLength: WORD,
3474     CriticalReservationIops: LONG64,
3475     ReservationBandwidth: LONG64,
3476     CriticalReservationBandwidth: LONG64,
3477     MaxTimePercent: LONG64,
3478     ReservationTimePercent: LONG64,
3479     CriticalReservationTimePercent: LONG64,
3480 }}
3481 STRUCT!{struct JOBOBJECT_IO_RATE_CONTROL_INFORMATION_NATIVE_V3 {
3482     MaxIops: LONG64,
3483     MaxBandwidth: LONG64,
3484     ReservationIops: LONG64,
3485     VolumeName: PWSTR,
3486     BaseIoSize: DWORD,
3487     ControlFlags: JOB_OBJECT_IO_RATE_CONTROL_FLAGS,
3488     VolumeNameLength: WORD,
3489     CriticalReservationIops: LONG64,
3490     ReservationBandwidth: LONG64,
3491     CriticalReservationBandwidth: LONG64,
3492     MaxTimePercent: LONG64,
3493     ReservationTimePercent: LONG64,
3494     CriticalReservationTimePercent: LONG64,
3495     SoftMaxIops: LONG64,
3496     SoftMaxBandwidth: LONG64,
3497     SoftMaxTimePercent: LONG64,
3498     LimitExcessNotifyIops: LONG64,
3499     LimitExcessNotifyBandwidth: LONG64,
3500     LimitExcessNotifyTimePercent: LONG64,
3501 }}
3502 ENUM!{enum JOBOBJECT_IO_ATTRIBUTION_CONTROL_FLAGS {
3503     JOBOBJECT_IO_ATTRIBUTION_CONTROL_ENABLE = 0x1,
3504     JOBOBJECT_IO_ATTRIBUTION_CONTROL_DISABLE = 0x2,
3505     JOBOBJECT_IO_ATTRIBUTION_CONTROL_VALID_FLAGS = 0x3,
3506 }}
3507 STRUCT!{struct JOBOBJECT_IO_ATTRIBUTION_STATS {
3508     IoCount: ULONG_PTR,
3509     TotalNonOverlappedQueueTime: ULONGLONG,
3510     TotalNonOverlappedServiceTime: ULONGLONG,
3511     TotalSize: ULONGLONG,
3512 }}
3513 pub type PJOBOBJECT_IO_ATTRIBUTION_STATS = *mut JOBOBJECT_IO_ATTRIBUTION_STATS;
3514 STRUCT!{struct JOBOBJECT_IO_ATTRIBUTION_INFORMATION {
3515     ControlFlags: DWORD,
3516     ReadStats: JOBOBJECT_IO_ATTRIBUTION_STATS,
3517     WriteStats: JOBOBJECT_IO_ATTRIBUTION_STATS,
3518 }}
3519 pub type PJOBOBJECT_IO_ATTRIBUTION_INFORMATION = *mut JOBOBJECT_IO_ATTRIBUTION_INFORMATION;
3520 pub const JOB_OBJECT_TERMINATE_AT_END_OF_JOB: DWORD = 0;
3521 pub const JOB_OBJECT_POST_AT_END_OF_JOB: DWORD = 1;
3522 pub const JOB_OBJECT_MSG_END_OF_JOB_TIME: DWORD = 1;
3523 pub const JOB_OBJECT_MSG_END_OF_PROCESS_TIME: DWORD = 2;
3524 pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT: DWORD = 3;
3525 pub const JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO: DWORD = 4;
3526 pub const JOB_OBJECT_MSG_NEW_PROCESS: DWORD = 6;
3527 pub const JOB_OBJECT_MSG_EXIT_PROCESS: DWORD = 7;
3528 pub const JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS: DWORD = 8;
3529 pub const JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT: DWORD = 9;
3530 pub const JOB_OBJECT_MSG_JOB_MEMORY_LIMIT: DWORD = 10;
3531 pub const JOB_OBJECT_MSG_NOTIFICATION_LIMIT: DWORD = 11;
3532 pub const JOB_OBJECT_MSG_JOB_CYCLE_TIME_LIMIT: DWORD = 12;
3533 pub const JOB_OBJECT_MSG_SILO_TERMINATED: DWORD = 13;
3534 pub const JOB_OBJECT_MSG_MINIMUM: DWORD = 1;
3535 pub const JOB_OBJECT_MSG_MAXIMUM: DWORD = 13;
3536 pub const JOB_OBJECT_VALID_COMPLETION_FILTER: DWORD = ((1 << (JOB_OBJECT_MSG_MAXIMUM + 1)) - 1)
3537     - ((1 << JOB_OBJECT_MSG_MINIMUM) - 1);
3538 pub const JOB_OBJECT_LIMIT_WORKINGSET: DWORD = 0x00000001;
3539 pub const JOB_OBJECT_LIMIT_PROCESS_TIME: DWORD = 0x00000002;
3540 pub const JOB_OBJECT_LIMIT_JOB_TIME: DWORD = 0x00000004;
3541 pub const JOB_OBJECT_LIMIT_ACTIVE_PROCESS: DWORD = 0x00000008;
3542 pub const JOB_OBJECT_LIMIT_AFFINITY: DWORD = 0x00000010;
3543 pub const JOB_OBJECT_LIMIT_PRIORITY_CLASS: DWORD = 0x00000020;
3544 pub const JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME: DWORD = 0x00000040;
3545 pub const JOB_OBJECT_LIMIT_SCHEDULING_CLASS: DWORD = 0x00000080;
3546 pub const JOB_OBJECT_LIMIT_PROCESS_MEMORY: DWORD = 0x00000100;
3547 pub const JOB_OBJECT_LIMIT_JOB_MEMORY: DWORD = 0x00000200;
3548 pub const JOB_OBJECT_LIMIT_JOB_MEMORY_HIGH: DWORD = JOB_OBJECT_LIMIT_JOB_MEMORY;
3549 pub const JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION: DWORD = 0x00000400;
3550 pub const JOB_OBJECT_LIMIT_BREAKAWAY_OK: DWORD = 0x00000800;
3551 pub const JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK: DWORD = 0x00001000;
3552 pub const JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE: DWORD = 0x00002000;
3553 pub const JOB_OBJECT_LIMIT_SUBSET_AFFINITY: DWORD = 0x00004000;
3554 pub const JOB_OBJECT_LIMIT_JOB_MEMORY_LOW: DWORD = 0x00008000;
3555 pub const JOB_OBJECT_LIMIT_JOB_READ_BYTES: DWORD = 0x00010000;
3556 pub const JOB_OBJECT_LIMIT_JOB_WRITE_BYTES: DWORD = 0x00020000;
3557 pub const JOB_OBJECT_LIMIT_RATE_CONTROL: DWORD = 0x00040000;
3558 pub const JOB_OBJECT_LIMIT_CPU_RATE_CONTROL: DWORD = JOB_OBJECT_LIMIT_RATE_CONTROL;
3559 pub const JOB_OBJECT_LIMIT_IO_RATE_CONTROL: DWORD = 0x00008000;
3560 pub const JOB_OBJECT_LIMIT_NET_RATE_CONTROL: DWORD = 0x00010000;
3561 pub const JOB_OBJECT_LIMIT_VALID_FLAGS: DWORD = 0x0007ffff;
3562 pub const JOB_OBJECT_BASIC_LIMIT_VALID_FLAGS: DWORD = 0x000000ff;
3563 pub const JOB_OBJECT_EXTENDED_LIMIT_VALID_FLAGS: DWORD = 0x00007fff;
3564 pub const JOB_OBJECT_NOTIFICATION_LIMIT_VALID_FLAGS: DWORD = JOB_OBJECT_LIMIT_JOB_READ_BYTES
3565     | JOB_OBJECT_LIMIT_JOB_WRITE_BYTES | JOB_OBJECT_LIMIT_JOB_TIME
3566     | JOB_OBJECT_LIMIT_JOB_MEMORY_LOW | JOB_OBJECT_LIMIT_JOB_MEMORY_HIGH
3567     | JOB_OBJECT_LIMIT_CPU_RATE_CONTROL | JOB_OBJECT_LIMIT_IO_RATE_CONTROL
3568     | JOB_OBJECT_LIMIT_NET_RATE_CONTROL;
3569 pub const JOB_OBJECT_UILIMIT_NONE: DWORD = 0x00000000;
3570 pub const JOB_OBJECT_UILIMIT_HANDLES: DWORD = 0x00000001;
3571 pub const JOB_OBJECT_UILIMIT_READCLIPBOARD: DWORD = 0x00000002;
3572 pub const JOB_OBJECT_UILIMIT_WRITECLIPBOARD: DWORD = 0x00000004;
3573 pub const JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS: DWORD = 0x00000008;
3574 pub const JOB_OBJECT_UILIMIT_DISPLAYSETTINGS: DWORD = 0x00000010;
3575 pub const JOB_OBJECT_UILIMIT_GLOBALATOMS: DWORD = 0x00000020;
3576 pub const JOB_OBJECT_UILIMIT_DESKTOP: DWORD = 0x00000040;
3577 pub const JOB_OBJECT_UILIMIT_EXITWINDOWS: DWORD = 0x00000080;
3578 pub const JOB_OBJECT_UILIMIT_ALL: DWORD = 0x000000FF;
3579 pub const JOB_OBJECT_UI_VALID_FLAGS: DWORD = 0x000000FF;
3580 pub const JOB_OBJECT_SECURITY_NO_ADMIN: DWORD = 0x00000001;
3581 pub const JOB_OBJECT_SECURITY_RESTRICTED_TOKEN: DWORD = 0x00000002;
3582 pub const JOB_OBJECT_SECURITY_ONLY_TOKEN: DWORD = 0x00000004;
3583 pub const JOB_OBJECT_SECURITY_FILTER_TOKENS: DWORD = 0x00000008;
3584 pub const JOB_OBJECT_SECURITY_VALID_FLAGS: DWORD = 0x0000000f;
3585 pub const JOB_OBJECT_CPU_RATE_CONTROL_ENABLE: DWORD = 0x1;
3586 pub const JOB_OBJECT_CPU_RATE_CONTROL_WEIGHT_BASED: DWORD = 0x2;
3587 pub const JOB_OBJECT_CPU_RATE_CONTROL_HARD_CAP: DWORD = 0x4;
3588 pub const JOB_OBJECT_CPU_RATE_CONTROL_NOTIFY: DWORD = 0x8;
3589 pub const JOB_OBJECT_CPU_RATE_CONTROL_MIN_MAX_RATE: DWORD = 0x10;
3590 pub const JOB_OBJECT_CPU_RATE_CONTROL_VALID_FLAGS: DWORD = 0x1f;
3591 ENUM!{enum JOBOBJECTINFOCLASS {
3592     JobObjectBasicAccountingInformation = 1,
3593     JobObjectBasicLimitInformation,
3594     JobObjectBasicProcessIdList,
3595     JobObjectBasicUIRestrictions,
3596     JobObjectSecurityLimitInformation,
3597     JobObjectEndOfJobTimeInformation,
3598     JobObjectAssociateCompletionPortInformation,
3599     JobObjectBasicAndIoAccountingInformation,
3600     JobObjectExtendedLimitInformation,
3601     JobObjectJobSetInformation,
3602     JobObjectGroupInformation,
3603     JobObjectNotificationLimitInformation,
3604     JobObjectLimitViolationInformation,
3605     JobObjectGroupInformationEx,
3606     JobObjectCpuRateControlInformation,
3607     JobObjectCompletionFilter,
3608     JobObjectCompletionCounter,
3609     JobObjectReserved1Information = 18,
3610     JobObjectReserved2Information,
3611     JobObjectReserved3Information,
3612     JobObjectReserved4Information,
3613     JobObjectReserved5Information,
3614     JobObjectReserved6Information,
3615     JobObjectReserved7Information,
3616     JobObjectReserved8Information,
3617     JobObjectReserved9Information,
3618     JobObjectReserved10Information,
3619     JobObjectReserved11Information,
3620     JobObjectReserved12Information,
3621     JobObjectReserved13Information,
3622     JobObjectReserved14Information = 31,
3623     JobObjectNetRateControlInformation,
3624     JobObjectNotificationLimitInformation2,
3625     JobObjectLimitViolationInformation2,
3626     JobObjectCreateSilo,
3627     JobObjectSiloBasicInformation,
3628     JobObjectReserved15Information = 37,
3629     JobObjectReserved16Information = 38,
3630     JobObjectReserved17Information = 39,
3631     JobObjectReserved18Information = 40,
3632     JobObjectReserved19Information = 41,
3633     JobObjectReserved20Information = 42,
3634     JobObjectReserved21Information = 43,
3635     JobObjectReserved22Information = 44,
3636     JobObjectReserved23Information = 45,
3637     JobObjectReserved24Information = 46,
3638     JobObjectReserved25Information = 47,
3639     MaxJobObjectInfoClass,
3640 }}
3641 STRUCT!{struct SILOOBJECT_BASIC_INFORMATION {
3642     SiloId: DWORD,
3643     SiloParentId: DWORD,
3644     NumberOfProcesses: DWORD,
3645     IsInServerSilo: BOOLEAN,
3646     Reserved: [BYTE; 3],
3647 }}
3648 pub type PSILOOBJECT_BASIC_INFORMATION = *mut SILOOBJECT_BASIC_INFORMATION;
3649 ENUM!{enum SERVERSILO_STATE {
3650     SERVERSILO_INITING = 0,
3651     SERVERSILO_STARTED,
3652     SERVERSILO_SHUTTING_DOWN,
3653     SERVERSILO_TERMINATING,
3654     SERVERSILO_TERMINATED,
3655 }}
3656 pub type PSERVERSILO_STATE = *mut SERVERSILO_STATE;
3657 STRUCT!{struct SERVERSILO_BASIC_INFORMATION {
3658     ServiceSessionId: DWORD,
3659     State: SERVERSILO_STATE,
3660     ExitStatus: DWORD,
3661 }}
3662 pub type PSERVERSILO_BASIC_INFORMATION = *mut SERVERSILO_BASIC_INFORMATION;
3663 ENUM!{enum FIRMWARE_TYPE {
3664     FirmwareTypeUnknown,
3665     FirmwareTypeBios,
3666     FirmwareTypeUefi,
3667     FirmwareTypeMax,
3668 }}
3669 pub type PFIRMWARE_TYPE = *mut FIRMWARE_TYPE;
3670 pub const EVENT_MODIFY_STATE: DWORD = 0x0002;
3671 pub const EVENT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3;
3672 pub const MUTANT_QUERY_STATE: DWORD = 0x0001;
3673 pub const MUTANT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE;
3674 pub const SEMAPHORE_MODIFY_STATE: DWORD = 0x0002;
3675 pub const SEMAPHORE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3;
3676 pub const TIMER_QUERY_STATE: DWORD = 0x0001;
3677 pub const TIMER_MODIFY_STATE: DWORD = 0x0002;
3678 pub const TIMER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE
3679     | TIMER_MODIFY_STATE;
3680 pub const TIME_ZONE_ID_UNKNOWN: DWORD = 0;
3681 pub const TIME_ZONE_ID_STANDARD: DWORD = 1;
3682 pub const TIME_ZONE_ID_DAYLIGHT: DWORD = 2;
3683 ENUM!{enum LOGICAL_PROCESSOR_RELATIONSHIP {
3684     RelationProcessorCore,
3685     RelationNumaNode,
3686     RelationCache,
3687     RelationProcessorPackage,
3688     RelationGroup,
3689     RelationAll = 0xffff,
3690 }}
3691 pub const LTP_PC_SMT: BYTE = 0x1;
3692 ENUM!{enum PROCESSOR_CACHE_TYPE {
3693     CacheUnified,
3694     CacheInstruction,
3695     CacheData,
3696     CacheTrace,
3697 }}
3698 pub const CACHE_FULLY_ASSOCIATIVE: BYTE = 0xFF;
3699 STRUCT!{struct CACHE_DESCRIPTOR {
3700     Level: BYTE,
3701     Associativity: BYTE,
3702     LineSize: WORD,
3703     Size: DWORD,
3704     Type: PROCESSOR_CACHE_TYPE,
3705 }}
3706 pub type PCACHE_DESCRIPTOR = *mut CACHE_DESCRIPTOR;
3707 STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore {
3708     Flags: BYTE,
3709 }}
3710 STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode {
3711     NodeNumber: DWORD,
3712 }}
3713 UNION!{union SYSTEM_LOGICAL_PROCESSOR_INFORMATION_u {
3714     [u64; 2],
3715     ProcessorCore ProcessorCore_mut: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_ProcessorCore,
3716     NumaNode NumaNode_mut: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_NumaNode,
3717     Cache Cache_mut: CACHE_DESCRIPTOR,
3718     Reserved Reserved_mut: [ULONGLONG; 2],
3719 }}
3720 STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
3721     ProcessorMask: ULONG_PTR,
3722     Relationship: LOGICAL_PROCESSOR_RELATIONSHIP,
3723     u: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_u,
3724 }}
3725 pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION;
3726 STRUCT!{struct PROCESSOR_RELATIONSHIP {
3727     Flags: BYTE,
3728     EfficiencyClass: BYTE,
3729     Reserved: [BYTE; 20],
3730     GroupCount: WORD,
3731     GroupMask: [GROUP_AFFINITY; ANYSIZE_ARRAY],
3732 }}
3733 pub type PPROCESSOR_RELATIONSHIP = *mut PROCESSOR_RELATIONSHIP;
3734 STRUCT!{struct NUMA_NODE_RELATIONSHIP {
3735     NodeNumber: DWORD,
3736     Reserved: [BYTE; 20],
3737     GroupMask: GROUP_AFFINITY,
3738 }}
3739 pub type PNUMA_NODE_RELATIONSHIP = *mut NUMA_NODE_RELATIONSHIP;
3740 STRUCT!{struct CACHE_RELATIONSHIP {
3741     Level: BYTE,
3742     Associativity: BYTE,
3743     LineSize: WORD,
3744     CacheSize: DWORD,
3745     Type: PROCESSOR_CACHE_TYPE,
3746     Reserved: [BYTE; 20],
3747     GroupMask: GROUP_AFFINITY,
3748 }}
3749 pub type PCACHE_RELATIONSHIP = *mut CACHE_RELATIONSHIP;
3750 STRUCT!{struct PROCESSOR_GROUP_INFO {
3751     MaximumProcessorCount: BYTE,
3752     ActiveProcessorCount: BYTE,
3753     Reserved: [BYTE; 38],
3754     ActiveProcessorMask: KAFFINITY,
3755 }}
3756 pub type PPROCESSOR_GROUP_INFO = *mut PROCESSOR_GROUP_INFO;
3757 STRUCT!{struct GROUP_RELATIONSHIP {
3758     MaximumGroupCount: WORD,
3759     ActiveGroupCount: WORD,
3760     Reserved: [BYTE; 20],
3761     GroupInfo: [PROCESSOR_GROUP_INFO; ANYSIZE_ARRAY],
3762 }}
3763 pub type PGROUP_RELATIONSHIP = *mut GROUP_RELATIONSHIP;
3764 UNION!{union SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX_u {
3765     [u32; 17] [u64; 9],
3766     Processor Processor_mut: PROCESSOR_RELATIONSHIP,
3767     NumaNode NumaNode_mut: NUMA_NODE_RELATIONSHIP,
3768     Cache Cache_mut: CACHE_RELATIONSHIP,
3769     Group Group_mut: GROUP_RELATIONSHIP,
3770 }}
3771 STRUCT!{struct SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX {
3772     Relationship: LOGICAL_PROCESSOR_RELATIONSHIP,
3773     Size: DWORD,
3774     u: SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX_u,
3775 }}
3776 pub type PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX = *mut SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
3777 ENUM!{enum CPU_SET_INFORMATION_TYPE {
3778     CpuSetInformation,
3779 }}
3780 pub type PCPU_SET_INFORMATION_TYPE = *mut CPU_SET_INFORMATION_TYPE;
3781 pub const SYSTEM_CPU_SET_INFORMATION_PARKED: BYTE = 0x1;
3782 pub const SYSTEM_CPU_SET_INFORMATION_ALLOCATED: BYTE = 0x2;
3783 pub const SYSTEM_CPU_SET_INFORMATION_ALLOCATED_TO_TARGET_PROCESS: BYTE = 0x4;
3784 pub const SYSTEM_CPU_SET_INFORMATION_REALTIME: BYTE = 0x8;
3785 STRUCT!{struct SYSTEM_CPU_SET_INFORMATION_CpuSet {
3786     Id: DWORD,
3787     Group: WORD,
3788     LogicalProcessorIndex: BYTE,
3789     CoreIndex: BYTE,
3790     LastLevelCacheIndex: BYTE,
3791     NumaNodeIndex: BYTE,
3792     EfficiencyClass: BYTE,
3793     AllFlags: BYTE,
3794     Reserved: DWORD,
3795     AllocationTag: DWORD64,
3796 }}
3797 BITFIELD!{SYSTEM_CPU_SET_INFORMATION_CpuSet AllFlags: BYTE [
3798     Parked set_Parked[0..1],
3799     Allocated set_Allocated[1..2],
3800     AllocatedToTargetProcess set_AllocatedToTargetProcess[2..3],
3801     RealTime set_RealTime[3..4],
3802     ReservedFlags set_ReservedFlags[4..8],
3803 ]}
3804 STRUCT!{struct SYSTEM_CPU_SET_INFORMATION {
3805     Size: DWORD,
3806     Type: CPU_SET_INFORMATION_TYPE,
3807     CpuSet: SYSTEM_CPU_SET_INFORMATION_CpuSet,
3808 }}
3809 pub type PSYSTEM_CPU_SET_INFORMATION = *mut SYSTEM_CPU_SET_INFORMATION;
3810 STRUCT!{struct SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION {
3811     CycleTime: DWORD64,
3812 }}
3813 pub type PSYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION = *mut SYSTEM_PROCESSOR_CYCLE_TIME_INFORMATION;
3814 pub const PROCESSOR_INTEL_386: DWORD = 386;
3815 pub const PROCESSOR_INTEL_486: DWORD = 486;
3816 pub const PROCESSOR_INTEL_PENTIUM: DWORD = 586;
3817 pub const PROCESSOR_INTEL_IA64: DWORD = 2200;
3818 pub const PROCESSOR_AMD_X8664: DWORD = 8664;
3819 pub const PROCESSOR_MIPS_R4000: DWORD = 4000;
3820 pub const PROCESSOR_ALPHA_21064: DWORD = 21064;
3821 pub const PROCESSOR_PPC_601: DWORD = 601;
3822 pub const PROCESSOR_PPC_603: DWORD = 603;
3823 pub const PROCESSOR_PPC_604: DWORD = 604;
3824 pub const PROCESSOR_PPC_620: DWORD = 620;
3825 pub const PROCESSOR_HITACHI_SH3: DWORD = 10003;
3826 pub const PROCESSOR_HITACHI_SH3E: DWORD = 10004;
3827 pub const PROCESSOR_HITACHI_SH4: DWORD = 10005;
3828 pub const PROCESSOR_MOTOROLA_821: DWORD = 821;
3829 pub const PROCESSOR_SHx_SH3: DWORD = 103;
3830 pub const PROCESSOR_SHx_SH4: DWORD = 104;
3831 pub const PROCESSOR_STRONGARM: DWORD = 2577;
3832 pub const PROCESSOR_ARM720: DWORD = 1824;
3833 pub const PROCESSOR_ARM820: DWORD = 2080;
3834 pub const PROCESSOR_ARM920: DWORD = 2336;
3835 pub const PROCESSOR_ARM_7TDMI: DWORD = 70001;
3836 pub const PROCESSOR_OPTIL: DWORD = 0x494f;
3837 pub const PROCESSOR_ARCHITECTURE_INTEL: WORD = 0;
3838 pub const PROCESSOR_ARCHITECTURE_MIPS: WORD = 1;
3839 pub const PROCESSOR_ARCHITECTURE_ALPHA: WORD = 2;
3840 pub const PROCESSOR_ARCHITECTURE_PPC: WORD = 3;
3841 pub const PROCESSOR_ARCHITECTURE_SHX: WORD = 4;
3842 pub const PROCESSOR_ARCHITECTURE_ARM: WORD = 5;
3843 pub const PROCESSOR_ARCHITECTURE_IA64: WORD = 6;
3844 pub const PROCESSOR_ARCHITECTURE_ALPHA64: WORD = 7;
3845 pub const PROCESSOR_ARCHITECTURE_MSIL: WORD = 8;
3846 pub const PROCESSOR_ARCHITECTURE_AMD64: WORD = 9;
3847 pub const PROCESSOR_ARCHITECTURE_IA32_ON_WIN64: WORD = 10;
3848 pub const PROCESSOR_ARCHITECTURE_NEUTRAL: WORD = 11;
3849 pub const PROCESSOR_ARCHITECTURE_ARM64: WORD = 12;
3850 pub const PROCESSOR_ARCHITECTURE_ARM32_ON_WIN64: WORD = 13;
3851 pub const PROCESSOR_ARCHITECTURE_IA32_ON_ARM64: WORD = 14;
3852 pub const PROCESSOR_ARCHITECTURE_UNKNOWN: WORD = 0xFFFF;
3853 pub const PF_FLOATING_POINT_PRECISION_ERRATA: DWORD = 0;
3854 pub const PF_FLOATING_POINT_EMULATED: DWORD = 1;
3855 pub const PF_COMPARE_EXCHANGE_DOUBLE: DWORD = 2;
3856 pub const PF_MMX_INSTRUCTIONS_AVAILABLE: DWORD = 3;
3857 pub const PF_PPC_MOVEMEM_64BIT_OK: DWORD = 4;
3858 pub const PF_ALPHA_BYTE_INSTRUCTIONS: DWORD = 5;
3859 pub const PF_XMMI_INSTRUCTIONS_AVAILABLE: DWORD = 6;
3860 pub const PF_3DNOW_INSTRUCTIONS_AVAILABLE: DWORD = 7;
3861 pub const PF_RDTSC_INSTRUCTION_AVAILABLE: DWORD = 8;
3862 pub const PF_PAE_ENABLED: DWORD = 9;
3863 pub const PF_XMMI64_INSTRUCTIONS_AVAILABLE: DWORD = 10;
3864 pub const PF_SSE_DAZ_MODE_AVAILABLE: DWORD = 11;
3865 pub const PF_NX_ENABLED: DWORD = 12;
3866 pub const PF_SSE3_INSTRUCTIONS_AVAILABLE: DWORD = 13;
3867 pub const PF_COMPARE_EXCHANGE128: DWORD = 14;
3868 pub const PF_COMPARE64_EXCHANGE128: DWORD = 15;
3869 pub const PF_CHANNELS_ENABLED: DWORD = 16;
3870 pub const PF_XSAVE_ENABLED: DWORD = 17;
3871 pub const PF_ARM_VFP_32_REGISTERS_AVAILABLE: DWORD = 18;
3872 pub const PF_ARM_NEON_INSTRUCTIONS_AVAILABLE: DWORD = 19;
3873 pub const PF_SECOND_LEVEL_ADDRESS_TRANSLATION: DWORD = 20;
3874 pub const PF_VIRT_FIRMWARE_ENABLED: DWORD = 21;
3875 pub const PF_RDWRFSGSBASE_AVAILABLE: DWORD = 22;
3876 pub const PF_FASTFAIL_AVAILABLE: DWORD = 23;
3877 pub const PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE: DWORD = 24;
3878 pub const PF_ARM_64BIT_LOADSTORE_ATOMIC: DWORD = 25;
3879 pub const PF_ARM_EXTERNAL_CACHE_AVAILABLE: DWORD = 26;
3880 pub const PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE: DWORD = 27;
3881 pub const PF_RDRAND_INSTRUCTION_AVAILABLE: DWORD = 28;
3882 pub const PF_ARM_V8_INSTRUCTIONS_AVAILABLE: DWORD = 29;
3883 pub const PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE: DWORD = 30;
3884 pub const PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE: DWORD = 31;
3885 pub const PF_RDTSCP_INSTRUCTION_AVAILABLE: DWORD = 32;
3886 pub const XSTATE_LEGACY_FLOATING_POINT: ULONG64 = 0;
3887 pub const XSTATE_LEGACY_SSE: ULONG64 = 1;
3888 pub const XSTATE_GSSE: ULONG64 = 2;
3889 pub const XSTATE_AVX: ULONG64 = XSTATE_GSSE;
3890 pub const XSTATE_MPX_BNDREGS: ULONG64 = 3;
3891 pub const XSTATE_MPX_BNDCSR: ULONG64 = 4;
3892 pub const XSTATE_AVX512_KMASK: ULONG64 = 5;
3893 pub const XSTATE_AVX512_ZMM_H: ULONG64 = 6;
3894 pub const XSTATE_AVX512_ZMM: ULONG64 = 7;
3895 pub const XSTATE_IPT: ULONG64 = 8;
3896 pub const XSTATE_LWP: ULONG64 = 62;
3897 pub const MAXIMUM_XSTATE_FEATURES: usize = 64;
3898 pub const XSTATE_MASK_LEGACY_FLOATING_POINT: ULONG64 = 1 << XSTATE_LEGACY_FLOATING_POINT;
3899 pub const XSTATE_MASK_LEGACY_SSE: ULONG64 = 1 << XSTATE_LEGACY_SSE;
3900 pub const XSTATE_MASK_LEGACY: ULONG64 = XSTATE_MASK_LEGACY_FLOATING_POINT | XSTATE_MASK_LEGACY_SSE;
3901 pub const XSTATE_MASK_GSSE: ULONG64 = 1 << XSTATE_GSSE;
3902 pub const XSTATE_MASK_AVX: ULONG64 = XSTATE_MASK_GSSE;
3903 pub const XSTATE_MASK_MPX: ULONG64 = (1 << XSTATE_MPX_BNDREGS) | (1 << XSTATE_MPX_BNDCSR);
3904 pub const XSTATE_MASK_AVX512: ULONG64 = (1 << XSTATE_AVX512_KMASK) | (1 << XSTATE_AVX512_ZMM_H)
3905     | (1 << XSTATE_AVX512_ZMM);
3906 pub const XSTATE_MASK_IPT: ULONG64 = 1 << XSTATE_IPT;
3907 pub const XSTATE_MASK_LWP: ULONG64 = 1 << XSTATE_LWP;
3908 pub const XSTATE_MASK_ALLOWED: ULONG64 = XSTATE_MASK_LEGACY | XSTATE_MASK_AVX | XSTATE_MASK_MPX
3909     | XSTATE_MASK_AVX512 | XSTATE_MASK_IPT | XSTATE_MASK_LWP;
3910 pub const XSTATE_MASK_PERSISTENT: ULONG64 = (1 << XSTATE_MPX_BNDCSR) | XSTATE_MASK_LWP;
3911 pub const XSTATE_COMPACTION_ENABLE: ULONG64 = 63;
3912 pub const XSTATE_COMPACTION_ENABLE_MASK: ULONG64 = 1 << XSTATE_COMPACTION_ENABLE;
3913 pub const XSTATE_ALIGN_BIT: ULONG64 = 1;
3914 pub const XSTATE_ALIGN_MASK: ULONG64 = 1 << XSTATE_ALIGN_BIT;
3915 pub const XSTATE_CONTROLFLAG_XSAVEOPT_MASK: ULONG64 = 1;
3916 pub const XSTATE_CONTROLFLAG_XSAVEC_MASK: ULONG64 = 2;
3917 pub const XSTATE_CONTROLFLAG_VALID_MASK: ULONG64 = XSTATE_CONTROLFLAG_XSAVEOPT_MASK
3918     | XSTATE_CONTROLFLAG_XSAVEC_MASK;
3919 STRUCT!{struct XSTATE_FEATURE {
3920     Offset: DWORD,
3921     Size: DWORD,
3922 }}
3923 pub type PXSTATE_FEATURE = *mut XSTATE_FEATURE;
3924 STRUCT!{struct XSTATE_CONFIGURATION {
3925     EnabledFeatures: DWORD64,
3926     EnabledVolatileFeatures: DWORD64,
3927     Size: DWORD,
3928     ControlFlags: DWORD,
3929     Features: [XSTATE_FEATURE; MAXIMUM_XSTATE_FEATURES],
3930     EnabledSupervisorFeatures: DWORD64,
3931     AlignedFeatures: DWORD64,
3932     AllFeatureSize: DWORD,
3933     AllFeatures: [DWORD; MAXIMUM_XSTATE_FEATURES],
3934 }}
3935 BITFIELD!{XSTATE_CONFIGURATION ControlFlags: DWORD [
3936     OptimizedSave set_OptimizedSave[0..1],
3937     CompactionEnabled set_CompactionEnabled[1..2],
3938 ]}
3939 pub type PXSTATE_CONFIGURATION = *mut XSTATE_CONFIGURATION;
3940 STRUCT!{struct MEMORY_BASIC_INFORMATION {
3941     BaseAddress: PVOID,
3942     AllocationBase: PVOID,
3943     AllocationProtect: DWORD,
3944     RegionSize: SIZE_T,
3945     State: DWORD,
3946     Protect: DWORD,
3947     Type: DWORD,
3948 }}
3949 pub type PMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
3950 STRUCT!{struct MEMORY_BASIC_INFORMATION32 {
3951     BaseAddress: DWORD,
3952     AllocationBase: DWORD,
3953     AllocationProtect: DWORD,
3954     RegionSize: DWORD,
3955     State: DWORD,
3956     Protect: DWORD,
3957     Type: DWORD,
3958 }}
3959 pub type PMEMORY_BASIC_INFORMATION32 = *mut MEMORY_BASIC_INFORMATION32;
3960 STRUCT!{struct MEMORY_BASIC_INFORMATION64 { // FIXME: align 16
3961     BaseAddress: ULONGLONG,
3962     AllocationBase: ULONGLONG,
3963     AllocationProtect: DWORD,
3964     __alignment1: DWORD,
3965     RegionSize: ULONGLONG,
3966     State: DWORD,
3967     Protect: DWORD,
3968     Type: DWORD,
3969     __alignment2: DWORD,
3970 }}
3971 pub type PMEMORY_BASIC_INFORMATION64 = *mut MEMORY_BASIC_INFORMATION64;
3972 pub const CFG_CALL_TARGET_VALID: ULONG_PTR = 0x00000001;
3973 pub const CFG_CALL_TARGET_PROCESSED: ULONG_PTR = 0x00000002;
3974 pub const CFG_CALL_TARGET_CONVERT_EXPORT_SUPPRESSED_TO_VALID: ULONG_PTR = 0x00000004;
3975 STRUCT!{struct CFG_CALL_TARGET_INFO {
3976     Offset: ULONG_PTR,
3977     Flags: ULONG_PTR,
3978 }}
3979 pub type PCFG_CALL_TARGET_INFO = *mut CFG_CALL_TARGET_INFO;
3980 pub const SECTION_QUERY: DWORD = 0x0001;
3981 pub const SECTION_MAP_WRITE: DWORD = 0x0002;
3982 pub const SECTION_MAP_READ: DWORD = 0x0004;
3983 pub const SECTION_MAP_EXECUTE: DWORD = 0x0008;
3984 pub const SECTION_EXTEND_SIZE: DWORD = 0x0010;
3985 pub const SECTION_MAP_EXECUTE_EXPLICIT: DWORD = 0x0020;
3986 pub const SECTION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SECTION_QUERY
3987     | SECTION_MAP_WRITE | SECTION_MAP_READ | SECTION_MAP_EXECUTE | SECTION_EXTEND_SIZE;
3988 pub const SESSION_QUERY_ACCESS: DWORD = 0x0001;
3989 pub const SESSION_MODIFY_ACCESS: DWORD = 0x0002;
3990 pub const SESSION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SESSION_QUERY_ACCESS
3991     | SESSION_MODIFY_ACCESS;
3992 pub const MEMORY_PARTITION_QUERY_ACCESS: DWORD = 0x0001;
3993 pub const MEMORY_PARTITION_MODIFY_ACCESS: DWORD = 0x0002;
3994 pub const MEMORY_PARTITION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE
3995     | MEMORY_PARTITION_QUERY_ACCESS | MEMORY_PARTITION_MODIFY_ACCESS;
3996 pub const PAGE_NOACCESS: DWORD = 0x01;
3997 pub const PAGE_READONLY: DWORD = 0x02;
3998 pub const PAGE_READWRITE: DWORD = 0x04;
3999 pub const PAGE_WRITECOPY: DWORD = 0x08;
4000 pub const PAGE_EXECUTE: DWORD = 0x10;
4001 pub const PAGE_EXECUTE_READ: DWORD = 0x20;
4002 pub const PAGE_EXECUTE_READWRITE: DWORD = 0x40;
4003 pub const PAGE_EXECUTE_WRITECOPY: DWORD = 0x80;
4004 pub const PAGE_GUARD: DWORD = 0x100;
4005 pub const PAGE_NOCACHE: DWORD = 0x200;
4006 pub const PAGE_WRITECOMBINE: DWORD = 0x400;
4007 pub const PAGE_ENCLAVE_THREAD_CONTROL: DWORD = 0x80000000;
4008 pub const PAGE_REVERT_TO_FILE_MAP: DWORD = 0x80000000;
4009 pub const PAGE_TARGETS_NO_UPDATE: DWORD = 0x40000000;
4010 pub const PAGE_TARGETS_INVALID: DWORD = 0x40000000;
4011 pub const PAGE_ENCLAVE_UNVALIDATED: DWORD = 0x20000000;
4012 pub const PAGE_ENCLAVE_DECOMMIT: DWORD = 0x10000000;
4013 pub const MEM_COMMIT: DWORD = 0x1000;
4014 pub const MEM_RESERVE: DWORD = 0x2000;
4015 pub const MEM_DECOMMIT: DWORD = 0x4000;
4016 pub const MEM_RELEASE: DWORD = 0x8000;
4017 pub const MEM_FREE: DWORD = 0x10000;
4018 pub const MEM_PRIVATE: DWORD = 0x20000;
4019 pub const MEM_MAPPED: DWORD = 0x40000;
4020 pub const MEM_RESET: DWORD = 0x80000;
4021 pub const MEM_TOP_DOWN: DWORD = 0x100000;
4022 pub const MEM_WRITE_WATCH: DWORD = 0x200000;
4023 pub const MEM_PHYSICAL: DWORD = 0x400000;
4024 pub const MEM_ROTATE: DWORD = 0x800000;
4025 pub const MEM_DIFFERENT_IMAGE_BASE_OK: DWORD = 0x800000;
4026 pub const MEM_RESET_UNDO: DWORD = 0x1000000;
4027 pub const MEM_LARGE_PAGES: DWORD = 0x20000000;
4028 pub const MEM_4MB_PAGES: DWORD = 0x80000000;
4029 pub const MEM_64K_PAGES: DWORD = MEM_LARGE_PAGES | MEM_PHYSICAL;
4030 pub const SEC_64K_PAGES: DWORD = 0x00080000;
4031 pub const SEC_FILE: DWORD = 0x800000;
4032 pub const SEC_IMAGE: DWORD = 0x1000000;
4033 pub const SEC_PROTECTED_IMAGE: DWORD = 0x2000000;
4034 pub const SEC_RESERVE: DWORD = 0x4000000;
4035 pub const SEC_COMMIT: DWORD = 0x8000000;
4036 pub const SEC_NOCACHE: DWORD = 0x10000000;
4037 pub const SEC_WRITECOMBINE: DWORD = 0x40000000;
4038 pub const SEC_LARGE_PAGES: DWORD = 0x80000000;
4039 pub const SEC_IMAGE_NO_EXECUTE: DWORD = SEC_IMAGE | SEC_NOCACHE;
4040 pub const MEM_IMAGE: DWORD = SEC_IMAGE;
4041 pub const WRITE_WATCH_FLAG_RESET: DWORD = 0x01;
4042 pub const MEM_UNMAP_WITH_TRANSIENT_BOOST: DWORD = 0x01;
4043 pub const ENCLAVE_TYPE_SGX: DWORD = 0x00000001;
4044 pub const ENCLAVE_TYPE_SGX2: DWORD = 0x00000002;
4045 STRUCT!{struct ENCLAVE_CREATE_INFO_SGX {
4046     Secs: [BYTE; 4096],
4047 }}
4048 pub type PENCLAVE_CREATE_INFO_SGX = *mut ENCLAVE_CREATE_INFO_SGX;
4049 STRUCT!{struct ENCLAVE_INIT_INFO_SGX {
4050     SigStruct: [BYTE; 1808],
4051     Reserved1: [BYTE; 240],
4052     EInitToken: [BYTE; 304],
4053     Reserved2: [BYTE; 1744],
4054 }}
4055 pub type PENCLAVE_INIT_INFO_SGX = *mut ENCLAVE_INIT_INFO_SGX;
4056 pub const FILE_READ_DATA: DWORD = 0x0001;
4057 pub const FILE_LIST_DIRECTORY: DWORD = 0x0001;
4058 pub const FILE_WRITE_DATA: DWORD = 0x0002;
4059 pub const FILE_ADD_FILE: DWORD = 0x0002;
4060 pub const FILE_APPEND_DATA: DWORD = 0x0004;
4061 pub const FILE_ADD_SUBDIRECTORY: DWORD = 0x0004;
4062 pub const FILE_CREATE_PIPE_INSTANCE: DWORD = 0x0004;
4063 pub const FILE_READ_EA: DWORD = 0x0008;
4064 pub const FILE_WRITE_EA: DWORD = 0x0010;
4065 pub const FILE_EXECUTE: DWORD = 0x0020;
4066 pub const FILE_TRAVERSE: DWORD = 0x0020;
4067 pub const FILE_DELETE_CHILD: DWORD = 0x0040;
4068 pub const FILE_READ_ATTRIBUTES: DWORD = 0x0080;
4069 pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x0100;
4070 pub const FILE_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF;
4071 pub const FILE_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | FILE_READ_DATA
4072     | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE;
4073 pub const FILE_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA
4074     | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE;
4075 pub const FILE_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES
4076     | FILE_EXECUTE | SYNCHRONIZE;
4077 pub const FILE_SHARE_READ: DWORD = 0x00000001;
4078 pub const FILE_SHARE_WRITE: DWORD = 0x00000002;
4079 pub const FILE_SHARE_DELETE: DWORD = 0x00000004;
4080 pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x00000001;
4081 pub const FILE_ATTRIBUTE_HIDDEN: DWORD = 0x00000002;
4082 pub const FILE_ATTRIBUTE_SYSTEM: DWORD = 0x00000004;
4083 pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x00000010;
4084 pub const FILE_ATTRIBUTE_ARCHIVE: DWORD = 0x00000020;
4085 pub const FILE_ATTRIBUTE_DEVICE: DWORD = 0x00000040;
4086 pub const FILE_ATTRIBUTE_NORMAL: DWORD = 0x00000080;
4087 pub const FILE_ATTRIBUTE_TEMPORARY: DWORD = 0x00000100;
4088 pub const FILE_ATTRIBUTE_SPARSE_FILE: DWORD = 0x00000200;
4089 pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x00000400;
4090 pub const FILE_ATTRIBUTE_COMPRESSED: DWORD = 0x00000800;
4091 pub const FILE_ATTRIBUTE_OFFLINE: DWORD = 0x00001000;
4092 pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: DWORD = 0x00002000;
4093 pub const FILE_ATTRIBUTE_ENCRYPTED: DWORD = 0x00004000;
4094 pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: DWORD = 0x00008000;
4095 pub const FILE_ATTRIBUTE_VIRTUAL: DWORD = 0x00010000;
4096 pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: DWORD = 0x00020000;
4097 pub const FILE_ATTRIBUTE_EA: DWORD = 0x00040000;
4098 pub const FILE_ATTRIBUTE_PINNED: DWORD = 0x00080000;
4099 pub const FILE_ATTRIBUTE_UNPINNED: DWORD = 0x00100000;
4100 pub const FILE_ATTRIBUTE_RECALL_ON_OPEN: DWORD = 0x00040000;
4101 pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS: DWORD = 0x00400000;
4102 pub const FILE_NOTIFY_CHANGE_FILE_NAME: DWORD = 0x00000001;
4103 pub const FILE_NOTIFY_CHANGE_DIR_NAME: DWORD = 0x00000002;
4104 pub const FILE_NOTIFY_CHANGE_ATTRIBUTES: DWORD = 0x00000004;
4105 pub const FILE_NOTIFY_CHANGE_SIZE: DWORD = 0x00000008;
4106 pub const FILE_NOTIFY_CHANGE_LAST_WRITE: DWORD = 0x00000010;
4107 pub const FILE_NOTIFY_CHANGE_LAST_ACCESS: DWORD = 0x00000020;
4108 pub const FILE_NOTIFY_CHANGE_CREATION: DWORD = 0x00000040;
4109 pub const FILE_NOTIFY_CHANGE_SECURITY: DWORD = 0x00000100;
4110 pub const FILE_ACTION_ADDED: DWORD = 0x00000001;
4111 pub const FILE_ACTION_REMOVED: DWORD = 0x00000002;
4112 pub const FILE_ACTION_MODIFIED: DWORD = 0x00000003;
4113 pub const FILE_ACTION_RENAMED_OLD_NAME: DWORD = 0x00000004;
4114 pub const FILE_ACTION_RENAMED_NEW_NAME: DWORD = 0x00000005;
4115 pub const MAILSLOT_NO_MESSAGE: DWORD = 0xFFFFFFFF;
4116 pub const MAILSLOT_WAIT_FOREVER: DWORD = 0xFFFFFFFF;
4117 pub const FILE_CASE_SENSITIVE_SEARCH: DWORD = 0x00000001;
4118 pub const FILE_CASE_PRESERVED_NAMES: DWORD = 0x00000002;
4119 pub const FILE_UNICODE_ON_DISK: DWORD = 0x00000004;
4120 pub const FILE_PERSISTENT_ACLS: DWORD = 0x00000008;
4121 pub const FILE_FILE_COMPRESSION: DWORD = 0x00000010;
4122 pub const FILE_VOLUME_QUOTAS: DWORD = 0x00000020;
4123 pub const FILE_SUPPORTS_SPARSE_FILES: DWORD = 0x00000040;
4124 pub const FILE_SUPPORTS_REPARSE_POINTS: DWORD = 0x00000080;
4125 pub const FILE_SUPPORTS_REMOTE_STORAGE: DWORD = 0x00000100;
4126 pub const FILE_RETURNS_CLEANUP_RESULT_INFO: DWORD = 0x00000200;
4127 pub const FILE_VOLUME_IS_COMPRESSED: DWORD = 0x00008000;
4128 pub const FILE_SUPPORTS_OBJECT_IDS: DWORD = 0x00010000;
4129 pub const FILE_SUPPORTS_ENCRYPTION: DWORD = 0x00020000;
4130 pub const FILE_NAMED_STREAMS: DWORD = 0x00040000;
4131 pub const FILE_READ_ONLY_VOLUME: DWORD = 0x00080000;
4132 pub const FILE_SEQUENTIAL_WRITE_ONCE: DWORD = 0x00100000;
4133 pub const FILE_SUPPORTS_TRANSACTIONS: DWORD = 0x00200000;
4134 pub const FILE_SUPPORTS_HARD_LINKS: DWORD = 0x00400000;
4135 pub const FILE_SUPPORTS_EXTENDED_ATTRIBUTES: DWORD = 0x00800000;
4136 pub const FILE_SUPPORTS_OPEN_BY_FILE_ID: DWORD = 0x01000000;
4137 pub const FILE_SUPPORTS_USN_JOURNAL: DWORD = 0x02000000;
4138 pub const FILE_SUPPORTS_INTEGRITY_STREAMS: DWORD = 0x04000000;
4139 pub const FILE_SUPPORTS_BLOCK_REFCOUNTING: DWORD = 0x08000000;
4140 pub const FILE_SUPPORTS_SPARSE_VDL: DWORD = 0x10000000;
4141 pub const FILE_DAX_VOLUME: DWORD = 0x20000000;
4142 pub const FILE_SUPPORTS_GHOSTING: DWORD = 0x40000000;
4143 pub const FILE_INVALID_FILE_ID: LONGLONG = -1;
4144 STRUCT!{struct FILE_ID_128 {
4145     Identifier: [BYTE; 16],
4146 }}
4147 pub type PFILE_ID_128 = *mut FILE_ID_128;
4148 STRUCT!{struct FILE_NOTIFY_INFORMATION {
4149     NextEntryOffset: DWORD,
4150     Action: DWORD,
4151     FileNameLength: DWORD,
4152     FileName: [WCHAR; 1],
4153 }}
4154 UNION!{union FILE_SEGMENT_ELEMENT {
4155     [u64; 1],
4156     Buffer Buffer_mut: PVOID64,
4157     Alignment Alignment_mut: ULONGLONG,
4158 }}
4159 pub type PFILE_SEGMENT_ELEMENT = *mut FILE_SEGMENT_ELEMENT;
4160 pub const FLUSH_FLAGS_FILE_DATA_ONLY: ULONG = 0x00000001;
4161 pub const FLUSH_FLAGS_NO_SYNC: ULONG = 0x00000002;
4162 pub const FLUSH_FLAGS_FILE_DATA_SYNC_ONLY: ULONG = 0x00000004;
4163 STRUCT!{struct REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer {
4164     DataBuffer: [BYTE; 1],
4165 }}
4166 STRUCT!{struct REPARSE_GUID_DATA_BUFFER {
4167     ReparseTag: DWORD,
4168     ReparseDataLength: WORD,
4169     Reserved: WORD,
4170     ReparseGuid: GUID,
4171     GenericReparseBuffer: REPARSE_GUID_DATA_BUFFER_GenericReparseBuffer,
4172 }}
4173 pub type PREPARSE_GUID_DATA_BUFFER = *mut REPARSE_GUID_DATA_BUFFER;
4174 pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: DWORD = 16 * 1024;
4175 pub const IO_REPARSE_TAG_RESERVED_ZERO: DWORD = 0;
4176 pub const IO_REPARSE_TAG_RESERVED_ONE: DWORD = 1;
4177 pub const IO_REPARSE_TAG_RESERVED_TWO: DWORD = 2;
4178 pub const IO_REPARSE_TAG_RESERVED_RANGE: DWORD = IO_REPARSE_TAG_RESERVED_TWO;
4179 #[inline]
IsReparseTagMicrosoft(_tag: DWORD) -> bool4180 pub fn IsReparseTagMicrosoft(_tag: DWORD) -> bool {
4181     (_tag & 0x80000000) != 0
4182 }
4183 #[inline]
IsReparseTagNameSurrogate(_tag: DWORD) -> bool4184 pub fn IsReparseTagNameSurrogate(_tag: DWORD) -> bool {
4185     (_tag & 0x20000000) != 0
4186 }
4187 #[inline]
IsReparseTagDirectory(_tag: DWORD) -> bool4188 pub fn IsReparseTagDirectory(_tag: DWORD) -> bool {
4189     (_tag & 0x10000000) != 0
4190 }
4191 pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xA0000003;
4192 pub const IO_REPARSE_TAG_HSM: DWORD = 0xC0000004;
4193 pub const IO_REPARSE_TAG_HSM2: DWORD = 0x80000006;
4194 pub const IO_REPARSE_TAG_SIS: DWORD = 0x80000007;
4195 pub const IO_REPARSE_TAG_WIM: DWORD = 0x80000008;
4196 pub const IO_REPARSE_TAG_CSV: DWORD = 0x80000009;
4197 pub const IO_REPARSE_TAG_DFS: DWORD = 0x8000000A;
4198 pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xA000000C;
4199 pub const IO_REPARSE_TAG_DFSR: DWORD = 0x80000012;
4200 pub const IO_REPARSE_TAG_DEDUP: DWORD = 0x80000013;
4201 pub const IO_REPARSE_TAG_NFS: DWORD = 0x80000014;
4202 pub const IO_REPARSE_TAG_FILE_PLACEHOLDER: DWORD = 0x80000015;
4203 pub const IO_REPARSE_TAG_WOF: DWORD = 0x80000017;
4204 pub const IO_REPARSE_TAG_WCI: DWORD = 0x80000018;
4205 pub const IO_REPARSE_TAG_GLOBAL_REPARSE: DWORD = 0xA0000019;
4206 pub const IO_REPARSE_TAG_CLOUD: DWORD = 0x9000001A;
4207 pub const IO_REPARSE_TAG_CLOUD_ROOT: DWORD = 0x9000101A;
4208 pub const IO_REPARSE_TAG_CLOUD_ON_DEMAND: DWORD = 0x9000201A;
4209 pub const IO_REPARSE_TAG_CLOUD_ROOT_ON_DEMAND: DWORD = 0x9000301A;
4210 pub const IO_REPARSE_TAG_APPEXECLINK: DWORD = 0x8000001B;
4211 pub const IO_REPARSE_TAG_GVFS: DWORD = 0x9000001C;
4212 pub const IO_REPARSE_TAG_WCI_TOMBSTONE: DWORD = 0xA000001F;
4213 pub const IO_REPARSE_TAG_UNHANDLED: DWORD = 0x80000020;
4214 pub const IO_REPARSE_TAG_ONEDRIVE: DWORD = 0x80000021;
4215 pub const IO_REPARSE_TAG_GVFS_TOMBSTONE: DWORD = 0xA0000022;
4216 pub const SCRUB_DATA_INPUT_FLAG_RESUME: DWORD = 0x00000001;
4217 pub const SCRUB_DATA_INPUT_FLAG_SKIP_IN_SYNC: DWORD = 0x00000002;
4218 pub const SCRUB_DATA_INPUT_FLAG_SKIP_NON_INTEGRITY_DATA: DWORD = 0x00000004;
4219 pub const SCRUB_DATA_OUTPUT_FLAG_INCOMPLETE: DWORD = 0x00000001;
4220 pub const SCRUB_DATA_OUTPUT_FLAG_NON_USER_DATA_RANGE: DWORD = 0x00010000;
4221 pub const SCRUB_DATA_OUTPUT_FLAG_PARITY_EXTENT_DATA_RETURNED: DWORD = 0x00020000;
4222 pub const SCRUB_DATA_OUTPUT_FLAG_RESUME_CONTEXT_LENGTH_SPECIFIED: DWORD = 0x00040000;
4223 STRUCT!{struct SCRUB_DATA_INPUT {
4224     Size: DWORD,
4225     Flags: DWORD,
4226     MaximumIos: DWORD,
4227     Reserved: [DWORD; 17],
4228     ResumeContext: [BYTE; 816],
4229 }}
4230 pub type PSCRUB_DATA_INPUT = *mut SCRUB_DATA_INPUT;
4231 STRUCT!{struct SCRUB_PARITY_EXTENT {
4232     Offset: LONGLONG,
4233     Length: ULONGLONG,
4234 }}
4235 pub type PSCRUB_PARITY_EXTENT = *mut SCRUB_PARITY_EXTENT;
4236 STRUCT!{struct SCRUB_PARITY_EXTENT_DATA {
4237     Size: WORD,
4238     Flags: WORD,
4239     NumberOfParityExtents: WORD,
4240     MaximumNumberOfParityExtents: WORD,
4241     ParityExtents: [SCRUB_PARITY_EXTENT; ANYSIZE_ARRAY],
4242 }}
4243 pub type PSCRUB_PARITY_EXTENT_DATA = *mut SCRUB_PARITY_EXTENT_DATA;
4244 STRUCT!{struct SCRUB_DATA_OUTPUT {
4245     Size: DWORD,
4246     Flags: DWORD,
4247     Status: DWORD,
4248     ErrorFileOffset: ULONGLONG,
4249     ErrorLength: ULONGLONG,
4250     NumberOfBytesRepaired: ULONGLONG,
4251     NumberOfBytesFailed: ULONGLONG,
4252     InternalFileReference: ULONGLONG,
4253     ResumeContextLength: WORD,
4254     ParityExtentDataOffset: WORD,
4255     Reserved: [DWORD; 5],
4256     ResumeContext: [BYTE; 816],
4257 }}
4258 pub type PSCRUB_DATA_OUTPUT = *mut SCRUB_DATA_OUTPUT;
4259 ENUM!{enum SharedVirtualDiskSupportType {
4260     SharedVirtualDisksUnsupported = 0,
4261     SharedVirtualDisksSupported = 1,
4262     SharedVirtualDiskSnapshotsSupported = 3,
4263     SharedVirtualDiskCDPSnapshotsSupported = 7,
4264 }}
4265 ENUM!{enum SharedVirtualDiskHandleState {
4266     SharedVirtualDiskHandleStateNone = 0,
4267     SharedVirtualDiskHandleStateFileShared = 1,
4268     SharedVirtualDiskHandleStateHandleShared = 3,
4269 }}
4270 STRUCT!{struct SHARED_VIRTUAL_DISK_SUPPORT {
4271     SharedVirtualDiskSupport: SharedVirtualDiskSupportType,
4272     HandleState: SharedVirtualDiskHandleState,
4273 }}
4274 pub type PSHARED_VIRTUAL_DISK_SUPPORT = *mut SHARED_VIRTUAL_DISK_SUPPORT;
4275 #[inline]
IsVirtualDiskFileShared(HandleState: SharedVirtualDiskHandleState) -> bool4276 pub fn IsVirtualDiskFileShared(HandleState: SharedVirtualDiskHandleState) -> bool {
4277     (HandleState & SharedVirtualDiskHandleStateFileShared) != 0
4278 }
4279 pub const IO_COMPLETION_MODIFY_STATE: DWORD = 0x0002;
4280 pub const IO_COMPLETION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x3;
4281 pub const IO_QOS_MAX_RESERVATION: DWORD64 = 1000000000;
4282 pub const SMB_CCF_APP_INSTANCE_EA_NAME: &'static str = "ClusteredApplicationInstance";
4283 pub const NETWORK_APP_INSTANCE_CSV_FLAGS_VALID_ONLY_IF_CSV_COORDINATOR: DWORD = 0x00000001;
4284 STRUCT!{struct NETWORK_APP_INSTANCE_EA {
4285     AppInstanceID: GUID,
4286     CsvFlags: DWORD,
4287 }}
4288 pub type PNETWORK_APP_INSTANCE_EA = *mut NETWORK_APP_INSTANCE_EA;
4289 pub const DUPLICATE_CLOSE_SOURCE: DWORD = 0x00000001;
4290 pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002;
4291 DEFINE_GUID!{GUID_MAX_POWER_SAVINGS,
4292     0xa1841308, 0x3541, 0x4fab, 0xbc, 0x81, 0xf7, 0x15, 0x56, 0xf2, 0x0b, 0x4a}
4293 DEFINE_GUID!{GUID_MIN_POWER_SAVINGS,
4294     0x8c5e7fda, 0xe8bf, 0x4a96, 0x9a, 0x85, 0xa6, 0xe2, 0x3a, 0x8c, 0x63, 0x5c}
4295 DEFINE_GUID!{GUID_TYPICAL_POWER_SAVINGS,
4296     0x381b4222, 0xf694, 0x41f0, 0x96, 0x85, 0xff, 0x5b, 0xb2, 0x60, 0xdf, 0x2e}
4297 DEFINE_GUID!{NO_SUBGROUP_GUID,
4298     0xfea3413e, 0x7e05, 0x4911, 0x9a, 0x71, 0x70, 0x03, 0x31, 0xf1, 0xc2, 0x94}
4299 DEFINE_GUID!{ALL_POWERSCHEMES_GUID,
4300     0x68a1e95e, 0x13ea, 0x41e1, 0x80, 0x11, 0x0c, 0x49, 0x6c, 0xa4, 0x90, 0xb0}
4301 DEFINE_GUID!{GUID_POWERSCHEME_PERSONALITY,
4302     0x245d8541, 0x3943, 0x4422, 0xb0, 0x25, 0x13, 0xa7, 0x84, 0xf6, 0x79, 0xb7}
4303 DEFINE_GUID!{GUID_ACTIVE_POWERSCHEME,
4304     0x31f9f286, 0x5084, 0x42fe, 0xb7, 0x20, 0x2b, 0x02, 0x64, 0x99, 0x37, 0x63}
4305 DEFINE_GUID!{GUID_IDLE_RESILIENCY_SUBGROUP,
4306     0x2e601130, 0x5351, 0x4d9d, 0x8e, 0x4, 0x25, 0x29, 0x66, 0xba, 0xd0, 0x54}
4307 DEFINE_GUID!{GUID_IDLE_RESILIENCY_PERIOD,
4308     0xc42b79aa, 0xaa3a, 0x484b, 0xa9, 0x8f, 0x2c, 0xf3, 0x2a, 0xa9, 0xa, 0x28}
4309 DEFINE_GUID!{GUID_DEEP_SLEEP_ENABLED,
4310     0xd502f7ee, 0x1dc7, 0x4efd, 0xa5, 0x5d, 0xf0, 0x4b, 0x6f, 0x5c, 0x5, 0x45}
4311 DEFINE_GUID!{GUID_DEEP_SLEEP_PLATFORM_STATE,
4312     0xd23f2fb8, 0x9536, 0x4038, 0x9c, 0x94, 0x1c, 0xe0, 0x2e, 0x5c, 0x21, 0x52}
4313 DEFINE_GUID!{GUID_DISK_COALESCING_POWERDOWN_TIMEOUT,
4314     0xc36f0eb4, 0x2988, 0x4a70, 0x8e, 0xee, 0x8, 0x84, 0xfc, 0x2c, 0x24, 0x33}
4315 DEFINE_GUID!{GUID_EXECUTION_REQUIRED_REQUEST_TIMEOUT,
4316     0x3166bc41, 0x7e98, 0x4e03, 0xb3, 0x4e, 0xec, 0xf, 0x5f, 0x2b, 0x21, 0x8e}
4317 DEFINE_GUID!{GUID_VIDEO_SUBGROUP,
4318     0x7516b95f, 0xf776, 0x4464, 0x8c, 0x53, 0x06, 0x16, 0x7f, 0x40, 0xcc, 0x99}
4319 DEFINE_GUID!{GUID_VIDEO_POWERDOWN_TIMEOUT,
4320     0x3c0bc021, 0xc8a8, 0x4e07, 0xa9, 0x73, 0x6b, 0x14, 0xcb, 0xcb, 0x2b, 0x7e}
4321 DEFINE_GUID!{GUID_VIDEO_ANNOYANCE_TIMEOUT,
4322     0x82dbcf2d, 0xcd67, 0x40c5, 0xbf, 0xdc, 0x9f, 0x1a, 0x5c, 0xcd, 0x46, 0x63}
4323 DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_PERCENT_INCREASE,
4324     0xeed904df, 0xb142, 0x4183, 0xb1, 0x0b, 0x5a, 0x11, 0x97, 0xa3, 0x78, 0x64}
4325 DEFINE_GUID!{GUID_VIDEO_DIM_TIMEOUT,
4326     0x17aaa29b, 0x8b43, 0x4b94, 0xaa, 0xfe, 0x35, 0xf6, 0x4d, 0xaa, 0xf1, 0xee}
4327 DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_POWERDOWN,
4328     0x90959d22, 0xd6a1, 0x49b9, 0xaf, 0x93, 0xbc, 0xe8, 0x85, 0xad, 0x33, 0x5b}
4329 DEFINE_GUID!{GUID_MONITOR_POWER_ON,
4330     0x02731015, 0x4510, 0x4526, 0x99, 0xe6, 0xe5, 0xa1, 0x7e, 0xbd, 0x1a, 0xea}
4331 DEFINE_GUID!{GUID_DEVICE_POWER_POLICY_VIDEO_BRIGHTNESS,
4332     0xaded5e82, 0xb909, 0x4619, 0x99, 0x49, 0xf5, 0xd7, 0x1d, 0xac, 0x0b, 0xcb}
4333 DEFINE_GUID!{GUID_DEVICE_POWER_POLICY_VIDEO_DIM_BRIGHTNESS,
4334     0xf1fbfde2, 0xa960, 0x4165, 0x9f, 0x88, 0x50, 0x66, 0x79, 0x11, 0xce, 0x96}
4335 DEFINE_GUID!{GUID_VIDEO_CURRENT_MONITOR_BRIGHTNESS,
4336     0x8ffee2c6, 0x2d01, 0x46be, 0xad, 0xb9, 0x39, 0x8a, 0xdd, 0xc5, 0xb4, 0xff}
4337 DEFINE_GUID!{GUID_VIDEO_ADAPTIVE_DISPLAY_BRIGHTNESS,
4338     0xfbd9aa66, 0x9553, 0x4097, 0xba, 0x44, 0xed, 0x6e, 0x9d, 0x65, 0xea, 0xb8}
4339 DEFINE_GUID!{GUID_CONSOLE_DISPLAY_STATE,
4340     0x6fe69556, 0x704a, 0x47a0, 0x8f, 0x24, 0xc2, 0x8d, 0x93, 0x6f, 0xda, 0x47}
4341 DEFINE_GUID!{GUID_ALLOW_DISPLAY_REQUIRED,
4342     0xa9ceb8da, 0xcd46, 0x44fb, 0xa9, 0x8b, 0x02, 0xaf, 0x69, 0xde, 0x46, 0x23}
4343 DEFINE_GUID!{GUID_VIDEO_CONSOLE_LOCK_TIMEOUT,
4344     0x8ec4b3a5, 0x6868, 0x48c2, 0xbe, 0x75, 0x4f, 0x30, 0x44, 0xbe, 0x88, 0xa7}
4345 DEFINE_GUID!{GUID_ADAPTIVE_POWER_BEHAVIOR_SUBGROUP,
4346     0x8619b916, 0xe004, 0x4dd8, 0x9b, 0x66, 0xda, 0xe8, 0x6f, 0x80, 0x66, 0x98}
4347 DEFINE_GUID!{GUID_NON_ADAPTIVE_INPUT_TIMEOUT,
4348     0x5adbbfbc, 0x74e, 0x4da1, 0xba, 0x38, 0xdb, 0x8b, 0x36, 0xb2, 0xc8, 0xf3}
4349 DEFINE_GUID!{GUID_ADAPTIVE_INPUT_CONTROLLER_STATE,
4350     0xe98fae9, 0xf45a, 0x4de1, 0xa7, 0x57, 0x60, 0x31, 0xf1, 0x97, 0xf6, 0xea}
4351 DEFINE_GUID!{GUID_DISK_SUBGROUP,
4352     0x0012ee47, 0x9041, 0x4b5d, 0x9b, 0x77, 0x53, 0x5f, 0xba, 0x8b, 0x14, 0x42}
4353 DEFINE_GUID!{GUID_DISK_MAX_POWER,
4354     0x51dea550, 0xbb38, 0x4bc4, 0x99, 0x1b, 0xea, 0xcf, 0x37, 0xbe, 0x5e, 0xc8}
4355 DEFINE_GUID!{GUID_DISK_POWERDOWN_TIMEOUT,
4356     0x6738e2c4, 0xe8a5, 0x4a42, 0xb1, 0x6a, 0xe0, 0x40, 0xe7, 0x69, 0x75, 0x6e}
4357 DEFINE_GUID!{GUID_DISK_IDLE_TIMEOUT,
4358     0x58e39ba8, 0xb8e6, 0x4ef6, 0x90, 0xd0, 0x89, 0xae, 0x32, 0xb2, 0x58, 0xd6}
4359 DEFINE_GUID!{GUID_DISK_BURST_IGNORE_THRESHOLD,
4360     0x80e3c60e, 0xbb94, 0x4ad8, 0xbb, 0xe0, 0x0d, 0x31, 0x95, 0xef, 0xc6, 0x63}
4361 DEFINE_GUID!{GUID_DISK_ADAPTIVE_POWERDOWN,
4362     0x396a32e1, 0x499a, 0x40b2, 0x91, 0x24, 0xa9, 0x6a, 0xfe, 0x70, 0x76, 0x67}
4363 DEFINE_GUID!{GUID_SLEEP_SUBGROUP,
4364     0x238c9fa8, 0x0aad, 0x41ed, 0x83, 0xf4, 0x97, 0xbe, 0x24, 0x2c, 0x8f, 0x20}
4365 DEFINE_GUID!{GUID_SLEEP_IDLE_THRESHOLD,
4366     0x81cd32e0, 0x7833, 0x44f3, 0x87, 0x37, 0x70, 0x81, 0xf3, 0x8d, 0x1f, 0x70}
4367 DEFINE_GUID!{GUID_STANDBY_TIMEOUT,
4368     0x29f6c1db, 0x86da, 0x48c5, 0x9f, 0xdb, 0xf2, 0xb6, 0x7b, 0x1f, 0x44, 0xda}
4369 DEFINE_GUID!{GUID_UNATTEND_SLEEP_TIMEOUT,
4370     0x7bc4a2f9, 0xd8fc, 0x4469, 0xb0, 0x7b, 0x33, 0xeb, 0x78, 0x5a, 0xac, 0xa0}
4371 DEFINE_GUID!{GUID_HIBERNATE_TIMEOUT,
4372     0x9d7815a6, 0x7ee4, 0x497e, 0x88, 0x88, 0x51, 0x5a, 0x05, 0xf0, 0x23, 0x64}
4373 DEFINE_GUID!{GUID_HIBERNATE_FASTS4_POLICY,
4374     0x94ac6d29, 0x73ce, 0x41a6, 0x80, 0x9f, 0x63, 0x63, 0xba, 0x21, 0xb4, 0x7e}
4375 DEFINE_GUID!{GUID_CRITICAL_POWER_TRANSITION,
4376     0xb7a27025, 0xe569, 0x46c2, 0xa5, 0x04, 0x2b, 0x96, 0xca, 0xd2, 0x25, 0xa1}
4377 DEFINE_GUID!{GUID_SYSTEM_AWAYMODE,
4378     0x98a7f580, 0x01f7, 0x48aa, 0x9c, 0x0f, 0x44, 0x35, 0x2c, 0x29, 0xe5, 0xc0}
4379 DEFINE_GUID!{GUID_ALLOW_AWAYMODE,
4380     0x25dfa149, 0x5dd1, 0x4736, 0xb5, 0xab, 0xe8, 0xa3, 0x7b, 0x5b, 0x81, 0x87}
4381 DEFINE_GUID!{GUID_USER_PRESENCE_PREDICTION,
4382     0x82011705, 0xfb95, 0x4d46, 0x8d, 0x35, 0x40, 0x42, 0xb1, 0xd2, 0xd, 0xef}
4383 DEFINE_GUID!{GUID_STANDBY_BUDGET_GRACE_PERIOD,
4384     0x60c07fe1, 0x0556, 0x45cf, 0x99, 0x03, 0xd5, 0x6e, 0x32, 0x21, 0x2, 0x42}
4385 DEFINE_GUID!{GUID_STANDBY_BUDGET_PERCENT,
4386     0x9fe527be, 0x1b70, 0x48da, 0x93, 0x0d, 0x7b, 0xcf, 0x17, 0xb4, 0x49, 0x90}
4387 DEFINE_GUID!{GUID_STANDBY_RESERVE_GRACE_PERIOD,
4388     0xc763ee92, 0x71e8, 0x4127, 0x84, 0xeb, 0xf6, 0xed, 0x04, 0x3a, 0x3e, 0x3d}
4389 DEFINE_GUID!{GUID_STANDBY_RESERVE_TIME,
4390     0x468fe7e5, 0x1158, 0x46ec, 0x88, 0xbc, 0x5b, 0x96, 0xc9, 0xe4, 0x4f, 0xd0}
4391 DEFINE_GUID!{GUID_STANDBY_RESET_PERCENT,
4392     0x49cb11a5, 0x56e2, 0x4afb, 0x9d, 0x38, 0x3d, 0xf4, 0x78, 0x72, 0xe2, 0x1b}
4393 DEFINE_GUID!{GUID_ALLOW_STANDBY_STATES,
4394     0xabfc2519, 0x3608, 0x4c2a, 0x94, 0xea, 0x17, 0x1b, 0x0e, 0xd5, 0x46, 0xab}
4395 DEFINE_GUID!{GUID_ALLOW_RTC_WAKE,
4396     0xbd3b718a, 0x0680, 0x4d9d, 0x8a, 0xb2, 0xe1, 0xd2, 0xb4, 0xac, 0x80, 0x6d}
4397 DEFINE_GUID!{GUID_ALLOW_SYSTEM_REQUIRED,
4398     0xa4b195f5, 0x8225, 0x47d8, 0x80, 0x12, 0x9d, 0x41, 0x36, 0x97, 0x86, 0xe2}
4399 DEFINE_GUID!{GUID_POWER_SAVING_STATUS,
4400     0xe00958c0, 0xc213, 0x4ace, 0xac, 0x77, 0xfe, 0xcc, 0xed, 0x2e, 0xee, 0xa5}
4401 DEFINE_GUID!{GUID_ENERGY_SAVER_SUBGROUP,
4402     0xde830923, 0xa562, 0x41af, 0xa0, 0x86, 0xe3, 0xa2, 0xc6, 0xba, 0xd2, 0xda}
4403 DEFINE_GUID!{GUID_ENERGY_SAVER_BATTERY_THRESHOLD,
4404     0xe69653ca, 0xcf7f, 0x4f05, 0xaa, 0x73, 0xcb, 0x83, 0x3f, 0xa9, 0x0a, 0xd4}
4405 DEFINE_GUID!{GUID_ENERGY_SAVER_BRIGHTNESS,
4406     0x13d09884, 0xf74e, 0x474a, 0xa8, 0x52, 0xb6, 0xbd, 0xe8, 0xad, 0x03, 0xa8}
4407 DEFINE_GUID!{GUID_ENERGY_SAVER_POLICY,
4408     0x5c5bb349, 0xad29, 0x4ee2, 0x9d, 0xb, 0x2b, 0x25, 0x27, 0xf, 0x7a, 0x81}
4409 DEFINE_GUID!{GUID_SYSTEM_BUTTON_SUBGROUP,
4410     0x4f971e89, 0xeebd, 0x4455, 0xa8, 0xde, 0x9e, 0x59, 0x04, 0x0e, 0x73, 0x47}
4411 pub const POWERBUTTON_ACTION_INDEX_NOTHING: DWORD = 0;
4412 pub const POWERBUTTON_ACTION_INDEX_SLEEP: DWORD = 1;
4413 pub const POWERBUTTON_ACTION_INDEX_HIBERNATE: DWORD = 2;
4414 pub const POWERBUTTON_ACTION_INDEX_SHUTDOWN: DWORD = 3;
4415 pub const POWERBUTTON_ACTION_INDEX_TURN_OFF_THE_DISPLAY: DWORD = 4;
4416 pub const POWERBUTTON_ACTION_VALUE_NOTHING: DWORD = 0;
4417 pub const POWERBUTTON_ACTION_VALUE_SLEEP: DWORD = 2;
4418 pub const POWERBUTTON_ACTION_VALUE_HIBERNATE: DWORD = 3;
4419 pub const POWERBUTTON_ACTION_VALUE_SHUTDOWN: DWORD = 6;
4420 pub const POWERBUTTON_ACTION_VALUE_TURN_OFF_THE_DISPLAY: DWORD = 8;
4421 DEFINE_GUID!{GUID_POWERBUTTON_ACTION,
4422     0x7648efa3, 0xdd9c, 0x4e3e, 0xb5, 0x66, 0x50, 0xf9, 0x29, 0x38, 0x62, 0x80}
4423 DEFINE_GUID!{GUID_SLEEPBUTTON_ACTION,
4424     0x96996bc0, 0xad50, 0x47ec, 0x92, 0x3b, 0x6f, 0x41, 0x87, 0x4d, 0xd9, 0xeb}
4425 DEFINE_GUID!{GUID_USERINTERFACEBUTTON_ACTION,
4426     0xa7066653, 0x8d6c, 0x40a8, 0x91, 0x0e, 0xa1, 0xf5, 0x4b, 0x84, 0xc7, 0xe5}
4427 DEFINE_GUID!{GUID_LIDCLOSE_ACTION,
4428     0x5ca83367, 0x6e45, 0x459f, 0xa2, 0x7b, 0x47, 0x6b, 0x1d, 0x01, 0xc9, 0x36}
4429 DEFINE_GUID!{GUID_LIDOPEN_POWERSTATE,
4430     0x99ff10e7, 0x23b1, 0x4c07, 0xa9, 0xd1, 0x5c, 0x32, 0x06, 0xd7, 0x41, 0xb4}
4431 DEFINE_GUID!{GUID_BATTERY_SUBGROUP,
4432     0xe73a048d, 0xbf27, 0x4f12, 0x97, 0x31, 0x8b, 0x20, 0x76, 0xe8, 0x89, 0x1f}
4433 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_0,
4434     0x637ea02f, 0xbbcb, 0x4015, 0x8e, 0x2c, 0xa1, 0xc7, 0xb9, 0xc0, 0xb5, 0x46}
4435 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_0,
4436     0x9a66d8d7, 0x4ff7, 0x4ef9, 0xb5, 0xa2, 0x5a, 0x32, 0x6c, 0xa2, 0xa4, 0x69}
4437 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_0,
4438     0x5dbb7c9f, 0x38e9, 0x40d2, 0x97, 0x49, 0x4f, 0x8a, 0x0e, 0x9f, 0x64, 0x0f}
4439 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_1,
4440     0xd8742dcb, 0x3e6a, 0x4b3c, 0xb3, 0xfe, 0x37, 0x46, 0x23, 0xcd, 0xcf, 0x06}
4441 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_1,
4442     0x8183ba9a, 0xe910, 0x48da, 0x87, 0x69, 0x14, 0xae, 0x6d, 0xc1, 0x17, 0x0a}
4443 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_1,
4444     0xbcded951, 0x187b, 0x4d05, 0xbc, 0xcc, 0xf7, 0xe5, 0x19, 0x60, 0xc2, 0x58}
4445 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_2,
4446     0x421cba38, 0x1a8e, 0x4881, 0xac, 0x89, 0xe3, 0x3a, 0x8b, 0x04, 0xec, 0xe4}
4447 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_2,
4448     0x07a07ca2, 0xadaf, 0x40d7, 0xb0, 0x77, 0x53, 0x3a, 0xad, 0xed, 0x1b, 0xfa}
4449 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_2,
4450     0x7fd2f0c4, 0xfeb7, 0x4da3, 0x81, 0x17, 0xe3, 0xfb, 0xed, 0xc4, 0x65, 0x82}
4451 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_ACTION_3,
4452     0x80472613, 0x9780, 0x455e, 0xb3, 0x08, 0x72, 0xd3, 0x00, 0x3c, 0xf2, 0xf8}
4453 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_LEVEL_3,
4454     0x58afd5a6, 0xc2dd, 0x47d2, 0x9f, 0xbf, 0xef, 0x70, 0xcc, 0x5c, 0x59, 0x65}
4455 DEFINE_GUID!{GUID_BATTERY_DISCHARGE_FLAGS_3,
4456     0x73613ccf, 0xdbfa, 0x4279, 0x83, 0x56, 0x49, 0x35, 0xf6, 0xbf, 0x62, 0xf3}
4457 DEFINE_GUID!{GUID_PROCESSOR_SETTINGS_SUBGROUP,
4458     0x54533251, 0x82be, 0x4824, 0x96, 0xc1, 0x47, 0xb6, 0x0b, 0x74, 0x0d, 0x00}
4459 DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_POLICY,
4460     0x57027304, 0x4af6, 0x4104, 0x92, 0x60, 0xe3, 0xd9, 0x52, 0x48, 0xfc, 0x36}
4461 pub const PERFSTATE_POLICY_CHANGE_IDEAL: DWORD = 0;
4462 pub const PERFSTATE_POLICY_CHANGE_SINGLE: DWORD = 1;
4463 pub const PERFSTATE_POLICY_CHANGE_ROCKET: DWORD = 2;
4464 pub const PERFSTATE_POLICY_CHANGE_IDEAL_AGGRESSIVE: DWORD = 3;
4465 pub const PERFSTATE_POLICY_CHANGE_DECREASE_MAX: DWORD = PERFSTATE_POLICY_CHANGE_ROCKET;
4466 pub const PERFSTATE_POLICY_CHANGE_INCREASE_MAX: DWORD = PERFSTATE_POLICY_CHANGE_IDEAL_AGGRESSIVE;
4467 DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MAXIMUM,
4468     0xbc5038f7, 0x23e0, 0x4960, 0x96, 0xda, 0x33, 0xab, 0xaf, 0x59, 0x35, 0xec}
4469 DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MAXIMUM_1,
4470     0xbc5038f7, 0x23e0, 0x4960, 0x96, 0xda, 0x33, 0xab, 0xaf, 0x59, 0x35, 0xed}
4471 DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MINIMUM,
4472     0x893dee8e, 0x2bef, 0x41e0, 0x89, 0xc6, 0xb5, 0x5d, 0x09, 0x29, 0x96, 0x4c}
4473 DEFINE_GUID!{GUID_PROCESSOR_THROTTLE_MINIMUM_1,
4474     0x893dee8e, 0x2bef, 0x41e0, 0x89, 0xc6, 0xb5, 0x5d, 0x09, 0x29, 0x96, 0x4d}
4475 DEFINE_GUID!{GUID_PROCESSOR_FREQUENCY_LIMIT,
4476     0x75b0ae3f, 0xbce0, 0x45a7, 0x8c, 0x89, 0xc9, 0x61, 0x1c, 0x25, 0xe1, 0x00}
4477 DEFINE_GUID!{GUID_PROCESSOR_FREQUENCY_LIMIT_1,
4478     0x75b0ae3f, 0xbce0, 0x45a7, 0x8c, 0x89, 0xc9, 0x61, 0x1c, 0x25, 0xe1, 0x01}
4479 DEFINE_GUID!{GUID_PROCESSOR_ALLOW_THROTTLING,
4480     0x3b04d4fd, 0x1cc7, 0x4f23, 0xab, 0x1c, 0xd1, 0x33, 0x78, 0x19, 0xc4, 0xbb}
4481 pub const PROCESSOR_THROTTLE_DISABLED: DWORD = 0;
4482 pub const PROCESSOR_THROTTLE_ENABLED: DWORD = 1;
4483 pub const PROCESSOR_THROTTLE_AUTOMATIC: DWORD = 2;
4484 DEFINE_GUID!{GUID_PROCESSOR_IDLESTATE_POLICY,
4485     0x68f262a7, 0xf621, 0x4069, 0xb9, 0xa5, 0x48, 0x74, 0x16, 0x9b, 0xe2, 0x3c}
4486 DEFINE_GUID!{GUID_PROCESSOR_PERFSTATE_POLICY,
4487     0xbbdc3814, 0x18e9, 0x4463, 0x8a, 0x55, 0xd1, 0x97, 0x32, 0x7c, 0x45, 0xc0}
4488 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_THRESHOLD,
4489     0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5d}
4490 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_THRESHOLD_1,
4491     0x06cadf0e, 0x64ed, 0x448a, 0x89, 0x27, 0xce, 0x7b, 0xf9, 0x0e, 0xb3, 0x5e}
4492 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_THRESHOLD,
4493     0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa6}
4494 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_THRESHOLD_1,
4495     0x12a0ab44, 0xfe28, 0x4fa9, 0xb3, 0xbd, 0x4b, 0x64, 0xf4, 0x49, 0x60, 0xa7}
4496 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_POLICY,
4497     0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x18}
4498 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_POLICY_1,
4499     0x465e1f50, 0xb610, 0x473a, 0xab, 0x58, 0x0, 0xd1, 0x7, 0x7d, 0xc4, 0x19}
4500 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_POLICY,
4501     0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc6}
4502 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_POLICY_1,
4503     0x40fbefc7, 0x2e9d, 0x4d25, 0xa1, 0x85, 0xc, 0xfd, 0x85, 0x74, 0xba, 0xc7}
4504 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_TIME,
4505     0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xaa}
4506 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_TIME_1,
4507     0x984cf492, 0x3bed, 0x4488, 0xa8, 0xf9, 0x42, 0x86, 0xc9, 0x7b, 0xf5, 0xab}
4508 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_TIME,
4509     0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc8}
4510 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_TIME_1,
4511     0xd8edeb9b, 0x95cf, 0x4f95, 0xa7, 0x3c, 0xb0, 0x61, 0x97, 0x36, 0x93, 0xc9}
4512 DEFINE_GUID!{GUID_PROCESSOR_PERF_TIME_CHECK,
4513     0x4d2b0152, 0x7d5c, 0x498b, 0x88, 0xe2, 0x34, 0x34, 0x53, 0x92, 0xa2, 0xc5}
4514 DEFINE_GUID!{GUID_PROCESSOR_PERF_BOOST_POLICY,
4515     0x45bcc044, 0xd885, 0x43e2, 0x86, 0x5, 0xee, 0xe, 0xc6, 0xe9, 0x6b, 0x59}
4516 pub const PROCESSOR_PERF_BOOST_POLICY_DISABLED: DWORD = 0;
4517 pub const PROCESSOR_PERF_BOOST_POLICY_MAX: DWORD = 100;
4518 DEFINE_GUID!{GUID_PROCESSOR_PERF_BOOST_MODE,
4519     0xbe337238, 0xd82, 0x4146, 0xa9, 0x60, 0x4f, 0x37, 0x49, 0xd4, 0x70, 0xc7}
4520 pub const PROCESSOR_PERF_BOOST_MODE_DISABLED: DWORD = 0;
4521 pub const PROCESSOR_PERF_BOOST_MODE_ENABLED: DWORD = 1;
4522 pub const PROCESSOR_PERF_BOOST_MODE_AGGRESSIVE: DWORD = 2;
4523 pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_ENABLED: DWORD = 3;
4524 pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE: DWORD = 4;
4525 pub const PROCESSOR_PERF_BOOST_MODE_AGGRESSIVE_AT_GUARANTEED: DWORD = 5;
4526 pub const PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE_AT_GUARANTEED: DWORD = 6;
4527 pub const PROCESSOR_PERF_BOOST_MODE_MAX: DWORD
4528     = PROCESSOR_PERF_BOOST_MODE_EFFICIENT_AGGRESSIVE_AT_GUARANTEED;
4529 DEFINE_GUID!{GUID_PROCESSOR_PERF_AUTONOMOUS_MODE,
4530     0x8baa4a8a, 0x14c6, 0x4451, 0x8e, 0x8b, 0x14, 0xbd, 0xbd, 0x19, 0x75, 0x37}
4531 pub const PROCESSOR_PERF_AUTONOMOUS_MODE_DISABLED: DWORD = 0;
4532 pub const PROCESSOR_PERF_AUTONOMOUS_MODE_ENABLED: DWORD = 1;
4533 DEFINE_GUID!{GUID_PROCESSOR_PERF_ENERGY_PERFORMANCE_PREFERENCE,
4534     0x36687f9e, 0xe3a5, 0x4dbf, 0xb1, 0xdc, 0x15, 0xeb, 0x38, 0x1c, 0x68, 0x63}
4535 pub const PROCESSOR_PERF_PERFORMANCE_PREFERENCE: DWORD = 0xff;
4536 pub const PROCESSOR_PERF_ENERGY_PREFERENCE: DWORD = 0;
4537 DEFINE_GUID!{GUID_PROCESSOR_PERF_AUTONOMOUS_ACTIVITY_WINDOW,
4538     0xcfeda3d0, 0x7697, 0x4566, 0xa9, 0x22, 0xa9, 0x8, 0x6c, 0xd4, 0x9d, 0xfa}
4539 pub const PROCESSOR_PERF_MINIMUM_ACTIVITY_WINDOW: DWORD = 0;
4540 pub const PROCESSOR_PERF_MAXIMUM_ACTIVITY_WINDOW: DWORD = 1270000000;
4541 DEFINE_GUID!{GUID_PROCESSOR_DUTY_CYCLING,
4542     0x4e4450b3, 0x6179, 0x4e91, 0xb8, 0xf1, 0x5b, 0xb9, 0x93, 0x8f, 0x81, 0xa1}
4543 pub const PROCESSOR_DUTY_CYCLING_DISABLED: DWORD = 0;
4544 pub const PROCESSOR_DUTY_CYCLING_ENABLED: DWORD = 1;
4545 DEFINE_GUID!{GUID_PROCESSOR_IDLE_ALLOW_SCALING,
4546     0x6c2993b0, 0x8f48, 0x481f, 0xbc, 0xc6, 0x0, 0xdd, 0x27, 0x42, 0xaa, 0x6}
4547 DEFINE_GUID!{GUID_PROCESSOR_IDLE_DISABLE,
4548     0x5d76a2ca, 0xe8c0, 0x402f, 0xa1, 0x33, 0x21, 0x58, 0x49, 0x2d, 0x58, 0xad}
4549 DEFINE_GUID!{GUID_PROCESSOR_IDLE_STATE_MAXIMUM,
4550     0x9943e905, 0x9a30, 0x4ec1, 0x9b, 0x99, 0x44, 0xdd, 0x3b, 0x76, 0xf7, 0xa2}
4551 DEFINE_GUID!{GUID_PROCESSOR_IDLE_TIME_CHECK,
4552     0xc4581c31, 0x89ab, 0x4597, 0x8e, 0x2b, 0x9c, 0x9c, 0xab, 0x44, 0xe, 0x6b}
4553 DEFINE_GUID!{GUID_PROCESSOR_IDLE_DEMOTE_THRESHOLD,
4554     0x4b92d758, 0x5a24, 0x4851, 0xa4, 0x70, 0x81, 0x5d, 0x78, 0xae, 0xe1, 0x19}
4555 DEFINE_GUID!{GUID_PROCESSOR_IDLE_PROMOTE_THRESHOLD,
4556     0x7b224883, 0xb3cc, 0x4d79, 0x81, 0x9f, 0x83, 0x74, 0x15, 0x2c, 0xbe, 0x7c}
4557 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_THRESHOLD,
4558     0xdf142941, 0x20f3, 0x4edf, 0x9a, 0x4a, 0x9c, 0x83, 0xd3, 0xd7, 0x17, 0xd1}
4559 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_THRESHOLD,
4560     0x68dd2f27, 0xa4ce, 0x4e11, 0x84, 0x87, 0x37, 0x94, 0xe4, 0x13, 0x5d, 0xfa}
4561 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_POLICY,
4562     0xc7be0679, 0x2817, 0x4d69, 0x9d, 0x02, 0x51, 0x9a, 0x53, 0x7e, 0xd0, 0xc6}
4563 pub const CORE_PARKING_POLICY_CHANGE_IDEAL: DWORD = 0;
4564 pub const CORE_PARKING_POLICY_CHANGE_SINGLE: DWORD = 1;
4565 pub const CORE_PARKING_POLICY_CHANGE_ROCKET: DWORD = 2;
4566 pub const CORE_PARKING_POLICY_CHANGE_MULTISTEP: DWORD = 3;
4567 pub const CORE_PARKING_POLICY_CHANGE_MAX: DWORD = CORE_PARKING_POLICY_CHANGE_MULTISTEP;
4568 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_POLICY,
4569     0x71021b41, 0xc749, 0x4d21, 0xbe, 0x74, 0xa0, 0x0f, 0x33, 0x5d, 0x58, 0x2b}
4570 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MAX_CORES,
4571     0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x28}
4572 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MAX_CORES_1,
4573     0xea062031, 0x0e34, 0x4ff1, 0x9b, 0x6d, 0xeb, 0x10, 0x59, 0x33, 0x40, 0x29}
4574 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MIN_CORES,
4575     0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x83}
4576 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_MIN_CORES_1,
4577     0x0cc5b647, 0xc1df, 0x4637, 0x89, 0x1a, 0xde, 0xc3, 0x5c, 0x31, 0x85, 0x84}
4578 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_INCREASE_TIME,
4579     0x2ddd5a84, 0x5a71, 0x437e, 0x91, 0x2a, 0xdb, 0x0b, 0x8c, 0x78, 0x87, 0x32}
4580 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_DECREASE_TIME,
4581     0xdfd10d17, 0xd5eb, 0x45dd, 0x87, 0x7a, 0x9a, 0x34, 0xdd, 0xd1, 0x5c, 0x82}
4582 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_DECREASE_FACTOR,
4583     0x8f7b45e3, 0xc393, 0x480a, 0x87, 0x8c, 0xf6, 0x7a, 0xc3, 0xd0, 0x70, 0x82}
4584 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_HISTORY_THRESHOLD,
4585     0x5b33697b, 0xe89d, 0x4d38, 0xaa, 0x46, 0x9e, 0x7d, 0xfb, 0x7c, 0xd2, 0xf9}
4586 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_AFFINITY_WEIGHTING,
4587     0xe70867f1, 0xfa2f, 0x4f4e, 0xae, 0xa1, 0x4d, 0x8a, 0x0b, 0xa2, 0x3b, 0x20}
4588 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_DECREASE_FACTOR,
4589     0x1299023c, 0xbc28, 0x4f0a, 0x81, 0xec, 0xd3, 0x29, 0x5a, 0x8d, 0x81, 0x5d}
4590 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_HISTORY_THRESHOLD,
4591     0x9ac18e92, 0xaa3c, 0x4e27, 0xb3, 0x07, 0x01, 0xae, 0x37, 0x30, 0x71, 0x29}
4592 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_WEIGHTING,
4593     0x8809c2d8, 0xb155, 0x42d4, 0xbc, 0xda, 0x0d, 0x34, 0x56, 0x51, 0xb1, 0xdb}
4594 DEFINE_GUID!{GUID_PROCESSOR_CORE_PARKING_OVER_UTILIZATION_THRESHOLD,
4595     0x943c8cb6, 0x6f93, 0x4227, 0xad, 0x87, 0xe9, 0xa3, 0xfe, 0xec, 0x08, 0xd1}
4596 DEFINE_GUID!{GUID_PROCESSOR_PARKING_CORE_OVERRIDE,
4597     0xa55612aa, 0xf624, 0x42c6, 0xa4, 0x43, 0x73, 0x97, 0xd0, 0x64, 0xc0, 0x4f}
4598 DEFINE_GUID!{GUID_PROCESSOR_PARKING_PERF_STATE,
4599     0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2b}
4600 DEFINE_GUID!{GUID_PROCESSOR_PARKING_PERF_STATE_1,
4601     0x447235c7, 0x6a8d, 0x4cc0, 0x8e, 0x24, 0x9e, 0xaf, 0x70, 0xb9, 0x6e, 0x2c}
4602 DEFINE_GUID!{GUID_PROCESSOR_PARKING_CONCURRENCY_THRESHOLD,
4603     0x2430ab6f, 0xa520, 0x44a2, 0x96, 0x01, 0xf7, 0xf2, 0x3b, 0x51, 0x34, 0xb1}
4604 DEFINE_GUID!{GUID_PROCESSOR_PARKING_HEADROOM_THRESHOLD,
4605     0xf735a673, 0x2066, 0x4f80, 0xa0, 0xc5, 0xdd, 0xee, 0x0c, 0xf1, 0xbf, 0x5d}
4606 DEFINE_GUID!{GUID_PROCESSOR_PARKING_DISTRIBUTION_THRESHOLD,
4607     0x4bdaf4e9, 0xd103, 0x46d7, 0xa5, 0xf0, 0x62, 0x80, 0x12, 0x16, 0x16, 0xef}
4608 DEFINE_GUID!{GUID_PROCESSOR_PERF_HISTORY,
4609     0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x5f}
4610 DEFINE_GUID!{GUID_PROCESSOR_PERF_HISTORY_1,
4611     0x7d24baa7, 0x0b84, 0x480f, 0x84, 0x0c, 0x1b, 0x07, 0x43, 0xc0, 0x0f, 0x60}
4612 DEFINE_GUID!{GUID_PROCESSOR_PERF_INCREASE_HISTORY,
4613     0x99b3ef01, 0x752f, 0x46a1, 0x80, 0xfb, 0x77, 0x30, 0x1, 0x1f, 0x23, 0x54}
4614 DEFINE_GUID!{GUID_PROCESSOR_PERF_DECREASE_HISTORY,
4615     0x300f6f8, 0xabd6, 0x45a9, 0xb7, 0x4f, 0x49, 0x8, 0x69, 0x1a, 0x40, 0xb5}
4616 DEFINE_GUID!{GUID_PROCESSOR_PERF_CORE_PARKING_HISTORY,
4617     0x77d7f282, 0x8f1a, 0x42cd, 0x85, 0x37, 0x45, 0x45, 0xa, 0x83, 0x9b, 0xe8}
4618 DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT,
4619     0x0822df31, 0x9c83, 0x441c, 0xa0, 0x79, 0x0d, 0xe4, 0xcf, 0x00, 0x9c, 0x7b}
4620 DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT_PERF,
4621     0x619b7505, 0x3b, 0x4e82, 0xb7, 0xa6, 0x4d, 0xd2, 0x9c, 0x30, 0x9, 0x71}
4622 DEFINE_GUID!{GUID_PROCESSOR_PERF_LATENCY_HINT_PERF_1,
4623     0x619b7505, 0x3b, 0x4e82, 0xb7, 0xa6, 0x4d, 0xd2, 0x9c, 0x30, 0x9, 0x72}
4624 DEFINE_GUID!{GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK,
4625     0x616cdaa5, 0x695e, 0x4545, 0x97, 0xad, 0x97, 0xdc, 0x2d, 0x1b, 0xdd, 0x88}
4626 DEFINE_GUID!{GUID_PROCESSOR_LATENCY_HINT_MIN_UNPARK_1,
4627     0x616cdaa5, 0x695e, 0x4545, 0x97, 0xad, 0x97, 0xdc, 0x2d, 0x1b, 0xdd, 0x89}
4628 DEFINE_GUID!{GUID_PROCESSOR_DISTRIBUTE_UTILITY,
4629     0xe0007330, 0xf589, 0x42ed, 0xa4, 0x01, 0x5d, 0xdb, 0x10, 0xe7, 0x85, 0xd3}
4630 DEFINE_GUID!{GUID_PROCESSOR_HETEROGENEOUS_POLICY,
4631     0x7f2f5cfa, 0xf10c, 0x4823, 0xb5, 0xe1, 0xe9, 0x3a, 0xe8, 0x5f, 0x46, 0xb5}
4632 DEFINE_GUID!{GUID_PROCESSOR_HETERO_DECREASE_TIME,
4633     0x7f2492b6, 0x60b1, 0x45e5, 0xae, 0x55, 0x77, 0x3f, 0x8c, 0xd5, 0xca, 0xec}
4634 DEFINE_GUID!{GUID_PROCESSOR_HETERO_INCREASE_TIME,
4635     0x4009efa7, 0xe72d, 0x4cba, 0x9e, 0xdf, 0x91, 0x08, 0x4e, 0xa8, 0xcb, 0xc3}
4636 DEFINE_GUID!{GUID_PROCESSOR_HETERO_DECREASE_THRESHOLD,
4637     0xf8861c27, 0x95e7, 0x475c, 0x86, 0x5b, 0x13, 0xc0, 0xcb, 0x3f, 0x9d, 0x6b}
4638 DEFINE_GUID!{GUID_PROCESSOR_HETERO_INCREASE_THRESHOLD,
4639     0xb000397d, 0x9b0b, 0x483d, 0x98, 0xc9, 0x69, 0x2a, 0x60, 0x60, 0xcf, 0xbf}
4640 DEFINE_GUID!{GUID_PROCESSOR_CLASS0_FLOOR_PERF,
4641     0xfddc842b, 0x8364, 0x4edc, 0x94, 0xcf, 0xc1, 0x7f, 0x60, 0xde, 0x1c, 0x80}
4642 DEFINE_GUID!{GUID_PROCESSOR_CLASS1_INITIAL_PERF,
4643     0x1facfc65, 0xa930, 0x4bc5, 0x9f, 0x38, 0x50, 0x4e, 0xc0, 0x97, 0xbb, 0xc0}
4644 DEFINE_GUID!{GUID_SYSTEM_COOLING_POLICY,
4645     0x94d3a615, 0xa899, 0x4ac5, 0xae, 0x2b, 0xe4, 0xd8, 0xf6, 0x34, 0x36, 0x7f}
4646 DEFINE_GUID!{GUID_LOCK_CONSOLE_ON_WAKE,
4647     0x0e796bdb, 0x100d, 0x47d6, 0xa2, 0xd5, 0xf7, 0xd2, 0xda, 0xa5, 0x1f, 0x51}
4648 DEFINE_GUID!{GUID_DEVICE_IDLE_POLICY,
4649     0x4faab71a, 0x92e5, 0x4726, 0xb5, 0x31, 0x22, 0x45, 0x59, 0x67, 0x2d, 0x19}
4650 pub const POWER_DEVICE_IDLE_POLICY_PERFORMANCE: DWORD = 0;
4651 pub const POWER_DEVICE_IDLE_POLICY_CONSERVATIVE: DWORD = 1;
4652 DEFINE_GUID!{GUID_CONNECTIVITY_IN_STANDBY,
4653     0xf15576e8, 0x98b7, 0x4186, 0xb9, 0x44, 0xea, 0xfa, 0x66, 0x44, 0x02, 0xd9}
4654 pub const POWER_CONNECTIVITY_IN_STANDBY_DISABLED: DWORD = 0;
4655 pub const POWER_CONNECTIVITY_IN_STANDBY_ENABLED: DWORD = 1;
4656 pub const POWER_CONNECTIVITY_IN_STANDBY_DISABLED_LID_CLOSE: DWORD = 2;
4657 DEFINE_GUID!{GUID_DISCONNECTED_STANDBY_MODE,
4658     0x68afb2d9, 0xee95, 0x47a8, 0x8f, 0x50, 0x41, 0x15, 0x08, 0x80, 0x73, 0xb1}
4659 pub const POWER_DISCONNECTED_STANDBY_MODE_NORMAL: DWORD = 0;
4660 pub const POWER_DISCONNECTED_STANDBY_MODE_AGGRESSIVE: DWORD = 1;
4661 DEFINE_GUID!{GUID_ACDC_POWER_SOURCE,
4662     0x5d3e9a59, 0xe9d5, 0x4b00, 0xa6, 0xbd, 0xff, 0x34, 0xff, 0x51, 0x65, 0x48}
4663 DEFINE_GUID!{GUID_LIDSWITCH_STATE_CHANGE,
4664     0xba3e0f4d, 0xb817, 0x4094, 0xa2, 0xd1, 0xd5, 0x63, 0x79, 0xe6, 0xa0, 0xf3}
4665 DEFINE_GUID!{GUID_BATTERY_PERCENTAGE_REMAINING,
4666     0xa7ad8041, 0xb45a, 0x4cae, 0x87, 0xa3, 0xee, 0xcb, 0xb4, 0x68, 0xa9, 0xe1}
4667 DEFINE_GUID!{GUID_BATTERY_COUNT,
4668     0x7d263f15, 0xfca4, 0x49e5, 0x85, 0x4b, 0xa9, 0xf2, 0xbf, 0xbd, 0x5c, 0x24}
4669 DEFINE_GUID!{GUID_GLOBAL_USER_PRESENCE,
4670     0x786e8a1d, 0xb427, 0x4344, 0x92, 0x7, 0x9, 0xe7, 0xb, 0xdc, 0xbe, 0xa9}
4671 DEFINE_GUID!{GUID_SESSION_DISPLAY_STATUS,
4672     0x2b84c20e, 0xad23, 0x4ddf, 0x93, 0xdb, 0x5, 0xff, 0xbd, 0x7e, 0xfc, 0xa5}
4673 DEFINE_GUID!{GUID_SESSION_USER_PRESENCE,
4674     0x3c0f4548, 0xc03f, 0x4c4d, 0xb9, 0xf2, 0x23, 0x7e, 0xde, 0x68, 0x63, 0x76}
4675 DEFINE_GUID!{GUID_IDLE_BACKGROUND_TASK,
4676     0x515c31d8, 0xf734, 0x163d, 0xa0, 0xfd, 0x11, 0xa0, 0x8c, 0x91, 0xe8, 0xf1}
4677 DEFINE_GUID!{GUID_BACKGROUND_TASK_NOTIFICATION,
4678     0xcf23f240, 0x2a54, 0x48d8, 0xb1, 0x14, 0xde, 0x15, 0x18, 0xff, 0x05, 0x2e}
4679 DEFINE_GUID!{GUID_APPLAUNCH_BUTTON,
4680     0x1a689231, 0x7399, 0x4e9a, 0x8f, 0x99, 0xb7, 0x1f, 0x99, 0x9d, 0xb3, 0xfa}
4681 DEFINE_GUID!{GUID_PCIEXPRESS_SETTINGS_SUBGROUP,
4682     0x501a4d13, 0x42af,0x4429, 0x9f, 0xd1, 0xa8, 0x21, 0x8c, 0x26, 0x8e, 0x20}
4683 DEFINE_GUID!{GUID_PCIEXPRESS_ASPM_POLICY,
4684     0xee12f906, 0xd277, 0x404b, 0xb6, 0xda, 0xe5, 0xfa, 0x1a, 0x57, 0x6d, 0xf5}
4685 DEFINE_GUID!{GUID_ENABLE_SWITCH_FORCED_SHUTDOWN,
4686     0x833a6b62, 0xdfa4, 0x46d1, 0x82, 0xf8, 0xe0, 0x9e, 0x34, 0xd0, 0x29, 0xd6}
4687 DEFINE_GUID!{GUID_INTSTEER_SUBGROUP,
4688     0x48672f38, 0x7a9a, 0x4bb2, 0x8b, 0xf8, 0x3d, 0x85, 0xbe, 0x19, 0xde, 0x4e}
4689 DEFINE_GUID!{GUID_INTSTEER_MODE,
4690     0x2bfc24f9, 0x5ea2, 0x4801, 0x82, 0x13, 0x3d, 0xba, 0xe0, 0x1a, 0xa3, 0x9d}
4691 DEFINE_GUID!{GUID_INTSTEER_LOAD_PER_PROC_TRIGGER,
4692     0x73cde64d, 0xd720, 0x4bb2, 0xa8, 0x60, 0xc7, 0x55, 0xaf, 0xe7, 0x7e, 0xf2}
4693 DEFINE_GUID!{GUID_INTSTEER_TIME_UNPARK_TRIGGER,
4694     0xd6ba4903, 0x386f, 0x4c2c, 0x8a, 0xdb, 0x5c, 0x21, 0xb3, 0x32, 0x8d, 0x25}
4695 ENUM!{enum SYSTEM_POWER_STATE {
4696     PowerSystemUnspecified = 0,
4697     PowerSystemWorking = 1,
4698     PowerSystemSleeping1 = 2,
4699     PowerSystemSleeping2 = 3,
4700     PowerSystemSleeping3 = 4,
4701     PowerSystemHibernate = 5,
4702     PowerSystemShutdown = 6,
4703     PowerSystemMaximum = 7,
4704 }}
4705 pub type PSYSTEM_POWER_STATE = *mut SYSTEM_POWER_STATE;
4706 pub const POWER_SYSTEM_MAXIMUM: usize = 7;
4707 ENUM!{enum POWER_ACTION {
4708     PowerActionNone = 0,
4709     PowerActionReserved,
4710     PowerActionSleep,
4711     PowerActionHibernate,
4712     PowerActionShutdown,
4713     PowerActionShutdownReset,
4714     PowerActionShutdownOff,
4715     PowerActionWarmEject,
4716     PowerActionDisplayOff,
4717 }}
4718 pub type PPOWER_ACTION = *mut POWER_ACTION;
4719 ENUM!{enum DEVICE_POWER_STATE {
4720     PowerDeviceUnspecified = 0,
4721     PowerDeviceD0,
4722     PowerDeviceD1,
4723     PowerDeviceD2,
4724     PowerDeviceD3,
4725     PowerDeviceMaximum,
4726 }}
4727 pub type PDEVICE_POWER_STATE = *mut DEVICE_POWER_STATE;
4728 ENUM!{enum MONITOR_DISPLAY_STATE {
4729     PowerMonitorOff = 0,
4730     PowerMonitorOn,
4731     PowerMonitorDim,
4732 }}
4733 pub type PMONITOR_DISPLAY_STATE = *mut MONITOR_DISPLAY_STATE;
4734 ENUM!{enum USER_ACTIVITY_PRESENCE {
4735     PowerUserPresent = 0,
4736     PowerUserNotPresent,
4737     PowerUserInactive,
4738     PowerUserMaximum,
4739     PowerUserInvalid = PowerUserMaximum,
4740 }}
4741 pub type PUSER_ACTIVITY_PRESENCE = *mut USER_ACTIVITY_PRESENCE;
4742 pub const ES_SYSTEM_REQUIRED: DWORD = 0x00000001;
4743 pub const ES_DISPLAY_REQUIRED: DWORD = 0x00000002;
4744 pub const ES_USER_PRESENT: DWORD = 0x00000004;
4745 pub const ES_AWAYMODE_REQUIRED: DWORD = 0x00000040;
4746 pub const ES_CONTINUOUS: DWORD = 0x80000000;
4747 pub type EXECUTION_STATE = DWORD;
4748 pub type PEXECUTION_STATE = *mut DWORD;
4749 ENUM!{enum LATENCY_TIME {
4750     LT_DONT_CARE,
4751     LT_LOWEST_LATENCY,
4752 }}
4753 pub const DIAGNOSTIC_REASON_VERSION: ULONG = 0;
4754 pub const DIAGNOSTIC_REASON_SIMPLE_STRING: ULONG = 0x00000001;
4755 pub const DIAGNOSTIC_REASON_DETAILED_STRING: ULONG = 0x00000002;
4756 pub const DIAGNOSTIC_REASON_NOT_SPECIFIED: ULONG = 0x80000000;
4757 pub const DIAGNOSTIC_REASON_INVALID_FLAGS: ULONG = !0x80000007;
4758 pub const POWER_REQUEST_CONTEXT_VERSION: ULONG = DIAGNOSTIC_REASON_VERSION;
4759 pub const POWER_REQUEST_CONTEXT_SIMPLE_STRING: ULONG = DIAGNOSTIC_REASON_SIMPLE_STRING;
4760 pub const POWER_REQUEST_CONTEXT_DETAILED_STRING: ULONG = DIAGNOSTIC_REASON_DETAILED_STRING;
4761 ENUM!{enum POWER_REQUEST_TYPE {
4762     PowerRequestDisplayRequired,
4763     PowerRequestSystemRequired,
4764     PowerRequestAwayModeRequired,
4765     PowerRequestExecutionRequired,
4766 }}
4767 pub type PPOWER_REQUEST_TYPE = *mut POWER_REQUEST_TYPE;
4768 pub const PDCAP_D0_SUPPORTED: DWORD = 0x00000001;
4769 pub const PDCAP_D1_SUPPORTED: DWORD = 0x00000002;
4770 pub const PDCAP_D2_SUPPORTED: DWORD = 0x00000004;
4771 pub const PDCAP_D3_SUPPORTED: DWORD = 0x00000008;
4772 pub const PDCAP_WAKE_FROM_D0_SUPPORTED: DWORD = 0x00000010;
4773 pub const PDCAP_WAKE_FROM_D1_SUPPORTED: DWORD = 0x00000020;
4774 pub const PDCAP_WAKE_FROM_D2_SUPPORTED: DWORD = 0x00000040;
4775 pub const PDCAP_WAKE_FROM_D3_SUPPORTED: DWORD = 0x00000080;
4776 pub const PDCAP_WARM_EJECT_SUPPORTED: DWORD = 0x00000100;
4777 STRUCT!{struct CM_POWER_DATA {
4778     PD_Size: DWORD,
4779     PD_MostRecentPowerState: DEVICE_POWER_STATE,
4780     PD_Capabilities: DWORD,
4781     PD_D1Latency: DWORD,
4782     PD_D2Latency: DWORD,
4783     PD_D3Latency: DWORD,
4784     PD_PowerStateMapping: [DEVICE_POWER_STATE; POWER_SYSTEM_MAXIMUM],
4785     PD_DeepestSystemWake: SYSTEM_POWER_STATE,
4786 }}
4787 pub type PCM_POWER_DATA = *mut CM_POWER_DATA;
4788 ENUM!{enum POWER_INFORMATION_LEVEL {
4789     SystemPowerPolicyAc,
4790     SystemPowerPolicyDc,
4791     VerifySystemPolicyAc,
4792     VerifySystemPolicyDc,
4793     SystemPowerCapabilities,
4794     SystemBatteryState,
4795     SystemPowerStateHandler,
4796     ProcessorStateHandler,
4797     SystemPowerPolicyCurrent,
4798     AdministratorPowerPolicy,
4799     SystemReserveHiberFile,
4800     ProcessorInformation,
4801     SystemPowerInformation,
4802     ProcessorStateHandler2,
4803     LastWakeTime,
4804     LastSleepTime,
4805     SystemExecutionState,
4806     SystemPowerStateNotifyHandler,
4807     ProcessorPowerPolicyAc,
4808     ProcessorPowerPolicyDc,
4809     VerifyProcessorPowerPolicyAc,
4810     VerifyProcessorPowerPolicyDc,
4811     ProcessorPowerPolicyCurrent,
4812     SystemPowerStateLogging,
4813     SystemPowerLoggingEntry,
4814     SetPowerSettingValue,
4815     NotifyUserPowerSetting,
4816     PowerInformationLevelUnused0,
4817     SystemMonitorHiberBootPowerOff,
4818     SystemVideoState,
4819     TraceApplicationPowerMessage,
4820     TraceApplicationPowerMessageEnd,
4821     ProcessorPerfStates,
4822     ProcessorIdleStates,
4823     ProcessorCap,
4824     SystemWakeSource,
4825     SystemHiberFileInformation,
4826     TraceServicePowerMessage,
4827     ProcessorLoad,
4828     PowerShutdownNotification,
4829     MonitorCapabilities,
4830     SessionPowerInit,
4831     SessionDisplayState,
4832     PowerRequestCreate,
4833     PowerRequestAction,
4834     GetPowerRequestList,
4835     ProcessorInformationEx,
4836     NotifyUserModeLegacyPowerEvent,
4837     GroupPark,
4838     ProcessorIdleDomains,
4839     WakeTimerList,
4840     SystemHiberFileSize,
4841     ProcessorIdleStatesHv,
4842     ProcessorPerfStatesHv,
4843     ProcessorPerfCapHv,
4844     ProcessorSetIdle,
4845     LogicalProcessorIdling,
4846     UserPresence,
4847     PowerSettingNotificationName,
4848     GetPowerSettingValue,
4849     IdleResiliency,
4850     SessionRITState,
4851     SessionConnectNotification,
4852     SessionPowerCleanup,
4853     SessionLockState,
4854     SystemHiberbootState,
4855     PlatformInformation,
4856     PdcInvocation,
4857     MonitorInvocation,
4858     FirmwareTableInformationRegistered,
4859     SetShutdownSelectedTime,
4860     SuspendResumeInvocation,
4861     PlmPowerRequestCreate,
4862     ScreenOff,
4863     CsDeviceNotification,
4864     PlatformRole,
4865     LastResumePerformance,
4866     DisplayBurst,
4867     ExitLatencySamplingPercentage,
4868     RegisterSpmPowerSettings,
4869     PlatformIdleStates,
4870     ProcessorIdleVeto,
4871     PlatformIdleVeto,
4872     SystemBatteryStatePrecise,
4873     ThermalEvent,
4874     PowerRequestActionInternal,
4875     BatteryDeviceState,
4876     PowerInformationInternal,
4877     ThermalStandby,
4878     SystemHiberFileType,
4879     PhysicalPowerButtonPress,
4880     QueryPotentialDripsConstraint,
4881     EnergyTrackerCreate,
4882     EnergyTrackerQuery,
4883     UpdateBlackBoxRecorder,
4884     PowerInformationLevelMaximum,
4885 }}
4886 ENUM!{enum POWER_USER_PRESENCE_TYPE {
4887     UserNotPresent = 0,
4888     UserPresent = 1,
4889     UserUnknown = 0xff,
4890 }}
4891 pub type PPOWER_USER_PRESENCE_TYPE = *mut POWER_USER_PRESENCE_TYPE;
4892 STRUCT!{struct POWER_USER_PRESENCE {
4893     UserPresence: POWER_USER_PRESENCE_TYPE,
4894 }}
4895 pub type PPOWER_USER_PRESENCE = *mut POWER_USER_PRESENCE;
4896 STRUCT!{struct POWER_SESSION_CONNECT {
4897     Connected: BOOLEAN,
4898     Console: BOOLEAN,
4899 }}
4900 pub type PPOWER_SESSION_CONNECT = *mut POWER_SESSION_CONNECT;
4901 STRUCT!{struct POWER_SESSION_TIMEOUTS {
4902     InputTimeout: DWORD,
4903     DisplayTimeout: DWORD,
4904 }}
4905 pub type PPOWER_SESSION_TIMEOUTS = *mut POWER_SESSION_TIMEOUTS;
4906 STRUCT!{struct POWER_SESSION_RIT_STATE {
4907     Active: BOOLEAN,
4908     LastInputTime: DWORD,
4909 }}
4910 pub type PPOWER_SESSION_RIT_STATE = *mut POWER_SESSION_RIT_STATE;
4911 STRUCT!{struct POWER_SESSION_WINLOGON {
4912     SessionId: DWORD,
4913     Console: BOOLEAN,
4914     Locked: BOOLEAN,
4915 }}
4916 pub type PPOWER_SESSION_WINLOGON = *mut POWER_SESSION_WINLOGON;
4917 STRUCT!{struct POWER_IDLE_RESILIENCY {
4918     CoalescingTimeout: DWORD,
4919     IdleResiliencyPeriod: DWORD,
4920 }}
4921 pub type PPOWER_IDLE_RESILIENCY = *mut POWER_IDLE_RESILIENCY;
4922 ENUM!{enum POWER_MONITOR_REQUEST_REASON {
4923     MonitorRequestReasonUnknown,
4924     MonitorRequestReasonPowerButton,
4925     MonitorRequestReasonRemoteConnection,
4926     MonitorRequestReasonScMonitorpower,
4927     MonitorRequestReasonUserInput,
4928     MonitorRequestReasonAcDcDisplayBurst,
4929     MonitorRequestReasonUserDisplayBurst,
4930     MonitorRequestReasonPoSetSystemState,
4931     MonitorRequestReasonSetThreadExecutionState,
4932     MonitorRequestReasonFullWake,
4933     MonitorRequestReasonSessionUnlock,
4934     MonitorRequestReasonScreenOffRequest,
4935     MonitorRequestReasonIdleTimeout,
4936     MonitorRequestReasonPolicyChange,
4937     MonitorRequestReasonSleepButton,
4938     MonitorRequestReasonLid,
4939     MonitorRequestReasonBatteryCountChange,
4940     MonitorRequestReasonGracePeriod,
4941     MonitorRequestReasonPnP,
4942     MonitorRequestReasonDP,
4943     MonitorRequestReasonSxTransition,
4944     MonitorRequestReasonSystemIdle,
4945     MonitorRequestReasonNearProximity,
4946     MonitorRequestReasonThermalStandby,
4947     MonitorRequestReasonResumePdc,
4948     MonitorRequestReasonResumeS4,
4949     MonitorRequestReasonTerminal,
4950     MonitorRequestReasonPdcSignal,
4951     MonitorRequestReasonAcDcDisplayBurstSuppressed,
4952     MonitorRequestReasonSystemStateEntered,
4953     MonitorRequestReasonWinrt,
4954     MonitorRequestReasonMax,
4955 }}
4956 ENUM!{enum POWER_MONITOR_REQUEST_TYPE {
4957     MonitorRequestTypeOff,
4958     MonitorRequestTypeOnAndPresent,
4959     MonitorRequestTypeToggleOn,
4960 }}
4961 STRUCT!{struct POWER_MONITOR_INVOCATION {
4962     Console: BOOLEAN,
4963     RequestReason: POWER_MONITOR_REQUEST_REASON,
4964 }}
4965 pub type PPOWER_MONITOR_INVOCATION = *mut POWER_MONITOR_INVOCATION;
4966 STRUCT!{struct RESUME_PERFORMANCE {
4967     PostTimeMs: DWORD,
4968     TotalResumeTimeMs: ULONGLONG,
4969     ResumeCompleteTimestamp: ULONGLONG,
4970 }}
4971 pub type PRESUME_PERFORMANCE = *mut RESUME_PERFORMANCE;
4972 ENUM!{enum SYSTEM_POWER_CONDITION {
4973     PoAc,
4974     PoDc,
4975     PoHot,
4976     PoConditionMaximum,
4977 }}
4978 STRUCT!{struct SET_POWER_SETTING_VALUE {
4979     Version: DWORD,
4980     Guid: GUID,
4981     PowerCondition: SYSTEM_POWER_CONDITION,
4982     DataLength: DWORD,
4983     Data: [BYTE; ANYSIZE_ARRAY],
4984 }}
4985 pub type PSET_POWER_SETTING_VALUE = *mut SET_POWER_SETTING_VALUE;
4986 STRUCT!{struct NOTIFY_USER_POWER_SETTING {
4987     Guid: GUID,
4988 }}
4989 pub type PNOTIFY_USER_POWER_SETTING = *mut NOTIFY_USER_POWER_SETTING;
4990 STRUCT!{struct APPLICATIONLAUNCH_SETTING_VALUE {
4991     ActivationTime: LARGE_INTEGER,
4992     Flags: DWORD,
4993     ButtonInstanceID: DWORD,
4994 }}
4995 pub type PAPPLICATIONLAUNCH_SETTING_VALUE = *mut APPLICATIONLAUNCH_SETTING_VALUE;
4996 ENUM!{enum POWER_PLATFORM_ROLE {
4997     PlatformRoleUnspecified = 0,
4998     PlatformRoleDesktop,
4999     PlatformRoleMobile,
5000     PlatformRoleWorkstation,
5001     PlatformRoleEnterpriseServer,
5002     PlatformRoleSOHOServer,
5003     PlatformRoleAppliancePC,
5004     PlatformRolePerformanceServer,
5005     PlatformRoleSlate,
5006     PlatformRoleMaximum,
5007 }}
5008 pub type PPOWER_PLATFORM_ROLE = *mut POWER_PLATFORM_ROLE;
5009 pub const POWER_PLATFORM_ROLE_V1: ULONG = 0x00000001;
5010 pub const POWER_PLATFORM_ROLE_V1_MAX: POWER_PLATFORM_ROLE = PlatformRolePerformanceServer + 1;
5011 pub const POWER_PLATFORM_ROLE_V2: ULONG = 0x00000002;
5012 pub const POWER_PLATFORM_ROLE_V2_MAX: POWER_PLATFORM_ROLE = PlatformRoleSlate + 1;
5013 pub const POWER_PLATFORM_ROLE_VERSION: ULONG = POWER_PLATFORM_ROLE_V2;
5014 pub const POWER_PLATFORM_ROLE_VERSION_MAX: POWER_PLATFORM_ROLE = POWER_PLATFORM_ROLE_V2_MAX;
5015 STRUCT!{struct POWER_PLATFORM_INFORMATION {
5016     AoAc: BOOLEAN,
5017 }}
5018 pub type PPOWER_PLATFORM_INFORMATION = *mut POWER_PLATFORM_INFORMATION;
5019 STRUCT!{struct BATTERY_REPORTING_SCALE {
5020     Granularity: DWORD,
5021     Capacity: DWORD,
5022 }}
5023 pub type PBATTERY_REPORTING_SCALE = *mut BATTERY_REPORTING_SCALE;
5024 STRUCT!{struct PPM_WMI_LEGACY_PERFSTATE {
5025     Frequency: DWORD,
5026     Flags: DWORD,
5027     PercentFrequency: DWORD,
5028 }}
5029 pub type PPPM_WMI_LEGACY_PERFSTATE = *mut PPM_WMI_LEGACY_PERFSTATE;
5030 STRUCT!{struct PPM_WMI_IDLE_STATE {
5031     Latency: DWORD,
5032     Power: DWORD,
5033     TimeCheck: DWORD,
5034     PromotePercent: BYTE,
5035     DemotePercent: BYTE,
5036     StateType: BYTE,
5037     Reserved: BYTE,
5038     StateFlags: DWORD,
5039     Context: DWORD,
5040     IdleHandler: DWORD,
5041     Reserved1: DWORD,
5042 }}
5043 pub type PPPM_WMI_IDLE_STATE = *mut PPM_WMI_IDLE_STATE;
5044 STRUCT!{struct PPM_WMI_IDLE_STATES {
5045     Type: DWORD,
5046     Count: DWORD,
5047     TargetState: DWORD,
5048     OldState: DWORD,
5049     TargetProcessors: DWORD64,
5050     State: [PPM_WMI_IDLE_STATE; ANYSIZE_ARRAY],
5051 }}
5052 pub type PPPM_WMI_IDLE_STATES = *mut PPM_WMI_IDLE_STATES;
5053 STRUCT!{struct PPM_WMI_IDLE_STATES_EX {
5054     Type: DWORD,
5055     Count: DWORD,
5056     TargetState: DWORD,
5057     OldState: DWORD,
5058     TargetProcessors: PVOID,
5059     State: [PPM_WMI_IDLE_STATE; ANYSIZE_ARRAY],
5060 }}
5061 pub type PPPM_WMI_IDLE_STATES_EX = *mut PPM_WMI_IDLE_STATES_EX;
5062 STRUCT!{struct PPM_WMI_PERF_STATE {
5063     Frequency: DWORD,
5064     Power: DWORD,
5065     PercentFrequency: BYTE,
5066     IncreaseLevel: BYTE,
5067     DecreaseLevel: BYTE,
5068     Type: BYTE,
5069     IncreaseTime: DWORD,
5070     DecreaseTime: DWORD,
5071     Control: DWORD64,
5072     Status: DWORD64,
5073     HitCount: DWORD,
5074     Reserved1: DWORD,
5075     Reserved2: DWORD64,
5076     Reserved3: DWORD64,
5077 }}
5078 pub type PPPM_WMI_PERF_STATE = *mut PPM_WMI_PERF_STATE;
5079 STRUCT!{struct PPM_WMI_PERF_STATES {
5080     Count: DWORD,
5081     MaxFrequency: DWORD,
5082     CurrentState: DWORD,
5083     MaxPerfState: DWORD,
5084     MinPerfState: DWORD,
5085     LowestPerfState: DWORD,
5086     ThermalConstraint: DWORD,
5087     BusyAdjThreshold: BYTE,
5088     PolicyType: BYTE,
5089     Type: BYTE,
5090     Reserved: BYTE,
5091     TimerInterval: DWORD,
5092     TargetProcessors: DWORD64,
5093     PStateHandler: DWORD,
5094     PStateContext: DWORD,
5095     TStateHandler: DWORD,
5096     TStateContext: DWORD,
5097     FeedbackHandler: DWORD,
5098     Reserved1: DWORD,
5099     Reserved2: DWORD64,
5100     State: [PPM_WMI_PERF_STATE; ANYSIZE_ARRAY],
5101 }}
5102 pub type PPPM_WMI_PERF_STATES = *mut PPM_WMI_PERF_STATES;
5103 STRUCT!{struct PPM_WMI_PERF_STATES_EX {
5104     Count: DWORD,
5105     MaxFrequency: DWORD,
5106     CurrentState: DWORD,
5107     MaxPerfState: DWORD,
5108     MinPerfState: DWORD,
5109     LowestPerfState: DWORD,
5110     ThermalConstraint: DWORD,
5111     BusyAdjThreshold: BYTE,
5112     PolicyType: BYTE,
5113     Type: BYTE,
5114     Reserved: BYTE,
5115     TimerInterval: DWORD,
5116     TargetProcessors: PVOID,
5117     PStateHandler: DWORD,
5118     PStateContext: DWORD,
5119     TStateHandler: DWORD,
5120     TStateContext: DWORD,
5121     FeedbackHandler: DWORD,
5122     Reserved1: DWORD,
5123     Reserved2: DWORD64,
5124     State: [PPM_WMI_PERF_STATE; ANYSIZE_ARRAY],
5125 }}
5126 pub type PPPM_WMI_PERF_STATES_EX = *mut PPM_WMI_PERF_STATES_EX;
5127 pub const PROC_IDLE_BUCKET_COUNT: usize = 6;
5128 STRUCT!{struct PPM_IDLE_STATE_ACCOUNTING {
5129     IdleTransitions: DWORD,
5130     FailedTransitions: DWORD,
5131     InvalidBucketIndex: DWORD,
5132     TotalTime: DWORD64,
5133     IdleTimeBuckets: [DWORD; PROC_IDLE_BUCKET_COUNT],
5134 }}
5135 pub type PPPM_IDLE_STATE_ACCOUNTING = *mut PPM_IDLE_STATE_ACCOUNTING;
5136 STRUCT!{struct PPM_IDLE_ACCOUNTING {
5137     StateCount: DWORD,
5138     TotalTransitions: DWORD,
5139     ResetCount: DWORD,
5140     StartTime: DWORD64,
5141     State: [PPM_IDLE_STATE_ACCOUNTING; ANYSIZE_ARRAY],
5142 }}
5143 pub type PPPM_IDLE_ACCOUNTING = *mut PPM_IDLE_ACCOUNTING;
5144 pub const PROC_IDLE_BUCKET_COUNT_EX: usize = 16;
5145 STRUCT!{struct PPM_IDLE_STATE_BUCKET_EX {
5146     TotalTimeUs: DWORD64,
5147     MinTimeUs: DWORD,
5148     MaxTimeUs: DWORD,
5149     Count: DWORD,
5150 }}
5151 pub type PPPM_IDLE_STATE_BUCKET_EX = *mut PPM_IDLE_STATE_BUCKET_EX;
5152 STRUCT!{struct PPM_IDLE_STATE_ACCOUNTING_EX {
5153     TotalTime: DWORD64,
5154     IdleTransitions: DWORD,
5155     FailedTransitions: DWORD,
5156     InvalidBucketIndex: DWORD,
5157     MinTimeUs: DWORD,
5158     MaxTimeUs: DWORD,
5159     CancelledTransitions: DWORD,
5160     IdleTimeBuckets: [PPM_IDLE_STATE_BUCKET_EX; PROC_IDLE_BUCKET_COUNT_EX],
5161 }}
5162 pub type PPPM_IDLE_STATE_ACCOUNTING_EX = *mut PPM_IDLE_STATE_ACCOUNTING_EX;
5163 STRUCT!{struct PPM_IDLE_ACCOUNTING_EX {
5164     StateCount: DWORD,
5165     TotalTransitions: DWORD,
5166     ResetCount: DWORD,
5167     AbortCount: DWORD,
5168     StartTime: DWORD64,
5169     State: [PPM_IDLE_STATE_ACCOUNTING_EX; ANYSIZE_ARRAY],
5170 }}
5171 pub type PPPM_IDLE_ACCOUNTING_EX = *mut PPM_IDLE_ACCOUNTING_EX;
5172 pub const ACPI_PPM_SOFTWARE_ALL: DWORD = 0xFC;
5173 pub const ACPI_PPM_SOFTWARE_ANY: DWORD = 0xFD;
5174 pub const ACPI_PPM_HARDWARE_ALL: DWORD = 0xFE;
5175 pub const MS_PPM_SOFTWARE_ALL: DWORD = 0x1;
5176 pub const PPM_FIRMWARE_ACPI1C2: DWORD = 0x00000001;
5177 pub const PPM_FIRMWARE_ACPI1C3: DWORD = 0x00000002;
5178 pub const PPM_FIRMWARE_ACPI1TSTATES: DWORD = 0x00000004;
5179 pub const PPM_FIRMWARE_CST: DWORD = 0x00000008;
5180 pub const PPM_FIRMWARE_CSD: DWORD = 0x00000010;
5181 pub const PPM_FIRMWARE_PCT: DWORD = 0x00000020;
5182 pub const PPM_FIRMWARE_PSS: DWORD = 0x00000040;
5183 pub const PPM_FIRMWARE_XPSS: DWORD = 0x00000080;
5184 pub const PPM_FIRMWARE_PPC: DWORD = 0x00000100;
5185 pub const PPM_FIRMWARE_PSD: DWORD = 0x00000200;
5186 pub const PPM_FIRMWARE_PTC: DWORD = 0x00000400;
5187 pub const PPM_FIRMWARE_TSS: DWORD = 0x00000800;
5188 pub const PPM_FIRMWARE_TPC: DWORD = 0x00001000;
5189 pub const PPM_FIRMWARE_TSD: DWORD = 0x00002000;
5190 pub const PPM_FIRMWARE_PCCH: DWORD = 0x00004000;
5191 pub const PPM_FIRMWARE_PCCP: DWORD = 0x00008000;
5192 pub const PPM_FIRMWARE_OSC: DWORD = 0x00010000;
5193 pub const PPM_FIRMWARE_PDC: DWORD = 0x00020000;
5194 pub const PPM_FIRMWARE_CPC: DWORD = 0x00040000;
5195 pub const PPM_FIRMWARE_LPI: DWORD = 0x00080000;
5196 pub const PPM_PERFORMANCE_IMPLEMENTATION_NONE: DWORD = 0x00000000;
5197 pub const PPM_PERFORMANCE_IMPLEMENTATION_PSTATES: DWORD = 0x00000001;
5198 pub const PPM_PERFORMANCE_IMPLEMENTATION_PCCV1: DWORD = 0x00000002;
5199 pub const PPM_PERFORMANCE_IMPLEMENTATION_CPPC: DWORD = 0x00000003;
5200 pub const PPM_PERFORMANCE_IMPLEMENTATION_PEP: DWORD = 0x00000004;
5201 pub const PPM_IDLE_IMPLEMENTATION_NONE: DWORD = 0x00000000;
5202 pub const PPM_IDLE_IMPLEMENTATION_CSTATES: DWORD = 0x00000001;
5203 pub const PPM_IDLE_IMPLEMENTATION_PEP: DWORD = 0x00000002;
5204 pub const PPM_IDLE_IMPLEMENTATION_MICROPEP: DWORD = 0x00000003;
5205 pub const PPM_IDLE_IMPLEMENTATION_LPISTATES: DWORD = 0x00000004;
5206 DEFINE_GUID!{PPM_PERFSTATE_CHANGE_GUID,
5207     0xa5b32ddd, 0x7f39, 0x4abc, 0xb8, 0x92, 0x90, 0xe, 0x43, 0xb5, 0x9e, 0xbb}
5208 DEFINE_GUID!{PPM_PERFSTATE_DOMAIN_CHANGE_GUID,
5209     0x995e6b7f, 0xd653, 0x497a, 0xb9, 0x78, 0x36, 0xa3, 0xc, 0x29, 0xbf, 0x1}
5210 DEFINE_GUID!{PPM_IDLESTATE_CHANGE_GUID,
5211     0x4838fe4f, 0xf71c, 0x4e51, 0x9e, 0xcc, 0x84, 0x30, 0xa7, 0xac, 0x4c, 0x6c}
5212 DEFINE_GUID!{PPM_PERFSTATES_DATA_GUID,
5213     0x5708cc20, 0x7d40, 0x4bf4, 0xb4, 0xaa, 0x2b, 0x01, 0x33, 0x8d, 0x01, 0x26}
5214 DEFINE_GUID!{PPM_IDLESTATES_DATA_GUID,
5215     0xba138e10, 0xe250, 0x4ad7, 0x86, 0x16, 0xcf, 0x1a, 0x7a, 0xd4, 0x10, 0xe7}
5216 DEFINE_GUID!{PPM_IDLE_ACCOUNTING_GUID,
5217     0xe2a26f78, 0xae07, 0x4ee0, 0xa3, 0x0f, 0xce, 0x54, 0xf5, 0x5a, 0x94, 0xcd}
5218 DEFINE_GUID!{PPM_IDLE_ACCOUNTING_EX_GUID,
5219     0xd67abd39, 0x81f8, 0x4a5e, 0x81, 0x52, 0x72, 0xe3, 0x1e, 0xc9, 0x12, 0xee}
5220 DEFINE_GUID!{PPM_THERMALCONSTRAINT_GUID,
5221     0xa852c2c8, 0x1a4c, 0x423b, 0x8c, 0x2c, 0xf3, 0x0d, 0x82, 0x93, 0x1a, 0x88}
5222 DEFINE_GUID!{PPM_PERFMON_PERFSTATE_GUID,
5223     0x7fd18652, 0xcfe, 0x40d2, 0xb0, 0xa1, 0xb, 0x6, 0x6a, 0x87, 0x75, 0x9e}
5224 DEFINE_GUID!{PPM_THERMAL_POLICY_CHANGE_GUID,
5225     0x48f377b8, 0x6880, 0x4c7b, 0x8b, 0xdc, 0x38, 0x1, 0x76, 0xc6, 0x65, 0x4d}
5226 STRUCT!{struct PPM_PERFSTATE_EVENT {
5227     State: DWORD,
5228     Status: DWORD,
5229     Latency: DWORD,
5230     Speed: DWORD,
5231     Processor: DWORD,
5232 }}
5233 pub type PPPM_PERFSTATE_EVENT = *mut PPM_PERFSTATE_EVENT;
5234 STRUCT!{struct PPM_PERFSTATE_DOMAIN_EVENT {
5235     State: DWORD,
5236     Latency: DWORD,
5237     Speed: DWORD,
5238     Processors: DWORD64,
5239 }}
5240 pub type PPPM_PERFSTATE_DOMAIN_EVENT = *mut PPM_PERFSTATE_DOMAIN_EVENT;
5241 STRUCT!{struct PPM_IDLESTATE_EVENT {
5242     NewState: DWORD,
5243     OldState: DWORD,
5244     Processors: DWORD64,
5245 }}
5246 pub type PPPM_IDLESTATE_EVENT = *mut PPM_IDLESTATE_EVENT;
5247 STRUCT!{struct PPM_THERMALCHANGE_EVENT {
5248     ThermalConstraint: DWORD,
5249     Processors: DWORD64,
5250 }}
5251 pub type PPPM_THERMALCHANGE_EVENT = *mut PPM_THERMALCHANGE_EVENT;
5252 STRUCT!{struct PPM_THERMAL_POLICY_EVENT {
5253     Mode: BYTE,
5254     Processors: DWORD64,
5255 }}
5256 pub type PPPM_THERMAL_POLICY_EVENT = *mut PPM_THERMAL_POLICY_EVENT;
5257 STRUCT!{struct POWER_ACTION_POLICY {
5258     Action: POWER_ACTION,
5259     Flags: DWORD,
5260     EventCode: DWORD,
5261 }}
5262 pub type PPOWER_ACTION_POLICY = *mut POWER_ACTION_POLICY;
5263 pub const POWER_ACTION_QUERY_ALLOWED: DWORD = 0x00000001;
5264 pub const POWER_ACTION_UI_ALLOWED: DWORD = 0x00000002;
5265 pub const POWER_ACTION_OVERRIDE_APPS: DWORD = 0x00000004;
5266 pub const POWER_ACTION_HIBERBOOT: DWORD = 0x00000008;
5267 pub const POWER_ACTION_USER_NOTIFY: DWORD = 0x00000010;
5268 pub const POWER_ACTION_DOZE_TO_HIBERNATE: DWORD = 0x00000020;
5269 pub const POWER_ACTION_PSEUDO_TRANSITION: DWORD = 0x08000000;
5270 pub const POWER_ACTION_LIGHTEST_FIRST: DWORD = 0x10000000;
5271 pub const POWER_ACTION_LOCK_CONSOLE: DWORD = 0x20000000;
5272 pub const POWER_ACTION_DISABLE_WAKES: DWORD = 0x40000000;
5273 pub const POWER_ACTION_CRITICAL: DWORD = 0x80000000;
5274 pub const POWER_LEVEL_USER_NOTIFY_TEXT: DWORD = 0x00000001;
5275 pub const POWER_LEVEL_USER_NOTIFY_SOUND: DWORD = 0x00000002;
5276 pub const POWER_LEVEL_USER_NOTIFY_EXEC: DWORD = 0x00000004;
5277 pub const POWER_USER_NOTIFY_BUTTON: DWORD = 0x00000008;
5278 pub const POWER_USER_NOTIFY_SHUTDOWN: DWORD = 0x00000010;
5279 pub const POWER_USER_NOTIFY_FORCED_SHUTDOWN: DWORD = 0x00000020;
5280 pub const POWER_FORCE_TRIGGER_RESET: DWORD = 0x80000000;
5281 pub const BATTERY_DISCHARGE_FLAGS_EVENTCODE_MASK: DWORD = 0x00000007;
5282 pub const BATTERY_DISCHARGE_FLAGS_ENABLE: DWORD = 0x80000000;
5283 STRUCT!{struct SYSTEM_POWER_LEVEL {
5284     Enable: BOOLEAN,
5285     Spare: [BYTE; 3],
5286     BatteryLevel: DWORD,
5287     PowerPolicy: POWER_ACTION_POLICY,
5288     MinSystemState: SYSTEM_POWER_STATE,
5289 }}
5290 pub type PSYSTEM_POWER_LEVEL = *mut SYSTEM_POWER_LEVEL;
5291 pub const NUM_DISCHARGE_POLICIES: usize = 4;
5292 pub const DISCHARGE_POLICY_CRITICAL: DWORD = 0;
5293 pub const DISCHARGE_POLICY_LOW: DWORD = 1;
5294 STRUCT!{struct SYSTEM_POWER_POLICY {
5295     Revision: DWORD,
5296     PowerButton: POWER_ACTION_POLICY,
5297     SleepButton: POWER_ACTION_POLICY,
5298     LidClose: POWER_ACTION_POLICY,
5299     LidOpenWake: SYSTEM_POWER_STATE,
5300     Reserved: DWORD,
5301     Idle: POWER_ACTION_POLICY,
5302     IdleTimeout: DWORD,
5303     IdleSensitivity: BYTE,
5304     DynamicThrottle: BYTE,
5305     Spare2: [BYTE; 2],
5306     MinSleep: SYSTEM_POWER_STATE,
5307     MaxSleep: SYSTEM_POWER_STATE,
5308     ReducedLatencySleep: SYSTEM_POWER_STATE,
5309     WinLogonFlags: DWORD,
5310     Spare3: DWORD,
5311     DozeS4Timeout: DWORD,
5312     BroadcastCapacityResolution: DWORD,
5313     DischargePolicy: [SYSTEM_POWER_LEVEL; NUM_DISCHARGE_POLICIES],
5314     VideoTimeout: DWORD,
5315     VideoDimDisplay: BOOLEAN,
5316     VideoReserved: [DWORD; 3],
5317     SpindownTimeout: DWORD,
5318     OptimizeForPower: BOOLEAN,
5319     FanThrottleTolerance: BYTE,
5320     ForcedThrottle: BYTE,
5321     MinThrottle: BYTE,
5322     OverThrottled: POWER_ACTION_POLICY,
5323 }}
5324 pub type PSYSTEM_POWER_POLICY = *mut SYSTEM_POWER_POLICY;
5325 pub const PROCESSOR_IDLESTATE_POLICY_COUNT: usize = 0x3;
5326 STRUCT!{struct PROCESSOR_IDLESTATE_INFO {
5327     TimeCheck: DWORD,
5328     DemotePercent: BYTE,
5329     PromotePercent: BYTE,
5330     Spare: [BYTE; 2],
5331 }}
5332 pub type PPROCESSOR_IDLESTATE_INFO = *mut PROCESSOR_IDLESTATE_INFO;
5333 STRUCT!{struct PROCESSOR_IDLESTATE_POLICY_Flags {
5334     AsWORD: WORD,
5335 }}
5336 BITFIELD!{PROCESSOR_IDLESTATE_POLICY_Flags AsWORD: WORD [
5337     AllowScaling set_AllowScaling[0..1],
5338     Disabled set_Disabled[1..2],
5339     Reserved set_Reserved[2..16],
5340 ]}
5341 STRUCT!{struct PROCESSOR_IDLESTATE_POLICY {
5342     Revision: WORD,
5343     Flags: PROCESSOR_IDLESTATE_POLICY_Flags,
5344     PolicyCount: DWORD,
5345     Policy: [PROCESSOR_IDLESTATE_INFO; PROCESSOR_IDLESTATE_POLICY_COUNT],
5346 }}
5347 pub type PPROCESSOR_IDLESTATE_POLICY = *mut PROCESSOR_IDLESTATE_POLICY;
5348 pub const PO_THROTTLE_NONE: DWORD = 0;
5349 pub const PO_THROTTLE_CONSTANT: DWORD = 1;
5350 pub const PO_THROTTLE_DEGRADE: DWORD = 2;
5351 pub const PO_THROTTLE_ADAPTIVE: DWORD = 3;
5352 pub const PO_THROTTLE_MAXIMUM: DWORD = 4;
5353 STRUCT!{struct PROCESSOR_POWER_POLICY_INFO {
5354     TimeCheck: DWORD,
5355     DemoteLimit: DWORD,
5356     PromoteLimit: DWORD,
5357     DemotePercent: BYTE,
5358     PromotePercent: BYTE,
5359     Spare: [BYTE; 2],
5360     Reserved: DWORD,
5361 }}
5362 BITFIELD!{PROCESSOR_POWER_POLICY_INFO Reserved: DWORD [
5363     AllowDemotion set_AllowDemotion[0..1],
5364     AllowPromotion set_AllowPromotion[1..2],
5365     Reserved set_Reserved[2..32],
5366 ]}
5367 pub type PPROCESSOR_POWER_POLICY_INFO = *mut PROCESSOR_POWER_POLICY_INFO;
5368 STRUCT!{struct PROCESSOR_POWER_POLICY {
5369     Revision: DWORD,
5370     DynamicThrottle: BYTE,
5371     Spare: [BYTE; 3],
5372     BitFields: DWORD,
5373     PolicyCount: DWORD,
5374     Policy: [PROCESSOR_POWER_POLICY_INFO; 3],
5375 }}
5376 BITFIELD!{PROCESSOR_POWER_POLICY BitFields: DWORD [
5377     DisableCStates set_DisableCStates[0..1],
5378     Reserved set_Reserved[1..32],
5379 ]}
5380 pub type PPROCESSOR_POWER_POLICY = *mut PROCESSOR_POWER_POLICY;
5381 STRUCT!{struct PROCESSOR_PERFSTATE_POLICY_u_Flags {
5382     AsBYTE: BYTE,
5383 }}
5384 BITFIELD!{PROCESSOR_PERFSTATE_POLICY_u_Flags AsBYTE: BYTE [
5385     NoDomainAccounting set_NoDomainAccounting[0..1],
5386     IncreasePolicy set_IncreasePolicy[1..3],
5387     DecreasePolicy set_DecreasePolicy[3..5],
5388     Reserved set_Reserved[5..8],
5389 ]}
5390 UNION!{union PROCESSOR_PERFSTATE_POLICY_u {
5391     [u8; 1],
5392     Spare Spare_mut: BYTE,
5393     Flags Flags_mut: PROCESSOR_PERFSTATE_POLICY_u_Flags,
5394 }}
5395 STRUCT!{struct PROCESSOR_PERFSTATE_POLICY {
5396     Revision: DWORD,
5397     MaxThrottle: BYTE,
5398     MinThrottle: BYTE,
5399     BusyAdjThreshold: BYTE,
5400     u: PROCESSOR_PERFSTATE_POLICY_u,
5401     TimeCheck: DWORD,
5402     IncreaseTime: DWORD,
5403     DecreaseTime: DWORD,
5404     IncreasePercent: DWORD,
5405     DecreasePercent: DWORD,
5406 }}
5407 pub type PPROCESSOR_PERFSTATE_POLICY = *mut PROCESSOR_PERFSTATE_POLICY;
5408 STRUCT!{struct ADMINISTRATOR_POWER_POLICY {
5409     MinSleep: SYSTEM_POWER_STATE,
5410     MaxSleep: SYSTEM_POWER_STATE,
5411     MinVideoTimeout: DWORD,
5412     MaxVideoTimeout: DWORD,
5413     MinSpindownTimeout: DWORD,
5414     MaxSpindownTimeout: DWORD,
5415 }}
5416 pub type PADMINISTRATOR_POWER_POLICY = *mut ADMINISTRATOR_POWER_POLICY;
5417 ENUM!{enum HIBERFILE_BUCKET_SIZE {
5418     HiberFileBucket1GB = 0,
5419     HiberFileBucket2GB,
5420     HiberFileBucket4GB,
5421     HiberFileBucket8GB,
5422     HiberFileBucket16GB,
5423     HiberFileBucket32GB,
5424     HiberFileBucketUnlimited,
5425     HiberFileBucketMax,
5426 }}
5427 pub const HIBERFILE_TYPE_NONE: BYTE = 0x00;
5428 pub const HIBERFILE_TYPE_REDUCED: BYTE = 0x01;
5429 pub const HIBERFILE_TYPE_FULL: BYTE = 0x02;
5430 pub const HIBERFILE_TYPE_MAX: usize = 0x03;
5431 STRUCT!{struct HIBERFILE_BUCKET {
5432     MaxPhysicalMemory: DWORD64,
5433     PhysicalMemoryPercent: [DWORD; HIBERFILE_TYPE_MAX],
5434 }}
5435 pub type PHIBERFILE_BUCKET = *mut HIBERFILE_BUCKET;
5436 STRUCT!{struct SYSTEM_POWER_CAPABILITIES {
5437     PowerButtonPresent: BOOLEAN,
5438     SleepButtonPresent: BOOLEAN,
5439     LidPresent: BOOLEAN,
5440     SystemS1: BOOLEAN,
5441     SystemS2: BOOLEAN,
5442     SystemS3: BOOLEAN,
5443     SystemS4: BOOLEAN,
5444     SystemS5: BOOLEAN,
5445     HiberFilePresent: BOOLEAN,
5446     FullWake: BOOLEAN,
5447     VideoDimPresent: BOOLEAN,
5448     ApmPresent: BOOLEAN,
5449     UpsPresent: BOOLEAN,
5450     ThermalControl: BOOLEAN,
5451     ProcessorThrottle: BOOLEAN,
5452     ProcessorMinThrottle: BYTE,
5453     ProcessorMaxThrottle: BYTE,
5454     FastSystemS4: BOOLEAN,
5455     Hiberboot: BOOLEAN,
5456     WakeAlarmPresent: BOOLEAN,
5457     AoAc: BOOLEAN,
5458     DiskSpinDown: BOOLEAN,
5459     HiberFileType: BYTE,
5460     AoAcConnectivitySupported: BOOLEAN,
5461     spare3: [BYTE; 6],
5462     SystemBatteriesPresent: BOOLEAN,
5463     BatteriesAreShortTerm: BOOLEAN,
5464     BatteryScale: [BATTERY_REPORTING_SCALE; 3],
5465     AcOnLineWake: SYSTEM_POWER_STATE,
5466     SoftLidWake: SYSTEM_POWER_STATE,
5467     RtcWake: SYSTEM_POWER_STATE,
5468     MinDeviceWakeState: SYSTEM_POWER_STATE,
5469     DefaultLowLatencyWake: SYSTEM_POWER_STATE,
5470 }}
5471 pub type PSYSTEM_POWER_CAPABILITIES = *mut SYSTEM_POWER_CAPABILITIES;
5472 STRUCT!{struct SYSTEM_BATTERY_STATE {
5473     AcOnLine: BOOLEAN,
5474     BatteryPresent: BOOLEAN,
5475     Charging: BOOLEAN,
5476     Discharging: BOOLEAN,
5477     Spare1: [BOOLEAN; 3],
5478     Tag: BYTE,
5479     MaxCapacity: DWORD,
5480     RemainingCapacity: DWORD,
5481     Rate: DWORD,
5482     EstimatedTime: DWORD,
5483     DefaultAlert1: DWORD,
5484     DefaultAlert2: DWORD,
5485 }}
5486 pub type PSYSTEM_BATTERY_STATE = *mut SYSTEM_BATTERY_STATE;
5487 pub const IMAGE_DOS_SIGNATURE: WORD = 0x5A4D;
5488 pub const IMAGE_OS2_SIGNATURE: WORD = 0x454E;
5489 pub const IMAGE_OS2_SIGNATURE_LE: WORD = 0x454C;
5490 pub const IMAGE_VXD_SIGNATURE: WORD = 0x454C;
5491 pub const IMAGE_NT_SIGNATURE: DWORD = 0x00004550;
5492 STRUCT!{struct IMAGE_DOS_HEADER {
5493     e_magic: WORD,
5494     e_cblp: WORD,
5495     e_cp: WORD,
5496     e_crlc: WORD,
5497     e_cparhdr: WORD,
5498     e_minalloc: WORD,
5499     e_maxalloc: WORD,
5500     e_ss: WORD,
5501     e_sp: WORD,
5502     e_csum: WORD,
5503     e_ip: WORD,
5504     e_cs: WORD,
5505     e_lfarlc: WORD,
5506     e_ovno: WORD,
5507     e_res: [WORD; 4],
5508     e_oemid: WORD,
5509     e_oeminfo: WORD,
5510     e_res2: [WORD; 10],
5511     e_lfanew: LONG,
5512 }}
5513 pub type PIMAGE_DOS_HEADER = *mut IMAGE_DOS_HEADER;
5514 STRUCT!{struct IMAGE_OS2_HEADER {
5515     ne_magic: WORD,
5516     ne_ver: CHAR,
5517     ne_rev: CHAR,
5518     ne_enttab: WORD,
5519     ne_cbenttab: WORD,
5520     ne_crc: LONG,
5521     ne_flags: WORD,
5522     ne_autodata: WORD,
5523     ne_heap: WORD,
5524     ne_stack: WORD,
5525     ne_csip: LONG,
5526     ne_sssp: LONG,
5527     ne_cseg: WORD,
5528     ne_cmod: WORD,
5529     ne_cbnrestab: WORD,
5530     ne_segtab: WORD,
5531     ne_rsrctab: WORD,
5532     ne_restab: WORD,
5533     ne_modtab: WORD,
5534     ne_imptab: WORD,
5535     ne_nrestab: LONG,
5536     ne_cmovent: WORD,
5537     ne_align: WORD,
5538     ne_cres: WORD,
5539     ne_exetyp: BYTE,
5540     ne_flagsothers: BYTE,
5541     ne_pretthunks: WORD,
5542     ne_psegrefbytes: WORD,
5543     ne_swaparea: WORD,
5544     ne_expver: WORD,
5545 }}
5546 pub type PIMAGE_OS2_HEADER = *mut IMAGE_OS2_HEADER;
5547 STRUCT!{struct IMAGE_VXD_HEADER {
5548     e32_magic: WORD,
5549     e32_border: BYTE,
5550     e32_worder: BYTE,
5551     e32_level: DWORD,
5552     e32_cpu: WORD,
5553     e32_os: WORD,
5554     e32_ver: DWORD,
5555     e32_mflags: DWORD,
5556     e32_mpages: DWORD,
5557     e32_startobj: DWORD,
5558     e32_eip: DWORD,
5559     e32_stackobj: DWORD,
5560     e32_esp: DWORD,
5561     e32_pagesize: DWORD,
5562     e32_lastpagesize: DWORD,
5563     e32_fixupsize: DWORD,
5564     e32_fixupsum: DWORD,
5565     e32_ldrsize: DWORD,
5566     e32_ldrsum: DWORD,
5567     e32_objtab: DWORD,
5568     e32_objcnt: DWORD,
5569     e32_objmap: DWORD,
5570     e32_itermap: DWORD,
5571     e32_rsrctab: DWORD,
5572     e32_rsrccnt: DWORD,
5573     e32_restab: DWORD,
5574     e32_enttab: DWORD,
5575     e32_dirtab: DWORD,
5576     e32_dircnt: DWORD,
5577     e32_fpagetab: DWORD,
5578     e32_frectab: DWORD,
5579     e32_impmod: DWORD,
5580     e32_impmodcnt: DWORD,
5581     e32_impproc: DWORD,
5582     e32_pagesum: DWORD,
5583     e32_datapage: DWORD,
5584     e32_preload: DWORD,
5585     e32_nrestab: DWORD,
5586     e32_cbnrestab: DWORD,
5587     e32_nressum: DWORD,
5588     e32_autodata: DWORD,
5589     e32_debuginfo: DWORD,
5590     e32_debuglen: DWORD,
5591     e32_instpreload: DWORD,
5592     e32_instdemand: DWORD,
5593     e32_heapsize: DWORD,
5594     e32_res3: [BYTE; 12],
5595     e32_winresoff: DWORD,
5596     e32_winreslen: DWORD,
5597     e32_devid: WORD,
5598     e32_ddkver: WORD,
5599 }}
5600 pub type PIMAGE_VXD_HEADER = *mut IMAGE_VXD_HEADER;
5601 STRUCT!{struct IMAGE_FILE_HEADER {
5602     Machine: WORD,
5603     NumberOfSections: WORD,
5604     TimeDateStamp: DWORD,
5605     PointerToSymbolTable: DWORD,
5606     NumberOfSymbols: DWORD,
5607     SizeOfOptionalHeader: WORD,
5608     Characteristics: WORD,
5609 }}
5610 pub type PIMAGE_FILE_HEADER = *mut IMAGE_FILE_HEADER;
5611 pub const IMAGE_SIZEOF_FILE_HEADER: usize = 20;
5612 pub const IMAGE_FILE_RELOCS_STRIPPED: WORD = 0x0001;
5613 pub const IMAGE_FILE_EXECUTABLE_IMAGE: WORD = 0x0002;
5614 pub const IMAGE_FILE_LINE_NUMS_STRIPPED: WORD = 0x0004;
5615 pub const IMAGE_FILE_LOCAL_SYMS_STRIPPED: WORD = 0x0008;
5616 pub const IMAGE_FILE_AGGRESIVE_WS_TRIM: WORD = 0x0010;
5617 pub const IMAGE_FILE_LARGE_ADDRESS_AWARE: WORD = 0x0020;
5618 pub const IMAGE_FILE_BYTES_REVERSED_LO: WORD = 0x0080;
5619 pub const IMAGE_FILE_32BIT_MACHINE: WORD = 0x0100;
5620 pub const IMAGE_FILE_DEBUG_STRIPPED: WORD = 0x0200;
5621 pub const IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP: WORD = 0x0400;
5622 pub const IMAGE_FILE_NET_RUN_FROM_SWAP: WORD = 0x0800;
5623 pub const IMAGE_FILE_SYSTEM: WORD = 0x1000;
5624 pub const IMAGE_FILE_DLL: WORD = 0x2000;
5625 pub const IMAGE_FILE_UP_SYSTEM_ONLY: WORD = 0x4000;
5626 pub const IMAGE_FILE_BYTES_REVERSED_HI: WORD = 0x8000;
5627 pub const IMAGE_FILE_MACHINE_UNKNOWN: WORD = 0;
5628 pub const IMAGE_FILE_MACHINE_TARGET_HOST: WORD = 0x0001;
5629 pub const IMAGE_FILE_MACHINE_I386: WORD = 0x014c;
5630 pub const IMAGE_FILE_MACHINE_R3000: WORD = 0x0162;
5631 pub const IMAGE_FILE_MACHINE_R4000: WORD = 0x0166;
5632 pub const IMAGE_FILE_MACHINE_R10000: WORD = 0x0168;
5633 pub const IMAGE_FILE_MACHINE_WCEMIPSV2: WORD = 0x0169;
5634 pub const IMAGE_FILE_MACHINE_ALPHA: WORD = 0x0184;
5635 pub const IMAGE_FILE_MACHINE_SH3: WORD = 0x01a2;
5636 pub const IMAGE_FILE_MACHINE_SH3DSP: WORD = 0x01a3;
5637 pub const IMAGE_FILE_MACHINE_SH3E: WORD = 0x01a4;
5638 pub const IMAGE_FILE_MACHINE_SH4: WORD = 0x01a6;
5639 pub const IMAGE_FILE_MACHINE_SH5: WORD = 0x01a8;
5640 pub const IMAGE_FILE_MACHINE_ARM: WORD = 0x01c0;
5641 pub const IMAGE_FILE_MACHINE_THUMB: WORD = 0x01c2;
5642 pub const IMAGE_FILE_MACHINE_ARMNT: WORD = 0x01c4;
5643 pub const IMAGE_FILE_MACHINE_AM33: WORD = 0x01d3;
5644 pub const IMAGE_FILE_MACHINE_POWERPC: WORD = 0x01F0;
5645 pub const IMAGE_FILE_MACHINE_POWERPCFP: WORD = 0x01f1;
5646 pub const IMAGE_FILE_MACHINE_IA64: WORD = 0x0200;
5647 pub const IMAGE_FILE_MACHINE_MIPS16: WORD = 0x0266;
5648 pub const IMAGE_FILE_MACHINE_ALPHA64: WORD = 0x0284;
5649 pub const IMAGE_FILE_MACHINE_MIPSFPU: WORD = 0x0366;
5650 pub const IMAGE_FILE_MACHINE_MIPSFPU16: WORD = 0x0466;
5651 pub const IMAGE_FILE_MACHINE_AXP64: WORD = IMAGE_FILE_MACHINE_ALPHA64;
5652 pub const IMAGE_FILE_MACHINE_TRICORE: WORD = 0x0520;
5653 pub const IMAGE_FILE_MACHINE_CEF: WORD = 0x0CEF;
5654 pub const IMAGE_FILE_MACHINE_EBC: WORD = 0x0EBC;
5655 pub const IMAGE_FILE_MACHINE_AMD64: WORD = 0x8664;
5656 pub const IMAGE_FILE_MACHINE_M32R: WORD = 0x9041;
5657 pub const IMAGE_FILE_MACHINE_ARM64: WORD = 0xAA64;
5658 pub const IMAGE_FILE_MACHINE_CEE: WORD = 0xC0EE;
5659 STRUCT!{struct IMAGE_DATA_DIRECTORY {
5660     VirtualAddress: DWORD,
5661     Size: DWORD,
5662 }}
5663 pub type PIMAGE_DATA_DIRECTORY = *mut IMAGE_DATA_DIRECTORY;
5664 pub const IMAGE_NUMBEROF_DIRECTORY_ENTRIES: usize = 16;
5665 STRUCT!{struct IMAGE_OPTIONAL_HEADER32 {
5666     Magic: WORD,
5667     MajorLinkerVersion: BYTE,
5668     MinorLinkerVersion: BYTE,
5669     SizeOfCode: DWORD,
5670     SizeOfInitializedData: DWORD,
5671     SizeOfUninitializedData: DWORD,
5672     AddressOfEntryPoint: DWORD,
5673     BaseOfCode: DWORD,
5674     BaseOfData: DWORD,
5675     ImageBase: DWORD,
5676     SectionAlignment: DWORD,
5677     FileAlignment: DWORD,
5678     MajorOperatingSystemVersion: WORD,
5679     MinorOperatingSystemVersion: WORD,
5680     MajorImageVersion: WORD,
5681     MinorImageVersion: WORD,
5682     MajorSubsystemVersion: WORD,
5683     MinorSubsystemVersion: WORD,
5684     Win32VersionValue: DWORD,
5685     SizeOfImage: DWORD,
5686     SizeOfHeaders: DWORD,
5687     CheckSum: DWORD,
5688     Subsystem: WORD,
5689     DllCharacteristics: WORD,
5690     SizeOfStackReserve: DWORD,
5691     SizeOfStackCommit: DWORD,
5692     SizeOfHeapReserve: DWORD,
5693     SizeOfHeapCommit: DWORD,
5694     LoaderFlags: DWORD,
5695     NumberOfRvaAndSizes: DWORD,
5696     DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES],
5697 }}
5698 pub type PIMAGE_OPTIONAL_HEADER32 = *mut IMAGE_OPTIONAL_HEADER32;
5699 STRUCT!{struct IMAGE_ROM_OPTIONAL_HEADER {
5700     Magic: WORD,
5701     MajorLinkerVersion: BYTE,
5702     MinorLinkerVersion: BYTE,
5703     SizeOfCode: DWORD,
5704     SizeOfInitializedData: DWORD,
5705     SizeOfUninitializedData: DWORD,
5706     AddressOfEntryPoint: DWORD,
5707     BaseOfCode: DWORD,
5708     BaseOfData: DWORD,
5709     BaseOfBss: DWORD,
5710     GprMask: DWORD,
5711     CprMask: [DWORD; 4],
5712     GpValue: DWORD,
5713 }}
5714 pub type PIMAGE_ROM_OPTIONAL_HEADER = *mut IMAGE_ROM_OPTIONAL_HEADER;
5715 STRUCT!{struct IMAGE_OPTIONAL_HEADER64 {
5716     Magic: WORD,
5717     MajorLinkerVersion: BYTE,
5718     MinorLinkerVersion: BYTE,
5719     SizeOfCode: DWORD,
5720     SizeOfInitializedData: DWORD,
5721     SizeOfUninitializedData: DWORD,
5722     AddressOfEntryPoint: DWORD,
5723     BaseOfCode: DWORD,
5724     ImageBase: ULONGLONG,
5725     SectionAlignment: DWORD,
5726     FileAlignment: DWORD,
5727     MajorOperatingSystemVersion: WORD,
5728     MinorOperatingSystemVersion: WORD,
5729     MajorImageVersion: WORD,
5730     MinorImageVersion: WORD,
5731     MajorSubsystemVersion: WORD,
5732     MinorSubsystemVersion: WORD,
5733     Win32VersionValue: DWORD,
5734     SizeOfImage: DWORD,
5735     SizeOfHeaders: DWORD,
5736     CheckSum: DWORD,
5737     Subsystem: WORD,
5738     DllCharacteristics: WORD,
5739     SizeOfStackReserve: ULONGLONG,
5740     SizeOfStackCommit: ULONGLONG,
5741     SizeOfHeapReserve: ULONGLONG,
5742     SizeOfHeapCommit: ULONGLONG,
5743     LoaderFlags: DWORD,
5744     NumberOfRvaAndSizes: DWORD,
5745     DataDirectory: [IMAGE_DATA_DIRECTORY; IMAGE_NUMBEROF_DIRECTORY_ENTRIES],
5746 }}
5747 pub type PIMAGE_OPTIONAL_HEADER64 = *mut IMAGE_OPTIONAL_HEADER64;
5748 pub const IMAGE_NT_OPTIONAL_HDR32_MAGIC: WORD = 0x10b;
5749 pub const IMAGE_NT_OPTIONAL_HDR64_MAGIC: WORD = 0x20b;
5750 pub const IMAGE_ROM_OPTIONAL_HDR_MAGIC: WORD = 0x107;
5751 #[cfg(target_pointer_width = "64")]
5752 IFDEF!{
5753 pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER64;
5754 pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER64;
5755 pub const IMAGE_NT_OPTIONAL_HDR_MAGIC: WORD = IMAGE_NT_OPTIONAL_HDR64_MAGIC;
5756 }
5757 #[cfg(target_pointer_width = "32")]
5758 IFDEF!{
5759 pub type IMAGE_OPTIONAL_HEADER = IMAGE_OPTIONAL_HEADER32;
5760 pub type PIMAGE_OPTIONAL_HEADER = PIMAGE_OPTIONAL_HEADER32;
5761 pub const IMAGE_NT_OPTIONAL_HDR_MAGIC: WORD = IMAGE_NT_OPTIONAL_HDR32_MAGIC;
5762 }
5763 STRUCT!{struct IMAGE_NT_HEADERS64 {
5764     Signature: DWORD,
5765     FileHeader: IMAGE_FILE_HEADER,
5766     OptionalHeader: IMAGE_OPTIONAL_HEADER64,
5767 }}
5768 pub type PIMAGE_NT_HEADERS64 = *mut IMAGE_NT_HEADERS64;
5769 STRUCT!{struct IMAGE_NT_HEADERS32 {
5770     Signature: DWORD,
5771     FileHeader: IMAGE_FILE_HEADER,
5772     OptionalHeader: IMAGE_OPTIONAL_HEADER32,
5773 }}
5774 pub type PIMAGE_NT_HEADERS32 = *mut IMAGE_NT_HEADERS32;
5775 STRUCT!{struct IMAGE_ROM_HEADERS {
5776     FileHeader: IMAGE_FILE_HEADER,
5777     OptionalHeader: IMAGE_ROM_OPTIONAL_HEADER,
5778 }}
5779 pub type PIMAGE_ROM_HEADERS = *mut IMAGE_ROM_HEADERS;
5780 #[cfg(target_pointer_width = "64")]
5781 IFDEF!{
5782 pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS64;
5783 pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS64;
5784 }
5785 #[cfg(target_pointer_width = "32")]
5786 IFDEF!{
5787 pub type IMAGE_NT_HEADERS = IMAGE_NT_HEADERS32;
5788 pub type PIMAGE_NT_HEADERS = PIMAGE_NT_HEADERS32;
5789 }
5790 pub const IMAGE_SUBSYSTEM_UNKNOWN: WORD = 0;
5791 pub const IMAGE_SUBSYSTEM_NATIVE: WORD = 1;
5792 pub const IMAGE_SUBSYSTEM_WINDOWS_GUI: WORD = 2;
5793 pub const IMAGE_SUBSYSTEM_WINDOWS_CUI: WORD = 3;
5794 pub const IMAGE_SUBSYSTEM_OS2_CUI: WORD = 5;
5795 pub const IMAGE_SUBSYSTEM_POSIX_CUI: WORD = 7;
5796 pub const IMAGE_SUBSYSTEM_NATIVE_WINDOWS: WORD = 8;
5797 pub const IMAGE_SUBSYSTEM_WINDOWS_CE_GUI: WORD = 9;
5798 pub const IMAGE_SUBSYSTEM_EFI_APPLICATION: WORD = 10;
5799 pub const IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER: WORD = 11;
5800 pub const IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER: WORD = 12;
5801 pub const IMAGE_SUBSYSTEM_EFI_ROM: WORD = 13;
5802 pub const IMAGE_SUBSYSTEM_XBOX: WORD = 14;
5803 pub const IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION: WORD = 16;
5804 pub const IMAGE_SUBSYSTEM_XBOX_CODE_CATALOG: WORD = 17;
5805 pub const IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA: WORD = 0x0020;
5806 pub const IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE: WORD = 0x0040;
5807 pub const IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY: WORD = 0x0080;
5808 pub const IMAGE_DLLCHARACTERISTICS_NX_COMPAT: WORD = 0x0100;
5809 pub const IMAGE_DLLCHARACTERISTICS_NO_ISOLATION: WORD = 0x0200;
5810 pub const IMAGE_DLLCHARACTERISTICS_NO_SEH: WORD = 0x0400;
5811 pub const IMAGE_DLLCHARACTERISTICS_NO_BIND: WORD = 0x0800;
5812 pub const IMAGE_DLLCHARACTERISTICS_APPCONTAINER: WORD = 0x1000;
5813 pub const IMAGE_DLLCHARACTERISTICS_WDM_DRIVER: WORD = 0x2000;
5814 pub const IMAGE_DLLCHARACTERISTICS_GUARD_CF: WORD = 0x4000;
5815 pub const IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE: WORD = 0x8000;
5816 pub const IMAGE_DIRECTORY_ENTRY_EXPORT: WORD = 0;
5817 pub const IMAGE_DIRECTORY_ENTRY_IMPORT: WORD = 1;
5818 pub const IMAGE_DIRECTORY_ENTRY_RESOURCE: WORD = 2;
5819 pub const IMAGE_DIRECTORY_ENTRY_EXCEPTION: WORD = 3;
5820 pub const IMAGE_DIRECTORY_ENTRY_SECURITY: WORD = 4;
5821 pub const IMAGE_DIRECTORY_ENTRY_BASERELOC: WORD = 5;
5822 pub const IMAGE_DIRECTORY_ENTRY_DEBUG: WORD = 6;
5823 pub const IMAGE_DIRECTORY_ENTRY_ARCHITECTURE: WORD = 7;
5824 pub const IMAGE_DIRECTORY_ENTRY_GLOBALPTR: WORD = 8;
5825 pub const IMAGE_DIRECTORY_ENTRY_TLS: WORD = 9;
5826 pub const IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG: WORD = 10;
5827 pub const IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT: WORD = 11;
5828 pub const IMAGE_DIRECTORY_ENTRY_IAT: WORD = 12;
5829 pub const IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT: WORD = 13;
5830 pub const IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR: WORD = 14;
5831 STRUCT!{struct ANON_OBJECT_HEADER {
5832     Sig1: WORD,
5833     Sig2: WORD,
5834     Version: WORD,
5835     Machine: WORD,
5836     TimeDateStamp: DWORD,
5837     ClassID: CLSID,
5838     SizeOfData: DWORD,
5839 }}
5840 STRUCT!{struct ANON_OBJECT_HEADER_V2 {
5841     Sig1: WORD,
5842     Sig2: WORD,
5843     Version: WORD,
5844     Machine: WORD,
5845     TimeDateStamp: DWORD,
5846     ClassID: CLSID,
5847     SizeOfData: DWORD,
5848     Flags: DWORD,
5849     MetaDataSize: DWORD,
5850     MetaDataOffset: DWORD,
5851 }}
5852 STRUCT!{struct ANON_OBJECT_HEADER_BIGOBJ {
5853     Sig1: WORD,
5854     Sig2: WORD,
5855     Version: WORD,
5856     Machine: WORD,
5857     TimeDateStamp: DWORD,
5858     ClassID: CLSID,
5859     SizeOfData: DWORD,
5860     Flags: DWORD,
5861     MetaDataSize: DWORD,
5862     MetaDataOffset: DWORD,
5863     NumberOfSections: DWORD,
5864     PointerToSymbolTable: DWORD,
5865     NumberOfSymbols: DWORD,
5866 }}
5867 pub const IMAGE_SIZEOF_SHORT_NAME: usize = 8;
5868 UNION!{union IMAGE_SECTION_HEADER_Misc {
5869     [u32; 1],
5870     PhysicalAddress PhysicalAddress_mut: DWORD,
5871     VirtualSize VirtualSize_mut: DWORD,
5872 }}
5873 STRUCT!{struct IMAGE_SECTION_HEADER {
5874     Name: [BYTE; IMAGE_SIZEOF_SHORT_NAME],
5875     Misc: IMAGE_SECTION_HEADER_Misc,
5876     VirtualAddress: DWORD,
5877     SizeOfRawData: DWORD,
5878     PointerToRawData: DWORD,
5879     PointerToRelocations: DWORD,
5880     PointerToLinenumbers: DWORD,
5881     NumberOfRelocations: WORD,
5882     NumberOfLinenumbers: WORD,
5883     Characteristics: DWORD,
5884 }}
5885 pub type PIMAGE_SECTION_HEADER = *mut IMAGE_SECTION_HEADER;
5886 pub const IMAGE_SIZEOF_SECTION_HEADER: usize = 40;
5887 pub const IMAGE_SCN_TYPE_NO_PAD: DWORD = 0x00000008;
5888 pub const IMAGE_SCN_CNT_CODE: DWORD = 0x00000020;
5889 pub const IMAGE_SCN_CNT_INITIALIZED_DATA: DWORD = 0x00000040;
5890 pub const IMAGE_SCN_CNT_UNINITIALIZED_DATA: DWORD = 0x00000080;
5891 pub const IMAGE_SCN_LNK_OTHER: DWORD = 0x00000100;
5892 pub const IMAGE_SCN_LNK_INFO: DWORD = 0x00000200;
5893 pub const IMAGE_SCN_LNK_REMOVE: DWORD = 0x00000800;
5894 pub const IMAGE_SCN_LNK_COMDAT: DWORD = 0x00001000;
5895 pub const IMAGE_SCN_NO_DEFER_SPEC_EXC: DWORD = 0x00004000;
5896 pub const IMAGE_SCN_GPREL: DWORD = 0x00008000;
5897 pub const IMAGE_SCN_MEM_FARDATA: DWORD = 0x00008000;
5898 pub const IMAGE_SCN_MEM_PURGEABLE: DWORD = 0x00020000;
5899 pub const IMAGE_SCN_MEM_16BIT: DWORD = 0x00020000;
5900 pub const IMAGE_SCN_MEM_LOCKED: DWORD = 0x00040000;
5901 pub const IMAGE_SCN_MEM_PRELOAD: DWORD = 0x00080000;
5902 pub const IMAGE_SCN_ALIGN_1BYTES: DWORD = 0x00100000;
5903 pub const IMAGE_SCN_ALIGN_2BYTES: DWORD = 0x00200000;
5904 pub const IMAGE_SCN_ALIGN_4BYTES: DWORD = 0x00300000;
5905 pub const IMAGE_SCN_ALIGN_8BYTES: DWORD = 0x00400000;
5906 pub const IMAGE_SCN_ALIGN_16BYTES: DWORD = 0x00500000;
5907 pub const IMAGE_SCN_ALIGN_32BYTES: DWORD = 0x00600000;
5908 pub const IMAGE_SCN_ALIGN_64BYTES: DWORD = 0x00700000;
5909 pub const IMAGE_SCN_ALIGN_128BYTES: DWORD = 0x00800000;
5910 pub const IMAGE_SCN_ALIGN_256BYTES: DWORD = 0x00900000;
5911 pub const IMAGE_SCN_ALIGN_512BYTES: DWORD = 0x00A00000;
5912 pub const IMAGE_SCN_ALIGN_1024BYTES: DWORD = 0x00B00000;
5913 pub const IMAGE_SCN_ALIGN_2048BYTES: DWORD = 0x00C00000;
5914 pub const IMAGE_SCN_ALIGN_4096BYTES: DWORD = 0x00D00000;
5915 pub const IMAGE_SCN_ALIGN_8192BYTES: DWORD = 0x00E00000;
5916 pub const IMAGE_SCN_ALIGN_MASK: DWORD = 0x00F00000;
5917 pub const IMAGE_SCN_LNK_NRELOC_OVFL: DWORD = 0x01000000;
5918 pub const IMAGE_SCN_MEM_DISCARDABLE: DWORD = 0x02000000;
5919 pub const IMAGE_SCN_MEM_NOT_CACHED: DWORD = 0x04000000;
5920 pub const IMAGE_SCN_MEM_NOT_PAGED: DWORD = 0x08000000;
5921 pub const IMAGE_SCN_MEM_SHARED: DWORD = 0x10000000;
5922 pub const IMAGE_SCN_MEM_EXECUTE: DWORD = 0x20000000;
5923 pub const IMAGE_SCN_MEM_READ: DWORD = 0x40000000;
5924 pub const IMAGE_SCN_MEM_WRITE: DWORD = 0x80000000;
5925 pub const IMAGE_SCN_SCALE_INDEX: DWORD = 0x00000001;
5926 STRUCT!{struct IMAGE_SYMBOL_N_Name {
5927     Short: DWORD,
5928     Long: DWORD,
5929 }}
5930 UNION!{union IMAGE_SYMBOL_N {
5931     [u32; 2],
5932     ShortName ShortName_mut: [BYTE; 8],
5933     Name Name_mut: IMAGE_SYMBOL_N_Name,
5934     LongName LongName_mut: [DWORD; 2],
5935 }}
5936 STRUCT!{struct IMAGE_SYMBOL {
5937     N: IMAGE_SYMBOL_N,
5938     Value: DWORD,
5939     SectionNumber: SHORT,
5940     Type: WORD,
5941     StorageClass: BYTE,
5942     NumberOfAuxSymbols: BYTE,
5943 }}
5944 pub type PIMAGE_SYMBOL = *mut IMAGE_SYMBOL;
5945 pub const IMAGE_SIZEOF_SYMBOL: usize = 18;
5946 STRUCT!{struct IMAGE_SYMBOL_EX_N_Name {
5947     Short: DWORD,
5948     Long: DWORD,
5949 }}
5950 UNION!{union IMAGE_SYMBOL_EX_N {
5951     [u32; 2],
5952     ShortName ShortName_mut: [BYTE; 8],
5953     Name Name_mut: IMAGE_SYMBOL_EX_N_Name,
5954     LongName LongName_mut: [DWORD; 2],
5955 }}
5956 STRUCT!{struct IMAGE_SYMBOL_EX {
5957     N: IMAGE_SYMBOL_EX_N,
5958     Value: DWORD,
5959     SectionNumber: LONG,
5960     Type: WORD,
5961     StorageClass: BYTE,
5962     NumberOfAuxSymbols: BYTE,
5963 }}
5964 pub type PIMAGE_SYMBOL_EX = *mut IMAGE_SYMBOL_EX;
5965 pub const IMAGE_SYM_UNDEFINED: SHORT = 0;
5966 pub const IMAGE_SYM_ABSOLUTE: SHORT = -1;
5967 pub const IMAGE_SYM_DEBUG: SHORT = -2;
5968 pub const IMAGE_SYM_SECTION_MAX: USHORT = 0xFEFF;
5969 pub const IMAGE_SYM_SECTION_MAX_EX: LONG = MAXLONG;
5970 pub const IMAGE_SYM_TYPE_NULL: WORD = 0x0000;
5971 pub const IMAGE_SYM_TYPE_VOID: WORD = 0x0001;
5972 pub const IMAGE_SYM_TYPE_CHAR: WORD = 0x0002;
5973 pub const IMAGE_SYM_TYPE_SHORT: WORD = 0x0003;
5974 pub const IMAGE_SYM_TYPE_INT: WORD = 0x0004;
5975 pub const IMAGE_SYM_TYPE_LONG: WORD = 0x0005;
5976 pub const IMAGE_SYM_TYPE_FLOAT: WORD = 0x0006;
5977 pub const IMAGE_SYM_TYPE_DOUBLE: WORD = 0x0007;
5978 pub const IMAGE_SYM_TYPE_STRUCT: WORD = 0x0008;
5979 pub const IMAGE_SYM_TYPE_UNION: WORD = 0x0009;
5980 pub const IMAGE_SYM_TYPE_ENUM: WORD = 0x000A;
5981 pub const IMAGE_SYM_TYPE_MOE: WORD = 0x000B;
5982 pub const IMAGE_SYM_TYPE_BYTE: WORD = 0x000C;
5983 pub const IMAGE_SYM_TYPE_WORD: WORD = 0x000D;
5984 pub const IMAGE_SYM_TYPE_UINT: WORD = 0x000E;
5985 pub const IMAGE_SYM_TYPE_DWORD: WORD = 0x000F;
5986 pub const IMAGE_SYM_TYPE_PCODE: WORD = 0x8000;
5987 pub const IMAGE_SYM_DTYPE_NULL: WORD = 0;
5988 pub const IMAGE_SYM_DTYPE_POINTER: WORD = 1;
5989 pub const IMAGE_SYM_DTYPE_FUNCTION: WORD = 2;
5990 pub const IMAGE_SYM_DTYPE_ARRAY: WORD = 3;
5991 pub const IMAGE_SYM_CLASS_END_OF_FUNCTION: BYTE = -1i8 as u8;
5992 pub const IMAGE_SYM_CLASS_NULL: BYTE = 0x0000;
5993 pub const IMAGE_SYM_CLASS_AUTOMATIC: BYTE = 0x0001;
5994 pub const IMAGE_SYM_CLASS_EXTERNAL: BYTE = 0x0002;
5995 pub const IMAGE_SYM_CLASS_STATIC: BYTE = 0x0003;
5996 pub const IMAGE_SYM_CLASS_REGISTER: BYTE = 0x0004;
5997 pub const IMAGE_SYM_CLASS_EXTERNAL_DEF: BYTE = 0x0005;
5998 pub const IMAGE_SYM_CLASS_LABEL: BYTE = 0x0006;
5999 pub const IMAGE_SYM_CLASS_UNDEFINED_LABEL: BYTE = 0x0007;
6000 pub const IMAGE_SYM_CLASS_MEMBER_OF_STRUCT: BYTE = 0x0008;
6001 pub const IMAGE_SYM_CLASS_ARGUMENT: BYTE = 0x0009;
6002 pub const IMAGE_SYM_CLASS_STRUCT_TAG: BYTE = 0x000A;
6003 pub const IMAGE_SYM_CLASS_MEMBER_OF_UNION: BYTE = 0x000B;
6004 pub const IMAGE_SYM_CLASS_UNION_TAG: BYTE = 0x000C;
6005 pub const IMAGE_SYM_CLASS_TYPE_DEFINITION: BYTE = 0x000D;
6006 pub const IMAGE_SYM_CLASS_UNDEFINED_STATIC: BYTE = 0x000E;
6007 pub const IMAGE_SYM_CLASS_ENUM_TAG: BYTE = 0x000F;
6008 pub const IMAGE_SYM_CLASS_MEMBER_OF_ENUM: BYTE = 0x0010;
6009 pub const IMAGE_SYM_CLASS_REGISTER_PARAM: BYTE = 0x0011;
6010 pub const IMAGE_SYM_CLASS_BIT_FIELD: BYTE = 0x0012;
6011 pub const IMAGE_SYM_CLASS_FAR_EXTERNAL: BYTE = 0x0044;
6012 pub const IMAGE_SYM_CLASS_BLOCK: BYTE = 0x0064;
6013 pub const IMAGE_SYM_CLASS_FUNCTION: BYTE = 0x0065;
6014 pub const IMAGE_SYM_CLASS_END_OF_STRUCT: BYTE = 0x0066;
6015 pub const IMAGE_SYM_CLASS_FILE: BYTE = 0x0067;
6016 pub const IMAGE_SYM_CLASS_SECTION: BYTE = 0x0068;
6017 pub const IMAGE_SYM_CLASS_WEAK_EXTERNAL: BYTE = 0x0069;
6018 pub const IMAGE_SYM_CLASS_CLR_TOKEN: BYTE = 0x006B;
6019 pub const N_BTMASK: WORD = 0x000F;
6020 pub const N_TMASK: WORD = 0x0030;
6021 pub const N_TMASK1: WORD = 0x00C0;
6022 pub const N_TMASK2: WORD = 0x00F0;
6023 pub const N_BTSHFT: usize = 4;
6024 pub const N_TSHIFT: usize = 2;
6025 #[inline]
BTYPE(x: WORD) -> bool6026 pub fn BTYPE(x: WORD) -> bool {
6027     (x & N_BTMASK) != 0
6028 }
6029 #[inline]
ISPTR(x: WORD) -> bool6030 pub fn ISPTR(x: WORD) -> bool {
6031     (x & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)
6032 }
6033 #[inline]
ISFCN(x: WORD) -> bool6034 pub fn ISFCN(x: WORD) -> bool {
6035     (x & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)
6036 }
6037 #[inline]
ISARY(x: WORD) -> bool6038 pub fn ISARY(x: WORD) -> bool {
6039     (x & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)
6040 }
6041 #[inline]
ISTAG(x: BYTE) -> bool6042 pub fn ISTAG(x: BYTE) -> bool {
6043     (x == IMAGE_SYM_CLASS_STRUCT_TAG) || (x == IMAGE_SYM_CLASS_UNION_TAG)
6044     || (x == IMAGE_SYM_CLASS_ENUM_TAG)
6045 }
6046 #[inline]
INCREF(x: WORD) -> WORD6047 pub fn INCREF(x: WORD) -> WORD {
6048     ((x & !N_BTMASK) << N_TSHIFT) | (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) | (x & N_BTMASK)
6049 }
6050 #[inline]
DECREF(x: WORD) -> WORD6051 pub fn DECREF(x: WORD) -> WORD {
6052     ((x >> N_TSHIFT) & !N_BTMASK) | (x & N_BTMASK)
6053 }
6054 STRUCT!{struct IMAGE_AUX_SYMBOL_TOKEN_DEF {
6055     bAuxType: BYTE,
6056     bReserved: BYTE,
6057     SymbolTableIndex: DWORD,
6058     rgbReserved: [BYTE; 12],
6059 }}
6060 pub type PIMAGE_AUX_SYMBOL_TOKEN_DEF = *mut IMAGE_AUX_SYMBOL_TOKEN_DEF;
6061 STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_Misc_LnSz {
6062     Linenumber: WORD,
6063     Size: WORD,
6064 }}
6065 UNION!{union IMAGE_AUX_SYMBOL_Sym_Misc {
6066     [u32; 1],
6067     LnSz LnSz_mut: IMAGE_AUX_SYMBOL_Sym_Misc_LnSz,
6068     TotalSize TotalSize_mut: DWORD,
6069 }}
6070 STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_FcnAry_Function {
6071     PointerToLinenumber: DWORD,
6072     PointerToNextFunction: DWORD,
6073 }}
6074 STRUCT!{struct IMAGE_AUX_SYMBOL_Sym_FcnAry_Array {
6075     Dimension: [WORD; 4],
6076 }}
6077 UNION!{union IMAGE_AUX_SYMBOL_Sym_FcnAry {
6078     [u32; 2],
6079     Function Function_mut: IMAGE_AUX_SYMBOL_Sym_FcnAry_Function,
6080     Array Array_mut: IMAGE_AUX_SYMBOL_Sym_FcnAry_Array,
6081 }}
6082 STRUCT!{struct IMAGE_AUX_SYMBOL_Sym {
6083     TagIndex: DWORD,
6084     Misc: IMAGE_AUX_SYMBOL_Sym_Misc,
6085     FcnAry: IMAGE_AUX_SYMBOL_Sym_FcnAry,
6086     TvIndex: WORD,
6087 }}
6088 STRUCT!{struct IMAGE_AUX_SYMBOL_File {
6089     Name: [BYTE; IMAGE_SIZEOF_SYMBOL],
6090 }}
6091 STRUCT!{struct IMAGE_AUX_SYMBOL_Section {
6092     Length: DWORD,
6093     NumberOfRelocations: WORD,
6094     NumberOfLinenumbers: WORD,
6095     CheckSum: DWORD,
6096     Number: SHORT,
6097     Selection: BYTE,
6098     bReserved: BYTE,
6099     HighNumber: SHORT,
6100 }}
6101 STRUCT!{struct IMAGE_AUX_SYMBOL_CRC {
6102     crc: DWORD,
6103     rgbReserved: [BYTE; 14],
6104 }}
6105 STRUCT!{struct IMAGE_AUX_SYMBOL {
6106     Sym: IMAGE_AUX_SYMBOL_Sym,
6107     File: IMAGE_AUX_SYMBOL_File,
6108     Section: IMAGE_AUX_SYMBOL_Section,
6109     TokenDef: IMAGE_AUX_SYMBOL_TOKEN_DEF,
6110     CRC: IMAGE_AUX_SYMBOL_CRC,
6111 }}
6112 pub type PIMAGE_AUX_SYMBOL = *mut IMAGE_AUX_SYMBOL;
6113 STRUCT!{struct IMAGE_AUX_SYMBOL_EX_Sym {
6114     WeakDefaultSymIndex: DWORD,
6115     WeakSearchType: DWORD,
6116     rgbReserved: [BYTE; 12],
6117 }}
6118 STRUCT!{struct IMAGE_AUX_SYMBOL_EX_File {
6119     Name: [BYTE; 20],
6120 }}
6121 STRUCT!{struct IMAGE_AUX_SYMBOL_EX_Section {
6122     Length: DWORD,
6123     NumberOfRelocations: WORD,
6124     NumberOfLinenumbers: WORD,
6125     CheckSum: DWORD,
6126     Number: SHORT,
6127     Selection: BYTE,
6128     bReserved: BYTE,
6129     HighNumber: SHORT,
6130     rgbReserved: [BYTE; 2],
6131 }}
6132 STRUCT!{struct IMAGE_AUX_SYMBOL_EX_s {
6133     TokenDef: IMAGE_AUX_SYMBOL_TOKEN_DEF,
6134     rgbReserved: [BYTE; 2],
6135 }}
6136 STRUCT!{struct IMAGE_AUX_SYMBOL_EX_CRC {
6137     crc: DWORD,
6138     rgbReserved: [BYTE; 16],
6139 }}
6140 STRUCT!{struct IMAGE_AUX_SYMBOL_EX {
6141     Sym: IMAGE_AUX_SYMBOL_EX_Sym,
6142     File: IMAGE_AUX_SYMBOL_EX_File,
6143     Section: IMAGE_AUX_SYMBOL_EX_Section,
6144     s: IMAGE_AUX_SYMBOL_EX_s,
6145     CRC: IMAGE_AUX_SYMBOL_EX_CRC,
6146 }}
6147 pub type PIMAGE_AUX_SYMBOL_EX = *mut IMAGE_AUX_SYMBOL_EX;
6148 ENUM!{enum IMAGE_AUX_SYMBOL_TYPE {
6149     IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1,
6150 }}
6151 pub const IMAGE_COMDAT_SELECT_NODUPLICATES: BYTE = 1;
6152 pub const IMAGE_COMDAT_SELECT_ANY: BYTE = 2;
6153 pub const IMAGE_COMDAT_SELECT_SAME_SIZE: BYTE = 3;
6154 pub const IMAGE_COMDAT_SELECT_EXACT_MATCH: BYTE = 4;
6155 pub const IMAGE_COMDAT_SELECT_ASSOCIATIVE: BYTE = 5;
6156 pub const IMAGE_COMDAT_SELECT_LARGEST: BYTE = 6;
6157 pub const IMAGE_COMDAT_SELECT_NEWEST: BYTE = 7;
6158 pub const IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY: BYTE = 1;
6159 pub const IMAGE_WEAK_EXTERN_SEARCH_LIBRARY: BYTE = 2;
6160 pub const IMAGE_WEAK_EXTERN_SEARCH_ALIAS: BYTE = 3;
6161 UNION!{union IMAGE_RELOCATION_u {
6162     [u32; 1],
6163     VirtualAddress VirtualAddress_mut: DWORD,
6164     RelocCount RelocCount_mut: DWORD,
6165 }}
6166 STRUCT!{struct IMAGE_RELOCATION {
6167     u: IMAGE_RELOCATION_u,
6168     SymbolTableIndex: DWORD,
6169     Type: WORD,
6170 }}
6171 pub type PIMAGE_RELOCATION = *mut IMAGE_RELOCATION;
6172 pub const IMAGE_REL_I386_ABSOLUTE: WORD = 0x0000;
6173 pub const IMAGE_REL_I386_DIR16: WORD = 0x0001;
6174 pub const IMAGE_REL_I386_REL16: WORD = 0x0002;
6175 pub const IMAGE_REL_I386_DIR32: WORD = 0x0006;
6176 pub const IMAGE_REL_I386_DIR32NB: WORD = 0x0007;
6177 pub const IMAGE_REL_I386_SEG12: WORD = 0x0009;
6178 pub const IMAGE_REL_I386_SECTION: WORD = 0x000A;
6179 pub const IMAGE_REL_I386_SECREL: WORD = 0x000B;
6180 pub const IMAGE_REL_I386_TOKEN: WORD = 0x000C;
6181 pub const IMAGE_REL_I386_SECREL7: WORD = 0x000D;
6182 pub const IMAGE_REL_I386_REL32: WORD = 0x0014;
6183 pub const IMAGE_REL_MIPS_ABSOLUTE: WORD = 0x0000;
6184 pub const IMAGE_REL_MIPS_REFHALF: WORD = 0x0001;
6185 pub const IMAGE_REL_MIPS_REFWORD: WORD = 0x0002;
6186 pub const IMAGE_REL_MIPS_JMPADDR: WORD = 0x0003;
6187 pub const IMAGE_REL_MIPS_REFHI: WORD = 0x0004;
6188 pub const IMAGE_REL_MIPS_REFLO: WORD = 0x0005;
6189 pub const IMAGE_REL_MIPS_GPREL: WORD = 0x0006;
6190 pub const IMAGE_REL_MIPS_LITERAL: WORD = 0x0007;
6191 pub const IMAGE_REL_MIPS_SECTION: WORD = 0x000A;
6192 pub const IMAGE_REL_MIPS_SECREL: WORD = 0x000B;
6193 pub const IMAGE_REL_MIPS_SECRELLO: WORD = 0x000C;
6194 pub const IMAGE_REL_MIPS_SECRELHI: WORD = 0x000D;
6195 pub const IMAGE_REL_MIPS_TOKEN: WORD = 0x000E;
6196 pub const IMAGE_REL_MIPS_JMPADDR16: WORD = 0x0010;
6197 pub const IMAGE_REL_MIPS_REFWORDNB: WORD = 0x0022;
6198 pub const IMAGE_REL_MIPS_PAIR: WORD = 0x0025;
6199 pub const IMAGE_REL_ALPHA_ABSOLUTE: WORD = 0x0000;
6200 pub const IMAGE_REL_ALPHA_REFLONG: WORD = 0x0001;
6201 pub const IMAGE_REL_ALPHA_REFQUAD: WORD = 0x0002;
6202 pub const IMAGE_REL_ALPHA_GPREL32: WORD = 0x0003;
6203 pub const IMAGE_REL_ALPHA_LITERAL: WORD = 0x0004;
6204 pub const IMAGE_REL_ALPHA_LITUSE: WORD = 0x0005;
6205 pub const IMAGE_REL_ALPHA_GPDISP: WORD = 0x0006;
6206 pub const IMAGE_REL_ALPHA_BRADDR: WORD = 0x0007;
6207 pub const IMAGE_REL_ALPHA_HINT: WORD = 0x0008;
6208 pub const IMAGE_REL_ALPHA_INLINE_REFLONG: WORD = 0x0009;
6209 pub const IMAGE_REL_ALPHA_REFHI: WORD = 0x000A;
6210 pub const IMAGE_REL_ALPHA_REFLO: WORD = 0x000B;
6211 pub const IMAGE_REL_ALPHA_PAIR: WORD = 0x000C;
6212 pub const IMAGE_REL_ALPHA_MATCH: WORD = 0x000D;
6213 pub const IMAGE_REL_ALPHA_SECTION: WORD = 0x000E;
6214 pub const IMAGE_REL_ALPHA_SECREL: WORD = 0x000F;
6215 pub const IMAGE_REL_ALPHA_REFLONGNB: WORD = 0x0010;
6216 pub const IMAGE_REL_ALPHA_SECRELLO: WORD = 0x0011;
6217 pub const IMAGE_REL_ALPHA_SECRELHI: WORD = 0x0012;
6218 pub const IMAGE_REL_ALPHA_REFQ3: WORD = 0x0013;
6219 pub const IMAGE_REL_ALPHA_REFQ2: WORD = 0x0014;
6220 pub const IMAGE_REL_ALPHA_REFQ1: WORD = 0x0015;
6221 pub const IMAGE_REL_ALPHA_GPRELLO: WORD = 0x0016;
6222 pub const IMAGE_REL_ALPHA_GPRELHI: WORD = 0x0017;
6223 pub const IMAGE_REL_PPC_ABSOLUTE: WORD = 0x0000;
6224 pub const IMAGE_REL_PPC_ADDR64: WORD = 0x0001;
6225 pub const IMAGE_REL_PPC_ADDR32: WORD = 0x0002;
6226 pub const IMAGE_REL_PPC_ADDR24: WORD = 0x0003;
6227 pub const IMAGE_REL_PPC_ADDR16: WORD = 0x0004;
6228 pub const IMAGE_REL_PPC_ADDR14: WORD = 0x0005;
6229 pub const IMAGE_REL_PPC_REL24: WORD = 0x0006;
6230 pub const IMAGE_REL_PPC_REL14: WORD = 0x0007;
6231 pub const IMAGE_REL_PPC_TOCREL16: WORD = 0x0008;
6232 pub const IMAGE_REL_PPC_TOCREL14: WORD = 0x0009;
6233 pub const IMAGE_REL_PPC_ADDR32NB: WORD = 0x000A;
6234 pub const IMAGE_REL_PPC_SECREL: WORD = 0x000B;
6235 pub const IMAGE_REL_PPC_SECTION: WORD = 0x000C;
6236 pub const IMAGE_REL_PPC_IFGLUE: WORD = 0x000D;
6237 pub const IMAGE_REL_PPC_IMGLUE: WORD = 0x000E;
6238 pub const IMAGE_REL_PPC_SECREL16: WORD = 0x000F;
6239 pub const IMAGE_REL_PPC_REFHI: WORD = 0x0010;
6240 pub const IMAGE_REL_PPC_REFLO: WORD = 0x0011;
6241 pub const IMAGE_REL_PPC_PAIR: WORD = 0x0012;
6242 pub const IMAGE_REL_PPC_SECRELLO: WORD = 0x0013;
6243 pub const IMAGE_REL_PPC_SECRELHI: WORD = 0x0014;
6244 pub const IMAGE_REL_PPC_GPREL: WORD = 0x0015;
6245 pub const IMAGE_REL_PPC_TOKEN: WORD = 0x0016;
6246 pub const IMAGE_REL_PPC_TYPEMASK: WORD = 0x00FF;
6247 pub const IMAGE_REL_PPC_NEG: WORD = 0x0100;
6248 pub const IMAGE_REL_PPC_BRTAKEN: WORD = 0x0200;
6249 pub const IMAGE_REL_PPC_BRNTAKEN: WORD = 0x0400;
6250 pub const IMAGE_REL_PPC_TOCDEFN: WORD = 0x0800;
6251 pub const IMAGE_REL_SH3_ABSOLUTE: WORD = 0x0000;
6252 pub const IMAGE_REL_SH3_DIRECT16: WORD = 0x0001;
6253 pub const IMAGE_REL_SH3_DIRECT32: WORD = 0x0002;
6254 pub const IMAGE_REL_SH3_DIRECT8: WORD = 0x0003;
6255 pub const IMAGE_REL_SH3_DIRECT8_WORD: WORD = 0x0004;
6256 pub const IMAGE_REL_SH3_DIRECT8_LONG: WORD = 0x0005;
6257 pub const IMAGE_REL_SH3_DIRECT4: WORD = 0x0006;
6258 pub const IMAGE_REL_SH3_DIRECT4_WORD: WORD = 0x0007;
6259 pub const IMAGE_REL_SH3_DIRECT4_LONG: WORD = 0x0008;
6260 pub const IMAGE_REL_SH3_PCREL8_WORD: WORD = 0x0009;
6261 pub const IMAGE_REL_SH3_PCREL8_LONG: WORD = 0x000A;
6262 pub const IMAGE_REL_SH3_PCREL12_WORD: WORD = 0x000B;
6263 pub const IMAGE_REL_SH3_STARTOF_SECTION: WORD = 0x000C;
6264 pub const IMAGE_REL_SH3_SIZEOF_SECTION: WORD = 0x000D;
6265 pub const IMAGE_REL_SH3_SECTION: WORD = 0x000E;
6266 pub const IMAGE_REL_SH3_SECREL: WORD = 0x000F;
6267 pub const IMAGE_REL_SH3_DIRECT32_NB: WORD = 0x0010;
6268 pub const IMAGE_REL_SH3_GPREL4_LONG: WORD = 0x0011;
6269 pub const IMAGE_REL_SH3_TOKEN: WORD = 0x0012;
6270 pub const IMAGE_REL_SHM_PCRELPT: WORD = 0x0013;
6271 pub const IMAGE_REL_SHM_REFLO: WORD = 0x0014;
6272 pub const IMAGE_REL_SHM_REFHALF: WORD = 0x0015;
6273 pub const IMAGE_REL_SHM_RELLO: WORD = 0x0016;
6274 pub const IMAGE_REL_SHM_RELHALF: WORD = 0x0017;
6275 pub const IMAGE_REL_SHM_PAIR: WORD = 0x0018;
6276 pub const IMAGE_REL_SH_NOMODE: WORD = 0x8000;
6277 pub const IMAGE_REL_ARM_ABSOLUTE: WORD = 0x0000;
6278 pub const IMAGE_REL_ARM_ADDR32: WORD = 0x0001;
6279 pub const IMAGE_REL_ARM_ADDR32NB: WORD = 0x0002;
6280 pub const IMAGE_REL_ARM_BRANCH24: WORD = 0x0003;
6281 pub const IMAGE_REL_ARM_BRANCH11: WORD = 0x0004;
6282 pub const IMAGE_REL_ARM_TOKEN: WORD = 0x0005;
6283 pub const IMAGE_REL_ARM_GPREL12: WORD = 0x0006;
6284 pub const IMAGE_REL_ARM_GPREL7: WORD = 0x0007;
6285 pub const IMAGE_REL_ARM_BLX24: WORD = 0x0008;
6286 pub const IMAGE_REL_ARM_BLX11: WORD = 0x0009;
6287 pub const IMAGE_REL_ARM_SECTION: WORD = 0x000E;
6288 pub const IMAGE_REL_ARM_SECREL: WORD = 0x000F;
6289 pub const IMAGE_REL_ARM_MOV32A: WORD = 0x0010;
6290 pub const IMAGE_REL_ARM_MOV32: WORD = 0x0010;
6291 pub const IMAGE_REL_ARM_MOV32T: WORD = 0x0011;
6292 pub const IMAGE_REL_THUMB_MOV32: WORD = 0x0011;
6293 pub const IMAGE_REL_ARM_BRANCH20T: WORD = 0x0012;
6294 pub const IMAGE_REL_THUMB_BRANCH20: WORD = 0x0012;
6295 pub const IMAGE_REL_ARM_BRANCH24T: WORD = 0x0014;
6296 pub const IMAGE_REL_THUMB_BRANCH24: WORD = 0x0014;
6297 pub const IMAGE_REL_ARM_BLX23T: WORD = 0x0015;
6298 pub const IMAGE_REL_THUMB_BLX23: WORD = 0x0015;
6299 pub const IMAGE_REL_AM_ABSOLUTE: WORD = 0x0000;
6300 pub const IMAGE_REL_AM_ADDR32: WORD = 0x0001;
6301 pub const IMAGE_REL_AM_ADDR32NB: WORD = 0x0002;
6302 pub const IMAGE_REL_AM_CALL32: WORD = 0x0003;
6303 pub const IMAGE_REL_AM_FUNCINFO: WORD = 0x0004;
6304 pub const IMAGE_REL_AM_REL32_1: WORD = 0x0005;
6305 pub const IMAGE_REL_AM_REL32_2: WORD = 0x0006;
6306 pub const IMAGE_REL_AM_SECREL: WORD = 0x0007;
6307 pub const IMAGE_REL_AM_SECTION: WORD = 0x0008;
6308 pub const IMAGE_REL_AM_TOKEN: WORD = 0x0009;
6309 pub const IMAGE_REL_ARM64_ABSOLUTE: WORD = 0x0000;
6310 pub const IMAGE_REL_ARM64_ADDR32: WORD = 0x0001;
6311 pub const IMAGE_REL_ARM64_ADDR32NB: WORD = 0x0002;
6312 pub const IMAGE_REL_ARM64_BRANCH26: WORD = 0x0003;
6313 pub const IMAGE_REL_ARM64_PAGEBASE_REL21: WORD = 0x0004;
6314 pub const IMAGE_REL_ARM64_REL21: WORD = 0x0005;
6315 pub const IMAGE_REL_ARM64_PAGEOFFSET_12A: WORD = 0x0006;
6316 pub const IMAGE_REL_ARM64_PAGEOFFSET_12L: WORD = 0x0007;
6317 pub const IMAGE_REL_ARM64_SECREL: WORD = 0x0008;
6318 pub const IMAGE_REL_ARM64_SECREL_LOW12A: WORD = 0x0009;
6319 pub const IMAGE_REL_ARM64_SECREL_HIGH12A: WORD = 0x000A;
6320 pub const IMAGE_REL_ARM64_SECREL_LOW12L: WORD = 0x000B;
6321 pub const IMAGE_REL_ARM64_TOKEN: WORD = 0x000C;
6322 pub const IMAGE_REL_ARM64_SECTION: WORD = 0x000D;
6323 pub const IMAGE_REL_ARM64_ADDR64: WORD = 0x000E;
6324 pub const IMAGE_REL_ARM64_BRANCH19: WORD = 0x000F;
6325 pub const IMAGE_REL_AMD64_ABSOLUTE: WORD = 0x0000;
6326 pub const IMAGE_REL_AMD64_ADDR64: WORD = 0x0001;
6327 pub const IMAGE_REL_AMD64_ADDR32: WORD = 0x0002;
6328 pub const IMAGE_REL_AMD64_ADDR32NB: WORD = 0x0003;
6329 pub const IMAGE_REL_AMD64_REL32: WORD = 0x0004;
6330 pub const IMAGE_REL_AMD64_REL32_1: WORD = 0x0005;
6331 pub const IMAGE_REL_AMD64_REL32_2: WORD = 0x0006;
6332 pub const IMAGE_REL_AMD64_REL32_3: WORD = 0x0007;
6333 pub const IMAGE_REL_AMD64_REL32_4: WORD = 0x0008;
6334 pub const IMAGE_REL_AMD64_REL32_5: WORD = 0x0009;
6335 pub const IMAGE_REL_AMD64_SECTION: WORD = 0x000A;
6336 pub const IMAGE_REL_AMD64_SECREL: WORD = 0x000B;
6337 pub const IMAGE_REL_AMD64_SECREL7: WORD = 0x000C;
6338 pub const IMAGE_REL_AMD64_TOKEN: WORD = 0x000D;
6339 pub const IMAGE_REL_AMD64_SREL32: WORD = 0x000E;
6340 pub const IMAGE_REL_AMD64_PAIR: WORD = 0x000F;
6341 pub const IMAGE_REL_AMD64_SSPAN32: WORD = 0x0010;
6342 pub const IMAGE_REL_IA64_ABSOLUTE: WORD = 0x0000;
6343 pub const IMAGE_REL_IA64_IMM14: WORD = 0x0001;
6344 pub const IMAGE_REL_IA64_IMM22: WORD = 0x0002;
6345 pub const IMAGE_REL_IA64_IMM64: WORD = 0x0003;
6346 pub const IMAGE_REL_IA64_DIR32: WORD = 0x0004;
6347 pub const IMAGE_REL_IA64_DIR64: WORD = 0x0005;
6348 pub const IMAGE_REL_IA64_PCREL21B: WORD = 0x0006;
6349 pub const IMAGE_REL_IA64_PCREL21M: WORD = 0x0007;
6350 pub const IMAGE_REL_IA64_PCREL21F: WORD = 0x0008;
6351 pub const IMAGE_REL_IA64_GPREL22: WORD = 0x0009;
6352 pub const IMAGE_REL_IA64_LTOFF22: WORD = 0x000A;
6353 pub const IMAGE_REL_IA64_SECTION: WORD = 0x000B;
6354 pub const IMAGE_REL_IA64_SECREL22: WORD = 0x000C;
6355 pub const IMAGE_REL_IA64_SECREL64I: WORD = 0x000D;
6356 pub const IMAGE_REL_IA64_SECREL32: WORD = 0x000E;
6357 pub const IMAGE_REL_IA64_DIR32NB: WORD = 0x0010;
6358 pub const IMAGE_REL_IA64_SREL14: WORD = 0x0011;
6359 pub const IMAGE_REL_IA64_SREL22: WORD = 0x0012;
6360 pub const IMAGE_REL_IA64_SREL32: WORD = 0x0013;
6361 pub const IMAGE_REL_IA64_UREL32: WORD = 0x0014;
6362 pub const IMAGE_REL_IA64_PCREL60X: WORD = 0x0015;
6363 pub const IMAGE_REL_IA64_PCREL60B: WORD = 0x0016;
6364 pub const IMAGE_REL_IA64_PCREL60F: WORD = 0x0017;
6365 pub const IMAGE_REL_IA64_PCREL60I: WORD = 0x0018;
6366 pub const IMAGE_REL_IA64_PCREL60M: WORD = 0x0019;
6367 pub const IMAGE_REL_IA64_IMMGPREL64: WORD = 0x001A;
6368 pub const IMAGE_REL_IA64_TOKEN: WORD = 0x001B;
6369 pub const IMAGE_REL_IA64_GPREL32: WORD = 0x001C;
6370 pub const IMAGE_REL_IA64_ADDEND: WORD = 0x001F;
6371 pub const IMAGE_REL_CEF_ABSOLUTE: WORD = 0x0000;
6372 pub const IMAGE_REL_CEF_ADDR32: WORD = 0x0001;
6373 pub const IMAGE_REL_CEF_ADDR64: WORD = 0x0002;
6374 pub const IMAGE_REL_CEF_ADDR32NB: WORD = 0x0003;
6375 pub const IMAGE_REL_CEF_SECTION: WORD = 0x0004;
6376 pub const IMAGE_REL_CEF_SECREL: WORD = 0x0005;
6377 pub const IMAGE_REL_CEF_TOKEN: WORD = 0x0006;
6378 pub const IMAGE_REL_CEE_ABSOLUTE: WORD = 0x0000;
6379 pub const IMAGE_REL_CEE_ADDR32: WORD = 0x0001;
6380 pub const IMAGE_REL_CEE_ADDR64: WORD = 0x0002;
6381 pub const IMAGE_REL_CEE_ADDR32NB: WORD = 0x0003;
6382 pub const IMAGE_REL_CEE_SECTION: WORD = 0x0004;
6383 pub const IMAGE_REL_CEE_SECREL: WORD = 0x0005;
6384 pub const IMAGE_REL_CEE_TOKEN: WORD = 0x0006;
6385 pub const IMAGE_REL_M32R_ABSOLUTE: WORD = 0x0000;
6386 pub const IMAGE_REL_M32R_ADDR32: WORD = 0x0001;
6387 pub const IMAGE_REL_M32R_ADDR32NB: WORD = 0x0002;
6388 pub const IMAGE_REL_M32R_ADDR24: WORD = 0x0003;
6389 pub const IMAGE_REL_M32R_GPREL16: WORD = 0x0004;
6390 pub const IMAGE_REL_M32R_PCREL24: WORD = 0x0005;
6391 pub const IMAGE_REL_M32R_PCREL16: WORD = 0x0006;
6392 pub const IMAGE_REL_M32R_PCREL8: WORD = 0x0007;
6393 pub const IMAGE_REL_M32R_REFHALF: WORD = 0x0008;
6394 pub const IMAGE_REL_M32R_REFHI: WORD = 0x0009;
6395 pub const IMAGE_REL_M32R_REFLO: WORD = 0x000A;
6396 pub const IMAGE_REL_M32R_PAIR: WORD = 0x000B;
6397 pub const IMAGE_REL_M32R_SECTION: WORD = 0x000C;
6398 pub const IMAGE_REL_M32R_SECREL32: WORD = 0x000D;
6399 pub const IMAGE_REL_M32R_TOKEN: WORD = 0x000E;
6400 pub const IMAGE_REL_EBC_ABSOLUTE: WORD = 0x0000;
6401 pub const IMAGE_REL_EBC_ADDR32NB: WORD = 0x0001;
6402 pub const IMAGE_REL_EBC_REL32: WORD = 0x0002;
6403 pub const IMAGE_REL_EBC_SECTION: WORD = 0x0003;
6404 pub const IMAGE_REL_EBC_SECREL: WORD = 0x0004;
6405 UNION!{union IMAGE_LINENUMBER_Type {
6406     [u32; 1],
6407     SymbolTableIndex SymbolTableIndex_mut: DWORD,
6408     VirtualAddress VirtualAddress_mut: DWORD,
6409 }}
6410 STRUCT!{struct IMAGE_LINENUMBER {
6411     Type: IMAGE_LINENUMBER_Type,
6412     Linenumber: WORD,
6413 }}
6414 pub type PIMAGE_LINENUMBER = *mut IMAGE_LINENUMBER;
6415 STRUCT!{struct IMAGE_BASE_RELOCATION {
6416     VirtualAddress: DWORD,
6417     SizeOfBlock: DWORD,
6418 }}
6419 pub type PIMAGE_BASE_RELOCATION = *mut IMAGE_BASE_RELOCATION;
6420 pub const IMAGE_REL_BASED_ABSOLUTE: WORD = 0;
6421 pub const IMAGE_REL_BASED_HIGH: WORD = 1;
6422 pub const IMAGE_REL_BASED_LOW: WORD = 2;
6423 pub const IMAGE_REL_BASED_HIGHLOW: WORD = 3;
6424 pub const IMAGE_REL_BASED_HIGHADJ: WORD = 4;
6425 pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_5: WORD = 5;
6426 pub const IMAGE_REL_BASED_RESERVED: WORD = 6;
6427 pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_7: WORD = 7;
6428 pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_8: WORD = 8;
6429 pub const IMAGE_REL_BASED_MACHINE_SPECIFIC_9: WORD = 9;
6430 pub const IMAGE_REL_BASED_DIR64: WORD = 10;
6431 pub const IMAGE_REL_BASED_IA64_IMM64: WORD = 9;
6432 pub const IMAGE_REL_BASED_MIPS_JMPADDR: WORD = 5;
6433 pub const IMAGE_REL_BASED_MIPS_JMPADDR16: WORD = 9;
6434 pub const IMAGE_REL_BASED_ARM_MOV32: WORD = 5;
6435 pub const IMAGE_REL_BASED_THUMB_MOV32: WORD = 7;
6436 pub const IMAGE_ARCHIVE_START_SIZE: usize = 8;
6437 pub const IMAGE_ARCHIVE_START: &'static str = "!<arch>\n";
6438 pub const IMAGE_ARCHIVE_END: &'static str = "`\n";
6439 pub const IMAGE_ARCHIVE_PAD: &'static str = "\n";
6440 pub const IMAGE_ARCHIVE_LINKER_MEMBER: &'static str = "/               ";
6441 pub const IMAGE_ARCHIVE_LONGNAMES_MEMBER: &'static str = "//              ";
6442 pub const IMAGE_ARCHIVE_HYBRIDMAP_MEMBER: &'static str = "/<HYBRIDMAP>/   ";
6443 STRUCT!{struct IMAGE_ARCHIVE_MEMBER_HEADER {
6444     Name: [BYTE; 16],
6445     Date: [BYTE; 12],
6446     UserID: [BYTE; 6],
6447     GroupID: [BYTE; 6],
6448     Mode: [BYTE; 8],
6449     Size: [BYTE; 10],
6450     EndHeader: [BYTE; 2],
6451 }}
6452 pub type PIMAGE_ARCHIVE_MEMBER_HEADER = *mut IMAGE_ARCHIVE_MEMBER_HEADER;
6453 pub const IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR: usize = 60;
6454 STRUCT!{struct IMAGE_EXPORT_DIRECTORY {
6455     Characteristics: DWORD,
6456     TimeDateStamp: DWORD,
6457     MajorVersion: WORD,
6458     MinorVersion: WORD,
6459     Name: DWORD,
6460     Base: DWORD,
6461     NumberOfFunctions: DWORD,
6462     NumberOfNames: DWORD,
6463     AddressOfFunctions: DWORD,
6464     AddressOfNames: DWORD,
6465     AddressOfNameOrdinals: DWORD,
6466 }}
6467 pub type PIMAGE_EXPORT_DIRECTORY = *mut IMAGE_EXPORT_DIRECTORY;
6468 STRUCT!{struct IMAGE_IMPORT_BY_NAME {
6469     Hint: WORD,
6470     Name: [CHAR; 1],
6471 }}
6472 pub type PIMAGE_IMPORT_BY_NAME = *mut IMAGE_IMPORT_BY_NAME;
6473 UNION!{union IMAGE_THUNK_DATA64_u1 {
6474     [u64; 1],
6475     ForwarderString ForwarderString_mut: ULONGLONG,
6476     Function Function_mut: ULONGLONG,
6477     Ordinal Ordinal_mut: ULONGLONG,
6478     AddressOfData AddressOfData_mut: ULONGLONG,
6479 }}
6480 STRUCT!{struct IMAGE_THUNK_DATA64 {
6481     u1: IMAGE_THUNK_DATA64_u1,
6482 }}
6483 pub type PIMAGE_THUNK_DATA64 = *mut IMAGE_THUNK_DATA64;
6484 UNION!{union IMAGE_THUNK_DATA32_u1 {
6485     [u32; 1],
6486     ForwarderString ForwarderString_mut: DWORD,
6487     Function Function_mut: DWORD,
6488     Ordinal Ordinal_mut: DWORD,
6489     AddressOfData AddressOfData_mut: DWORD,
6490 }}
6491 STRUCT!{struct IMAGE_THUNK_DATA32 {
6492     u1: IMAGE_THUNK_DATA32_u1,
6493 }}
6494 pub type PIMAGE_THUNK_DATA32 = *mut IMAGE_THUNK_DATA32;
6495 pub const IMAGE_ORDINAL_FLAG64: ULONGLONG = 0x8000000000000000;
6496 pub const IMAGE_ORDINAL_FLAG32: DWORD = 0x80000000;
6497 #[inline]
IMAGE_ORDINAL64(Ordinal: ULONGLONG) -> ULONGLONG6498 pub fn IMAGE_ORDINAL64(Ordinal: ULONGLONG) -> ULONGLONG {
6499     Ordinal & 0xffff
6500 }
6501 #[inline]
IMAGE_ORDINAL32(Ordinal: DWORD) -> DWORD6502 pub fn IMAGE_ORDINAL32(Ordinal: DWORD) -> DWORD {
6503     Ordinal & 0xffff
6504 }
6505 #[inline]
IMAGE_SNAP_BY_ORDINAL64(Ordinal: ULONGLONG) -> bool6506 pub fn IMAGE_SNAP_BY_ORDINAL64(Ordinal: ULONGLONG) -> bool {
6507     (Ordinal & IMAGE_ORDINAL_FLAG64) != 0
6508 }
6509 #[inline]
IMAGE_SNAP_BY_ORDINAL32(Ordinal: DWORD) -> bool6510 pub fn IMAGE_SNAP_BY_ORDINAL32(Ordinal: DWORD) -> bool {
6511     (Ordinal & IMAGE_ORDINAL_FLAG32) != 0
6512 }
6513 FN!{stdcall PIMAGE_TLS_CALLBACK(
6514     DllHandle: PVOID,
6515     Reason: DWORD,
6516     Reserved: PVOID,
6517 ) -> ()}
6518 STRUCT!{struct IMAGE_TLS_DIRECTORY64 {
6519     StartAddressOfRawData: ULONGLONG,
6520     EndAddressOfRawData: ULONGLONG,
6521     AddressOfIndex: ULONGLONG,
6522     AddressOfCallBacks: ULONGLONG,
6523     SizeOfZeroFill: DWORD,
6524     Characteristics: DWORD,
6525 }}
6526 BITFIELD!{IMAGE_TLS_DIRECTORY64 Characteristics: DWORD [
6527     Reserved0 set_Reserved0[0..20],
6528     Alignment set_Alignment[20..24],
6529     Reserved1 set_Reserved1[24..32],
6530 ]}
6531 pub type PIMAGE_TLS_DIRECTORY64 = *mut IMAGE_TLS_DIRECTORY64;
6532 STRUCT!{struct IMAGE_TLS_DIRECTORY32 {
6533     StartAddressOfRawData: DWORD,
6534     EndAddressOfRawData: DWORD,
6535     AddressOfIndex: DWORD,
6536     AddressOfCallBacks: DWORD,
6537     SizeOfZeroFill: DWORD,
6538     Characteristics: DWORD,
6539 }}
6540 BITFIELD!{IMAGE_TLS_DIRECTORY32 Characteristics: DWORD [
6541     Reserved0 set_Reserved0[0..20],
6542     Alignment set_Alignment[20..24],
6543     Reserved1 set_Reserved1[24..32],
6544 ]}
6545 pub type PIMAGE_TLS_DIRECTORY32 = *mut IMAGE_TLS_DIRECTORY32;
6546 #[cfg(target_pointer_width = "64")]
6547 IFDEF!{
6548 pub const IMAGE_ORDINAL_FLAG: ULONGLONG = IMAGE_ORDINAL_FLAG64;
6549 #[inline]
6550 pub fn IMAGE_ORDINAL(Ordinal: ULONGLONG) -> ULONGLONG {
6551     IMAGE_ORDINAL64(Ordinal)
6552 }
6553 pub type IMAGE_THUNK_DATA = IMAGE_THUNK_DATA64;
6554 pub type PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA64;
6555 #[inline]
6556 pub fn IMAGE_SNAP_BY_ORDINAL(Ordinal: ULONGLONG) -> bool {
6557     IMAGE_SNAP_BY_ORDINAL64(Ordinal)
6558 }
6559 pub type IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY64;
6560 pub type PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY64;
6561 }
6562 #[cfg(target_pointer_width = "32")]
6563 IFDEF!{
6564 pub const IMAGE_ORDINAL_FLAG: DWORD = IMAGE_ORDINAL_FLAG32;
6565 #[inline]
6566 pub fn IMAGE_ORDINAL(Ordinal: DWORD) -> DWORD {
6567     IMAGE_ORDINAL32(Ordinal)
6568 }
6569 pub type IMAGE_THUNK_DATA = IMAGE_THUNK_DATA32;
6570 pub type PIMAGE_THUNK_DATA = PIMAGE_THUNK_DATA32;
6571 #[inline]
6572 pub fn IMAGE_SNAP_BY_ORDINAL(Ordinal: DWORD) -> bool {
6573     IMAGE_SNAP_BY_ORDINAL32(Ordinal)
6574 }
6575 pub type IMAGE_TLS_DIRECTORY = IMAGE_TLS_DIRECTORY32;
6576 pub type PIMAGE_TLS_DIRECTORY = PIMAGE_TLS_DIRECTORY32;
6577 }
6578 UNION!{union IMAGE_IMPORT_DESCRIPTOR_u {
6579     [u32; 1],
6580     Characteristics Characteristics_mut: DWORD,
6581     OriginalFirstThunk OriginalFirstThunk_mut: DWORD,
6582 }}
6583 STRUCT!{struct IMAGE_IMPORT_DESCRIPTOR {
6584     u: IMAGE_IMPORT_DESCRIPTOR_u,
6585     TimeDateStamp: DWORD,
6586     ForwarderChain: DWORD,
6587     Name: DWORD,
6588     FirstThunk: DWORD,
6589 }}
6590 pub type PIMAGE_IMPORT_DESCRIPTOR = *mut IMAGE_IMPORT_DESCRIPTOR;
6591 STRUCT!{struct IMAGE_BOUND_IMPORT_DESCRIPTOR {
6592     TimeDateStamp: DWORD,
6593     OffsetModuleName: WORD,
6594     NumberOfModuleForwarderRefs: WORD,
6595 }}
6596 pub type PIMAGE_BOUND_IMPORT_DESCRIPTOR = *mut IMAGE_BOUND_IMPORT_DESCRIPTOR;
6597 STRUCT!{struct IMAGE_BOUND_FORWARDER_REF {
6598     TimeDateStamp: DWORD,
6599     OffsetModuleName: WORD,
6600     Reserved: WORD,
6601 }}
6602 pub type PIMAGE_BOUND_FORWARDER_REF = *mut IMAGE_BOUND_FORWARDER_REF;
6603 STRUCT!{struct IMAGE_DELAYLOAD_DESCRIPTOR_Attributes {
6604     AllAttributes: DWORD,
6605 }}
6606 BITFIELD!{IMAGE_DELAYLOAD_DESCRIPTOR_Attributes AllAttributes: DWORD [
6607     RvaBased set_RvaBased[0..1],
6608     ReservedAttributes set_ReservedAttributes[1..32],
6609 ]}
6610 STRUCT!{struct IMAGE_DELAYLOAD_DESCRIPTOR {
6611     Attributes: IMAGE_DELAYLOAD_DESCRIPTOR_Attributes,
6612     DllNameRVA: DWORD,
6613     ModuleHandleRVA: DWORD,
6614     ImportAddressTableRVA: DWORD,
6615     ImportNameTableRVA: DWORD,
6616     BoundImportAddressTableRVA: DWORD,
6617     UnloadInformationTableRVA: DWORD,
6618     TimeDateStamp: DWORD,
6619 }}
6620 pub type PIMAGE_DELAYLOAD_DESCRIPTOR = *mut IMAGE_DELAYLOAD_DESCRIPTOR;
6621 pub type PCIMAGE_DELAYLOAD_DESCRIPTOR = *const IMAGE_DELAYLOAD_DESCRIPTOR;
6622 STRUCT!{struct IMAGE_RESOURCE_DIRECTORY {
6623     Characteristics: DWORD,
6624     TimeDateStamp: DWORD,
6625     MajorVersion: WORD,
6626     MinorVersion: WORD,
6627     NumberOfNamedEntries: WORD,
6628     NumberOfIdEntries: WORD,
6629 }}
6630 pub type PIMAGE_RESOURCE_DIRECTORY = *mut IMAGE_RESOURCE_DIRECTORY;
6631 pub const IMAGE_RESOURCE_NAME_IS_STRING: DWORD = 0x80000000;
6632 pub const IMAGE_RESOURCE_DATA_IS_DIRECTORY: DWORD = 0x80000000;
6633 STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s {
6634     BitFields: DWORD,
6635 }}
6636 BITFIELD!{IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s BitFields: DWORD [
6637     NameOffset set_NameOffset[0..31],
6638     NameIsString set_NameIsString[31..32],
6639 ]}
6640 UNION!{union IMAGE_RESOURCE_DIRECTORY_ENTRY_u {
6641     [u32; 1],
6642     s s_mut: IMAGE_RESOURCE_DIRECTORY_ENTRY_u_s,
6643     Name Name_mut: DWORD,
6644     Id Id_mut: WORD,
6645 }}
6646 STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_ENTRY {
6647     u: IMAGE_RESOURCE_DIRECTORY_ENTRY_u,
6648     OffsetToData: DWORD,
6649 }}
6650 BITFIELD!{IMAGE_RESOURCE_DIRECTORY_ENTRY OffsetToData: DWORD [
6651     OffsetToDirectory set_OffsetToDirectory[0..31],
6652     DataIsDirectory set_DataIsDirectory[31..32],
6653 ]}
6654 pub type PIMAGE_RESOURCE_DIRECTORY_ENTRY = *mut IMAGE_RESOURCE_DIRECTORY_ENTRY;
6655 STRUCT!{struct IMAGE_RESOURCE_DIRECTORY_STRING {
6656     Length: WORD,
6657     NameString: [CHAR; 1],
6658 }}
6659 pub type PIMAGE_RESOURCE_DIRECTORY_STRING = *mut IMAGE_RESOURCE_DIRECTORY_STRING;
6660 STRUCT!{struct IMAGE_RESOURCE_DIR_STRING_U {
6661     Length: WORD,
6662     NameString: [WCHAR; 1],
6663 }}
6664 pub type PIMAGE_RESOURCE_DIR_STRING_U = *mut IMAGE_RESOURCE_DIR_STRING_U;
6665 STRUCT!{struct IMAGE_RESOURCE_DATA_ENTRY {
6666     OffsetToData: DWORD,
6667     Size: DWORD,
6668     CodePage: DWORD,
6669     Reserved: DWORD,
6670 }}
6671 pub type PIMAGE_RESOURCE_DATA_ENTRY = *mut IMAGE_RESOURCE_DATA_ENTRY;
6672 STRUCT!{struct IMAGE_LOAD_CONFIG_CODE_INTEGRITY {
6673     Flags: WORD,
6674     Catalog: WORD,
6675     CatalogOffset: DWORD,
6676     Reserved: DWORD,
6677 }}
6678 pub type PIMAGE_LOAD_CONFIG_CODE_INTEGRITY = *mut IMAGE_LOAD_CONFIG_CODE_INTEGRITY;
6679 STRUCT!{struct IMAGE_DYNAMIC_RELOCATION_TABLE {
6680     Version: DWORD,
6681     Size: DWORD,
6682 }}
6683 pub type PIMAGE_DYNAMIC_RELOCATION_TABLE = *mut IMAGE_DYNAMIC_RELOCATION_TABLE;
6684 STRUCT!{#[repr(packed)] struct IMAGE_DYNAMIC_RELOCATION32 {
6685     Symbol: DWORD,
6686     BaseRelocSize: DWORD,
6687 }}
6688 pub type PIMAGE_DYNAMIC_RELOCATION32 = *mut IMAGE_DYNAMIC_RELOCATION32;
6689 STRUCT!{#[repr(packed)] struct IMAGE_DYNAMIC_RELOCATION64 {
6690     Symbol: ULONGLONG,
6691     BaseRelocSize: DWORD,
6692 }}
6693 pub type PIMAGE_DYNAMIC_RELOCATION64 = *mut IMAGE_DYNAMIC_RELOCATION64;
6694 STRUCT!{#[repr(packed)] struct IMAGE_DYNAMIC_RELOCATION32_V2 {
6695     HeaderSize: DWORD,
6696     FixupInfoSize: DWORD,
6697     Symbol: DWORD,
6698     SymbolGroup: DWORD,
6699     Flags: DWORD,
6700 }}
6701 pub type PIMAGE_DYNAMIC_RELOCATION32_V2 = *mut IMAGE_DYNAMIC_RELOCATION32_V2;
6702 STRUCT!{#[repr(packed)] struct IMAGE_DYNAMIC_RELOCATION64_V2 {
6703     HeaderSize: DWORD,
6704     FixupInfoSize: DWORD,
6705     Symbol: ULONGLONG,
6706     SymbolGroup: DWORD,
6707     Flags: DWORD,
6708 }}
6709 pub type PIMAGE_DYNAMIC_RELOCATION64_V2 = *mut IMAGE_DYNAMIC_RELOCATION64_V2;
6710 #[cfg(target_pointer_width = "64")]
6711 IFDEF!{
6712 pub type IMAGE_DYNAMIC_RELOCATION = IMAGE_DYNAMIC_RELOCATION64;
6713 pub type PIMAGE_DYNAMIC_RELOCATION = PIMAGE_DYNAMIC_RELOCATION64;
6714 pub type IMAGE_DYNAMIC_RELOCATION_V2 = IMAGE_DYNAMIC_RELOCATION64_V2;
6715 pub type PIMAGE_DYNAMIC_RELOCATION_V2 = PIMAGE_DYNAMIC_RELOCATION64_V2;
6716 }
6717 #[cfg(target_pointer_width = "32")]
6718 IFDEF!{
6719 pub type IMAGE_DYNAMIC_RELOCATION = IMAGE_DYNAMIC_RELOCATION32;
6720 pub type PIMAGE_DYNAMIC_RELOCATION = PIMAGE_DYNAMIC_RELOCATION32;
6721 pub type IMAGE_DYNAMIC_RELOCATION_V2 = IMAGE_DYNAMIC_RELOCATION32_V2;
6722 pub type PIMAGE_DYNAMIC_RELOCATION_V2 = PIMAGE_DYNAMIC_RELOCATION32_V2;
6723 }
6724 pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_PROLOGUE: DWORD = 0x00000001;
6725 pub const IMAGE_DYNAMIC_RELOCATION_GUARD_RF_EPILOGUE: DWORD = 0x00000002;
6726 STRUCT!{#[repr(packed)] struct IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER {
6727     PrologueByteCount: BYTE,
6728 }}
6729 pub type PIMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER = *mut IMAGE_PROLOGUE_DYNAMIC_RELOCATION_HEADER;
6730 STRUCT!{#[repr(packed)] struct IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER {
6731     EpilogueCount: DWORD,
6732     EpilogueByteCount: BYTE,
6733     BranchDescriptorElementSize: BYTE,
6734     BranchDescriptorCount: WORD,
6735 }}
6736 pub type PIMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER = *mut IMAGE_EPILOGUE_DYNAMIC_RELOCATION_HEADER;
6737 STRUCT!{struct IMAGE_LOAD_CONFIG_DIRECTORY32 {
6738     Size: DWORD,
6739     TimeDateStamp: DWORD,
6740     MajorVersion: WORD,
6741     MinorVersion: WORD,
6742     GlobalFlagsClear: DWORD,
6743     GlobalFlagsSet: DWORD,
6744     CriticalSectionDefaultTimeout: DWORD,
6745     DeCommitFreeBlockThreshold: DWORD,
6746     DeCommitTotalFreeThreshold: DWORD,
6747     LockPrefixTable: DWORD,
6748     MaximumAllocationSize: DWORD,
6749     VirtualMemoryThreshold: DWORD,
6750     ProcessHeapFlags: DWORD,
6751     ProcessAffinityMask: DWORD,
6752     CSDVersion: WORD,
6753     DependentLoadFlags: WORD,
6754     EditList: DWORD,
6755     SecurityCookie: DWORD,
6756     SEHandlerTable: DWORD,
6757     SEHandlerCount: DWORD,
6758     GuardCFCheckFunctionPointer: DWORD,
6759     GuardCFDispatchFunctionPointer: DWORD,
6760     GuardCFFunctionTable: DWORD,
6761     GuardCFFunctionCount: DWORD,
6762     GuardFlags: DWORD,
6763     CodeIntegrity: IMAGE_LOAD_CONFIG_CODE_INTEGRITY,
6764     GuardAddressTakenIatEntryTable: DWORD,
6765     GuardAddressTakenIatEntryCount: DWORD,
6766     GuardLongJumpTargetTable: DWORD,
6767     GuardLongJumpTargetCount: DWORD,
6768     DynamicValueRelocTable: DWORD,
6769     CHPEMetadataPointer: DWORD,
6770     GuardRFFailureRoutine: DWORD,
6771     GuardRFFailureRoutineFunctionPointer: DWORD,
6772     DynamicValueRelocTableOffset: DWORD,
6773     DynamicValueRelocTableSection: WORD,
6774     Reserved2: WORD,
6775     GuardRFVerifyStackPointerFunctionPointer: DWORD,
6776     HotPatchTableOffset: DWORD,
6777     Reserved3: DWORD,
6778     EnclaveConfigurationPointer: DWORD,
6779 }}
6780 pub type PIMAGE_LOAD_CONFIG_DIRECTORY32 = *mut IMAGE_LOAD_CONFIG_DIRECTORY32;
6781 STRUCT!{struct IMAGE_LOAD_CONFIG_DIRECTORY64 {
6782     Size: DWORD,
6783     TimeDateStamp: DWORD,
6784     MajorVersion: WORD,
6785     MinorVersion: WORD,
6786     GlobalFlagsClear: DWORD,
6787     GlobalFlagsSet: DWORD,
6788     CriticalSectionDefaultTimeout: DWORD,
6789     DeCommitFreeBlockThreshold: ULONGLONG,
6790     DeCommitTotalFreeThreshold: ULONGLONG,
6791     LockPrefixTable: ULONGLONG,
6792     MaximumAllocationSize: ULONGLONG,
6793     VirtualMemoryThreshold: ULONGLONG,
6794     ProcessAffinityMask: ULONGLONG,
6795     ProcessHeapFlags: DWORD,
6796     CSDVersion: WORD,
6797     DependentLoadFlags: WORD,
6798     EditList: ULONGLONG,
6799     SecurityCookie: ULONGLONG,
6800     SEHandlerTable: ULONGLONG,
6801     SEHandlerCount: ULONGLONG,
6802     GuardCFCheckFunctionPointer: ULONGLONG,
6803     GuardCFDispatchFunctionPointer: ULONGLONG,
6804     GuardCFFunctionTable: ULONGLONG,
6805     GuardCFFunctionCount: ULONGLONG,
6806     GuardFlags: DWORD,
6807     CodeIntegrity: IMAGE_LOAD_CONFIG_CODE_INTEGRITY,
6808     GuardAddressTakenIatEntryTable: ULONGLONG,
6809     GuardAddressTakenIatEntryCount: ULONGLONG,
6810     GuardLongJumpTargetTable: ULONGLONG,
6811     GuardLongJumpTargetCount: ULONGLONG,
6812     DynamicValueRelocTable: ULONGLONG,
6813     CHPEMetadataPointer: ULONGLONG,
6814     GuardRFFailureRoutine: ULONGLONG,
6815     GuardRFFailureRoutineFunctionPointer: ULONGLONG,
6816     DynamicValueRelocTableOffset: DWORD,
6817     DynamicValueRelocTableSection: WORD,
6818     Reserved2: WORD,
6819     GuardRFVerifyStackPointerFunctionPointer: ULONGLONG,
6820     HotPatchTableOffset: DWORD,
6821     Reserved3: DWORD,
6822     EnclaveConfigurationPointer: ULONGLONG,
6823 }}
6824 pub type PIMAGE_LOAD_CONFIG_DIRECTORY64 = *mut IMAGE_LOAD_CONFIG_DIRECTORY64;
6825 #[cfg(target_pointer_width = "64")]
6826 IFDEF!{
6827 pub type IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY64;
6828 pub type PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY64;
6829 }
6830 #[cfg(target_pointer_width = "32")]
6831 IFDEF!{
6832 pub type IMAGE_LOAD_CONFIG_DIRECTORY = IMAGE_LOAD_CONFIG_DIRECTORY32;
6833 pub type PIMAGE_LOAD_CONFIG_DIRECTORY = PIMAGE_LOAD_CONFIG_DIRECTORY32;
6834 }
6835 STRUCT!{struct IMAGE_HOT_PATCH_INFO {
6836     Version: DWORD,
6837     Size: DWORD,
6838     SequenceNumber: DWORD,
6839     BaseImageList: DWORD,
6840     BaseImageCount: DWORD,
6841     BufferOffset: DWORD,
6842 }}
6843 pub type PIMAGE_HOT_PATCH_INFO = *mut IMAGE_HOT_PATCH_INFO;
6844 STRUCT!{struct IMAGE_HOT_PATCH_BASE {
6845     SequenceNumber: DWORD,
6846     Flags: DWORD,
6847     OriginalTimeDateStamp: DWORD,
6848     OriginalCheckSum: DWORD,
6849     CodeIntegrityInfo: DWORD,
6850     CodeIntegritySize: DWORD,
6851     PatchTable: DWORD,
6852     BufferOffset: DWORD,
6853 }}
6854 pub type PIMAGE_HOT_PATCH_BASE = *mut IMAGE_HOT_PATCH_BASE;
6855 STRUCT!{struct IMAGE_HOT_PATCH_HASHES {
6856     SHA256: [BYTE; 32],
6857     SHA1: [BYTE; 20],
6858 }}
6859 pub type PIMAGE_HOT_PATCH_HASHES = *mut IMAGE_HOT_PATCH_HASHES;
6860 pub const IMAGE_HOT_PATCH_BASE_OBLIGATORY: DWORD = 0x00000001;
6861 pub const IMAGE_HOT_PATCH_CHUNK_INVERSE: DWORD = 0x80000000;
6862 pub const IMAGE_HOT_PATCH_CHUNK_OBLIGATORY: DWORD = 0x40000000;
6863 pub const IMAGE_HOT_PATCH_CHUNK_RESERVED: DWORD = 0x3FF03000;
6864 pub const IMAGE_HOT_PATCH_CHUNK_TYPE: DWORD = 0x000FC000;
6865 pub const IMAGE_HOT_PATCH_CHUNK_SOURCE_RVA: DWORD = 0x00008000;
6866 pub const IMAGE_HOT_PATCH_CHUNK_TARGET_RVA: DWORD = 0x00004000;
6867 pub const IMAGE_HOT_PATCH_CHUNK_SIZE: DWORD = 0x00000FFF;
6868 pub const IMAGE_HOT_PATCH_NONE: DWORD = 0x00000000;
6869 pub const IMAGE_HOT_PATCH_FUNCTION: DWORD = 0x0001C000;
6870 pub const IMAGE_HOT_PATCH_ABSOLUTE: DWORD = 0x0002C000;
6871 pub const IMAGE_HOT_PATCH_REL32: DWORD = 0x0003C000;
6872 pub const IMAGE_HOT_PATCH_CALL_TARGET: DWORD = 0x00044000;
6873 pub const IMAGE_HOT_PATCH_INDIRECT: DWORD = 0x0005C000;
6874 pub const IMAGE_HOT_PATCH_NO_CALL_TARGET: DWORD = 0x00064000;
6875 pub const IMAGE_HOT_PATCH_DYNAMIC_VALUE: DWORD = 0x00078000;
6876 pub const IMAGE_GUARD_CF_INSTRUMENTED: DWORD = 0x00000100;
6877 pub const IMAGE_GUARD_CFW_INSTRUMENTED: DWORD = 0x00000200;
6878 pub const IMAGE_GUARD_CF_FUNCTION_TABLE_PRESENT: DWORD = 0x00000400;
6879 pub const IMAGE_GUARD_SECURITY_COOKIE_UNUSED: DWORD = 0x00000800;
6880 pub const IMAGE_GUARD_PROTECT_DELAYLOAD_IAT: DWORD = 0x00001000;
6881 pub const IMAGE_GUARD_DELAYLOAD_IAT_IN_ITS_OWN_SECTION: DWORD = 0x00002000;
6882 pub const IMAGE_GUARD_CF_EXPORT_SUPPRESSION_INFO_PRESENT: DWORD = 0x00004000;
6883 pub const IMAGE_GUARD_CF_ENABLE_EXPORT_SUPPRESSION: DWORD = 0x00008000;
6884 pub const IMAGE_GUARD_CF_LONGJUMP_TABLE_PRESENT: DWORD = 0x00010000;
6885 pub const IMAGE_GUARD_RF_INSTRUMENTED: DWORD = 0x00020000;
6886 pub const IMAGE_GUARD_RF_ENABLE: DWORD = 0x00040000;
6887 pub const IMAGE_GUARD_RF_STRICT: DWORD = 0x00080000;
6888 pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_MASK: DWORD = 0xF0000000;
6889 pub const IMAGE_GUARD_CF_FUNCTION_TABLE_SIZE_SHIFT: usize = 28;
6890 pub const IMAGE_GUARD_FLAG_FID_SUPPRESSED: DWORD = 0x01;
6891 pub const IMAGE_GUARD_FLAG_EXPORT_SUPPRESSED: DWORD = 0x02;
6892 STRUCT!{struct IMAGE_CE_RUNTIME_FUNCTION_ENTRY {
6893     FuncStart: DWORD,
6894     BitFields: DWORD,
6895 }}
6896 BITFIELD!{IMAGE_CE_RUNTIME_FUNCTION_ENTRY BitFields: DWORD [
6897     PrologLen set_PrologLen[0..8],
6898     FuncLen set_FuncLen[8..30],
6899     ThirtyTwoBit set_ThirtyTwoBit[30..31],
6900     ExceptionFlag set_ExceptionFlag[31..32],
6901 ]}
6902 pub type PIMAGE_CE_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_CE_RUNTIME_FUNCTION_ENTRY;
6903 STRUCT!{struct IMAGE_ARM_RUNTIME_FUNCTION_ENTRY {
6904     BeginAddress: DWORD,
6905     UnwindData: DWORD,
6906 }}
6907 BITFIELD!{IMAGE_ARM_RUNTIME_FUNCTION_ENTRY UnwindData: DWORD [
6908     Flag set_Flag[0..2],
6909     FunctionLength set_FunctionLength[2..13],
6910     Ret set_Ret[13..15],
6911     H set_H[15..16],
6912     Reg set_Reg[16..19],
6913     R set_R[19..20],
6914     L set_L[20..21],
6915     C set_c[21..22],
6916     StackAdjust set_StackAdjust[22..32],
6917 ]}
6918 pub type PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ARM_RUNTIME_FUNCTION_ENTRY;
6919 STRUCT!{struct IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY {
6920     BeginAddress: DWORD,
6921     UnwindData: DWORD,
6922 }}
6923 BITFIELD!{IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY UnwindData: DWORD [
6924     Flag set_Flag[0..2],
6925     FunctionLength set_FunctionLength[2..13],
6926     RegF set_RegF[13..16],
6927     RegI set_RegI[16..20],
6928     H set_H[20..21],
6929     CR set_cR[21..23],
6930     FrameSize set_FrameSize[23..32],
6931 ]}
6932 pub type PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
6933 STRUCT!{struct IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY {
6934     BeginAddress: ULONGLONG,
6935     EndAddress: ULONGLONG,
6936     ExceptionHandler: ULONGLONG,
6937     HandlerData: ULONGLONG,
6938     PrologEndAddress: ULONGLONG,
6939 }}
6940 pub type PIMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ALPHA64_RUNTIME_FUNCTION_ENTRY;
6941 STRUCT!{struct IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY {
6942     BeginAddress: DWORD,
6943     EndAddress: DWORD,
6944     ExceptionHandler: DWORD,
6945     HandlerData: DWORD,
6946     PrologEndAddress: DWORD,
6947 }}
6948 pub type PIMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY = *mut IMAGE_ALPHA_RUNTIME_FUNCTION_ENTRY;
6949 UNION!{union IMAGE_RUNTIME_FUNCTION_ENTRY_u {
6950     [u32; 1],
6951     UnwindInfoAddress UnwindInfoAddress_mut: DWORD,
6952     UnwindData UnwindData_mut: DWORD,
6953 }}
6954 STRUCT!{struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
6955     BeginAddress: DWORD,
6956     EndAddress: DWORD,
6957     u: IMAGE_RUNTIME_FUNCTION_ENTRY_u,
6958 }}
6959 pub type _PIMAGE_RUNTIME_FUNCTION_ENTRY = *mut _IMAGE_RUNTIME_FUNCTION_ENTRY;
6960 pub type IMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY;
6961 pub type PIMAGE_IA64_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY;
6962 #[cfg(target_arch = "aarch64")]
6963 IFDEF!{
6964 pub type IMAGE_RUNTIME_FUNCTION_ENTRY = IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
6965 pub type PIMAGE_RUNTIME_FUNCTION_ENTRY = PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY;
6966 }
6967 #[cfg(not(target_arch = "aarch64"))]
6968 IFDEF!{
6969 pub type IMAGE_RUNTIME_FUNCTION_ENTRY = _IMAGE_RUNTIME_FUNCTION_ENTRY;
6970 pub type PIMAGE_RUNTIME_FUNCTION_ENTRY = _PIMAGE_RUNTIME_FUNCTION_ENTRY;
6971 }
6972 STRUCT!{struct IMAGE_DEBUG_DIRECTORY {
6973     Characteristics: DWORD,
6974     TimeDateStamp: DWORD,
6975     MajorVersion: WORD,
6976     MinorVersion: WORD,
6977     Type: DWORD,
6978     SizeOfData: DWORD,
6979     AddressOfRawData: DWORD,
6980     PointerToRawData: DWORD,
6981 }}
6982 pub type PIMAGE_DEBUG_DIRECTORY = *mut IMAGE_DEBUG_DIRECTORY;
6983 pub const IMAGE_DEBUG_TYPE_UNKNOWN: DWORD = 0;
6984 pub const IMAGE_DEBUG_TYPE_COFF: DWORD = 1;
6985 pub const IMAGE_DEBUG_TYPE_CODEVIEW: DWORD = 2;
6986 pub const IMAGE_DEBUG_TYPE_FPO: DWORD = 3;
6987 pub const IMAGE_DEBUG_TYPE_MISC: DWORD = 4;
6988 pub const IMAGE_DEBUG_TYPE_EXCEPTION: DWORD = 5;
6989 pub const IMAGE_DEBUG_TYPE_FIXUP: DWORD = 6;
6990 pub const IMAGE_DEBUG_TYPE_OMAP_TO_SRC: DWORD = 7;
6991 pub const IMAGE_DEBUG_TYPE_OMAP_FROM_SRC: DWORD = 8;
6992 pub const IMAGE_DEBUG_TYPE_BORLAND: DWORD = 9;
6993 pub const IMAGE_DEBUG_TYPE_RESERVED10: DWORD = 10;
6994 pub const IMAGE_DEBUG_TYPE_CLSID: DWORD = 11;
6995 pub const IMAGE_DEBUG_TYPE_VC_FEATURE: DWORD = 12;
6996 pub const IMAGE_DEBUG_TYPE_POGO: DWORD = 13;
6997 pub const IMAGE_DEBUG_TYPE_ILTCG: DWORD = 14;
6998 pub const IMAGE_DEBUG_TYPE_MPX: DWORD = 15;
6999 pub const IMAGE_DEBUG_TYPE_REPRO: DWORD = 16;
7000 STRUCT!{struct IMAGE_COFF_SYMBOLS_HEADER {
7001     NumberOfSymbols: DWORD,
7002     LvaToFirstSymbol: DWORD,
7003     NumberOfLinenumbers: DWORD,
7004     LvaToFirstLinenumber: DWORD,
7005     RvaToFirstByteOfCode: DWORD,
7006     RvaToLastByteOfCode: DWORD,
7007     RvaToFirstByteOfData: DWORD,
7008     RvaToLastByteOfData: DWORD,
7009 }}
7010 pub type PIMAGE_COFF_SYMBOLS_HEADER = *mut IMAGE_COFF_SYMBOLS_HEADER;
7011 pub const FRAME_FPO: WORD = 0;
7012 pub const FRAME_TRAP: WORD = 1;
7013 pub const FRAME_TSS: WORD = 2;
7014 pub const FRAME_NONFPO: WORD = 3;
7015 STRUCT!{struct FPO_DATA {
7016     ulOffStart: DWORD,
7017     cbProcSize: DWORD,
7018     cdwLocals: DWORD,
7019     cdwParams: WORD,
7020     BitFields: WORD,
7021 }}
7022 BITFIELD!{FPO_DATA BitFields: WORD [
7023     cbProlog set_cbProlog[0..8],
7024     cbRegs set_cbRegs[8..11],
7025     fHasSEH set_fHasSEH[11..12],
7026     fUseBP set_fUseBP[12..13],
7027     reserved set_reserved[13..14],
7028     cbFrame set_cbFrame[14..16],
7029 ]}
7030 pub type PFPO_DATA = *mut FPO_DATA;
7031 pub const SIZEOF_RFPO_DATA: usize = 16;
7032 pub const IMAGE_DEBUG_MISC_EXENAME: DWORD = 1;
7033 STRUCT!{struct IMAGE_DEBUG_MISC {
7034     DataType: DWORD,
7035     Length: DWORD,
7036     Unicode: BOOLEAN,
7037     Reserved: [BYTE; 3],
7038     Data: [BYTE; 1],
7039 }}
7040 pub type PIMAGE_DEBUG_MISC = *mut IMAGE_DEBUG_MISC;
7041 STRUCT!{struct IMAGE_FUNCTION_ENTRY {
7042     StartingAddress: DWORD,
7043     EndingAddress: DWORD,
7044     EndOfPrologue: DWORD,
7045 }}
7046 pub type PIMAGE_FUNCTION_ENTRY = *mut IMAGE_FUNCTION_ENTRY;
7047 UNION!{union IMAGE_FUNCTION_ENTRY64_u {
7048     [u64; 1],
7049     EndOfPrologue EndOfPrologue_mut: ULONGLONG,
7050     UnwindInfoAddress UnwindInfoAddress_mut: ULONGLONG,
7051 }}
7052 STRUCT!{struct IMAGE_FUNCTION_ENTRY64 {
7053     StartingAddress: ULONGLONG,
7054     EndingAddress: ULONGLONG,
7055     u: IMAGE_FUNCTION_ENTRY64_u,
7056 }}
7057 pub type PIMAGE_FUNCTION_ENTRY64 = *mut IMAGE_FUNCTION_ENTRY64;
7058 STRUCT!{struct IMAGE_SEPARATE_DEBUG_HEADER {
7059     Signature: WORD,
7060     Flags: WORD,
7061     Machine: WORD,
7062     Characteristics: WORD,
7063     TimeDateStamp: DWORD,
7064     CheckSum: DWORD,
7065     ImageBase: DWORD,
7066     SizeOfImage: DWORD,
7067     NumberOfSections: DWORD,
7068     ExportedNamesSize: DWORD,
7069     DebugDirectorySize: DWORD,
7070     SectionAlignment: DWORD,
7071     Reserved: [DWORD; 2],
7072 }}
7073 pub type PIMAGE_SEPARATE_DEBUG_HEADER = *mut IMAGE_SEPARATE_DEBUG_HEADER;
7074 STRUCT!{struct NON_PAGED_DEBUG_INFO {
7075     Signature: WORD,
7076     Flags: WORD,
7077     Size: DWORD,
7078     Machine: WORD,
7079     Characteristics: WORD,
7080     TimeDateStamp: DWORD,
7081     CheckSum: DWORD,
7082     SizeOfImage: DWORD,
7083     ImageBase: ULONGLONG,
7084 }}
7085 pub type PNON_PAGED_DEBUG_INFO = *mut NON_PAGED_DEBUG_INFO;
7086 pub const IMAGE_SEPARATE_DEBUG_SIGNATURE: WORD = 0x4944;
7087 pub const NON_PAGED_DEBUG_SIGNATURE: WORD = 0x494E;
7088 pub const IMAGE_SEPARATE_DEBUG_FLAGS_MASK: WORD = 0x8000;
7089 pub const IMAGE_SEPARATE_DEBUG_MISMATCH: WORD = 0x8000;
7090 STRUCT!{struct IMAGE_ARCHITECTURE_HEADER {
7091     BitFields: c_uint,
7092     FirstEntryRVA: DWORD,
7093 }}
7094 BITFIELD!{IMAGE_ARCHITECTURE_HEADER BitFields: c_uint [
7095     AmaskValue set_AmaskValue[0..1],
7096     unused1 set_unused1[1..8],
7097     AmaskShift set_AmaskShift[8..16],
7098     unused2 set_unused2[8..32],
7099 ]}
7100 pub type PIMAGE_ARCHITECTURE_HEADER = *mut IMAGE_ARCHITECTURE_HEADER;
7101 STRUCT!{struct IMAGE_ARCHITECTURE_ENTRY {
7102     FixupInstRVA: DWORD,
7103     NewInst: DWORD,
7104 }}
7105 pub type PIMAGE_ARCHITECTURE_ENTRY = *mut IMAGE_ARCHITECTURE_ENTRY;
7106 pub const IMPORT_OBJECT_HDR_SIG2: WORD = 0xffff;
7107 UNION!{union IMPORT_OBJECT_HEADER_u {
7108     [u16; 1],
7109     Ordinal Ordinal_mut: WORD,
7110     Hint Hint_mut: WORD,
7111 }}
7112 STRUCT!{struct IMPORT_OBJECT_HEADER {
7113     Sig1: WORD,
7114     Sig2: WORD,
7115     Version: WORD,
7116     Machine: WORD,
7117     TimeDateStamp: DWORD,
7118     SizeOfData: DWORD,
7119     u: IMPORT_OBJECT_HEADER_u,
7120     BitFields: WORD,
7121 }}
7122 BITFIELD!{IMPORT_OBJECT_HEADER BitFields: WORD [
7123     Type set_Type[0..2],
7124     NameType set_NameType[2..5],
7125     Reserved set_Reserved[5..16],
7126 ]}
7127 ENUM!{enum IMPORT_OBJECT_TYPE {
7128     IMPORT_OBJECT_CODE = 0,
7129     IMPORT_OBJECT_DATA = 1,
7130     IMPORT_OBJECT_CONST = 2,
7131 }}
7132 ENUM!{enum IMPORT_OBJECT_NAME_TYPE {
7133     IMPORT_OBJECT_ORDINAL = 0,
7134     IMPORT_OBJECT_NAME = 1,
7135     IMPORT_OBJECT_NAME_NO_PREFIX = 2,
7136     IMPORT_OBJECT_NAME_UNDECORATE = 3,
7137     IMPORT_OBJECT_NAME_EXPORTAS = 4,
7138 }}
7139 ENUM!{enum ReplacesCorHdrNumericDefines {
7140     COMIMAGE_FLAGS_ILONLY = 0x00000001,
7141     COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
7142     COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
7143     COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
7144     COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010,
7145     COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
7146     COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000,
7147     COR_VERSION_MAJOR_V2 = 2,
7148     COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
7149     COR_VERSION_MINOR = 5,
7150     COR_DELETED_NAME_LENGTH = 8,
7151     COR_VTABLEGAP_NAME_LENGTH = 8,
7152     NATIVE_TYPE_MAX_CB = 1,
7153     COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE= 0xFF,
7154     IMAGE_COR_MIH_METHODRVA = 0x01,
7155     IMAGE_COR_MIH_EHRVA = 0x02,
7156     IMAGE_COR_MIH_BASICBLOCK = 0x08,
7157     COR_VTABLE_32BIT = 0x01,
7158     COR_VTABLE_64BIT = 0x02,
7159     COR_VTABLE_FROM_UNMANAGED = 0x04,
7160     COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = 0x08,
7161     COR_VTABLE_CALL_MOST_DERIVED = 0x10,
7162     IMAGE_COR_EATJ_THUNK_SIZE = 32,
7163     MAX_CLASS_NAME = 1024,
7164     MAX_PACKAGE_NAME = 1024,
7165 }}
7166 UNION!{union IMAGE_COR20_HEADER_u {
7167     [u32; 1],
7168     EntryPointToken EntryPointToken_mut: DWORD,
7169     EntryPointRVA EntryPointRVA_mut: DWORD,
7170 }}
7171 STRUCT!{struct IMAGE_COR20_HEADER {
7172     cb: DWORD,
7173     MajorRuntimeVersion: WORD,
7174     MinorRuntimeVersion: WORD,
7175     MetaData: IMAGE_DATA_DIRECTORY,
7176     Flags: DWORD,
7177     u: IMAGE_COR20_HEADER_u,
7178     Resources: IMAGE_DATA_DIRECTORY,
7179     StrongNameSignature: IMAGE_DATA_DIRECTORY,
7180     CodeManagerTable: IMAGE_DATA_DIRECTORY,
7181     VTableFixups: IMAGE_DATA_DIRECTORY,
7182     ExportAddressTableJumps: IMAGE_DATA_DIRECTORY,
7183     ManagedNativeHeader: IMAGE_DATA_DIRECTORY,
7184 }}
7185 pub type PIMAGE_COR20_HEADER = *mut IMAGE_COR20_HEADER;
7186 extern "system" {
RtlCaptureStackBackTrace( FramesToSkip: DWORD, FramesToCapture: DWORD, BackTrace: *mut PVOID, BackTraceHash: PDWORD, ) -> WORD7187     pub fn RtlCaptureStackBackTrace(
7188         FramesToSkip: DWORD,
7189         FramesToCapture: DWORD,
7190         BackTrace: *mut PVOID,
7191         BackTraceHash: PDWORD,
7192     ) -> WORD;
RtlCaptureContext( ContextRecord: PCONTEXT, )7193     pub fn RtlCaptureContext(
7194         ContextRecord: PCONTEXT,
7195     );
RtlUnwind( TargetFrame: PVOID, TargetIp: PVOID, ExceptionRecord: PEXCEPTION_RECORD, ReturnValue: PVOID, )7196     pub fn RtlUnwind(
7197         TargetFrame: PVOID,
7198         TargetIp: PVOID,
7199         ExceptionRecord: PEXCEPTION_RECORD,
7200         ReturnValue: PVOID,
7201     );
7202 }
7203 #[cfg(target_pointer_width = "64")]
7204 extern "system" {
RtlAddFunctionTable( FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, BaseAddress: DWORD64, ) -> BOOLEAN7205     pub fn RtlAddFunctionTable(
7206         FunctionTable: PRUNTIME_FUNCTION,
7207         EntryCount: DWORD,
7208         BaseAddress: DWORD64,
7209     ) -> BOOLEAN;
RtlDeleteFunctionTable( FunctionTable: PRUNTIME_FUNCTION, ) -> BOOLEAN7210     pub fn RtlDeleteFunctionTable(
7211         FunctionTable: PRUNTIME_FUNCTION,
7212     ) -> BOOLEAN;
RtlInstallFunctionTableCallback( TableIdentifier: DWORD64, BaseAddress: DWORD64, Length: DWORD, Callback: PGET_RUNTIME_FUNCTION_CALLBACK, Context: PVOID, OutOfProcessCallbackDll: PCWSTR, ) -> BOOLEAN7213     pub fn RtlInstallFunctionTableCallback(
7214         TableIdentifier: DWORD64,
7215         BaseAddress: DWORD64,
7216         Length: DWORD,
7217         Callback: PGET_RUNTIME_FUNCTION_CALLBACK,
7218         Context: PVOID,
7219         OutOfProcessCallbackDll: PCWSTR,
7220     ) -> BOOLEAN;
RtlAddGrowableFunctionTable( DynamicTable: *mut PVOID, FunctionTable: PRUNTIME_FUNCTION, EntryCount: DWORD, MaximumEntryCount: DWORD, RangeBase: ULONG_PTR, RangeEnd: ULONG_PTR, ) -> DWORD7221     pub fn RtlAddGrowableFunctionTable(
7222         DynamicTable: *mut PVOID,
7223         FunctionTable: PRUNTIME_FUNCTION,
7224         EntryCount: DWORD,
7225         MaximumEntryCount: DWORD,
7226         RangeBase: ULONG_PTR,
7227         RangeEnd: ULONG_PTR,
7228     ) -> DWORD;
RtlGrowFunctionTable( DynamicTable: PVOID, NewEntryCount: DWORD, )7229     pub fn RtlGrowFunctionTable(
7230         DynamicTable: PVOID,
7231         NewEntryCount: DWORD,
7232     );
RtlDeleteGrowableFunctionTable( DynamicTable: PVOID, )7233     pub fn RtlDeleteGrowableFunctionTable(
7234         DynamicTable: PVOID,
7235     );
RtlLookupFunctionEntry( ControlPc: DWORD64, ImageBase: PDWORD64, HistoryTable: PUNWIND_HISTORY_TABLE, ) -> PRUNTIME_FUNCTION7236     pub fn RtlLookupFunctionEntry(
7237         ControlPc: DWORD64,
7238         ImageBase: PDWORD64,
7239         HistoryTable: PUNWIND_HISTORY_TABLE,
7240     ) -> PRUNTIME_FUNCTION;
7241 }
7242 #[cfg(target_arch = "x86_64")]
7243 IFDEF!{
7244 extern "C" {
7245     pub fn RtlRestoreContext(
7246         ContextRecord: PCONTEXT,
7247         ExceptionRecord: *mut EXCEPTION_RECORD,
7248     );
7249 }
7250 extern "system" {
7251     pub fn RtlUnwindEx(
7252         TargetFrame: PVOID,
7253         TargetIp: PVOID,
7254         ExceptionRecord: PEXCEPTION_RECORD,
7255         ReturnValue: PVOID,
7256         ContextRecord: PCONTEXT,
7257         HistoryTable: PUNWIND_HISTORY_TABLE,
7258     );
7259     pub fn RtlVirtualUnwind(
7260         HandlerType: DWORD,
7261         ImageBase: DWORD64,
7262         ControlPc: DWORD64,
7263         FunctionEntry: PRUNTIME_FUNCTION,
7264         ContextRecord: PCONTEXT,
7265         HandlerData: *mut PVOID,
7266         EstablisherFrame: PDWORD64,
7267         ContextPointers: PKNONVOLATILE_CONTEXT_POINTERS,
7268     ) -> PEXCEPTION_ROUTINE;
7269 }
7270 }
7271 extern "system" {
RtlPcToFileHeader( PcValue: PVOID, BaseOfImage: *mut PVOID, ) -> PVOID7272     pub fn RtlPcToFileHeader(
7273         PcValue: PVOID,
7274         BaseOfImage: *mut PVOID,
7275     ) -> PVOID;
RtlCompareMemory( Source1: *const VOID, Source2: *const VOID, Length: SIZE_T, ) -> SIZE_T7276     pub fn RtlCompareMemory(
7277         Source1: *const VOID,
7278         Source2: *const VOID,
7279         Length: SIZE_T,
7280     ) -> SIZE_T;
7281 }
7282 STRUCT!{struct SLIST_ENTRY {
7283     Next: *mut SLIST_ENTRY,
7284 }}
7285 pub type PSLIST_ENTRY = *mut SLIST_ENTRY;
7286 #[cfg(target_pointer_width = "64")]
7287 IFDEF!{
7288 STRUCT!{struct SLIST_HEADER_s {
7289     Alignment: ULONGLONG,
7290     Region: ULONGLONG,
7291 }}
7292 STRUCT!{struct SLIST_HEADER_HeaderX64 {
7293     BitFields1: ULONGLONG,
7294     BitFields2: ULONGLONG,
7295 }}
7296 BITFIELD!{SLIST_HEADER_HeaderX64 BitFields1: ULONGLONG [
7297     Depth set_Depth[0..16],
7298     Sequence set_Sequence[16..64],
7299 ]}
7300 BITFIELD!{SLIST_HEADER_HeaderX64 BitFields2: ULONGLONG [
7301     Reserved set_Reserved[0..4],
7302     NextEntry set_NextEntry[4..64],
7303 ]}
7304 UNION!{union SLIST_HEADER {
7305     [u64; 2],
7306     s s_mut: SLIST_HEADER_s,
7307     HeaderX64 HeaderX64_mut: SLIST_HEADER_HeaderX64,
7308 }}
7309 pub type PSLIST_HEADER = *mut SLIST_HEADER;
7310 }
7311 #[cfg(target_pointer_width = "32")]
7312 IFDEF!{
7313 STRUCT!{struct SLIST_HEADER_s {
7314     Next: SLIST_ENTRY,
7315     Depth: WORD,
7316     Reserved: WORD,
7317 }}
7318 UNION!{union SLIST_HEADER {
7319     [u64; 1],
7320     Alignment Alignment_mut: ULONGLONG,
7321     s s_mut: SLIST_HEADER_s,
7322 }}
7323 pub type PSLIST_HEADER = *mut SLIST_HEADER;
7324 }
7325 extern "system" {
RtlInitializeSListHead( ListHead: PSLIST_HEADER, )7326     pub fn RtlInitializeSListHead(
7327         ListHead: PSLIST_HEADER,
7328     );
RtlFirstEntrySList( ListHead: *const SLIST_HEADER, ) -> PSLIST_ENTRY7329     pub fn RtlFirstEntrySList(
7330         ListHead: *const SLIST_HEADER,
7331     ) -> PSLIST_ENTRY;
RtlInterlockedPopEntrySList( ListHead: PSLIST_HEADER, ) -> PSLIST_ENTRY7332     pub fn RtlInterlockedPopEntrySList(
7333         ListHead: PSLIST_HEADER,
7334     ) -> PSLIST_ENTRY;
RtlInterlockedPushEntrySList( ListHead: PSLIST_HEADER, ListEntry: PSLIST_ENTRY, ) -> PSLIST_ENTRY7335     pub fn RtlInterlockedPushEntrySList(
7336         ListHead: PSLIST_HEADER,
7337         ListEntry: PSLIST_ENTRY,
7338     ) -> PSLIST_ENTRY;
RtlInterlockedPushListSListEx( ListHead: PSLIST_HEADER, ListEntry: PSLIST_ENTRY, ListEnd: PSLIST_ENTRY, Count: DWORD, ) -> PSLIST_ENTRY7339     pub fn RtlInterlockedPushListSListEx(
7340         ListHead: PSLIST_HEADER,
7341         ListEntry: PSLIST_ENTRY,
7342         ListEnd: PSLIST_ENTRY,
7343         Count: DWORD,
7344     ) -> PSLIST_ENTRY;
RtlInterlockedFlushSList( ListHead: PSLIST_HEADER, ) -> PSLIST_ENTRY7345     pub fn RtlInterlockedFlushSList(
7346         ListHead: PSLIST_HEADER,
7347     ) -> PSLIST_ENTRY;
RtlQueryDepthSList( ListHead: PSLIST_HEADER, ) -> WORD7348     pub fn RtlQueryDepthSList(
7349         ListHead: PSLIST_HEADER,
7350     ) -> WORD;
7351 }
7352 pub const RTL_RUN_ONCE_INIT: RTL_RUN_ONCE = RTL_RUN_ONCE { Ptr: 0 as PVOID };
7353 pub const RTL_RUN_ONCE_CHECK_ONLY: ULONG = 0x00000001;
7354 pub const RTL_RUN_ONCE_ASYNC: ULONG = 0x00000002;
7355 pub const RTL_RUN_ONCE_INIT_FAILED: ULONG = 0x00000004;
7356 STRUCT!{struct RTL_RUN_ONCE {
7357     Ptr: PVOID,
7358 }}
7359 pub type PRTL_RUN_ONCE = *mut RTL_RUN_ONCE;
7360 STRUCT!{struct RTL_BARRIER {
7361     Reserved1: DWORD,
7362     Reserved2: DWORD,
7363     Reserved3: [ULONG_PTR; 2],
7364     Reserved4: DWORD,
7365     Reserved5: DWORD,
7366 }}
7367 pub type PRTL_BARRIER = *mut RTL_BARRIER;
7368 pub const FAST_FAIL_LEGACY_GS_VIOLATION: c_uint = 0;
7369 pub const FAST_FAIL_VTGUARD_CHECK_FAILURE: c_uint = 1;
7370 pub const FAST_FAIL_STACK_COOKIE_CHECK_FAILURE: c_uint = 2;
7371 pub const FAST_FAIL_CORRUPT_LIST_ENTRY: c_uint = 3;
7372 pub const FAST_FAIL_INCORRECT_STACK: c_uint = 4;
7373 pub const FAST_FAIL_INVALID_ARG: c_uint = 5;
7374 pub const FAST_FAIL_GS_COOKIE_INIT: c_uint = 6;
7375 pub const FAST_FAIL_FATAL_APP_EXIT: c_uint = 7;
7376 pub const FAST_FAIL_RANGE_CHECK_FAILURE: c_uint = 8;
7377 pub const FAST_FAIL_UNSAFE_REGISTRY_ACCESS: c_uint = 9;
7378 pub const FAST_FAIL_GUARD_ICALL_CHECK_FAILURE: c_uint = 10;
7379 pub const FAST_FAIL_GUARD_WRITE_CHECK_FAILURE: c_uint = 11;
7380 pub const FAST_FAIL_INVALID_FIBER_SWITCH: c_uint = 12;
7381 pub const FAST_FAIL_INVALID_SET_OF_CONTEXT: c_uint = 13;
7382 pub const FAST_FAIL_INVALID_REFERENCE_COUNT: c_uint = 14;
7383 pub const FAST_FAIL_INVALID_JUMP_BUFFER: c_uint = 18;
7384 pub const FAST_FAIL_MRDATA_MODIFIED: c_uint = 19;
7385 pub const FAST_FAIL_CERTIFICATION_FAILURE: c_uint = 20;
7386 pub const FAST_FAIL_INVALID_EXCEPTION_CHAIN: c_uint = 21;
7387 pub const FAST_FAIL_CRYPTO_LIBRARY: c_uint = 22;
7388 pub const FAST_FAIL_INVALID_CALL_IN_DLL_CALLOUT: c_uint = 23;
7389 pub const FAST_FAIL_INVALID_IMAGE_BASE: c_uint = 24;
7390 pub const FAST_FAIL_DLOAD_PROTECTION_FAILURE: c_uint = 25;
7391 pub const FAST_FAIL_UNSAFE_EXTENSION_CALL: c_uint = 26;
7392 pub const FAST_FAIL_DEPRECATED_SERVICE_INVOKED: c_uint = 27;
7393 pub const FAST_FAIL_INVALID_BUFFER_ACCESS: c_uint = 28;
7394 pub const FAST_FAIL_INVALID_BALANCED_TREE: c_uint = 29;
7395 pub const FAST_FAIL_INVALID_NEXT_THREAD: c_uint = 30;
7396 pub const FAST_FAIL_GUARD_ICALL_CHECK_SUPPRESSED: c_uint = 31;
7397 pub const FAST_FAIL_APCS_DISABLED: c_uint = 32;
7398 pub const FAST_FAIL_INVALID_IDLE_STATE: c_uint = 33;
7399 pub const FAST_FAIL_MRDATA_PROTECTION_FAILURE: c_uint = 34;
7400 pub const FAST_FAIL_UNEXPECTED_HEAP_EXCEPTION: c_uint = 35;
7401 pub const FAST_FAIL_INVALID_LOCK_STATE: c_uint = 36;
7402 pub const FAST_FAIL_GUARD_JUMPTABLE: c_uint = 37;
7403 pub const FAST_FAIL_INVALID_LONGJUMP_TARGET: c_uint = 38;
7404 pub const FAST_FAIL_INVALID_DISPATCH_CONTEXT: c_uint = 39;
7405 pub const FAST_FAIL_INVALID_THREAD: c_uint = 40;
7406 pub const FAST_FAIL_INVALID_SYSCALL_NUMBER: c_uint = 41;
7407 pub const FAST_FAIL_INVALID_FILE_OPERATION: c_uint = 42;
7408 pub const FAST_FAIL_LPAC_ACCESS_DENIED: c_uint = 43;
7409 pub const FAST_FAIL_GUARD_SS_FAILURE: c_uint = 44;
7410 pub const FAST_FAIL_LOADER_CONTINUITY_FAILURE: c_uint = 45;
7411 pub const FAST_FAIL_GUARD_EXPORT_SUPPRESSION_FAILURE: c_uint = 46;
7412 pub const FAST_FAIL_INVALID_CONTROL_STACK: c_uint = 47;
7413 pub const FAST_FAIL_SET_CONTEXT_DENIED: c_uint = 48;
7414 pub const FAST_FAIL_INVALID_FAST_FAIL_CODE: c_uint = 0xFFFFFFFF;
7415 pub const HEAP_NO_SERIALIZE: DWORD = 0x00000001;
7416 pub const HEAP_GROWABLE: DWORD = 0x00000002;
7417 pub const HEAP_GENERATE_EXCEPTIONS: DWORD = 0x00000004;
7418 pub const HEAP_ZERO_MEMORY: DWORD = 0x00000008;
7419 pub const HEAP_REALLOC_IN_PLACE_ONLY: DWORD = 0x00000010;
7420 pub const HEAP_TAIL_CHECKING_ENABLED: DWORD = 0x00000020;
7421 pub const HEAP_FREE_CHECKING_ENABLED: DWORD = 0x00000040;
7422 pub const HEAP_DISABLE_COALESCE_ON_FREE: DWORD = 0x00000080;
7423 pub const HEAP_CREATE_ALIGN_16: DWORD = 0x00010000;
7424 pub const HEAP_CREATE_ENABLE_TRACING: DWORD = 0x00020000;
7425 pub const HEAP_CREATE_ENABLE_EXECUTE: DWORD = 0x00040000;
7426 pub const HEAP_MAXIMUM_TAG: DWORD = 0x0FFF;
7427 pub const HEAP_PSEUDO_TAG_FLAG: DWORD = 0x8000;
7428 pub const HEAP_TAG_SHIFT: usize = 18;
7429 pub const HEAP_CREATE_SEGMENT_HEAP: DWORD = 0x00000100;
7430 pub const HEAP_CREATE_HARDENED: DWORD = 0x00000200;
7431 #[inline]
HEAP_MAKE_TAG_FLAGS(TagBase: DWORD, Tag: DWORD) -> DWORD7432 pub fn HEAP_MAKE_TAG_FLAGS(TagBase: DWORD, Tag: DWORD) -> DWORD {
7433     TagBase + (Tag << HEAP_TAG_SHIFT)
7434 }
7435 pub const IS_TEXT_UNICODE_ASCII16: INT = 0x0001;
7436 pub const IS_TEXT_UNICODE_REVERSE_ASCII16: INT = 0x0010;
7437 pub const IS_TEXT_UNICODE_STATISTICS: INT = 0x0002;
7438 pub const IS_TEXT_UNICODE_REVERSE_STATISTICS: INT = 0x0020;
7439 pub const IS_TEXT_UNICODE_CONTROLS: INT = 0x0004;
7440 pub const IS_TEXT_UNICODE_REVERSE_CONTROLS: INT = 0x0040;
7441 pub const IS_TEXT_UNICODE_SIGNATURE: INT = 0x0008;
7442 pub const IS_TEXT_UNICODE_REVERSE_SIGNATURE: INT = 0x0080;
7443 pub const IS_TEXT_UNICODE_ILLEGAL_CHARS: INT = 0x0100;
7444 pub const IS_TEXT_UNICODE_ODD_LENGTH: INT = 0x0200;
7445 pub const IS_TEXT_UNICODE_DBCS_LEADBYTE: INT = 0x0400;
7446 pub const IS_TEXT_UNICODE_NULL_BYTES: INT = 0x1000;
7447 pub const IS_TEXT_UNICODE_UNICODE_MASK: INT = 0x000F;
7448 pub const IS_TEXT_UNICODE_REVERSE_MASK: INT = 0x00F0;
7449 pub const IS_TEXT_UNICODE_NOT_UNICODE_MASK: INT = 0x0F00;
7450 pub const IS_TEXT_UNICODE_NOT_ASCII_MASK: INT = 0xF000;
7451 pub const COMPRESSION_FORMAT_NONE: USHORT = 0x0000;
7452 pub const COMPRESSION_FORMAT_DEFAULT: USHORT = 0x0001;
7453 pub const COMPRESSION_FORMAT_LZNT1: USHORT = 0x0002;
7454 pub const COMPRESSION_FORMAT_XPRESS: USHORT = 0x0003;
7455 pub const COMPRESSION_FORMAT_XPRESS_HUFF: USHORT = 0x0004;
7456 pub const COMPRESSION_ENGINE_STANDARD: USHORT = 0x0000;
7457 pub const COMPRESSION_ENGINE_MAXIMUM: USHORT = 0x0100;
7458 pub const COMPRESSION_ENGINE_HIBER: USHORT = 0x0200;
7459 // RtlEqualMemory
7460 #[inline]
RtlMoveMemory(Destination: *mut c_void, Source: *const c_void, Length: usize)7461 pub unsafe fn RtlMoveMemory(Destination: *mut c_void, Source: *const c_void, Length: usize) {
7462     use core::ptr::copy;
7463     copy(Source as *const u8, Destination as *mut u8, Length);
7464 }
7465 #[inline]
RtlCopyMemory(Destination: *mut c_void, Source: *const c_void, Length: usize)7466 pub unsafe fn RtlCopyMemory(Destination: *mut c_void, Source: *const c_void, Length: usize) {
7467     use core::ptr::copy_nonoverlapping;
7468     copy_nonoverlapping(Source as *const u8, Destination as *mut u8, Length);
7469 }
7470 #[inline]
RtlFillMemory(Destination: *mut c_void, Length: usize, Fill: u8)7471 pub unsafe fn RtlFillMemory(Destination: *mut c_void, Length: usize, Fill: u8) {
7472     use core::ptr::write_bytes;
7473     write_bytes(Destination as *mut u8, Fill, Length);
7474 }
7475 #[inline]
RtlZeroMemory(Destination: *mut c_void, Length: usize)7476 pub unsafe fn RtlZeroMemory(Destination: *mut c_void, Length: usize) {
7477     use core::ptr::write_bytes;
7478     write_bytes(Destination as *mut u8, 0, Length);
7479 }
7480 pub const SEF_DACL_AUTO_INHERIT: ULONG = 0x01;
7481 pub const SEF_SACL_AUTO_INHERIT: ULONG = 0x02;
7482 pub const SEF_DEFAULT_DESCRIPTOR_FOR_OBJECT: ULONG = 0x04;
7483 pub const SEF_AVOID_PRIVILEGE_CHECK: ULONG = 0x08;
7484 pub const SEF_AVOID_OWNER_CHECK: ULONG = 0x10;
7485 pub const SEF_DEFAULT_OWNER_FROM_PARENT: ULONG = 0x20;
7486 pub const SEF_DEFAULT_GROUP_FROM_PARENT: ULONG = 0x40;
7487 pub const SEF_MACL_NO_WRITE_UP: ULONG = 0x100;
7488 pub const SEF_MACL_NO_READ_UP: ULONG = 0x200;
7489 pub const SEF_MACL_NO_EXECUTE_UP: ULONG = 0x400;
7490 pub const SEF_AI_USE_EXTRA_PARAMS: ULONG = 0x800;
7491 pub const SEF_AVOID_OWNER_RESTRICTION: ULONG = 0x1000;
7492 pub const SEF_MACL_VALID_FLAGS: ULONG = SEF_MACL_NO_WRITE_UP | SEF_MACL_NO_READ_UP
7493     | SEF_MACL_NO_EXECUTE_UP;
7494 STRUCT!{struct MESSAGE_RESOURCE_ENTRY {
7495     Length: WORD,
7496     Flags: WORD,
7497     Text: [BYTE; 1],
7498 }}
7499 pub type PMESSAGE_RESOURCE_ENTRY = *mut MESSAGE_RESOURCE_ENTRY;
7500 pub const MESSAGE_RESOURCE_UNICODE: WORD = 0x0001;
7501 STRUCT!{struct MESSAGE_RESOURCE_BLOCK {
7502     LowId: DWORD,
7503     HighId: DWORD,
7504     OffsetToEntries: DWORD,
7505 }}
7506 pub type PMESSAGE_RESOURCE_BLOCK = *mut MESSAGE_RESOURCE_BLOCK;
7507 STRUCT!{struct MESSAGE_RESOURCE_DATA {
7508     NumberOfBlocks: DWORD,
7509     Blocks: [MESSAGE_RESOURCE_BLOCK; 1],
7510 }}
7511 pub type PMESSAGE_RESOURCE_DATA = *mut MESSAGE_RESOURCE_DATA;
7512 STRUCT!{struct OSVERSIONINFOA {
7513     dwOSVersionInfoSize: DWORD,
7514     dwMajorVersion: DWORD,
7515     dwMinorVersion: DWORD,
7516     dwBuildNumber: DWORD,
7517     dwPlatformId: DWORD,
7518     szCSDVersion: [CHAR; 128],
7519 }}
7520 pub type POSVERSIONINFOA = *mut OSVERSIONINFOA;
7521 pub type LPOSVERSIONINFOA = *mut OSVERSIONINFOA;
7522 STRUCT!{struct OSVERSIONINFOW {
7523     dwOSVersionInfoSize: DWORD,
7524     dwMajorVersion: DWORD,
7525     dwMinorVersion: DWORD,
7526     dwBuildNumber: DWORD,
7527     dwPlatformId: DWORD,
7528     szCSDVersion: [WCHAR; 128],
7529 }}
7530 pub type POSVERSIONINFOW = *mut OSVERSIONINFOW;
7531 pub type LPOSVERSIONINFOW = *mut OSVERSIONINFOW;
7532 pub type RTL_OSVERSIONINFOW = OSVERSIONINFOW;
7533 pub type PRTL_OSVERSIONINFOW = *mut OSVERSIONINFOW;
7534 STRUCT!{struct OSVERSIONINFOEXA {
7535     dwOSVersionInfoSize: DWORD,
7536     dwMajorVersion: DWORD,
7537     dwMinorVersion: DWORD,
7538     dwBuildNumber: DWORD,
7539     dwPlatformId: DWORD,
7540     szCSDVersion: [CHAR; 128],
7541     wServicePackMajor: WORD,
7542     wServicePackMinor: WORD,
7543     wSuiteMask: WORD,
7544     wProductType: BYTE,
7545     wReserved: BYTE,
7546 }}
7547 pub type POSVERSIONINFOEXA = *mut OSVERSIONINFOEXA;
7548 pub type LPOSVERSIONINFOEXA = *mut OSVERSIONINFOEXA;
7549 STRUCT!{struct OSVERSIONINFOEXW {
7550     dwOSVersionInfoSize: DWORD,
7551     dwMajorVersion: DWORD,
7552     dwMinorVersion: DWORD,
7553     dwBuildNumber: DWORD,
7554     dwPlatformId: DWORD,
7555     szCSDVersion: [WCHAR; 128],
7556     wServicePackMajor: WORD,
7557     wServicePackMinor: WORD,
7558     wSuiteMask: WORD,
7559     wProductType: BYTE,
7560     wReserved: BYTE,
7561 }}
7562 pub type POSVERSIONINFOEXW = *mut OSVERSIONINFOEXW;
7563 pub type LPOSVERSIONINFOEXW = *mut OSVERSIONINFOEXW;
7564 pub type RTL_OSVERSIONINFOEXW = OSVERSIONINFOEXW;
7565 pub type PRTL_OSVERSIONINFOEXW = *mut OSVERSIONINFOEXW;
7566 pub const VER_EQUAL: BYTE = 1;
7567 pub const VER_GREATER: BYTE = 2;
7568 pub const VER_GREATER_EQUAL: BYTE = 3;
7569 pub const VER_LESS: BYTE = 4;
7570 pub const VER_LESS_EQUAL: BYTE = 5;
7571 pub const VER_AND: BYTE = 6;
7572 pub const VER_OR: BYTE = 7;
7573 pub const VER_CONDITION_MASK: BYTE = 7;
7574 pub const VER_NUM_BITS_PER_CONDITION_MASK: BYTE = 3;
7575 pub const VER_MINORVERSION: DWORD = 0x0000001;
7576 pub const VER_MAJORVERSION: DWORD = 0x0000002;
7577 pub const VER_BUILDNUMBER: DWORD = 0x0000004;
7578 pub const VER_PLATFORMID: DWORD = 0x0000008;
7579 pub const VER_SERVICEPACKMINOR: DWORD = 0x0000010;
7580 pub const VER_SERVICEPACKMAJOR: DWORD = 0x0000020;
7581 pub const VER_SUITENAME: DWORD = 0x0000040;
7582 pub const VER_PRODUCT_TYPE: DWORD = 0x0000080;
7583 pub const VER_NT_WORKSTATION: BYTE = 0x0000001;
7584 pub const VER_NT_DOMAIN_CONTROLLER: BYTE = 0x0000002;
7585 pub const VER_NT_SERVER: BYTE = 0x0000003;
7586 pub const VER_PLATFORM_WIN32s: DWORD = 0;
7587 pub const VER_PLATFORM_WIN32_WINDOWS: DWORD = 1;
7588 pub const VER_PLATFORM_WIN32_NT: DWORD = 2;
7589 extern "system" {
VerSetConditionMask( ConditionMask: ULONGLONG, TypeMask: DWORD, Condition: BYTE, ) -> ULONGLONG7590     pub fn VerSetConditionMask(
7591         ConditionMask: ULONGLONG,
7592         TypeMask: DWORD,
7593         Condition: BYTE,
7594     ) -> ULONGLONG;
RtlGetProductInfo( OSMajorVersion: DWORD, OSMinorVersion: DWORD, SpMajorVersion: DWORD, SpMinorVersion: DWORD, ReturnedProductType: PDWORD, ) -> BOOLEAN7595     pub fn RtlGetProductInfo(
7596         OSMajorVersion: DWORD,
7597         OSMinorVersion: DWORD,
7598         SpMajorVersion: DWORD,
7599         SpMinorVersion: DWORD,
7600         ReturnedProductType: PDWORD,
7601     ) -> BOOLEAN;
7602 }
7603 pub const RTL_UMS_VERSION: DWORD = 0x100;
7604 ENUM!{enum RTL_UMS_THREAD_INFO_CLASS {
7605     UmsThreadInvalidInfoClass = 0,
7606     UmsThreadUserContext,
7607     UmsThreadPriority,
7608     UmsThreadAffinity,
7609     UmsThreadTeb,
7610     UmsThreadIsSuspended,
7611     UmsThreadIsTerminated,
7612     UmsThreadMaxInfoClass,
7613 }}
7614 ENUM!{enum RTL_UMS_SCHEDULER_REASON {
7615     UmsSchedulerStartup = 0,
7616     UmsSchedulerThreadBlocked,
7617     UmsSchedulerThreadYield,
7618 }}
7619 FN!{stdcall PRTL_UMS_SCHEDULER_ENTRY_POINT(
7620     Reason: RTL_UMS_SCHEDULER_REASON,
7621     ActivationPayload: ULONG_PTR,
7622     SchedulerParam: PVOID,
7623 ) -> ()}
7624 #[inline]
IS_VALIDATION_ENABLED(C: DWORD, L: DWORD) -> bool7625 pub fn IS_VALIDATION_ENABLED(C: DWORD, L: DWORD) -> bool {
7626     (L & C) != 0
7627 }
7628 pub const VRL_PREDEFINED_CLASS_BEGIN: DWORD = 1 << 0;
7629 pub const VRL_CUSTOM_CLASS_BEGIN: DWORD = 1 << 8;
7630 pub const VRL_CLASS_CONSISTENCY: DWORD = VRL_CUSTOM_CLASS_BEGIN << 8;
7631 pub const VRL_ENABLE_KERNEL_BREAKS: DWORD = 1 << 31;
7632 pub const CTMF_INCLUDE_APPCONTAINER: ULONG = 0x00000001;
7633 pub const CTMF_INCLUDE_LPAC: ULONG = 0x00000002;
7634 pub const CTMF_VALID_FLAGS: ULONG = CTMF_INCLUDE_APPCONTAINER | CTMF_INCLUDE_LPAC;
7635 extern "system" {
RtlCrc32( Buffer: *const c_void, Size: size_t, InitialCrc: DWORD, ) -> DWORD7636     pub fn RtlCrc32(
7637         Buffer: *const c_void,
7638         Size: size_t,
7639         InitialCrc: DWORD,
7640     ) -> DWORD;
RtlCrc64( Buffer: *const c_void, Size: size_t, InitialCrc: ULONGLONG, ) -> ULONGLONG7641     pub fn RtlCrc64(
7642         Buffer: *const c_void,
7643         Size: size_t,
7644         InitialCrc: ULONGLONG,
7645     ) -> ULONGLONG;
7646 }
7647 ENUM!{enum OS_DEPLOYEMENT_STATE_VALUES {
7648     OS_DEPLOYMENT_STANDARD = 1,
7649     OS_DEPLOYMENT_COMPACT,
7650 }}
7651 extern "system" {
RtlOsDeploymentState( Flags: DWORD, ) -> OS_DEPLOYEMENT_STATE_VALUES7652     pub fn RtlOsDeploymentState(
7653         Flags: DWORD,
7654     ) -> OS_DEPLOYEMENT_STATE_VALUES;
7655 }
7656 #[cfg(target_arch = "x86_64")]
7657 IFDEF!{
7658 STRUCT!{struct NV_MEMORY_RANGE {
7659     BaseAddress: *mut VOID,
7660     Length: SIZE_T,
7661 }}
7662 pub type PNV_MEMORY_RANGE = *mut NV_MEMORY_RANGE;
7663 pub const FLUSH_NV_MEMORY_IN_FLAG_NO_DRAIN: ULONG = 0x00000001;
7664 pub const FLUSH_NV_MEMORY_DEFAULT_TOKEN: ULONG_PTR = -1isize as usize;
7665 }
7666 STRUCT!{struct RTL_CRITICAL_SECTION_DEBUG {
7667     Type: WORD,
7668     CreatorBackTraceIndex: WORD,
7669     CriticalSection: *mut RTL_CRITICAL_SECTION,
7670     ProcessLocksList: LIST_ENTRY,
7671     EntryCount: DWORD,
7672     ContentionCount: DWORD,
7673     Flags: DWORD,
7674     CreatorBackTraceIndexHigh: WORD,
7675     SpareWORD: WORD,
7676 }}
7677 pub type PRTL_CRITICAL_SECTION_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG;
7678 pub type RTL_RESOURCE_DEBUG = RTL_CRITICAL_SECTION_DEBUG;
7679 pub type PRTL_RESOURCE_DEBUG = *mut RTL_CRITICAL_SECTION_DEBUG;
7680 pub const RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO: ULONG_PTR = 0x01000000;
7681 pub const RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN: ULONG_PTR = 0x02000000;
7682 pub const RTL_CRITICAL_SECTION_FLAG_STATIC_INIT: ULONG_PTR = 0x04000000;
7683 pub const RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE: ULONG_PTR = 0x08000000;
7684 pub const RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO: ULONG_PTR = 0x10000000;
7685 pub const RTL_CRITICAL_SECTION_ALL_FLAG_BITS: ULONG_PTR = 0xFF000000;
7686 pub const RTL_CRITICAL_SECTION_FLAG_RESERVED: ULONG_PTR = RTL_CRITICAL_SECTION_ALL_FLAG_BITS
7687     & !(RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO | RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN
7688         | RTL_CRITICAL_SECTION_FLAG_STATIC_INIT | RTL_CRITICAL_SECTION_FLAG_RESOURCE_TYPE
7689         | RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO);
7690 pub const RTL_CRITICAL_SECTION_DEBUG_FLAG_STATIC_INIT: DWORD = 0x00000001;
7691 STRUCT!{struct RTL_CRITICAL_SECTION {
7692     DebugInfo: PRTL_CRITICAL_SECTION_DEBUG,
7693     LockCount: LONG,
7694     RecursionCount: LONG,
7695     OwningThread: HANDLE,
7696     LockSemaphore: HANDLE,
7697     SpinCount: ULONG_PTR,
7698 }}
7699 pub type PRTL_CRITICAL_SECTION = *mut RTL_CRITICAL_SECTION;
7700 STRUCT!{struct RTL_SRWLOCK {
7701     Ptr: PVOID,
7702 }}
7703 pub type PRTL_SRWLOCK = *mut RTL_SRWLOCK;
7704 pub const RTL_SRWLOCK_INIT: RTL_SRWLOCK = RTL_SRWLOCK { Ptr: 0 as PVOID };
7705 STRUCT!{struct RTL_CONDITION_VARIABLE {
7706     Ptr: PVOID,
7707 }}
7708 pub type PRTL_CONDITION_VARIABLE = *mut RTL_CONDITION_VARIABLE;
7709 pub const RTL_CONDITION_VARIABLE_INIT: RTL_CONDITION_VARIABLE = RTL_CONDITION_VARIABLE {
7710     Ptr: 0 as PVOID,
7711 };
7712 pub const RTL_CONDITION_VARIABLE_LOCKMODE_SHARED: DWORD = 0x1;
7713 FN!{stdcall PAPCFUNC(
7714     Parameter: ULONG_PTR,
7715 ) -> ()}
7716 FN!{stdcall PVECTORED_EXCEPTION_HANDLER(
7717     ExceptionInfo: *mut EXCEPTION_POINTERS,
7718 ) -> LONG}
7719 ENUM!{enum HEAP_INFORMATION_CLASS {
7720     HeapCompatibilityInformation = 0,
7721     HeapEnableTerminationOnCorruption = 1,
7722     HeapOptimizeResources = 3,
7723 }}
7724 pub const HEAP_OPTIMIZE_RESOURCES_CURRENT_VERSION: DWORD = 1;
7725 STRUCT!{struct HEAP_OPTIMIZE_RESOURCES_INFORMATION {
7726     Version: DWORD,
7727     Flags: DWORD,
7728 }}
7729 pub type PHEAP_OPTIMIZE_RESOURCES_INFORMATION = *mut HEAP_OPTIMIZE_RESOURCES_INFORMATION;
7730 pub const WT_EXECUTEDEFAULT: ULONG = 0x00000000;
7731 pub const WT_EXECUTEINIOTHREAD: ULONG = 0x00000001;
7732 pub const WT_EXECUTEINUITHREAD: ULONG = 0x00000002;
7733 pub const WT_EXECUTEINWAITTHREAD: ULONG = 0x00000004;
7734 pub const WT_EXECUTEONLYONCE: ULONG = 0x00000008;
7735 pub const WT_EXECUTEINTIMERTHREAD: ULONG = 0x00000020;
7736 pub const WT_EXECUTELONGFUNCTION: ULONG = 0x00000010;
7737 pub const WT_EXECUTEINPERSISTENTIOTHREAD: ULONG = 0x00000040;
7738 pub const WT_EXECUTEINPERSISTENTTHREAD: ULONG = 0x00000080;
7739 pub const WT_TRANSFER_IMPERSONATION: ULONG = 0x00000100;
7740 #[inline]
WT_SET_MAX_THREADPOOL_THREADS(Flags: ULONG, Limit: ULONG) -> ULONG7741 pub fn WT_SET_MAX_THREADPOOL_THREADS(Flags: ULONG, Limit: ULONG) -> ULONG {
7742     Flags | (Limit << 16)
7743 }
7744 FN!{stdcall WAITORTIMERCALLBACKFUNC(
7745     PVOID,
7746     BOOLEAN,
7747 ) -> ()}
7748 FN!{stdcall WORKERCALLBACKFUNC(
7749     PVOID,
7750 ) -> ()}
7751 FN!{stdcall APC_CALLBACK_FUNCTION(
7752     DWORD,
7753     PVOID,
7754     PVOID,
7755 ) -> ()}
7756 pub type WAITORTIMERCALLBACK = WAITORTIMERCALLBACKFUNC;
7757 FN!{stdcall PFLS_CALLBACK_FUNCTION(
7758     lpFlsData: PVOID,
7759 ) -> ()}
7760 FN!{stdcall PSECURE_MEMORY_CACHE_CALLBACK(
7761     Addr: PVOID,
7762     Range: SIZE_T,
7763 ) -> BOOLEAN}
7764 pub const WT_EXECUTEINLONGTHREAD: ULONG = 0x00000010;
7765 pub const WT_EXECUTEDELETEWAIT: ULONG = 0x00000008;
7766 ENUM!{enum ACTIVATION_CONTEXT_INFO_CLASS {
7767     ActivationContextBasicInformation = 1,
7768     ActivationContextDetailedInformation = 2,
7769     AssemblyDetailedInformationInActivationContext = 3,
7770     FileInformationInAssemblyOfAssemblyInActivationContext = 4,
7771     RunlevelInformationInActivationContext = 5,
7772     CompatibilityInformationInActivationContext = 6,
7773     ActivationContextManifestResourceName = 7,
7774     MaxActivationContextInfoClass,
7775     AssemblyDetailedInformationInActivationContxt = 3,
7776     FileInformationInAssemblyOfAssemblyInActivationContxt = 4,
7777 }}
7778 pub type ACTIVATIONCONTEXTINFOCLASS = ACTIVATION_CONTEXT_INFO_CLASS;
7779 STRUCT!{struct ACTIVATION_CONTEXT_QUERY_INDEX {
7780     ulAssemblyIndex: DWORD,
7781     ulFileIndexInAssembly: DWORD,
7782 }}
7783 pub type PACTIVATION_CONTEXT_QUERY_INDEX = *mut ACTIVATION_CONTEXT_QUERY_INDEX;
7784 pub type PCACTIVATION_CONTEXT_QUERY_INDEX = *const ACTIVATION_CONTEXT_QUERY_INDEX;
7785 pub const ACTIVATION_CONTEXT_PATH_TYPE_NONE: DWORD = 1;
7786 pub const ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE: DWORD = 2;
7787 pub const ACTIVATION_CONTEXT_PATH_TYPE_URL: DWORD = 3;
7788 pub const ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF: DWORD = 4;
7789 STRUCT!{struct ASSEMBLY_FILE_DETAILED_INFORMATION {
7790     ulFlags: DWORD,
7791     ulFilenameLength: DWORD,
7792     ulPathLength: DWORD,
7793     lpFileName: PCWSTR,
7794     lpFilePath: PCWSTR,
7795 }}
7796 pub type PASSEMBLY_FILE_DETAILED_INFORMATION = *mut ASSEMBLY_FILE_DETAILED_INFORMATION;
7797 pub type PCASSEMBLY_FILE_DETAILED_INFORMATION = *const ASSEMBLY_FILE_DETAILED_INFORMATION;
7798 pub type ASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = ASSEMBLY_FILE_DETAILED_INFORMATION;
7799 pub type PASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PASSEMBLY_FILE_DETAILED_INFORMATION;
7800 pub type PCASSEMBLY_DLL_REDIRECTION_DETAILED_INFORMATION = PCASSEMBLY_FILE_DETAILED_INFORMATION;
7801 STRUCT!{struct ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
7802     ulFlags: DWORD,
7803     ulEncodedAssemblyIdentityLength: DWORD,
7804     ulManifestPathType: DWORD,
7805     ulManifestPathLength: DWORD,
7806     liManifestLastWriteTime: LARGE_INTEGER,
7807     ulPolicyPathType: DWORD,
7808     ulPolicyPathLength: DWORD,
7809     liPolicyLastWriteTime: LARGE_INTEGER,
7810     ulMetadataSatelliteRosterIndex: DWORD,
7811     ulManifestVersionMajor: DWORD,
7812     ulManifestVersionMinor: DWORD,
7813     ulPolicyVersionMajor: DWORD,
7814     ulPolicyVersionMinor: DWORD,
7815     ulAssemblyDirectoryNameLength: DWORD,
7816     lpAssemblyEncodedAssemblyIdentity: PCWSTR,
7817     lpAssemblyManifestPath: PCWSTR,
7818     lpAssemblyPolicyPath: PCWSTR,
7819     lpAssemblyDirectoryName: PCWSTR,
7820     ulFileCount: DWORD,
7821 }}
7822 pub type PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
7823     = *mut ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
7824 pub type PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
7825     = *const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
7826 ENUM!{enum ACTCTX_REQUESTED_RUN_LEVEL {
7827     ACTCTX_RUN_LEVEL_UNSPECIFIED = 0,
7828     ACTCTX_RUN_LEVEL_AS_INVOKER,
7829     ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE,
7830     ACTCTX_RUN_LEVEL_REQUIRE_ADMIN,
7831     ACTCTX_RUN_LEVEL_NUMBERS,
7832 }}
7833 STRUCT!{struct ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION {
7834     ulFlags: DWORD,
7835     RunLevel: ACTCTX_REQUESTED_RUN_LEVEL,
7836     UiAccess: DWORD,
7837 }}
7838 pub type PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION = *mut ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION;
7839 pub type PCACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION
7840     = *const ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION;
7841 ENUM!{enum ACTCTX_COMPATIBILITY_ELEMENT_TYPE {
7842     ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0,
7843     ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS,
7844     ACTCTX_COMPATIBILITY_ELEMENT_TYPE_MITIGATION,
7845 }}
7846 STRUCT!{struct COMPATIBILITY_CONTEXT_ELEMENT {
7847     Id: GUID,
7848     Type: ACTCTX_COMPATIBILITY_ELEMENT_TYPE,
7849 }}
7850 pub type PCOMPATIBILITY_CONTEXT_ELEMENT = *mut COMPATIBILITY_CONTEXT_ELEMENT;
7851 pub type PCCOMPATIBILITY_CONTEXT_ELEMENT = *const COMPATIBILITY_CONTEXT_ELEMENT;
7852 STRUCT!{struct ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION {
7853     ElementCount: DWORD,
7854     Elements: [COMPATIBILITY_CONTEXT_ELEMENT; 0],
7855 }}
7856 pub type PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
7857     = *mut ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION;
7858 pub type PCACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION
7859     = *const ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION;
7860 STRUCT!{struct SUPPORTED_OS_INFO {
7861     MajorVersion: WORD,
7862     MinorVersion: WORD,
7863 }}
7864 pub type PSUPPORTED_OS_INFO = *mut SUPPORTED_OS_INFO;
7865 STRUCT!{struct ACTIVATION_CONTEXT_DETAILED_INFORMATION {
7866     dwFlags: DWORD,
7867     ulFormatVersion: DWORD,
7868     ulAssemblyCount: DWORD,
7869     ulRootManifestPathType: DWORD,
7870     ulRootManifestPathChars: DWORD,
7871     ulRootConfigurationPathType: DWORD,
7872     ulRootConfigurationPathChars: DWORD,
7873     ulAppDirPathType: DWORD,
7874     ulAppDirPathChars: DWORD,
7875     lpRootManifestPath: PCWSTR,
7876     lpRootConfigurationPath: PCWSTR,
7877     lpAppDirPath: PCWSTR,
7878 }}
7879 pub type PACTIVATION_CONTEXT_DETAILED_INFORMATION = *mut ACTIVATION_CONTEXT_DETAILED_INFORMATION;
7880 pub type PCACTIVATION_CONTEXT_DETAILED_INFORMATION
7881     = *const ACTIVATION_CONTEXT_DETAILED_INFORMATION;
7882 pub const CREATE_BOUNDARY_DESCRIPTOR_ADD_APPCONTAINER_SID: DWORD = 0x1;
7883 STRUCT!{struct HARDWARE_COUNTER_DATA {
7884     Type: HARDWARE_COUNTER_TYPE,
7885     Reserved: DWORD,
7886     Value: DWORD64,
7887 }}
7888 pub type PHARDWARE_COUNTER_DATA = *mut HARDWARE_COUNTER_DATA;
7889 pub const PERFORMANCE_DATA_VERSION: BYTE = 1;
7890 STRUCT!{struct PERFORMANCE_DATA {
7891     Size: WORD,
7892     Version: BYTE,
7893     HwCountersCount: BYTE,
7894     ContextSwitchCount: DWORD,
7895     WaitReasonBitMap: DWORD64,
7896     CycleTime: DWORD64,
7897     RetryCount: DWORD,
7898     Reserved: DWORD,
7899     HwCounters: [HARDWARE_COUNTER_DATA; MAX_HW_COUNTERS],
7900 }}
7901 pub type PPERFORMANCE_DATA = *mut PERFORMANCE_DATA;
7902 pub const READ_THREAD_PROFILING_FLAG_DISPATCHING: DWORD = 0x00000001;
7903 pub const READ_THREAD_PROFILING_FLAG_HARDWARE_COUNTERS: DWORD = 0x00000002;
7904 pub const UNIFIEDBUILDREVISION_KEY: &'static str
7905     = "\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion";
7906 pub const UNIFIEDBUILDREVISION_VALUE: &'static str = "UBR";
7907 pub const UNIFIEDBUILDREVISION_MIN: DWORD = 0x00000000;
7908 pub const DEVICEFAMILYDEVICEFORM_KEY: &'static str
7909     = "\\Registry\\Machine\\Software\\Microsoft\\Windows NT\\CurrentVersion\\OEM";
7910 pub const DEVICEFAMILYDEVICEFORM_VALUE: &'static str = "DeviceForm";
7911 pub const DEVICEFAMILYINFOENUM_UAP: DWORD = 0x00000000;
7912 pub const DEVICEFAMILYINFOENUM_WINDOWS_8X: DWORD = 0x00000001;
7913 pub const DEVICEFAMILYINFOENUM_WINDOWS_PHONE_8X: DWORD = 0x00000002;
7914 pub const DEVICEFAMILYINFOENUM_DESKTOP: DWORD = 0x00000003;
7915 pub const DEVICEFAMILYINFOENUM_MOBILE: DWORD = 0x00000004;
7916 pub const DEVICEFAMILYINFOENUM_XBOX: DWORD = 0x00000005;
7917 pub const DEVICEFAMILYINFOENUM_TEAM: DWORD = 0x00000006;
7918 pub const DEVICEFAMILYINFOENUM_IOT: DWORD = 0x00000007;
7919 pub const DEVICEFAMILYINFOENUM_IOT_HEADLESS: DWORD = 0x00000008;
7920 pub const DEVICEFAMILYINFOENUM_SERVER: DWORD = 0x00000009;
7921 pub const DEVICEFAMILYINFOENUM_HOLOGRAPHIC: DWORD = 0x0000000A;
7922 pub const DEVICEFAMILYINFOENUM_XBOXSRA: DWORD = 0x0000000B;
7923 pub const DEVICEFAMILYINFOENUM_XBOXERA: DWORD = 0x0000000C;
7924 pub const DEVICEFAMILYINFOENUM_SERVER_NANO: DWORD = 0x0000000D;
7925 pub const DEVICEFAMILYINFOENUM_MAX: DWORD = 0x0000000D;
7926 pub const DEVICEFAMILYDEVICEFORM_UNKNOWN: DWORD = 0x00000000;
7927 pub const DEVICEFAMILYDEVICEFORM_PHONE: DWORD = 0x00000001;
7928 pub const DEVICEFAMILYDEVICEFORM_TABLET: DWORD = 0x00000002;
7929 pub const DEVICEFAMILYDEVICEFORM_DESKTOP: DWORD = 0x00000003;
7930 pub const DEVICEFAMILYDEVICEFORM_NOTEBOOK: DWORD = 0x00000004;
7931 pub const DEVICEFAMILYDEVICEFORM_CONVERTIBLE: DWORD = 0x00000005;
7932 pub const DEVICEFAMILYDEVICEFORM_DETACHABLE: DWORD = 0x00000006;
7933 pub const DEVICEFAMILYDEVICEFORM_ALLINONE: DWORD = 0x00000007;
7934 pub const DEVICEFAMILYDEVICEFORM_STICKPC: DWORD = 0x00000008;
7935 pub const DEVICEFAMILYDEVICEFORM_PUCK: DWORD = 0x00000009;
7936 pub const DEVICEFAMILYDEVICEFORM_LARGESCREEN: DWORD = 0x0000000A;
7937 pub const DEVICEFAMILYDEVICEFORM_HMD: DWORD = 0x0000000B;
7938 pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_HANDHELD: DWORD = 0x0000000C;
7939 pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_TABLET: DWORD = 0x0000000D;
7940 pub const DEVICEFAMILYDEVICEFORM_BANKING: DWORD = 0x0000000E;
7941 pub const DEVICEFAMILYDEVICEFORM_BUILDING_AUTOMATION: DWORD = 0x0000000F;
7942 pub const DEVICEFAMILYDEVICEFORM_DIGITAL_SIGNAGE: DWORD = 0x00000010;
7943 pub const DEVICEFAMILYDEVICEFORM_GAMING: DWORD = 0x00000011;
7944 pub const DEVICEFAMILYDEVICEFORM_HOME_AUTOMATION: DWORD = 0x00000012;
7945 pub const DEVICEFAMILYDEVICEFORM_INDUSTRIAL_AUTOMATION: DWORD = 0x00000013;
7946 pub const DEVICEFAMILYDEVICEFORM_KIOSK: DWORD = 0x00000014;
7947 pub const DEVICEFAMILYDEVICEFORM_MAKER_BOARD: DWORD = 0x00000015;
7948 pub const DEVICEFAMILYDEVICEFORM_MEDICAL: DWORD = 0x00000016;
7949 pub const DEVICEFAMILYDEVICEFORM_NETWORKING: DWORD = 0x00000017;
7950 pub const DEVICEFAMILYDEVICEFORM_POINT_OF_SERVICE: DWORD = 0x00000018;
7951 pub const DEVICEFAMILYDEVICEFORM_PRINTING: DWORD = 0x00000019;
7952 pub const DEVICEFAMILYDEVICEFORM_THIN_CLIENT: DWORD = 0x0000001A;
7953 pub const DEVICEFAMILYDEVICEFORM_TOY: DWORD = 0x0000001B;
7954 pub const DEVICEFAMILYDEVICEFORM_VENDING: DWORD = 0x0000001C;
7955 pub const DEVICEFAMILYDEVICEFORM_INDUSTRY_OTHER: DWORD = 0x0000001D;
7956 pub const DEVICEFAMILYDEVICEFORM_MAX: DWORD = 0x0000001D;
7957 extern "system" {
RtlGetDeviceFamilyInfoEnum( pullUAPInfo: *mut ULONGLONG, pulDeviceFamily: *mut DWORD, pulDeviceForm: *mut DWORD, )7958     pub fn RtlGetDeviceFamilyInfoEnum(
7959         pullUAPInfo: *mut ULONGLONG,
7960         pulDeviceFamily: *mut DWORD,
7961         pulDeviceForm: *mut DWORD,
7962     );
RtlConvertDeviceFamilyInfoToString( pulDeviceFamilyBufferSize: PDWORD, pulDeviceFormBufferSize: PDWORD, DeviceFamily: PWSTR, DeviceForm: PWSTR, ) -> DWORD7963     pub fn RtlConvertDeviceFamilyInfoToString(
7964         pulDeviceFamilyBufferSize: PDWORD,
7965         pulDeviceFormBufferSize: PDWORD,
7966         DeviceFamily: PWSTR,
7967         DeviceForm: PWSTR,
7968     ) -> DWORD;
RtlSwitchedVVI( VersionInfo: PRTL_OSVERSIONINFOEXW, TypeMask: DWORD, ConditionMask: ULONGLONG, ) -> DWORD7969     pub fn RtlSwitchedVVI(
7970         VersionInfo: PRTL_OSVERSIONINFOEXW,
7971         TypeMask: DWORD,
7972         ConditionMask: ULONGLONG,
7973     ) -> DWORD;
7974 }
7975 pub const DLL_PROCESS_ATTACH: DWORD = 1;
7976 pub const DLL_THREAD_ATTACH: DWORD = 2;
7977 pub const DLL_THREAD_DETACH: DWORD = 3;
7978 pub const DLL_PROCESS_DETACH: DWORD = 0;
7979 pub const EVENTLOG_SEQUENTIAL_READ: DWORD = 0x0001;
7980 pub const EVENTLOG_SEEK_READ: DWORD = 0x0002;
7981 pub const EVENTLOG_FORWARDS_READ: DWORD = 0x0004;
7982 pub const EVENTLOG_BACKWARDS_READ: DWORD = 0x0008;
7983 pub const EVENTLOG_SUCCESS: WORD = 0x0000;
7984 pub const EVENTLOG_ERROR_TYPE: WORD = 0x0001;
7985 pub const EVENTLOG_WARNING_TYPE: WORD = 0x0002;
7986 pub const EVENTLOG_INFORMATION_TYPE: WORD = 0x0004;
7987 pub const EVENTLOG_AUDIT_SUCCESS: WORD = 0x0008;
7988 pub const EVENTLOG_AUDIT_FAILURE: WORD = 0x0010;
7989 pub const EVENTLOG_START_PAIRED_EVENT: WORD = 0x0001;
7990 pub const EVENTLOG_END_PAIRED_EVENT: WORD = 0x0002;
7991 pub const EVENTLOG_END_ALL_PAIRED_EVENTS: WORD = 0x0004;
7992 pub const EVENTLOG_PAIRED_EVENT_ACTIVE: WORD = 0x0008;
7993 pub const EVENTLOG_PAIRED_EVENT_INACTIVE: WORD = 0x0010;
7994 STRUCT!{struct EVENTLOGRECORD {
7995     Length: DWORD,
7996     Reserved: DWORD,
7997     RecordNumber: DWORD,
7998     TimeGenerated: DWORD,
7999     TimeWritten: DWORD,
8000     EventID: DWORD,
8001     EventType: WORD,
8002     NumStrings: WORD,
8003     EventCategory: WORD,
8004     ReservedFlags: WORD,
8005     ClosingRecordNumber: DWORD,
8006     StringOffset: DWORD,
8007     UserSidLength: DWORD,
8008     UserSidOffset: DWORD,
8009     DataLength: DWORD,
8010     DataOffset: DWORD,
8011 }}
8012 pub type PEVENTLOGRECORD = *mut EVENTLOGRECORD;
8013 pub const MAXLOGICALLOGNAMESIZE: usize = 256;
8014 pub type PEVENTSFORLOGFILE = *mut EVENTSFORLOGFILE;
8015 pub type PPACKEDEVENTINFO = *mut PACKEDEVENTINFO;
8016 STRUCT!{struct EVENTSFORLOGFILE {
8017     ulSize: DWORD,
8018     szLogicalLogFile: [WCHAR; MAXLOGICALLOGNAMESIZE],
8019     ulNumRecords: DWORD,
8020     pEventLogRecords: [EVENTLOGRECORD; 0],
8021 }}
8022 STRUCT!{struct PACKEDEVENTINFO {
8023     ulSize: DWORD,
8024     ulNumEventsForLogFile: DWORD,
8025     ulOffsets: [DWORD; 0],
8026 }}
8027 pub const KEY_QUERY_VALUE: u32 = 0x0001;
8028 pub const KEY_SET_VALUE: u32 = 0x0002;
8029 pub const KEY_CREATE_SUB_KEY: u32 = 0x0004;
8030 pub const KEY_ENUMERATE_SUB_KEYS: u32 = 0x0008;
8031 pub const KEY_NOTIFY: u32 = 0x0010;
8032 pub const KEY_CREATE_LINK: u32 = 0x0020;
8033 pub const KEY_WOW64_32KEY: u32 = 0x0200;
8034 pub const KEY_WOW64_64KEY: u32 = 0x0100;
8035 pub const KEY_WOW64_RES: u32 = 0x0300;
8036 pub const KEY_READ: u32 = (STANDARD_RIGHTS_READ | KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS
8037     | KEY_NOTIFY) & !SYNCHRONIZE;
8038 pub const KEY_WRITE: u32 = (STANDARD_RIGHTS_WRITE | KEY_SET_VALUE | KEY_CREATE_SUB_KEY)
8039     & !SYNCHRONIZE;
8040 pub const KEY_EXECUTE: u32 = KEY_READ & !SYNCHRONIZE;
8041 pub const KEY_ALL_ACCESS: u32 = (STANDARD_RIGHTS_ALL | KEY_QUERY_VALUE | KEY_SET_VALUE
8042     | KEY_CREATE_SUB_KEY | KEY_ENUMERATE_SUB_KEYS | KEY_NOTIFY | KEY_CREATE_LINK) & !SYNCHRONIZE;
8043 pub const REG_OPTION_RESERVED: DWORD = 0x00000000;
8044 pub const REG_OPTION_NON_VOLATILE: DWORD = 0x00000000;
8045 pub const REG_OPTION_VOLATILE: DWORD = 0x00000001;
8046 pub const REG_OPTION_CREATE_LINK: DWORD = 0x00000002;
8047 pub const REG_OPTION_BACKUP_RESTORE: DWORD = 0x00000004;
8048 pub const REG_OPTION_OPEN_LINK: DWORD = 0x00000008;
8049 pub const REG_OPTION_DONT_VIRTUALIZE: DWORD = 0x00000010;
8050 pub const REG_LEGAL_OPTION: DWORD = REG_OPTION_RESERVED | REG_OPTION_NON_VOLATILE
8051     | REG_OPTION_VOLATILE | REG_OPTION_CREATE_LINK | REG_OPTION_BACKUP_RESTORE
8052     | REG_OPTION_OPEN_LINK | REG_OPTION_DONT_VIRTUALIZE;
8053 pub const REG_OPEN_LEGAL_OPTION: DWORD = REG_OPTION_RESERVED | REG_OPTION_BACKUP_RESTORE
8054     | REG_OPTION_OPEN_LINK | REG_OPTION_DONT_VIRTUALIZE;
8055 pub const REG_CREATED_NEW_KEY: DWORD = 0x00000001;
8056 pub const REG_OPENED_EXISTING_KEY: DWORD = 0x00000002;
8057 pub const REG_STANDARD_FORMAT: DWORD = 1;
8058 pub const REG_LATEST_FORMAT: DWORD = 2;
8059 pub const REG_NO_COMPRESSION: DWORD = 4;
8060 pub const REG_WHOLE_HIVE_VOLATILE: DWORD = 0x00000001;
8061 pub const REG_REFRESH_HIVE: DWORD = 0x00000002;
8062 pub const REG_NO_LAZY_FLUSH: DWORD = 0x00000004;
8063 pub const REG_FORCE_RESTORE: DWORD = 0x00000008;
8064 pub const REG_APP_HIVE: DWORD = 0x00000010;
8065 pub const REG_PROCESS_PRIVATE: DWORD = 0x00000020;
8066 pub const REG_START_JOURNAL: DWORD = 0x00000040;
8067 pub const REG_HIVE_EXACT_FILE_GROWTH: DWORD = 0x00000080;
8068 pub const REG_HIVE_NO_RM: DWORD = 0x00000100;
8069 pub const REG_HIVE_SINGLE_LOG: DWORD = 0x00000200;
8070 pub const REG_BOOT_HIVE: DWORD = 0x00000400;
8071 pub const REG_LOAD_HIVE_OPEN_HANDLE: DWORD = 0x00000800;
8072 pub const REG_FLUSH_HIVE_FILE_GROWTH: DWORD = 0x00001000;
8073 pub const REG_OPEN_READ_ONLY: DWORD = 0x00002000;
8074 pub const REG_IMMUTABLE: DWORD = 0x00004000;
8075 pub const REG_APP_HIVE_OPEN_READ_ONLY: DWORD = REG_OPEN_READ_ONLY;
8076 pub const REG_FORCE_UNLOAD: DWORD = 1;
8077 pub const REG_UNLOAD_LEGAL_FLAGS: DWORD = REG_FORCE_UNLOAD;
8078 pub const REG_NOTIFY_CHANGE_NAME: DWORD = 0x00000001;
8079 pub const REG_NOTIFY_CHANGE_ATTRIBUTES: DWORD = 0x00000002;
8080 pub const REG_NOTIFY_CHANGE_LAST_SET: DWORD = 0x00000004;
8081 pub const REG_NOTIFY_CHANGE_SECURITY: DWORD = 0x00000008;
8082 pub const REG_NOTIFY_THREAD_AGNOSTIC: DWORD = 0x10000000;
8083 pub const REG_LEGAL_CHANGE_FILTER: DWORD = REG_NOTIFY_CHANGE_NAME | REG_NOTIFY_CHANGE_ATTRIBUTES
8084     | REG_NOTIFY_CHANGE_LAST_SET | REG_NOTIFY_CHANGE_SECURITY | REG_NOTIFY_THREAD_AGNOSTIC;
8085 pub const REG_NONE: DWORD = 0;
8086 pub const REG_SZ: DWORD = 1;
8087 pub const REG_EXPAND_SZ: DWORD = 2;
8088 pub const REG_BINARY: DWORD = 3;
8089 pub const REG_DWORD: DWORD = 4;
8090 pub const REG_DWORD_LITTLE_ENDIAN: DWORD = 4;
8091 pub const REG_DWORD_BIG_ENDIAN: DWORD = 5;
8092 pub const REG_LINK: DWORD = 6;
8093 pub const REG_MULTI_SZ: DWORD = 7;
8094 pub const REG_RESOURCE_LIST: DWORD = 8;
8095 pub const REG_FULL_RESOURCE_DESCRIPTOR: DWORD = 9;
8096 pub const REG_RESOURCE_REQUIREMENTS_LIST: DWORD = 10;
8097 pub const REG_QWORD: DWORD = 11;
8098 pub const REG_QWORD_LITTLE_ENDIAN: DWORD = 11;
8099 pub const SERVICE_KERNEL_DRIVER: DWORD = 0x00000001;
8100 pub const SERVICE_FILE_SYSTEM_DRIVER: DWORD = 0x00000002;
8101 pub const SERVICE_ADAPTER: DWORD = 0x00000004;
8102 pub const SERVICE_RECOGNIZER_DRIVER: DWORD = 0x00000008;
8103 pub const SERVICE_DRIVER: DWORD = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER
8104     | SERVICE_RECOGNIZER_DRIVER;
8105 pub const SERVICE_WIN32_OWN_PROCESS: DWORD = 0x00000010;
8106 pub const SERVICE_WIN32_SHARE_PROCESS: DWORD = 0x00000020;
8107 pub const SERVICE_WIN32: DWORD = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS;
8108 pub const SERVICE_USER_SERVICE: DWORD = 0x00000040;
8109 pub const SERVICE_USERSERVICE_INSTANCE: DWORD = 0x00000080;
8110 pub const SERVICE_USER_SHARE_PROCESS: DWORD = SERVICE_USER_SERVICE | SERVICE_WIN32_SHARE_PROCESS;
8111 pub const SERVICE_USER_OWN_PROCESS: DWORD = SERVICE_USER_SERVICE | SERVICE_WIN32_OWN_PROCESS;
8112 pub const SERVICE_INTERACTIVE_PROCESS: DWORD = 0x00000100;
8113 pub const SERVICE_PKG_SERVICE: DWORD = 0x00000200;
8114 pub const SERVICE_TYPE_ALL: DWORD = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER
8115     | SERVICE_INTERACTIVE_PROCESS | SERVICE_USER_SERVICE | SERVICE_USERSERVICE_INSTANCE
8116     | SERVICE_PKG_SERVICE;
8117 pub const SERVICE_BOOT_START: DWORD = 0x00000000;
8118 pub const SERVICE_SYSTEM_START: DWORD = 0x00000001;
8119 pub const SERVICE_AUTO_START: DWORD = 0x00000002;
8120 pub const SERVICE_DEMAND_START: DWORD = 0x00000003;
8121 pub const SERVICE_DISABLED: DWORD = 0x00000004;
8122 pub const SERVICE_ERROR_IGNORE: DWORD = 0x00000000;
8123 pub const SERVICE_ERROR_NORMAL: DWORD = 0x00000001;
8124 pub const SERVICE_ERROR_SEVERE: DWORD = 0x00000002;
8125 pub const SERVICE_ERROR_CRITICAL: DWORD = 0x00000003;
8126 ENUM!{enum SERVICE_NODE_TYPE {
8127     DriverType = SERVICE_KERNEL_DRIVER,
8128     FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
8129     Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
8130     Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
8131     AdapterType = SERVICE_ADAPTER,
8132     RecognizerType = SERVICE_RECOGNIZER_DRIVER,
8133 }}
8134 ENUM!{enum SERVICE_LOAD_TYPE {
8135     BootLoad = SERVICE_BOOT_START,
8136     SystemLoad = SERVICE_SYSTEM_START,
8137     AutoLoad = SERVICE_AUTO_START,
8138     DemandLoad = SERVICE_DEMAND_START,
8139     DisableLoad = SERVICE_DISABLED,
8140 }}
8141 ENUM!{enum SERVICE_ERROR_TYPE {
8142     IgnoreError = SERVICE_ERROR_IGNORE,
8143     NormalError = SERVICE_ERROR_NORMAL,
8144     SevereError = SERVICE_ERROR_SEVERE,
8145     CriticalError = SERVICE_ERROR_CRITICAL,
8146 }}
8147 pub const CM_SERVICE_NETWORK_BOOT_LOAD: DWORD = 0x00000001;
8148 pub const CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD: DWORD = 0x00000002;
8149 pub const CM_SERVICE_USB_DISK_BOOT_LOAD: DWORD = 0x00000004;
8150 pub const CM_SERVICE_SD_DISK_BOOT_LOAD: DWORD = 0x00000008;
8151 pub const CM_SERVICE_USB3_DISK_BOOT_LOAD: DWORD = 0x00000010;
8152 pub const CM_SERVICE_MEASURED_BOOT_LOAD: DWORD = 0x00000020;
8153 pub const CM_SERVICE_VERIFIER_BOOT_LOAD: DWORD = 0x00000040;
8154 pub const CM_SERVICE_WINPE_BOOT_LOAD: DWORD = 0x00000080;
8155 pub const CM_SERVICE_VALID_PROMOTION_MASK: DWORD = CM_SERVICE_NETWORK_BOOT_LOAD
8156     | CM_SERVICE_VIRTUAL_DISK_BOOT_LOAD | CM_SERVICE_USB_DISK_BOOT_LOAD
8157     | CM_SERVICE_SD_DISK_BOOT_LOAD | CM_SERVICE_USB3_DISK_BOOT_LOAD
8158     | CM_SERVICE_MEASURED_BOOT_LOAD | CM_SERVICE_VERIFIER_BOOT_LOAD | CM_SERVICE_WINPE_BOOT_LOAD;
8159 pub const TAPE_ERASE_SHORT: DWORD = 0;
8160 pub const TAPE_ERASE_LONG: DWORD = 1;
8161 STRUCT!{struct TAPE_ERASE {
8162     Type: DWORD,
8163     Immediate: BOOLEAN,
8164 }}
8165 pub type PTAPE_ERASE = *mut TAPE_ERASE;
8166 pub const TAPE_LOAD: DWORD = 0;
8167 pub const TAPE_UNLOAD: DWORD = 1;
8168 pub const TAPE_TENSION: DWORD = 2;
8169 pub const TAPE_LOCK: DWORD = 3;
8170 pub const TAPE_UNLOCK: DWORD = 4;
8171 pub const TAPE_FORMAT: DWORD = 5;
8172 STRUCT!{struct TAPE_PREPARE {
8173     Operation: DWORD,
8174     Immediate: BOOLEAN,
8175 }}
8176 pub type PTAPE_PREPARE = *mut TAPE_PREPARE;
8177 pub const TAPE_SETMARKS: DWORD = 0;
8178 pub const TAPE_FILEMARKS: DWORD = 1;
8179 pub const TAPE_SHORT_FILEMARKS: DWORD = 2;
8180 pub const TAPE_LONG_FILEMARKS: DWORD = 3;
8181 STRUCT!{struct TAPE_WRITE_MARKS {
8182     Type: DWORD,
8183     Count: DWORD,
8184     Immediate: BOOLEAN,
8185 }}
8186 pub type PTAPE_WRITE_MARKS = *mut TAPE_WRITE_MARKS;
8187 pub const TAPE_ABSOLUTE_POSITION: DWORD = 0;
8188 pub const TAPE_LOGICAL_POSITION: DWORD = 1;
8189 pub const TAPE_PSEUDO_LOGICAL_POSITION: DWORD = 2;
8190 STRUCT!{struct TAPE_GET_POSITION {
8191     Type: DWORD,
8192     Partition: DWORD,
8193     Offset: LARGE_INTEGER,
8194 }}
8195 pub type PTAPE_GET_POSITION = *mut TAPE_GET_POSITION;
8196 pub const TAPE_REWIND: DWORD = 0;
8197 pub const TAPE_ABSOLUTE_BLOCK: DWORD = 1;
8198 pub const TAPE_LOGICAL_BLOCK: DWORD = 2;
8199 pub const TAPE_PSEUDO_LOGICAL_BLOCK: DWORD = 3;
8200 pub const TAPE_SPACE_END_OF_DATA: DWORD = 4;
8201 pub const TAPE_SPACE_RELATIVE_BLOCKS: DWORD = 5;
8202 pub const TAPE_SPACE_FILEMARKS: DWORD = 6;
8203 pub const TAPE_SPACE_SEQUENTIAL_FMKS: DWORD = 7;
8204 pub const TAPE_SPACE_SETMARKS: DWORD = 8;
8205 pub const TAPE_SPACE_SEQUENTIAL_SMKS: DWORD = 9;
8206 STRUCT!{struct TAPE_SET_POSITION {
8207     Method: DWORD,
8208     Partition: DWORD,
8209     Offset: LARGE_INTEGER,
8210     Immediate: BOOLEAN,
8211 }}
8212 pub type PTAPE_SET_POSITION = *mut TAPE_SET_POSITION;
8213 pub const TAPE_DRIVE_FIXED: DWORD = 0x00000001;
8214 pub const TAPE_DRIVE_SELECT: DWORD = 0x00000002;
8215 pub const TAPE_DRIVE_INITIATOR: DWORD = 0x00000004;
8216 pub const TAPE_DRIVE_ERASE_SHORT: DWORD = 0x00000010;
8217 pub const TAPE_DRIVE_ERASE_LONG: DWORD = 0x00000020;
8218 pub const TAPE_DRIVE_ERASE_BOP_ONLY: DWORD = 0x00000040;
8219 pub const TAPE_DRIVE_ERASE_IMMEDIATE: DWORD = 0x00000080;
8220 pub const TAPE_DRIVE_TAPE_CAPACITY: DWORD = 0x00000100;
8221 pub const TAPE_DRIVE_TAPE_REMAINING: DWORD = 0x00000200;
8222 pub const TAPE_DRIVE_FIXED_BLOCK: DWORD = 0x00000400;
8223 pub const TAPE_DRIVE_VARIABLE_BLOCK: DWORD = 0x00000800;
8224 pub const TAPE_DRIVE_WRITE_PROTECT: DWORD = 0x00001000;
8225 pub const TAPE_DRIVE_EOT_WZ_SIZE: DWORD = 0x00002000;
8226 pub const TAPE_DRIVE_ECC: DWORD = 0x00010000;
8227 pub const TAPE_DRIVE_COMPRESSION: DWORD = 0x00020000;
8228 pub const TAPE_DRIVE_PADDING: DWORD = 0x00040000;
8229 pub const TAPE_DRIVE_REPORT_SMKS: DWORD = 0x00080000;
8230 pub const TAPE_DRIVE_GET_ABSOLUTE_BLK: DWORD = 0x00100000;
8231 pub const TAPE_DRIVE_GET_LOGICAL_BLK: DWORD = 0x00200000;
8232 pub const TAPE_DRIVE_SET_EOT_WZ_SIZE: DWORD = 0x00400000;
8233 pub const TAPE_DRIVE_EJECT_MEDIA: DWORD = 0x01000000;
8234 pub const TAPE_DRIVE_CLEAN_REQUESTS: DWORD = 0x02000000;
8235 pub const TAPE_DRIVE_SET_CMP_BOP_ONLY: DWORD = 0x04000000;
8236 pub const TAPE_DRIVE_RESERVED_BIT: DWORD = 0x80000000;
8237 pub const TAPE_DRIVE_LOAD_UNLOAD: DWORD = 0x80000001;
8238 pub const TAPE_DRIVE_TENSION: DWORD = 0x80000002;
8239 pub const TAPE_DRIVE_LOCK_UNLOCK: DWORD = 0x80000004;
8240 pub const TAPE_DRIVE_REWIND_IMMEDIATE: DWORD = 0x80000008;
8241 pub const TAPE_DRIVE_SET_BLOCK_SIZE: DWORD = 0x80000010;
8242 pub const TAPE_DRIVE_LOAD_UNLD_IMMED: DWORD = 0x80000020;
8243 pub const TAPE_DRIVE_TENSION_IMMED: DWORD = 0x80000040;
8244 pub const TAPE_DRIVE_LOCK_UNLK_IMMED: DWORD = 0x80000080;
8245 pub const TAPE_DRIVE_SET_ECC: DWORD = 0x80000100;
8246 pub const TAPE_DRIVE_SET_COMPRESSION: DWORD = 0x80000200;
8247 pub const TAPE_DRIVE_SET_PADDING: DWORD = 0x80000400;
8248 pub const TAPE_DRIVE_SET_REPORT_SMKS: DWORD = 0x80000800;
8249 pub const TAPE_DRIVE_ABSOLUTE_BLK: DWORD = 0x80001000;
8250 pub const TAPE_DRIVE_ABS_BLK_IMMED: DWORD = 0x80002000;
8251 pub const TAPE_DRIVE_LOGICAL_BLK: DWORD = 0x80004000;
8252 pub const TAPE_DRIVE_LOG_BLK_IMMED: DWORD = 0x80008000;
8253 pub const TAPE_DRIVE_END_OF_DATA: DWORD = 0x80010000;
8254 pub const TAPE_DRIVE_RELATIVE_BLKS: DWORD = 0x80020000;
8255 pub const TAPE_DRIVE_FILEMARKS: DWORD = 0x80040000;
8256 pub const TAPE_DRIVE_SEQUENTIAL_FMKS: DWORD = 0x80080000;
8257 pub const TAPE_DRIVE_SETMARKS: DWORD = 0x80100000;
8258 pub const TAPE_DRIVE_SEQUENTIAL_SMKS: DWORD = 0x80200000;
8259 pub const TAPE_DRIVE_REVERSE_POSITION: DWORD = 0x80400000;
8260 pub const TAPE_DRIVE_SPACE_IMMEDIATE: DWORD = 0x80800000;
8261 pub const TAPE_DRIVE_WRITE_SETMARKS: DWORD = 0x81000000;
8262 pub const TAPE_DRIVE_WRITE_FILEMARKS: DWORD = 0x82000000;
8263 pub const TAPE_DRIVE_WRITE_SHORT_FMKS: DWORD = 0x84000000;
8264 pub const TAPE_DRIVE_WRITE_LONG_FMKS: DWORD = 0x88000000;
8265 pub const TAPE_DRIVE_WRITE_MARK_IMMED: DWORD = 0x90000000;
8266 pub const TAPE_DRIVE_FORMAT: DWORD = 0xA0000000;
8267 pub const TAPE_DRIVE_FORMAT_IMMEDIATE: DWORD = 0xC0000000;
8268 pub const TAPE_DRIVE_HIGH_FEATURES: DWORD = 0x80000000;
8269 STRUCT!{struct TAPE_GET_DRIVE_PARAMETERS {
8270     ECC: BOOLEAN,
8271     Compression: BOOLEAN,
8272     DataPadding: BOOLEAN,
8273     ReportSetmarks: BOOLEAN,
8274     DefaultBlockSize: DWORD,
8275     MaximumBlockSize: DWORD,
8276     MinimumBlockSize: DWORD,
8277     MaximumPartitionCount: DWORD,
8278     FeaturesLow: DWORD,
8279     FeaturesHigh: DWORD,
8280     EOTWarningZoneSize: DWORD,
8281 }}
8282 pub type PTAPE_GET_DRIVE_PARAMETERS = *mut TAPE_GET_DRIVE_PARAMETERS;
8283 STRUCT!{struct TAPE_SET_DRIVE_PARAMETERS {
8284     ECC: BOOLEAN,
8285     Compression: BOOLEAN,
8286     DataPadding: BOOLEAN,
8287     ReportSetmarks: BOOLEAN,
8288     EOTWarningZoneSize: DWORD,
8289 }}
8290 pub type PTAPE_SET_DRIVE_PARAMETERS = *mut TAPE_SET_DRIVE_PARAMETERS;
8291 STRUCT!{struct TAPE_GET_MEDIA_PARAMETERS {
8292     Capacity: LARGE_INTEGER,
8293     Remaining: LARGE_INTEGER,
8294     BlockSize: DWORD,
8295     PartitionCount: DWORD,
8296     WriteProtected: BOOLEAN,
8297 }}
8298 pub type PTAPE_GET_MEDIA_PARAMETERS = *mut TAPE_GET_MEDIA_PARAMETERS;
8299 STRUCT!{struct TAPE_SET_MEDIA_PARAMETERS {
8300     BlockSize: DWORD,
8301 }}
8302 pub type PTAPE_SET_MEDIA_PARAMETERS = *mut TAPE_SET_MEDIA_PARAMETERS;
8303 pub const TAPE_FIXED_PARTITIONS: DWORD = 0;
8304 pub const TAPE_SELECT_PARTITIONS: DWORD = 1;
8305 pub const TAPE_INITIATOR_PARTITIONS: DWORD = 2;
8306 STRUCT!{struct TAPE_CREATE_PARTITION {
8307     Method: DWORD,
8308     Count: DWORD,
8309     Size: DWORD,
8310 }}
8311 pub type PTAPE_CREATE_PARTITION = *mut TAPE_CREATE_PARTITION;
8312 pub const TAPE_QUERY_DRIVE_PARAMETERS: DWORD = 0;
8313 pub const TAPE_QUERY_MEDIA_CAPACITY: DWORD = 1;
8314 pub const TAPE_CHECK_FOR_DRIVE_PROBLEM: DWORD = 2;
8315 pub const TAPE_QUERY_IO_ERROR_DATA: DWORD = 3;
8316 pub const TAPE_QUERY_DEVICE_ERROR_DATA: DWORD = 4;
8317 STRUCT!{struct TAPE_WMI_OPERATIONS {
8318     Method: DWORD,
8319     DataBufferSize: DWORD,
8320     DataBuffer: PVOID,
8321 }}
8322 pub type PTAPE_WMI_OPERATIONS = *mut TAPE_WMI_OPERATIONS;
8323 ENUM!{enum TAPE_DRIVE_PROBLEM_TYPE {
8324     TapeDriveProblemNone,
8325     TapeDriveReadWriteWarning,
8326     TapeDriveReadWriteError,
8327     TapeDriveReadWarning,
8328     TapeDriveWriteWarning,
8329     TapeDriveReadError,
8330     TapeDriveWriteError,
8331     TapeDriveHardwareError,
8332     TapeDriveUnsupportedMedia,
8333     TapeDriveScsiConnectionError,
8334     TapeDriveTimetoClean,
8335     TapeDriveCleanDriveNow,
8336     TapeDriveMediaLifeExpired,
8337     TapeDriveSnappedTape,
8338 }}
8339 pub const TRANSACTIONMANAGER_QUERY_INFORMATION: DWORD = 0x0001;
8340 pub const TRANSACTIONMANAGER_SET_INFORMATION: DWORD = 0x0002;
8341 pub const TRANSACTIONMANAGER_RECOVER: DWORD = 0x0004;
8342 pub const TRANSACTIONMANAGER_RENAME: DWORD = 0x0008;
8343 pub const TRANSACTIONMANAGER_CREATE_RM: DWORD = 0x0010;
8344 pub const TRANSACTIONMANAGER_BIND_TRANSACTION: DWORD = 0x0020;
8345 pub const TRANSACTIONMANAGER_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ
8346     | TRANSACTIONMANAGER_QUERY_INFORMATION;
8347 pub const TRANSACTIONMANAGER_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE
8348     | TRANSACTIONMANAGER_SET_INFORMATION | TRANSACTIONMANAGER_RECOVER | TRANSACTIONMANAGER_RENAME
8349     | TRANSACTIONMANAGER_CREATE_RM;
8350 pub const TRANSACTIONMANAGER_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE;
8351 pub const TRANSACTIONMANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED
8352     | TRANSACTIONMANAGER_GENERIC_READ | TRANSACTIONMANAGER_GENERIC_WRITE
8353     | TRANSACTIONMANAGER_GENERIC_EXECUTE | TRANSACTIONMANAGER_BIND_TRANSACTION;
8354 pub const TRANSACTION_QUERY_INFORMATION: DWORD = 0x0001;
8355 pub const TRANSACTION_SET_INFORMATION: DWORD = 0x0002;
8356 pub const TRANSACTION_ENLIST: DWORD = 0x0004;
8357 pub const TRANSACTION_COMMIT: DWORD = 0x0008;
8358 pub const TRANSACTION_ROLLBACK: DWORD = 0x0010;
8359 pub const TRANSACTION_PROPAGATE: DWORD = 0x0020;
8360 pub const TRANSACTION_RIGHT_RESERVED1: DWORD = 0x0040;
8361 pub const TRANSACTION_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | TRANSACTION_QUERY_INFORMATION
8362     | SYNCHRONIZE;
8363 pub const TRANSACTION_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE | TRANSACTION_SET_INFORMATION
8364     | TRANSACTION_COMMIT | TRANSACTION_ENLIST | TRANSACTION_ROLLBACK | TRANSACTION_PROPAGATE
8365     | SYNCHRONIZE;
8366 pub const TRANSACTION_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | TRANSACTION_COMMIT
8367     | TRANSACTION_ROLLBACK | SYNCHRONIZE;
8368 pub const TRANSACTION_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | TRANSACTION_GENERIC_READ
8369     | TRANSACTION_GENERIC_WRITE | TRANSACTION_GENERIC_EXECUTE;
8370 pub const TRANSACTION_RESOURCE_MANAGER_RIGHTS: DWORD = TRANSACTION_GENERIC_READ
8371     | STANDARD_RIGHTS_WRITE | TRANSACTION_SET_INFORMATION | TRANSACTION_ENLIST
8372     | TRANSACTION_ROLLBACK | TRANSACTION_PROPAGATE | SYNCHRONIZE;
8373 pub const RESOURCEMANAGER_QUERY_INFORMATION: DWORD = 0x0001;
8374 pub const RESOURCEMANAGER_SET_INFORMATION: DWORD = 0x0002;
8375 pub const RESOURCEMANAGER_RECOVER: DWORD = 0x0004;
8376 pub const RESOURCEMANAGER_ENLIST: DWORD = 0x0008;
8377 pub const RESOURCEMANAGER_GET_NOTIFICATION: DWORD = 0x0010;
8378 pub const RESOURCEMANAGER_REGISTER_PROTOCOL: DWORD = 0x0020;
8379 pub const RESOURCEMANAGER_COMPLETE_PROPAGATION: DWORD = 0x0040;
8380 pub const RESOURCEMANAGER_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ
8381     | RESOURCEMANAGER_QUERY_INFORMATION | SYNCHRONIZE;
8382 pub const RESOURCEMANAGER_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE
8383     | RESOURCEMANAGER_SET_INFORMATION | RESOURCEMANAGER_RECOVER | RESOURCEMANAGER_ENLIST
8384     | RESOURCEMANAGER_GET_NOTIFICATION | RESOURCEMANAGER_REGISTER_PROTOCOL
8385     | RESOURCEMANAGER_COMPLETE_PROPAGATION | SYNCHRONIZE;
8386 pub const RESOURCEMANAGER_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE
8387     | RESOURCEMANAGER_RECOVER | RESOURCEMANAGER_ENLIST | RESOURCEMANAGER_GET_NOTIFICATION
8388     | RESOURCEMANAGER_COMPLETE_PROPAGATION | SYNCHRONIZE;
8389 pub const RESOURCEMANAGER_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED
8390     | RESOURCEMANAGER_GENERIC_READ | RESOURCEMANAGER_GENERIC_WRITE
8391     | RESOURCEMANAGER_GENERIC_EXECUTE;
8392 pub const ENLISTMENT_QUERY_INFORMATION: DWORD = 0x0001;
8393 pub const ENLISTMENT_SET_INFORMATION: DWORD = 0x0002;
8394 pub const ENLISTMENT_RECOVER: DWORD = 0x0004;
8395 pub const ENLISTMENT_SUBORDINATE_RIGHTS: DWORD = 0x0008;
8396 pub const ENLISTMENT_SUPERIOR_RIGHTS: DWORD = 0x0010;
8397 pub const ENLISTMENT_GENERIC_READ: DWORD = STANDARD_RIGHTS_READ | ENLISTMENT_QUERY_INFORMATION;
8398 pub const ENLISTMENT_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE | ENLISTMENT_SET_INFORMATION
8399     | ENLISTMENT_RECOVER | ENLISTMENT_SUBORDINATE_RIGHTS | ENLISTMENT_SUPERIOR_RIGHTS;
8400 pub const ENLISTMENT_GENERIC_EXECUTE: DWORD = STANDARD_RIGHTS_EXECUTE | ENLISTMENT_RECOVER
8401     | ENLISTMENT_SUBORDINATE_RIGHTS | ENLISTMENT_SUPERIOR_RIGHTS;
8402 pub const ENLISTMENT_ALL_ACCESS: DWORD = STANDARD_RIGHTS_REQUIRED | ENLISTMENT_GENERIC_READ
8403     | ENLISTMENT_GENERIC_WRITE | ENLISTMENT_GENERIC_EXECUTE;
8404 ENUM!{enum TRANSACTION_OUTCOME {
8405     TransactionOutcomeUndetermined = 1,
8406     TransactionOutcomeCommitted,
8407     TransactionOutcomeAborted,
8408 }}
8409 ENUM!{enum TRANSACTION_STATE {
8410     TransactionStateNormal = 1,
8411     TransactionStateIndoubt,
8412     TransactionStateCommittedNotify,
8413 }}
8414 STRUCT!{struct TRANSACTION_BASIC_INFORMATION {
8415     TransactionId: GUID,
8416     State: DWORD,
8417     Outcome: DWORD,
8418 }}
8419 pub type PTRANSACTION_BASIC_INFORMATION = *mut TRANSACTION_BASIC_INFORMATION;
8420 STRUCT!{struct TRANSACTIONMANAGER_BASIC_INFORMATION {
8421     TmIdentity: GUID,
8422     VirtualClock: LARGE_INTEGER,
8423 }}
8424 pub type PTRANSACTIONMANAGER_BASIC_INFORMATION = *mut TRANSACTIONMANAGER_BASIC_INFORMATION;
8425 STRUCT!{struct TRANSACTIONMANAGER_LOG_INFORMATION {
8426     LogIdentity: GUID,
8427 }}
8428 pub type PTRANSACTIONMANAGER_LOG_INFORMATION = *mut TRANSACTIONMANAGER_LOG_INFORMATION;
8429 STRUCT!{struct TRANSACTIONMANAGER_LOGPATH_INFORMATION {
8430     LogPathLength: DWORD,
8431     LogPath: [WCHAR; 1],
8432 }}
8433 pub type PTRANSACTIONMANAGER_LOGPATH_INFORMATION = *mut TRANSACTIONMANAGER_LOGPATH_INFORMATION;
8434 STRUCT!{struct TRANSACTIONMANAGER_RECOVERY_INFORMATION {
8435     LastRecoveredLsn: ULONGLONG,
8436 }}
8437 pub type PTRANSACTIONMANAGER_RECOVERY_INFORMATION = *mut TRANSACTIONMANAGER_RECOVERY_INFORMATION;
8438 STRUCT!{struct TRANSACTIONMANAGER_OLDEST_INFORMATION {
8439     OldestTransactionGuid: GUID,
8440 }}
8441 pub type PTRANSACTIONMANAGER_OLDEST_INFORMATION = *mut TRANSACTIONMANAGER_OLDEST_INFORMATION;
8442 STRUCT!{struct TRANSACTION_PROPERTIES_INFORMATION {
8443     IsolationLevel: DWORD,
8444     IsolationFlags: DWORD,
8445     Timeout: LARGE_INTEGER,
8446     Outcome: DWORD,
8447     DescriptionLength: DWORD,
8448     Description: [WCHAR; 1],
8449 }}
8450 pub type PTRANSACTION_PROPERTIES_INFORMATION = *mut TRANSACTION_PROPERTIES_INFORMATION;
8451 STRUCT!{struct TRANSACTION_BIND_INFORMATION {
8452     TmHandle: HANDLE,
8453 }}
8454 pub type PTRANSACTION_BIND_INFORMATION = *mut TRANSACTION_BIND_INFORMATION;
8455 STRUCT!{struct TRANSACTION_ENLISTMENT_PAIR {
8456     EnlistmentId: GUID,
8457     ResourceManagerId: GUID,
8458 }}
8459 pub type PTRANSACTION_ENLISTMENT_PAIR = *mut TRANSACTION_ENLISTMENT_PAIR;
8460 STRUCT!{struct TRANSACTION_ENLISTMENTS_INFORMATION {
8461     NumberOfEnlistments: DWORD,
8462     EnlistmentPair: [TRANSACTION_ENLISTMENT_PAIR; 1],
8463 }}
8464 pub type PTRANSACTION_ENLISTMENTS_INFORMATION = *mut TRANSACTION_ENLISTMENTS_INFORMATION;
8465 STRUCT!{struct TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION {
8466     SuperiorEnlistmentPair: TRANSACTION_ENLISTMENT_PAIR,
8467 }}
8468 pub type PTRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION
8469     = *mut TRANSACTION_SUPERIOR_ENLISTMENT_INFORMATION;
8470 STRUCT!{struct RESOURCEMANAGER_BASIC_INFORMATION {
8471     ResourceManagerId: GUID,
8472     DescriptionLength: DWORD,
8473     Description: [WCHAR; 1],
8474 }}
8475 pub type PRESOURCEMANAGER_BASIC_INFORMATION = *mut RESOURCEMANAGER_BASIC_INFORMATION;
8476 STRUCT!{struct RESOURCEMANAGER_COMPLETION_INFORMATION {
8477     IoCompletionPortHandle: HANDLE,
8478     CompletionKey: ULONG_PTR,
8479 }}
8480 pub type PRESOURCEMANAGER_COMPLETION_INFORMATION = *mut RESOURCEMANAGER_COMPLETION_INFORMATION;
8481 ENUM!{enum TRANSACTION_INFORMATION_CLASS {
8482     TransactionBasicInformation,
8483     TransactionPropertiesInformation,
8484     TransactionEnlistmentInformation,
8485     TransactionSuperiorEnlistmentInformation,
8486     TransactionBindInformation,
8487     TransactionDTCPrivateInformation,
8488 }}
8489 ENUM!{enum TRANSACTIONMANAGER_INFORMATION_CLASS {
8490     TransactionManagerBasicInformation,
8491     TransactionManagerLogInformation,
8492     TransactionManagerLogPathInformation,
8493     TransactionManagerRecoveryInformation = 4,
8494     TransactionManagerOnlineProbeInformation = 3,
8495     TransactionManagerOldestTransactionInformation = 5,
8496 }}
8497 ENUM!{enum RESOURCEMANAGER_INFORMATION_CLASS {
8498     ResourceManagerBasicInformation,
8499     ResourceManagerCompletionInformation,
8500 }}
8501 STRUCT!{struct ENLISTMENT_BASIC_INFORMATION {
8502     EnlistmentId: GUID,
8503     TransactionId: GUID,
8504     ResourceManagerId: GUID,
8505 }}
8506 pub type PENLISTMENT_BASIC_INFORMATION = *mut ENLISTMENT_BASIC_INFORMATION;
8507 STRUCT!{struct ENLISTMENT_CRM_INFORMATION {
8508     CrmTransactionManagerId: GUID,
8509     CrmResourceManagerId: GUID,
8510     CrmEnlistmentId: GUID,
8511 }}
8512 pub type PENLISTMENT_CRM_INFORMATION = *mut ENLISTMENT_CRM_INFORMATION;
8513 ENUM!{enum ENLISTMENT_INFORMATION_CLASS {
8514     EnlistmentBasicInformation,
8515     EnlistmentRecoveryInformation,
8516     EnlistmentCrmInformation,
8517 }}
8518 STRUCT!{struct TRANSACTION_LIST_ENTRY {
8519     UOW: UOW,
8520 }}
8521 pub type PTRANSACTION_LIST_ENTRY = *mut TRANSACTION_LIST_ENTRY;
8522 STRUCT!{struct TRANSACTION_LIST_INFORMATION {
8523     NumberOfTransactions: DWORD,
8524     TransactionInformation: [TRANSACTION_LIST_ENTRY; 1],
8525 }}
8526 pub type PTRANSACTION_LIST_INFORMATION = *mut TRANSACTION_LIST_INFORMATION;
8527 ENUM!{enum KTMOBJECT_TYPE {
8528     KTMOBJECT_TRANSACTION,
8529     KTMOBJECT_TRANSACTION_MANAGER,
8530     KTMOBJECT_RESOURCE_MANAGER,
8531     KTMOBJECT_ENLISTMENT,
8532     KTMOBJECT_INVALID,
8533 }}
8534 pub type PKTMOBJECT_TYPE = *mut KTMOBJECT_TYPE;
8535 STRUCT!{struct KTMOBJECT_CURSOR {
8536     LastQuery: GUID,
8537     ObjectIdCount: DWORD,
8538     ObjectIds: [GUID; 1],
8539 }}
8540 pub type PKTMOBJECT_CURSOR = *mut KTMOBJECT_CURSOR;
8541 pub type TP_VERSION = DWORD;
8542 pub type PTP_VERSION = *mut DWORD;
8543 STRUCT!{struct TP_CALLBACK_INSTANCE {
8544     dummy: *mut c_void,
8545 }}
8546 pub type PTP_CALLBACK_INSTANCE = *mut TP_CALLBACK_INSTANCE;
8547 FN!{stdcall PTP_SIMPLE_CALLBACK(
8548     Instance: PTP_CALLBACK_INSTANCE,
8549     Context: PVOID,
8550 ) -> ()}
8551 STRUCT!{struct TP_POOL {
8552     dummy: *mut c_void,
8553 }}
8554 pub type PTP_POOL = *mut TP_POOL;
8555 ENUM!{enum TP_CALLBACK_PRIORITY {
8556     TP_CALLBACK_PRIORITY_HIGH,
8557     TP_CALLBACK_PRIORITY_NORMAL,
8558     TP_CALLBACK_PRIORITY_LOW,
8559     TP_CALLBACK_PRIORITY_INVALID,
8560     TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID,
8561 }}
8562 STRUCT!{struct TP_POOL_STACK_INFORMATION {
8563     StackReserve: SIZE_T,
8564     StackCommit: SIZE_T,
8565 }}
8566 pub type PTP_POOL_STACK_INFORMATION = *mut TP_POOL_STACK_INFORMATION;
8567 STRUCT!{struct TP_CLEANUP_GROUP {
8568     dummy: *mut c_void,
8569 }}
8570 pub type PTP_CLEANUP_GROUP = *mut TP_CLEANUP_GROUP;
8571 FN!{stdcall PTP_CLEANUP_GROUP_CANCEL_CALLBACK(
8572     ObjectContext: PVOID,
8573     CleanupContext: PVOID,
8574 ) -> ()}
8575 STRUCT!{struct TP_CALLBACK_ENVIRON_V3_u_s {
8576     BitFields: DWORD,
8577 }}
8578 BITFIELD!{TP_CALLBACK_ENVIRON_V3_u_s BitFields: DWORD [
8579     LongFunction set_LongFunction[0..1],
8580     Persistent set_Persistent[1..2],
8581     Private set_Private[2..32],
8582 ]}
8583 UNION!{union TP_CALLBACK_ENVIRON_V3_u {
8584     [u32; 1],
8585     Flags Flags_mut: DWORD,
8586     s s_mut: TP_CALLBACK_ENVIRON_V3_u_s,
8587 }}
8588 STRUCT!{struct TP_CALLBACK_ENVIRON_V3 {
8589     Version: TP_VERSION,
8590     Pool: PTP_POOL,
8591     CleanupGroup: PTP_CLEANUP_GROUP,
8592     CleanupGroupCancelCallback: PTP_CLEANUP_GROUP_CANCEL_CALLBACK,
8593     RaceDll: PVOID,
8594     ActivationContext: *mut ACTIVATION_CONTEXT,
8595     FinalizationCallback: PTP_SIMPLE_CALLBACK,
8596     u: TP_CALLBACK_ENVIRON_V3_u,
8597     CallbackPriority: TP_CALLBACK_PRIORITY,
8598     Size: DWORD,
8599 }}
8600 pub type TP_CALLBACK_ENVIRON = TP_CALLBACK_ENVIRON_V3;
8601 pub type PTP_CALLBACK_ENVIRON = *mut TP_CALLBACK_ENVIRON_V3;
8602 STRUCT!{struct TP_WORK {
8603     dummy: *mut c_void,
8604 }}
8605 pub type PTP_WORK = *mut TP_WORK;
8606 FN!{stdcall PTP_WORK_CALLBACK(
8607     Instance: PTP_CALLBACK_INSTANCE,
8608     Context: PVOID,
8609     Work: PTP_WORK,
8610 ) -> ()}
8611 STRUCT!{struct TP_TIMER {
8612     dummy: *mut c_void,
8613 }}
8614 pub type PTP_TIMER = *mut TP_TIMER;
8615 FN!{stdcall PTP_TIMER_CALLBACK(
8616     Instance: PTP_CALLBACK_INSTANCE,
8617     Context: PVOID,
8618     Timer: PTP_TIMER,
8619 ) -> ()}
8620 pub type TP_WAIT_RESULT = DWORD;
8621 STRUCT!{struct TP_WAIT {
8622     dummy: *mut c_void,
8623 }}
8624 pub type PTP_WAIT = *mut TP_WAIT;
8625 FN!{stdcall PTP_WAIT_CALLBACK(
8626     Instance: PTP_CALLBACK_INSTANCE,
8627     Context: PVOID,
8628     Wait: PTP_WAIT,
8629     WaitResult: TP_WAIT_RESULT,
8630 ) -> ()}
8631 STRUCT!{struct TP_IO {
8632     dummy: *mut c_void,
8633 }}
8634 pub type PTP_IO = *mut TP_IO;
8635 pub const ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION: ULONG = 1;
8636 pub const ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION: ULONG = 2;
8637 pub const ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION: ULONG = 3;
8638 pub const ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION: ULONG = 4;
8639 pub const ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION: ULONG = 5;
8640 pub const ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION: ULONG = 6;
8641 pub const ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION: ULONG = 7;
8642 pub const ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE: ULONG = 8;
8643 pub const ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES: ULONG = 9;
8644 pub const ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS: ULONG = 10;
8645 pub const ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO: ULONG = 11;
8646 STRUCT!{struct ACTIVATION_CONTEXT {
8647     dummy: *mut c_void,
8648 }}
8649