xref: /reactos/dll/win32/aclui/precomp.h (revision c2c66aff)
1 #ifndef _ACLUI_PCH_
2 #define _ACLUI_PCH_
3 
4 #define _ACLUI_
5 
6 #include <stdarg.h>
7 
8 #define WIN32_NO_STATUS
9 #define _INC_WINDOWS
10 #define COM_NO_WINDOWS_H
11 
12 #include <windef.h>
13 #include <winbase.h>
14 #include <wingdi.h>
15 #include <ole2.h>
16 #include <objsel.h>
17 #include <aclui.h>
18 #define NTOS_MODE_USER
19 #include <ndk/rtlfuncs.h>
20 
21 #define EnableRedrawWindow(hwnd) \
22     SendMessage((hwnd), WM_SETREDRAW, TRUE, 0)
23 
24 #define DisableRedrawWindow(hwnd) \
25     SendMessage((hwnd), WM_SETREDRAW, FALSE, 0)
26 
27 extern HINSTANCE hDllInstance;
28 
29 typedef struct _ACE_ENTRY
30 {
31     struct _ACE_ENTRY *Next;
32 } ACE_ENTRY, *PACE_ENTRY;
33 
34 typedef struct _PRINCIPAL_LISTITEM
35 {
36     struct _PRINCIPAL_LISTITEM *Next;
37     struct _SIDREQRESULT *SidReqResult;
38     PACE_ENTRY ACEs;
39     LPWSTR DisplayString;
40 } PRINCIPAL_LISTITEM, *PPRINCIPAL_LISTITEM;
41 
42 typedef struct _SECURITY_PAGE
43 {
44     HWND hWnd;
45     HWND hBtnAdd;
46     HWND hBtnRemove;
47     HWND hBtnAdvanced;
48     HWND hAceCheckList;
49     HWND hPermissionsForLabel;
50 
51     /* Main Principals List */
52     HWND hWndPrincipalsList;
53     PPRINCIPAL_LISTITEM PrincipalsListHead;
54 
55     PSID OwnerSid;
56     BOOL OwnerDefaulted;
57 
58     INT ControlsMargin;
59 
60     INT SpecialPermCheckIndex;
61 
62     HIMAGELIST hiPrincipals;
63 
64     LPSECURITYINFO psi;
65     SI_OBJECT_INFO ObjectInfo;
66     IDsObjectPicker *pDsObjectPicker;
67 
68     SI_ACCESS DefaultAccess;
69 
70     HANDLE SidCacheMgr;
71     LONG SidLookupsPending;
72     UINT Initializing : 1;
73 
74     LPCWSTR ServerName;
75 } SECURITY_PAGE, *PSECURITY_PAGE;
76 
77 /* MISC ***********************************************************************/
78 
79 DWORD
80 LoadAndFormatString(IN HINSTANCE hInstance,
81                     IN UINT uID,
82                     OUT LPWSTR *lpTarget,
83                     ...);
84 
85 LPARAM
86 ListViewGetSelectedItemData(IN HWND hwnd);
87 
88 BOOL
89 ListViewSelectItem(IN HWND hwnd,
90                    IN INT Index);
91 
92 HRESULT
93 InitializeObjectPicker(IN PCWSTR ServerName,
94                        IN PSI_OBJECT_INFO ObjectInfo,
95                        OUT IDsObjectPicker **pDsObjectPicker);
96 
97 VOID
98 FreeObjectPicker(IN IDsObjectPicker *pDsObjectPicker);
99 
100 typedef BOOL (*POBJPICK_SELECTED_SID)(IN IDsObjectPicker *pDsObjectPicker,
101                                       IN HWND hwndParent  OPTIONAL,
102                                       IN PSID pSid,
103                                       IN PVOID Context  OPTIONAL);
104 
105 HRESULT
106 InvokeObjectPickerDialog(IN IDsObjectPicker *pDsObjectPicker,
107                          IN HWND hwndParent  OPTIONAL,
108                          IN POBJPICK_SELECTED_SID SelectedSidCallback,
109                          IN PVOID Context  OPTIONAL);
110 
111 /* CHECKLIST CONTROL **********************************************************/
112 
113 #define CIS_DENYDISABLED        (0x8)
114 #define CIS_DENYENABLED (0x0)
115 #define CIS_ALLOWDISABLED       (0x4)
116 #define CIS_ALLOWENABLED        (0x0)
117 #define CIS_ALLOW       (0x2)
118 #define CIS_DENY        (0x1)
119 #define CIS_NONE        (0x0)
120 #define CIS_DISABLED    (CIS_ALLOWDISABLED | CIS_DENYDISABLED)
121 
122 #define CLB_ALLOW       (0x1)
123 #define CLB_DENY        (0x0)
124 
125 #define CIS_MASK (CIS_DISABLED | CIS_ALLOW | CIS_DENY)
126 
127 #define CLM_ADDITEM     (WM_USER + 1)
128 #define CLM_DELITEM     (WM_USER + 2)
129 #define CLM_GETITEMCOUNT        (WM_USER + 3)
130 #define CLM_CLEAR       (WM_USER + 4)
131 #define CLM_SETCHECKBOXCOLUMN   (WM_USER + 5)
132 #define CLM_GETCHECKBOXCOLUMN   (WM_USER + 6)
133 #define CLM_CLEARCHECKBOXES     (WM_USER + 7)
134 #define CLM_SETITEMSTATE        (WM_USER + 8)
135 #define CLM_ENABLEQUICKSEARCH   (WM_USER + 9)
136 #define CLM_SETQUICKSEARCH_TIMEOUT_RESET        (WM_USER + 10)
137 #define CLM_SETQUICKSEARCH_TIMEOUT_SETFOCUS     (WM_USER + 11)
138 #define CLM_FINDITEMBYACCESSMASK    (WM_USER + 12)
139 
140 #define CLN_CHANGINGITEMCHECKBOX        (101)
141 
142 typedef struct _NMCHANGEITEMCHECKBOX
143 {
144     NMHDR nmhdr;
145     DWORD OldState;
146     DWORD NewState;
147     DWORD CheckBox;
148     BOOL Checked;
149 } NMCHANGEITEMCHECKBOX, *PNMCHANGEITEMCHECKBOX;
150 
151 BOOL
152 RegisterCheckListControl(HINSTANCE hInstance);
153 
154 VOID
155 UnregisterCheckListControl(HINSTANCE hInstance);
156 
157 /* DLLMAIN ********************************************************************/
158 
159 BOOL
160 WINAPI
161 DllMain(IN HINSTANCE hinstDLL,
162         IN DWORD dwReason,
163         IN LPVOID lpvReserved);
164 
165 /* SIDCACHE *******************************************************************/
166 
167 typedef struct _SIDREQRESULT
168 {
169     LONG RefCount;
170     SID_NAME_USE SidNameUse;
171     LPWSTR AccountName;
172     LPWSTR DomainName;
173 } SIDREQRESULT, *PSIDREQRESULT;
174 
175 typedef VOID (*PSIDREQCOMPLETIONPROC)(IN HANDLE SidCacheMgr,
176                                       IN PSID Sid,
177                                       IN PSIDREQRESULT SidRequestResult,
178                                       IN PVOID Context);
179 
180 HANDLE
181 CreateSidCacheMgr(IN HANDLE Heap,
182                   IN LPCWSTR SystemName);
183 
184 VOID
185 DestroySidCacheMgr(IN HANDLE SidCacheMgr);
186 
187 VOID
188 DequeueSidLookup(IN HANDLE SidCacheMgr,
189                  IN PSID pSid);
190 
191 BOOL
192 LookupSidCache(IN HANDLE SidCacheMgr,
193                IN PSID pSid,
194                IN PSIDREQCOMPLETIONPROC CompletionProc,
195                IN PVOID Context);
196 
197 VOID
198 ReferenceSidReqResult(IN HANDLE SidCacheMgr,
199                       IN PSIDREQRESULT ReqResult);
200 
201 VOID
202 DereferenceSidReqResult(IN HANDLE SidCacheMgr,
203                         IN PSIDREQRESULT ReqResult);
204 
205 #endif /* _ACLUI_PCH_ */
206