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.

348 lines
10 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Windows NT Directory Service Property Pages
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1999
  7. //
  8. // File: group.h
  9. //
  10. // Contents: DS object property pages class header
  11. //
  12. // Classes: CDsPropPagesHost, CDsPropPagesHostCF, CDsTableDrivenPage
  13. //
  14. // History: 21-March-97 EricB created
  15. //
  16. //-----------------------------------------------------------------------------
  17. #ifndef _GROUP_H_
  18. #define _GROUP_H_
  19. #include "proppage.h"
  20. #include "pages.h"
  21. #include "objlist.h"
  22. #include <initguid.h>
  23. #include "objselp.h"
  24. HRESULT
  25. CreateGroupMembersPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj,
  26. PWSTR pwzADsPath, PWSTR pwzClass, HWND hNotifyObj,
  27. DWORD dwFlags, CDSBasePathsInfo* pBasePathsInfo,
  28. HPROPSHEETPAGE * phPage);
  29. HRESULT
  30. CreateGroupGenObjPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj,
  31. PWSTR pwzADsPath, PWSTR pwzClass, HWND hNotifyObj,
  32. DWORD dwFlags, CDSBasePathsInfo* pBasePathsInfo,
  33. HPROPSHEETPAGE * phPage);
  34. HRESULT
  35. CreateGrpShlGenPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj,
  36. PWSTR pwzADsPath, PWSTR pwzClass, HWND hNotifyObj,
  37. DWORD dwFlags, CDSBasePathsInfo* pBasePathsInfo,
  38. HPROPSHEETPAGE * phPage);
  39. HRESULT GetDomainMode(CDsPropPageBase * pObj, PBOOL pfMixed);
  40. HRESULT GetDomainMode(PWSTR pwzDomain, HWND hWnd, PBOOL pfMixed);
  41. HRESULT GetGroupType(CDsPropPageBase * pObj, DWORD * pdwType);
  42. //+----------------------------------------------------------------------------
  43. //
  44. // Class: CDsGroupGenObjPage
  45. //
  46. // Purpose: property page object class for the general page of the
  47. // group object.
  48. //
  49. //-----------------------------------------------------------------------------
  50. class CDsGroupGenObjPage : public CDsPropPageBase
  51. {
  52. public:
  53. #ifdef _DEBUG
  54. char szClass[32];
  55. #endif
  56. CDsGroupGenObjPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, HWND hNotifyObj,
  57. DWORD dwFlags);
  58. ~CDsGroupGenObjPage(void);
  59. //
  60. // Instance specific wind proc
  61. //
  62. LRESULT DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  63. private:
  64. HRESULT OnInitDialog(LPARAM lParam);
  65. LRESULT OnApply(void);
  66. LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  67. LRESULT OnNotify(WPARAM wParam, LPARAM lParam);
  68. void OnQuerySiblings(WPARAM wParam, LPARAM lParam);
  69. void OnAttrChanged(WPARAM wParam);
  70. LRESULT OnDestroy(void);
  71. HRESULT IsSpecialAccount(bool& fIsSpecialAccount);
  72. CDsIconCtrl * m_pCIcon;
  73. BOOL m_fMixed; // Domain is in mixed mode
  74. DWORD m_dwType;
  75. BOOL m_fTypeWritable;
  76. BOOL m_fDescrWritable;
  77. BOOL m_fSamNameWritable;
  78. BOOL m_fEmailWritable;
  79. BOOL m_fCommentWritable;
  80. BOOL m_fTypeDirty;
  81. BOOL m_fDescrDirty;
  82. BOOL m_fSamNameDirty;
  83. BOOL m_fEmailDirty;
  84. BOOL m_fCommentDirty;
  85. };
  86. HRESULT FillGroupList(CDsPropPageBase * pPage, CDsMembershipList * pList,
  87. DWORD dwGroupRID);
  88. HRESULT GetRealDN(CDsPropPageBase * pPage, CMemberListItem * pItem);
  89. HRESULT FindFPO(PSID pSid, PWSTR pwzDomain, CStrW & strFPODN);
  90. //+----------------------------------------------------------------------------
  91. //
  92. // CMemberDomainMode helper classes
  93. //
  94. //-----------------------------------------------------------------------------
  95. class CMMMemberListItem : public CDLink
  96. {
  97. public:
  98. CMMMemberListItem(void) {};
  99. ~CMMMemberListItem(void) {};
  100. // CDLink method overrides:
  101. CMMMemberListItem * Next(void) {return (CMMMemberListItem *)CDLink::Next();};
  102. CStr m_strName;
  103. };
  104. class CMMMemberList
  105. {
  106. public:
  107. CMMMemberList(void) : m_pListHead(NULL) {};
  108. ~CMMMemberList(void) {Clear();};
  109. HRESULT Insert(LPCTSTR ptzName);
  110. void GetList(CStr & strList);
  111. void Clear(void);
  112. private:
  113. CMMMemberListItem * m_pListHead;
  114. };
  115. class CDomainModeListItem : public CDLink
  116. {
  117. public:
  118. CDomainModeListItem(void) : m_fMixed(FALSE) {};
  119. ~CDomainModeListItem(void) {};
  120. // CDLink method overrides:
  121. CDomainModeListItem * Next(void) {return (CDomainModeListItem *)CDLink::Next();};
  122. CStrW m_strName;
  123. BOOL m_fMixed;
  124. };
  125. class CDomainModeList
  126. {
  127. public:
  128. CDomainModeList(void) : m_pListHead(NULL) {};
  129. ~CDomainModeList(void);
  130. HRESULT Insert(PWSTR pwzName, BOOL fMixed);
  131. BOOL Find(LPCWSTR pwzDomain, PBOOL pfMixed);
  132. private:
  133. CDomainModeListItem * m_pListHead;
  134. };
  135. //+----------------------------------------------------------------------------
  136. //
  137. // Class: CMemberDomainMode
  138. //
  139. // Purpose: Maintains a list of all domains in the enterprise from which
  140. // members have been added along with those domains' mode. Keeps
  141. // a second list of members who have been added from mixed-mode
  142. // domains.
  143. //
  144. //-----------------------------------------------------------------------------
  145. class CMemberDomainMode
  146. {
  147. public:
  148. CMemberDomainMode(void) {};
  149. ~CMemberDomainMode(void) {};
  150. void Init(CDsPropPageBase * pPage);
  151. HRESULT CheckMember(PWSTR pwzMemberDN);
  152. HRESULT ListExternalMembers(CStr & strList);
  153. private:
  154. CDomainModeList m_DomainList;
  155. CMMMemberList m_MemberList;
  156. CDsPropPageBase * m_pPage;
  157. };
  158. //+----------------------------------------------------------------------------
  159. //
  160. // Class: CDsSelectionListWrapper
  161. //
  162. // Purpose: A wrapper class for the DS_SELECTION_LIST that maintains a
  163. // linked list of DS_SELECTION items and can make a DS_SELECTION_LIST
  164. // from that list
  165. //
  166. //-----------------------------------------------------------------------------
  167. class CDsSelectionListWrapper
  168. {
  169. public:
  170. CDsSelectionListWrapper() : m_pNext(NULL), m_pSelection(NULL) {}
  171. ~CDsSelectionListWrapper() {}
  172. CDsSelectionListWrapper* m_pNext;
  173. PDS_SELECTION m_pSelection;
  174. static PDS_SELECTION_LIST CreateSelectionList(CDsSelectionListWrapper* pHead);
  175. static UINT GetCount(CDsSelectionListWrapper* pHead);
  176. static void DetachItemsAndDeleteList(CDsSelectionListWrapper* pHead);
  177. };
  178. //+----------------------------------------------------------------------------
  179. //
  180. // Class: CDsGrpMembersPage
  181. //
  182. // Purpose: Property page object class for the group object's membership
  183. // page.
  184. //
  185. //-----------------------------------------------------------------------------
  186. class CDsGrpMembersPage : public CDsPropPageBase,
  187. public ICustomizeDsBrowser
  188. {
  189. public:
  190. #ifdef _DEBUG
  191. char szClass[32];
  192. #endif
  193. CDsGrpMembersPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, HWND hNotifyObj,
  194. DWORD dwFlags);
  195. ~CDsGrpMembersPage(void);
  196. //
  197. // IUknown methods
  198. //
  199. STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObject);
  200. STDMETHOD_(ULONG, AddRef)(void);
  201. STDMETHOD_(ULONG, Release)(void);
  202. //
  203. // ICustomizeDsBrowser methods
  204. //
  205. STDMETHOD(Initialize)(THIS_
  206. HWND hwnd,
  207. PCDSOP_INIT_INFO pInitInfo,
  208. IBindHelper *pBindHelper);
  209. STDMETHOD(GetQueryInfoByScope)(THIS_
  210. IDsObjectPickerScope *pDsScope,
  211. PDSQUERYINFO *ppdsqi);
  212. STDMETHOD(AddObjects)(THIS_
  213. IDsObjectPickerScope *pDsScope,
  214. IDataObject **ppdo);
  215. STDMETHOD(ApproveObjects)(THIS_
  216. IDsObjectPickerScope*,
  217. IDataObject*,
  218. PBOOL) { return S_OK; } // Approve everything
  219. STDMETHOD(PrefixSearch)(THIS_
  220. IDsObjectPickerScope *pDsScope,
  221. PCWSTR pwzSearchFor,
  222. IDataObject **pdo);
  223. STDMETHOD_(PSID, LookupDownlevelName)(THIS_
  224. PCWSTR) { return NULL; }
  225. //
  226. // Instance specific wind proc
  227. //
  228. LRESULT DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  229. BOOL m_fShowIcons;
  230. protected:
  231. HRESULT OnInitDialog(LPARAM lParam);
  232. HRESULT OnInitDialog(LPARAM lParam, BOOL fShowIcons);
  233. LRESULT OnApply(void);
  234. virtual LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  235. LRESULT OnNotify(WPARAM wParam, LPARAM lParam);
  236. LRESULT OnDestroy(void);
  237. private:
  238. void InvokeUserQuery(void);
  239. void RemoveMember(void);
  240. HRESULT FillGroupList(void);
  241. HRESULT GetRealDN(CMemberListItem * pDelItem);
  242. HRESULT LoadGroupExtraClasses(BOOL bSecurity);
  243. HRESULT BuildQueryString(PWSTR* ppszFilterString);
  244. HRESULT CollectDsObjects(PWSTR pszFilter,
  245. IDsObjectPickerScope *pDsScope,
  246. CDsPropDataObj *pdo);
  247. PWSTR* m_pszSecurityGroupExtraClasses;
  248. DWORD m_dwSecurityGroupExtraClassesCount;
  249. PWSTR* m_pszNonSecurityGroupExtraClasses;
  250. DWORD m_dwNonSecurityGroupExtraClassesCount;
  251. HWND m_hwndObjPicker;
  252. PCDSOP_INIT_INFO m_pInitInfo;
  253. CComPtr<IBindHelper> m_pBinder;
  254. protected:
  255. CDsMembershipList * m_pList;
  256. CMemberLinkList m_DelList;
  257. DWORD m_dwGroupRID;
  258. BOOL m_fMixed; // Domain is in mixed mode
  259. DWORD m_dwType;
  260. BOOL m_fMemberWritable;
  261. CMemberDomainMode m_MixedModeMembers;
  262. };
  263. //+----------------------------------------------------------------------------
  264. //
  265. // Class: CDsGrpShlGenPage
  266. //
  267. // Purpose: Property page object class for the group object's shell general
  268. // page which includes membership manipulation which is gained by
  269. // subclassing CDsGrpMembersPage.
  270. //
  271. //-----------------------------------------------------------------------------
  272. class CDsGrpShlGenPage : public CDsGrpMembersPage
  273. {
  274. public:
  275. #ifdef _DEBUG
  276. char szClass[32];
  277. #endif
  278. CDsGrpShlGenPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, HWND hNotifyObj,
  279. DWORD dwFlags);
  280. ~CDsGrpShlGenPage(void);
  281. private:
  282. HRESULT OnInitDialog(LPARAM lParam);
  283. LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  284. LRESULT OnApply(void);
  285. LRESULT OnDestroy(void);
  286. #if !defined(DSADMIN)
  287. void MakeNotWritable() { m_fMemberWritable = FALSE; m_fDescrWritable = FALSE;}
  288. #endif
  289. CDsIconCtrl * m_pCIcon;
  290. BOOL m_fDescrWritable;
  291. BOOL m_fDescrDirty;
  292. };
  293. #endif // _GROUP_H_