home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / accctrl.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  23.5 KB  |  696 lines

  1. //+-------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1993-1998.
  5. //
  6. //  File:       accctrl.h
  7. //
  8. //  Contents:   common includes for new style Win32 Access Control
  9. //              APIs
  10. //
  11. //
  12. //--------------------------------------------------------------------
  13. #ifndef __ACCESS_CONTROL__
  14. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  15. #define __ACCESS_CONTROL__
  16.  
  17. #ifndef __midl
  18. #include <wtypes.h>
  19. #endif
  20.  
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24.  
  25. #define AccFree LocalFree
  26.  
  27. //
  28. // Definition:
  29. // This enumerated type defines the objects supported by the get/set API within
  30. // this document.  See section 3.1, Object Types for a detailed definition of the
  31. // supported object types, and their name formats.
  32. //
  33. typedef enum _SE_OBJECT_TYPE
  34. {
  35.     SE_UNKNOWN_OBJECT_TYPE = 0,
  36.     SE_FILE_OBJECT,
  37.     SE_SERVICE,
  38.     SE_PRINTER,
  39.     SE_REGISTRY_KEY,
  40.     SE_LMSHARE,
  41.     SE_KERNEL_OBJECT,
  42.     SE_WINDOW_OBJECT,
  43.     SE_DS_OBJECT,
  44.     SE_DS_OBJECT_ALL,
  45.     SE_PROVIDER_DEFINED_OBJECT,
  46.     SE_WMIGUID_OBJECT
  47. } SE_OBJECT_TYPE;
  48.  
  49. //
  50. // Definition: TRUSTEE_TYPE
  51. // This enumerated type specifies the type of trustee account for the trustee
  52. // returned by the API described in this document.
  53. // TRUSTEE_IS_UNKNOWN - The trustee is an unknown, but not necessarily invalid
  54. //                      type.  This field is not validated on input to the APIs
  55. //                      that take Trustees.
  56. // TRUSTEE_IS_USER      The trustee account is a user account.
  57. // TRUSTEE_IS_GROUP     The trustee account is a group account.
  58. //
  59.  
  60. typedef enum _TRUSTEE_TYPE
  61. {
  62.     TRUSTEE_IS_UNKNOWN,
  63.     TRUSTEE_IS_USER,
  64.     TRUSTEE_IS_GROUP,
  65.     TRUSTEE_IS_DOMAIN,
  66.     TRUSTEE_IS_ALIAS,
  67.     TRUSTEE_IS_WELL_KNOWN_GROUP,
  68.     TRUSTEE_IS_DELETED,
  69.     TRUSTEE_IS_INVALID,
  70.     TRUSTEE_IS_COMPUTER
  71. } TRUSTEE_TYPE;
  72.  
  73.  
  74. //
  75. // Definition: TRUSTEE_FORM
  76. // This enumerated type specifies the form the trustee identifier is in for a
  77. // particular trustee.
  78. // TRUSTEE_IS_SID       The trustee is identified with a SID rather than with a name.
  79. // TRUSTEE_IS_NAME      The trustee is identified with a name.
  80. //
  81.  
  82. typedef enum _TRUSTEE_FORM
  83. {
  84.     TRUSTEE_IS_SID,
  85.     TRUSTEE_IS_NAME,
  86.     TRUSTEE_BAD_FORM,
  87.     TRUSTEE_IS_OBJECTS_AND_SID,
  88.     TRUSTEE_IS_OBJECTS_AND_NAME
  89. } TRUSTEE_FORM;
  90.  
  91.  
  92. //
  93. // Definition: MULTIPLE_TRUSTEE_OPERATION
  94. // If the trustee is a multiple trustee, this enumerated type specifies the type.
  95. // TRUSTEE_IS_IMPERSONATE       The trustee is an impersonate trustee and the multiple
  96. //                          trustee field in the trustee points to another trustee
  97. //                          that is a trustee for the server that will be doing the
  98. //                          impersonation.
  99. //
  100.  
  101. typedef enum _MULTIPLE_TRUSTEE_OPERATION
  102. {
  103.     NO_MULTIPLE_TRUSTEE,
  104.     TRUSTEE_IS_IMPERSONATE,
  105. } MULTIPLE_TRUSTEE_OPERATION;
  106.  
  107.  
  108. typedef struct  _OBJECTS_AND_SID
  109. {
  110.     DWORD   ObjectsPresent;
  111.     GUID    ObjectTypeGuid;
  112.     GUID    InheritedObjectTypeGuid;
  113.     SID     * pSid;
  114. } OBJECTS_AND_SID, *POBJECTS_AND_SID;
  115.  
  116. typedef struct  _OBJECTS_AND_NAME_A
  117. {
  118.     DWORD          ObjectsPresent;
  119.     SE_OBJECT_TYPE ObjectType;
  120.     LPSTR    ObjectTypeName;
  121.     LPSTR    InheritedObjectTypeName;
  122.     LPSTR    ptstrName;
  123. } OBJECTS_AND_NAME_A, *POBJECTS_AND_NAME_A;
  124. typedef struct  _OBJECTS_AND_NAME_W
  125. {
  126.     DWORD          ObjectsPresent;
  127.     SE_OBJECT_TYPE ObjectType;
  128.     LPWSTR   ObjectTypeName;
  129.     LPWSTR   InheritedObjectTypeName;
  130.     LPWSTR   ptstrName;
  131. } OBJECTS_AND_NAME_W, *POBJECTS_AND_NAME_W;
  132. #ifdef UNICODE
  133. typedef OBJECTS_AND_NAME_W OBJECTS_AND_NAME_;
  134. typedef POBJECTS_AND_NAME_W POBJECTS_AND_NAME_;
  135. #else
  136. typedef OBJECTS_AND_NAME_A OBJECTS_AND_NAME_;
  137. typedef POBJECTS_AND_NAME_A POBJECTS_AND_NAME_;
  138. #endif // UNICODE
  139.  
  140. //
  141. // Definition: TRUSTEE
  142. // This structure is used to pass account information into and out of the system
  143. // using the API defined in this document.
  144. // PMultipleTrustee     - if NON-NULL, points to another trustee structure, as
  145. //                    defined by the multiple trustee operation field.
  146. // MultipleTrusteeOperation - Defines the multiple trustee operation/type.
  147. // TrusteeForm - defines if the trustee is defined by name or SID.
  148. // TrusteeType - defines if the trustee type is unknown, a user or a group.
  149. // PwcsName     - points to the trustee name or the trustee SID.
  150. //
  151.  
  152. typedef struct _TRUSTEE_A
  153. {
  154.     struct _TRUSTEE_A          *pMultipleTrustee;
  155.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  156.     TRUSTEE_FORM                TrusteeForm;
  157.     TRUSTEE_TYPE                TrusteeType;
  158. #ifdef __midl
  159.     [switch_is(TrusteeForm)]
  160.     union
  161.     {
  162.     [case(TRUSTEE_IS_NAME)]
  163.         LPSTR                   ptstrName;
  164.     [case(TRUSTEE_IS_SID)]
  165.         SID                    *pSid;
  166.     [case(TRUSTEE_IS_OBJECTS_AND_SID)]
  167.         OBJECTS_AND_SID        *pObjectsAndSid;
  168.     [case(TRUSTEE_IS_OBJECTS_AND_NAME)]
  169.         OBJECTS_AND_NAME_A     *pObjectsAndName;
  170.     };
  171. #else
  172.     LPSTR                       ptstrName;
  173. #endif
  174. } TRUSTEE_A, *PTRUSTEE_A, TRUSTEEA, *PTRUSTEEA;
  175. typedef struct _TRUSTEE_W
  176. {
  177.     struct _TRUSTEE_W          *pMultipleTrustee;
  178.     MULTIPLE_TRUSTEE_OPERATION  MultipleTrusteeOperation;
  179.     TRUSTEE_FORM                TrusteeForm;
  180.     TRUSTEE_TYPE                TrusteeType;
  181. #ifdef __midl
  182.     [switch_is(TrusteeForm)]
  183.     union
  184.     {
  185.     [case(TRUSTEE_IS_NAME)]
  186.         LPWSTR                  ptstrName;
  187.     [case(TRUSTEE_IS_SID)]
  188.         SID                    *pSid;
  189.     [case(TRUSTEE_IS_OBJECTS_AND_SID)]
  190.         OBJECTS_AND_SID        *pObjectsAndSid;
  191.     [case(TRUSTEE_IS_OBJECTS_AND_NAME)]
  192.         OBJECTS_AND_NAME_W     *pObjectsAndName;
  193.     };
  194. #else
  195.     LPWSTR                      ptstrName;
  196. #endif
  197. } TRUSTEE_W, *PTRUSTEE_W, TRUSTEEW, *PTRUSTEEW;
  198. #ifdef UNICODE
  199. typedef TRUSTEE_W TRUSTEE_;
  200. typedef PTRUSTEE_W PTRUSTEE_;
  201. typedef TRUSTEEW TRUSTEE;
  202. typedef PTRUSTEEW PTRUSTEE;
  203. #else
  204. typedef TRUSTEE_A TRUSTEE_;
  205. typedef PTRUSTEE_A PTRUSTEE_;
  206. typedef TRUSTEEA TRUSTEE;
  207. typedef PTRUSTEEA PTRUSTEE;
  208. #endif // UNICODE
  209.  
  210. //
  211. // Definition: ACCESS_MODE
  212. // This enumerated type specifies how permissions are (requested)/to be applied
  213. //  for the trustee by the access control entry.  On input this field can by any
  214. //  of the values, although it is not meaningful to mix access control and audit
  215. //  control entries.  On output this field will be either SET_ACCESS, DENY_ACCESS,
  216. // SET_AUDIT_SUCCESS, SET_AUDIT_FAILURE.
  217. // The following descriptions define how this type effects an explicit access
  218. // request to apply access permissions to an object.
  219. // GRANT_ACCESS - The trustee will have at least the requested permissions upon
  220. //                successful completion of the command. (If the trustee has
  221. //                additional permissions they will not be removed).
  222. // SET_ACCESS - The trustee will have exactly the requested permissions upon
  223. //              successful completion of the command.
  224. // DENY_ACCESS - The trustee will be denied the specified permissions.
  225. // REVOKE_ACCESS - Any explicit access rights the trustee has will be revoked.
  226. // SET_AUDIT_SUCCESS - The trustee will be audited for successful opens of the
  227. //                     object using the requested permissions.
  228. // SET_AUDIT_FAILURE - The trustee will be audited for failed opens of the object
  229. //                     using the requested permissions.
  230. //
  231.  
  232. typedef enum _ACCESS_MODE
  233. {
  234.     NOT_USED_ACCESS = 0,
  235.     GRANT_ACCESS,
  236.     SET_ACCESS,
  237.     DENY_ACCESS,
  238.     REVOKE_ACCESS,
  239.     SET_AUDIT_SUCCESS,
  240.     SET_AUDIT_FAILURE
  241. } ACCESS_MODE;
  242.  
  243. //
  244. // Definition: Inheritance flags
  245. // These bit masks are provided to allow simple application of inheritance in
  246. // explicit access requests on containers.
  247. // NO_INHERITANCE       The specific access permissions will only be applied to
  248. //                  the container, and will not be inherited by objects created
  249. //                  within the container.
  250. // SUB_CONTAINERS_ONLY_INHERIT  The specific access permissions will be inherited
  251. //                              and applied to sub containers created within the
  252. //                              container, and will be applied to the container
  253. //                              itself.
  254. // SUB_OBJECTS_ONLY_INHERIT     The specific access permissions will only be inherited
  255. //                              by objects created within the specific container.
  256. //                              The access permissions will not be applied to the
  257. //                              container itself.
  258. // SUB_CONTAINERS_AND_OBJECTS_INHERIT   The specific access permissions will be
  259. //                                      inherited by containers created within the
  260. //                                      specific container, will be applied to
  261. //                                      objects created within the container, but
  262. //                                      will not be applied to the container itself.
  263. //
  264. #define NO_INHERITANCE 0x0
  265. #define SUB_OBJECTS_ONLY_INHERIT            0x1
  266. #define SUB_CONTAINERS_ONLY_INHERIT         0x2
  267. #define SUB_CONTAINERS_AND_OBJECTS_INHERIT  0x3
  268. #define INHERIT_NO_PROPAGATE                0x4
  269. #define INHERIT_ONLY                        0x8
  270.  
  271. //
  272. // Informational bit that is returned
  273. //
  274. #define INHERITED_ACCESS_ENTRY              0x10
  275.  
  276. //
  277. // Informational bit that tells where a node was inherited from.  Valid only
  278. // for NT 5 APIs
  279. //
  280. #define INHERITED_PARENT                    0x10000000
  281. #define INHERITED_GRANDPARENT               0x20000000
  282.  
  283.  
  284. //
  285. // Definition: EXPLICIT_ACCESS
  286. // This structure is used to pass access control entry information into and out
  287. // of the system using the API defined in this document.
  288. // grfAccessPermissions - This contains the access permissions to assign for the
  289. //                     trustee.  It is in the form of an NT access mask.
  290. // grfAccessMode - This field defines how the permissions are to be applied for
  291. //                 the trustee.
  292. // grfInheritance - For containers, this field defines how the access control
  293. //                  entry is/(is requested) to be inherited on
  294. //                  objects/sub-containers created within the container.
  295. // Trustee - This field contains the definition of the trustee account the
  296. //           explicit access applies to.
  297. //
  298.  
  299. typedef struct _EXPLICIT_ACCESS_A
  300. {
  301.     DWORD        grfAccessPermissions;
  302.     ACCESS_MODE  grfAccessMode;
  303.     DWORD        grfInheritance;
  304.     TRUSTEE_A    Trustee;
  305. } EXPLICIT_ACCESS_A, *PEXPLICIT_ACCESS_A, EXPLICIT_ACCESSA, *PEXPLICIT_ACCESSA;
  306. typedef struct _EXPLICIT_ACCESS_W
  307. {
  308.     DWORD        grfAccessPermissions;
  309.     ACCESS_MODE  grfAccessMode;
  310.     DWORD        grfInheritance;
  311.     TRUSTEE_W    Trustee;
  312. } EXPLICIT_ACCESS_W, *PEXPLICIT_ACCESS_W, EXPLICIT_ACCESSW, *PEXPLICIT_ACCESSW;
  313. #ifdef UNICODE
  314. typedef EXPLICIT_ACCESS_W EXPLICIT_ACCESS_;
  315. typedef PEXPLICIT_ACCESS_W PEXPLICIT_ACCESS_;
  316. typedef EXPLICIT_ACCESSW EXPLICIT_ACCESS;
  317. typedef PEXPLICIT_ACCESSW PEXPLICIT_ACCESS;
  318. #else
  319. typedef EXPLICIT_ACCESS_A EXPLICIT_ACCESS_;
  320. typedef PEXPLICIT_ACCESS_A PEXPLICIT_ACCESS_;
  321. typedef EXPLICIT_ACCESSA EXPLICIT_ACCESS;
  322. typedef PEXPLICIT_ACCESSA PEXPLICIT_ACCESS;
  323. #endif // UNICODE
  324.  
  325.  
  326.  
  327. //----------------------------------------------------------------------------
  328. //
  329. //                                  NT5 APIs
  330. //
  331. //----------------------------------------------------------------------------
  332.  
  333. //
  334. // Default provider
  335. //
  336. #define ACCCTRL_DEFAULT_PROVIDERA   "Windows NT Access Provider"
  337. #define ACCCTRL_DEFAULT_PROVIDERW  L"Windows NT Access Provider"
  338.  
  339. #ifdef UNICODE
  340. #define ACCCTRL_DEFAULT_PROVIDER ACCCTRL_DEFAULT_PROVIDERW
  341. #else
  342. #define ACCCTRL_DEFAULT_PROVIDER ACCCTRL_DEFAULT_PROVIDERA
  343. #endif
  344.  
  345.  
  346.  
  347.  
  348. //
  349. /// Access rights
  350. //
  351. typedef     ULONG   ACCESS_RIGHTS, *PACCESS_RIGHTS;
  352.  
  353. //
  354. // Inheritance flags
  355. //
  356. typedef ULONG INHERIT_FLAGS, *PINHERIT_FLAGS;
  357.  
  358.  
  359. //
  360. // Access / Audit structures
  361. //
  362. typedef struct _ACTRL_ACCESS_ENTRYA
  363. {
  364.     TRUSTEE_A       Trustee;
  365.     ULONG           fAccessFlags;
  366.     ACCESS_RIGHTS   Access;
  367.     ACCESS_RIGHTS   ProvSpecificAccess;
  368.     INHERIT_FLAGS   Inheritance;
  369.     LPSTR           lpInheritProperty;
  370. } ACTRL_ACCESS_ENTRYA, *PACTRL_ACCESS_ENTRYA;
  371. //
  372. // Access / Audit structures
  373. //
  374. typedef struct _ACTRL_ACCESS_ENTRYW
  375. {
  376.     TRUSTEE_W       Trustee;
  377.     ULONG           fAccessFlags;
  378.     ACCESS_RIGHTS   Access;
  379.     ACCESS_RIGHTS   ProvSpecificAccess;
  380.     INHERIT_FLAGS   Inheritance;
  381.     LPWSTR          lpInheritProperty;
  382. } ACTRL_ACCESS_ENTRYW, *PACTRL_ACCESS_ENTRYW;
  383. #ifdef UNICODE
  384. typedef ACTRL_ACCESS_ENTRYW ACTRL_ACCESS_ENTRY;
  385. typedef PACTRL_ACCESS_ENTRYW PACTRL_ACCESS_ENTRY;
  386. #else
  387. typedef ACTRL_ACCESS_ENTRYA ACTRL_ACCESS_ENTRY;
  388. typedef PACTRL_ACCESS_ENTRYA PACTRL_ACCESS_ENTRY;
  389. #endif // UNICODE
  390.  
  391.  
  392.  
  393. typedef struct _ACTRL_ACCESS_ENTRY_LISTA
  394. {
  395.     ULONG                   cEntries;
  396. #ifdef __midl
  397.     [size_is(cEntries)]
  398. #endif
  399.     ACTRL_ACCESS_ENTRYA    *pAccessList;
  400. } ACTRL_ACCESS_ENTRY_LISTA, *PACTRL_ACCESS_ENTRY_LISTA;
  401. typedef struct _ACTRL_ACCESS_ENTRY_LISTW
  402. {
  403.     ULONG                   cEntries;
  404. #ifdef __midl
  405.     [size_is(cEntries)]
  406. #endif
  407.     ACTRL_ACCESS_ENTRYW    *pAccessList;
  408. } ACTRL_ACCESS_ENTRY_LISTW, *PACTRL_ACCESS_ENTRY_LISTW;
  409. #ifdef UNICODE
  410. typedef ACTRL_ACCESS_ENTRY_LISTW ACTRL_ACCESS_ENTRY_LIST;
  411. typedef PACTRL_ACCESS_ENTRY_LISTW PACTRL_ACCESS_ENTRY_LIST;
  412. #else
  413. typedef ACTRL_ACCESS_ENTRY_LISTA ACTRL_ACCESS_ENTRY_LIST;
  414. typedef PACTRL_ACCESS_ENTRY_LISTA PACTRL_ACCESS_ENTRY_LIST;
  415. #endif // UNICODE
  416.  
  417.  
  418.  
  419. typedef struct _ACTRL_PROPERTY_ENTRYA
  420. {
  421.     LPSTR                       lpProperty;
  422.     PACTRL_ACCESS_ENTRY_LISTA   pAccessEntryList;
  423.     ULONG                       fListFlags;
  424. } ACTRL_PROPERTY_ENTRYA, *PACTRL_PROPERTY_ENTRYA;
  425. typedef struct _ACTRL_PROPERTY_ENTRYW
  426. {
  427.     LPWSTR                      lpProperty;
  428.     PACTRL_ACCESS_ENTRY_LISTW   pAccessEntryList;
  429.     ULONG                       fListFlags;
  430. } ACTRL_PROPERTY_ENTRYW, *PACTRL_PROPERTY_ENTRYW;
  431. #ifdef UNICODE
  432. typedef ACTRL_PROPERTY_ENTRYW ACTRL_PROPERTY_ENTRY;
  433. typedef PACTRL_PROPERTY_ENTRYW PACTRL_PROPERTY_ENTRY;
  434. #else
  435. typedef ACTRL_PROPERTY_ENTRYA ACTRL_PROPERTY_ENTRY;
  436. typedef PACTRL_PROPERTY_ENTRYA PACTRL_PROPERTY_ENTRY;
  437. #endif // UNICODE
  438.  
  439.  
  440.  
  441. typedef struct _ACTRL_ALISTA
  442. {
  443.     ULONG                       cEntries;
  444. #ifdef __midl
  445.     [size_is(cEntries)]
  446. #endif
  447.     PACTRL_PROPERTY_ENTRYA      pPropertyAccessList;
  448. } ACTRL_ACCESSA, *PACTRL_ACCESSA, ACTRL_AUDITA, *PACTRL_AUDITA;
  449. typedef struct _ACTRL_ALISTW
  450. {
  451.     ULONG                       cEntries;
  452. #ifdef __midl
  453.     [size_is(cEntries)]
  454. #endif
  455.     PACTRL_PROPERTY_ENTRYW      pPropertyAccessList;
  456. } ACTRL_ACCESSW, *PACTRL_ACCESSW, ACTRL_AUDITW, *PACTRL_AUDITW;
  457. #ifdef UNICODE
  458. typedef ACTRL_ACCESSW ACTRL_ACCESS;
  459. typedef PACTRL_ACCESSW PACTRL_ACCESS;
  460. typedef ACTRL_AUDITW ACTRL_AUDIT;
  461. typedef PACTRL_AUDITW PACTRL_AUDIT;
  462. #else
  463. typedef ACTRL_ACCESSA ACTRL_ACCESS;
  464. typedef PACTRL_ACCESSA PACTRL_ACCESS;
  465. typedef ACTRL_AUDITA ACTRL_AUDIT;
  466. typedef PACTRL_AUDITA PACTRL_AUDIT;
  467. #endif // UNICODE
  468.  
  469.  
  470.  
  471. //
  472. // TRUSTEE_ACCESS flags
  473. //
  474. #define TRUSTEE_ACCESS_ALLOWED      0x00000001L
  475. #define TRUSTEE_ACCESS_READ         0x00000002L
  476. #define TRUSTEE_ACCESS_WRITE        0x00000004L
  477.  
  478. #define TRUSTEE_ACCESS_EXPLICIT     0x00000001L
  479. #define TRUSTEE_ACCESS_READ_WRITE   (TRUSTEE_ACCESS_READ |                  \
  480.                                      TRUSTEE_ACCESS_WRITE)
  481.  
  482.  
  483. #define TRUSTEE_ACCESS_ALL          0xFFFFFFFFL
  484.  
  485. typedef struct _TRUSTEE_ACCESSA
  486. {
  487.     LPSTR           lpProperty;
  488.     ACCESS_RIGHTS   Access;
  489.     ULONG           fAccessFlags;
  490.     ULONG           fReturnedAccess;
  491. } TRUSTEE_ACCESSA, *PTRUSTEE_ACCESSA;
  492. typedef struct _TRUSTEE_ACCESSW
  493. {
  494.     LPWSTR          lpProperty;
  495.     ACCESS_RIGHTS   Access;
  496.     ULONG           fAccessFlags;
  497.     ULONG           fReturnedAccess;
  498. } TRUSTEE_ACCESSW, *PTRUSTEE_ACCESSW;
  499. #ifdef UNICODE
  500. typedef TRUSTEE_ACCESSW TRUSTEE_ACCESS;
  501. typedef PTRUSTEE_ACCESSW PTRUSTEE_ACCESS;
  502. #else
  503. typedef TRUSTEE_ACCESSA TRUSTEE_ACCESS;
  504. typedef PTRUSTEE_ACCESSA PTRUSTEE_ACCESS;
  505. #endif // UNICODE
  506.  
  507.  
  508.  
  509. //
  510. // Generic permission values
  511. //
  512. #define ACTRL_RESERVED          0x00000000
  513. #define ACTRL_PERM_1            0x00000001
  514. #define ACTRL_PERM_2            0x00000002
  515. #define ACTRL_PERM_3            0x00000004
  516. #define ACTRL_PERM_4            0x00000008
  517. #define ACTRL_PERM_5            0x00000010
  518. #define ACTRL_PERM_6            0x00000020
  519. #define ACTRL_PERM_7            0x00000040
  520. #define ACTRL_PERM_8            0x00000080
  521. #define ACTRL_PERM_9            0x00000100
  522. #define ACTRL_PERM_10           0x00000200
  523. #define ACTRL_PERM_11           0x00000400
  524. #define ACTRL_PERM_12           0x00000800
  525. #define ACTRL_PERM_13           0x00001000
  526. #define ACTRL_PERM_14           0x00002000
  527. #define ACTRL_PERM_15           0x00004000
  528. #define ACTRL_PERM_16           0x00008000
  529. #define ACTRL_PERM_17           0x00010000
  530. #define ACTRL_PERM_18           0x00020000
  531. #define ACTRL_PERM_19           0x00040000
  532. #define ACTRL_PERM_20           0x00080000
  533.  
  534. //
  535. // Access permissions
  536. //
  537. #define ACTRL_ACCESS_ALLOWED        0x00000001
  538. #define ACTRL_ACCESS_DENIED         0x00000002
  539. #define ACTRL_AUDIT_SUCCESS         0x00000004
  540. #define ACTRL_AUDIT_FAILURE         0x00000008
  541.  
  542. //
  543. // Property list flags
  544. //
  545. #define ACTRL_ACCESS_PROTECTED      0x00000001
  546.  
  547. //
  548. // Standard and object rights
  549. //
  550. #define ACTRL_SYSTEM_ACCESS         0x04000000
  551. #define ACTRL_DELETE                0x08000000
  552. #define ACTRL_READ_CONTROL          0x10000000
  553. #define ACTRL_CHANGE_ACCESS         0x20000000
  554. #define ACTRL_CHANGE_OWNER          0x40000000
  555. #define ACTRL_SYNCHRONIZE           0x80000000
  556. #define ACTRL_STD_RIGHTS_ALL        0xf8000000
  557. #define ACTRL_STD_RIGHT_REQUIRED    ( ACTRL_STD_RIGHTS_ALL & ~ACTRL_SYNCHRONIZE )
  558.  
  559. #ifndef _DS_CONTROL_BITS_DEFINED_
  560. #define _DS_CONTROL_BITS_DEFINED_
  561. #define ACTRL_DS_OPEN                           ACTRL_RESERVED
  562. #define ACTRL_DS_CREATE_CHILD                   ACTRL_PERM_1
  563. #define ACTRL_DS_DELETE_CHILD                   ACTRL_PERM_2
  564. #define ACTRL_DS_LIST                           ACTRL_PERM_3
  565. #define ACTRL_DS_SELF                           ACTRL_PERM_4
  566. #define ACTRL_DS_READ_PROP                      ACTRL_PERM_5
  567. #define ACTRL_DS_WRITE_PROP                     ACTRL_PERM_6
  568. #define ACTRL_DS_DELETE_TREE                    ACTRL_PERM_7
  569. #define ACTRL_DS_LIST_OBJECT                    ACTRL_PERM_8
  570. #define ACTRL_DS_CONTROL_ACCESS                 ACTRL_PERM_9
  571. #endif
  572.  
  573. #define ACTRL_FILE_READ                         ACTRL_PERM_1
  574. #define ACTRL_FILE_WRITE                        ACTRL_PERM_2
  575. #define ACTRL_FILE_APPEND                       ACTRL_PERM_3
  576. #define ACTRL_FILE_READ_PROP                    ACTRL_PERM_4
  577. #define ACTRL_FILE_WRITE_PROP                   ACTRL_PERM_5
  578. #define ACTRL_FILE_EXECUTE                      ACTRL_PERM_6
  579. #define ACTRL_FILE_READ_ATTRIB                  ACTRL_PERM_8
  580. #define ACTRL_FILE_WRITE_ATTRIB                 ACTRL_PERM_9
  581. #define ACTRL_FILE_CREATE_PIPE                  ACTRL_PERM_10
  582. #define ACTRL_DIR_LIST                          ACTRL_PERM_1
  583. #define ACTRL_DIR_CREATE_OBJECT                 ACTRL_PERM_2
  584. #define ACTRL_DIR_CREATE_CHILD                  ACTRL_PERM_3
  585. #define ACTRL_DIR_DELETE_CHILD                  ACTRL_PERM_7
  586. #define ACTRL_DIR_TRAVERSE                      ACTRL_PERM_6
  587. #define ACTRL_KERNEL_TERMINATE                  ACTRL_PERM_1
  588. #define ACTRL_KERNEL_THREAD                     ACTRL_PERM_2
  589. #define ACTRL_KERNEL_VM                         ACTRL_PERM_3
  590. #define ACTRL_KERNEL_VM_READ                    ACTRL_PERM_4
  591. #define ACTRL_KERNEL_VM_WRITE                   ACTRL_PERM_5
  592. #define ACTRL_KERNEL_DUP_HANDLE                 ACTRL_PERM_6
  593. #define ACTRL_KERNEL_PROCESS                    ACTRL_PERM_7
  594. #define ACTRL_KERNEL_SET_INFO                   ACTRL_PERM_8
  595. #define ACTRL_KERNEL_GET_INFO                   ACTRL_PERM_9
  596. #define ACTRL_KERNEL_CONTROL                    ACTRL_PERM_10
  597. #define ACTRL_KERNEL_ALERT                      ACTRL_PERM_11
  598. #define ACTRL_KERNEL_GET_CONTEXT                ACTRL_PERM_12
  599. #define ACTRL_KERNEL_SET_CONTEXT                ACTRL_PERM_13
  600. #define ACTRL_KERNEL_TOKEN                      ACTRL_PERM_14
  601. #define ACTRL_KERNEL_IMPERSONATE                ACTRL_PERM_15
  602. #define ACTRL_KERNEL_DIMPERSONATE               ACTRL_PERM_16
  603. #define ACTRL_PRINT_SADMIN                      ACTRL_PERM_1
  604. #define ACTRL_PRINT_SLIST                       ACTRL_PERM_2
  605. #define ACTRL_PRINT_PADMIN                      ACTRL_PERM_3
  606. #define ACTRL_PRINT_PUSE                        ACTRL_PERM_4
  607. #define ACTRL_PRINT_JADMIN                      ACTRL_PERM_5
  608. #define ACTRL_SVC_GET_INFO                      ACTRL_PERM_1
  609. #define ACTRL_SVC_SET_INFO                      ACTRL_PERM_2
  610. #define ACTRL_SVC_STATUS                        ACTRL_PERM_3
  611. #define ACTRL_SVC_LIST                          ACTRL_PERM_4
  612. #define ACTRL_SVC_START                         ACTRL_PERM_5
  613. #define ACTRL_SVC_STOP                          ACTRL_PERM_6
  614. #define ACTRL_SVC_PAUSE                         ACTRL_PERM_7
  615. #define ACTRL_SVC_INTERROGATE                   ACTRL_PERM_8
  616. #define ACTRL_SVC_UCONTROL                      ACTRL_PERM_9
  617. #define ACTRL_REG_QUERY                         ACTRL_PERM_1
  618. #define ACTRL_REG_SET                           ACTRL_PERM_2
  619. #define ACTRL_REG_CREATE_CHILD                  ACTRL_PERM_3
  620. #define ACTRL_REG_LIST                          ACTRL_PERM_4
  621. #define ACTRL_REG_NOTIFY                        ACTRL_PERM_5
  622. #define ACTRL_REG_LINK                          ACTRL_PERM_6
  623. #define ACTRL_WIN_CLIPBRD                       ACTRL_PERM_1
  624. #define ACTRL_WIN_GLOBAL_ATOMS                  ACTRL_PERM_2
  625. #define ACTRL_WIN_CREATE                        ACTRL_PERM_3
  626. #define ACTRL_WIN_LIST_DESK                     ACTRL_PERM_4
  627. #define ACTRL_WIN_LIST                          ACTRL_PERM_5
  628. #define ACTRL_WIN_READ_ATTRIBS                  ACTRL_PERM_6
  629. #define ACTRL_WIN_WRITE_ATTRIBS                 ACTRL_PERM_7
  630. #define ACTRL_WIN_SCREEN                        ACTRL_PERM_8
  631. #define ACTRL_WIN_EXIT                          ACTRL_PERM_9
  632.  
  633.  
  634.  
  635.  
  636. typedef struct _ACTRL_OVERLAPPED
  637. {
  638.     union {
  639.         PVOID Provider;
  640.         ULONG Reserved1;
  641.     };
  642.  
  643.     ULONG       Reserved2;
  644.     HANDLE      hEvent;
  645.  
  646. } ACTRL_OVERLAPPED, *PACTRL_OVERLAPPED;
  647.  
  648. typedef struct _ACTRL_ACCESS_INFOA
  649. {
  650.     ULONG       fAccessPermission;
  651.     LPSTR       lpAccessPermissionName;
  652. } ACTRL_ACCESS_INFOA, *PACTRL_ACCESS_INFOA;
  653. typedef struct _ACTRL_ACCESS_INFOW
  654. {
  655.     ULONG       fAccessPermission;
  656.     LPWSTR      lpAccessPermissionName;
  657. } ACTRL_ACCESS_INFOW, *PACTRL_ACCESS_INFOW;
  658. #ifdef UNICODE
  659. typedef ACTRL_ACCESS_INFOW ACTRL_ACCESS_INFO;
  660. typedef PACTRL_ACCESS_INFOW PACTRL_ACCESS_INFO;
  661. #else
  662. typedef ACTRL_ACCESS_INFOA ACTRL_ACCESS_INFO;
  663. typedef PACTRL_ACCESS_INFOA PACTRL_ACCESS_INFO;
  664. #endif // UNICODE
  665.  
  666. typedef struct _ACTRL_CONTROL_INFOA
  667. {
  668.     LPSTR       lpControlId;
  669.     LPSTR       lpControlName;
  670. } ACTRL_CONTROL_INFOA, *PACTRL_CONTROL_INFOA;
  671. typedef struct _ACTRL_CONTROL_INFOW
  672. {
  673.     LPWSTR      lpControlId;
  674.     LPWSTR      lpControlName;
  675. } ACTRL_CONTROL_INFOW, *PACTRL_CONTROL_INFOW;
  676. #ifdef UNICODE
  677. typedef ACTRL_CONTROL_INFOW ACTRL_CONTROL_INFO;
  678. typedef PACTRL_CONTROL_INFOW PACTRL_CONTROL_INFO;
  679. #else
  680. typedef ACTRL_CONTROL_INFOA ACTRL_CONTROL_INFO;
  681. typedef PACTRL_CONTROL_INFOA PACTRL_CONTROL_INFO;
  682. #endif // UNICODE
  683.  
  684.  
  685. #define ACTRL_ACCESS_NO_OPTIONS                 0x00000000
  686. #define ACTRL_ACCESS_SUPPORTS_OBJECT_ENTRIES    0x00000001
  687.  
  688.  
  689. #ifdef __cplusplus
  690. }
  691. #endif
  692.  
  693. #pragma option pop /*P_O_Pop*/
  694. #endif // __ACCESS_CONTROL__
  695.  
  696.