1 /***********************************************************************\
2 *                                secext.d                               *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 // Don't include this file directly, use win32.security instead.
11 module win32.secext;
12 pragma(lib, "secur32.lib");
13 
14 private import win32.w32api, win32.windef;
15 
16 static assert (_WIN32_WINNT >= 0x0501,
17   "SecExt is only available on WindowsXP and later");
18 
19 enum EXTENDED_NAME_FORMAT {
20 	NameUnknown,
21 	NameFullyQualifiedDN,
22 	NameSamCompatible,
23 	NameDisplay,          // =  3
24 	NameUniqueId             =  6,
25 	NameCanonical,
26 	NameUserPrincipal,
27 	NameCanonicalEx,
28 	NameServicePrincipal, // = 10
29 	NameDnsDomain            = 12
30 }
31 alias EXTENDED_NAME_FORMAT* PEXTENDED_NAME_FORMAT;
32 
33 extern (Windows) {
34 	BOOLEAN GetComputerObjectNameA(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
35 	BOOLEAN GetComputerObjectNameW(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
36 	BOOLEAN GetUserNameExA(EXTENDED_NAME_FORMAT, LPSTR, PULONG);
37 	BOOLEAN GetUserNameExW(EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
38 	BOOLEAN TranslateNameA(LPCSTR, EXTENDED_NAME_FORMAT,
39 	  EXTENDED_NAME_FORMAT, LPSTR, PULONG);
40 	BOOLEAN TranslateNameW(LPCWSTR, EXTENDED_NAME_FORMAT,
41 	  EXTENDED_NAME_FORMAT, LPWSTR, PULONG);
42 }
43 
44 version (Unicode) {
45 	alias GetComputerObjectNameW GetComputerObjectName;
46 	alias GetUserNameExW GetUserNameEx;
47 	alias TranslateNameW TranslateName;
48 } else {
49 	alias GetComputerObjectNameA GetComputerObjectName;
50 	alias GetUserNameExA GetUserNameEx;
51 	alias TranslateNameA TranslateName;
52 }