- Fix the sad sad definition of sizeof(ANSI_NULL) which returned 4...
[reactos.git] / reactos / w32api / include / winnt.h
1 #ifndef _WINNT_H
2 #define _WINNT_H
3 #if __GNUC__ >= 3
4 #pragma GCC system_header
5 #endif
6
7 /* translate GCC target defines to MS equivalents. Keep this synchronized
8 with windows.h. */
9 #if defined(__i686__) && !defined(_M_IX86)
10 #define _M_IX86 600
11 #elif defined(__i586__) && !defined(_M_IX86)
12 #define _M_IX86 500
13 #elif defined(__i486__) && !defined(_M_IX86)
14 #define _M_IX86 400
15 #elif defined(__i386__) && !defined(_M_IX86)
16 #define _M_IX86 300
17 #endif
18 #if defined(_M_IX86) && !defined(_X86_)
19 #define _X86_
20 #elif defined(_M_ALPHA) && !defined(_ALPHA_)
21 #define _ALPHA_
22
23 #elif defined(_M_ARM) && !defined(ARM)
24 #define ARM
25 #elif defined(_M_PPC) && !defined(_PPC_)
26 #define _PPC_
27 #elif defined(_M_MRX000) && !defined(_MIPS_)
28 #define _MIPS_
29 #elif defined(_M_M68K) && !defined(_68K_)
30 #define _68K_
31 #endif
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <ctype.h>
38 #include <winerror.h>
39
40 #ifndef RC_INVOKED
41 #include <string.h>
42
43 /* FIXME: add more architectures. Is there a way to specify this in GCC? */
44 #ifdef _X86_
45 #define UNALIGNED
46 #else
47 #define UNALIGNED
48 #endif
49
50 #ifndef VOID
51 #define VOID void
52 #endif
53 typedef char CHAR;
54 typedef short SHORT;
55 typedef long LONG;
56 typedef char CCHAR, *PCCHAR;
57 typedef unsigned char UCHAR,*PUCHAR;
58 typedef unsigned short USHORT,*PUSHORT;
59 typedef unsigned long ULONG,*PULONG;
60 typedef char *PSZ;
61
62 typedef void *PVOID,*LPVOID;
63
64 /* FIXME for __WIN64 */
65 #ifndef __ptr64
66 #define __ptr64
67 #endif
68 typedef void* __ptr64 PVOID64;
69
70 #ifndef _WCHAR_T_DEFINED
71 #define _WCHAR_T_DEFINED
72 #ifndef _WCHAR_T_
73 #define _WCHAR_T_
74 #undef __need_wchar_t
75 #ifndef __cplusplus
76 typedef unsigned short wchar_t;
77 #endif
78 #endif
79 #endif
80
81 typedef wchar_t WCHAR;
82 typedef WCHAR *PWCHAR,*LPWCH,*PWCH,*NWPSTR,*LPWSTR,*PWSTR;
83 typedef CONST WCHAR *LPCWCH,*PCWCH,*LPCWSTR,*PCWSTR;
84 typedef CHAR *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
85 typedef CONST CHAR *LPCCH,*PCSTR,*LPCSTR;
86 #ifndef _TCHAR_DEFINED
87 #define _TCHAR_DEFINED
88 #ifdef UNICODE
89 /*
90 * NOTE: This tests UNICODE, which is different from the _UNICODE define
91 * used to differentiate standard C runtime calls.
92 */
93 typedef WCHAR TCHAR;
94 typedef WCHAR _TCHAR;
95 #else
96 typedef CHAR TCHAR;
97 typedef CHAR _TCHAR;
98 #endif
99 #endif
100 typedef TCHAR TBYTE,*PTCH,*PTBYTE;
101 typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR;
102 typedef const TCHAR *LPCTSTR;
103 #ifdef UNICODE
104 /*
105 * __TEXT is a private macro whose specific use is to force the expansion of a
106 * macro passed as an argument to the macro TEXT. DO NOT use this
107 * macro within your programs. It's name and function could change without
108 * notice.
109 */
110 #define __TEXT(q) L##q
111 #else
112 #define __TEXT(q) q
113 #endif
114 /*
115 * UNICODE a constant string when UNICODE is defined, else returns the string
116 * unmodified.
117 * The corresponding macros _TEXT() and _T() for mapping _UNICODE strings
118 * passed to C runtime functions are defined in mingw/tchar.h
119 */
120 #define TEXT(q) __TEXT(q)
121 typedef SHORT *PSHORT;
122 typedef LONG *PLONG;
123 #ifdef STRICT
124 typedef void *HANDLE;
125 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
126 #else
127 typedef PVOID HANDLE;
128 #define DECLARE_HANDLE(n) typedef HANDLE n
129 #endif
130 typedef HANDLE *PHANDLE,*LPHANDLE;
131 typedef DWORD LCID;
132 typedef PDWORD PLCID;
133 typedef WORD LANGID;
134 #ifdef __GNUC__
135 #define _HAVE_INT64
136 #define _INTEGRAL_MAX_BITS 64
137 #undef __int64
138 #define __int64 long long
139 #elif defined(__WATCOMC__) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
140 #define _HAVE_INT64
141 #endif /* __GNUC__/__WATCOMC */
142 #if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
143 typedef __int64 LONGLONG;
144 typedef unsigned __int64 DWORDLONG;
145 #else
146 typedef double LONGLONG,DWORDLONG;
147 #endif
148 typedef LONGLONG *PLONGLONG;
149 typedef DWORDLONG *PDWORDLONG;
150 typedef DWORDLONG ULONGLONG,*PULONGLONG;
151 typedef LONGLONG USN;
152 #ifdef _HAVE_INT64
153 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
154 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
155 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
156 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
157 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
158 #endif
159 #define ANSI_NULL ((CHAR)0)
160 #define UNICODE_NULL ((WCHAR)0)
161 typedef BYTE BOOLEAN,*PBOOLEAN;
162 #endif
163 typedef BYTE FCHAR;
164 typedef WORD FSHORT;
165 typedef DWORD FLONG;
166
167 #define NTAPI __stdcall
168 #include <basetsd.h>
169 #define ACE_OBJECT_TYPE_PRESENT 0x00000001
170 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
171 #define APPLICATION_ERROR_MASK 0x20000000
172 #define ERROR_SEVERITY_SUCCESS 0x00000000
173 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
174 #define ERROR_SEVERITY_WARNING 0x80000000
175 #define ERROR_SEVERITY_ERROR 0xC0000000
176 /* also in ddk/ntifs.h */
177 #define COMPRESSION_FORMAT_NONE (0x0000)
178 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
179 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
180 #define COMPRESSION_ENGINE_STANDARD (0x0000)
181 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
182 #define COMPRESSION_ENGINE_HIBER (0x0200)
183 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
184 #define ACCESS_DENIED_ACE_TYPE (0x1)
185 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
186 #define SYSTEM_ALARM_ACE_TYPE (0x3)
187 /*end ntifs.h */
188 #define ANYSIZE_ARRAY 1
189 #define OBJECT_INHERIT_ACE 1
190 #define CONTAINER_INHERIT_ACE 2
191 #define NO_PROPAGATE_INHERIT_ACE 4
192 #define INHERIT_ONLY_ACE 8
193 #define INHERITED_ACE 10
194 #define VALID_INHERIT_FLAGS 16
195 #define SUCCESSFUL_ACCESS_ACE_FLAG 64
196 #define FAILED_ACCESS_ACE_FLAG 128
197 #define DELETE 0x00010000L
198 #define READ_CONTROL 0x20000L
199 #define WRITE_DAC 0x40000L
200 #define WRITE_OWNER 0x80000L
201 #define SYNCHRONIZE 0x100000L
202 #define STANDARD_RIGHTS_REQUIRED 0xF0000
203 #define STANDARD_RIGHTS_READ 0x20000
204 #define STANDARD_RIGHTS_WRITE 0x20000
205 #define STANDARD_RIGHTS_EXECUTE 0x20000
206 #define STANDARD_RIGHTS_ALL 0x1F0000
207 #define SPECIFIC_RIGHTS_ALL 0xFFFF
208 #define ACCESS_SYSTEM_SECURITY 0x1000000
209
210 #define MAXIMUM_ALLOWED 0x2000000
211 #define GENERIC_READ 0x80000000
212 #define GENERIC_WRITE 0x40000000
213 #define GENERIC_EXECUTE 0x20000000
214 #define GENERIC_ALL 0x10000000
215
216 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
217
218 /* Also in ddk/winddk.h */
219 #define FILE_LIST_DIRECTORY 0x00000001
220 #define FILE_READ_DATA 0x00000001
221 #define FILE_ADD_FILE 0x00000002
222 #define FILE_WRITE_DATA 0x00000002
223 #define FILE_ADD_SUBDIRECTORY 0x00000004
224 #define FILE_APPEND_DATA 0x00000004
225 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
226 #define FILE_READ_EA 0x00000008
227 #define FILE_READ_PROPERTIES 0x00000008
228 #define FILE_WRITE_EA 0x00000010
229 #define FILE_WRITE_PROPERTIES 0x00000010
230 #define FILE_EXECUTE 0x00000020
231 #define FILE_TRAVERSE 0x00000020
232 #define FILE_DELETE_CHILD 0x00000040
233 #define FILE_READ_ATTRIBUTES 0x00000080
234 #define FILE_WRITE_ATTRIBUTES 0x00000100
235
236 #define FILE_SHARE_READ 0x00000001
237 #define FILE_SHARE_WRITE 0x00000002
238 #define FILE_SHARE_DELETE 0x00000004
239 #define FILE_SHARE_VALID_FLAGS 0x00000007
240
241 #define FILE_ATTRIBUTE_READONLY 0x00000001
242 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
243 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
244 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
245 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
246 #define FILE_ATTRIBUTE_DEVICE 0x00000040
247 #define FILE_ATTRIBUTE_NORMAL 0x00000080
248 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
249 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
250 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
251 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
252 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
253 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
254 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
255 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
256 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
257
258 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
259 #define FILE_STRUCTURED_STORAGE 0x00000441
260
261 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
262 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
263 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
264 #define FILE_VALID_SET_FLAGS 0x00000036
265
266 #define FILE_DIRECTORY_FILE 0x00000001
267 #define FILE_WRITE_THROUGH 0x00000002
268 #define FILE_SEQUENTIAL_ONLY 0x00000004
269 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
270 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
271 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
272 #define FILE_NON_DIRECTORY_FILE 0x00000040
273 #define FILE_CREATE_TREE_CONNECTION 0x00000080
274 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
275 #define FILE_NO_EA_KNOWLEDGE 0x00000200
276 #define FILE_OPEN_FOR_RECOVERY 0x00000400
277 #define FILE_RANDOM_ACCESS 0x00000800
278 #define FILE_DELETE_ON_CLOSE 0x00001000
279 #define FILE_OPEN_BY_FILE_ID 0x00002000
280 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
281 #define FILE_NO_COMPRESSION 0x00008000
282 #define FILE_RESERVE_OPFILTER 0x00100000
283 #define FILE_OPEN_REPARSE_POINT 0x00200000
284 #define FILE_OPEN_NO_RECALL 0x00400000
285 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
286
287 #define FILE_ALL_ACCESS \
288 (STANDARD_RIGHTS_REQUIRED | \
289 SYNCHRONIZE | \
290 0x1FF)
291
292 #define FILE_GENERIC_EXECUTE \
293 (STANDARD_RIGHTS_EXECUTE | \
294 FILE_READ_ATTRIBUTES | \
295 FILE_EXECUTE | \
296 SYNCHRONIZE)
297
298 #define FILE_GENERIC_READ \
299 (STANDARD_RIGHTS_READ | \
300 FILE_READ_DATA | \
301 FILE_READ_ATTRIBUTES | \
302 FILE_READ_EA | \
303 SYNCHRONIZE)
304
305 #define FILE_GENERIC_WRITE \
306 (STANDARD_RIGHTS_WRITE | \
307 FILE_WRITE_DATA | \
308 FILE_WRITE_ATTRIBUTES | \
309 FILE_WRITE_EA | \
310 FILE_APPEND_DATA | \
311 SYNCHRONIZE)
312 /* end winddk.h */
313 /* also in ddk/ntifs.h */
314 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
315 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
316 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
317 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
318 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
319 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
320 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
321 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
322 #define FILE_NOTIFY_CHANGE_EA 0x00000080
323 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
324 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
325 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
326 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
327 #define FILE_NOTIFY_VALID_MASK 0x00000fff
328
329 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
330 #define FILE_CASE_PRESERVED_NAMES 0x00000002
331 #define FILE_UNICODE_ON_DISK 0x00000004
332 #define FILE_PERSISTENT_ACLS 0x00000008
333 #define FILE_FILE_COMPRESSION 0x00000010
334 #define FILE_VOLUME_QUOTAS 0x00000020
335 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
336 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
337 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
338 #define FS_LFN_APIS 0x00004000
339 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
340 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
341 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
342 #define FILE_NAMED_STREAMS 0x00040000
343
344 #define IO_COMPLETION_QUERY_STATE 0x0001
345 #define IO_COMPLETION_MODIFY_STATE 0x0002
346 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
347 /* end ntifs.h */
348
349 /* also in ddk/winddk.h */
350 #define DUPLICATE_CLOSE_SOURCE 0x00000001
351 #define DUPLICATE_SAME_ACCESS 0x00000002
352 /* end winddk.k */
353
354 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
355 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
356 #define PROCESS_TERMINATE 1
357 #define PROCESS_CREATE_THREAD 2
358 #define PROCESS_SET_SESSIONID 4
359 #define PROCESS_VM_OPERATION 8
360 #define PROCESS_VM_READ 16
361 #define PROCESS_VM_WRITE 32
362 #define PROCESS_DUP_HANDLE 64
363 #define PROCESS_CREATE_PROCESS 128
364 #define PROCESS_SET_QUOTA 256
365 #define PROCESS_SET_INFORMATION 512
366 #define PROCESS_QUERY_INFORMATION 1024
367 #define PROCESS_SUSPEND_RESUME 2048
368 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
369 #define THREAD_TERMINATE 1
370 #define THREAD_SUSPEND_RESUME 2
371 #define THREAD_GET_CONTEXT 8
372 #define THREAD_SET_CONTEXT 16
373 #define THREAD_SET_INFORMATION 32
374 #define THREAD_QUERY_INFORMATION 64
375 #define THREAD_SET_THREAD_TOKEN 128
376 #define THREAD_IMPERSONATE 256
377 #define THREAD_DIRECT_IMPERSONATION 0x200
378 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
379 #define THREAD_BASE_PRIORITY_LOWRT 15
380 #define THREAD_BASE_PRIORITY_MAX 2
381 #define THREAD_BASE_PRIORITY_MIN (-2)
382 #define THREAD_BASE_PRIORITY_IDLE (-15)
383 #define EXCEPTION_NONCONTINUABLE 1
384 #define EXCEPTION_MAXIMUM_PARAMETERS 15
385 #define MUTANT_QUERY_STATE 0x0001
386 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
387 #define TIMER_QUERY_STATE 0x0001
388 #define TIMER_MODIFY_STATE 0x0002
389 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
390 /*
391 * To prevent gcc compiler warnings, bracket these defines when initialising
392 * a SID_IDENTIFIER_AUTHORITY, eg.
393 * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
394 */
395 #define SID_MAX_SUB_AUTHORITIES 15
396 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
397 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
398 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
399 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
400 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
401 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
402 #define SECURITY_NULL_RID 0
403 #define SECURITY_WORLD_RID (0x00000000L)
404 #define SECURITY_LOCAL_RID 0
405 #define SECURITY_CREATOR_OWNER_RID 0
406 #define SECURITY_CREATOR_GROUP_RID 1
407 #define SECURITY_DIALUP_RID 1
408 #define SECURITY_NETWORK_RID 2
409 #define SECURITY_BATCH_RID 3
410 #define SECURITY_INTERACTIVE_RID 4
411 #define SECURITY_LOGON_IDS_RID 5
412 #define SECURITY_SERVICE_RID 6
413 #define SECURITY_LOCAL_SYSTEM_RID 18
414 #define SECURITY_BUILTIN_DOMAIN_RID 32
415 #define SECURITY_PRINCIPAL_SELF_RID 10
416 #define SECURITY_CREATOR_OWNER_SERVER_RID 0x2
417 #define SECURITY_CREATOR_GROUP_SERVER_RID 0x3
418 #define SECURITY_LOGON_IDS_RID_COUNT 0x3
419 #define SECURITY_ANONYMOUS_LOGON_RID 0x7
420 #define SECURITY_PROXY_RID 0x8
421 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x9
422 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
423 #define SECURITY_AUTHENTICATED_USER_RID 0xB
424 #define SECURITY_RESTRICTED_CODE_RID 0xC
425 #define SECURITY_NT_NON_UNIQUE_RID 0x15
426 #define SID_REVISION 1
427 #define DOMAIN_USER_RID_ADMIN 0x1F4L
428 #define DOMAIN_USER_RID_GUEST 0x1F5L
429 #define DOMAIN_GROUP_RID_ADMINS 0x200L
430 #define DOMAIN_GROUP_RID_USERS 0x201L
431 #define DOMAIN_ALIAS_RID_ADMINS 0x220L
432 #define DOMAIN_ALIAS_RID_USERS 0x221L
433 #define DOMAIN_ALIAS_RID_GUESTS 0x222L
434 #define DOMAIN_ALIAS_RID_POWER_USERS 0x223L
435 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x224L
436 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x225L
437 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x226L
438 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x227L
439 #define DOMAIN_ALIAS_RID_REPLICATOR 0x228L
440
441 typedef enum
442 {
443 WinNullSid = 0,
444 WinWorldSid,
445 WinLocalSid,
446 WinCreatorOwnerSid,
447 WinCreatorGroupSid,
448 WinCreatorOwnerServerSid,
449 WinCreatorGroupServerSid,
450 WinNtAuthoritySid,
451 WinDialupSid,
452 WinNetworkSid,
453 WinBatchSid,
454 WinInteractiveSid,
455 WinServiceSid,
456 WinAnonymousSid,
457 WinProxySid,
458 WinEnterpriseControllersSid,
459 WinSelfSid,
460 WinAuthenticatedUserSid,
461 WinRestrictedCodeSid,
462 WinTerminalServerSid,
463 WinRemoteLogonIdSid,
464 WinLogonIdsSid,
465 WinLocalSystemSid,
466 WinLocalServiceSid,
467 WinNetworkServiceSid,
468 WinBuiltinDomainSid,
469 WinBuiltinAdministratorsSid,
470 WinBuiltinUsersSid,
471 WinBuiltinGuestsSid,
472 WinBuiltinPowerUsersSid,
473 WinBuiltinAccountOperatorsSid,
474 WinBuiltinSystemOperatorsSid,
475 WinBuiltinPrintOperatorsSid,
476 WinBuiltinBackupOperatorsSid,
477 WinBuiltinReplicatorSid,
478 WinBuiltinPreWindows2000CompatibleAccessSid,
479 WinBuiltinRemoteDesktopUsersSid,
480 WinBuiltinNetworkConfigurationOperatorsSid,
481 WinAccountAdministratorSid,
482 WinAccountGuestSid,
483 WinAccountKrbtgtSid,
484 WinAccountDomainAdminsSid,
485 WinAccountDomainUsersSid,
486 WinAccountDomainGuestsSid,
487 WinAccountComputersSid,
488 WinAccountControllersSid,
489 WinAccountCertAdminsSid,
490 WinAccountSchemaAdminsSid,
491 WinAccountEnterpriseAdminsSid,
492 WinAccountPolicyAdminsSid,
493 WinAccountRasAndIasServersSid,
494 WinNTLMAuthenticationSid,
495 WinDigestAuthenticationSid,
496 WinSChannelAuthenticationSid,
497 WinThisOrganizationSid,
498 WinOtherOrganizationSid,
499 WinBuiltinIncomingForestTrustBuildersSid,
500 WinBuiltinPerfMonitoringUsersSid,
501 WinBuiltinPerfLoggingUsersSid,
502 WinBuiltinAuthorizationAccessSid,
503 WinBuiltinTerminalServerLicenseServersSid,
504 WinBuiltinDCOMUsersSid
505 } WELL_KNOWN_SID_TYPE;
506
507 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
508 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
509 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
510 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
511 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
512 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
513 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
514 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
515 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
516 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
517 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
518 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
519 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
520 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
521 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
522 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
523 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
524 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
525 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
526 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
527 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
528 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
529 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
530 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
531 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
532 #define SE_GROUP_MANDATORY 1
533 #define SE_GROUP_ENABLED_BY_DEFAULT 2
534 #define SE_GROUP_ENABLED 4
535 #define SE_GROUP_OWNER 8
536 #define SE_GROUP_USE_FOR_DENY_ONLY 16
537 #define SE_GROUP_LOGON_ID 3221225472U
538 #define SE_GROUP_RESOURCE 536870912
539 #define LANG_NEUTRAL 0x00
540 #define LANG_ARABIC 0x01
541 #define LANG_BULGARIAN 0x02
542 #define LANG_CATALAN 0x03
543 #define LANG_CHINESE 0x04
544 #define LANG_CZECH 0x05
545 #define LANG_DANISH 0x06
546 #define LANG_GERMAN 0x07
547 #define LANG_GREEK 0x08
548 #define LANG_ENGLISH 0x09
549 #define LANG_SPANISH 0x0a
550 #define LANG_FINNISH 0x0b
551 #define LANG_FRENCH 0x0c
552 #define LANG_HEBREW 0x0d
553 #define LANG_HUNGARIAN 0x0e
554 #define LANG_ICELANDIC 0x0f
555 #define LANG_ITALIAN 0x10
556 #define LANG_JAPANESE 0x11
557 #define LANG_KOREAN 0x12
558 #define LANG_DUTCH 0x13
559 #define LANG_NORWEGIAN 0x14
560 #define LANG_POLISH 0x15
561 #define LANG_PORTUGUESE 0x16
562 #define LANG_ROMANIAN 0x18
563 #define LANG_RUSSIAN 0x19
564 #define LANG_CROATIAN 0x1a
565 #define LANG_SERBIAN 0x1a
566 #define LANG_SLOVAK 0x1b
567 #define LANG_ALBANIAN 0x1c
568 #define LANG_SWEDISH 0x1d
569 #define LANG_THAI 0x1e
570 #define LANG_TURKISH 0x1f
571 #define LANG_URDU 0x20
572 #define LANG_INDONESIAN 0x21
573 #define LANG_UKRAINIAN 0x22
574 #define LANG_BELARUSIAN 0x23
575 #define LANG_SLOVENIAN 0x24
576 #define LANG_ESTONIAN 0x25
577 #define LANG_LATVIAN 0x26
578 #define LANG_LITHUANIAN 0x27
579 #define LANG_FARSI 0x29
580 #define LANG_VIETNAMESE 0x2a
581 #define LANG_ARMENIAN 0x2b
582 #define LANG_AZERI 0x2c
583 #define LANG_BASQUE 0x2d
584 #define LANG_MACEDONIAN 0x2f
585 #define LANG_AFRIKAANS 0x36
586 #define LANG_GEORGIAN 0x37
587 #define LANG_FAEROESE 0x38
588 #define LANG_HINDI 0x39
589 #define LANG_MALAY 0x3e
590 #define LANG_KAZAK 0x3f
591 #define LANG_KYRGYZ 0x40
592 #define LANG_SWAHILI 0x41
593 #define LANG_UZBEK 0x43
594 #define LANG_TATAR 0x44
595 #define LANG_BENGALI 0x45
596 #define LANG_PUNJABI 0x46
597 #define LANG_GUJARATI 0x47
598 #define LANG_ORIYA 0x48
599 #define LANG_TAMIL 0x49
600 #define LANG_TELUGU 0x4a
601 #define LANG_KANNADA 0x4b
602 #define LANG_MALAYALAM 0x4c
603 #define LANG_ASSAMESE 0x4d
604 #define LANG_MARATHI 0x4e
605 #define LANG_SANSKRIT 0x4f
606 #define LANG_MONGOLIAN 0x50
607 #define LANG_GALICIAN 0x56
608 #define LANG_KONKANI 0x57
609 #define LANG_MANIPURI 0x58
610 #define LANG_SINDHI 0x59
611 #define LANG_SYRIAC 0x5a
612 #define LANG_KASHMIRI 0x60
613 #define LANG_NEPALI 0x61
614 #define LANG_DIVEHI 0x65
615 #define LANG_INVARIANT 0x7f
616 #define SUBLANG_NEUTRAL 0x00
617 #define SUBLANG_DEFAULT 0x01
618 #define SUBLANG_SYS_DEFAULT 0x02
619 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
620 #define SUBLANG_ARABIC_IRAQ 0x02
621 #define SUBLANG_ARABIC_EGYPT 0x03
622 #define SUBLANG_ARABIC_LIBYA 0x04
623 #define SUBLANG_ARABIC_ALGERIA 0x05
624 #define SUBLANG_ARABIC_MOROCCO 0x06
625 #define SUBLANG_ARABIC_TUNISIA 0x07
626 #define SUBLANG_ARABIC_OMAN 0x08
627 #define SUBLANG_ARABIC_YEMEN 0x09
628 #define SUBLANG_ARABIC_SYRIA 0x0a
629 #define SUBLANG_ARABIC_JORDAN 0x0b
630 #define SUBLANG_ARABIC_LEBANON 0x0c
631 #define SUBLANG_ARABIC_KUWAIT 0x0d
632 #define SUBLANG_ARABIC_UAE 0x0e
633 #define SUBLANG_ARABIC_BAHRAIN 0x0f
634 #define SUBLANG_ARABIC_QATAR 0x10
635 #define SUBLANG_AZERI_LATIN 0x01
636 #define SUBLANG_AZERI_CYRILLIC 0x02
637 #define SUBLANG_CHINESE_TRADITIONAL 0x01
638 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
639 #define SUBLANG_CHINESE_HONGKONG 0x03
640 #define SUBLANG_CHINESE_SINGAPORE 0x04
641 #define SUBLANG_CHINESE_MACAU 0x05
642 #define SUBLANG_DUTCH 0x01
643 #define SUBLANG_DUTCH_BELGIAN 0x02
644 #define SUBLANG_ENGLISH_US 0x01
645 #define SUBLANG_ENGLISH_UK 0x02
646 #define SUBLANG_ENGLISH_AUS 0x03
647 #define SUBLANG_ENGLISH_CAN 0x04
648 #define SUBLANG_ENGLISH_NZ 0x05
649 #define SUBLANG_ENGLISH_EIRE 0x06
650 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
651 #define SUBLANG_ENGLISH_JAMAICA 0x08
652 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
653 #define SUBLANG_ENGLISH_BELIZE 0x0a
654 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
655 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
656 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
657 #define SUBLANG_FRENCH 0x01
658 #define SUBLANG_FRENCH_BELGIAN 0x02
659 #define SUBLANG_FRENCH_CANADIAN 0x03
660 #define SUBLANG_FRENCH_SWISS 0x04
661 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
662 #define SUBLANG_FRENCH_MONACO 0x06
663 #define SUBLANG_GERMAN 0x01
664 #define SUBLANG_GERMAN_SWISS 0x02
665 #define SUBLANG_GERMAN_AUSTRIAN 0x03
666 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
667 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
668 #define SUBLANG_ITALIAN 0x01
669 #define SUBLANG_ITALIAN_SWISS 0x02
670 #define SUBLANG_KASHMIRI_INDIA 0x02
671 #define SUBLANG_KASHMIRI_SASIA 0x02
672 #define SUBLANG_KOREAN 0x01
673 #define SUBLANG_LITHUANIAN 0x01
674 #define SUBLANG_MALAY_MALAYSIA 0x01
675 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
676 #define SUBLANG_NEPALI_INDIA 0x02
677 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
678 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
679 #define SUBLANG_PORTUGUESE 0x01
680 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x02
681 #define SUBLANG_SERBIAN_LATIN 0x02
682 #define SUBLANG_SERBIAN_CYRILLIC 0x03
683 #define SUBLANG_SPANISH 0x01
684 #define SUBLANG_SPANISH_MEXICAN 0x02
685 #define SUBLANG_SPANISH_MODERN 0x03
686 #define SUBLANG_SPANISH_GUATEMALA 0x04
687 #define SUBLANG_SPANISH_COSTA_RICA 0x05
688 #define SUBLANG_SPANISH_PANAMA 0x06
689 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
690 #define SUBLANG_SPANISH_VENEZUELA 0x08
691 #define SUBLANG_SPANISH_COLOMBIA 0x09
692 #define SUBLANG_SPANISH_PERU 0x0a
693 #define SUBLANG_SPANISH_ARGENTINA 0x0b
694 #define SUBLANG_SPANISH_ECUADOR 0x0c
695 #define SUBLANG_SPANISH_CHILE 0x0d
696 #define SUBLANG_SPANISH_URUGUAY 0x0e
697 #define SUBLANG_SPANISH_PARAGUAY 0x0f
698 #define SUBLANG_SPANISH_BOLIVIA 0x10
699 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
700 #define SUBLANG_SPANISH_HONDURAS 0x12
701 #define SUBLANG_SPANISH_NICARAGUA 0x13
702 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
703 #define SUBLANG_SWEDISH 0x01
704 #define SUBLANG_SWEDISH_FINLAND 0x02
705 #define SUBLANG_URDU_PAKISTAN 0x01
706 #define SUBLANG_URDU_INDIA 0x02
707 #define SUBLANG_UZBEK_LATIN 0x01
708 #define SUBLANG_UZBEK_CYRILLIC 0x02
709 #define NLS_VALID_LOCALE_MASK 1048575
710 #define SORT_DEFAULT 0
711 #define SORT_JAPANESE_XJIS 0
712 #define SORT_JAPANESE_UNICODE 1
713 #define SORT_CHINESE_BIG5 0
714 #define SORT_CHINESE_PRCP 0
715 #define SORT_CHINESE_UNICODE 1
716 #define SORT_CHINESE_PRC 2
717 #define SORT_CHINESE_BOPOMOFO 3
718 #define SORT_KOREAN_KSC 0
719 #define SORT_KOREAN_UNICODE 1
720 #define SORT_GERMAN_PHONE_BOOK 1
721 #define SORT_HUNGARIAN_DEFAULT 0
722 #define SORT_HUNGARIAN_TECHNICAL 1
723 #define SORT_GEORGIAN_TRADITIONAL 0
724 #define SORT_GEORGIAN_MODERN 1
725 #define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
726 #define MAKELCID(l,s) ((DWORD)((((DWORD)((WORD)(s)))<<16)|((DWORD)((WORD)(l)))))
727 #define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
728 #define SORTIDFROMLCID(l) ((WORD)((((DWORD)(l))&NLS_VALID_LOCALE_MASK)>>16))
729 #define SORTVERSIONFROMLCID(l) ((WORD)((((DWORD)(l))>>20)&0xf))
730 #define SUBLANGID(l) ((WORD)(l)>>10)
731 #define LANGIDFROMLCID(l) ((WORD)(l))
732 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)
733 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
734 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)
735 #define ACL_REVISION 2
736 #define ACL_REVISION_DS 4
737 #define ACL_REVISION1 1
738 #define ACL_REVISION2 2
739 #define ACL_REVISION3 3
740 #define ACL_REVISION4 4
741 #define MIN_ACL_REVISION 2
742 #define MAX_ACL_REVISION 4
743 #define MINCHAR 0x80
744 #define MAXCHAR 0x7f
745 #define MINSHORT 0x8000
746 #define MAXSHORT 0x7fff
747 #define MINLONG 0x80000000
748 #define MAXLONG 0x7fffffff
749 #define MAXBYTE 0xff
750 #define MAXWORD 0xffff
751 #define MAXDWORD 0xffffffff
752 #define PROCESSOR_INTEL_386 386
753 #define PROCESSOR_INTEL_486 486
754 #define PROCESSOR_INTEL_PENTIUM 586
755 #define PROCESSOR_MIPS_R4000 4000
756 #define PROCESSOR_ALPHA_21064 21064
757 #define PROCESSOR_INTEL_IA64 2200
758 #define PROCESSOR_PPC_601 601
759 #define PROCESSOR_PPC_603 603
760 #define PROCESSOR_PPC_604 604
761 #define PROCESSOR_PPC_620 620
762 #define PROCESSOR_ARCHITECTURE_INTEL 0
763 #define PROCESSOR_ARCHITECTURE_MIPS 1
764 #define PROCESSOR_ARCHITECTURE_ALPHA 2
765 #define PROCESSOR_ARCHITECTURE_PPC 3
766 #define PROCESSOR_ARCHITECTURE_SHX 4
767 #define PROCESSOR_ARCHITECTURE_ARM 5
768 #define PROCESSOR_ARCHITECTURE_IA64 6
769 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
770 #define PROCESSOR_ARCHITECTURE_MSIL8
771 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
772 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
773 #define PF_FLOATING_POINT_EMULATED 1
774 #define PF_COMPARE_EXCHANGE_DOUBLE 2
775 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
776 #define PF_PPC_MOVEMEM_64BIT_OK 4
777 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
778 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
779 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
780 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
781 #define PF_PAE_ENABLED 9
782 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
783 /* also in ddk/ntifs.h */
784 #define FILE_ACTION_ADDED 0x00000001
785 #define FILE_ACTION_REMOVED 0x00000002
786 #define FILE_ACTION_MODIFIED 0x00000003
787 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
788 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
789 #define FILE_ACTION_ADDED_STREAM 0x00000006
790 #define FILE_ACTION_REMOVED_STREAM 0x00000007
791 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
792 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
793 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
794 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
795 /* end ntifs.h */
796 #define HEAP_NO_SERIALIZE 1
797 #define HEAP_GROWABLE 2
798 #define HEAP_GENERATE_EXCEPTIONS 4
799 #define HEAP_ZERO_MEMORY 8
800 #define HEAP_REALLOC_IN_PLACE_ONLY 16
801 #define HEAP_TAIL_CHECKING_ENABLED 32
802 #define HEAP_FREE_CHECKING_ENABLED 64
803 #define HEAP_DISABLE_COALESCE_ON_FREE 128
804 #define HEAP_CREATE_ALIGN_16 0x0000
805 #define HEAP_CREATE_ENABLE_TRACING 0x20000
806 #define HEAP_MAXIMUM_TAG 0xFFF
807 #define HEAP_PSEUDO_TAG_FLAG 0x8000
808 #define HEAP_TAG_SHIFT 16
809 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
810 #define KEY_QUERY_VALUE 1
811 #define KEY_SET_VALUE 2
812 #define KEY_CREATE_SUB_KEY 4
813 #define KEY_ENUMERATE_SUB_KEYS 8
814 #define KEY_NOTIFY 16
815 #define KEY_CREATE_LINK 32
816 #define KEY_WRITE 0x20006
817 #define KEY_EXECUTE 0x20019
818 #define KEY_READ 0x20019
819 #define KEY_ALL_ACCESS 0xf003f
820 #define REG_WHOLE_HIVE_VOLATILE 1
821 #define REG_REFRESH_HIVE 2
822 #define REG_NO_LAZY_FLUSH 4
823 #define REG_OPTION_RESERVED 0
824 #define REG_OPTION_NON_VOLATILE 0
825 #define REG_OPTION_VOLATILE 1
826 #define REG_OPTION_CREATE_LINK 2
827 #define REG_OPTION_BACKUP_RESTORE 4
828 #define REG_OPTION_OPEN_LINK 8
829 #define REG_LEGAL_OPTION 15
830 #define OWNER_SECURITY_INFORMATION 1
831 #define GROUP_SECURITY_INFORMATION 2
832 #define DACL_SECURITY_INFORMATION 4
833 #define SACL_SECURITY_INFORMATION 8
834 #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
835 #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
836 #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
837 #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
838 #define MAXIMUM_PROCESSORS 32
839 #define PAGE_NOACCESS 0x0001
840 #define PAGE_READONLY 0x0002
841 #define PAGE_READWRITE 0x0004
842 #define PAGE_WRITECOPY 0x0008
843 #define PAGE_EXECUTE 0x0010
844 #define PAGE_EXECUTE_READ 0x0020
845 #define PAGE_EXECUTE_READWRITE 0x0040
846 #define PAGE_EXECUTE_WRITECOPY 0x0080
847 #define PAGE_GUARD 0x0100
848 #define PAGE_NOCACHE 0x0200
849 #define PAGE_WRITECOMBINE 0x0400
850 #define MEM_COMMIT 0x1000
851 #define MEM_RESERVE 0x2000
852 #define MEM_DECOMMIT 0x4000
853 #define MEM_RELEASE 0x8000
854 #define MEM_FREE 0x10000
855 #define MEM_PRIVATE 0x20000
856 #define MEM_MAPPED 0x40000
857 #define MEM_RESET 0x80000
858 #define MEM_TOP_DOWN 0x100000
859 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
860 #define MEM_PHYSICAL 0x400000
861 #define MEM_4MB_PAGES 0x80000000
862 /* also in ddk/ntifs.h */
863 #define MEM_IMAGE SEC_IMAGE
864 #define SEC_BASED 0x00200000
865 #define SEC_NO_CHANGE 0x00400000
866 #define SEC_FILE 0x00800000
867 #define SEC_IMAGE 0x01000000
868 #define SEC_VLM 0x02000000
869 #define SEC_RESERVE 0x04000000
870 #define SEC_COMMIT 0x08000000
871 #define SEC_NOCACHE 0x10000000
872 /* end ntifs.h */
873 #define SECTION_EXTEND_SIZE 16
874 #define SECTION_MAP_READ 4
875 #define SECTION_MAP_WRITE 2
876 #define SECTION_QUERY 1
877 #define SECTION_MAP_EXECUTE 8
878 #define SECTION_ALL_ACCESS 0xf001f
879 #define MESSAGE_RESOURCE_UNICODE 1
880 #define RTL_CRITSECT_TYPE 0
881 #define RTL_RESOURCE_TYPE 1
882 /* Also in winddk.h */
883 #define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
884 #ifndef CONTAINING_RECORD
885 #define CONTAINING_RECORD(address, type, field) \
886 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
887 #endif
888 /* end winddk.h */
889 #define IMAGE_SIZEOF_FILE_HEADER 20
890 #define IMAGE_FILE_RELOCS_STRIPPED 1
891 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
892 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
893 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
894 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
895 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
896 #define IMAGE_FILE_BYTES_REVERSED_LO 128
897 #define IMAGE_FILE_32BIT_MACHINE 256
898 #define IMAGE_FILE_DEBUG_STRIPPED 512
899 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
900 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
901 #define IMAGE_FILE_SYSTEM 4096
902 #define IMAGE_FILE_DLL 8192
903 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
904 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
905 #define IMAGE_FILE_MACHINE_UNKNOWN 0
906 #define IMAGE_FILE_MACHINE_I386 332
907 #define IMAGE_FILE_MACHINE_R3000 354
908 #define IMAGE_FILE_MACHINE_R4000 358
909 #define IMAGE_FILE_MACHINE_R10000 360
910 #define IMAGE_FILE_MACHINE_ALPHA 388
911 #define IMAGE_FILE_MACHINE_POWERPC 496
912 #define IMAGE_FILE_MACHINE_IA64 512
913 #define IMAGE_FILE_MACHINE_AMD64 0x8664
914 #define IMAGE_DOS_SIGNATURE 0x5A4D
915 #define IMAGE_OS2_SIGNATURE 0x454E
916 #define IMAGE_OS2_SIGNATURE_LE 0x454C
917 #define IMAGE_VXD_SIGNATURE 0x454C
918 #define IMAGE_NT_SIGNATURE 0x00004550
919 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
920 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
921 #ifdef _WIN64
922 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
923 #else
924 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
925 #endif
926 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
927 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
928 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
929 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
930 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
931 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
932 #define IMAGE_SIZEOF_SHORT_NAME 8
933 #define IMAGE_SIZEOF_SECTION_HEADER 40
934 #define IMAGE_SIZEOF_SYMBOL 18
935 #define IMAGE_SIZEOF_AUX_SYMBOL 18
936 #define IMAGE_SIZEOF_RELOCATION 10
937 #define IMAGE_SIZEOF_BASE_RELOCATION 8
938 #define IMAGE_SIZEOF_LINENUMBER 6
939 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
940 #define SIZEOF_RFPO_DATA 16
941 #define IMAGE_SUBSYSTEM_UNKNOWN 0
942 #define IMAGE_SUBSYSTEM_NATIVE 1
943 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
944 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
945 #define IMAGE_SUBSYSTEM_OS2_CUI 5
946 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
947 #define IMAGE_SUBSYSTEM_XBOX 14
948 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((DWORD)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
949 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
950 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
951 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
952 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
953 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
954 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
955 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
956 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
957 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
958 #define IMAGE_DIRECTORY_ENTRY_TLS 9
959 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
960 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
961 #define IMAGE_DIRECTORY_ENTRY_IAT 12
962 #define IMAGE_SCN_TYPE_REG 0
963 #define IMAGE_SCN_TYPE_DSECT 1
964 #define IMAGE_SCN_TYPE_NOLOAD 2
965 #define IMAGE_SCN_TYPE_GROUP 4
966 #define IMAGE_SCN_TYPE_NO_PAD 8
967 #define IMAGE_SCN_CNT_CODE 32
968 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
969 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
970 #define IMAGE_SCN_LNK_OTHER 256
971 #define IMAGE_SCN_LNK_INFO 512
972 #define IMAGE_SCN_LNK_REMOVE 2048
973 #define IMAGE_SCN_LNK_COMDAT 4096
974 #define IMAGE_SCN_MEM_FARDATA 0x8000
975 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
976 #define IMAGE_SCN_MEM_16BIT 0x20000
977 #define IMAGE_SCN_MEM_LOCKED 0x40000
978 #define IMAGE_SCN_MEM_PRELOAD 0x80000
979 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
980 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
981 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
982 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
983 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
984 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
985 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
986 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
987 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
988 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
989 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
990 #define IMAGE_SCN_MEM_SHARED 0x10000000
991 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
992 #define IMAGE_SCN_MEM_READ 0x40000000
993 #define IMAGE_SCN_MEM_WRITE 0x80000000
994 #define IMAGE_SYM_UNDEFINED 0
995 #define IMAGE_SYM_ABSOLUTE (-1)
996 #define IMAGE_SYM_DEBUG (-2)
997 #define IMAGE_SYM_TYPE_NULL 0
998 #define IMAGE_SYM_TYPE_VOID 1
999 #define IMAGE_SYM_TYPE_CHAR 2
1000 #define IMAGE_SYM_TYPE_SHORT 3
1001 #define IMAGE_SYM_TYPE_INT 4
1002 #define IMAGE_SYM_TYPE_LONG 5
1003 #define IMAGE_SYM_TYPE_FLOAT 6
1004 #define IMAGE_SYM_TYPE_DOUBLE 7
1005 #define IMAGE_SYM_TYPE_STRUCT 8
1006 #define IMAGE_SYM_TYPE_UNION 9
1007 #define IMAGE_SYM_TYPE_ENUM 10
1008 #define IMAGE_SYM_TYPE_MOE 11
1009 #define IMAGE_SYM_TYPE_BYTE 12
1010 #define IMAGE_SYM_TYPE_WORD 13
1011 #define IMAGE_SYM_TYPE_UINT 14
1012 #define IMAGE_SYM_TYPE_DWORD 15
1013 #define IMAGE_SYM_TYPE_PCODE 32768
1014 #define IMAGE_SYM_DTYPE_NULL 0
1015 #define IMAGE_SYM_DTYPE_POINTER 1
1016 #define IMAGE_SYM_DTYPE_FUNCTION 2
1017 #define IMAGE_SYM_DTYPE_ARRAY 3
1018 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1019 #define IMAGE_SYM_CLASS_NULL 0
1020 #define IMAGE_SYM_CLASS_AUTOMATIC 1
1021 #define IMAGE_SYM_CLASS_EXTERNAL 2
1022 #define IMAGE_SYM_CLASS_STATIC 3
1023 #define IMAGE_SYM_CLASS_REGISTER 4
1024 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1025 #define IMAGE_SYM_CLASS_LABEL 6
1026 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1027 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1028 #define IMAGE_SYM_CLASS_ARGUMENT 9
1029 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
1030 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1031 #define IMAGE_SYM_CLASS_UNION_TAG 12
1032 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1033 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1034 #define IMAGE_SYM_CLASS_ENUM_TAG 15
1035 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1036 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1037 #define IMAGE_SYM_CLASS_BIT_FIELD 18
1038 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
1039 #define IMAGE_SYM_CLASS_BLOCK 100
1040 #define IMAGE_SYM_CLASS_FUNCTION 101
1041 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1042 #define IMAGE_SYM_CLASS_FILE 103
1043 #define IMAGE_SYM_CLASS_SECTION 104
1044 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1045 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1046 #define IMAGE_COMDAT_SELECT_ANY 2
1047 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1048 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1049 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1050 #define IMAGE_COMDAT_SELECT_LARGEST 6
1051 #define IMAGE_COMDAT_SELECT_NEWEST 7
1052 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1053 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1054 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1055 #define IMAGE_REL_I386_ABSOLUTE 0
1056 #define IMAGE_REL_I386_DIR16 1
1057 #define IMAGE_REL_I386_REL16 2
1058 #define IMAGE_REL_I386_DIR32 6
1059 #define IMAGE_REL_I386_DIR32NB 7
1060 #define IMAGE_REL_I386_SEG12 9
1061 #define IMAGE_REL_I386_SECTION 10
1062 #define IMAGE_REL_I386_SECREL 11
1063 #define IMAGE_REL_I386_REL32 20
1064 #define IMAGE_REL_MIPS_ABSOLUTE 0
1065 #define IMAGE_REL_MIPS_REFHALF 1
1066 #define IMAGE_REL_MIPS_REFWORD 2
1067 #define IMAGE_REL_MIPS_JMPADDR 3
1068 #define IMAGE_REL_MIPS_REFHI 4
1069 #define IMAGE_REL_MIPS_REFLO 5
1070 #define IMAGE_REL_MIPS_GPREL 6
1071 #define IMAGE_REL_MIPS_LITERAL 7
1072 #define IMAGE_REL_MIPS_SECTION 10
1073 #define IMAGE_REL_MIPS_SECREL 11
1074 #define IMAGE_REL_MIPS_SECRELLO 12
1075 #define IMAGE_REL_MIPS_SECRELHI 13
1076 #define IMAGE_REL_MIPS_REFWORDNB 34
1077 #define IMAGE_REL_MIPS_PAIR 35
1078 #define IMAGE_REL_ALPHA_ABSOLUTE 0
1079 #define IMAGE_REL_ALPHA_REFLONG 1
1080 #define IMAGE_REL_ALPHA_REFQUAD 2
1081 #define IMAGE_REL_ALPHA_GPREL32 3
1082 #define IMAGE_REL_ALPHA_LITERAL 4
1083 #define IMAGE_REL_ALPHA_LITUSE 5
1084 #define IMAGE_REL_ALPHA_GPDISP 6
1085 #define IMAGE_REL_ALPHA_BRADDR 7
1086 #define IMAGE_REL_ALPHA_HINT 8
1087 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1088 #define IMAGE_REL_ALPHA_REFHI 10
1089 #define IMAGE_REL_ALPHA_REFLO 11
1090 #define IMAGE_REL_ALPHA_PAIR 12
1091 #define IMAGE_REL_ALPHA_MATCH 13
1092 #define IMAGE_REL_ALPHA_SECTION 14
1093 #define IMAGE_REL_ALPHA_SECREL 15
1094 #define IMAGE_REL_ALPHA_REFLONGNB 16
1095 #define IMAGE_REL_ALPHA_SECRELLO 17
1096 #define IMAGE_REL_ALPHA_SECRELHI 18
1097 #define IMAGE_REL_PPC_ABSOLUTE 0
1098 #define IMAGE_REL_PPC_ADDR64 1
1099 #define IMAGE_REL_PPC_ADDR32 2
1100 #define IMAGE_REL_PPC_ADDR24 3
1101 #define IMAGE_REL_PPC_ADDR16 4
1102 #define IMAGE_REL_PPC_ADDR14 5
1103 #define IMAGE_REL_PPC_REL24 6
1104 #define IMAGE_REL_PPC_REL14 7
1105 #define IMAGE_REL_PPC_TOCREL16 8
1106 #define IMAGE_REL_PPC_TOCREL14 9
1107 #define IMAGE_REL_PPC_ADDR32NB 10
1108 #define IMAGE_REL_PPC_SECREL 11
1109 #define IMAGE_REL_PPC_SECTION 12
1110 #define IMAGE_REL_PPC_IFGLUE 13
1111 #define IMAGE_REL_PPC_IMGLUE 14
1112 #define IMAGE_REL_PPC_SECREL16 15
1113 #define IMAGE_REL_PPC_REFHI 16
1114 #define IMAGE_REL_PPC_REFLO 17
1115 #define IMAGE_REL_PPC_PAIR 18
1116 #define IMAGE_REL_PPC_TYPEMASK 255
1117 #define IMAGE_REL_PPC_NEG 256
1118 #define IMAGE_REL_PPC_BRTAKEN 512
1119 #define IMAGE_REL_PPC_BRNTAKEN 1024
1120 #define IMAGE_REL_PPC_TOCDEFN 2048
1121 #define IMAGE_REL_BASED_ABSOLUTE 0
1122 #define IMAGE_REL_BASED_HIGH 1
1123 #define IMAGE_REL_BASED_LOW 2
1124 #define IMAGE_REL_BASED_HIGHLOW 3
1125 #define IMAGE_REL_BASED_HIGHADJ 4
1126 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1127 #define IMAGE_ARCHIVE_START_SIZE 8
1128 #define IMAGE_ARCHIVE_START "!<arch>\n"
1129 #define IMAGE_ARCHIVE_END "`\n"
1130 #define IMAGE_ARCHIVE_PAD "\n"
1131 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1132 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1133 #define IMAGE_ORDINAL_FLAG 0x80000000
1134 #define IMAGE_SNAP_BY_ORDINAL(o) ((o&IMAGE_ORDINAL_FLAG)!=0)
1135 #define IMAGE_ORDINAL(o) (o&0xffff)
1136 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1137 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1138 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
1139 #define IMAGE_DEBUG_TYPE_COFF 1
1140 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
1141 #define IMAGE_DEBUG_TYPE_FPO 3
1142 #define IMAGE_DEBUG_TYPE_MISC 4
1143 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
1144 #define IMAGE_DEBUG_TYPE_FIXUP 6
1145 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
1146 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
1147 #define FRAME_FPO 0
1148 #define FRAME_TRAP 1
1149 #define FRAME_TSS 2
1150 #define FRAME_NONFPO 3
1151 #define IMAGE_DEBUG_MISC_EXENAME 1
1152 #define N_BTMASK 0x000F
1153 #define N_TMASK 0x0030
1154 #define N_TMASK1 0x00C0
1155 #define N_TMASK2 0x00F0
1156 #define N_BTSHFT 4
1157 #define N_TSHIFT 2
1158 #define IS_TEXT_UNICODE_ASCII16 1
1159 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
1160 #define IS_TEXT_UNICODE_STATISTICS 2
1161 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
1162 #define IS_TEXT_UNICODE_CONTROLS 4
1163 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
1164 #define IS_TEXT_UNICODE_SIGNATURE 8
1165 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
1166 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
1167 #define IS_TEXT_UNICODE_ODD_LENGTH 512
1168 #define IS_TEXT_UNICODE_NULL_BYTES 4096
1169 #define IS_TEXT_UNICODE_UNICODE_MASK 15
1170 #define IS_TEXT_UNICODE_REVERSE_MASK 240
1171 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
1172 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
1173 #define SERVICE_KERNEL_DRIVER 1
1174 #define SERVICE_FILE_SYSTEM_DRIVER 2
1175 #define SERVICE_ADAPTER 4
1176 #define SERVICE_RECOGNIZER_DRIVER 8
1177 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
1178 #define SERVICE_WIN32_OWN_PROCESS 16
1179 #define SERVICE_WIN32_SHARE_PROCESS 32
1180 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
1181 #define SERVICE_INTERACTIVE_PROCESS 256
1182 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
1183 #define SERVICE_BOOT_START 0
1184 #define SERVICE_SYSTEM_START 1
1185 #define SERVICE_AUTO_START 2
1186 #define SERVICE_DEMAND_START 3
1187 #define SERVICE_DISABLED 4
1188 #define SERVICE_ERROR_IGNORE 0
1189 #define SERVICE_ERROR_NORMAL 1
1190 #define SERVICE_ERROR_SEVERE 2
1191 #define SERVICE_ERROR_CRITICAL 3
1192 #define SE_OWNER_DEFAULTED 1
1193 #define SE_GROUP_DEFAULTED 2
1194 #define SE_DACL_PRESENT 4
1195 #define SE_DACL_DEFAULTED 8
1196 #define SE_SACL_PRESENT 16
1197 #define SE_SACL_DEFAULTED 32
1198 #define SE_DACL_AUTO_INHERIT_REQ 256
1199 #define SE_SACL_AUTO_INHERIT_REQ 512
1200 #define SE_DACL_AUTO_INHERITED 1024
1201 #define SE_SACL_AUTO_INHERITED 2048
1202 #define SE_DACL_PROTECTED 4096
1203 #define SE_SACL_PROTECTED 8192
1204 #define SE_RM_CONTROL_VALID 0x4000
1205 #define SE_SELF_RELATIVE 0x8000
1206 #define SECURITY_DESCRIPTOR_MIN_LENGTH 20
1207 #define SECURITY_DESCRIPTOR_REVISION 1
1208 #define SECURITY_DESCRIPTOR_REVISION1 1
1209 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
1210 #define SE_PRIVILEGE_ENABLED 2
1211 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
1212 #define PRIVILEGE_SET_ALL_NECESSARY 1
1213 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
1214 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
1215 #define SECURITY_DYNAMIC_TRACKING TRUE
1216 #define SECURITY_STATIC_TRACKING FALSE
1217 /* also in ddk/ntifs.h */
1218 #define TOKEN_ASSIGN_PRIMARY (0x0001)
1219 #define TOKEN_DUPLICATE (0x0002)
1220 #define TOKEN_IMPERSONATE (0x0004)
1221 #define TOKEN_QUERY (0x0008)
1222 #define TOKEN_QUERY_SOURCE (0x0010)
1223 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
1224 #define TOKEN_ADJUST_GROUPS (0x0040)
1225 #define TOKEN_ADJUST_DEFAULT (0x0080)
1226 #define TOKEN_ADJUST_SESSIONID (0x0100)
1227 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
1228 TOKEN_ASSIGN_PRIMARY |\
1229 TOKEN_DUPLICATE |\
1230 TOKEN_IMPERSONATE |\
1231 TOKEN_QUERY |\
1232 TOKEN_QUERY_SOURCE |\
1233 TOKEN_ADJUST_PRIVILEGES |\
1234 TOKEN_ADJUST_GROUPS |\
1235 TOKEN_ADJUST_DEFAULT |\
1236 TOKEN_ADJUST_SESSIONID)
1237 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
1238 TOKEN_QUERY)
1239 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
1240 TOKEN_ADJUST_PRIVILEGES |\
1241 TOKEN_ADJUST_GROUPS |\
1242 TOKEN_ADJUST_DEFAULT)
1243
1244 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
1245 #define TOKEN_SOURCE_LENGTH 8
1246 /* end ddk/ntifs.h */
1247 #define DLL_PROCESS_DETACH 0
1248 #define DLL_PROCESS_ATTACH 1
1249 #define DLL_THREAD_ATTACH 2
1250 #define DLL_THREAD_DETACH 3
1251 #define DBG_CONTINUE 0x10002
1252 #define DBG_TERMINATE_THREAD 0x40010003
1253 #define DBG_TERMINATE_PROCESS 0x40010004
1254 #define DBG_CONTROL_C 0x40010005
1255 #define DBG_CONTROL_BREAK 0x40010008
1256 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1257 #define TAPE_ABSOLUTE_POSITION 0
1258 #define TAPE_LOGICAL_POSITION 1
1259 #define TAPE_PSEUDO_LOGICAL_POSITION 2
1260 #define TAPE_REWIND 0
1261 #define TAPE_ABSOLUTE_BLOCK 1
1262 #define TAPE_LOGICAL_BLOCK 2
1263 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
1264 #define TAPE_SPACE_END_OF_DATA 4
1265 #define TAPE_SPACE_RELATIVE_BLOCKS 5
1266 #define TAPE_SPACE_FILEMARKS 6
1267 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
1268 #define TAPE_SPACE_SETMARKS 8
1269 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
1270 #define TAPE_DRIVE_FIXED 1
1271 #define TAPE_DRIVE_SELECT 2
1272 #define TAPE_DRIVE_INITIATOR 4
1273 #define TAPE_DRIVE_ERASE_SHORT 16
1274 #define TAPE_DRIVE_ERASE_LONG 32
1275 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
1276 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
1277 #define TAPE_DRIVE_TAPE_CAPACITY 256
1278 #define TAPE_DRIVE_TAPE_REMAINING 512
1279 #define TAPE_DRIVE_FIXED_BLOCK 1024
1280 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
1281 #define TAPE_DRIVE_WRITE_PROTECT 4096
1282 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
1283 #define TAPE_DRIVE_ECC 0x10000
1284 #define TAPE_DRIVE_COMPRESSION 0x20000
1285 #define TAPE_DRIVE_PADDING 0x40000
1286 #define TAPE_DRIVE_REPORT_SMKS 0x80000
1287 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
1288 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
1289 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
1290 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
1291 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
1292 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
1293 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
1294 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
1295 #define TAPE_DRIVE_TENSION 0x80000002
1296 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
1297 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
1298 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
1299 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
1300 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
1301 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
1302 #define TAPE_DRIVE_SET_ECC 0x80000100
1303 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
1304 #define TAPE_DRIVE_SET_PADDING 0x80000400
1305 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
1306 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
1307 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
1308 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1309 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1310 #define TAPE_DRIVE_END_OF_DATA 0x80010000
1311 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1312 #define TAPE_DRIVE_FILEMARKS 0x80040000
1313 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1314 #define TAPE_DRIVE_SETMARKS 0x80100000
1315 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1316 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1317 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1318 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1319 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1320 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1321 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1322 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1323 #define TAPE_DRIVE_FORMAT 0xA0000000
1324 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1325 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1326 #define TAPE_FIXED_PARTITIONS 0
1327 #define TAPE_INITIATOR_PARTITIONS 2
1328 #define TAPE_SELECT_PARTITIONS 1
1329 #define TAPE_FILEMARKS 1
1330 #define TAPE_LONG_FILEMARKS 3
1331 #define TAPE_SETMARKS 0
1332 #define TAPE_SHORT_FILEMARKS 2
1333 #define TAPE_ERASE_LONG 1
1334 #define TAPE_ERASE_SHORT 0
1335 #define TAPE_LOAD 0
1336 #define TAPE_UNLOAD 1
1337 #define TAPE_TENSION 2
1338 #define TAPE_LOCK 3
1339 #define TAPE_UNLOCK 4
1340 #define TAPE_FORMAT 5
1341 #if (_WIN32_WINNT >= 0x0500)
1342 #define VER_MINORVERSION 0x0000001
1343 #define VER_MAJORVERSION 0x0000002
1344 #define VER_BUILDNUMBER 0x0000004
1345 #define VER_PLATFORMID 0x0000008
1346 #define VER_SERVICEPACKMINOR 0x0000010
1347 #define VER_SERVICEPACKMAJOR 0x0000020
1348 #define VER_SUITENAME 0x0000040
1349 #define VER_PRODUCT_TYPE 0x0000080
1350 #define VER_EQUAL 1
1351 #define VER_GREATER 2
1352 #define VER_GREATER_EQUAL 3
1353 #define VER_LESS 4
1354 #define VER_LESS_EQUAL 5
1355 #define VER_AND 6
1356 #define VER_OR 7
1357 #endif
1358 #define VER_PLATFORM_WIN32s 0
1359 #define VER_PLATFORM_WIN32_WINDOWS 1
1360 #define VER_PLATFORM_WIN32_NT 2
1361 #define VER_NT_WORKSTATION 1
1362 #define VER_NT_DOMAIN_CONTROLLER 2
1363 #define VER_NT_SERVER 3
1364 #define VER_SUITE_SMALLBUSINESS 1
1365 #define VER_SUITE_ENTERPRISE 2
1366 #define VER_SUITE_BACKOFFICE 4
1367 #define VER_SUITE_TERMINAL 16
1368 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
1369 #define VER_SUITE_DATACENTER 128
1370 #define VER_SUITE_PERSONAL 512
1371 #define VER_SUITE_BLADE 1024
1372 #define WT_EXECUTEDEFAULT 0x00000000
1373 #define WT_EXECUTEINIOTHREAD 0x00000001
1374 #define WT_EXECUTEINWAITTHREAD 0x00000004
1375 #define WT_EXECUTEONLYONCE 0x00000008
1376 #define WT_EXECUTELONGFUNCTION 0x00000010
1377 #define WT_EXECUTEINTIMERTHREAD 0x00000020
1378 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1379 #define WT_TRANSFER_IMPERSONATION 0x00000100
1380 #if (_WIN32_WINNT >= 0x0501)
1381 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1382 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1383 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1384 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1385 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1386 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1387 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1388 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1389 #endif /* (_WIN32_WINNT >= 0x0501) */
1390 #define BTYPE(x) ((x)&N_BTMASK)
1391 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1392 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1393 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1394 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1395 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1396 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1397 #define TLS_MINIMUM_AVAILABLE 64
1398 #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
1399 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1400 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1401 #define IO_REPARSE_TAG_RESERVED_ZERO 0
1402 #define IO_REPARSE_TAG_RESERVED_ONE 1
1403 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1404 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1405 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
1406 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1407 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1408 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1409 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1410 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1411 #ifndef RC_INVOKED
1412 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
1413
1414 #ifdef _GUID_DEFINED
1415 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1416 #endif
1417
1418 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1419 #define GUID_DEFINED
1420 typedef struct _GUID {
1421 unsigned long Data1;
1422 unsigned short Data2;
1423 unsigned short Data3;
1424 unsigned char Data4[8];
1425 } GUID, *REFGUID, *LPGUID;
1426 #define SYSTEM_LUID { 0x3E7, 0x0 }
1427 #endif /* GUID_DEFINED */
1428
1429 /* ACE Access Types, also in ntifs.h */
1430 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
1431 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
1432 #define ACCESS_DENIED_ACE_TYPE (0x1)
1433 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
1434 #define SYSTEM_ALARM_ACE_TYPE (0x3)
1435 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
1436 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
1437 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
1438 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
1439 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
1440 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
1441 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
1442 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
1443 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
1444 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
1445 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
1446 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
1447 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
1448 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
1449 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
1450 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
1451 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
1452 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
1453 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
1454 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x10)
1455 /* end ntifs.h */
1456 typedef struct _GENERIC_MAPPING {
1457 ACCESS_MASK GenericRead;
1458 ACCESS_MASK GenericWrite;
1459 ACCESS_MASK GenericExecute;
1460 ACCESS_MASK GenericAll;
1461 } GENERIC_MAPPING, *PGENERIC_MAPPING;
1462 typedef struct _ACE_HEADER {
1463 BYTE AceType;
1464 BYTE AceFlags;
1465 WORD AceSize;
1466 } ACE_HEADER, *PACE_HEADER;
1467 typedef struct _ACCESS_ALLOWED_ACE {
1468 ACE_HEADER Header;
1469 ACCESS_MASK Mask;
1470 DWORD SidStart;
1471 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
1472 typedef struct _ACCESS_DENIED_ACE {
1473 ACE_HEADER Header;
1474 ACCESS_MASK Mask;
1475 DWORD SidStart;
1476 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
1477 typedef struct _SYSTEM_AUDIT_ACE {
1478 ACE_HEADER Header;
1479 ACCESS_MASK Mask;
1480 DWORD SidStart;
1481 } SYSTEM_AUDIT_ACE;
1482 typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
1483 typedef struct _SYSTEM_ALARM_ACE {
1484 ACE_HEADER Header;
1485 ACCESS_MASK Mask;
1486 DWORD SidStart;
1487 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
1488 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
1489 ACE_HEADER Header;
1490 ACCESS_MASK Mask;
1491 DWORD Flags;
1492 GUID ObjectType;
1493 GUID InheritedObjectType;
1494 DWORD SidStart;
1495 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
1496 typedef struct _ACCESS_DENIED_OBJECT_ACE {
1497 ACE_HEADER Header;
1498 ACCESS_MASK Mask;
1499 DWORD Flags;
1500 GUID ObjectType;
1501 GUID InheritedObjectType;
1502 DWORD SidStart;
1503 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
1504 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
1505 ACE_HEADER Header;
1506 ACCESS_MASK Mask;
1507 DWORD Flags;
1508 GUID ObjectType;
1509 GUID InheritedObjectType;
1510 DWORD SidStart;
1511 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
1512 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
1513 ACE_HEADER Header;
1514 ACCESS_MASK Mask;
1515 DWORD Flags;
1516 GUID ObjectType;
1517 GUID InheritedObjectType;
1518 DWORD SidStart;
1519 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
1520 typedef struct _ACL {
1521 BYTE AclRevision;
1522 BYTE Sbz1;
1523 WORD AclSize;
1524 WORD AceCount;
1525 WORD Sbz2;
1526 } ACL,*PACL;
1527 typedef struct _ACL_REVISION_INFORMATION {
1528 DWORD AclRevision;
1529 } ACL_REVISION_INFORMATION;
1530 typedef struct _ACL_SIZE_INFORMATION {
1531 DWORD AceCount;
1532 DWORD AclBytesInUse;
1533 DWORD AclBytesFree;
1534 } ACL_SIZE_INFORMATION;
1535
1536 /* FIXME: add more machines */
1537 #if defined(_X86_) || defined(linux)
1538 #define SIZE_OF_80387_REGISTERS 80
1539 #define CONTEXT_i386 0x10000
1540 #define CONTEXT_i486 0x10000
1541 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
1542 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
1543 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
1544 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
1545 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
1546 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
1547 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
1548 #define MAXIMUM_SUPPORTED_EXTENSION 512
1549 typedef struct _FLOATING_SAVE_AREA {
1550 DWORD ControlWord;
1551 DWORD StatusWord;
1552 DWORD TagWord;
1553 DWORD ErrorOffset;
1554 DWORD ErrorSelector;
1555 DWORD DataOffset;
1556 DWORD DataSelector;
1557 BYTE RegisterArea[80];
1558 DWORD Cr0NpxState;
1559 } FLOATING_SAVE_AREA;
1560 typedef struct _CONTEXT {
1561 DWORD ContextFlags;
1562 DWORD Dr0;
1563 DWORD Dr1;
1564 DWORD Dr2;
1565 DWORD Dr3;
1566 DWORD Dr6;
1567 DWORD Dr7;
1568 FLOATING_SAVE_AREA FloatSave;
1569 DWORD SegGs;
1570 DWORD SegFs;
1571 DWORD SegEs;
1572 DWORD SegDs;
1573 DWORD Edi;
1574 DWORD Esi;
1575 DWORD Ebx;
1576 DWORD Edx;
1577 DWORD Ecx;
1578 DWORD Eax;
1579 DWORD Ebp;
1580 DWORD Eip;
1581 DWORD SegCs;
1582 DWORD EFlags;
1583 DWORD Esp;
1584 DWORD SegSs;
1585 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
1586 } CONTEXT;
1587 #elif defined(_PPC_)
1588 #define CONTEXT_CONTROL 1L
1589 #define CONTEXT_FLOATING_POINT 2L
1590 #define CONTEXT_INTEGER 4L
1591 #define CONTEXT_DEBUG_REGISTERS 8L
1592 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1593 typedef struct {
1594 double Fpr0;
1595 double Fpr1;
1596 double Fpr2;
1597 double Fpr3;
1598 double Fpr4;
1599 double Fpr5;
1600 double Fpr6;
1601 double Fpr7;
1602 double Fpr8;
1603 double Fpr9;
1604 double Fpr10;
1605 double Fpr11;
1606 double Fpr12;
1607 double Fpr13;
1608 double Fpr14;
1609 double Fpr15;
1610 double Fpr16;
1611 double Fpr17;
1612 double Fpr18;
1613 double Fpr19;
1614 double Fpr20;
1615 double Fpr21;
1616 double Fpr22;
1617 double Fpr23;
1618 double Fpr24;
1619 double Fpr25;
1620 double Fpr26;
1621 double Fpr27;
1622 double Fpr28;
1623 double Fpr29;
1624 double Fpr30;
1625 double Fpr31;
1626 double Fpscr;
1627 DWORD Gpr0;
1628 DWORD Gpr1;
1629 DWORD Gpr2;
1630 DWORD Gpr3;
1631 DWORD Gpr4;
1632 DWORD Gpr5;
1633 DWORD Gpr6;
1634 DWORD Gpr7;
1635 DWORD Gpr8;
1636 DWORD Gpr9;
1637 DWORD Gpr10;
1638 DWORD Gpr11;
1639 DWORD Gpr12;
1640 DWORD Gpr13;
1641 DWORD Gpr14;
1642 DWORD Gpr15;
1643 DWORD Gpr16;
1644 DWORD Gpr17;
1645 DWORD Gpr18;
1646 DWORD Gpr19;
1647 DWORD Gpr20;
1648 DWORD Gpr21;
1649 DWORD Gpr22;
1650 DWORD Gpr23;
1651 DWORD Gpr24;
1652 DWORD Gpr25;
1653 DWORD Gpr26;
1654 DWORD Gpr27;
1655 DWORD Gpr28;
1656 DWORD Gpr29;
1657 DWORD Gpr30;
1658 DWORD Gpr31;
1659 DWORD Cr;
1660 DWORD Xer;
1661 DWORD Msr;
1662 DWORD Iar;
1663 DWORD Lr;
1664 DWORD Ctr;
1665 DWORD ContextFlags;
1666 DWORD Fill[3];
1667 DWORD Dr0;
1668 DWORD Dr1;
1669 DWORD Dr2;
1670 DWORD Dr3;
1671 DWORD Dr4;
1672 DWORD Dr5;
1673 DWORD Dr6;
1674 DWORD Dr7;
1675 } CONTEXT;
1676 #elif defined(_ALPHA_)
1677 #define CONTEXT_ALPHA 0x20000
1678 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1679 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1680 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1681 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1682 typedef struct _CONTEXT {
1683 ULONGLONG FltF0;
1684 ULONGLONG FltF1;
1685 ULONGLONG FltF2;
1686 ULONGLONG FltF3;
1687 ULONGLONG FltF4;
1688 ULONGLONG FltF5;
1689 ULONGLONG FltF6;
1690 ULONGLONG FltF7;
1691 ULONGLONG FltF8;
1692 ULONGLONG FltF9;
1693 ULONGLONG FltF10;
1694 ULONGLONG FltF11;
1695 ULONGLONG FltF12;
1696 ULONGLONG FltF13;
1697 ULONGLONG FltF14;
1698 ULONGLONG FltF15;
1699 ULONGLONG FltF16;
1700 ULONGLONG FltF17;
1701 ULONGLONG FltF18;
1702 ULONGLONG FltF19;
1703 ULONGLONG FltF20;
1704 ULONGLONG FltF21;
1705 ULONGLONG FltF22;
1706 ULONGLONG FltF23;
1707 ULONGLONG FltF24;
1708 ULONGLONG FltF25;
1709 ULONGLONG FltF26;
1710 ULONGLONG FltF27;
1711 ULONGLONG FltF28;
1712 ULONGLONG FltF29;
1713 ULONGLONG FltF30;
1714 ULONGLONG FltF31;
1715 ULONGLONG IntV0;
1716 ULONGLONG IntT0;
1717 ULONGLONG IntT1;
1718 ULONGLONG IntT2;
1719 ULONGLONG IntT3;
1720 ULONGLONG IntT4;
1721 ULONGLONG IntT5;
1722 ULONGLONG IntT6;
1723 ULONGLONG IntT7;
1724 ULONGLONG IntS0;
1725 ULONGLONG IntS1;
1726 ULONGLONG IntS2;
1727 ULONGLONG IntS3;
1728 ULONGLONG IntS4;
1729 ULONGLONG IntS5;
1730 ULONGLONG IntFp;
1731 ULONGLONG IntA0;
1732 ULONGLONG IntA1;
1733 ULONGLONG IntA2;
1734 ULONGLONG IntA3;
1735 ULONGLONG IntA4;
1736 ULONGLONG IntA5;
1737 ULONGLONG IntT8;
1738 ULONGLONG IntT9;
1739 ULONGLONG IntT10;
1740 ULONGLONG IntT11;
1741 ULONGLONG IntRa;
1742 ULONGLONG IntT12;
1743 ULONGLONG IntAt;
1744 ULONGLONG IntGp;
1745 ULONGLONG IntSp;
1746 ULONGLONG IntZero;
1747 ULONGLONG Fpcr;
1748 ULONGLONG SoftFpcr;
1749 ULONGLONG Fir;
1750 DWORD Psr;
1751 DWORD ContextFlags;
1752 DWORD Fill[4];
1753 } CONTEXT;
1754 #elif defined(SHx)
1755
1756 /* These are the debug or break registers on the SH3 */
1757 typedef struct _DEBUG_REGISTERS {
1758 ULONG BarA;
1759 UCHAR BasrA;
1760 UCHAR BamrA;
1761 USHORT BbrA;
1762 ULONG BarB;
1763 UCHAR BasrB;
1764 UCHAR BamrB;
1765 USHORT BbrB;
1766 ULONG BdrB;
1767 ULONG BdmrB;
1768 USHORT Brcr;
1769 USHORT Align;
1770 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
1771
1772 /* The following flags control the contents of the CONTEXT structure. */
1773
1774 #define CONTEXT_SH3 0x00000040
1775 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
1776
1777 #ifdef SH3
1778 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
1779 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
1780 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
1781 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
1782 #else /* SH4 */
1783 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
1784 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
1785 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
1786 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
1787 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
1788 #endif
1789
1790 /* Context Frame */
1791
1792 /* This frame is used to store a limited processor context into the */
1793 /* Thread structure for CPUs which have no floating point support. */
1794
1795 typedef struct _CONTEXT {
1796 /* The flags values within this flag control the contents of */
1797 /* a CONTEXT record. */
1798
1799 /* If the context record is used as an input parameter, then */
1800 /* for each portion of the context record controlled by a flag */
1801 /* whose value is set, it is assumed that that portion of the */
1802 /* context record contains valid context. If the context record */
1803 /* is being used to modify a thread's context, then only that */
1804 /* portion of the threads context will be modified. */
1805
1806 /* If the context record is used as an IN OUT parameter to capture */
1807 /* the context of a thread, then only those portions of the thread's */
1808 /* context corresponding to set flags will be returned. */
1809
1810 /* The context record is never used as an OUT only parameter. */
1811
1812
1813 ULONG ContextFlags;
1814
1815 /* This section is specified/returned if the ContextFlags word contains */
1816 /* the flag CONTEXT_INTEGER. */
1817
1818 /* N.B. The registers RA and R15 are defined in this section, but are */
1819 /* considered part of the control context rather than part of the integer */
1820 /* context. */
1821
1822 ULONG PR;
1823 ULONG MACH;
1824 ULONG MACL;
1825 ULONG GBR;
1826 ULONG R0;
1827 ULONG R1;
1828 ULONG R2;
1829 ULONG R3;
1830 ULONG R4;
1831 ULONG R5;
1832 ULONG R6;
1833 ULONG R7;
1834 ULONG R8;
1835 ULONG R9;
1836 ULONG R10;
1837 ULONG R11;
1838 ULONG R12;
1839 ULONG R13;
1840 ULONG R14;
1841 ULONG R15;
1842
1843 /* This section is specified/returned if the ContextFlags word contains */
1844 /* the flag CONTEXT_CONTROL. */
1845
1846 /* N.B. The registers r15 and ra are defined in the integer section, */
1847 /* but are considered part of the control context rather than part of */
1848 /* the integer context. */
1849
1850 ULONG Fir;
1851 ULONG Psr;
1852
1853 #if !defined(SH3e) && !defined(SH4)
1854 ULONG OldStuff[2];
1855 DEBUG_REGISTERS DebugRegisters;
1856 #else
1857 ULONG Fpscr;
1858 ULONG Fpul;
1859 ULONG FRegs[16];
1860 #if defined(SH4)
1861 ULONG xFRegs[16];
1862 #endif
1863 #endif
1864 } CONTEXT;
1865
1866 #elif defined(MIPS)
1867
1868 /* The following flags control the contents of the CONTEXT structure. */
1869
1870 #define CONTEXT_R4000 0x00010000 /* r4000 context */
1871
1872 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
1873 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
1874 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
1875
1876 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1877
1878 /* Context Frame */
1879
1880 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
1881
1882 /* This frame has a several purposes: 1) it is used as an argument to */
1883 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
1884 /* 3) it is used to construct a call frame for exception dispatching */
1885 /* in user mode, and 4) it is used in the user level thread creation */
1886 /* routines. */
1887
1888 /* The layout of the record conforms to a standard call frame. */
1889
1890
1891 typedef struct _CONTEXT {
1892
1893 /* This section is always present and is used as an argument build */
1894 /* area. */
1895
1896 DWORD Argument[4];
1897
1898 /* This section is specified/returned if the ContextFlags word contains */
1899 /* the flag CONTEXT_FLOATING_POINT. */
1900
1901 DWORD FltF0;
1902 DWORD FltF1;
1903 DWORD FltF2;
1904 DWORD FltF3;
1905 DWORD FltF4;
1906 DWORD FltF5;
1907 DWORD FltF6;
1908 DWORD FltF7;
1909 DWORD FltF8;
1910 DWORD FltF9;
1911 DWORD FltF10;
1912 DWORD FltF11;
1913 DWORD FltF12;
1914 DWORD FltF13;
1915 DWORD FltF14;
1916 DWORD FltF15;
1917 DWORD FltF16;
1918 DWORD FltF17;
1919 DWORD FltF18;
1920 DWORD FltF19;
1921 DWORD FltF20;
1922 DWORD FltF21;
1923 DWORD FltF22;
1924 DWORD FltF23;
1925 DWORD FltF24;
1926 DWORD FltF25;
1927 DWORD FltF26;
1928 DWORD FltF27;
1929 DWORD FltF28;
1930 DWORD FltF29;
1931 DWORD FltF30;
1932 DWORD FltF31;
1933
1934 /* This section is specified/returned if the ContextFlags word contains */
1935 /* the flag CONTEXT_INTEGER. */
1936
1937 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
1938 /* considered part of the control context rather than part of the integer */
1939 /* context. */
1940
1941 /* N.B. Register zero is not stored in the frame. */
1942
1943 DWORD IntZero;
1944 DWORD IntAt;
1945 DWORD IntV0;
1946 DWORD IntV1;
1947 DWORD IntA0;
1948 DWORD IntA1;
1949 DWORD IntA2;
1950 DWORD IntA3;
1951 DWORD IntT0;
1952 DWORD IntT1;
1953 DWORD IntT2;
1954 DWORD IntT3;
1955 DWORD IntT4;
1956 DWORD IntT5;
1957 DWORD IntT6;
1958 DWORD IntT7;
1959 DWORD IntS0;
1960 DWORD IntS1;
1961 DWORD IntS2;
1962 DWORD IntS3;
1963 DWORD IntS4;
1964 DWORD IntS5;
1965 DWORD IntS6;
1966 DWORD IntS7;
1967 DWORD IntT8;
1968 DWORD IntT9;
1969 DWORD IntK0;
1970 DWORD IntK1;
1971 DWORD IntGp;
1972 DWORD IntSp;
1973 DWORD IntS8;
1974 DWORD IntRa;
1975 DWORD IntLo;
1976 DWORD IntHi;
1977
1978 /* This section is specified/returned if the ContextFlags word contains */
1979 /* the flag CONTEXT_FLOATING_POINT. */
1980
1981 DWORD Fsr;
1982
1983 /* This section is specified/returned if the ContextFlags word contains */
1984 /* the flag CONTEXT_CONTROL. */
1985
1986 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
1987 /* but are considered part of the control context rather than part of */
1988 /* the integer context. */
1989
1990 DWORD Fir;
1991 DWORD Psr;
1992
1993 /* The flags values within this flag control the contents of */
1994 /* a CONTEXT record. */
1995
1996 /* If the context record is used as an input parameter, then */
1997 /* for each portion of the context record controlled by a flag */
1998 /* whose value is set, it is assumed that that portion of the */
1999 /* context record contains valid context. If the context record */
2000 /* is being used to modify a thread's context, then only that */
2001 /* portion of the threads context will be modified. */
2002
2003 /* If the context record is used as an IN OUT parameter to capture */
2004 /* the context of a thread, then only those portions of the thread's */
2005 /* context corresponding to set flags will be returned. */
2006
2007 /* The context record is never used as an OUT only parameter. */
2008
2009 DWORD ContextFlags;
2010
2011 DWORD Fill[2];
2012
2013 } CONTEXT;
2014 #elif defined(ARM)
2015
2016 /* The following flags control the contents of the CONTEXT structure. */
2017
2018 #define CONTEXT_ARM 0x0000040
2019 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
2020 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
2021
2022 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
2023
2024 typedef struct _CONTEXT {
2025 /* The flags values within this flag control the contents of
2026 a CONTEXT record.
2027
2028 If the context record is used as an input parameter, then
2029 for each portion of the context record controlled by a flag
2030 whose value is set, it is assumed that that portion of the
2031 context record contains valid context. If the context record
2032 is being used to modify a thread's context, then only that
2033 portion of the threads context will be modified.
2034
2035 If the context record is used as an IN OUT parameter to capture
2036 the context of a thread, then only those portions of the thread's
2037 context corresponding to set flags will be returned.
2038
2039 The context record is never used as an OUT only parameter. */
2040
2041 ULONG ContextFlags;
2042
2043 /* This section is specified/returned if the ContextFlags word contains
2044 the flag CONTEXT_INTEGER. */
2045 ULONG R0;
2046 ULONG R1;
2047 ULONG R2;
2048 ULONG R3;
2049 ULONG R4;
2050 ULONG R5;
2051 ULONG R6;
2052 ULONG R7;
2053 ULONG R8;
2054 ULONG R9;
2055 ULONG R10;
2056 ULONG R11;
2057 ULONG R12;
2058
2059 ULONG Sp;
2060 ULONG Lr;
2061 ULONG Pc;
2062 ULONG Psr;
2063 } CONTEXT;
2064
2065 #else
2066 #error "undefined processor type"
2067 #endif
2068 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
2069 typedef struct _EXCEPTION_RECORD {
2070 DWORD ExceptionCode;
2071 DWORD ExceptionFlags;
2072 struct _EXCEPTION_RECORD *ExceptionRecord;
2073 PVOID ExceptionAddress;
2074 DWORD NumberParameters;
2075 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2076 } EXCEPTION_RECORD,*PEXCEPTION_RECORD,*LPEXCEPTION_RECORD;
2077 typedef struct _EXCEPTION_POINTERS {
2078 PEXCEPTION_RECORD ExceptionRecord;
2079 PCONTEXT ContextRecord;
2080 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS,*LPEXCEPTION_POINTERS;
2081 typedef union _LARGE_INTEGER {
2082 struct {
2083 DWORD LowPart;
2084 LONG HighPart;
2085 } u;
2086 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2087 _ANONYMOUS_STRUCT struct {
2088 DWORD LowPart;
2089 LONG HighPart;
2090 };
2091 #endif /* NONAMELESSUNION */
2092 LONGLONG QuadPart;
2093 } LARGE_INTEGER, *PLARGE_INTEGER;
2094 typedef union _ULARGE_INTEGER {
2095 struct {
2096 DWORD LowPart;
2097 DWORD HighPart;
2098 } u;
2099 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2100 _ANONYMOUS_STRUCT struct {
2101 DWORD LowPart;
2102 DWORD HighPart;
2103 };
2104 #endif /* NONAMELESSUNION */
2105 ULONGLONG QuadPart;
2106 } ULARGE_INTEGER, *PULARGE_INTEGER;
2107 typedef struct _LUID {
2108 DWORD LowPart;
2109 LONG HighPart;
2110 } LUID, *PLUID;
2111 #pragma pack(push,4)
2112 typedef struct _LUID_AND_ATTRIBUTES {
2113 LUID Luid;
2114 DWORD Attributes;
2115 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2116 #pragma pack(pop)
2117 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2118 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
2119 typedef struct _PRIVILEGE_SET {
2120 DWORD PrivilegeCount;
2121 DWORD Control;
2122 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2123 } PRIVILEGE_SET,*PPRIVILEGE_SET;
2124 typedef struct _SECURITY_ATTRIBUTES {
2125 DWORD nLength;
2126 LPVOID lpSecurityDescriptor;
2127 BOOL bInheritHandle;
2128 } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
2129 typedef enum _SECURITY_IMPERSONATION_LEVEL {
2130 SecurityAnonymous,
2131 SecurityIdentification,
2132 SecurityImpersonation,
2133 SecurityDelegation
2134 } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
2135 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
2136 typedef struct _SECURITY_QUALITY_OF_SERVICE {
2137 DWORD Length;
2138 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2139 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2140 BOOLEAN EffectiveOnly;
2141 } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
2142 typedef PVOID PACCESS_TOKEN;
2143 typedef struct _SE_IMPERSONATION_STATE {
2144 PACCESS_TOKEN Token;
2145 BOOLEAN CopyOnOpen;
2146 BOOLEAN EffectiveOnly;
2147 SECURITY_IMPERSONATION_LEVEL Level;
2148 } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
2149 typedef struct _SID_IDENTIFIER_AUTHORITY {
2150 BYTE Value[6];
2151 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
2152 typedef PVOID PSID;
2153 typedef struct _SID {
2154 BYTE Revision;
2155 BYTE SubAuthorityCount;
2156 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2157 DWORD SubAuthority[ANYSIZE_ARRAY];
2158 } SID, *PISID;
2159 typedef struct _SID_AND_ATTRIBUTES {
2160 PSID Sid;
2161 DWORD Attributes;
2162 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
2163 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2164 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
2165 typedef struct _TOKEN_SOURCE {
2166 CHAR SourceName[TOKEN_SOURCE_LENGTH];
2167 LUID SourceIdentifier;
2168 } TOKEN_SOURCE,*PTOKEN_SOURCE;
2169 typedef struct _TOKEN_CONTROL {
2170 LUID TokenId;
2171 LUID AuthenticationId;
2172 LUID ModifiedId;
2173 TOKEN_SOURCE TokenSource;
2174 } TOKEN_CONTROL,*PTOKEN_CONTROL;
2175 typedef struct _TOKEN_DEFAULT_DACL {
2176 PACL DefaultDacl;
2177 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
2178 typedef struct _TOKEN_GROUPS {
2179 DWORD GroupCount;
2180 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2181 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
2182 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
2183 ULONG SidCount;
2184 ULONG SidLength;
2185 PSID_AND_ATTRIBUTES Sids;
2186 ULONG RestrictedSidCount;
2187 ULONG RestrictedSidLength;
2188 PSID_AND_ATTRIBUTES RestrictedSids;
2189 ULONG PrivilegeCount;
2190 ULONG PrivilegeLength;
2191 PLUID_AND_ATTRIBUTES Privileges;
2192 LUID AuthenticationId;
2193 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
2194 typedef struct _TOKEN_ORIGIN {
2195 LUID OriginatingLogonSession;
2196 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
2197 typedef struct _TOKEN_OWNER {
2198 PSID Owner;
2199 } TOKEN_OWNER,*PTOKEN_OWNER;
2200 typedef struct _TOKEN_PRIMARY_GROUP {
2201 PSID PrimaryGroup;
2202 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
2203 typedef struct _TOKEN_PRIVILEGES {
2204 DWORD PrivilegeCount;
2205 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
2206 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
2207 typedef enum tagTOKEN_TYPE {
2208 TokenPrimary = 1,
2209 TokenImpersonation
2210 } TOKEN_TYPE,*PTOKEN_TYPE;
2211 typedef struct _TOKEN_STATISTICS {
2212 LUID TokenId;
2213 LUID AuthenticationId;
2214 LARGE_INTEGER ExpirationTime;
2215 TOKEN_TYPE TokenType;
2216 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2217 DWORD DynamicCharged;
2218 DWORD DynamicAvailable;
2219 DWORD GroupCount;
2220 DWORD PrivilegeCount;
2221 LUID ModifiedId;
2222 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
2223 typedef struct _TOKEN_USER {
2224 SID_AND_ATTRIBUTES User;
2225 } TOKEN_USER, *PTOKEN_USER;
2226 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
2227 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
2228 typedef struct _SECURITY_DESCRIPTOR {
2229 BYTE Revision;
2230 BYTE Sbz1;
2231 SECURITY_DESCRIPTOR_CONTROL Control;
2232 PSID Owner;
2233 PSID Group;
2234 PACL Sacl;
2235 PACL Dacl;
2236 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
2237 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
2238 BYTE Revision;
2239 BYTE Sbz1;
2240 SECURITY_DESCRIPTOR_CONTROL Control;
2241 DWORD Owner;
2242 DWORD Group;
2243 DWORD Sacl;
2244 DWORD Dacl;
2245 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2246 typedef enum _TOKEN_INFORMATION_CLASS {
2247 TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner,
2248 TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,
2249 TokenImpersonationLevel,TokenStatistics,TokenRestrictedSids,
2250 TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,
2251 TokenSandBoxInert,TokenAuditPolicy,TokenOrigin,
2252 } TOKEN_INFORMATION_CLASS;
2253 typedef enum _SID_NAME_USE {
2254 SidTypeUser=1,SidTypeGroup,SidTypeDomain,SidTypeAlias,
2255 SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,
2256 SidTypeUnknown
2257 } SID_NAME_USE,*PSID_NAME_USE;
2258 typedef struct _QUOTA_LIMITS {
2259 SIZE_T PagedPoolLimit;
2260 SIZE_T NonPagedPoolLimit;
2261 SIZE_T MinimumWorkingSetSize;
2262 SIZE_T MaximumWorkingSetSize;
2263 SIZE_T PagefileLimit;
2264 LARGE_INTEGER TimeLimit;
2265 } QUOTA_LIMITS,*PQUOTA_LIMITS;
2266 typedef struct _IO_COUNTERS {
2267 ULONGLONG ReadOperationCount;
2268 ULONGLONG WriteOperationCount;
2269 ULONGLONG OtherOperationCount;
2270 ULONGLONG ReadTransferCount;
2271 ULONGLONG WriteTransferCount;
2272 ULONGLONG OtherTransferCount;
2273 } IO_COUNTERS, *PIO_COUNTERS;
2274 typedef struct _FILE_NOTIFY_INFORMATION {
2275 DWORD NextEntryOffset;
2276 DWORD Action;
2277 DWORD FileNameLength;
2278 WCHAR FileName[1];
2279 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
2280 typedef struct _TAPE_ERASE {
2281 DWORD Type;
2282 BOOLEAN Immediate;
2283 } TAPE_ERASE,*PTAPE_ERASE;
2284 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
2285 BOOLEAN ECC;
2286 BOOLEAN Compression;
2287 BOOLEAN DataPadding;
2288 BOOLEAN ReportSetmarks;
2289 DWORD DefaultBlockSize;
2290 DWORD MaximumBlockSize;
2291 DWORD MinimumBlockSize;
2292 DWORD MaximumPartitionCount;
2293 DWORD FeaturesLow;
2294 DWORD FeaturesHigh;
2295 DWORD EOTWarningZoneSize;
2296 } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS;
2297 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
2298 LARGE_INTEGER Capacity;
2299 LARGE_INTEGER Remaining;
2300 DWORD BlockSize;
2301 DWORD PartitionCount;
2302 BOOLEAN WriteProtected;
2303 } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS;
2304 typedef struct _TAPE_GET_POSITION {
2305 ULONG Type;
2306 ULONG Partition;
2307 LARGE_INTEGER Offset;
2308 } TAPE_GET_POSITION,*PTAPE_GET_POSITION;
2309 typedef struct _TAPE_PREPARE {
2310 DWORD Operation;
2311 BOOLEAN Immediate;
2312 } TAPE_PREPARE,*PTAPE_PREPARE;
2313 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
2314 BOOLEAN ECC;
2315 BOOLEAN Compression;
2316 BOOLEAN DataPadding;
2317 BOOLEAN ReportSetmarks;
2318 ULONG EOTWarningZoneSize;
2319 } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS;
2320 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
2321 ULONG BlockSize;
2322 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
2323 typedef struct _TAPE_SET_POSITION {
2324 DWORD Method;
2325 DWORD Partition;
2326 LARGE_INTEGER Offset;
2327 BOOLEAN Immediate;
2328 } TAPE_SET_POSITION,*PTAPE_SET_POSITION;
2329 typedef struct _TAPE_WRITE_MARKS {
2330 DWORD Type;
2331 DWORD Count;
2332 BOOLEAN Immediate;
2333 } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS;
2334 typedef struct _TAPE_CREATE_PARTITION {
2335 DWORD Method;
2336 DWORD Count;
2337 DWORD Size;
2338 } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION;
2339 typedef struct _MEMORY_BASIC_INFORMATION {
2340 PVOID BaseAddress;
2341 PVOID AllocationBase;
2342 DWORD AllocationProtect;
2343 DWORD RegionSize;
2344 DWORD State;
2345 DWORD Protect;
2346 DWORD Type;
2347 } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
2348 typedef struct _MESSAGE_RESOURCE_ENTRY {
2349 WORD Length;
2350 WORD Flags;
2351 BYTE Text[1];
2352 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2353 typedef struct _MESSAGE_RESOURCE_BLOCK {
2354 DWORD LowId;
2355 DWORD HighId;
2356 DWORD OffsetToEntries;
2357 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2358 typedef struct _MESSAGE_RESOURCE_DATA {
2359 DWORD NumberOfBlocks;
2360 MESSAGE_RESOURCE_BLOCK Blocks[1];
2361 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2362 typedef struct _LIST_ENTRY {
2363 struct _LIST_ENTRY *Flink;
2364 struct _LIST_ENTRY *Blink;
2365 } LIST_ENTRY,*PLIST_ENTRY;
2366 typedef struct _SINGLE_LIST_ENTRY {
2367 struct _SINGLE_LIST_ENTRY *Next;
2368 } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY;
2369
2370 #ifndef _SLIST_HEADER_
2371 #define _SLIST_HEADER_
2372 #define SLIST_ENTRY SINGLE_LIST_ENTRY
2373 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2374 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2375 typedef union _SLIST_HEADER {
2376 ULONGLONG Alignment;
2377 _ANONYMOUS_STRUCT struct {
2378 SLIST_ENTRY Next;
2379 WORD Depth;
2380 WORD Sequence;
2381 } DUMMYSTRUCTNAME;
2382 } SLIST_HEADER,*PSLIST_HEADER;
2383 #endif /* !_SLIST_HEADER_ */
2384
2385 /* FIXME: Please oh please stop including winnt.h from the DDK... */
2386 #ifndef __NTDDK_H
2387 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
2388 WORD Type;
2389 WORD CreatorBackTraceIndex;
2390 struct _RTL_CRITICAL_SECTION *CriticalSection;
2391 LIST_ENTRY ProcessLocksList;
2392 DWORD EntryCount;
2393 DWORD ContentionCount;
2394 DWORD Spare[2];
2395 } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG;
2396 typedef struct _RTL_CRITICAL_SECTION {
2397 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
2398 LONG LockCount;
2399 LONG RecursionCount;
2400 HANDLE OwningThread;
2401 HANDLE LockSemaphore;
2402 ULONG_PTR SpinCount;
2403 } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
2404 #endif
2405
2406 typedef struct _EVENTLOGRECORD {
2407 DWORD Length;
2408 DWORD Reserved;
2409 DWORD RecordNumber;
2410 DWORD TimeGenerated;
2411 DWORD TimeWritten;
2412 DWORD EventID;
2413 WORD EventType;
2414 WORD NumStrings;
2415 WORD EventCategory;
2416 WORD ReservedFlags;
2417 DWORD ClosingRecordNumber;
2418 DWORD StringOffset;
2419 DWORD UserSidLength;
2420 DWORD UserSidOffset;
2421 DWORD DataLength;
2422 DWORD DataOffset;
2423 } EVENTLOGRECORD,*PEVENTLOGRECORD;
2424 typedef struct _OSVERSIONINFOA {
2425 DWORD dwOSVersionInfoSize;
2426 DWORD dwMajorVersion;
2427 DWORD dwMinorVersion;
2428 DWORD dwBuildNumber;
2429 DWORD dwPlatformId;
2430 CHAR szCSDVersion[128];
2431 } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA;
2432 typedef struct _OSVERSIONINFOW {
2433 DWORD dwOSVersionInfoSize;
2434 DWORD dwMajorVersion;
2435 DWORD dwMinorVersion;
2436 DWORD dwBuildNumber;
2437 DWORD dwPlatformId;
2438 WCHAR szCSDVersion[128];
2439 } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW;
2440 typedef struct _OSVERSIONINFOEXA {
2441 DWORD dwOSVersionInfoSize;
2442 DWORD dwMajorVersion;
2443 DWORD dwMinorVersion;
2444 DWORD dwBuildNumber;
2445 DWORD dwPlatformId;
2446 CHAR szCSDVersion[128];
2447 WORD wServicePackMajor;
2448 WORD wServicePackMinor;
2449 WORD wSuiteMask;
2450 BYTE wProductType;
2451 BYTE wReserved;
2452 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2453 typedef struct _OSVERSIONINFOEXW {
2454 DWORD dwOSVersionInfoSize;
2455 DWORD dwMajorVersion;
2456 DWORD dwMinorVersion;
2457 DWORD dwBuildNumber;
2458 DWORD dwPlatformId;
2459 WCHAR szCSDVersion[128];
2460 WORD wServicePackMajor;
2461 WORD wServicePackMinor;
2462 WORD wSuiteMask;
2463 BYTE wProductType;
2464 BYTE wReserved;
2465 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
2466 #pragma pack(push,2)
2467 typedef struct _IMAGE_VXD_HEADER {
2468 WORD e32_magic;
2469 BYTE e32_border;
2470 BYTE e32_worder;
2471 DWORD e32_level;
2472 WORD e32_cpu;
2473 WORD e32_os;
2474 DWORD e32_ver;
2475 DWORD e32_mflags;
2476 DWORD e32_mpages;
2477 DWORD e32_startobj;
2478 DWORD e32_eip;
2479 DWORD e32_stackobj;
2480 DWORD e32_esp;
2481 DWORD e32_pagesize;
2482 DWORD e32_lastpagesize;
2483 DWORD e32_fixupsize;
2484 DWORD e32_fixupsum;
2485 DWORD e32_ldrsize;
2486 DWORD e32_ldrsum;
2487 DWORD e32_objtab;
2488 DWORD e32_objcnt;
2489 DWORD e32_objmap;
2490 DWORD e32_itermap;
2491 DWORD e32_rsrctab;
2492 DWORD e32_rsrccnt;
2493 DWORD e32_restab;
2494 DWORD e32_enttab;
2495 DWORD e32_dirtab;
2496 DWORD e32_dircnt;
2497 DWORD e32_fpagetab;
2498 DWORD e32_frectab;
2499 DWORD e32_impmod;
2500 DWORD e32_impmodcnt;
2501 DWORD e32_impproc;
2502 DWORD e32_pagesum;
2503 DWORD e32_datapage;
2504 DWORD e32_preload;
2505 DWORD e32_nrestab;
2506 DWORD e32_cbnrestab;
2507 DWORD e32_nressum;
2508 DWORD e32_autodata;
2509 DWORD e32_debuginfo;
2510 DWORD e32_debuglen;
2511 DWORD e32_instpreload;
2512 DWORD e32_instdemand;
2513 DWORD e32_heapsize;
2514 BYTE e32_res3[12];
2515 DWORD e32_winresoff;
2516 DWORD e32_winreslen;
2517 WORD e32_devid;
2518 WORD e32_ddkver;
2519 } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER;
2520 #pragma pack(pop)
2521 #pragma pack(push,4)
2522 typedef struct _IMAGE_FILE_HEADER {
2523 WORD Machine;
2524 WORD NumberOfSections;
2525 DWORD TimeDateStamp;
2526 DWORD PointerToSymbolTable;
2527 DWORD NumberOfSymbols;
2528 WORD SizeOfOptionalHeader;
2529 WORD Characteristics;
2530 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2531 typedef struct _IMAGE_DATA_DIRECTORY {
2532 DWORD VirtualAddress;
2533 DWORD Size;
2534 } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
2535 typedef struct _IMAGE_OPTIONAL_HEADER32 {
2536 WORD Magic;
2537 BYTE MajorLinkerVersion;
2538 BYTE MinorLinkerVersion;
2539 DWORD SizeOfCode;
2540 DWORD SizeOfInitializedData;
2541 DWORD SizeOfUninitializedData;
2542 DWORD AddressOfEntryPoint;
2543 DWORD BaseOfCode;
2544 DWORD BaseOfData;
2545 DWORD ImageBase;
2546 DWORD SectionAlignment;
2547 DWORD FileAlignment;
2548 WORD MajorOperatingSystemVersion;
2549 WORD MinorOperatingSystemVersion;
2550 WORD MajorImageVersion;
2551 WORD MinorImageVersion;
2552 WORD MajorSubsystemVersion;
2553 WORD MinorSubsystemVersion;
2554 DWORD Win32VersionValue;
2555 DWORD SizeOfImage;
2556 DWORD SizeOfHeaders;
2557 DWORD CheckSum;
2558 WORD Subsystem;
2559 WORD DllCharacteristics;
2560 DWORD SizeOfStackReserve;
2561 DWORD SizeOfStackCommit;
2562 DWORD SizeOfHeapReserve;
2563 DWORD SizeOfHeapCommit;
2564 DWORD LoaderFlags;
2565 DWORD NumberOfRvaAndSizes;
2566 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2567 } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
2568 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2569 WORD Magic;
2570 BYTE MajorLinkerVersion;
2571 BYTE MinorLinkerVersion;
2572 DWORD SizeOfCode;
2573 DWORD SizeOfInitializedData;
2574 DWORD SizeOfUninitializedData;
2575 DWORD AddressOfEntryPoint;
2576 DWORD BaseOfCode;
2577 ULONGLONG ImageBase;
2578 DWORD SectionAlignment;
2579 DWORD FileAlignment;
2580 WORD MajorOperatingSystemVersion;
2581 WORD MinorOperatingSystemVersion;
2582 WORD MajorImageVersion;
2583 WORD MinorImageVersion;
2584 WORD MajorSubsystemVersion;
2585 WORD MinorSubsystemVersion;
2586 DWORD Reserved1;
2587 DWORD SizeOfImage;
2588 DWORD SizeOfHeaders;
2589 DWORD CheckSum;
2590 WORD Subsystem;
2591 WORD DllCharacteristics;
2592 ULONGLONG SizeOfStackReserve;
2593 ULONGLONG SizeOfStackCommit;
2594 ULONGLONG SizeOfHeapReserve;
2595 ULONGLONG SizeOfHeapCommit;
2596 DWORD LoaderFlags;
2597 DWORD NumberOfRvaAndSizes;
2598 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2599 } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
2600 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
2601 WORD Magic;
2602 BYTE MajorLinkerVersion;
2603 BYTE MinorLinkerVersion;
2604 DWORD SizeOfCode;
2605 DWORD SizeOfInitializedData;
2606 DWORD SizeOfUninitializedData;
2607 DWORD AddressOfEntryPoint;
2608 DWORD BaseOfCode;
2609 DWORD BaseOfData;
2610 DWORD BaseOfBss;
2611 DWORD GprMask;
2612 DWORD CprMask[4];
2613 DWORD GpValue;
2614 } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER;
2615 #pragma pack(pop)
2616 #pragma pack(push,2)
2617 typedef struct _IMAGE_DOS_HEADER {
2618 WORD e_magic;
2619 WORD e_cblp;
2620 WORD e_cp;
2621 WORD e_crlc;
2622 WORD e_cparhdr;
2623 WORD e_minalloc;
2624 WORD e_maxalloc;
2625 WORD e_ss;
2626 WORD e_sp;
2627 WORD e_csum;
2628 WORD e_ip;
2629 WORD e_cs;
2630 WORD e_lfarlc;
2631 WORD e_ovno;
2632 WORD e_res[4];
2633 WORD e_oemid;
2634 WORD e_oeminfo;
2635 WORD e_res2[10];
2636 LONG e_lfanew;
2637 } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
2638 typedef struct _IMAGE_OS2_HEADER {
2639 WORD ne_magic;
2640 CHAR ne_ver;
2641 CHAR ne_rev;
2642 WORD ne_enttab;
2643 WORD ne_cbenttab;
2644 LONG ne_crc;
2645 WORD ne_flags;
2646 WORD ne_autodata;
2647 WORD ne_heap;
2648 WORD ne_stack;
2649 LONG ne_csip;
2650 LONG ne_sssp;
2651 WORD ne_cseg;
2652 WORD ne_cmod;
2653 WORD ne_cbnrestab;
2654 WORD ne_segtab;
2655 WORD ne_rsrctab;
2656 WORD ne_restab;
2657 WORD ne_modtab;
2658 WORD ne_imptab;
2659 LONG ne_nrestab;
2660 WORD ne_cmovent;
2661 WORD ne_align;
2662 WORD ne_cres;
2663 BYTE ne_exetyp;
2664 BYTE ne_flagsothers;
2665 WORD ne_pretthunks;
2666 WORD ne_psegrefbytes;
2667 WORD ne_swaparea;
2668 WORD ne_expver;
2669 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
2670 #pragma pack(pop)
2671 #pragma pack(push,4)
2672 typedef struct _IMAGE_NT_HEADERS32 {
2673 DWORD Signature;
2674 IMAGE_FILE_HEADER FileHeader;
2675 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
2676 } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32;
2677 typedef struct _IMAGE_NT_HEADERS64 {
2678 DWORD Signature;
2679 IMAGE_FILE_HEADER FileHeader;
2680 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2681 } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64;
2682 #ifdef _WIN64
2683 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2684 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2685 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2686 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2687 #else
2688 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2689 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2690 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2691 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2692 #endif
2693 typedef struct _IMAGE_ROM_HEADERS {
2694 IMAGE_FILE_HEADER FileHeader;
2695 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
2696 } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS;
2697 typedef struct _IMAGE_SECTION_HEADER {
2698 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2699 union {
2700 DWORD PhysicalAddress;
2701 DWORD VirtualSize;
2702 } Misc;
2703 DWORD VirtualAddress;
2704 DWORD SizeOfRawData;
2705 DWORD PointerToRawData;
2706 DWORD PointerToRelocations;
2707 DWORD PointerToLinenumbers;
2708 WORD NumberOfRelocations;
2709 WORD NumberOfLinenumbers;
2710 DWORD Characteristics;
2711 } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
2712 #pragma pack(pop)
2713 #pragma pack(push,2)
2714 typedef struct _IMAGE_SYMBOL {
2715 union {
2716 BYTE ShortName[8];
2717 struct {
2718 DWORD Short;
2719 DWORD Long;
2720 } Name;
2721 PBYTE LongName[2];
2722 } N;
2723 DWORD Value;
2724 SHORT SectionNumber;
2725 WORD Type;
2726 BYTE StorageClass;
2727 BYTE NumberOfAuxSymbols;
2728 } IMAGE_SYMBOL,*PIMAGE_SYMBOL;
2729 typedef union _IMAGE_AUX_SYMBOL {
2730 struct {
2731 DWORD TagIndex;
2732 union {
2733 struct {
2734 WORD Linenumber;
2735 WORD Size;
2736 } LnSz;
2737 DWORD TotalSize;
2738 } Misc;
2739 union {
2740 struct {
2741 DWORD PointerToLinenumber;
2742 DWORD PointerToNextFunction;
2743 } Function;
2744 struct {
2745 WORD Dimension[4];
2746 } Array;
2747 } FcnAry;
2748 WORD TvIndex;
2749 } Sym;
2750 struct {
2751 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2752 } File;
2753 struct {
2754 DWORD Length;
2755 WORD NumberOfRelocations;
2756 WORD NumberOfLinenumbers;
2757 DWORD CheckSum;
2758 SHORT Number;
2759 BYTE Selection;
2760 } Section;
2761 } IMAGE_AUX_SYMBOL,*PIMAGE_AUX_SYMBOL;
2762 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2763 DWORD NumberOfSymbols;
2764 DWORD LvaToFirstSymbol;
2765 DWORD NumberOfLinenumbers;
2766 DWORD LvaToFirstLinenumber;
2767 DWORD RvaToFirstByteOfCode;
2768 DWORD RvaToLastByteOfCode;
2769 DWORD RvaToFirstByteOfData;
2770 DWORD RvaToLastByteOfData;
2771 } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER;
2772 typedef struct _IMAGE_RELOCATION {
2773 _ANONYMOUS_UNION union {
2774 DWORD VirtualAddress;
2775 DWORD RelocCount;
2776 } DUMMYUNIONNAME;
2777 DWORD SymbolTableIndex;
2778 WORD Type;
2779 } IMAGE_RELOCATION,*PIMAGE_RELOCATION;
2780 #pragma pack(pop)
2781 #pragma pack(push,4)
2782 typedef struct _IMAGE_BASE_RELOCATION {
2783 DWORD VirtualAddress;
2784 DWORD SizeOfBlock;
2785 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2786 #pragma pack(pop)
2787 #pragma pack(push,2)
2788 typedef struct _IMAGE_LINENUMBER {
2789 union {
2790 DWORD SymbolTableIndex;
2791 DWORD VirtualAddress;
2792 } Type;
2793 WORD Linenumber;
2794 } IMAGE_LINENUMBER,*PIMAGE_LINENUMBER;
2795 #pragma pack(pop)
2796 #pragma pack(push,4)
2797 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
2798 BYTE Name[16];
2799 BYTE Date[12];
2800 BYTE UserID[6];
2801 BYTE GroupID[6];
2802 BYTE Mode[8];
2803 BYTE Size[10];
2804 BYTE EndHeader[2];
2805 } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER;
2806 typedef struct _IMAGE_EXPORT_DIRECTORY {
2807 DWORD Characteristics;
2808 DWORD TimeDateStamp;
2809 WORD MajorVersion;
2810 WORD MinorVersion;
2811 DWORD Name;
2812 DWORD Base;
2813 DWORD NumberOfFunctions;
2814 DWORD NumberOfNames;
2815 DWORD AddressOfFunctions;
2816 DWORD AddressOfNames;
2817 DWORD AddressOfNameOrdinals;
2818 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2819 typedef struct _IMAGE_IMPORT_BY_NAME {
2820 WORD Hint;
2821 BYTE Name[1];
2822 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2823 typedef struct _IMAGE_THUNK_DATA {
2824 union {
2825 PBYTE ForwarderString;
2826 PDWORD Function;
2827 DWORD Ordinal;
2828 PIMAGE_IMPORT_BY_NAME AddressOfData;
2829 } u1;
2830 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
2831 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2832 _ANONYMOUS_UNION union {
2833 DWORD Characteristics;
2834 PIMAGE_THUNK_DATA OriginalFirstThunk;
2835 } DUMMYUNIONNAME;
2836 DWORD TimeDateStamp;
2837 DWORD ForwarderChain;
2838 DWORD Name;
2839 PIMAGE_THUNK_DATA FirstThunk;
2840 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2841 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR {
2842 DWORD TimeDateStamp;
2843 WORD OffsetModuleName;
2844 WORD NumberOfModuleForwarderRefs;
2845 } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2846 typedef struct _IMAGE_BOUND_FORWARDER_REF {
2847 DWORD TimeDateStamp;
2848 WORD OffsetModuleName;
2849 WORD Reserved;
2850 } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF;
2851 typedef void(NTAPI *PIMAGE_TLS_CALLBACK)(PVOID,DWORD,PVOID);
2852 typedef struct _IMAGE_TLS_DIRECTORY {
2853 DWORD StartAddressOfRawData;
2854 DWORD EndAddressOfRawData;
2855 PDWORD AddressOfIndex;
2856 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2857 DWORD SizeOfZeroFill;
2858 DWORD Characteristics;
2859 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2860 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2861 DWORD Characteristics;
2862 DWORD TimeDateStamp;
2863 WORD MajorVersion;
2864 WORD MinorVersion;
2865 WORD NumberOfNamedEntries;
2866 WORD NumberOfIdEntries;
2867 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2868 _ANONYMOUS_STRUCT typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2869 _ANONYMOUS_UNION union {
2870 _ANONYMOUS_STRUCT struct {
2871 DWORD NameOffset:31;
2872 DWORD NameIsString:1;
2873 }DUMMYSTRUCTNAME;
2874 DWORD Name;
2875 WORD Id;
2876 } DUMMYUNIONNAME;
2877 _ANONYMOUS_UNION union {
2878 DWORD OffsetToData;
2879 _ANONYMOUS_STRUCT struct {
2880 DWORD OffsetToDirectory:31;
2881 DWORD DataIsDirectory:1;
2882 } DUMMYSTRUCTNAME2;
2883 } DUMMYUNIONNAME2;
2884 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2885 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2886 WORD Length;
2887 CHAR NameString[1];
2888 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2889 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2890 WORD Length;
2891 WCHAR NameString[1];
2892 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2893 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2894 DWORD OffsetToData;
2895 DWORD Size;
2896 DWORD CodePage;
2897 DWORD Reserved;
2898 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2899 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2900 DWORD Size;
2901 DWORD TimeDateStamp;
2902 WORD MajorVersion;
2903 WORD MinorVersion;
2904 DWORD GlobalFlagsClear;
2905 DWORD GlobalFlagsSet;
2906 DWORD CriticalSectionDefaultTimeout;
2907 DWORD DeCommitFreeBlockThreshold;
2908 DWORD DeCommitTotalFreeThreshold;
2909 DWORD LockPrefixTable;
2910 DWORD MaximumAllocationSize;
2911 DWORD VirtualMemoryThreshold;
2912 DWORD ProcessHeapFlags;
2913 DWORD ProcessAffinityMask;
2914 WORD CSDVersion;
2915 WORD Reserved1;
2916 DWORD EditList;
2917 DWORD SecurityCookie;
2918 DWORD SEHandlerTable;
2919 DWORD SEHandlerCount;
2920 } IMAGE_LOAD_CONFIG_DIRECTORY,*PIMAGE_LOAD_CONFIG_DIRECTORY;
2921 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
2922 DWORD BeginAddress;
2923 DWORD EndAddress;
2924 PVOID ExceptionHandler;
2925 PVOID HandlerData;
2926 DWORD PrologEndAddress;
2927 } IMAGE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_RUNTIME_FUNCTION_ENTRY;
2928 typedef struct _IMAGE_DEBUG_DIRECTORY {
2929 DWORD Characteristics;
2930 DWORD TimeDateStamp;
2931 WORD MajorVersion;
2932 WORD MinorVersion;
2933 DWORD Type;
2934 DWORD SizeOfData;
2935 DWORD AddressOfRawData;
2936 DWORD PointerToRawData;
2937 } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY;
2938 typedef struct _FPO_DATA {
2939 DWORD ulOffStart;
2940 DWORD cbProcSize;
2941 DWORD cdwLocals;
2942 WORD cdwParams;
2943 WORD cbProlog:8;
2944 WORD cbRegs:3;
2945 WORD fHasSEH:1;
2946 WORD fUseBP:1;
2947 WORD reserved:1;
2948 WORD cbFrame:2;
2949 } FPO_DATA,*PFPO_DATA;
2950 typedef struct _IMAGE_DEBUG_MISC {
2951 DWORD DataType;
2952 DWORD Length;
2953 BOOLEAN Unicode;
2954 BYTE Reserved[3];
2955 BYTE Data[1];
2956 } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC;
2957 typedef struct _IMAGE_FUNCTION_ENTRY {
2958 DWORD StartingAddress;
2959 DWORD EndingAddress;
2960 DWORD EndOfPrologue;
2961 } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY;
2962 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
2963 WORD Signature;
2964 WORD Flags;
2965 WORD Machine;
2966 WORD Characteristics;
2967 DWORD TimeDateStamp;
2968 DWORD CheckSum;
2969 DWORD ImageBase;
2970 DWORD SizeOfImage;
2971 DWORD NumberOfSections;
2972 DWORD ExportedNamesSize;
2973 DWORD DebugDirectorySize;
2974 DWORD SectionAlignment;
2975 DWORD Reserved[2];
2976 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
2977 #pragma pack(pop)
2978 typedef enum _CM_SERVICE_NODE_TYPE {
2979 DriverType=SERVICE_KERNEL_DRIVER,
2980 FileSystemType=SERVICE_FILE_SYSTEM_DRIVER,
2981 Win32ServiceOwnProcess=SERVICE_WIN32_OWN_PROCESS,
2982 Win32ServiceShareProcess=SERVICE_WIN32_SHARE_PROCESS,
2983 AdapterType=SERVICE_ADAPTER,
2984 RecognizerType=SERVICE_RECOGNIZER_DRIVER
2985 } SERVICE_NODE_TYPE;
2986 typedef enum _CM_SERVICE_LOAD_TYPE {
2987 BootLoad=SERVICE_BOOT_START,
2988 SystemLoad=SERVICE_SYSTEM_START,
2989 AutoLoad=SERVICE_AUTO_START,
2990 DemandLoad=SERVICE_DEMAND_START,
2991 DisableLoad=SERVICE_DISABLED
2992 } SERVICE_LOAD_TYPE;
2993 typedef enum _CM_ERROR_CONTROL_TYPE {
2994 IgnoreError=SERVICE_ERROR_IGNORE,
2995 NormalError=SERVICE_ERROR_NORMAL,
2996 SevereError=SERVICE_ERROR_SEVERE,
2997 CriticalError=SERVICE_ERROR_CRITICAL
2998 } SERVICE_ERROR_TYPE;
2999 typedef struct _NT_TIB {
3000 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
3001 PVOID StackBase;
3002 PVOID StackLimit;
3003 PVOID SubSystemTib;
3004 _ANONYMOUS_UNION union {
3005 PVOID FiberData;
3006 DWORD Version;
3007 } DUMMYUNIONNAME;
3008 PVOID ArbitraryUserPointer;
3009 struct _NT_TIB *Self;
3010 } NT_TIB,*PNT_TIB;
3011 typedef struct _REPARSE_DATA_BUFFER {
3012 DWORD ReparseTag;
3013 WORD ReparseDataLength;
3014 WORD Reserved;
3015 _ANONYMOUS_UNION union {
3016 struct {
3017 WORD SubstituteNameOffset;
3018 WORD SubstituteNameLength;
3019 WORD PrintNameOffset;
3020 WORD PrintNameLength;
3021 WCHAR PathBuffer[1];
3022 } SymbolicLinkReparseBuffer;
3023 struct {
3024 WORD SubstituteNameOffset;
3025 WORD SubstituteNameLength;
3026 WORD PrintNameOffset;
3027 WORD PrintNameLength;
3028 WCHAR PathBuffer[1];
3029 } MountPointReparseBuffer;
3030 struct {
3031 BYTE DataBuffer[1];
3032 } GenericReparseBuffer;
3033 } DUMMYUNIONNAME;
3034 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
3035 typedef struct _REPARSE_GUID_DATA_BUFFER {
3036 DWORD ReparseTag;
3037 WORD ReparseDataLength;
3038 WORD Reserved;
3039 GUID ReparseGuid;
3040 struct {
3041 BYTE DataBuffer[1];
3042 } GenericReparseBuffer;
3043 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;
3044 typedef struct _REPARSE_POINT_INFORMATION {
3045 WORD ReparseDataLength;
3046 WORD UnparsedNameLength;
3047 } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
3048
3049 typedef union _FILE_SEGMENT_ELEMENT {
3050 PVOID64 Buffer;
3051 ULONGLONG Alignment;
3052 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3053
3054 /* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
3055 #define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
3056 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
3057 #define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
3058 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
3059 #define JOB_OBJECT_LIMIT_AFFINITY 0x0010
3060 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
3061 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
3062 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
3063 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
3064 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
3065 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
3066 #define JOB_OBJECT_BREAKAWAY_OK 0x0800
3067 #define JOB_OBJECT_SILENT_BREAKAWAY 0x1000
3068
3069 /* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
3070 #define JOB_OBJECT_UILIMIT_HANDLES 0x0001
3071 #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
3072 #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
3073 #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
3074 #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
3075 #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
3076 #define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
3077 #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
3078
3079 /* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
3080 #define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
3081 #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
3082 #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
3083 #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
3084
3085 /* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
3086 #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
3087 #define JOB_OBJECT_POST_AT_END_OF_JOB 1
3088
3089 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
3090 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
3091 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
3092 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
3093 #define JOB_OBJECT_MSG_NEW_PROCESS 6
3094 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
3095 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
3096 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
3097 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
3098
3099 #define JOB_OBJECT_ASSIGN_PROCESS 1
3100 #define JOB_OBJECT_SET_ATTRIBUTES 2
3101 #define JOB_OBJECT_QUERY 4
3102 #define JOB_OBJECT_TERMINATE 8
3103 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 16
3104 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
3105
3106 /* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
3107 #ifndef __NTDDK_H
3108 typedef enum _JOBOBJECTINFOCLASS {
3109 JobObjectBasicAccountingInformation = 1,
3110 JobObjectBasicLimitInformation,
3111 JobObjectBasicProcessIdList,
3112 JobObjectBasicUIRestrictions,
3113 JobObjectSecurityLimitInformation,
3114 JobObjectEndOfJobTimeInformation,
3115 JobObjectAssociateCompletionPortInformation,
3116 JobObjectBasicAndIoAccountingInformation,
3117 JobObjectExtendedLimitInformation,
3118 JobObjectJobSetInformation,
3119 MaxJobObjectInfoClass
3120 } JOBOBJECTINFOCLASS;
3121 #endif
3122
3123 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
3124 LARGE_INTEGER TotalUserTime;
3125 LARGE_INTEGER TotalKernelTime;
3126 LARGE_INTEGER ThisPeriodTotalUserTime;
3127 LARGE_INTEGER ThisPeriodTotalKernelTime;
3128 DWORD TotalPageFaultCount;
3129 DWORD TotalProcesses;
3130 DWORD ActiveProcesses;
3131 DWORD TotalTerminatedProcesses;
3132 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3133 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
3134 LARGE_INTEGER PerProcessUserTimeLimit;
3135 LARGE_INTEGER PerJobUserTimeLimit;
3136 DWORD LimitFlags;
3137 SIZE_T MinimumWorkingSetSize;
3138 SIZE_T MaximumWorkingSetSize;
3139 DWORD ActiveProcessLimit;
3140 ULONG_PTR Affinity;
3141 DWORD PriorityClass;
3142 DWORD SchedulingClass;
3143 } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION;
3144 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
3145 DWORD NumberOfAssignedProcesses;
3146 DWORD NumberOfProcessIdsInList;
3147 ULONG_PTR ProcessIdList[1];
3148 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
3149 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
3150 DWORD UIRestrictionsClass;
3151 } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
3152 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
3153 DWORD SecurityLimitFlags;
3154 HANDLE JobToken;
3155 PTOKEN_GROUPS SidsToDisable;
3156 PTOKEN_PRIVILEGES PrivilegesToDelete;
3157 PTOKEN_GROUPS RestrictedSids;
3158 } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
3159 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
3160 DWORD EndOfJobTimeAction;
3161 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3162 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
3163 PVOID CompletionKey;
3164 HANDLE CompletionPort;
3165 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3166 typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
3167 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
3168 IO_COUNTERS IoInfo;
3169 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3170 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
3171 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
3172 IO_COUNTERS IoInfo;
3173 SIZE_T ProcessMemoryLimit;
3174 SIZE_T JobMemoryLimit;
3175 SIZE_T PeakProcessMemoryUsed;
3176 SIZE_T PeakJobMemoryUsed;
3177 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3178 typedef struct _JOBOBJECT_JOBSET_INFORMATION {
3179 DWORD MemberLevel;
3180 } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION;
3181
3182 /* Fixme: Making these defines conditional on WINVER will break ddk includes */
3183 #if 1 /* (WINVER >= 0x0500) */
3184
3185 #define ES_SYSTEM_REQUIRED 0x00000001
3186 #define ES_DISPLAY_REQUIRED 0x00000002
3187 #define ES_USER_PRESENT 0x00000004
3188 #define ES_CONTINUOUS 0x80000000
3189
3190 typedef enum _LATENCY_TIME {
3191 LT_DONT_CARE,
3192 LT_LOWEST_LATENCY
3193 } LATENCY_TIME, *PLATENCY_TIME;
3194
3195 typedef enum _SYSTEM_POWER_STATE {
3196 PowerSystemUnspecified,
3197 PowerSystemWorking,
3198 PowerSystemSleeping1,
3199 PowerSystemSleeping2,
3200 PowerSystemSleeping3,
3201 PowerSystemHibernate,
3202 PowerSystemShutdown,
3203 PowerSystemMaximum
3204 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
3205 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
3206
3207 typedef enum {
3208 PowerActionNone,
3209 PowerActionReserved,
3210 PowerActionSleep,
3211 PowerActionHibernate,
3212 PowerActionShutdown,
3213 PowerActionShutdownReset,
3214 PowerActionShutdownOff,
3215 PowerActionWarmEject
3216 } POWER_ACTION, *PPOWER_ACTION;
3217
3218 typedef enum _DEVICE_POWER_STATE {
3219 PowerDeviceUnspecified,
3220 PowerDeviceD0,
3221 PowerDeviceD1,
3222 PowerDeviceD2,
3223 PowerDeviceD3,
3224 PowerDeviceMaximum
3225 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3226
3227 typedef struct {
3228 DWORD Granularity;
3229 DWORD Capacity;
3230 } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
3231
3232 typedef struct _POWER_ACTION_POLICY {
3233 POWER_ACTION Action;
3234 ULONG Flags;
3235 ULONG EventCode;
3236 } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
3237
3238 /* POWER_ACTION_POLICY.Flags constants */
3239 #define POWER_ACTION_QUERY_ALLOWED 0x00000001
3240 #define POWER_ACTION_UI_ALLOWED 0x00000002
3241 #define POWER_ACTION_OVERRIDE_APPS 0x00000004
3242 #define POWER_ACTION_LIGHTEST_FIRST 0x10000000
3243 #define POWER_ACTION_LOCK_CONSOLE 0x20000000
3244 #define POWER_ACTION_DISABLE_WAKES 0x40000000
3245 #define POWER_ACTION_CRITICAL 0x80000000
3246
3247 /* POWER_ACTION_POLICY.EventCode constants */
3248 #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
3249 #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
3250 #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
3251 #define POWER_USER_NOTIFY_BUTTON 0x00000008
3252 #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
3253 #define POWER_FORCE_TRIGGER_RESET 0x80000000
3254
3255 #define DISCHARGE_POLICY_CRITICAL 0
3256 #define DISCHARGE_POLICY_LOW 1
3257 #define NUM_DISCHARGE_POLICIES 4
3258
3259 #define PO_THROTTLE_NONE 0
3260 #define PO_THROTTLE_CONSTANT 1
3261 #define PO_THROTTLE_DEGRADE 2
3262 #define PO_THROTTLE_ADAPTIVE 3
3263 #define PO_THROTTLE_MAXIMUM 4
3264
3265 typedef struct _SYSTEM_POWER_LEVEL {
3266 BOOLEAN Enable;
3267 UCHAR Spare[3];
3268 ULONG BatteryLevel;
3269 POWER_ACTION_POLICY PowerPolicy;
3270 SYSTEM_POWER_STATE MinSystemState;
3271 } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
3272
3273 typedef struct _SYSTEM_POWER_POLICY {
3274 ULONG Revision;
3275 POWER_ACTION_POLICY PowerButton;
3276 POWER_ACTION_POLICY SleepButton;
3277 POWER_ACTION_POLICY LidClose;
3278 SYSTEM_POWER_STATE LidOpenWake;
3279 ULONG Reserved;
3280 POWER_ACTION_POLICY Idle;
3281 ULONG IdleTimeout;
3282 UCHAR IdleSensitivity;
3283 UCHAR DynamicThrottle;
3284 UCHAR Spare2[2];
3285 SYSTEM_POWER_STATE MinSleep;
3286 SYSTEM_POWER_STATE MaxSleep;
3287 SYSTEM_POWER_STATE ReducedLatencySleep;
3288 ULONG WinLogonFlags;
3289 ULONG Spare3;
3290 ULONG DozeS4Timeout;
3291 ULONG BroadcastCapacityResolution;
3292 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
3293 ULONG VideoTimeout;
3294 BOOLEAN VideoDimDisplay;
3295 ULONG VideoReserved[3];
3296 ULONG SpindownTimeout;
3297 BOOLEAN OptimizeForPower;
3298 UCHAR FanThrottleTolerance;
3299 UCHAR ForcedThrottle;
3300 UCHAR MinThrottle;
3301 POWER_ACTION_POLICY OverThrottled;
3302 } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
3303
3304 typedef struct _SYSTEM_POWER_CAPABILITIES {
3305 BOOLEAN PowerButtonPresent;
3306 BOOLEAN SleepButtonPresent;
3307 BOOLEAN LidPresent;
3308 BOOLEAN SystemS1;
3309 BOOLEAN SystemS2;
3310 BOOLEAN SystemS3;
3311 BOOLEAN SystemS4;
3312 BOOLEAN SystemS5;
3313 BOOLEAN HiberFilePresent;
3314 BOOLEAN FullWake;
3315 BOOLEAN VideoDimPresent;
3316 BOOLEAN ApmPresent;
3317 BOOLEAN UpsPresent;
3318 BOOLEAN ThermalControl;
3319 BOOLEAN ProcessorThrottle;
3320 UCHAR ProcessorMinThrottle;
3321 UCHAR ProcessorMaxThrottle;
3322 UCHAR spare2[4];
3323 BOOLEAN DiskSpinDown;
3324 UCHAR spare3[8];
3325 BOOLEAN SystemBatteriesPresent;
3326 BOOLEAN BatteriesAreShortTerm;
3327 BATTERY_REPORTING_SCALE BatteryScale[3];
3328 SYSTEM_POWER_STATE AcOnLineWake;
3329 SYSTEM_POWER_STATE SoftLidWake;
3330 SYSTEM_POWER_STATE RtcWake;
3331 SYSTEM_POWER_STATE MinDeviceWakeState;
3332 SYSTEM_POWER_STATE DefaultLowLatencyWake;
3333 } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
3334
3335 typedef struct _SYSTEM_BATTERY_STATE {
3336 BOOLEAN AcOnLine;
3337 BOOLEAN BatteryPresent;
3338 BOOLEAN Charging;
3339 BOOLEAN Discharging;
3340 BOOLEAN Spare1[4];
3341 ULONG MaxCapacity;
3342 ULONG RemainingCapacity;
3343 ULONG Rate;
3344 ULONG EstimatedTime;
3345 ULONG DefaultAlert1;
3346 ULONG DefaultAlert2;
3347 } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
3348
3349 typedef DWORD EXECUTION_STATE;
3350 typedef enum _POWER_INFORMATION_LEVEL {
3351 SystemPowerPolicyAc,
3352 SystemPowerPolicyDc,
3353 VerifySystemPolicyAc,
3354 VerifySystemPolicyDc,
3355 SystemPowerCapabilities,
3356 SystemBatteryState,
3357 SystemPowerStateHandler,
3358 ProcessorStateHandler,
3359 SystemPowerPolicyCurrent,
3360 AdministratorPowerPolicy,
3361 SystemReserveHiberFile,
3362 ProcessorInformation,
3363 SystemPowerInformation,
3364 ProcessorStateHandler2,
3365 LastWakeTime,
3366 LastSleepTime,
3367 SystemExecutionState,
3368 SystemPowerStateNotifyHandler,
3369 ProcessorPowerPolicyAc,
3370 ProcessorPowerPolicyDc,
3371 VerifyProcessorPowerPolicyAc,
3372 VerifyProcessorPowerPolicyDc,
3373 ProcessorPowerPolicyCurrent
3374 } POWER_INFORMATION_LEVEL;
3375
3376 #if (_WIN32_WINNT >= 0x0500)
3377 typedef LONG (WINAPI *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS);
3378 #endif
3379 #if 1 /* (WIN32_WINNT >= 0x0500) */
3380 typedef struct _SYSTEM_POWER_INFORMATION {
3381 ULONG MaxIdlenessAllowed;
3382 ULONG Idleness;
3383 ULONG TimeRemaining;
3384 UCHAR CoolingMode;
3385 } SYSTEM_POWER_INFORMATION,*PSYSTEM_POWER_INFORMATION;
3386 #endif
3387
3388 #if (_WIN32_WINNT >= 0x0501)
3389 typedef enum _HEAP_INFORMATION_CLASS {
3390 HeapCompatibilityInformation
3391 } HEAP_INFORMATION_CLASS;
3392 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
3393 ActivationContextBasicInformation = 1,
3394 ActivationContextDetailedInformation,
3395 AssemblyDetailedInformationInActivationContext,
3396 FileInformationInAssemblyOfAssemblyInActivationContext
3397 } ACTIVATION_CONTEXT_INFO_CLASS;
3398 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
3399 DWORD ulFlags;
3400 DWORD ulEncodedAssemblyIdentityLength;
3401 DWORD ulManifestPathType;
3402 DWORD ulManifestPathLength;
3403 LARGE_INTEGER liManifestLastWriteTime;
3404 DWORD ulPolicyPathType;
3405 DWORD ulPolicyPathLength;
3406 LARGE_INTEGER liPolicyLastWriteTime;
3407 DWORD ulMetadataSatelliteRosterIndex;
3408 DWORD ulManifestVersionMajor;
3409 DWORD ulManifestVersionMinor;
3410 DWORD ulPolicyVersionMajor;
3411 DWORD ulPolicyVersionMinor;
3412 DWORD ulAssemblyDirectoryNameLength;
3413 PCWSTR lpAssemblyEncodedAssemblyIdentity;
3414 PCWSTR lpAssemblyManifestPath;
3415 PCWSTR lpAssemblyPolicyPath;
3416 PCWSTR lpAssemblyDirectoryName;
3417 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3418 typedef const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3419 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
3420 DWORD dwFlags;
3421 DWORD ulFormatVersion;
3422 DWORD ulAssemblyCount;
3423 DWORD ulRootManifestPathType;
3424 DWORD ulRootManifestPathChars;
3425 DWORD ulRootConfigurationPathType;
3426 DWORD ulRootConfigurationPathChars;
3427 DWORD ulAppDirPathType;
3428 DWORD ulAppDirPathChars;
3429 PCWSTR lpRootManifestPath;
3430 PCWSTR lpRootConfigurationPath;
3431 PCWSTR lpAppDirPath;
3432 } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION;
3433 typedef const ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION;
3434 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
3435 ULONG ulAssemblyIndex;
3436 ULONG ulFileIndexInAssembly;
3437 } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX;
3438 typedef const ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
3439 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
3440 DWORD ulFlags;
3441 DWORD ulFilenameLength;
3442 DWORD ulPathLength;
3443 PCWSTR lpFileName;
3444 PCWSTR lpFilePath;
3445 } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION;
3446 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
3447 #endif /* (WIN32_WINNT >= 0x0501) */
3448
3449 typedef struct _PROCESSOR_POWER_POLICY_INFO {
3450 ULONG TimeCheck;
3451 ULONG DemoteLimit;
3452 ULONG PromoteLimit;
3453 UCHAR DemotePercent;
3454 UCHAR PromotePercent;
3455 UCHAR Spare[2];
3456 ULONG AllowDemotion : 1;
3457 ULONG AllowPromotion : 1;
3458 ULONG Reserved : 30;
3459 } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
3460 typedef struct _PROCESSOR_POWER_POLICY {
3461 ULONG Revision;
3462 UCHAR DynamicThrottle;
3463 UCHAR Spare[3];
3464 ULONG Reserved;
3465 ULONG PolicyCount;
3466 PROCESSOR_POWER_POLICY_INFO Policy[3];
3467 } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
3468 typedef struct _ADMINISTRATOR_POWER_POLICY {
3469 SYSTEM_POWER_STATE MinSleep;
3470 SYSTEM_POWER_STATE MaxSleep;
3471 ULONG MinVideoTimeout;
3472 ULONG MaxVideoTimeout;
3473 ULONG MinSpindownTimeout;
3474 ULONG MaxSpindownTimeout;
3475 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
3476 #endif /* WINVER >= 0x0500 */
3477
3478 typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN);
3479
3480 #ifdef UNICODE
3481 typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3482 typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3483 #else
3484 typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3485 typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3486 #endif
3487
3488 #if (WIN32_WINNT >= 0x0500)
3489 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
3490 #endif
3491
3492 SIZE_T
3493 STDCALL
3494 RtlCompareMemory (
3495 const VOID *Source1,
3496 const VOID *Source2,
3497 SIZE_T Length
3498 );
3499
3500 #define RtlMoveMemory memmove
3501 #define RtlCopyMemory memcpy
3502 #define RtlFillMemory(d,l,f) memset((d), (f), (l))
3503 #define RtlZeroMemory(d,l) RtlFillMemory((d),(l),0)
3504
3505 typedef struct _OBJECT_TYPE_LIST {
3506 WORD Level;
3507 WORD Sbz;
3508 GUID *ObjectType;
3509 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
3510
3511 #if defined(__GNUC__)
3512
3513 static __inline__ PVOID GetCurrentFiber(void)
3514 {
3515 void* ret;
3516 __asm__ __volatile__ (
3517 "movl %%fs:0x10,%0"
3518 : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
3519 );
3520 return ret;
3521 }
3522
3523 static __inline__ struct _TEB * NtCurrentTeb(void)
3524 {
3525 struct _TEB *ret;
3526
3527 __asm__ __volatile__ (
3528 "movl %%fs:0x18, %0\n"
3529 : "=r" (ret)
3530 : /* no inputs */
3531 );
3532
3533 return ret;
3534 }
3535
3536 #elif defined(__WATCOMC__)
3537
3538 extern PVOID GetCurrentFiber(void);
3539 #pragma aux GetCurrentFiber = \
3540 "mov eax, dword ptr fs:0x10" \
3541 value [eax] \
3542 modify [eax];
3543
3544 extern struct _TEB * NtCurrentTeb(void);
3545 #pragma aux NtCurrentTeb = \
3546 "mov eax, dword ptr fs:0x18" \
3547 value [eax] \
3548 modify [eax];
3549
3550 #elif defined(_MSC_VER)
3551
3552 static __inline PVOID GetCurrentFiber(void)
3553 {
3554 PVOID p;
3555 __asm mov eax, fs:[10h]
3556 __asm mov [p], eax
3557 return p;
3558 }
3559
3560 static __inline struct _TEB * NtCurrentTeb(void)
3561 {
3562 struct _TEB *p;
3563 __asm mov eax, fs:[18h]
3564 __asm mov [p], eax
3565 return p;
3566 }
3567
3568 #endif /* __GNUC__/__WATCOMC__/_MSC_VER */
3569
3570 static __inline PVOID GetFiberData(void)
3571 {
3572 return *((PVOID *)GetCurrentFiber());
3573 }
3574
3575 #endif /* RC_INVOKED */
3576
3577 #ifdef __cplusplus
3578 }
3579 #endif
3580 #endif