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.

722 lines
24 KiB

  1. //+----------------------------------------------------------------------------
  2. //
  3. // Windows NT Active Directory Service Property Pages
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1999
  7. //
  8. // File: proppage.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 _PROPPAGE_H_
  18. #define _PROPPAGE_H_
  19. #include "adsprop.h"
  20. #include "pages.h"
  21. #include "strings.h"
  22. #include "notify.h"
  23. #define DSPROP_HELP_FILE_NAME TEXT("adprop.hlp")
  24. #define ADM_S_SKIP MAKE_HRESULT(SEVERITY_SUCCESS, 0, (PSNRET_INVALID_NOCHANGEPAGE + 2))
  25. #define DSPROP_DESCRIPTION_RANGE_UPPER 1024
  26. struct _DSPAGE; // forward declaration.
  27. class CDsPropPagesHost; // forward declaration.
  28. class CDsPropPageBase; // forward declaration.
  29. // Prototype for page creation function. The function should return S_FALSE if
  30. // the page shouldn't be created due to a non-error condition.
  31. //
  32. typedef HRESULT (*CREATE_PAGE)(struct _DSPAGE * pDsPage, LPDATAOBJECT pDataObj,
  33. PWSTR pwzObjDN, PWSTR pwszObjName,
  34. HWND hNotifyWnd, DWORD dwFlags,
  35. const CDSSmartBasePathsInfo& basePathsInfo,
  36. HPROPSHEETPAGE * phPage);
  37. typedef enum _DlgOp {
  38. fInit = 0,
  39. fApply,
  40. fOnCommand,
  41. fOnNotify,
  42. fOnDestroy,
  43. fOnCallbackRelease,
  44. fObjChanged,
  45. fAttrChange,
  46. fQuerySibling,
  47. fOnSetActive,
  48. fOnKillActive
  49. } DLG_OP;
  50. //+----------------------------------------------------------------------------
  51. //
  52. // Struct: ATTR_DATA
  53. //
  54. // Purpose: Per-Attribute data. The ATTR_DATA_WRITABLE bit is set if the
  55. // corresponding attribute is found in the Allowed-Attributes-
  56. // Effective list. The pAttrData struct pointer is passed to the
  57. // attr function where it can use the pVoid member for its private
  58. // storage needs.
  59. //
  60. //-----------------------------------------------------------------------------
  61. typedef struct _ATTR_DATA {
  62. DWORD dwFlags;
  63. LPARAM pVoid;
  64. } ATTR_DATA, * PATTR_DATA;
  65. #define ATTR_DATA_WRITABLE (0x00000001)
  66. #define ATTR_DATA_DIRTY (0x00000002)
  67. #define ATTR_DATA_IS_WRITABLE(ad) (ad.dwFlags & ATTR_DATA_WRITABLE)
  68. #define PATTR_DATA_IS_WRITABLE(pad) (pad->dwFlags & ATTR_DATA_WRITABLE)
  69. #define ATTR_DATA_IS_DIRTY(ad) (ad.dwFlags & ATTR_DATA_DIRTY)
  70. #define PATTR_DATA_IS_DIRTY(pad) (pad->dwFlags & ATTR_DATA_DIRTY)
  71. #define ATTR_DATA_SET_WRITABLE(ad) (ad.dwFlags |= ATTR_DATA_WRITABLE)
  72. #define PATTR_DATA_SET_WRITABLE(pad) (pad->dwFlags |= ATTR_DATA_WRITABLE)
  73. #define ATTR_DATA_CLEAR_WRITABLE(ad) (ad.dwFlags &= ~ATTR_DATA_WRITABLE)
  74. #define PATTR_DATA_CLEAR_WRITABLE(pad) (pad->dwFlags &= ~ATTR_DATA_WRITABLE)
  75. #define ATTR_DATA_SET_DIRTY(ad) (ad.dwFlags |= ATTR_DATA_DIRTY)
  76. #define PATTR_DATA_SET_DIRTY(pad) (pad->dwFlags |= ATTR_DATA_DIRTY)
  77. #define ATTR_DATA_CLEAR_DIRTY(ad) (ad.dwFlags &= ~ATTR_DATA_DIRTY)
  78. #define PATTR_DATA_CLEAR_DIRTY(pad) (pad->dwFlags &= ~ATTR_DATA_DIRTY)
  79. struct _ATTR_MAP; // forward declaration.
  80. typedef HRESULT (*PATTR_FCN)(CDsPropPageBase *, struct _ATTR_MAP *,
  81. PADS_ATTR_INFO, LPARAM, PATTR_DATA, DLG_OP);
  82. //+----------------------------------------------------------------------------
  83. //
  84. // Struct: ATTR_MAP
  85. //
  86. // Purpose: For each attribute on a property page, relates the control
  87. // ID, the attribute name and the attribute type.
  88. //
  89. // Notes: The standard table-driven processing assumes that nCtrlID is
  90. // valid unless pAttrFcn is defined, in which case the attr
  91. // function may choose to hard code the control ID.
  92. //
  93. //-----------------------------------------------------------------------------
  94. typedef struct _ATTR_MAP {
  95. int nCtrlID; // Control resource ID
  96. BOOL fIsReadOnly;
  97. BOOL fIsMultiValued; // From schema.ini: Is-Single-Valued
  98. DWORD nSizeLimit;
  99. ADS_ATTR_INFO AttrInfo;
  100. PATTR_FCN pAttrFcn; // Optional function pointer.
  101. PVOID pData;
  102. } ATTR_MAP, * PATTR_MAP;
  103. //+----------------------------------------------------------------------------
  104. //
  105. // Struct: DSPAGE
  106. //
  107. // Purpose: For each property page, lists the page title resource ID, the
  108. // page dialog templage ID, flags, the count and list of CLSIDs
  109. // for which this page should be shown, a pointer to a
  110. // page-class-specific creation function, and the count and list
  111. // of attributes. If nCLSIDs is zero, then the page should always
  112. // be shown.
  113. //
  114. //-----------------------------------------------------------------------------
  115. typedef struct _DSPAGE {
  116. int nPageTitle;
  117. int nDlgTemplate;
  118. DWORD dwFlags;
  119. DWORD nCLSIDs;
  120. const CLSID * rgCLSID;
  121. CREATE_PAGE pCreateFcn;
  122. DWORD cAttrs;
  123. PATTR_MAP * rgpAttrMap;
  124. } DSPAGE, * PDSPAGE;
  125. //+----------------------------------------------------------------------------
  126. //
  127. // Struct: DSCLASSPAGES
  128. //
  129. // Purpose: For each CLSID, lists the prog ID, the number of pages, and the
  130. // list of pages.
  131. //
  132. //-----------------------------------------------------------------------------
  133. typedef struct _DSCLASSPAGES {
  134. const CLSID * pcid;
  135. LPTSTR szProgID;
  136. DWORD cPages;
  137. PDSPAGE * rgpDsPages;
  138. } DSCLASSPAGES, * PDSCLASSPAGES;
  139. //+----------------------------------------------------------------------------
  140. //
  141. // Struct: RGDSPPCLASSES
  142. //
  143. // Purpose: Contains the count and list of classes supported by this DLL.
  144. //
  145. //-----------------------------------------------------------------------------
  146. typedef struct _RGDSPPCLASSES {
  147. int cClasses;
  148. PDSCLASSPAGES * rgpClass;
  149. } RGDSPPCLASSES, * PRGDSPPCLASSES;
  150. // Table driven page creation function.
  151. //
  152. HRESULT
  153. CreateTableDrivenPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj,
  154. PWSTR pwzADsPath, PWSTR pwzObjName,
  155. HWND hNotifyWnd, DWORD dwFlags,
  156. const CDSSmartBasePathsInfo& basePathsInfo,
  157. HPROPSHEETPAGE * phPage);
  158. /*
  159. HRESULT
  160. CreateScheduleObjPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj,
  161. LPWSTR pwszObjName, LPWSTR pwszClass,
  162. HWND hNotifyWnd, DWORD dwFlags, HPROPSHEETPAGE * phPage);
  163. */
  164. // Object page attribute function for object class.
  165. //
  166. HRESULT
  167. GetObjectClass(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  168. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  169. DLG_OP DlgOp);
  170. // Object page attribute function for object timestamps.
  171. //
  172. HRESULT
  173. GetObjectTimestamp(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  174. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  175. DLG_OP DlgOp);
  176. HRESULT
  177. ObjectPathField(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  178. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  179. DLG_OP DlgOp);
  180. // FPO general page attribute function for finding account name from the SID.
  181. //
  182. HRESULT
  183. GetAcctName(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  184. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  185. DLG_OP DlgOp);
  186. // General-purpose attribute function for ES_NUMBER edit controls with
  187. // associated spin button. This must always be accompanied by a "msctls_updown32"
  188. // control with the SpinButton attribute function. Set ATTR_MAP.pData to the
  189. // controlID of the associated spin button.
  190. //
  191. HRESULT
  192. EditNumber(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  193. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  194. DLG_OP DlgOp);
  195. // General-purpose READONLY attribute function for spin buttons accompaying EditNumber
  196. // edit controls. If you wish to limit the spinbutton range, set ATTR_MAP.nSizeLimit
  197. // to the high end of the range and ATTR_MAP.pData to the low end of the range.
  198. //
  199. HRESULT
  200. SpinButton(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  201. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  202. DLG_OP DlgOp);
  203. // Special-purpose attribute function for spin buttons to change accelerator
  204. // increment. Use this as READONLY for controls which already have a
  205. // SpinButton attribute function. Set ATTR_MAP.pData to the integer
  206. // multiple, e.g. 15 to move in increments of 15.
  207. //
  208. HRESULT
  209. SpinButtonExtendIncrement(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  210. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  211. DLG_OP DlgOp);
  212. // Special-purpose read-only attribute functions to pick apart a subnet mask and
  213. // fill in an IP Address Control (WC_IPADDRESS)
  214. HRESULT
  215. SubnetExtractAddress(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  216. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  217. DLG_OP DlgOp);
  218. HRESULT
  219. SubnetExtractMask(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  220. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  221. DLG_OP DlgOp);
  222. //
  223. // read-only attribute function to calculate the DNS alias of an NTDSDSA
  224. //
  225. HRESULT
  226. NTDSDSA_DNSAlias(CDsPropPageBase * pPage, PATTR_MAP pAttrMap,
  227. PADS_ATTR_INFO pAttrInfo, LPARAM lParam, PATTR_DATA pAttrData,
  228. DLG_OP DlgOp);
  229. // helper function to delete pADsValues (tablpage.cxx)
  230. void HelperDeleteADsValues( PADS_ATTR_INFO pAttrs );
  231. // global definitions
  232. extern HINSTANCE g_hInstance;
  233. extern RGDSPPCLASSES g_DsPPClasses;
  234. extern CLIPFORMAT g_cfDsObjectNames;
  235. extern CLIPFORMAT g_cfDsDispSpecOptions;
  236. extern CLIPFORMAT g_cfShellIDListArray;
  237. extern CLIPFORMAT g_cfMMCGetNodeType;
  238. extern CLIPFORMAT g_cfDsPropCfg;
  239. extern CLIPFORMAT g_cfDsSelList;
  240. extern CLIPFORMAT g_cfDsMultiSelectProppages;
  241. //extern CLIPFORMAT g_cfMMCGetCoClass;
  242. extern UINT g_uChangeMsg;
  243. extern int g_iInstance;
  244. #ifndef DSPROP_ADMIN
  245. extern CRITICAL_SECTION g_csNotifyCreate;
  246. #endif
  247. //+----------------------------------------------------------------------------
  248. //
  249. // Class: CDsPropPagesHost
  250. //
  251. // Purpose: property pages host object class
  252. //
  253. //-----------------------------------------------------------------------------
  254. class CDsPropPagesHost : public IShellExtInit, IShellPropSheetExt
  255. {
  256. public:
  257. #ifdef _DEBUG
  258. char szClass[32];
  259. #endif
  260. CDsPropPagesHost(PDSCLASSPAGES pDsPP);
  261. ~CDsPropPagesHost();
  262. //
  263. // IUnknown methods
  264. //
  265. STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObject);
  266. STDMETHOD_(ULONG, AddRef)(void);
  267. STDMETHOD_(ULONG, Release)(void);
  268. //
  269. // IShellExtInit methods
  270. //
  271. STDMETHOD(Initialize)(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj,
  272. HKEY hKeyID );
  273. //
  274. // IShellPropSheetExt methods
  275. //
  276. STDMETHOD(AddPages)(LPFNADDPROPSHEETPAGE pAddPageProc, LPARAM lParam);
  277. STDMETHOD(ReplacePage)(UINT uPageID, LPFNADDPROPSHEETPAGE pReplacePageFunc,
  278. LPARAM lParam);
  279. private:
  280. PDSCLASSPAGES m_pDsPPages;
  281. LPDATAOBJECT m_pDataObj;
  282. HWND m_hNotifyObj;
  283. STGMEDIUM m_ObjMedium;
  284. unsigned long m_uRefs;
  285. CDllRef m_DllRef;
  286. };
  287. typedef struct _ApplyErrorEntry
  288. {
  289. PWSTR pszPath; // Path to the object that had the error
  290. PWSTR pszClass; // Class of the object that had the error
  291. HRESULT hr; // HRESULT of the error (if 0 then pszStringError must not be NULL)
  292. PWSTR pszStringError; // User defined string error (used only if hr == NULL)
  293. } APPLY_ERROR_ENTRY, *PAPPLY_ERROR_ENTRY;
  294. //+----------------------------------------------------------------------------
  295. //
  296. // Class: CADsApplyErrors
  297. //
  298. // Purpose: contains an association between DS objects and errors that
  299. // occurred while doing an apply
  300. //
  301. //-----------------------------------------------------------------------------
  302. class CADsApplyErrors
  303. {
  304. public:
  305. CADsApplyErrors()
  306. : m_nArraySize(0),
  307. m_nCount(0),
  308. m_nIncAmount(5),
  309. m_pErrorTable(NULL),
  310. m_hWndPage(NULL),
  311. m_pszTitle(NULL)
  312. {}
  313. ~CADsApplyErrors();
  314. void SetError(PADSPROPERROR pError);
  315. HRESULT GetError(UINT nIndex);
  316. PWSTR GetStringError(UINT nIndex);
  317. PWSTR GetName(UINT nIndex);
  318. PWSTR GetClass(UINT nIndex);
  319. HWND GetPageHwnd() { return m_hWndPage; }
  320. UINT GetCount() { return m_nCount; }
  321. UINT GetErrorCount() { return m_nCount; }
  322. PWSTR GetPageTitle() { return m_pszTitle; }
  323. void Clear();
  324. private:
  325. PAPPLY_ERROR_ENTRY m_pErrorTable;
  326. UINT m_nCount;
  327. HWND m_hWndPage;
  328. PWSTR m_pszTitle;
  329. UINT m_nArraySize;
  330. UINT m_nIncAmount;
  331. };
  332. //+----------------------------------------------------------------------------
  333. //
  334. // Class: CDsPropPageBase
  335. //
  336. // Purpose: property page object base class
  337. //
  338. //-----------------------------------------------------------------------------
  339. class CDsPropPageBase : public IUnknown
  340. {
  341. public:
  342. #ifdef _DEBUG
  343. char szClass[32];
  344. #endif
  345. CDsPropPageBase(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, HWND hNotifyWnd,
  346. DWORD dwFlags);
  347. virtual ~CDsPropPageBase(void);
  348. //
  349. // IUnknown methods
  350. //
  351. STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObject);
  352. STDMETHOD_(ULONG, AddRef)(void);
  353. STDMETHOD_(ULONG, Release)(void);
  354. //
  355. // Static WndProc to be passed to CreateWindow
  356. //
  357. static INT_PTR CALLBACK StaticDlgProc(HWND hWnd, UINT uMsg,
  358. WPARAM wParam, LPARAM lParam);
  359. //
  360. // Instance specific wind proc
  361. //
  362. virtual INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam,
  363. LPARAM lParam) = 0;
  364. void Init(PWSTR pwzADsPath, PWSTR pwzClass, const CDSSmartBasePathsInfo& basePathsInfo);
  365. HRESULT CreatePage(HPROPSHEETPAGE * phPage);
  366. const LPWSTR GetObjPathName(void) {return m_pwszObjPathName;};
  367. const LPWSTR GetObjRDName(void) {return m_pwszRDName;};
  368. const LPWSTR GetObjClass(void) {return m_pwszObjClass;};
  369. HWND GetHWnd(void) {return m_hPage;};
  370. void SetDirty(BOOL fFullDirty = TRUE) {
  371. m_fPageDirty = TRUE;
  372. if (fFullDirty)
  373. {
  374. PropSheet_Changed(GetParent(m_hPage), m_hPage);
  375. EnableWindow(GetDlgItem(GetParent(m_hPage), IDCANCEL), TRUE);
  376. }
  377. };
  378. BOOL IsDirty() {return m_fPageDirty;}
  379. LRESULT OnHelp(LPHELPINFO pHelpInfo);
  380. virtual BOOL IsMultiselectPage() { return m_fMultiselectPage; }
  381. const CDSSmartBasePathsInfo& GetBasePathsInfo() { return m_basePathsInfo; }
  382. protected:
  383. static UINT CALLBACK PageCallback(HWND hwnd, UINT uMsg,
  384. LPPROPSHEETPAGE ppsp);
  385. //
  386. // Member functions, called by WndProc
  387. //
  388. LRESULT InitDlg(LPARAM lParam);
  389. virtual HRESULT OnInitDialog(LPARAM lParam) = 0;
  390. virtual LRESULT OnApply(void) = 0;
  391. LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  392. LRESULT OnNotify(WPARAM wParam, LPARAM lParam);
  393. LRESULT OnCancel(void);
  394. LRESULT OnSetFocus(HWND hwndLoseFocus);
  395. LRESULT OnShowWindow(void);
  396. LRESULT OnDestroy(void);
  397. LRESULT OnPSMQuerySibling(WPARAM wParam, LPARAM lParam);
  398. LRESULT OnPSNSetActive(LPARAM lParam);
  399. LRESULT OnPSNKillActive(LPARAM lParam);
  400. LRESULT OnDoInit();
  401. void CheckIfPageAttrsWritable(void);
  402. BOOL CheckIfWritable(const PWSTR & wzAttr);
  403. public:
  404. HRESULT GetObjSel(IDsObjectPicker ** ppObjSel, PBOOL pfIsInited = NULL);
  405. void ObjSelInited(void) {m_fObjSelInited = TRUE;};
  406. HRESULT SkipPrefix(PWSTR pwzObj, PWSTR * ppResult, BOOL fX500 = TRUE);
  407. HRESULT AddLDAPPrefix(PWSTR pwzObj, CStrW &pstrResult, BOOL fServer = TRUE);
  408. HRESULT GetADsPathname(CComPtr<IADsPathname>& refADsPath);
  409. HRESULT GetIDispSpec(IDsDisplaySpecifier ** ppDispSpec);
  410. BOOL IsReadOnly(void) {return m_fReadOnly;};
  411. BOOL SendErrorMessage(PADSPROPERROR pError)
  412. {
  413. return ADsPropSendErrorMessage(m_hNotifyObj, pError);
  414. }
  415. //
  416. // Data members
  417. //
  418. public:
  419. LPDATAOBJECT m_pWPTDataObj; // Wnd Proc Thread Data Obj.
  420. IDirectoryObject * m_pDsObj;
  421. protected:
  422. HWND m_hPage;
  423. BOOL m_fInInit;
  424. BOOL m_fPageDirty;
  425. BOOL m_fReadOnly;
  426. BOOL m_fMultiselectPage;
  427. LPDATAOBJECT m_pDataObj; // Marshalled to the wndproc thread.
  428. LPSTREAM m_pDataObjStrm; // Used to marshal data obj pointer.
  429. int m_nPageTitle;
  430. int m_nDlgTemplate;
  431. DWORD m_cAttrs;
  432. PATTR_MAP * m_rgpAttrMap;
  433. PWSTR m_pwszObjPathName;
  434. PWSTR m_pwszObjClass;
  435. PWSTR m_pwszRDName;
  436. CDllRef m_DllRef;
  437. CComPtr<IADsPathname> m_pADsPath;
  438. IDsObjectPicker * m_pObjSel;
  439. IDsDisplaySpecifier * m_pDispSpec;
  440. BOOL m_fObjSelInited;
  441. PATTR_DATA m_rgAttrData;
  442. unsigned long m_uRefs;
  443. HWND m_hNotifyObj;
  444. PADS_ATTR_INFO m_pWritableAttrs;
  445. HRESULT m_hrInit;
  446. CDSSmartBasePathsInfo m_basePathsInfo;
  447. };
  448. //+----------------------------------------------------------------------------
  449. //
  450. // Class: CDsTableDrivenPage
  451. //
  452. // Purpose: property page object class for table-driven attributes
  453. //
  454. //-----------------------------------------------------------------------------
  455. class CDsTableDrivenPage : public CDsPropPageBase
  456. {
  457. public:
  458. #ifdef _DEBUG
  459. char szClass[32];
  460. #endif
  461. CDsTableDrivenPage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, HWND hNotifyWnd,
  462. DWORD dwFlags);
  463. ~CDsTableDrivenPage(void);
  464. //
  465. // Instance specific wind proc
  466. //
  467. INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  468. BOOL SetNamedAttrDirty( LPCWSTR pszAttrName );
  469. protected:
  470. void SetDirty(DWORD i) {
  471. ATTR_DATA_SET_DIRTY(m_rgAttrData[i]);
  472. CDsPropPageBase::SetDirty();
  473. }
  474. LRESULT OnDestroy(void);
  475. private:
  476. HRESULT OnInitDialog(LPARAM lParam);
  477. LRESULT OnApply(void);
  478. LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  479. LRESULT OnObjChanged(void);
  480. LRESULT OnAttrChanged(WPARAM wParam);
  481. LRESULT OnQuerySibs(WPARAM wParam, LPARAM lParam);
  482. LRESULT OnNotify(WPARAM wParam, LPARAM lParam);
  483. HRESULT ReadAttrsSetCtrls(DLG_OP DlgOp);
  484. //
  485. // Data members
  486. //
  487. public:
  488. LPARAM m_pData;
  489. };
  490. /*
  491. //+----------------------------------------------------------------------------
  492. //
  493. // Class: CDsReplSchedulePage
  494. //
  495. // Purpose: property page object class for the schedule attribute.
  496. //
  497. //-----------------------------------------------------------------------------
  498. class CDsReplSchedulePage : public CDsPropPageBase
  499. {
  500. public:
  501. #ifdef _DEBUG
  502. char szClass[32];
  503. #endif
  504. CDsReplSchedulePage(PDSPAGE pDsPage, LPDATAOBJECT pDataObj, DWORD dwFlags);
  505. ~CDsReplSchedulePage(void);
  506. //
  507. // Instance specific wind proc
  508. //
  509. INT_PTR CALLBACK DlgProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  510. HRESULT GetServerName(void);
  511. private:
  512. LRESULT OnInitDialog(LPARAM lParam);
  513. LRESULT OnApply(void);
  514. LRESULT OnCommand(int id, HWND hwndCtl, UINT codeNotify);
  515. LRESULT OnDestroy(void);
  516. //
  517. // Data members
  518. //
  519. LPWSTR m_pwszLdapServer;
  520. };
  521. */
  522. //+----------------------------------------------------------------------------
  523. //
  524. // Class: CDsPropPagesHostCF
  525. //
  526. // Purpose: object class factory
  527. //
  528. //-----------------------------------------------------------------------------
  529. class CDsPropPagesHostCF : public IClassFactory
  530. {
  531. public:
  532. #ifdef _DEBUG
  533. char szClass[32];
  534. #endif
  535. CDsPropPagesHostCF(PDSCLASSPAGES pDsPP);
  536. ~CDsPropPagesHostCF();
  537. // IUnknown methods
  538. STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObject);
  539. STDMETHOD_(ULONG, AddRef)();
  540. STDMETHOD_(ULONG, Release)();
  541. // IClassFactory methods
  542. STDMETHOD(CreateInstance)(IUnknown * pUnkOuter, REFIID riid,
  543. void ** ppvObject);
  544. STDMETHOD(LockServer)(BOOL fLock);
  545. static IClassFactory * Create(PDSCLASSPAGES pDsPP);
  546. private:
  547. PDSCLASSPAGES m_pDsPP;
  548. unsigned long m_uRefs;
  549. CDllRef m_DllRef;
  550. };
  551. //+----------------------------------------------------------------------------
  552. //
  553. // Class: CDsPropDataObj
  554. //
  555. // Purpose: Data object for property pages.
  556. //
  557. // Notes: This is not a first class COM object since there is no class
  558. // factory.
  559. //
  560. //-----------------------------------------------------------------------------
  561. class CDsPropDataObj : public IDataObject
  562. {
  563. public:
  564. #ifdef _DEBUG
  565. char szClass[32];
  566. #endif
  567. CDsPropDataObj(HWND hwndParentPage,
  568. BOOL fReadOnly);
  569. ~CDsPropDataObj(void);
  570. HRESULT Init(LPWSTR pwszObjName, LPWSTR pwszClass);
  571. HRESULT Init(PDS_SELECTION_LIST pSelectionList);
  572. //
  573. // IUnknown methods
  574. //
  575. STDMETHOD(QueryInterface)(REFIID riid, void ** ppvObject);
  576. STDMETHOD_(ULONG, AddRef)(void);
  577. STDMETHOD_(ULONG, Release)(void);
  578. //
  579. // Standard IDataObject methods
  580. //
  581. // Implemented
  582. //
  583. STDMETHOD(GetData)(FORMATETC * pformatetcIn, STGMEDIUM * pmedium);
  584. // Not Implemented
  585. private:
  586. STDMETHOD(QueryGetData)(FORMATETC*)
  587. { return E_NOTIMPL; };
  588. STDMETHOD(GetCanonicalFormatEtc)(FORMATETC *,
  589. FORMATETC *)
  590. { return E_NOTIMPL; };
  591. STDMETHOD(EnumFormatEtc)(DWORD,
  592. LPENUMFORMATETC *)
  593. { return E_NOTIMPL; };
  594. STDMETHOD(GetDataHere)(LPFORMATETC, LPSTGMEDIUM)
  595. { return E_NOTIMPL; };
  596. STDMETHOD(SetData)(FORMATETC *, STGMEDIUM *,
  597. BOOL)
  598. { return E_NOTIMPL; };
  599. STDMETHOD(DAdvise)(FORMATETC *, DWORD,
  600. IAdviseSink *, DWORD *)
  601. { return E_NOTIMPL; };
  602. STDMETHOD(DUnadvise)(DWORD)
  603. { return E_NOTIMPL; };
  604. STDMETHOD(EnumDAdvise)(IEnumSTATDATA **)
  605. { return E_NOTIMPL; };
  606. BOOL m_fReadOnly;
  607. PWSTR m_pwszObjName;
  608. PWSTR m_pwszObjClass;
  609. HWND m_hwndParent;
  610. unsigned long m_uRefs;
  611. PDS_SELECTION_LIST m_pSelectionList;
  612. };
  613. //+----------------------------------------------------------------------------
  614. //
  615. // Function: PostPropSheet
  616. //
  617. // Synopsis: Creates a property sheet for the named object using MMC's
  618. // IPropertySheetProvider so that extension snapins can add pages.
  619. //
  620. //-----------------------------------------------------------------------------
  621. HRESULT
  622. PostPropSheet(PWSTR pwszObj, CDsPropPageBase * pParentPage,
  623. BOOL fReadOnly = FALSE);
  624. HRESULT
  625. PostADsPropSheet(PWSTR pwzObjDN, IDataObject * pParentObj, HWND hwndParent,
  626. HWND hNotifyObj, BOOL fReadOnly);
  627. #include "proputil.h"
  628. #endif // _PROPPAGE_H_