home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / CBuilder5 / INSTALL / DATA1.CAB / Program_Built_Files / Include / aclui.h < prev    next >
C/C++ Source or Header  |  2000-02-01  |  8KB  |  211 lines

  1. //+--------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (C) Microsoft Corporation, 1994-1999.
  5. //
  6. //  File:       aclui.h
  7. //
  8. //  Contents:   Definitions and prototypes for the ACLUI.DLL
  9. //
  10. //---------------------------------------------------------------------------
  11.  
  12. #ifndef _ACLUI_H_
  13. #pragma option push -b -a8 -pc -A- /*P_O_Push*/
  14. #define _ACLUI_H_
  15.  
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19.  
  20. #include <objbase.h>
  21. #include <commctrl.h>   // for HPROPSHEETPAGE
  22.  
  23.  
  24. #if !defined(_ACLUI_)
  25. #define ACLUIAPI    DECLSPEC_IMPORT WINAPI
  26. #else
  27. #define ACLUIAPI    WINAPI
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif  /* __cplusplus */
  33.  
  34. //
  35. // ISecurityInformation interface
  36. //
  37. //  Methods:
  38. //
  39. //     GetObjectInformation - Allows UI to determine type of object being
  40. //       edited.  Also allows determining if object is a container.
  41. //
  42. //     GetSecurity - Allows retrieving of ACLs from the original object
  43. //                       NOTE: ACLUI will LocalFree the security descriptor
  44. //                       returned by GetSecurity.
  45. //     SetSecurity - Allows setting of the ACLs on the original object
  46. //
  47. //     GetAccessRights - For retrieving the list of rights allowed
  48. //              on this object.
  49. //
  50. //     MapGeneric - For mapping generic rights to standard & specific rights
  51. //
  52. //     GetInheritTypes - For retrieving the list of possible sub-object types
  53. //              for a container.
  54. //
  55. //     PropertySheetCallback - A method which is called back during the various
  56. //              security UI property pages so that specialized work can be
  57. //              done.  Similar to PropSheetPageProc.  If uMsg == PSPCB_CREATE,
  58. //              then any error return value other than E_NOTIMPL will abort
  59. //              the creation of that page.  The type of page being created or
  60. //              destroyed is indicated by the uPage parameter.
  61. //
  62.  
  63. typedef struct _SI_OBJECT_INFO
  64. {
  65.     DWORD       dwFlags;
  66.     HINSTANCE   hInstance;          // resources (e.g. strings) reside here
  67.     LPWSTR      pszServerName;      // must be present
  68.     LPWSTR      pszObjectName;      // must be present
  69.     LPWSTR      pszPageTitle;       // only valid if SI_PAGE_TITLE is set
  70.     GUID        guidObjectType;     // only valid if SI_OBJECT_GUID is set
  71. } SI_OBJECT_INFO, *PSI_OBJECT_INFO;
  72.  
  73. // SI_OBJECT_INFO flags
  74. #define SI_EDIT_PERMS       0x00000000L // always implied
  75. #define SI_EDIT_OWNER       0x00000001L
  76. #define SI_EDIT_AUDITS      0x00000002L
  77. #define SI_CONTAINER        0x00000004L
  78. #define SI_READONLY         0x00000008L
  79. #define SI_ADVANCED         0x00000010L
  80. #define SI_RESET            0x00000020L
  81. #define SI_OWNER_READONLY   0x00000040L
  82. #define SI_EDIT_PROPERTIES  0x00000080L
  83. #define SI_OWNER_RECURSE    0x00000100L
  84. #define SI_NO_ACL_PROTECT   0x00000200L
  85. #define SI_NO_TREE_APPLY    0x00000400L
  86. #define SI_PAGE_TITLE       0x00000800L
  87. #define SI_SERVER_IS_DC     0x00001000L
  88. #define SI_RESET_DACL_TREE  0x00004000L
  89. #define SI_RESET_SACL_TREE  0x00008000L
  90. #define SI_OBJECT_GUID      0x00010000L
  91.  
  92. #define SI_EDIT_ALL     (SI_EDIT_PERMS | SI_EDIT_OWNER | SI_EDIT_AUDITS)
  93.  
  94.  
  95. typedef struct _SI_ACCESS
  96. {
  97.     const GUID *pguid;
  98.     ACCESS_MASK mask;
  99.     LPCWSTR     pszName;            // may be resource ID
  100.     DWORD       dwFlags;
  101. } SI_ACCESS, *PSI_ACCESS;
  102.  
  103. // SI_ACCESS flags
  104. #define SI_ACCESS_SPECIFIC  0x00010000L
  105. #define SI_ACCESS_GENERAL   0x00020000L
  106. #define SI_ACCESS_CONTAINER 0x00040000L // general access, container-only
  107. #define SI_ACCESS_PROPERTY  0x00080000L
  108. // ACE inheritance flags (CONTAINER_INHERIT_ACE, etc.) may also be set.
  109. // They will be used as the inheritance when an access is turned on.
  110.  
  111. typedef struct _SI_INHERIT_TYPE
  112. {
  113.     const GUID *pguid;
  114.     ULONG       dwFlags;
  115.     LPCWSTR     pszName;            // may be resource ID
  116. } SI_INHERIT_TYPE, *PSI_INHERIT_TYPE;
  117.  
  118. // SI_INHERIT_TYPE flags are a combination of INHERIT_ONLY_ACE,
  119. // CONTAINER_INHERIT_ACE, and OBJECT_INHERIT_ACE.
  120.  
  121. typedef enum _SI_PAGE_TYPE
  122. {
  123.     SI_PAGE_PERM=0,
  124.     SI_PAGE_ADVPERM,
  125.     SI_PAGE_AUDIT,
  126.     SI_PAGE_OWNER,
  127. } SI_PAGE_TYPE;
  128.  
  129. // Message to PropertySheetPageCallback (in addition to
  130. // PSPCB_CREATE and PSPCB_RELEASE)
  131. #define PSPCB_SI_INITDIALOG    (WM_USER + 1)
  132.  
  133.  
  134. #undef INTERFACE
  135. #define INTERFACE   ISecurityInformation
  136. DECLARE_INTERFACE_(ISecurityInformation, IUnknown)
  137. {
  138.     // *** IUnknown methods ***
  139.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  140.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  141.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  142.  
  143.     // *** ISecurityInformation methods ***
  144.     STDMETHOD(GetObjectInformation) (THIS_ PSI_OBJECT_INFO pObjectInfo ) PURE;
  145.     STDMETHOD(GetSecurity) (THIS_ SECURITY_INFORMATION RequestedInformation,
  146.                             PSECURITY_DESCRIPTOR *ppSecurityDescriptor,
  147.                             BOOL fDefault ) PURE;
  148.     STDMETHOD(SetSecurity) (THIS_ SECURITY_INFORMATION SecurityInformation,
  149.                             PSECURITY_DESCRIPTOR pSecurityDescriptor ) PURE;
  150.     STDMETHOD(GetAccessRights) (THIS_ const GUID* pguidObjectType,
  151.                                 DWORD dwFlags, // SI_EDIT_AUDITS, SI_EDIT_PROPERTIES
  152.                                 PSI_ACCESS *ppAccess,
  153.                                 ULONG *pcAccesses,
  154.                                 ULONG *piDefaultAccess ) PURE;
  155.     STDMETHOD(MapGeneric) (THIS_ const GUID *pguidObjectType,
  156.                            UCHAR *pAceFlags,
  157.                            ACCESS_MASK *pMask) PURE;
  158.     STDMETHOD(GetInheritTypes) (THIS_ PSI_INHERIT_TYPE *ppInheritTypes,
  159.                                 ULONG *pcInheritTypes ) PURE;
  160.     STDMETHOD(PropertySheetPageCallback)(THIS_ HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage ) PURE;
  161. };
  162. typedef ISecurityInformation *LPSECURITYINFO;
  163.  
  164. #undef INTERFACE
  165. #define INTERFACE   ISecurityInformation2
  166. DECLARE_INTERFACE_(ISecurityInformation2, IUnknown)
  167. {
  168.     // *** IUnknown methods ***
  169.     STDMETHOD(QueryInterface) (THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  170.     STDMETHOD_(ULONG,AddRef) (THIS)  PURE;
  171.     STDMETHOD_(ULONG,Release) (THIS) PURE;
  172.  
  173.     // *** ISecurityInformation2 methods ***
  174.     STDMETHOD_(BOOL,IsDaclCanonical) (THIS_ IN PACL pDacl) PURE;
  175.     STDMETHOD(LookupSids) (THIS_ IN ULONG cSids, IN PSID *rgpSids, OUT LPDATAOBJECT *ppdo) PURE;
  176. };
  177. typedef ISecurityInformation2 *LPSECURITYINFO2;
  178.  
  179. // HGLOBAL containing SID_INFO_LIST returned by ISecurityInformation2::LookupSids
  180. #define CFSTR_ACLUI_SID_INFO_LIST   TEXT("CFSTR_ACLUI_SID_INFO_LIST")
  181.  
  182. // Data structures corresponding to CFSTR_ACLUI_SID_INFO_LIST
  183. typedef struct _SID_INFO
  184. {
  185.     PSID    pSid;
  186.     PWSTR   pwzCommonName;
  187.     PWSTR   pwzClass;       // Used for selecting icon, e.g. "User" or "Group"
  188.     PWSTR   pwzUPN;         // Optional, may be NULL
  189. } SID_INFO, *PSID_INFO;
  190. typedef struct _SID_INFO_LIST
  191. {
  192.     ULONG       cItems;
  193.     SID_INFO    aSidInfo[ANYSIZE_ARRAY];
  194. } SID_INFO_LIST, *PSID_INFO_LIST;
  195.  
  196.  
  197. // {965FC360-16FF-11d0-91CB-00AA00BBB723}
  198. EXTERN_GUID(IID_ISecurityInformation, 0x965fc360, 0x16ff, 0x11d0, 0x91, 0xcb, 0x0, 0xaa, 0x0, 0xbb, 0xb7, 0x23);
  199. // {c3ccfdb4-6f88-11d2-a3ce-00c04fb1782a}
  200. EXTERN_GUID(IID_ISecurityInformation2, 0xc3ccfdb4, 0x6f88, 0x11d2, 0xa3, 0xce, 0x0, 0xc0, 0x4f, 0xb1, 0x78, 0x2a);
  201.  
  202. HPROPSHEETPAGE ACLUIAPI CreateSecurityPage( LPSECURITYINFO psi );
  203. BOOL ACLUIAPI EditSecurity( HWND hwndOwner, LPSECURITYINFO psi );
  204.  
  205. #ifdef __cplusplus
  206. }
  207. #endif  /* __cplusplus */
  208.  
  209. #pragma option pop /*P_O_Pop*/
  210. #endif  /* _ACLUI_H_ */
  211.