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