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