include: Add IProvideRuntimeContext and a few annotations.
[wine] / include / accctrl.h
1 /*
2  * Copyright (C) 2002 Alexandre Julliard
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #ifndef __WINE_ACCCTRL_H
20 #define __WINE_ACCCTRL_H
21
22 #include <wtypes.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 typedef enum _SE_OBJECT_TYPE
29 {
30     SE_UNKNOWN_OBJECT_TYPE = 0,
31     SE_FILE_OBJECT,
32     SE_SERVICE,
33     SE_PRINTER,
34     SE_REGISTRY_KEY,
35     SE_LMSHARE,
36     SE_KERNEL_OBJECT,
37     SE_WINDOW_OBJECT,
38     SE_DS_OBJECT,
39     SE_DS_OBJECT_ALL,
40     SE_PROVIDER_DEFINED_OBJECT,
41     SE_WMIGUID_OBJECT,
42     SE_REGISTRY_WOW64_32KEY
43 } SE_OBJECT_TYPE;
44
45 typedef enum _TRUSTEE_TYPE
46 {
47     TRUSTEE_IS_UNKNOWN,
48     TRUSTEE_IS_USER,
49     TRUSTEE_IS_GROUP,
50     TRUSTEE_IS_DOMAIN,
51     TRUSTEE_IS_ALIAS,
52     TRUSTEE_IS_WELL_KNOWN_GROUP,
53     TRUSTEE_IS_DELETED,
54     TRUSTEE_IS_INVALID,
55     TRUSTEE_IS_COMPUTER
56 } TRUSTEE_TYPE;
57
58 typedef enum _TRUSTEE_FORM
59 {
60     TRUSTEE_IS_SID,
61     TRUSTEE_IS_NAME,
62     TRUSTEE_BAD_FORM,
63     TRUSTEE_IS_OBJECTS_AND_SID,
64     TRUSTEE_IS_OBJECTS_AND_NAME
65 } TRUSTEE_FORM;
66
67 typedef enum _MULTIPLE_TRUSTEE_OPERATION
68 {
69     NO_MULTIPLE_TRUSTEE,
70     TRUSTEE_IS_IMPERSONATE,
71 } MULTIPLE_TRUSTEE_OPERATION;
72
73 typedef struct  _OBJECTS_AND_SID
74 {
75     DWORD   ObjectsPresent;
76     GUID    ObjectTypeGuid;
77     GUID    InheritedObjectTypeGuid;
78     SID    *pSid;
79 } OBJECTS_AND_SID, *POBJECTS_AND_SID;
80
81 typedef struct  _OBJECTS_AND_NAME_A
82 {
83     DWORD          ObjectsPresent;
84     SE_OBJECT_TYPE ObjectType;
85     LPSTR          ObjectTypeName;
86     LPSTR          InheritedObjectTypeName;
87     LPSTR          ptstrName;
88 } OBJECTS_AND_NAME_A, *POBJECTS_AND_NAME_A;
89
90 typedef struct  _OBJECTS_AND_NAME_W
91 {
92     DWORD          ObjectsPresent;
93     SE_OBJECT_TYPE ObjectType;
94     LPWSTR         ObjectTypeName;
95     LPWSTR         InheritedObjectTypeName;
96     LPWSTR         ptstrName;
97 } OBJECTS_AND_NAME_W, *POBJECTS_AND_NAME_W;
98
99 DECL_WINELIB_TYPE_AW(OBJECTS_AND_NAME_)
100 DECL_WINELIB_TYPE_AW(POBJECTS_AND_NAME_)
101
102 typedef struct _TRUSTEE_A
103 {
104     struct _TRUSTEE_A          *pMultipleTrustee;
105     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
106     TRUSTEE_FORM                TrusteeForm;
107     TRUSTEE_TYPE                TrusteeType;
108     LPSTR                       ptstrName;
109 } TRUSTEE_A, *PTRUSTEE_A, TRUSTEEA, *PTRUSTEEA;
110
111 typedef struct _TRUSTEE_W
112 {
113     struct _TRUSTEE_W          *pMultipleTrustee;
114     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
115     TRUSTEE_FORM                TrusteeForm;
116     TRUSTEE_TYPE                TrusteeType;
117     LPWSTR                      ptstrName;
118 } TRUSTEE_W, *PTRUSTEE_W, TRUSTEEW, *PTRUSTEEW;
119
120 DECL_WINELIB_TYPE_AW(TRUSTEE_)
121 DECL_WINELIB_TYPE_AW(PTRUSTEE_)
122 DECL_WINELIB_TYPE_AW(TRUSTEE)
123 DECL_WINELIB_TYPE_AW(PTRUSTEE)
124
125 typedef enum _ACCESS_MODE
126 {
127     NOT_USED_ACCESS = 0,
128     GRANT_ACCESS,
129     SET_ACCESS,
130     DENY_ACCESS,
131     REVOKE_ACCESS,
132     SET_AUDIT_SUCCESS,
133     SET_AUDIT_FAILURE
134 } ACCESS_MODE;
135
136 #define NO_INHERITANCE                      0x0
137 #define SUB_OBJECTS_ONLY_INHERIT            0x1
138 #define SUB_CONTAINERS_ONLY_INHERIT         0x2
139 #define SUB_CONTAINERS_AND_OBJECTS_INHERIT  0x3
140 #define INHERIT_NO_PROPAGATE                0x4
141 #define INHERIT_ONLY                        0x8
142 #define INHERITED_ACCESS_ENTRY              0x10
143 #define INHERITED_PARENT                    0x10000000
144 #define INHERITED_GRANDPARENT               0x20000000
145
146 typedef struct _EXPLICIT_ACCESS_A
147 {
148     DWORD        grfAccessPermissions;
149     ACCESS_MODE  grfAccessMode;
150     DWORD        grfInheritance;
151     TRUSTEE_A    Trustee;
152 } EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A, EXPLICIT_ACCESSA, *PEXPLICIT_ACCESSA;
153
154 typedef struct _EXPLICIT_ACCESS_W
155 {
156     DWORD        grfAccessPermissions;
157     ACCESS_MODE  grfAccessMode;
158     DWORD        grfInheritance;
159     TRUSTEE_W    Trustee;
160 } EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W, EXPLICIT_ACCESSW, *PEXPLICIT_ACCESSW;
161
162 DECL_WINELIB_TYPE_AW(EXPLICIT_ACCESS_)
163 DECL_WINELIB_TYPE_AW(PEXPLICIT_ACCESS_)
164 DECL_WINELIB_TYPE_AW(EXPLICIT_ACCESS)
165 DECL_WINELIB_TYPE_AW(PEXPLICIT_ACCESS)
166
167 typedef ULONG ACCESS_RIGHTS, *PACCESS_RIGHTS;
168 typedef ULONG INHERIT_FLAGS, *PINHERIT_FLAGS;
169
170 typedef struct _ACTRL_ACCESS_ENTRYA
171 {
172     TRUSTEE_A     Trustee;
173     ULONG         fAccessFlags;
174     ACCESS_RIGHTS Access;
175     ACCESS_RIGHTS ProvSpecificAccess;
176     INHERIT_FLAGS Inheritance;
177     LPSTR         lpInheritProperty;
178 } ACTRL_ACCESS_ENTRYA, *PACTRL_ACCESS_ENTRYA;
179
180 typedef struct _ACTRL_ACCESS_ENTRYW
181 {
182     TRUSTEE_W     Trustee;
183     ULONG         fAccessFlags;
184     ACCESS_RIGHTS Access;
185     ACCESS_RIGHTS ProvSpecificAccess;
186     INHERIT_FLAGS Inheritance;
187     LPWSTR        lpInheritProperty;
188 } ACTRL_ACCESS_ENTRYW, *PACTRL_ACCESS_ENTRYW;
189
190 DECL_WINELIB_TYPE_AW(ACTRL_ACCESS_ENTRY)
191 DECL_WINELIB_TYPE_AW(PACTRL_ACCESS_ENTRY)
192
193
194 typedef struct _ACTRL_ACCESS_ENTRY_LISTA
195 {
196     ULONG                cEntries;
197     ACTRL_ACCESS_ENTRYA *pAccessList;
198 } ACTRL_ACCESS_ENTRY_LISTA, *PACTRL_ACCESS_ENTRY_LISTA;
199
200 typedef struct _ACTRL_ACCESS_ENTRY_LISTW
201 {
202     ULONG                cEntries;
203     ACTRL_ACCESS_ENTRYW *pAccessList;
204 } ACTRL_ACCESS_ENTRY_LISTW, *PACTRL_ACCESS_ENTRY_LISTW;
205
206 DECL_WINELIB_TYPE_AW(ACTRL_ACCESS_ENTRY_LIST)
207 DECL_WINELIB_TYPE_AW(PACTRL_ACCESS_ENTRY_LIST)
208
209 typedef struct _ACTRL_PROPERTY_ENTRYA
210 {
211     LPSTR                     lpProperty;
212     PACTRL_ACCESS_ENTRY_LISTA pAccessEntryList;
213     ULONG                     fListFlags;
214 } ACTRL_PROPERTY_ENTRYA, *PACTRL_PROPERTY_ENTRYA;
215
216 typedef struct _ACTRL_PROPERTY_ENTRYW
217 {
218     LPWSTR                    lpProperty;
219     PACTRL_ACCESS_ENTRY_LISTW pAccessEntryList;
220     ULONG                     fListFlags;
221 } ACTRL_PROPERTY_ENTRYW, *PACTRL_PROPERTY_ENTRYW;
222
223 DECL_WINELIB_TYPE_AW(ACTRL_PROPERTY_ENTRY)
224 DECL_WINELIB_TYPE_AW(PACTRL_PROPERTY_ENTRY)
225
226 typedef struct _ACTRL_ALISTA
227 {
228     ULONG                  cEntries;
229     PACTRL_PROPERTY_ENTRYA pPropertyAccessList;
230 } ACTRL_ACCESSA, *PACTRL_ACCESSA, ACTRL_AUDITA, *PACTRL_AUDITA;
231
232 typedef struct _ACTRL_ALISTW
233 {
234     ULONG                  cEntries;
235     PACTRL_PROPERTY_ENTRYW pPropertyAccessList;
236 } ACTRL_ACCESSW, *PACTRL_ACCESSW, ACTRL_AUDITW, *PACTRL_AUDITW;
237
238 DECL_WINELIB_TYPE_AW(ACTRL_ACCESS)
239 DECL_WINELIB_TYPE_AW(PACTRL_ACCESS)
240 DECL_WINELIB_TYPE_AW(ACTRL_AUDIT)
241 DECL_WINELIB_TYPE_AW(PACTRL_AUDIT)
242
243 #define TRUSTEE_ACCESS_ALLOWED      0x00000001
244 #define TRUSTEE_ACCESS_READ         0x00000002
245 #define TRUSTEE_ACCESS_WRITE        0x00000004
246
247 #define TRUSTEE_ACCESS_EXPLICIT     0x00000001
248 #define TRUSTEE_ACCESS_READ_WRITE   (TRUSTEE_ACCESS_READ|TRUSTEE_ACCESS_WRITE)
249 #define TRUSTEE_ACCESS_ALL          0xFFFFFFFF
250
251 typedef struct _TRUSTEE_ACCESSA
252 {
253     LPSTR         lpProperty;
254     ACCESS_RIGHTS Access;
255     ULONG         fAccessFlags;
256     ULONG         fReturnedAccess;
257 } TRUSTEE_ACCESSA, *PTRUSTEE_ACCESSA;
258
259 typedef struct _TRUSTEE_ACCESSW
260 {
261     LPWSTR        lpProperty;
262     ACCESS_RIGHTS Access;
263     ULONG         fAccessFlags;
264     ULONG         fReturnedAccess;
265 } TRUSTEE_ACCESSW, *PTRUSTEE_ACCESSW;
266
267 DECL_WINELIB_TYPE_AW(TRUSTEE_ACCESS)
268 DECL_WINELIB_TYPE_AW(PTRUSTEE_ACCESS)
269
270 #define ACTRL_RESERVED              0x00000000
271 #define ACTRL_PERM_1                0x00000001
272 #define ACTRL_PERM_2                0x00000002
273 #define ACTRL_PERM_3                0x00000004
274 #define ACTRL_PERM_4                0x00000008
275 #define ACTRL_PERM_5                0x00000010
276 #define ACTRL_PERM_6                0x00000020
277 #define ACTRL_PERM_7                0x00000040
278 #define ACTRL_PERM_8                0x00000080
279 #define ACTRL_PERM_9                0x00000100
280 #define ACTRL_PERM_10               0x00000200
281 #define ACTRL_PERM_11               0x00000400
282 #define ACTRL_PERM_12               0x00000800
283 #define ACTRL_PERM_13               0x00001000
284 #define ACTRL_PERM_14               0x00002000
285 #define ACTRL_PERM_15               0x00004000
286 #define ACTRL_PERM_16               0x00008000
287 #define ACTRL_PERM_17               0x00010000
288 #define ACTRL_PERM_18               0x00020000
289 #define ACTRL_PERM_19               0x00040000
290 #define ACTRL_PERM_20               0x00080000
291
292 #define ACTRL_ACCESS_ALLOWED        0x00000001
293 #define ACTRL_ACCESS_DENIED         0x00000002
294 #define ACTRL_AUDIT_SUCCESS         0x00000004
295 #define ACTRL_AUDIT_FAILURE         0x00000008
296
297 #define ACTRL_ACCESS_PROTECTED      0x00000001
298
299 #define ACTRL_SYSTEM_ACCESS         0x04000000
300 #define ACTRL_DELETE                0x08000000
301 #define ACTRL_READ_CONTROL          0x10000000
302 #define ACTRL_CHANGE_ACCESS         0x20000000
303 #define ACTRL_CHANGE_OWNER          0x40000000
304 #define ACTRL_SYNCHRONIZE           0x80000000
305 #define ACTRL_STD_RIGHTS_ALL        0xf8000000
306 #define ACTRL_STD_RIGHT_REQUIRED    (ACTRL_STD_RIGHTS_ALL & ~ACTRL_SYNCHRONIZE)
307
308 #define ACTRL_DS_OPEN               ACTRL_RESERVED
309 #define ACTRL_DS_CREATE_CHILD       ACTRL_PERM_1
310 #define ACTRL_DS_DELETE_CHILD       ACTRL_PERM_2
311 #define ACTRL_DS_LIST               ACTRL_PERM_3
312 #define ACTRL_DS_SELF               ACTRL_PERM_4
313 #define ACTRL_DS_READ_PROP          ACTRL_PERM_5
314 #define ACTRL_DS_WRITE_PROP         ACTRL_PERM_6
315 #define ACTRL_DS_DELETE_TREE        ACTRL_PERM_7
316 #define ACTRL_DS_LIST_OBJECT        ACTRL_PERM_8
317 #define ACTRL_DS_CONTROL_ACCESS     ACTRL_PERM_9
318
319 #define ACTRL_FILE_READ             ACTRL_PERM_1
320 #define ACTRL_FILE_WRITE            ACTRL_PERM_2
321 #define ACTRL_FILE_APPEND           ACTRL_PERM_3
322 #define ACTRL_FILE_READ_PROP        ACTRL_PERM_4
323 #define ACTRL_FILE_WRITE_PROP       ACTRL_PERM_5
324 #define ACTRL_FILE_EXECUTE          ACTRL_PERM_6
325 #define ACTRL_FILE_READ_ATTRIB      ACTRL_PERM_8
326 #define ACTRL_FILE_WRITE_ATTRIB     ACTRL_PERM_9
327 #define ACTRL_FILE_CREATE_PIPE      ACTRL_PERM_10
328 #define ACTRL_DIR_LIST              ACTRL_PERM_1
329 #define ACTRL_DIR_CREATE_OBJECT     ACTRL_PERM_2
330 #define ACTRL_DIR_CREATE_CHILD      ACTRL_PERM_3
331 #define ACTRL_DIR_DELETE_CHILD      ACTRL_PERM_7
332 #define ACTRL_DIR_TRAVERSE          ACTRL_PERM_6
333 #define ACTRL_KERNEL_TERMINATE      ACTRL_PERM_1
334 #define ACTRL_KERNEL_THREAD         ACTRL_PERM_2
335 #define ACTRL_KERNEL_VM             ACTRL_PERM_3
336 #define ACTRL_KERNEL_VM_READ        ACTRL_PERM_4
337 #define ACTRL_KERNEL_VM_WRITE       ACTRL_PERM_5
338 #define ACTRL_KERNEL_DUP_HANDLE     ACTRL_PERM_6
339 #define ACTRL_KERNEL_PROCESS        ACTRL_PERM_7
340 #define ACTRL_KERNEL_SET_INFO       ACTRL_PERM_8
341 #define ACTRL_KERNEL_GET_INFO       ACTRL_PERM_9
342 #define ACTRL_KERNEL_CONTROL        ACTRL_PERM_10
343 #define ACTRL_KERNEL_ALERT          ACTRL_PERM_11
344 #define ACTRL_KERNEL_GET_CONTEXT    ACTRL_PERM_12
345 #define ACTRL_KERNEL_SET_CONTEXT    ACTRL_PERM_13
346 #define ACTRL_KERNEL_TOKEN          ACTRL_PERM_14
347 #define ACTRL_KERNEL_IMPERSONATE    ACTRL_PERM_15
348 #define ACTRL_KERNEL_DIMPERSONATE   ACTRL_PERM_16
349 #define ACTRL_PRINT_SADMIN          ACTRL_PERM_1
350 #define ACTRL_PRINT_SLIST           ACTRL_PERM_2
351 #define ACTRL_PRINT_PADMIN          ACTRL_PERM_3
352 #define ACTRL_PRINT_PUSE            ACTRL_PERM_4
353 #define ACTRL_PRINT_JADMIN          ACTRL_PERM_5
354 #define ACTRL_SVC_GET_INFO          ACTRL_PERM_1
355 #define ACTRL_SVC_SET_INFO          ACTRL_PERM_2
356 #define ACTRL_SVC_STATUS            ACTRL_PERM_3
357 #define ACTRL_SVC_LIST              ACTRL_PERM_4
358 #define ACTRL_SVC_START             ACTRL_PERM_5
359 #define ACTRL_SVC_STOP              ACTRL_PERM_6
360 #define ACTRL_SVC_PAUSE             ACTRL_PERM_7
361 #define ACTRL_SVC_INTERROGATE       ACTRL_PERM_8
362 #define ACTRL_SVC_UCONTROL          ACTRL_PERM_9
363 #define ACTRL_REG_QUERY             ACTRL_PERM_1
364 #define ACTRL_REG_SET               ACTRL_PERM_2
365 #define ACTRL_REG_CREATE_CHILD      ACTRL_PERM_3
366 #define ACTRL_REG_LIST              ACTRL_PERM_4
367 #define ACTRL_REG_NOTIFY            ACTRL_PERM_5
368 #define ACTRL_REG_LINK              ACTRL_PERM_6
369 #define ACTRL_WIN_CLIPBRD           ACTRL_PERM_1
370 #define ACTRL_WIN_GLOBAL_ATOMS      ACTRL_PERM_2
371 #define ACTRL_WIN_CREATE            ACTRL_PERM_3
372 #define ACTRL_WIN_LIST_DESK         ACTRL_PERM_4
373 #define ACTRL_WIN_LIST              ACTRL_PERM_5
374 #define ACTRL_WIN_READ_ATTRIBS      ACTRL_PERM_6
375 #define ACTRL_WIN_WRITE_ATTRIBS     ACTRL_PERM_7
376 #define ACTRL_WIN_SCREEN            ACTRL_PERM_8
377 #define ACTRL_WIN_EXIT              ACTRL_PERM_9
378
379 #define ACTRL_ACCESS_NO_OPTIONS                 0x00000000
380 #define ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES    0x00000001
381
382 typedef struct _ACTRL_OVERLAPPED
383 {
384     union {
385         PVOID Provider;
386         ULONG Reserved1;
387     } DUMMYUNIONNAME;
388     ULONG  Reserved2;
389     HANDLE hEvent;
390 } ACTRL_OVERLAPPED, *PACTRL_OVERLAPPED;
391
392 typedef struct _ACTRL_ACCESS_INFOA
393 {
394     ULONG  fAccessPermission;
395     LPSTR  lpAccessPermissionName;
396 } ACTRL_ACCESS_INFOA, *PACTRL_ACCESS_INFOA;
397
398 typedef struct _ACTRL_ACCESS_INFOW
399 {
400     ULONG  fAccessPermission;
401     LPWSTR lpAccessPermissionName;
402 } ACTRL_ACCESS_INFOW, *PACTRL_ACCESS_INFOW;
403
404 DECL_WINELIB_TYPE_AW(ACTRL_ACCESS_INFO)
405 DECL_WINELIB_TYPE_AW(PACTRL_ACCESS_INFO)
406
407 typedef struct _ACTRL_CONTROL_INFOA
408 {
409     LPSTR  lpControlId;
410     LPSTR  lpControlName;
411 } ACTRL_CONTROL_INFOA, *PACTRL_CONTROL_INFOA;
412
413 typedef struct _ACTRL_CONTROL_INFOW
414 {
415     LPWSTR lpControlId;
416     LPWSTR lpControlName;
417 } ACTRL_CONTROL_INFOW, *PACTRL_CONTROL_INFOW;
418
419 DECL_WINELIB_TYPE_AW(ACTRL_CONTROL_INFO)
420 DECL_WINELIB_TYPE_AW(PACTRL_CONTROL_INFO)
421
422 typedef enum _PROGRESS_INVOKE_SETTING {
423     ProgressInvokeNever = 1,
424     ProgressInvokeEveryObject,
425     ProgressInvokeOnError,
426     ProgressCancelOperation,
427     ProgressRetryOperation
428 } PROG_INVOKE_SETTING, *PPROG_INVOKE_SETTING;
429
430 typedef struct _INHERITED_FROMA
431 {
432     LONG   GenerationGap;
433     LPSTR  AncestorName;
434 } INHERITED_FROMA, *PINHERITED_FROMA;
435
436 typedef struct _INHERITED_FROMW
437 {
438     LONG   GenerationGap;
439     LPWSTR AncestorName;
440 } INHERITED_FROMW, *PINHERITED_FROMW;
441
442 DECL_WINELIB_TYPE_AW(INHERITED_FROM)
443 DECL_WINELIB_TYPE_AW(PINHERITED_FROM)
444
445 #define AccFree LocalFree
446
447 #ifdef __cplusplus
448 }
449 #endif
450
451 #endif /* __WINE_ACCCTRL_H */