Leaked source code of windows server 2003
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.

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