1 /**
2  * Windows API header module
3  *
4  * Translated from MinGW Windows headers
5  *
6  * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
7  * Source: $(DRUNTIMESRC core/sys/windows/_secext.d)
8  */
9 // Don't include this file directly, use win32.security instead.
10 /// Automatically imported and edited from the druntime module
11 /// core.sys.windows.secext for the auto-generated win32 package.
12 module win32.secext;
13 //version (Windows):
14 @system:
15 
16 version (ANSI) {} else version = Unicode;
17 version (Win32_UseLib) pragma(lib, "secur32");
18 
19 import win32.w32api, win32.windef;
20 
21 static assert (_WIN32_WINNT >= 0x501,
22   "SecExt is only available on WindowsXP and later");
23 
24 enum EXTENDED_NAME_FORMAT {
25     NameUnknown,
26     NameFullyQualifiedDN,
27     NameSamCompatible,
28     NameDisplay,          // =  3
29     NameUniqueId             =  6,
30     NameCanonical,
31     NameUserPrincipal,
32     NameCanonicalEx,
33     NameServicePrincipal, // = 10
34     NameDnsDomain            = 12
35 }
36 alias EXTENDED_NAME_FORMAT* PEXTENDED_NAME_FORMAT;
37 
38 extern (Windows) {
39     BOOLEAN GetComputerObjectNameA(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
40     BOOLEAN GetComputerObjectNameW(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
41     BOOLEAN GetUserNameExA(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
42     BOOLEAN GetUserNameExW(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
43     BOOLEAN TranslateNameA(LPCSTR, EXTENDED_NAME_FORMAT,
44       EXTENDED_NAME_FORMAT, LPSTR, PULONG);
45     BOOLEAN TranslateNameW(LPCWSTR, EXTENDED_NAME_FORMAT,
46       EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
47 }
48 
49 version (Unicode) {
50     alias GetComputerObjectNameW GetComputerObjectName;
51     alias GetUserNameExW GetUserNameEx;
52     alias TranslateNameW TranslateName;
53 } else {
54     alias GetComputerObjectNameA GetComputerObjectName;
55     alias GetUserNameExA GetUserNameEx;
56     alias TranslateNameA TranslateName;
57 }