Home | History | Annotate | Download | only in include
      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 _ACLUI_H_
      7 #define _ACLUI_H_
      8 
      9 #include <objbase.h>
     10 #include <commctrl.h>
     11 #include <accctrl.h>
     12 
     13 #ifndef _ACLUI_
     14 #define ACLUIAPI DECLSPEC_IMPORT WINAPI
     15 #else
     16 #define ACLUIAPI WINAPI
     17 #endif
     18 
     19 #ifdef __cplusplus
     20 extern "C" {
     21 #endif
     22 
     23   typedef struct _SI_OBJECT_INFO {
     24     DWORD dwFlags;
     25     HINSTANCE hInstance;
     26     LPWSTR pszServerName;
     27     LPWSTR pszObjectName;
     28     LPWSTR pszPageTitle;
     29     GUID guidObjectType;
     30   } SI_OBJECT_INFO,*PSI_OBJECT_INFO;
     31 
     32 #define SI_EDIT_PERMS __MSABI_LONG(0x00000000)
     33 #define SI_EDIT_OWNER __MSABI_LONG(0x00000001)
     34 #define SI_EDIT_AUDITS __MSABI_LONG(0x00000002)
     35 #define SI_CONTAINER __MSABI_LONG(0x00000004)
     36 #define SI_READONLY __MSABI_LONG(0x00000008)
     37 #define SI_ADVANCED __MSABI_LONG(0x00000010)
     38 #define SI_RESET __MSABI_LONG(0x00000020)
     39 #define SI_OWNER_READONLY __MSABI_LONG(0x00000040)
     40 #define SI_EDIT_PROPERTIES __MSABI_LONG(0x00000080)
     41 #define SI_OWNER_RECURSE __MSABI_LONG(0x00000100)
     42 #define SI_NO_ACL_PROTECT __MSABI_LONG(0x00000200)
     43 #define SI_NO_TREE_APPLY __MSABI_LONG(0x00000400)
     44 #define SI_PAGE_TITLE __MSABI_LONG(0x00000800)
     45 #define SI_SERVER_IS_DC __MSABI_LONG(0x00001000)
     46 #define SI_RESET_DACL_TREE __MSABI_LONG(0x00004000)
     47 #define SI_RESET_SACL_TREE __MSABI_LONG(0x00008000)
     48 #define SI_OBJECT_GUID __MSABI_LONG(0x00010000)
     49 #define SI_EDIT_EFFECTIVE __MSABI_LONG(0x00020000)
     50 #define SI_RESET_DACL __MSABI_LONG(0x00040000)
     51 #define SI_RESET_SACL __MSABI_LONG(0x00080000)
     52 #define SI_RESET_OWNER __MSABI_LONG(0x00100000)
     53 #define SI_NO_ADDITIONAL_PERMISSION __MSABI_LONG(0x00200000)
     54 #define SI_MAY_WRITE __MSABI_LONG(0x10000000)
     55 
     56 #define SI_EDIT_ALL (SI_EDIT_PERMS | SI_EDIT_OWNER | SI_EDIT_AUDITS)
     57 
     58   typedef struct _SI_ACCESS {
     59     const GUID *pguid;
     60     ACCESS_MASK mask;
     61     LPCWSTR pszName;
     62     DWORD dwFlags;
     63   } SI_ACCESS,*PSI_ACCESS;
     64 
     65 #define SI_ACCESS_SPECIFIC __MSABI_LONG(0x00010000)
     66 #define SI_ACCESS_GENERAL __MSABI_LONG(0x00020000)
     67 #define SI_ACCESS_CONTAINER __MSABI_LONG(0x00040000)
     68 #define SI_ACCESS_PROPERTY __MSABI_LONG(0x00080000)
     69 
     70   typedef struct _SI_INHERIT_TYPE {
     71     const GUID *pguid;
     72     ULONG dwFlags;
     73     LPCWSTR pszName;
     74   } SI_INHERIT_TYPE,*PSI_INHERIT_TYPE;
     75 
     76   typedef enum _SI_PAGE_TYPE {
     77     SI_PAGE_PERM=0,SI_PAGE_ADVPERM,SI_PAGE_AUDIT,SI_PAGE_OWNER,SI_PAGE_EFFECTIVE,
     78   } SI_PAGE_TYPE;
     79 
     80 #define PSPCB_SI_INITDIALOG (WM_USER+1)
     81 #undef INTERFACE
     82 #define INTERFACE ISecurityInformation
     83   DECLARE_INTERFACE_(ISecurityInformation,IUnknown) {
     84     STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
     85     STDMETHOD_(ULONG,AddRef) (THIS) PURE;
     86     STDMETHOD_(ULONG,Release) (THIS) PURE;
     87     STDMETHOD(GetObjectInformation) (THIS_ PSI_OBJECT_INFO pObjectInfo) PURE;
     88     STDMETHOD(GetSecurity) (THIS_ SECURITY_INFORMATION RequestedInformation,PSECURITY_DESCRIPTOR *ppSecurityDescriptor,WINBOOL fDefault) PURE;
     89     STDMETHOD(SetSecurity) (THIS_ SECURITY_INFORMATION SecurityInformation,PSECURITY_DESCRIPTOR pSecurityDescriptor) PURE;
     90     STDMETHOD(GetAccessRights) (THIS_ const GUID *pguidObjectType,DWORD dwFlags,PSI_ACCESS *ppAccess,ULONG *pcAccesses,ULONG *piDefaultAccess) PURE;
     91     STDMETHOD(MapGeneric) (THIS_ const GUID *pguidObjectType,UCHAR *pAceFlags,ACCESS_MASK *pMask) PURE;
     92     STDMETHOD(GetInheritTypes) (THIS_ PSI_INHERIT_TYPE *ppInheritTypes,ULONG *pcInheritTypes) PURE;
     93     STDMETHOD(PropertySheetPageCallback)(THIS_ HWND hwnd,UINT uMsg,SI_PAGE_TYPE uPage) PURE;
     94   };
     95   typedef ISecurityInformation *LPSECURITYINFO;
     96 
     97 #undef INTERFACE
     98 #define INTERFACE ISecurityInformation2
     99   DECLARE_INTERFACE_(ISecurityInformation2,IUnknown) {
    100     STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
    101     STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    102     STDMETHOD_(ULONG,Release) (THIS) PURE;
    103     STDMETHOD_(WINBOOL,IsDaclCanonical) (THIS_ PACL pDacl) PURE;
    104     STDMETHOD(LookupSids) (THIS_ ULONG cSids,PSID *rgpSids,LPDATAOBJECT *ppdo) PURE;
    105   };
    106   typedef ISecurityInformation2 *LPSECURITYINFO2;
    107 
    108 #define CFSTR_ACLUI_SID_INFO_LIST TEXT("CFSTR_ACLUI_SID_INFO_LIST")
    109 
    110   typedef struct _SID_INFO {
    111     PSID pSid;
    112     PWSTR pwzCommonName;
    113     PWSTR pwzClass;
    114     PWSTR pwzUPN;
    115   } SID_INFO,*PSID_INFO;
    116 
    117   typedef struct _SID_INFO_LIST {
    118     ULONG cItems;
    119     SID_INFO aSidInfo[ANYSIZE_ARRAY];
    120   } SID_INFO_LIST,*PSID_INFO_LIST;
    121 
    122 #undef INTERFACE
    123 #define INTERFACE IEffectivePermission
    124   DECLARE_INTERFACE_(IEffectivePermission,IUnknown) {
    125     STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
    126     STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    127     STDMETHOD_(ULONG,Release) (THIS) PURE;
    128     STDMETHOD(GetEffectivePermission) (THIS_ const GUID *pguidObjectType,PSID pUserSid,LPCWSTR pszServerName,PSECURITY_DESCRIPTOR pSD,POBJECT_TYPE_LIST *ppObjectTypeList,ULONG *pcObjectTypeListLength,PACCESS_MASK *ppGrantedAccessList,ULONG *pcGrantedAccessListLength) PURE;
    129   };
    130   typedef IEffectivePermission *LPEFFECTIVEPERMISSION;
    131 
    132 #undef INTERFACE
    133 #define INTERFACE ISecurityObjectTypeInfo
    134   DECLARE_INTERFACE_(ISecurityObjectTypeInfo,IUnknown) {
    135     STDMETHOD(QueryInterface) (THIS_ REFIID riid,LPVOID *ppvObj) PURE;
    136     STDMETHOD_(ULONG,AddRef) (THIS) PURE;
    137     STDMETHOD_(ULONG,Release) (THIS) PURE;
    138     STDMETHOD(GetInheritSource)(SECURITY_INFORMATION si,PACL pACL,PINHERITED_FROM *ppInheritArray) PURE;
    139   };
    140   typedef ISecurityObjectTypeInfo *LPSecurityObjectTypeInfo;
    141 
    142   EXTERN_GUID(IID_ISecurityInformation,0x965fc360,0x16ff,0x11d0,0x91,0xcb,0x0,0xaa,0x0,0xbb,0xb7,0x23);
    143   EXTERN_GUID(IID_ISecurityInformation2,0xc3ccfdb4,0x6f88,0x11d2,0xa3,0xce,0x0,0xc0,0x4f,0xb1,0x78,0x2a);
    144   EXTERN_GUID(IID_IEffectivePermission,0x3853dc76,0x9f35,0x407c,0x88,0xa1,0xd1,0x93,0x44,0x36,0x5f,0xbc);
    145   EXTERN_GUID(IID_ISecurityObjectTypeInfo,0xfc3066eb,0x79ef,0x444b,0x91,0x11,0xd1,0x8a,0x75,0xeb,0xf2,0xfa);
    146 
    147   HPROPSHEETPAGE ACLUIAPI CreateSecurityPage(LPSECURITYINFO psi);
    148   WINBOOL ACLUIAPI EditSecurity(HWND hwndOwner,LPSECURITYINFO psi);
    149 
    150 #ifdef __cplusplus
    151 }
    152 #endif
    153 #endif
    154