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