home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / RTLWIN32.PAK / ACLAPI.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  13.9 KB  |  442 lines

  1. //+-------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1993-1996.
  5. //
  6. //  File:        aclapi.h
  7. //
  8. //  Contents:    public header file for acl and trusted server access control
  9. //               APIs
  10. //
  11. //--------------------------------------------------------------------
  12.  
  13. /* $Copyright: 1997$ */
  14.  
  15. #ifndef __ACCESS_CONTROL_API__
  16. #define __ACCESS_CONTROL_API__
  17. #pragma option -b
  18.  
  19. #pragma option -b.
  20. #include <windows.h>
  21. #pragma option -b
  22. #pragma option -b.
  23. #include <accctrl.h>
  24. #pragma option -b
  25.  
  26. #ifdef __cplusplus
  27. extern "C" {
  28. #endif
  29.  
  30. DWORD
  31. WINAPI
  32. SetEntriesInAclW( IN  ULONG               cCountOfExplicitEntries,
  33.                   IN  PEXPLICIT_ACCESS_W  pListOfExplicitEntries,
  34.                   IN  PACL                OldAcl,
  35.                   OUT PACL              * NewAcl);
  36.  
  37. DWORD
  38. WINAPI
  39. SetEntriesInAclA( IN  ULONG               cCountOfExplicitEntries,
  40.                   IN  PEXPLICIT_ACCESS_A  pListOfExplicitEntries,
  41.                   IN  PACL                OldAcl,
  42.                   OUT PACL              * NewAcl);
  43.  
  44. #ifdef UNICODE
  45.     #define SetEntriesInAcl     SetEntriesInAclW
  46. #else
  47.     #define SetEntriesInAcl     SetEntriesInAclA
  48. #endif
  49.  
  50.  
  51. DWORD
  52. WINAPI
  53. GetExplicitEntriesFromAclW( IN  PACL                  pacl,
  54.                             OUT PULONG                pcCountOfExplicitEntries,
  55.                             OUT PEXPLICIT_ACCESS_W  * pListOfExplicitEntries);
  56.  
  57. DWORD
  58. WINAPI
  59. GetExplicitEntriesFromAclA( IN  PACL                  pacl,
  60.                             OUT PULONG                pcCountOfExplicitEntries,
  61.                             OUT PEXPLICIT_ACCESS_A  * pListOfExplicitEntries);
  62.  
  63. #ifdef UNICODE
  64.     #define GetExplicitEntriesFromAcl       GetExplicitEntriesFromAclW
  65. #else
  66.     #define GetExplicitEntriesFromAcl       GetExplicitEntriesFromAclA
  67. #endif
  68.  
  69.  
  70. DWORD
  71. WINAPI
  72. GetEffectiveRightsFromAclW( IN  PACL          pacl,
  73.                             IN  PTRUSTEE_W    pTrustee,
  74.                             OUT PACCESS_MASK  pAccessRights);
  75.  
  76. DWORD
  77. WINAPI
  78. GetEffectiveRightsFromAclA( IN  PACL          pacl,
  79.                             IN  PTRUSTEE_A    pTrustee,
  80.                             OUT PACCESS_MASK  pAccessRights);
  81.  
  82. #ifdef UNICODE
  83.     #define GetEffectiveRightsFromAcl       GetEffectiveRightsFromAclW
  84. #else
  85.     #define GetEffectiveRightsFromAcl       GetEffectiveRightsFromAclA
  86. #endif
  87.  
  88.  
  89. DWORD
  90. WINAPI
  91. GetAuditedPermissionsFromAclW( IN  PACL          pacl,
  92.                                IN  PTRUSTEE_W    pTrustee,
  93.                                OUT PACCESS_MASK  pSuccessfulAuditedRights,
  94.                                OUT PACCESS_MASK  pFailedAuditRights);
  95.  
  96. DWORD
  97. WINAPI
  98. GetAuditedPermissionsFromAclA( IN  PACL          pacl,
  99.                                IN  PTRUSTEE_A    pTrustee,
  100.                                OUT PACCESS_MASK  pSuccessfulAuditedRights,
  101.                                OUT PACCESS_MASK  pFailedAuditRights);
  102.  
  103. #ifdef UNICODE
  104.     #define GetAuditedPermissionsFromAcl    GetAuditedPermissionsFromAclW
  105. #else
  106.     #define GetAuditedPermissionsFromAcl    GetAuditedPermissionsFromAclA
  107. #endif
  108.  
  109.  
  110.  
  111. DWORD
  112. WINAPI
  113. GetNamedSecurityInfoW( IN  LPWSTR                 pObjectName,
  114.                        IN  SE_OBJECT_TYPE         ObjectType,
  115.                        IN  SECURITY_INFORMATION   SecurityInfo,
  116.                        OUT PSID                 * ppsidOowner,
  117.                        OUT PSID                 * ppsidGroup,
  118.                        OUT PACL                 * ppDacl,
  119.                        OUT PACL                 * ppSacl,
  120.                        OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
  121.  
  122. DWORD
  123. WINAPI
  124. GetNamedSecurityInfoA( IN  LPSTR                  pObjectName,
  125.                        IN  SE_OBJECT_TYPE         ObjectType,
  126.                        IN  SECURITY_INFORMATION   SecurityInfo,
  127.                        OUT PSID                 * ppsidOowner,
  128.                        OUT PSID                 * ppsidGroup,
  129.                        OUT PACL                 * ppDacl,
  130.                        OUT PACL                 * ppSacl,
  131.                        OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
  132.  
  133. #ifdef UNICODE
  134.     #define GetNamedSecurityInfo        GetNamedSecurityInfoW
  135. #else
  136.     #define GetNamedSecurityInfo        GetNamedSecurityInfoA
  137. #endif
  138.  
  139.  
  140. DWORD
  141. WINAPI
  142. GetSecurityInfo( IN  HANDLE                 handle,
  143.                  IN  SE_OBJECT_TYPE         ObjectType,
  144.                  IN  SECURITY_INFORMATION   SecurityInfo,
  145.                  OUT PSID                 * ppsidOowner,
  146.                  OUT PSID                 * ppsidGroup,
  147.                  OUT PACL                 * ppDacl,
  148.                  OUT PACL                 * ppSacl,
  149.                  OUT PSECURITY_DESCRIPTOR * ppSecurityDescriptor);
  150.  
  151.  
  152. DWORD
  153. WINAPI
  154. SetNamedSecurityInfoW( IN LPWSTR                pObjectName,
  155.                        IN SE_OBJECT_TYPE        ObjectType,
  156.                        IN SECURITY_INFORMATION  SecurityInfo,
  157.                        IN PSID                  psidOowner,
  158.                        IN PSID                  psidGroup,
  159.                        IN PACL                  pDacl,
  160.                        IN PACL                  pSacl);
  161.  
  162. DWORD
  163. WINAPI
  164. SetNamedSecurityInfoA( IN LPSTR                 pObjectName,
  165.                        IN SE_OBJECT_TYPE        ObjectType,
  166.                        IN SECURITY_INFORMATION  SecurityInfo,
  167.                        IN PSID                  psidOowner,
  168.                        IN PSID                  psidGroup,
  169.                        IN PACL                  pDacl,
  170.                        IN PACL                  pSacl);
  171.  
  172. #ifdef UNICODE
  173.     #define SetNamedSecurityInfo        SetNamedSecurityInfoW
  174. #else
  175.     #define SetNamedSecurityInfo        SetNamedSecurityInfoA
  176. #endif
  177.  
  178.  
  179. DWORD
  180. WINAPI
  181. SetSecurityInfo( IN HANDLE                handle,
  182.                  IN SE_OBJECT_TYPE        ObjectType,
  183.                  IN SECURITY_INFORMATION  SecurityInfo,
  184.                  IN PSID                  psidOowner,
  185.                  IN PSID                  psidGroup,
  186.                  IN PACL                  pDacl,
  187.                  IN PACL                  pSacl);
  188.  
  189.  
  190. //----------------------------------------------------------------------------
  191. // The following API are provided for trusted servers to use to
  192. // implement access control on their own objects.
  193. //----------------------------------------------------------------------------
  194.  
  195. DWORD
  196. WINAPI
  197. BuildSecurityDescriptorW( IN  PTRUSTEE_W              pOwner,
  198.                           IN  PTRUSTEE_W              pGroup,
  199.                           IN  ULONG                   cCountOfAccessEntries,
  200.                           IN  PEXPLICIT_ACCESS_W      pListOfAccessEntries,
  201.                           IN  ULONG                   cCountOfAuditEntries,
  202.                           IN  PEXPLICIT_ACCESS_W      pListOfAuditEntries,
  203.                           IN  PSECURITY_DESCRIPTOR    pOldSD,
  204.                           OUT PULONG                  pSizeNewSD,
  205.                           OUT PSECURITY_DESCRIPTOR  * pNewSD);
  206.  
  207. DWORD
  208. WINAPI
  209. BuildSecurityDescriptorA( IN  PTRUSTEE_A              pOwner,
  210.                           IN  PTRUSTEE_A              pGroup,
  211.                           IN  ULONG                   cCountOfAccessEntries,
  212.                           IN  PEXPLICIT_ACCESS_A      pListOfAccessEntries,
  213.                           IN  ULONG                   cCountOfAuditEntries,
  214.                           IN  PEXPLICIT_ACCESS_A      pListOfAuditEntries,
  215.                           IN  PSECURITY_DESCRIPTOR    pOldSD,
  216.                           OUT PULONG                  pSizeNewSD,
  217.                           OUT PSECURITY_DESCRIPTOR  * pNewSD);
  218.  
  219.  
  220. #ifdef UNICODE
  221.     #define BuildSecurityDescriptor     BuildSecurityDescriptorW
  222. #else
  223.     #define BuildSecurityDescriptor     BuildSecurityDescriptorA
  224. #endif
  225.  
  226.  
  227. DWORD
  228. WINAPI
  229. LookupSecurityDescriptorPartsW( OUT PTRUSTEE_W         * pOwner,
  230.                                 OUT PTRUSTEE_W         * pGroup,
  231.                                 OUT PULONG               cCountOfAccessEntries,
  232.                                 OUT PEXPLICIT_ACCESS_W * pListOfAccessEntries,
  233.                                 OUT PULONG               cCountOfAuditEntries,
  234.                                 OUT PEXPLICIT_ACCESS_W * pListOfAuditEntries,
  235.                                 IN  PSECURITY_DESCRIPTOR pSD);
  236.  
  237. DWORD
  238. WINAPI
  239. LookupSecurityDescriptorPartsA( OUT PTRUSTEE_A         * pOwner,
  240.                                 OUT PTRUSTEE_A         * pGroup,
  241.                                 OUT PULONG               cCountOfAccessEntries,
  242.                                 OUT PEXPLICIT_ACCESS_A * pListOfAccessEntries,
  243.                                 OUT PULONG               cCountOfAuditEntries,
  244.                                 OUT PEXPLICIT_ACCESS_A * pListOfAuditEntries,
  245.                                 IN  PSECURITY_DESCRIPTOR pSD);
  246.  
  247. #ifdef UNICODE
  248.     #define LookupSecurityDescriptorParts       LookupSecurityDescriptorPartsW
  249. #else
  250.     #define LookupSecurityDescriptorParts       LookupSecurityDescriptorPartsA
  251. #endif
  252.  
  253.  
  254. //----------------------------------------------------------------------------
  255. // The following helper API are provided for building
  256. // access control structures.
  257. //----------------------------------------------------------------------------
  258.  
  259. VOID
  260. WINAPI
  261. BuildExplicitAccessWithNameW( IN OUT PEXPLICIT_ACCESS_W  pExplicitAccess,
  262.                               IN     LPWSTR              pTrusteeName,
  263.                               IN     DWORD               AccessPermissions,
  264.                               IN     ACCESS_MODE         AccessMode,
  265.                               IN     DWORD               Inheritance);
  266.  
  267. VOID
  268. WINAPI
  269. BuildExplicitAccessWithNameA( IN OUT PEXPLICIT_ACCESS_A  pExplicitAccess,
  270.                               IN     LPSTR               pTrusteeName,
  271.                               IN     DWORD               AccessPermissions,
  272.                               IN     ACCESS_MODE         AccessMode,
  273.                               IN     DWORD               Inheritance);
  274.  
  275. #ifdef UNICODE
  276.     #define BuildExplicitAccessWithName     BuildExplicitAccessWithNameW
  277. #else
  278.     #define BuildExplicitAccessWithName     BuildExplicitAccessWithNameA
  279. #endif
  280.  
  281.  
  282. VOID
  283. WINAPI
  284. BuildImpersonateExplicitAccessWithNameW(
  285.     IN OUT PEXPLICIT_ACCESS_W  pExplicitAccess,
  286.     IN     LPWSTR              pTrusteeName,
  287.     IN     PTRUSTEE_W          pTrustee,
  288.     IN     DWORD               AccessPermissions,
  289.     IN     ACCESS_MODE         AccessMode,
  290.     IN     DWORD               Inheritance);
  291.  
  292. VOID
  293. WINAPI
  294. BuildImpersonateExplicitAccessWithNameA(
  295.     IN OUT PEXPLICIT_ACCESS_A  pExplicitAccess,
  296.     IN     LPSTR               pTrusteeName,
  297.     IN     PTRUSTEE_A          pTrustee,
  298.     IN     DWORD               AccessPermissions,
  299.     IN     ACCESS_MODE         AccessMode,
  300.     IN     DWORD               Inheritance);
  301.  
  302. #ifdef UNICODE
  303.     #define BuildImpersonateExplicitAccessWithName BuildImpersonateExplicitAccessWithNameW
  304. #else
  305.     #define BuildImpersonateExplicitAccessWithName BuildImpersonateExplicitAccessWithNameA
  306. #endif
  307.  
  308.  
  309. VOID
  310. WINAPI
  311. BuildTrusteeWithNameW( IN OUT PTRUSTEE_W  pTrustee,
  312.                        IN     LPWSTR      pName);
  313.  
  314. VOID
  315. WINAPI
  316. BuildTrusteeWithNameA( IN OUT PTRUSTEE_A  pTrustee,
  317.                        IN     LPSTR       pName);
  318.  
  319. #ifdef UNICODE
  320.     #define BuildTrusteeWithName        BuildTrusteeWithNameW
  321. #else
  322.     #define BuildTrusteeWithName        BuildTrusteeWithNameA
  323. #endif
  324.  
  325.  
  326. VOID
  327. WINAPI
  328. BuildImpersonateTrusteeW( IN OUT PTRUSTEE_W  pTrustee,
  329.                           IN     PTRUSTEE_W  pImpersonateTrustee);
  330.  
  331. VOID
  332. WINAPI
  333. BuildImpersonateTrusteeA( IN OUT PTRUSTEE_A  pTrustee,
  334.                           IN     PTRUSTEE_A  pImpersonateTrustee);
  335.  
  336. #ifdef UNICODE
  337.     #define BuildImpersonateTrustee     BuildImpersonateTrusteeW
  338. #else
  339.     #define BuildImpersonateTrustee     BuildImpersonateTrusteeA
  340. #endif
  341.  
  342.  
  343. VOID
  344. WINAPI
  345. BuildTrusteeWithSidW( IN OUT PTRUSTEE_W  pTrustee,
  346.                       IN     PSID        pSid);
  347.  
  348. VOID
  349. WINAPI
  350. BuildTrusteeWithSidA( IN OUT PTRUSTEE_A  pTrustee,
  351.                       IN     PSID        pSid);
  352.  
  353. #ifdef UNICODE
  354.     #define BuildTrusteeWithSid     BuildTrusteeWithSidW
  355. #else
  356.     #define BuildTrusteeWithSid     BuildTrusteeWithSidA
  357. #endif
  358.  
  359.  
  360. LPWSTR
  361. WINAPI
  362. GetTrusteeNameW( IN PTRUSTEE_W  pTrustee);
  363.  
  364. LPSTR
  365. WINAPI
  366. GetTrusteeNameA( IN PTRUSTEE_A  pTrustee);
  367.  
  368. #ifdef UNICODE
  369.     #define GetTrusteeName     GetTrusteeNameW
  370. #else
  371.     #define GetTrusteeName     GetTrusteeNameA
  372. #endif
  373.  
  374.  
  375. TRUSTEE_TYPE
  376. WINAPI
  377. GetTrusteeTypeW( IN PTRUSTEE_W  pTrustee);
  378.  
  379. TRUSTEE_TYPE
  380. WINAPI
  381. GetTrusteeTypeA( IN PTRUSTEE_A  pTrustee);
  382.  
  383. #ifdef UNICODE
  384.     #define GetTrusteeType     GetTrusteeTypeW
  385. #else
  386.     #define GetTrusteeType     GetTrusteeTypeA
  387. #endif
  388.  
  389.  
  390. TRUSTEE_FORM
  391. WINAPI
  392. GetTrusteeFormW( IN PTRUSTEE_W  pTrustee);
  393.  
  394. TRUSTEE_FORM
  395. WINAPI
  396. GetTrusteeFormA( IN PTRUSTEE_A  pTrustee);
  397.  
  398. #ifdef UNICODE
  399.     #define GetTrusteeForm     GetTrusteeFormW
  400. #else
  401.     #define GetTrusteeForm     GetTrusteeFormA
  402. #endif
  403.  
  404.  
  405. MULTIPLE_TRUSTEE_OPERATION
  406. WINAPI
  407. GetMultipleTrusteeOperationW( IN PTRUSTEE_W  pTrustee);
  408.  
  409. MULTIPLE_TRUSTEE_OPERATION
  410. WINAPI
  411. GetMultipleTrusteeOperationA( IN PTRUSTEE_A  pTrustee);
  412.  
  413. #ifdef UNICODE
  414.     #define GetMultipleTrusteeOperation        GetMultipleTrusteeOperationW
  415. #else
  416.     #define GetMultipleTrusteeOperation        GetMultipleTrusteeOperationA
  417. #endif
  418.  
  419.  
  420. PTRUSTEE_W
  421. WINAPI
  422. GetMultipleTrusteeW( IN PTRUSTEE_W  pTrustee);
  423.  
  424. PTRUSTEE_A
  425. WINAPI
  426. GetMultipleTrusteeA( IN PTRUSTEE_A  pTrustee);
  427.  
  428. #ifdef UNICODE
  429.     #define GetMultipleTrustee     GetMultipleTrusteeW
  430. #else
  431.     #define GetMultipleTrustee     GetMultipleTrusteeA
  432. #endif
  433.  
  434.  
  435. #ifdef __cplusplus
  436. }
  437. #endif
  438. #pragma option -b.
  439. #endif // __ACCESS_CONTROL_API__
  440.  
  441.  
  442.