1 /** 2 * Windows API header module 3 * 4 * Translated from MinGW Windows headers 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/_accctrl.d) 9 */ 10 module core.sys.windows.accctrl; 11 version (Windows): 12 13 version (ANSI) {} else version = Unicode; 14 15 import core.sys.windows.basetyps, core.sys.windows.w32api, core.sys.windows.winbase, core.sys.windows.windef; 16 17 // FIXME: check types and grouping of constants 18 // FIXME: check Windows version support 19 20 alias LocalFree AccFree; 21 22 enum uint 23 ACTRL_RESERVED = 0x00000000, 24 ACTRL_ACCESS_PROTECTED = 0x00000001, 25 ACTRL_ACCESS_ALLOWED = 0x00000001, 26 ACTRL_ACCESS_DENIED = 0x00000002, 27 ACTRL_AUDIT_SUCCESS = 0x00000004, 28 ACTRL_AUDIT_FAILURE = 0x00000008, 29 ACTRL_SYSTEM_ACCESS = 0x04000000, 30 ACTRL_DELETE = 0x08000000, 31 ACTRL_READ_CONTROL = 0x10000000, 32 ACTRL_CHANGE_ACCESS = 0x20000000, 33 ACTRL_CHANGE_OWNER = 0x40000000, 34 ACTRL_SYNCHRONIZE = 0x80000000, 35 ACTRL_STD_RIGHTS_ALL = 0xf8000000; 36 37 enum uint 38 ACTRL_FILE_READ = 0x00000001, 39 ACTRL_FILE_WRITE = 0x00000002, 40 ACTRL_FILE_APPEND = 0x00000004, 41 ACTRL_FILE_READ_PROP = 0x00000008, 42 ACTRL_FILE_WRITE_PROP = 0x00000010, 43 ACTRL_FILE_EXECUTE = 0x00000020, 44 ACTRL_FILE_READ_ATTRIB = 0x00000080, 45 ACTRL_FILE_WRITE_ATTRIB = 0x00000100, 46 ACTRL_FILE_CREATE_PIPE = 0x00000200; 47 48 enum uint 49 ACTRL_DIR_LIST = 0x00000001, 50 ACTRL_DIR_CREATE_OBJECT = 0x00000002, 51 ACTRL_DIR_CREATE_CHILD = 0x00000004, 52 ACTRL_DIR_DELETE_CHILD = 0x00000040, 53 ACTRL_DIR_TRAVERSE = 0x00000020; 54 55 enum uint 56 ACTRL_KERNEL_TERMINATE = 0x00000001, 57 ACTRL_KERNEL_THREAD = 0x00000002, 58 ACTRL_KERNEL_VM = 0x00000004, 59 ACTRL_KERNEL_VM_READ = 0x00000008, 60 ACTRL_KERNEL_VM_WRITE = 0x00000010, 61 ACTRL_KERNEL_DUP_HANDLE = 0x00000020, 62 ACTRL_KERNEL_PROCESS = 0x00000040, 63 ACTRL_KERNEL_SET_INFO = 0x00000080, 64 ACTRL_KERNEL_GET_INFO = 0x00000100, 65 ACTRL_KERNEL_CONTROL = 0x00000200, 66 ACTRL_KERNEL_ALERT = 0x00000400, 67 ACTRL_KERNEL_GET_CONTEXT = 0x00000800, 68 ACTRL_KERNEL_SET_CONTEXT = 0x00001000, 69 ACTRL_KERNEL_TOKEN = 0x00002000, 70 ACTRL_KERNEL_IMPERSONATE = 0x00004000, 71 ACTRL_KERNEL_DIMPERSONATE = 0x00008000; 72 73 enum uint 74 ACTRL_PRINT_SADMIN = 0x00000001, 75 ACTRL_PRINT_SLIST = 0x00000002, 76 ACTRL_PRINT_PADMIN = 0x00000004, 77 ACTRL_PRINT_PUSE = 0x00000008, 78 ACTRL_PRINT_JADMIN = 0x00000010; 79 80 enum uint 81 ACTRL_SVC_GET_INFO = 0x00000001, 82 ACTRL_SVC_SET_INFO = 0x00000002, 83 ACTRL_SVC_STATUS = 0x00000004, 84 ACTRL_SVC_LIST = 0x00000008, 85 ACTRL_SVC_START = 0x00000010, 86 ACTRL_SVC_STOP = 0x00000020, 87 ACTRL_SVC_PAUSE = 0x00000040, 88 ACTRL_SVC_INTERROGATE = 0x00000080, 89 ACTRL_SVC_UCONTROL = 0x00000100; 90 91 enum uint 92 ACTRL_REG_QUERY = 0x00000001, 93 ACTRL_REG_SET = 0x00000002, 94 ACTRL_REG_CREATE_CHILD = 0x00000004, 95 ACTRL_REG_LIST = 0x00000008, 96 ACTRL_REG_NOTIFY = 0x00000010, 97 ACTRL_REG_LINK = 0x00000020; 98 99 enum uint 100 ACTRL_WIN_CLIPBRD = 0x00000001, 101 ACTRL_WIN_GLOBAL_ATOMS = 0x00000002, 102 ACTRL_WIN_CREATE = 0x00000004, 103 ACTRL_WIN_LIST_DESK = 0x00000008, 104 ACTRL_WIN_LIST = 0x00000010, 105 ACTRL_WIN_READ_ATTRIBS = 0x00000020, 106 ACTRL_WIN_WRITE_ATTRIBS = 0x00000040, 107 ACTRL_WIN_SCREEN = 0x00000080, 108 ACTRL_WIN_EXIT = 0x00000100; 109 110 enum : uint { 111 ACTRL_ACCESS_NO_OPTIONS = 0x00000000, 112 ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES = 0x00000001 113 } 114 115 const TCHAR[] ACCCTRL_DEFAULT_PROVIDER = "Windows NT Access Provider"; 116 117 enum uint 118 TRUSTEE_ACCESS_ALLOWED = 0x00000001, 119 TRUSTEE_ACCESS_READ = 0x00000002, 120 TRUSTEE_ACCESS_WRITE = 0x00000004, 121 TRUSTEE_ACCESS_EXPLICIT = 0x00000001, 122 TRUSTEE_ACCESS_READ_WRITE = 0x00000006, 123 TRUSTEE_ACCESS_ALL = 0xFFFFFFFF; 124 125 enum uint 126 NO_INHERITANCE = 0x0, 127 SUB_OBJECTS_ONLY_INHERIT = 0x1, 128 SUB_CONTAINERS_ONLY_INHERIT = 0x2, 129 SUB_CONTAINERS_AND_OBJECTS_INHERIT = 0x3, 130 INHERIT_NO_PROPAGATE = 0x4, 131 INHERIT_ONLY = 0x8, 132 INHERITED_ACCESS_ENTRY = 0x10, 133 INHERITED_PARENT = 0x10000000, 134 INHERITED_GRANDPARENT = 0x20000000; 135 136 alias ULONG INHERIT_FLAGS, ACCESS_RIGHTS; 137 alias ULONG* PINHERIT_FLAGS, PACCESS_RIGHTS; 138 139 enum ACCESS_MODE { 140 NOT_USED_ACCESS, 141 GRANT_ACCESS, 142 SET_ACCESS, 143 DENY_ACCESS, 144 REVOKE_ACCESS, 145 SET_AUDIT_SUCCESS, 146 SET_AUDIT_FAILURE 147 } 148 149 enum SE_OBJECT_TYPE { 150 SE_UNKNOWN_OBJECT_TYPE, 151 SE_FILE_OBJECT, 152 SE_SERVICE, 153 SE_PRINTER, 154 SE_REGISTRY_KEY, 155 SE_LMSHARE, 156 SE_KERNEL_OBJECT, 157 SE_WINDOW_OBJECT, 158 SE_DS_OBJECT, 159 SE_DS_OBJECT_ALL, 160 SE_PROVIDER_DEFINED_OBJECT, 161 SE_WMIGUID_OBJECT, 162 SE_REGISTRY_WOW64_32KEY 163 } 164 165 enum TRUSTEE_TYPE { 166 TRUSTEE_IS_UNKNOWN, 167 TRUSTEE_IS_USER, 168 TRUSTEE_IS_GROUP, 169 TRUSTEE_IS_DOMAIN, 170 TRUSTEE_IS_ALIAS, 171 TRUSTEE_IS_WELL_KNOWN_GROUP, 172 TRUSTEE_IS_DELETED, 173 TRUSTEE_IS_INVALID, 174 TRUSTEE_IS_COMPUTER 175 } 176 177 enum TRUSTEE_FORM { 178 TRUSTEE_IS_SID, 179 TRUSTEE_IS_NAME, 180 TRUSTEE_BAD_FORM, 181 TRUSTEE_IS_OBJECTS_AND_SID, 182 TRUSTEE_IS_OBJECTS_AND_NAME 183 } 184 185 enum MULTIPLE_TRUSTEE_OPERATION { 186 NO_MULTIPLE_TRUSTEE, 187 TRUSTEE_IS_IMPERSONATE 188 } 189 190 struct TRUSTEE_A { 191 TRUSTEE_A* pMultipleTrustee; 192 MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation; 193 TRUSTEE_FORM TrusteeForm; 194 TRUSTEE_TYPE TrusteeType; 195 LPSTR ptstrName; 196 } 197 alias TRUSTEE_A TRUSTEEA; 198 alias TRUSTEE_A* PTRUSTEE_A, PTRUSTEEA; 199 200 struct TRUSTEE_W { 201 TRUSTEE_W* pMultipleTrustee; 202 MULTIPLE_TRUSTEE_OPERATION MultipleTrusteeOperation; 203 TRUSTEE_FORM TrusteeForm; 204 TRUSTEE_TYPE TrusteeType; 205 LPWSTR ptstrName; 206 } 207 alias TRUSTEE_W TRUSTEEW; 208 alias TRUSTEEW* PTRUSTEE_W, PTRUSTEEW; 209 210 struct ACTRL_ACCESS_ENTRYA { 211 TRUSTEE_A Trustee; 212 ULONG fAccessFlags; 213 ACCESS_RIGHTS Access; 214 ACCESS_RIGHTS ProvSpecificAccess; 215 INHERIT_FLAGS Inheritance; 216 LPCSTR lpInheritProperty; 217 } 218 alias ACTRL_ACCESS_ENTRYA* PACTRL_ACCESS_ENTRYA; 219 220 struct ACTRL_ACCESS_ENTRYW { 221 TRUSTEE_W Trustee; 222 ULONG fAccessFlags; 223 ACCESS_RIGHTS Access; 224 ACCESS_RIGHTS ProvSpecificAccess; 225 INHERIT_FLAGS Inheritance; 226 LPCWSTR lpInheritProperty; 227 } 228 alias ACTRL_ACCESS_ENTRYW* PACTRL_ACCESS_ENTRYW; 229 230 struct ACTRL_ACCESS_ENTRY_LISTA { 231 ULONG cEntries; 232 ACTRL_ACCESS_ENTRYA* pAccessList; 233 } 234 alias ACTRL_ACCESS_ENTRY_LISTA* PACTRL_ACCESS_ENTRY_LISTA; 235 236 struct ACTRL_ACCESS_ENTRY_LISTW { 237 ULONG cEntries; 238 ACTRL_ACCESS_ENTRYW* pAccessList; 239 } 240 alias ACTRL_ACCESS_ENTRY_LISTW* PACTRL_ACCESS_ENTRY_LISTW; 241 242 struct ACTRL_PROPERTY_ENTRYA { 243 LPCSTR lpProperty; 244 PACTRL_ACCESS_ENTRY_LISTA pAccessEntryList; 245 ULONG fListFlags; 246 } 247 alias ACTRL_PROPERTY_ENTRYA* PACTRL_PROPERTY_ENTRYA; 248 249 struct ACTRL_PROPERTY_ENTRYW { 250 LPCWSTR lpProperty; 251 PACTRL_ACCESS_ENTRY_LISTW pAccessEntryList; 252 ULONG fListFlags; 253 } 254 alias ACTRL_PROPERTY_ENTRYW* PACTRL_PROPERTY_ENTRYW; 255 256 struct ACTRL_ACCESSA { 257 ULONG cEntries; 258 PACTRL_PROPERTY_ENTRYA pPropertyAccessList; 259 } 260 alias ACTRL_ACCESSA ACTRL_AUDITA; 261 alias ACTRL_ACCESSA* PACTRL_ACCESSA, PACTRL_AUDITA; 262 263 struct ACTRL_ACCESSW { 264 ULONG cEntries; 265 PACTRL_PROPERTY_ENTRYW pPropertyAccessList; 266 } 267 alias ACTRL_ACCESSW ACTRL_AUDITW; 268 alias ACTRL_ACCESSW* PACTRL_ACCESSW, PACTRL_AUDITW; 269 270 struct TRUSTEE_ACCESSA { 271 LPSTR lpProperty; 272 ACCESS_RIGHTS Access; 273 ULONG fAccessFlags; 274 ULONG fReturnedAccess; 275 } 276 alias TRUSTEE_ACCESSA* PTRUSTEE_ACCESSA; 277 278 struct TRUSTEE_ACCESSW { 279 LPWSTR lpProperty; 280 ACCESS_RIGHTS Access; 281 ULONG fAccessFlags; 282 ULONG fReturnedAccess; 283 } 284 alias TRUSTEE_ACCESSW* PTRUSTEE_ACCESSW; 285 286 struct ACTRL_OVERLAPPED { 287 union { 288 PVOID Provider; 289 ULONG Reserved1; 290 } 291 ULONG Reserved2; 292 HANDLE hEvent; 293 } 294 alias ACTRL_OVERLAPPED* PACTRL_OVERLAPPED; 295 296 struct ACTRL_ACCESS_INFOA { 297 ULONG fAccessPermission; 298 LPSTR lpAccessPermissionName; 299 } 300 alias ACTRL_ACCESS_INFOA* PACTRL_ACCESS_INFOA; 301 302 struct ACTRL_ACCESS_INFOW { 303 ULONG fAccessPermission; 304 LPWSTR lpAccessPermissionName; 305 } 306 alias ACTRL_ACCESS_INFOW* PACTRL_ACCESS_INFOW; 307 308 struct ACTRL_CONTROL_INFOA { 309 LPSTR lpControlId; 310 LPSTR lpControlName; 311 } 312 alias ACTRL_CONTROL_INFOA* PACTRL_CONTROL_INFOA; 313 314 struct ACTRL_CONTROL_INFOW { 315 LPWSTR lpControlId; 316 LPWSTR lpControlName; 317 } 318 alias ACTRL_CONTROL_INFOW* PACTRL_CONTROL_INFOW; 319 320 struct EXPLICIT_ACCESS_A { 321 DWORD grfAccessPermissions; 322 ACCESS_MODE grfAccessMode; 323 DWORD grfInheritance; 324 TRUSTEE_A Trustee; 325 } 326 alias EXPLICIT_ACCESS_A EXPLICIT_ACCESSA; 327 alias EXPLICIT_ACCESS_A* PEXPLICIT_ACCESS_A, PEXPLICIT_ACCESSA; 328 329 struct EXPLICIT_ACCESS_W { 330 DWORD grfAccessPermissions; 331 ACCESS_MODE grfAccessMode; 332 DWORD grfInheritance; 333 TRUSTEE_W Trustee; 334 } 335 alias EXPLICIT_ACCESS_W EXPLICIT_ACCESSW; 336 alias EXPLICIT_ACCESS_W* PEXPLICIT_ACCESS_W, PEXPLICIT_ACCESSW; 337 338 struct OBJECTS_AND_SID { 339 DWORD ObjectsPresent; 340 GUID ObjectTypeGuid; 341 GUID InheritedObjectTypeGuid; 342 SID* pSid; 343 } 344 alias OBJECTS_AND_SID* POBJECTS_AND_SID; 345 346 struct OBJECTS_AND_NAME_A { 347 DWORD ObjectsPresent; 348 SE_OBJECT_TYPE ObjectType; 349 LPSTR ObjectTypeName; 350 LPSTR InheritedObjectTypeName; 351 LPSTR ptstrName; 352 } 353 alias OBJECTS_AND_NAME_A* POBJECTS_AND_NAME_A; 354 355 struct OBJECTS_AND_NAME_W { 356 DWORD ObjectsPresent; 357 SE_OBJECT_TYPE ObjectType; 358 LPWSTR ObjectTypeName; 359 LPWSTR InheritedObjectTypeName; 360 LPWSTR ptstrName; 361 } 362 alias OBJECTS_AND_NAME_W* POBJECTS_AND_NAME_W; 363 364 static if (_WIN32_WINNT >= 0x501) { 365 struct INHERITED_FROMA { 366 LONG GenerationGap; 367 LPSTR AncestorName; 368 } 369 alias INHERITED_FROMA* PINHERITED_FROMA; 370 371 struct INHERITED_FROMW { 372 LONG GenerationGap; 373 LPWSTR AncestorName; 374 } 375 alias INHERITED_FROMW* PINHERITED_FROMW; 376 } 377 378 version (Unicode) { 379 alias TRUSTEEW TRUSTEE; 380 alias ACTRL_ACCESSW ACTRL_ACCESS; 381 alias ACTRL_ACCESS_ENTRY_LISTW ACTRL_ACCESS_ENTRY_LIST; 382 alias ACTRL_ACCESS_INFOW ACTRL_ACCESS_INFO; 383 alias ACTRL_ACCESS_ENTRYW ACTRL_ACCESS_ENTRY; 384 alias ACTRL_AUDITW ACTRL_AUDIT; 385 alias ACTRL_CONTROL_INFOW ACTRL_CONTROL_INFO; 386 alias EXPLICIT_ACCESSW EXPLICIT_ACCESS; 387 alias TRUSTEE_ACCESSW TRUSTEE_ACCESS; 388 alias OBJECTS_AND_NAME_W OBJECTS_AND_NAME_; 389 static if (_WIN32_WINNT >= 0x501) { 390 alias INHERITED_FROMW INHERITED_FROM; 391 } 392 } else { 393 alias TRUSTEEA TRUSTEE; 394 alias ACTRL_ACCESSA ACTRL_ACCESS; 395 alias ACTRL_ACCESS_ENTRY_LISTA ACTRL_ACCESS_ENTRY_LIST; 396 alias ACTRL_ACCESS_INFOA ACTRL_ACCESS_INFO; 397 alias ACTRL_ACCESS_ENTRYA ACTRL_ACCESS_ENTRY; 398 alias ACTRL_AUDITA ACTRL_AUDIT; 399 alias ACTRL_CONTROL_INFOA ACTRL_CONTROL_INFO; 400 alias EXPLICIT_ACCESSA EXPLICIT_ACCESS; 401 alias TRUSTEE_ACCESSA TRUSTEE_ACCESS; 402 alias OBJECTS_AND_NAME_A OBJECTS_AND_NAME_; 403 static if (_WIN32_WINNT >= 0x501) { 404 alias INHERITED_FROMA INHERITED_FROM; 405 } 406 } 407 408 alias TRUSTEE TRUSTEE_; 409 alias TRUSTEE* PTRUSTEE, PTRUSTEE_; 410 alias ACTRL_ACCESS* PACTRL_ACCESS; 411 alias ACTRL_ACCESS_ENTRY_LIST* PACTRL_ACCESS_ENTRY_LIST; 412 alias ACTRL_ACCESS_INFO* PACTRL_ACCESS_INFO; 413 alias ACTRL_ACCESS_ENTRY* PACTRL_ACCESS_ENTRY; 414 alias ACTRL_AUDIT* PACTRL_AUDIT; 415 alias ACTRL_CONTROL_INFO* PACTRL_CONTROL_INFO; 416 alias EXPLICIT_ACCESS EXPLICIT_ACCESS_; 417 alias EXPLICIT_ACCESS* PEXPLICIT_ACCESS, PEXPLICIT_ACCESS_; 418 alias TRUSTEE_ACCESS* PTRUSTEE_ACCESS; 419 alias OBJECTS_AND_NAME_* POBJECTS_AND_NAME_; 420 static if (_WIN32_WINNT >= 0x501) { 421 alias INHERITED_FROM* PINHERITED_FROM; 422 }