Mercurial > games > semicongine
comparison fuhtark_test/include/ddk/ntdef.h @ 1500:91c8c3b7cbf0
add: futhark tests for generating vulkan api
| author | sam <sam@basx.dev> |
|---|---|
| date | Wed, 26 Nov 2025 21:36:48 +0700 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1499:1f58458b7ef7 | 1500:91c8c3b7cbf0 |
|---|---|
| 1 #ifndef _NTDEF_H | |
| 2 #define _NTDEF_H | |
| 3 | |
| 4 // | |
| 5 // Dependencies | |
| 6 // | |
| 7 #include <ctype.h> | |
| 8 #include <basetsd.h> | |
| 9 #include <excpt.h> | |
| 10 #include <sdkddkver.h> | |
| 11 | |
| 12 // FIXME: Should we include these here? | |
| 13 #include <stdarg.h> | |
| 14 #include <string.h> | |
| 15 | |
| 16 | |
| 17 typedef unsigned long POINTER_64; // FIXME! HACK!!! | |
| 18 | |
| 19 | |
| 20 | |
| 21 // | |
| 22 // Pseudo Modifiers for Input Parameters | |
| 23 // | |
| 24 #ifndef IN | |
| 25 #define IN | |
| 26 #endif | |
| 27 | |
| 28 #ifndef OUT | |
| 29 #define OUT | |
| 30 #endif | |
| 31 | |
| 32 #ifndef OPTIONAL | |
| 33 #define OPTIONAL | |
| 34 #endif | |
| 35 | |
| 36 #ifndef NOTHING | |
| 37 #define NOTHING | |
| 38 #endif | |
| 39 | |
| 40 #ifndef CRITICAL | |
| 41 #define CRITICAL | |
| 42 #endif | |
| 43 | |
| 44 #ifndef FAR | |
| 45 #define FAR | |
| 46 #endif | |
| 47 | |
| 48 | |
| 49 // | |
| 50 // Defines the "size" of an any-size array | |
| 51 // | |
| 52 #ifndef ANYSIZE_ARRAY | |
| 53 #define ANYSIZE_ARRAY 1 | |
| 54 #endif | |
| 55 | |
| 56 // | |
| 57 // Constant modifier | |
| 58 // | |
| 59 #ifndef CONST | |
| 60 #define CONST const | |
| 61 #endif | |
| 62 | |
| 63 // | |
| 64 // TRUE/FALSE | |
| 65 // | |
| 66 #define FALSE 0 | |
| 67 #define TRUE 1 | |
| 68 | |
| 69 // | |
| 70 // NULL/NULL64 | |
| 71 // | |
| 72 #ifndef NULL | |
| 73 #ifdef __cplusplus | |
| 74 #define NULL 0 | |
| 75 #define NULL64 0 | |
| 76 #else | |
| 77 #define NULL ((void *)0) | |
| 78 #define NULL64 ((void * POINTER_64)0) | |
| 79 #endif | |
| 80 #endif // NULL | |
| 81 | |
| 82 | |
| 83 // | |
| 84 // FIXME | |
| 85 // We should use the -fms-extensions compiler flag for gcc, | |
| 86 // and clean up the mess. | |
| 87 // | |
| 88 #ifndef NONAMELESSUNION | |
| 89 #ifdef __GNUC__ | |
| 90 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | |
| 91 #define _ANONYMOUS_UNION __extension__ | |
| 92 #define _ANONYMOUS_STRUCT __extension__ | |
| 93 #else | |
| 94 #if defined(__cplusplus) | |
| 95 #define _ANONYMOUS_UNION __extension__ | |
| 96 #endif /* __cplusplus */ | |
| 97 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */ | |
| 98 #elif defined(__WATCOMC__) || defined(_MSC_VER) | |
| 99 #define _ANONYMOUS_UNION | |
| 100 #define _ANONYMOUS_STRUCT | |
| 101 #endif /* __GNUC__/__WATCOMC__ */ | |
| 102 #endif /* NONAMELESSUNION */ | |
| 103 | |
| 104 #ifndef _ANONYMOUS_UNION | |
| 105 #define _ANONYMOUS_UNION | |
| 106 #define _UNION_NAME(x) x | |
| 107 #define DUMMYUNIONNAME u | |
| 108 #define DUMMYUNIONNAME2 u2 | |
| 109 #define DUMMYUNIONNAME3 u3 | |
| 110 #define DUMMYUNIONNAME4 u4 | |
| 111 #define DUMMYUNIONNAME5 u5 | |
| 112 #define DUMMYUNIONNAME6 u6 | |
| 113 #define DUMMYUNIONNAME7 u7 | |
| 114 #define DUMMYUNIONNAME8 u8 | |
| 115 #else | |
| 116 #define _UNION_NAME(x) | |
| 117 #define DUMMYUNIONNAME | |
| 118 #define DUMMYUNIONNAME2 | |
| 119 #define DUMMYUNIONNAME3 | |
| 120 #define DUMMYUNIONNAME4 | |
| 121 #define DUMMYUNIONNAME5 | |
| 122 #define DUMMYUNIONNAME6 | |
| 123 #define DUMMYUNIONNAME7 | |
| 124 #define DUMMYUNIONNAME8 | |
| 125 #endif | |
| 126 | |
| 127 #ifndef _ANONYMOUS_STRUCT | |
| 128 #define _ANONYMOUS_STRUCT | |
| 129 #define _STRUCT_NAME(x) x | |
| 130 #define DUMMYSTRUCTNAME s | |
| 131 #define DUMMYSTRUCTNAME2 s2 | |
| 132 #define DUMMYSTRUCTNAME3 s3 | |
| 133 #else | |
| 134 #define _STRUCT_NAME(x) | |
| 135 #define DUMMYSTRUCTNAME | |
| 136 #define DUMMYSTRUCTNAME2 | |
| 137 #define DUMMYSTRUCTNAME3 | |
| 138 #endif | |
| 139 | |
| 140 | |
| 141 | |
| 142 // FIXME | |
| 143 #undef UNALIGNED | |
| 144 #define UNALIGNED | |
| 145 #define RESTRICTED_POINTER | |
| 146 | |
| 147 // | |
| 148 // Returns the base address of a structure from a structure member | |
| 149 // | |
| 150 #ifndef CONTAINING_RECORD | |
| 151 #define CONTAINING_RECORD(address, type, field) \ | |
| 152 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field)))) | |
| 153 #endif | |
| 154 | |
| 155 // | |
| 156 // Returns the byte offset of the specified structure's member | |
| 157 // | |
| 158 #ifndef __GNUC__ | |
| 159 #define FIELD_OFFSET(Type, Field) ((LONG)(LONG_PTR)&(((Type*) 0)->Field)) | |
| 160 #else | |
| 161 #define FIELD_OFFSET(Type, Field) __builtin_offsetof(Type, Field) | |
| 162 #endif | |
| 163 | |
| 164 // | |
| 165 // Returns the type's alignment | |
| 166 // | |
| 167 #if defined(_MSC_VER) && (_MSC_VER >= 1300) | |
| 168 #define TYPE_ALIGNMENT(t) __alignof(t) | |
| 169 #else | |
| 170 #define TYPE_ALIGNMENT(t) FIELD_OFFSET( struct { char x; t test; }, test ) | |
| 171 #endif | |
| 172 | |
| 173 // | |
| 174 // Calling Conventions | |
| 175 // | |
| 176 #if defined(_M_IX86) | |
| 177 #define FASTCALL __fastcall | |
| 178 #else | |
| 179 #define FASTCALL | |
| 180 #endif | |
| 181 | |
| 182 #define NTAPI __stdcall | |
| 183 | |
| 184 // | |
| 185 // Used by the DDK exclusively , don't put in drivers | |
| 186 // | |
| 187 #define DDKAPI __stdcall // Use NTAPI instead | |
| 188 #define DDKCDECLAPI __cdecl // Just use __cdecl | |
| 189 | |
| 190 // | |
| 191 // Import and Export Specifiers | |
| 192 // | |
| 193 | |
| 194 // Done the same way as in windef.h for now | |
| 195 #define DECLSPEC_IMPORT __declspec(dllimport) | |
| 196 #define DECLSPEC_NORETURN __declspec(noreturn) | |
| 197 | |
| 198 | |
| 199 #ifndef DECLSPEC_ADDRSAFE | |
| 200 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64)) | |
| 201 #define DECLSPEC_ADDRSAFE __declspec(address_safe) | |
| 202 #else | |
| 203 #define DECLSPEC_ADDRSAFE | |
| 204 #endif | |
| 205 #endif | |
| 206 | |
| 207 #if !defined(_NTSYSTEM_) | |
| 208 #define NTSYSAPI DECLSPEC_IMPORT | |
| 209 #define NTSYSCALLAPI DECLSPEC_IMPORT | |
| 210 #else | |
| 211 #define NTSYSAPI | |
| 212 #if defined(_NTDLLBUILD_) | |
| 213 #define NTSYSCALLAPI | |
| 214 #else | |
| 215 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE | |
| 216 #endif | |
| 217 #endif | |
| 218 | |
| 219 // | |
| 220 // Inlines | |
| 221 // | |
| 222 #ifndef FORCEINLINE | |
| 223 #if (_MSC_VER >= 1200) | |
| 224 #define FORCEINLINE __forceinline | |
| 225 #elif (_MSC_VER) | |
| 226 #define FORCEINLINE __inline | |
| 227 #else | |
| 228 #define FORCEINLINE static __inline__ __attribute__((always_inline)) | |
| 229 #endif | |
| 230 #endif | |
| 231 | |
| 232 #ifndef DECLSPEC_NOINLINE | |
| 233 #if (_MSC_VER >= 1300) | |
| 234 #define DECLSPEC_NOINLINE __declspec(noinline) | |
| 235 #elif defined(__GNUC__) | |
| 236 #define DECLSPEC_NOINLINE __attribute__((noinline)) | |
| 237 #else | |
| 238 #define DECLSPEC_NOINLINE | |
| 239 #endif | |
| 240 #endif | |
| 241 | |
| 242 #if !defined(_M_CEE_PURE) | |
| 243 #define NTAPI_INLINE NTAPI | |
| 244 #else | |
| 245 #define NTAPI_INLINE | |
| 246 #endif | |
| 247 | |
| 248 // | |
| 249 // Use to specify structure alignment | |
| 250 // | |
| 251 #ifndef DECLSPEC_ALIGN | |
| 252 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS) | |
| 253 #define DECLSPEC_ALIGN(x) __declspec(align(x)) | |
| 254 #elif defined(__GNUC__) | |
| 255 #define DECLSPEC_ALIGN(x) __attribute__((aligned(x))) | |
| 256 #else | |
| 257 #define DECLSPEC_ALIGN(x) | |
| 258 #endif | |
| 259 #endif | |
| 260 | |
| 261 | |
| 262 | |
| 263 // | |
| 264 // Use to silence unused variable warnings when it is intentional | |
| 265 // | |
| 266 #define UNREFERENCED_PARAMETER(P) {(P)=(P);} | |
| 267 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);} | |
| 268 #define DBG_UNREFERENCED_PARAMETER(P) | |
| 269 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L) | |
| 270 | |
| 271 | |
| 272 | |
| 273 // | |
| 274 // min/max helper macros | |
| 275 // | |
| 276 #ifndef NOMINMAX | |
| 277 | |
| 278 #ifndef min | |
| 279 #define min(a,b) (((a) < (b)) ? (a) : (b)) | |
| 280 #endif | |
| 281 | |
| 282 #ifndef max | |
| 283 #define max(a,b) (((a) > (b)) ? (a) : (b)) | |
| 284 #endif | |
| 285 | |
| 286 #endif // NOMINMAX | |
| 287 | |
| 288 | |
| 289 | |
| 290 // | |
| 291 // Tell windef.h that we have defined some basic types | |
| 292 // | |
| 293 #define BASETYPES | |
| 294 | |
| 295 // | |
| 296 // Void Pointers | |
| 297 // | |
| 298 typedef void *PVOID; | |
| 299 //typedef void * POINTER_64 PVOID64; | |
| 300 typedef PVOID PVOID64; // FIXME! | |
| 301 | |
| 302 // | |
| 303 // Handle Type | |
| 304 // | |
| 305 #ifdef STRICT | |
| 306 typedef void *HANDLE; | |
| 307 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n | |
| 308 #else | |
| 309 typedef PVOID HANDLE; | |
| 310 #define DECLARE_HANDLE(n) typedef HANDLE n | |
| 311 #endif | |
| 312 typedef HANDLE *PHANDLE; | |
| 313 | |
| 314 // | |
| 315 // Upper-Case Versions of Some Standard C Types | |
| 316 // | |
| 317 #ifndef VOID | |
| 318 #define VOID void | |
| 319 typedef char CHAR; | |
| 320 typedef short SHORT; | |
| 321 typedef long LONG; | |
| 322 #if !defined(MIDL_PASS) | |
| 323 typedef int INT; | |
| 324 #endif | |
| 325 #endif | |
| 326 typedef double DOUBLE; | |
| 327 | |
| 328 // | |
| 329 // Used to store a non-float 8 byte aligned structure | |
| 330 // | |
| 331 typedef struct _QUAD | |
| 332 { | |
| 333 _ANONYMOUS_UNION union | |
| 334 { | |
| 335 __int64 UseThisFieldToCopy; | |
| 336 double DoNotUseThisField; | |
| 337 }; | |
| 338 } QUAD, *PQUAD, UQUAD, *PUQUAD; | |
| 339 | |
| 340 | |
| 341 // | |
| 342 // Unsigned Types | |
| 343 // | |
| 344 typedef unsigned char UCHAR, *PUCHAR; | |
| 345 typedef unsigned short USHORT, *PUSHORT; | |
| 346 typedef unsigned long ULONG, *PULONG; | |
| 347 typedef CONST UCHAR *PCUCHAR; | |
| 348 typedef CONST USHORT *PCUSHORT; | |
| 349 typedef CONST ULONG *PCULONG; | |
| 350 | |
| 351 typedef UCHAR FCHAR; | |
| 352 typedef USHORT FSHORT; | |
| 353 typedef ULONG FLONG; | |
| 354 typedef UCHAR BOOLEAN; | |
| 355 typedef BOOLEAN *PBOOLEAN; | |
| 356 | |
| 357 // | |
| 358 // Signed Types | |
| 359 // | |
| 360 typedef SHORT *PSHORT; | |
| 361 typedef LONG *PLONG; | |
| 362 | |
| 363 typedef LONG NTSTATUS; | |
| 364 typedef NTSTATUS *PNTSTATUS; | |
| 365 | |
| 366 typedef signed char SCHAR; | |
| 367 typedef SCHAR *PSCHAR; | |
| 368 | |
| 369 #ifndef _HRESULT_DEFINED | |
| 370 #define _HRESULT_DEFINED | |
| 371 typedef LONG HRESULT; | |
| 372 #endif | |
| 373 | |
| 374 // | |
| 375 // 64-bit types | |
| 376 // | |
| 377 typedef __int64 LONGLONG, *PLONGLONG; | |
| 378 typedef unsigned __int64 ULONGLONG, *PULONGLONG; | |
| 379 typedef ULONGLONG DWORDLONG, *PDWORDLONG; | |
| 380 | |
| 381 // | |
| 382 // Update Sequence Number | |
| 383 // | |
| 384 typedef LONGLONG USN; | |
| 385 | |
| 386 | |
| 387 // | |
| 388 // ANSI (Multi-byte Character) types | |
| 389 // | |
| 390 typedef CHAR *PCHAR, *LPCH, *PCH; | |
| 391 typedef CONST CHAR *LPCCH, *PCCH; | |
| 392 typedef CHAR *NPSTR, *LPSTR, *PSTR; | |
| 393 typedef PSTR *PZPSTR; | |
| 394 typedef CONST PSTR *PCZPSTR; | |
| 395 typedef CONST CHAR *LPCSTR, *PCSTR; | |
| 396 typedef PCSTR *PZPCSTR; | |
| 397 | |
| 398 // | |
| 399 // Pointer to an Asciiz string | |
| 400 // | |
| 401 typedef CHAR *PSZ; | |
| 402 typedef CONST char *PCSZ; | |
| 403 | |
| 404 // | |
| 405 // UNICODE (Wide Character) types | |
| 406 // | |
| 407 typedef wchar_t WCHAR; | |
| 408 typedef WCHAR *PWCHAR, *LPWCH, *PWCH; | |
| 409 typedef CONST WCHAR *LPCWCH, *PCWCH; | |
| 410 typedef WCHAR *NWPSTR, *LPWSTR, *PWSTR; | |
| 411 typedef PWSTR *PZPWSTR; | |
| 412 typedef CONST PWSTR *PCZPWSTR; | |
| 413 typedef WCHAR UNALIGNED *LPUWSTR, *PUWSTR; | |
| 414 typedef CONST WCHAR *LPCWSTR, *PCWSTR; | |
| 415 typedef PCWSTR *PZPCWSTR; | |
| 416 typedef CONST WCHAR UNALIGNED *LPCUWSTR, *PCUWSTR; | |
| 417 | |
| 418 // | |
| 419 // Cardinal Data Types | |
| 420 // | |
| 421 typedef char CCHAR, *PCCHAR; | |
| 422 typedef short CSHORT, *PCSHORT; | |
| 423 typedef ULONG CLONG, *PCLONG; | |
| 424 | |
| 425 // | |
| 426 // NLS basics (Locale and Language Ids) | |
| 427 // | |
| 428 typedef ULONG LCID; | |
| 429 typedef PULONG PLCID; | |
| 430 typedef USHORT LANGID; | |
| 431 | |
| 432 | |
| 433 | |
| 434 // | |
| 435 // Large Integer Unions | |
| 436 // | |
| 437 #if defined(MIDL_PASS) | |
| 438 typedef struct _LARGE_INTEGER { | |
| 439 #else | |
| 440 typedef union _LARGE_INTEGER { | |
| 441 _ANONYMOUS_STRUCT struct | |
| 442 { | |
| 443 ULONG LowPart; | |
| 444 LONG HighPart; | |
| 445 } DUMMYSTRUCTNAME; | |
| 446 struct | |
| 447 { | |
| 448 ULONG LowPart; | |
| 449 LONG HighPart; | |
| 450 } u; | |
| 451 #endif //MIDL_PASS | |
| 452 LONGLONG QuadPart; | |
| 453 } LARGE_INTEGER, *PLARGE_INTEGER; | |
| 454 | |
| 455 #if defined(MIDL_PASS) | |
| 456 typedef struct _ULARGE_INTEGER { | |
| 457 #else | |
| 458 typedef union _ULARGE_INTEGER { | |
| 459 _ANONYMOUS_STRUCT struct | |
| 460 { | |
| 461 ULONG LowPart; | |
| 462 ULONG HighPart; | |
| 463 } DUMMYSTRUCTNAME; | |
| 464 struct | |
| 465 { | |
| 466 ULONG LowPart; | |
| 467 ULONG HighPart; | |
| 468 } u; | |
| 469 #endif //MIDL_PASS | |
| 470 ULONGLONG QuadPart; | |
| 471 } ULARGE_INTEGER, *PULARGE_INTEGER; | |
| 472 | |
| 473 // | |
| 474 // Physical Addresses are always treated as 64-bit wide | |
| 475 // | |
| 476 typedef LARGE_INTEGER PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS; | |
| 477 | |
| 478 | |
| 479 | |
| 480 // | |
| 481 // Locally Unique Identifier | |
| 482 // | |
| 483 typedef struct _LUID { | |
| 484 ULONG LowPart; | |
| 485 LONG HighPart; | |
| 486 } LUID, *PLUID; | |
| 487 | |
| 488 | |
| 489 | |
| 490 // | |
| 491 // Native API Return Value Macros | |
| 492 // | |
| 493 #define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0) | |
| 494 #define NT_INFORMATION(Status) ((((ULONG)(Status)) >> 30) == 1) | |
| 495 #define NT_WARNING(Status) ((((ULONG)(Status)) >> 30) == 2) | |
| 496 #define NT_ERROR(Status) ((((ULONG)(Status)) >> 30) == 3) | |
| 497 | |
| 498 | |
| 499 | |
| 500 // | |
| 501 // String Types | |
| 502 // | |
| 503 typedef struct _UNICODE_STRING { | |
| 504 USHORT Length; | |
| 505 USHORT MaximumLength; | |
| 506 PWSTR Buffer; | |
| 507 } UNICODE_STRING, *PUNICODE_STRING; | |
| 508 typedef const UNICODE_STRING* PCUNICODE_STRING; | |
| 509 #define UNICODE_NULL ((WCHAR)0) | |
| 510 | |
| 511 typedef struct _CSTRING { | |
| 512 USHORT Length; | |
| 513 USHORT MaximumLength; | |
| 514 CONST CHAR *Buffer; | |
| 515 } CSTRING, *PCSTRING; | |
| 516 #define ANSI_NULL ((CHAR)0) | |
| 517 | |
| 518 typedef struct _STRING { | |
| 519 USHORT Length; | |
| 520 USHORT MaximumLength; | |
| 521 PCHAR Buffer; | |
| 522 } STRING, *PSTRING; | |
| 523 | |
| 524 typedef STRING ANSI_STRING; | |
| 525 typedef PSTRING PANSI_STRING; | |
| 526 typedef STRING OEM_STRING; | |
| 527 typedef PSTRING POEM_STRING; | |
| 528 typedef CONST STRING* PCOEM_STRING; | |
| 529 typedef STRING CANSI_STRING; | |
| 530 typedef PSTRING PCANSI_STRING; | |
| 531 | |
| 532 typedef struct _STRING32 { | |
| 533 USHORT Length; | |
| 534 USHORT MaximumLength; | |
| 535 ULONG Buffer; | |
| 536 } STRING32, *PSTRING32, | |
| 537 UNICODE_STRING32, *PUNICODE_STRING32, | |
| 538 ANSI_STRING32, *PANSI_STRING32; | |
| 539 | |
| 540 typedef struct _STRING64 { | |
| 541 USHORT Length; | |
| 542 USHORT MaximumLength; | |
| 543 ULONGLONG Buffer; | |
| 544 } STRING64, *PSTRING64, | |
| 545 UNICODE_STRING64, *PUNICODE_STRING64, | |
| 546 ANSI_STRING64, *PANSI_STRING64; | |
| 547 | |
| 548 // | |
| 549 // LangID and NLS | |
| 550 // | |
| 551 #define MAKELANGID(p, s) ((((USHORT)(s)) << 10) | (USHORT)(p)) | |
| 552 #define PRIMARYLANGID(lgid) ((USHORT)(lgid) & 0x3ff) | |
| 553 #define SUBLANGID(lgid) ((USHORT)(lgid) >> 10) | |
| 554 | |
| 555 #define NLS_VALID_LOCALE_MASK 0x000fffff | |
| 556 | |
| 557 #define MAKELCID(lgid, srtid) ((ULONG)((((ULONG)((USHORT)(srtid))) << 16) | \ | |
| 558 ((ULONG)((USHORT)(lgid))))) | |
| 559 #define MAKESORTLCID(lgid, srtid, ver) \ | |
| 560 ((ULONG)((MAKELCID(lgid, srtid)) | \ | |
| 561 (((ULONG)((USHORT)(ver))) << 20))) | |
| 562 #define LANGIDFROMLCID(lcid) ((USHORT)(lcid)) | |
| 563 #define SORTIDFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 16) & 0xf)) | |
| 564 #define SORTVERSIONFROMLCID(lcid) ((USHORT)((((ULONG)(lcid)) >> 20) & 0xf)) | |
| 565 | |
| 566 | |
| 567 | |
| 568 // | |
| 569 // Object Attributes | |
| 570 // | |
| 571 typedef struct _OBJECT_ATTRIBUTES { | |
| 572 ULONG Length; | |
| 573 HANDLE RootDirectory; | |
| 574 PUNICODE_STRING ObjectName; | |
| 575 ULONG Attributes; | |
| 576 PVOID SecurityDescriptor; | |
| 577 PVOID SecurityQualityOfService; | |
| 578 } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; | |
| 579 typedef CONST OBJECT_ATTRIBUTES *PCOBJECT_ATTRIBUTES; | |
| 580 | |
| 581 // | |
| 582 // Values for the Attributes member | |
| 583 // | |
| 584 #define OBJ_INHERIT 0x00000002 | |
| 585 #define OBJ_PERMANENT 0x00000010 | |
| 586 #define OBJ_EXCLUSIVE 0x00000020 | |
| 587 #define OBJ_CASE_INSENSITIVE 0x00000040 | |
| 588 #define OBJ_OPENIF 0x00000080 | |
| 589 #define OBJ_OPENLINK 0x00000100 | |
| 590 #define OBJ_KERNEL_HANDLE 0x00000200 | |
| 591 #define OBJ_FORCE_ACCESS_CHECK 0x00000400 | |
| 592 #define OBJ_VALID_ATTRIBUTES 0x000007F2 | |
| 593 | |
| 594 // | |
| 595 // Helper Macro | |
| 596 // | |
| 597 #define InitializeObjectAttributes(p,n,a,r,s) { \ | |
| 598 (p)->Length = sizeof(OBJECT_ATTRIBUTES); \ | |
| 599 (p)->RootDirectory = (r); \ | |
| 600 (p)->Attributes = (a); \ | |
| 601 (p)->ObjectName = (n); \ | |
| 602 (p)->SecurityDescriptor = (s); \ | |
| 603 (p)->SecurityQualityOfService = NULL; \ | |
| 604 } | |
| 605 | |
| 606 | |
| 607 | |
| 608 // | |
| 609 // Product Types | |
| 610 // | |
| 611 typedef enum _NT_PRODUCT_TYPE { | |
| 612 NtProductWinNt = 1, | |
| 613 NtProductLanManNt, | |
| 614 NtProductServer | |
| 615 } NT_PRODUCT_TYPE, *PNT_PRODUCT_TYPE; | |
| 616 | |
| 617 | |
| 618 | |
| 619 // | |
| 620 // Doubly Linked Lists | |
| 621 // | |
| 622 typedef struct _LIST_ENTRY { | |
| 623 struct _LIST_ENTRY *Flink; | |
| 624 struct _LIST_ENTRY *Blink; | |
| 625 } LIST_ENTRY, *PLIST_ENTRY, *RESTRICTED_POINTER PRLIST_ENTRY; | |
| 626 | |
| 627 typedef struct LIST_ENTRY32 | |
| 628 { | |
| 629 ULONG Flink; | |
| 630 ULONG Blink; | |
| 631 } LIST_ENTRY32, *PLIST_ENTRY32; | |
| 632 | |
| 633 typedef struct LIST_ENTRY64 | |
| 634 { | |
| 635 ULONGLONG Flink; | |
| 636 ULONGLONG Blink; | |
| 637 } LIST_ENTRY64, *PLIST_ENTRY64; | |
| 638 | |
| 639 // | |
| 640 // Singly Linked Lists | |
| 641 // | |
| 642 typedef struct _SINGLE_LIST_ENTRY { | |
| 643 struct _SINGLE_LIST_ENTRY *Next; | |
| 644 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; | |
| 645 | |
| 646 | |
| 647 | |
| 648 // | |
| 649 // Helper Macros | |
| 650 // | |
| 651 #define RTL_CONSTANT_STRING(s) { sizeof(s)-sizeof((s)[0]), sizeof(s), s } | |
| 652 | |
| 653 #define RTL_FIELD_SIZE(type, field) (sizeof(((type *)0)->field)) | |
| 654 | |
| 655 #define RTL_NUMBER_OF_V1(A) (sizeof(A)/sizeof((A)[0])) | |
| 656 #define RTL_NUMBER_OF_V2(A) RTL_NUMBER_OF_V1(A) | |
| 657 #ifdef ENABLE_RTL_NUMBER_OF_V2 | |
| 658 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V2(A) | |
| 659 #else | |
| 660 #define RTL_NUMBER_OF(A) RTL_NUMBER_OF_V1(A) | |
| 661 #endif | |
| 662 #define ARRAYSIZE(A) RTL_NUMBER_OF_V2(A) | |
| 663 | |
| 664 | |
| 665 | |
| 666 // | |
| 667 // Type Limits | |
| 668 // | |
| 669 #define MINCHAR 0x80 | |
| 670 #define MAXCHAR 0x7f | |
| 671 #define MINSHORT 0x8000 | |
| 672 #define MAXSHORT 0x7fff | |
| 673 #define MINLONG 0x80000000 | |
| 674 #define MAXLONG 0x7fffffff | |
| 675 #define MAXUCHAR 0xff | |
| 676 #define MAXUSHORT 0xffff | |
| 677 #define MAXULONG 0xffffffff | |
| 678 #define MAXLONGLONG (0x7fffffffffffffffLL) | |
| 679 | |
| 680 | |
| 681 | |
| 682 // | |
| 683 // Multiplication and Shift Operations | |
| 684 // | |
| 685 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b)) | |
| 686 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b)) | |
| 687 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b)) | |
| 688 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b)) | |
| 689 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b)) | |
| 690 | |
| 691 | |
| 692 | |
| 693 // | |
| 694 // C_ASSERT Definition | |
| 695 // | |
| 696 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1] | |
| 697 | |
| 698 | |
| 699 | |
| 700 // | |
| 701 // Primary language IDs. | |
| 702 // | |
| 703 #define LANG_NEUTRAL 0x00 | |
| 704 #define LANG_INVARIANT 0x7f | |
| 705 | |
| 706 #define LANG_AFRIKAANS 0x36 | |
| 707 #define LANG_ALBANIAN 0x1c | |
| 708 #define LANG_ALSATIAN 0x84 | |
| 709 #define LANG_AMHARIC 0x5e | |
| 710 #define LANG_ARABIC 0x01 | |
| 711 #define LANG_ARMENIAN 0x2b | |
| 712 #define LANG_ASSAMESE 0x4d | |
| 713 #define LANG_AZERI 0x2c | |
| 714 #define LANG_BASHKIR 0x6d | |
| 715 #define LANG_BASQUE 0x2d | |
| 716 #define LANG_BELARUSIAN 0x23 | |
| 717 #define LANG_BENGALI 0x45 | |
| 718 #define LANG_BRETON 0x7e | |
| 719 #define LANG_BOSNIAN 0x1a | |
| 720 #define LANG_BOSNIAN_NEUTRAL 0x781a | |
| 721 #define LANG_BULGARIAN 0x02 | |
| 722 #define LANG_CATALAN 0x03 | |
| 723 #define LANG_CHINESE 0x04 | |
| 724 #define LANG_CHINESE_SIMPLIFIED 0x04 | |
| 725 #define LANG_CHINESE_TRADITIONAL 0x7c04 | |
| 726 #define LANG_CORSICAN 0x83 | |
| 727 #define LANG_CROATIAN 0x1a | |
| 728 #define LANG_CZECH 0x05 | |
| 729 #define LANG_DANISH 0x06 | |
| 730 #define LANG_DARI 0x8c | |
| 731 #define LANG_DIVEHI 0x65 | |
| 732 #define LANG_DUTCH 0x13 | |
| 733 #define LANG_ENGLISH 0x09 | |
| 734 #define LANG_ESTONIAN 0x25 | |
| 735 #define LANG_FAEROESE 0x38 | |
| 736 #define LANG_FARSI 0x29 | |
| 737 #define LANG_FILIPINO 0x64 | |
| 738 #define LANG_FINNISH 0x0b | |
| 739 #define LANG_FRENCH 0x0c | |
| 740 #define LANG_FRISIAN 0x62 | |
| 741 #define LANG_GALICIAN 0x56 | |
| 742 #define LANG_GEORGIAN 0x37 | |
| 743 #define LANG_GERMAN 0x07 | |
| 744 #define LANG_GREEK 0x08 | |
| 745 #define LANG_GREENLANDIC 0x6f | |
| 746 #define LANG_GUJARATI 0x47 | |
| 747 #define LANG_HAUSA 0x68 | |
| 748 #define LANG_HEBREW 0x0d | |
| 749 #define LANG_HINDI 0x39 | |
| 750 #define LANG_HUNGARIAN 0x0e | |
| 751 #define LANG_ICELANDIC 0x0f | |
| 752 #define LANG_IGBO 0x70 | |
| 753 #define LANG_INDONESIAN 0x21 | |
| 754 #define LANG_INUKTITUT 0x5d | |
| 755 #define LANG_IRISH 0x3c | |
| 756 #define LANG_ITALIAN 0x10 | |
| 757 #define LANG_JAPANESE 0x11 | |
| 758 #define LANG_KANNADA 0x4b | |
| 759 #define LANG_KASHMIRI 0x60 | |
| 760 #define LANG_KAZAK 0x3f | |
| 761 #define LANG_KHMER 0x53 | |
| 762 #define LANG_KICHE 0x86 | |
| 763 #define LANG_KINYARWANDA 0x87 | |
| 764 #define LANG_KONKANI 0x57 | |
| 765 #define LANG_KOREAN 0x12 | |
| 766 #define LANG_KYRGYZ 0x40 | |
| 767 #define LANG_LAO 0x54 | |
| 768 #define LANG_LATVIAN 0x26 | |
| 769 #define LANG_LITHUANIAN 0x27 | |
| 770 #define LANG_LOWER_SORBIAN 0x2e | |
| 771 #define LANG_LUXEMBOURGISH 0x6e | |
| 772 #define LANG_MACEDONIAN 0x2f | |
| 773 #define LANG_MALAY 0x3e | |
| 774 #define LANG_MALAYALAM 0x4c | |
| 775 #define LANG_MALTESE 0x3a | |
| 776 #define LANG_MANIPURI 0x58 | |
| 777 #define LANG_MAORI 0x81 | |
| 778 #define LANG_MAPUDUNGUN 0x7a | |
| 779 #define LANG_MARATHI 0x4e | |
| 780 #define LANG_MOHAWK 0x7c | |
| 781 #define LANG_MONGOLIAN 0x50 | |
| 782 #define LANG_NEPALI 0x61 | |
| 783 #define LANG_NORWEGIAN 0x14 | |
| 784 #define LANG_OCCITAN 0x82 | |
| 785 #define LANG_ORIYA 0x48 | |
| 786 #define LANG_PASHTO 0x63 | |
| 787 #define LANG_PERSIAN 0x29 | |
| 788 #define LANG_POLISH 0x15 | |
| 789 #define LANG_PORTUGUESE 0x16 | |
| 790 #define LANG_PUNJABI 0x46 | |
| 791 #define LANG_QUECHUA 0x6b | |
| 792 #define LANG_ROMANIAN 0x18 | |
| 793 #define LANG_ROMANSH 0x17 | |
| 794 #define LANG_RUSSIAN 0x19 | |
| 795 #define LANG_SAMI 0x3b | |
| 796 #define LANG_SANSKRIT 0x4f | |
| 797 #define LANG_SERBIAN 0x1a | |
| 798 #define LANG_SERBIAN_NEUTRAL 0x7c1a | |
| 799 #define LANG_SINDHI 0x59 | |
| 800 #define LANG_SINHALESE 0x5b | |
| 801 #define LANG_SLOVAK 0x1b | |
| 802 #define LANG_SLOVENIAN 0x24 | |
| 803 #define LANG_SOTHO 0x6c | |
| 804 #define LANG_SPANISH 0x0a | |
| 805 #define LANG_SWAHILI 0x41 | |
| 806 #define LANG_SWEDISH 0x1d | |
| 807 #define LANG_SYRIAC 0x5a | |
| 808 #define LANG_TAJIK 0x28 | |
| 809 #define LANG_TAMAZIGHT 0x5f | |
| 810 #define LANG_TAMIL 0x49 | |
| 811 #define LANG_TATAR 0x44 | |
| 812 #define LANG_TELUGU 0x4a | |
| 813 #define LANG_THAI 0x1e | |
| 814 #define LANG_TIBETAN 0x51 | |
| 815 #define LANG_TIGRIGNA 0x73 | |
| 816 #define LANG_TSWANA 0x32 | |
| 817 #define LANG_TURKISH 0x1f | |
| 818 #define LANG_TURKMEN 0x42 | |
| 819 #define LANG_UIGHUR 0x80 | |
| 820 #define LANG_UKRAINIAN 0x22 | |
| 821 #define LANG_UPPER_SORBIAN 0x2e | |
| 822 #define LANG_URDU 0x20 | |
| 823 #define LANG_UZBEK 0x43 | |
| 824 #define LANG_VIETNAMESE 0x2a | |
| 825 #define LANG_WELSH 0x52 | |
| 826 #define LANG_WOLOF 0x88 | |
| 827 #define LANG_XHOSA 0x34 | |
| 828 #define LANG_YAKUT 0x85 | |
| 829 #define LANG_YI 0x78 | |
| 830 #define LANG_YORUBA 0x6a | |
| 831 #define LANG_ZULU 0x35 | |
| 832 | |
| 833 | |
| 834 | |
| 835 #endif /* _NTDEF_H */ |
