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