Artifact 3183d8d941c5427def0870a107355b7fbfd6a9ec:
- File
src/win32/ntdef.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /***************
0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0a 2a 20 20 20 20 20 ********\.*
0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0060: 20 20 20 20 20 20 20 20 20 20 20 6e 74 64 65 66 ntdef
0070: 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .d
0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0090: 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 *.*
00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00d0: 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 *.*
00e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
00f0: 20 20 20 20 20 20 57 69 6e 64 6f 77 73 20 41 50 Windows AP
0100: 49 20 68 65 61 64 65 72 20 6d 6f 64 75 6c 65 20 I header module
0110: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0120: 20 20 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 *.*
0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0170: 2a 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 *.*
0180: 20 20 20 20 54 72 61 6e 73 6c 61 74 65 64 20 66 Translated f
0190: 72 6f 6d 20 4d 69 6e 47 57 20 57 69 6e 64 6f 77 rom MinGW Window
01a0: 73 20 68 65 61 64 65 72 73 20 20 20 20 20 20 20 s headers
01b0: 20 20 20 20 20 20 20 20 20 20 2a 0a 2a 20 20 20 *.*
01c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
01d0: 20 20 20 20 20 20 20 20 62 79 20 53 74 65 77 61 by Stewa
01e0: 72 74 20 47 6f 72 64 6f 6e 20 20 20 20 20 20 20 rt Gordon
01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0200: 20 20 20 20 2a 0a 2a 20 20 20 20 20 20 20 20 20 *.*
0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0220: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0230: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0a *.
0250: 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 *
0260: 20 20 20 20 20 20 20 20 50 6c 61 63 65 64 20 69 Placed i
0270: 6e 74 6f 20 70 75 62 6c 69 63 20 64 6f 6d 61 69 nto public domai
0280: 6e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 n
0290: 20 20 20 20 20 20 20 20 2a 0a 5c 2a 2a 2a 2a 2a *.\*****
02a0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02b0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02c0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02d0: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
02e0: 2a 2a 2f 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32 **/.module win32
02f0: 2e 6e 74 64 65 66 3b 0a 0a 70 72 69 76 61 74 65 .ntdef;..private
0300: 20 69 6d 70 6f 72 74 20 77 69 6e 33 32 2e 62 61 import win32.ba
0310: 73 65 74 73 64 2c 20 77 69 6e 33 32 2e 73 75 62 setsd, win32.sub
0320: 61 75 74 68 2c 20 77 69 6e 33 32 2e 77 69 6e 64 auth, win32.wind
0330: 65 66 2c 20 77 69 6e 33 32 2e 77 69 6e 6e 74 3b ef, win32.winnt;
0340: 0a 0a 63 6f 6e 73 74 20 75 69 6e 74 0a 09 4f 42 ..const uint..OB
0350: 4a 5f 49 4e 48 45 52 49 54 20 20 20 20 20 20 20 J_INHERIT
0360: 20 20 20 3d 20 30 78 30 30 30 32 2c 0a 09 4f 42 = 0x0002,..OB
0370: 4a 5f 50 45 52 4d 41 4e 45 4e 54 20 20 20 20 20 J_PERMANENT
0380: 20 20 20 3d 20 30 78 30 30 31 30 2c 0a 09 4f 42 = 0x0010,..OB
0390: 4a 5f 45 58 43 4c 55 53 49 56 45 20 20 20 20 20 J_EXCLUSIVE
03a0: 20 20 20 3d 20 30 78 30 30 32 30 2c 0a 09 4f 42 = 0x0020,..OB
03b0: 4a 5f 43 41 53 45 5f 49 4e 53 45 4e 53 49 54 49 J_CASE_INSENSITI
03c0: 56 45 20 3d 20 30 78 30 30 34 30 2c 0a 09 4f 42 VE = 0x0040,..OB
03d0: 4a 5f 4f 50 45 4e 49 46 20 20 20 20 20 20 20 20 J_OPENIF
03e0: 20 20 20 3d 20 30 78 30 30 38 30 2c 0a 09 4f 42 = 0x0080,..OB
03f0: 4a 5f 4f 50 45 4e 4c 49 4e 4b 20 20 20 20 20 20 J_OPENLINK
0400: 20 20 20 3d 20 30 78 30 31 30 30 2c 0a 09 4f 42 = 0x0100,..OB
0410: 4a 5f 56 41 4c 49 44 5f 41 54 54 52 49 42 55 54 J_VALID_ATTRIBUT
0420: 45 53 20 3d 20 30 78 30 31 46 32 3b 0a 0a 76 6f ES = 0x01F2;..vo
0430: 69 64 20 49 6e 69 74 69 61 6c 69 7a 65 4f 62 6a id InitializeObj
0440: 65 63 74 41 74 74 72 69 62 75 74 65 73 28 4f 42 ectAttributes(OB
0450: 4a 45 43 54 5f 41 54 54 52 49 42 55 54 45 53 2a JECT_ATTRIBUTES*
0460: 20 70 2c 20 55 4e 49 43 4f 44 45 5f 53 54 52 49 p, UNICODE_STRI
0470: 4e 47 2a 20 6e 2c 0a 09 20 20 75 69 6e 74 20 61 NG* n,.. uint a
0480: 2c 20 48 41 4e 44 4c 45 20 72 2c 20 76 6f 69 64 , HANDLE r, void
0490: 2a 20 73 29 20 7b 0a 09 77 69 74 68 20 28 2a 70 * s) {..with (*p
04a0: 29 20 7b 0a 09 09 4c 65 6e 67 74 68 20 3d 20 4f ) {...Length = O
04b0: 42 4a 45 43 54 5f 41 54 54 52 49 42 55 54 45 53 BJECT_ATTRIBUTES
04c0: 2e 73 69 7a 65 6f 66 3b 0a 09 09 52 6f 6f 74 44 .sizeof;...RootD
04d0: 69 72 65 63 74 6f 72 79 20 3d 20 72 3b 0a 09 09 irectory = r;...
04e0: 41 74 74 72 69 62 75 74 65 73 20 3d 20 61 3b 0a Attributes = a;.
04f0: 09 09 4f 62 6a 65 63 74 4e 61 6d 65 20 3d 20 6e ..ObjectName = n
0500: 3b 0a 09 09 53 65 63 75 72 69 74 79 44 65 73 63 ;...SecurityDesc
0510: 72 69 70 74 6f 72 20 3d 20 73 3b 0a 09 09 53 65 riptor = s;...Se
0520: 63 75 72 69 74 79 51 75 61 6c 69 74 79 4f 66 53 curityQualityOfS
0530: 65 72 76 69 63 65 20 3d 20 6e 75 6c 6c 3b 0a 09 ervice = null;..
0540: 7d 0a 7d 0a 0a 62 6f 6f 6c 20 4e 54 5f 53 55 43 }.}..bool NT_SUC
0550: 43 45 53 53 28 69 6e 74 20 78 29 20 7b 20 72 65 CESS(int x) { re
0560: 74 75 72 6e 20 78 20 3e 3d 20 30 3b 20 7d 0a 0a turn x >= 0; }..
0570: 2f 2a 09 49 6e 20 4d 69 6e 47 57 2c 20 4e 54 53 /*.In MinGW, NTS
0580: 54 41 54 55 53 2c 20 55 4e 49 43 4f 44 45 5f 53 TATUS, UNICODE_S
0590: 54 52 49 4e 47 2c 20 53 54 52 49 4e 47 20 61 6e TRING, STRING an
05a0: 64 20 74 68 65 69 72 20 61 73 73 6f 63 69 61 74 d their associat
05b0: 65 64 20 70 6f 69 6e 74 65 72 0a 20 2a 09 74 79 ed pointer. *.ty
05c0: 70 65 20 61 6c 69 61 73 65 73 20 61 72 65 20 64 pe aliases are d
05d0: 65 66 69 6e 65 64 20 69 6e 20 6e 74 64 65 66 2e efined in ntdef.
05e0: 68 2c 20 6e 74 73 65 63 61 70 69 2e 68 20 61 6e h, ntsecapi.h an
05f0: 64 20 73 75 62 61 75 74 68 2e 68 2c 20 65 61 63 d subauth.h, eac
0600: 68 20 6f 66 0a 20 2a 09 77 68 69 63 68 20 63 68 h of. *.which ch
0610: 65 63 6b 73 20 74 68 61 74 20 6e 6f 6e 65 20 6f ecks that none o
0620: 66 20 74 68 65 20 6f 74 68 65 72 73 20 69 73 20 f the others is
0630: 61 6c 72 65 61 64 79 20 69 6e 63 6c 75 64 65 64 already included
0640: 2e 0a 20 2a 2f 0a 61 6c 69 61 73 20 69 6e 74 20 .. */.alias int
0650: 20 4e 54 53 54 41 54 55 53 3b 0a 61 6c 69 61 73 NTSTATUS;.alias
0660: 20 69 6e 74 2a 20 50 4e 54 53 54 41 54 55 53 3b int* PNTSTATUS;
0670: 0a 0a 73 74 72 75 63 74 20 55 4e 49 43 4f 44 45 ..struct UNICODE
0680: 5f 53 54 52 49 4e 47 20 7b 0a 09 55 53 48 4f 52 _STRING {..USHOR
0690: 54 20 4c 65 6e 67 74 68 3b 0a 09 55 53 48 4f 52 T Length;..USHOR
06a0: 54 20 4d 61 78 69 6d 75 6d 4c 65 6e 67 74 68 3b T MaximumLength;
06b0: 0a 09 50 57 53 54 52 20 20 42 75 66 66 65 72 3b ..PWSTR Buffer;
06c0: 0a 7d 0a 61 6c 69 61 73 20 55 4e 49 43 4f 44 45 .}.alias UNICODE
06d0: 5f 53 54 52 49 4e 47 2a 20 20 20 20 20 20 20 20 _STRING*
06e0: 50 55 4e 49 43 4f 44 45 5f 53 54 52 49 4e 47 3b PUNICODE_STRING;
06f0: 0a 61 6c 69 61 73 20 63 6f 6e 73 74 28 55 4e 49 .alias const(UNI
0700: 43 4f 44 45 5f 53 54 52 49 4e 47 29 2a 20 50 43 CODE_STRING)* PC
0710: 55 4e 49 43 4f 44 45 5f 53 54 52 49 4e 47 3b 0a UNICODE_STRING;.
0720: 0a 73 74 72 75 63 74 20 53 54 52 49 4e 47 20 7b .struct STRING {
0730: 0a 09 55 53 48 4f 52 54 20 4c 65 6e 67 74 68 3b ..USHORT Length;
0740: 0a 09 55 53 48 4f 52 54 20 4d 61 78 69 6d 75 6d ..USHORT Maximum
0750: 4c 65 6e 67 74 68 3b 0a 09 50 43 48 41 52 20 20 Length;..PCHAR
0760: 42 75 66 66 65 72 3b 0a 7d 0a 61 6c 69 61 73 20 Buffer;.}.alias
0770: 53 54 52 49 4e 47 20 20 41 4e 53 49 5f 53 54 52 STRING ANSI_STR
0780: 49 4e 47 2c 20 4f 45 4d 5f 53 54 52 49 4e 47 3b ING, OEM_STRING;
0790: 0a 61 6c 69 61 73 20 53 54 52 49 4e 47 2a 20 50 .alias STRING* P
07a0: 53 54 52 49 4e 47 2c 20 50 41 4e 53 49 5f 53 54 STRING, PANSI_ST
07b0: 52 49 4e 47 2c 20 50 4f 45 4d 5f 53 54 52 49 4e RING, POEM_STRIN
07c0: 47 3b 0a 0a 61 6c 69 61 73 20 4c 41 52 47 45 5f G;..alias LARGE_
07d0: 49 4e 54 45 47 45 52 20 20 50 48 59 53 49 43 41 INTEGER PHYSICA
07e0: 4c 5f 41 44 44 52 45 53 53 3b 0a 61 6c 69 61 73 L_ADDRESS;.alias
07f0: 20 4c 41 52 47 45 5f 49 4e 54 45 47 45 52 2a 20 LARGE_INTEGER*
0800: 50 50 48 59 53 49 43 41 4c 5f 41 44 44 52 45 53 PPHYSICAL_ADDRES
0810: 53 3b 0a 0a 65 6e 75 6d 20 53 45 43 54 49 4f 4e S;..enum SECTION
0820: 5f 49 4e 48 45 52 49 54 20 7b 0a 09 56 69 65 77 _INHERIT {..View
0830: 53 68 61 72 65 20 3d 20 31 2c 0a 09 56 69 65 77 Share = 1,..View
0840: 55 6e 6d 61 70 0a 7d 0a 0a 2f 2a 09 49 6e 20 4d Unmap.}../*.In M
0850: 69 6e 47 57 2c 20 74 68 69 73 20 69 73 20 64 65 inGW, this is de
0860: 66 69 6e 65 64 20 69 6e 20 6e 74 64 65 66 2e 68 fined in ntdef.h
0870: 20 61 6e 64 20 6e 74 73 65 63 61 70 69 2e 68 2c and ntsecapi.h,
0880: 20 65 61 63 68 20 6f 66 20 77 68 69 63 68 20 63 each of which c
0890: 68 65 63 6b 73 0a 20 2a 09 74 68 61 74 20 74 68 hecks. *.that th
08a0: 65 20 6f 74 68 65 72 20 69 73 6e 27 74 20 61 6c e other isn't al
08b0: 72 65 61 64 79 20 69 6e 63 6c 75 64 65 64 2e 0a ready included..
08c0: 20 2a 2f 0a 73 74 72 75 63 74 20 4f 42 4a 45 43 */.struct OBJEC
08d0: 54 5f 41 54 54 52 49 42 55 54 45 53 20 7b 0a 09 T_ATTRIBUTES {..
08e0: 55 4c 4f 4e 47 20 20 20 20 20 20 20 20 20 20 20 ULONG
08f0: 4c 65 6e 67 74 68 20 3d 20 4f 42 4a 45 43 54 5f Length = OBJECT_
0900: 41 54 54 52 49 42 55 54 45 53 2e 73 69 7a 65 6f ATTRIBUTES.sizeo
0910: 66 3b 0a 09 48 41 4e 44 4c 45 20 20 20 20 20 20 f;..HANDLE
0920: 20 20 20 20 52 6f 6f 74 44 69 72 65 63 74 6f 72 RootDirector
0930: 79 3b 0a 09 50 55 4e 49 43 4f 44 45 5f 53 54 52 y;..PUNICODE_STR
0940: 49 4e 47 20 4f 62 6a 65 63 74 4e 61 6d 65 3b 0a ING ObjectName;.
0950: 09 55 4c 4f 4e 47 20 20 20 20 20 20 20 20 20 20 .ULONG
0960: 20 41 74 74 72 69 62 75 74 65 73 3b 0a 09 50 56 Attributes;..PV
0970: 4f 49 44 20 20 20 20 20 20 20 20 20 20 20 53 65 OID Se
0980: 63 75 72 69 74 79 44 65 73 63 72 69 70 74 6f 72 curityDescriptor
0990: 3b 0a 09 50 56 4f 49 44 20 20 20 20 20 20 20 20 ;..PVOID
09a0: 20 20 20 53 65 63 75 72 69 74 79 51 75 61 6c 69 SecurityQuali
09b0: 74 79 4f 66 53 65 72 76 69 63 65 3b 0a 7d 0a 61 tyOfService;.}.a
09c0: 6c 69 61 73 20 4f 42 4a 45 43 54 5f 41 54 54 52 lias OBJECT_ATTR
09d0: 49 42 55 54 45 53 2a 20 50 4f 42 4a 45 43 54 5f IBUTES* POBJECT_
09e0: 41 54 54 52 49 42 55 54 45 53 3b 0a ATTRIBUTES;.