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