annotate win32/ntdef.d @ 1:4a9dcbd9e54f

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