Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

247 lines
6.6 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1998-2001 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // AclBase.h
  7. //
  8. // Description:
  9. // Implementation of the ISecurityInformation interface. This interface
  10. // is the new common security UI in NT 5.0.
  11. //
  12. // Implementation File:
  13. // AclBase.cpp
  14. //
  15. // Author:
  16. // Galen Barbee (galenb) February 6, 1998
  17. // From \nt\private\admin\snapin\filemgmt\permpage.h
  18. // by JonN
  19. //
  20. // Revision History:
  21. //
  22. // Notes:
  23. //
  24. /////////////////////////////////////////////////////////////////////////////
  25. #ifndef _ACLBASE_H
  26. #define _ACLBASE_H
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Include Files
  29. /////////////////////////////////////////////////////////////////////////////
  30. #ifndef _ACLUI_H_
  31. #include <aclui.h> // for ISecurityInformation
  32. #endif // _ACLUI_H_
  33. #include "CluAdmEx.h"
  34. #include <ObjSel.h>
  35. /*
  36. #define NT5_UGOP_FLAGS ( UGOP_USERS \
  37. | UGOP_ACCOUNT_GROUPS_SE \
  38. | UGOP_UNIVERSAL_GROUPS_SE \
  39. | UGOP_COMPUTERS \
  40. | UGOP_WELL_KNOWN_PRINCIPALS_USERS \
  41. )
  42. #define NT4_UGOP_FLAGS ( UGOP_USERS \
  43. | UGOP_GLOBAL_GROUPS \
  44. | UGOP_ALL_NT4_WELLKNOWN_SIDS \
  45. )
  46. */
  47. /* These are here to help document what the macro does...
  48. typedef struct _DSOP_UPLEVEL_FILTER_FLAGS
  49. {
  50. ULONG flBothModes; //b
  51. ULONG flMixedModeOnly; //m
  52. ULONG flNativeModeOnly; //n
  53. } DSOP_UPLEVEL_FILTER_FLAGS;
  54. typedef struct _DSOP_FILTER_FLAGS
  55. {
  56. DSOP_UPLEVEL_FILTER_FLAGS Uplevel;
  57. ULONG flDownlevel; //d
  58. } DSOP_FILTER_FLAGS;
  59. typedef struct _DSOP_SCOPE_INIT_INFO
  60. {
  61. ULONG cbSize;
  62. ULONG flType; //t
  63. ULONG flScope; //f
  64. DSOP_FILTER_FLAGS FilterFlags;
  65. PCWSTR pwzDcName;
  66. PCWSTR pwzADsPath;
  67. HRESULT hr;
  68. } DSOP_SCOPE_INIT_INFO, *PDSOP_SCOPE_INIT_INFO;
  69. */
  70. #define DECLARE_SCOPE(t,f,b,m,n,d) \
  71. { sizeof(DSOP_SCOPE_INIT_INFO), (t), (f), { { (b), (m), (n) }, (d) }, NULL, NULL, S_OK }
  72. static const DSOP_SCOPE_INIT_INFO g_aDSOPScopes[] =
  73. {
  74. // The domain to which the target computer is joined.
  75. DECLARE_SCOPE(DSOP_SCOPE_TYPE_UPLEVEL_JOINED_DOMAIN,
  76. 0,
  77. DSOP_FILTER_USERS
  78. | DSOP_FILTER_UNIVERSAL_GROUPS_SE
  79. | DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
  80. | DSOP_FILTER_WELL_KNOWN_PRINCIPALS
  81. | DSOP_FILTER_INCLUDE_ADVANCED_VIEW,
  82. 0,
  83. 0,
  84. 0 ),
  85. // The external domain to which the target computer is joined.
  86. DECLARE_SCOPE(DSOP_SCOPE_TYPE_ENTERPRISE_DOMAIN,
  87. 0,
  88. DSOP_FILTER_USERS
  89. | DSOP_FILTER_UNIVERSAL_GROUPS_SE
  90. | DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
  91. | DSOP_FILTER_WELL_KNOWN_PRINCIPALS
  92. | DSOP_FILTER_INCLUDE_ADVANCED_VIEW,
  93. 0,
  94. 0,
  95. 0 ),
  96. // The external domain to which the target computer is joined.
  97. DECLARE_SCOPE(DSOP_SCOPE_TYPE_EXTERNAL_UPLEVEL_DOMAIN,
  98. 0,
  99. DSOP_FILTER_USERS
  100. | DSOP_FILTER_UNIVERSAL_GROUPS_SE
  101. | DSOP_FILTER_DOMAIN_LOCAL_GROUPS_SE
  102. | DSOP_FILTER_WELL_KNOWN_PRINCIPALS
  103. | DSOP_FILTER_INCLUDE_ADVANCED_VIEW,
  104. 0,
  105. 0,
  106. 0 ),
  107. // The downlevel domain to which the target computer is joined.
  108. DECLARE_SCOPE(DSOP_SCOPE_TYPE_DOWNLEVEL_JOINED_DOMAIN,
  109. 0,
  110. 0,
  111. 0,
  112. 0,
  113. DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
  114. | DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
  115. | DSOP_DOWNLEVEL_FILTER_USERS,
  116. ),
  117. // The downlevel domain to which the target computer is joined.
  118. DECLARE_SCOPE(DSOP_SCOPE_TYPE_EXTERNAL_DOWNLEVEL_DOMAIN,
  119. 0,
  120. 0,
  121. 0,
  122. 0,
  123. DSOP_DOWNLEVEL_FILTER_ALL_WELLKNOWN_SIDS
  124. | DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
  125. | DSOP_DOWNLEVEL_FILTER_USERS,
  126. ),
  127. // The target computer
  128. DECLARE_SCOPE(DSOP_SCOPE_TYPE_TARGET_COMPUTER,
  129. DSOP_SCOPE_FLAG_STARTING_SCOPE,
  130. 0,
  131. 0,
  132. 0,
  133. DSOP_DOWNLEVEL_FILTER_SYSTEM
  134. | DSOP_DOWNLEVEL_FILTER_GLOBAL_GROUPS
  135. | DSOP_DOWNLEVEL_FILTER_LOCAL_GROUPS
  136. )
  137. }; // struct DSOP_SCOPE_INIT_INFO g_aDSOPScopes
  138. /////////////////////////////////////////////////////////////////////////////
  139. // Forward Class Declarations
  140. /////////////////////////////////////////////////////////////////////////////
  141. class CSecurityInformation;
  142. /////////////////////////////////////////////////////////////////////////////
  143. // External Class Declarations
  144. /////////////////////////////////////////////////////////////////////////////
  145. /////////////////////////////////////////////////////////////////////////////
  146. // CSecurityInformation security wrapper
  147. /////////////////////////////////////////////////////////////////////////////
  148. class CSecurityInformation : public ISecurityInformation, public CComObjectRoot, public IDsObjectPicker
  149. {
  150. DECLARE_NOT_AGGREGATABLE(CSecurityInformation)
  151. BEGIN_COM_MAP(CSecurityInformation)
  152. COM_INTERFACE_ENTRY(ISecurityInformation)
  153. COM_INTERFACE_ENTRY(IDsObjectPicker)
  154. END_COM_MAP()
  155. // *** IUnknown methods ***
  156. STDMETHOD_(ULONG, AddRef)( void )
  157. {
  158. return InternalAddRef();
  159. }
  160. STDMETHOD_(ULONG, Release)( void )
  161. {
  162. ULONG l = InternalRelease();
  163. if (l == 0)
  164. {
  165. delete this;
  166. }
  167. return l;
  168. }
  169. // *** ISecurityInformation methods ***
  170. STDMETHOD(GetObjectInformation)( PSI_OBJECT_INFO pObjectInfo );
  171. STDMETHOD(GetSecurity)( SECURITY_INFORMATION RequestedInformation,
  172. PSECURITY_DESCRIPTOR * ppSecurityDescriptor,
  173. BOOL fDefault ) = 0;
  174. STDMETHOD(SetSecurity)( SECURITY_INFORMATION SecurityInformation,
  175. PSECURITY_DESCRIPTOR pSecurityDescriptor );
  176. STDMETHOD(GetAccessRights)( const GUID * pguidObjectType,
  177. DWORD dwFlags,
  178. PSI_ACCESS * ppAccess,
  179. ULONG * pcAccesses,
  180. ULONG * piDefaultAccess );
  181. STDMETHOD(MapGeneric)( const GUID * pguidObjectType,
  182. UCHAR * pAceFlags,
  183. ACCESS_MASK * pMask );
  184. STDMETHOD(GetInheritTypes)( PSI_INHERIT_TYPE * ppInheritTypes,
  185. ULONG * pcInheritTypes );
  186. STDMETHOD(PropertySheetPageCallback)( HWND hwnd, UINT uMsg, SI_PAGE_TYPE uPage );
  187. // IDsObjectPicker
  188. STDMETHODIMP Initialize( PDSOP_INIT_INFO pInitInfo );
  189. STDMETHODIMP InvokeDialog( HWND hwndParent, IDataObject ** ppdoSelection );
  190. protected:
  191. CSecurityInformation( void );
  192. ~CSecurityInformation( void );
  193. HRESULT HrLocalAccountsInSD( IN PSECURITY_DESCRIPTOR pSD, OUT PBOOL pFound );
  194. PGENERIC_MAPPING m_pShareMap;
  195. PSI_ACCESS m_psiAccess;
  196. int m_nDefAccess;
  197. int m_nAccessElems;
  198. DWORD m_dwFlags;
  199. CString m_strServer;
  200. CString m_strNode;
  201. int m_nLocalSIDErrorMessageID;
  202. IDsObjectPicker * m_pObjectPicker;
  203. LONG m_cRef;
  204. };
  205. #endif //_ACLBASE_H