1 /** 2 * Windows API header module 3 * 4 * Translated from MinGW Windows headers 5 * 6 * Authors: Stewart Gordon 7 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 8 * Source: $(DRUNTIMESRC core/sys/windows/_ntdef.d) 9 */ 10 /// Automatically imported and edited from the druntime module 11 /// core.sys.windows.ntdef for the auto-generated win32 package. 12 module win32.ntdef; 13 //version (Windows): 14 @system: 15 16 import win32.basetsd, win32.subauth, win32.windef, win32.winnt; 17 18 enum uint 19 OBJ_INHERIT = 0x0002, 20 OBJ_PERMANENT = 0x0010, 21 OBJ_EXCLUSIVE = 0x0020, 22 OBJ_CASE_INSENSITIVE = 0x0040, 23 OBJ_OPENIF = 0x0080, 24 OBJ_OPENLINK = 0x0100, 25 OBJ_VALID_ATTRIBUTES = 0x01F2; 26 27 void InitializeObjectAttributes()(OBJECT_ATTRIBUTES* p, UNICODE_STRING* n, 28 uint a, HANDLE r, void* s) { 29 with (*p) { 30 Length = OBJECT_ATTRIBUTES.sizeof; 31 RootDirectory = r; 32 Attributes = a; 33 ObjectName = n; 34 SecurityDescriptor = s; 35 SecurityQualityOfService = null; 36 } 37 } 38 39 bool NT_SUCCESS()(int x) { return x >= 0; } 40 41 /* In MinGW, NTSTATUS, UNICODE_STRING, STRING and their associated pointer 42 * type aliases are defined in ntdef.h, ntsecapi.h and subauth.h, each of 43 * which checks that none of the others is already included. 44 */ 45 alias int NTSTATUS; 46 alias int* PNTSTATUS; 47 48 struct UNICODE_STRING { 49 USHORT Length; 50 USHORT MaximumLength; 51 PWSTR Buffer; 52 } 53 alias UNICODE_STRING* PUNICODE_STRING; 54 alias const(UNICODE_STRING)* PCUNICODE_STRING; 55 56 struct STRING { 57 USHORT Length; 58 USHORT MaximumLength; 59 PCHAR Buffer; 60 } 61 alias STRING ANSI_STRING, OEM_STRING; 62 alias STRING* PSTRING, PANSI_STRING, POEM_STRING; 63 64 alias LARGE_INTEGER PHYSICAL_ADDRESS; 65 alias LARGE_INTEGER* PPHYSICAL_ADDRESS; 66 67 enum SECTION_INHERIT { 68 ViewShare = 1, 69 ViewUnmap 70 } 71 72 /* In MinGW, this is defined in ntdef.h and ntsecapi.h, each of which checks 73 * that the other isn't already included. 74 */ 75 struct OBJECT_ATTRIBUTES { 76 ULONG Length = OBJECT_ATTRIBUTES.sizeof; 77 HANDLE RootDirectory; 78 PUNICODE_STRING ObjectName; 79 ULONG Attributes; 80 PVOID SecurityDescriptor; 81 PVOID SecurityQualityOfService; 82 } 83 alias OBJECT_ATTRIBUTES* POBJECT_ATTRIBUTES;