1 /***********************************************************************\
2 *                                aclui.d                                *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *             Translated from MinGW API for MS-Windows 3.10             *
7 *                           by Stewart Gordon                           *
8 *                                                                       *
9 *                       Placed into public domain                       *
10 \***********************************************************************/
11 module win32.aclui;
12 version(Windows):
13 pragma(lib, "aclui");
14 
15 private import win32.w32api;
16 
17 static assert (_WIN32_WINNT >= 0x500,
18 	"win32.aclui is available only if version Windows2000, WindowsXP, Windows2003 "
19 	"or WindowsVista is set");
20 
21 import win32.accctrl, win32.commctrl, win32.objbase;
22 private import win32.basetyps, win32.prsht, win32.unknwn, win32.windef,
23   win32.winuser;
24 
25 
26 struct SI_OBJECT_INFO {
27 	DWORD     dwFlags;
28 	HINSTANCE hInstance;
29 	LPWSTR    pszServerName;
30 	LPWSTR    pszObjectName;
31 	LPWSTR    pszPageTitle;
32 	GUID      guidObjectType;
33 }
34 alias SI_OBJECT_INFO* PSI_OBJECT_INFO;
35 
36 // values for SI_OBJECT_INFO.dwFlags
37 const DWORD
38 	SI_EDIT_PERMS               = 0x00000000,
39 	SI_EDIT_OWNER               = 0x00000001,
40 	SI_EDIT_AUDITS              = 0x00000002,
41 	SI_CONTAINER                = 0x00000004,
42 	SI_READONLY                 = 0x00000008,
43 	SI_ADVANCED                 = 0x00000010,
44 	SI_RESET                    = 0x00000020,
45 	SI_OWNER_READONLY           = 0x00000040,
46 	SI_EDIT_PROPERTIES          = 0x00000080,
47 	SI_OWNER_RECURSE            = 0x00000100,
48 	SI_NO_ACL_PROTECT           = 0x00000200,
49 	SI_NO_TREE_APPLY            = 0x00000400,
50 	SI_PAGE_TITLE               = 0x00000800,
51 	SI_SERVER_IS_DC             = 0x00001000,
52 	SI_RESET_DACL_TREE          = 0x00004000,
53 	SI_RESET_SACL_TREE          = 0x00008000,
54 	SI_OBJECT_GUID              = 0x00010000,
55 	SI_EDIT_EFFECTIVE           = 0x00020000,
56 	SI_RESET_DACL               = 0x00040000,
57 	SI_RESET_SACL               = 0x00080000,
58 	SI_RESET_OWNER              = 0x00100000,
59 	SI_NO_ADDITIONAL_PERMISSION = 0x00200000,
60 	SI_MAY_WRITE                = 0x10000000,
61 	SI_EDIT_ALL                 = SI_EDIT_PERMS | SI_EDIT_OWNER
62 	                              | SI_EDIT_AUDITS;
63 
64 struct SI_ACCESS {
65 	const(GUID)* pguid;
66 	ACCESS_MASK  mask;
67 	LPCWSTR      pszName;
68 	DWORD        dwFlags;
69 }
70 alias SI_ACCESS* PSI_ACCESS;
71 
72 // values for SI_ACCESS.dwFlags
73 const DWORD
74 	SI_ACCESS_SPECIFIC  = 0x00010000,
75 	SI_ACCESS_GENERAL   = 0x00020000,
76 	SI_ACCESS_CONTAINER = 0x00040000,
77 	SI_ACCESS_PROPERTY  = 0x00080000;
78 
79 
80 struct SI_INHERIT_TYPE {
81 	const(GUID)* pguid;
82 	ULONG        dwFlags;
83 	LPCWSTR      pszName;
84 }
85 alias SI_INHERIT_TYPE* PSI_INHERIT_TYPE;
86 
87 /* values for SI_INHERIT_TYPE.dwFlags
88    INHERIT_ONLY_ACE, CONTAINER_INHERIT_ACE, OBJECT_INHERIT_ACE
89    defined elsewhere */
90 
91 enum SI_PAGE_TYPE {
92 	SI_PAGE_PERM,
93 	SI_PAGE_ADVPERM,
94 	SI_PAGE_AUDIT,
95 	SI_PAGE_OWNER
96 }
97 
98 const uint PSPCB_SI_INITDIALOG = WM_USER + 1;
99 
100 interface ISecurityInformation : IUnknown {
101 	HRESULT GetObjectInformation(PSI_OBJECT_INFO);
102 	HRESULT GetSecurity(SECURITY_INFORMATION, PSECURITY_DESCRIPTOR*, BOOL);
103 	HRESULT SetSecurity(SECURITY_INFORMATION, PSECURITY_DESCRIPTOR);
104 	HRESULT GetAccessRights(const(GUID)*, DWORD, PSI_ACCESS*, ULONG*, ULONG*);
105 	HRESULT MapGeneric(const(GUID)*, UCHAR*, ACCESS_MASK*);
106 	HRESULT GetInheritTypes(PSI_INHERIT_TYPE*, ULONG*);
107 	HRESULT PropertySheetPageCallback(HWND, UINT, SI_PAGE_TYPE);
108 }
109 alias ISecurityInformation LPSECURITYINFO;
110 
111 /* Comment from MinGW
112  * TODO: ISecurityInformation2, IEffectivePermission, ISecurityObjectTypeInfo
113  */
114 
115 // FIXME: linkage attribute?
116 extern (C) /+DECLSPEC_IMPORT+/ extern const IID IID_ISecurityInformation;
117 
118 extern (Windows) {
119 	HPROPSHEETPAGE CreateSecurityPage(LPSECURITYINFO psi);
120 	BOOL EditSecurity(HWND hwndOwner, LPSECURITYINFO psi);
121 }