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.

202 lines
6.1 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1998 **/
  4. /**********************************************************************/
  5. /*
  6. dialin.h
  7. Class CRASDialin definition. This class implements COM interfaces:
  8. IUnknown
  9. IShellExtInit, IShellPropSheetExt
  10. -- to extend User object's property sheet,
  11. IRasDialin -- currently, no method is implemented, it'll be useful
  12. when part of the UI need to be reused
  13. FILE HISTORY:
  14. 12/15/97 Modified WeiJiang -- localsec snapin in User node extension
  15. */
  16. #ifndef __RASDIALIN_H_
  17. #define __RASDIALIN_H_
  18. #include <rtutils.h>
  19. #include "resource.h" // main symbols
  20. #include "helper.h"
  21. EXTERN_C const CLSID CLSID_RasDialin;
  22. class CDlgRASDialin;
  23. class CDlgRASDialinMerge;
  24. #ifdef SINGLE_SDO_CONNECTION // for share the same sdo connection for multiple users
  25. extern LONG g_lComponentDataSessions;
  26. #endif
  27. #define ByteOffset(base, offset) (((LPBYTE)base)+offset)
  28. class CDoNothingComponent :
  29. public CComObjectRoot,
  30. public IComponent
  31. {
  32. public:
  33. BEGIN_COM_MAP(CDoNothingComponent)
  34. COM_INTERFACE_ENTRY(IComponent)
  35. END_COM_MAP()
  36. // IComponent
  37. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Initialize(
  38. /* [in] */ LPCONSOLE lpConsole) SAYOK;
  39. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Notify(
  40. /* [in] */ LPDATAOBJECT lpDataObject,
  41. /* [in] */ MMC_NOTIFY_TYPE event,
  42. /* [in] */ LPARAM arg,
  43. /* [in] */ LPARAM param) SAYOK;
  44. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE Destroy(
  45. /* [in] */ MMC_COOKIE cookie) SAYOK;
  46. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE QueryDataObject(
  47. /* [in] */ MMC_COOKIE cookie,
  48. /* [in] */ DATA_OBJECT_TYPES type,
  49. /* [out] */ LPDATAOBJECT __RPC_FAR *ppDataObject) NOIMP;
  50. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetResultViewType(
  51. /* [in] */ MMC_COOKIE cookie,
  52. /* [out] */ LPOLESTR __RPC_FAR *ppViewType,
  53. /* [out] */ long __RPC_FAR *pViewOptions) NOIMP;
  54. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetDisplayInfo(
  55. /* [out][in] */ RESULTDATAITEM __RPC_FAR *pResultDataItem) NOIMP;
  56. virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE CompareObjects(
  57. /* [in] */ LPDATAOBJECT lpDataObjectA,
  58. /* [in] */ LPDATAOBJECT lpDataObjectB) SAYOK;
  59. };
  60. /////////////////////////////////////////////////////////////////////////////
  61. // CRasDialin
  62. //class ATL_NO_VTABLE CRasDialin :
  63. class CRasDialin :
  64. public CComObjectRoot,
  65. public CComCoClass<CRasDialin, &CLSID_RasDialin>,
  66. public IShellExtInit, // shell property page extension -- DS user
  67. public IShellPropSheetExt, // shell property page extension -- DS user
  68. #ifdef SINGLE_SDO_CONNECTION // for share the same sdo connection for multiple users
  69. public IComponentData,
  70. #endif
  71. public IExtendPropertySheet // Snapin node property page extension
  72. {
  73. public:
  74. CRasDialin();
  75. virtual ~CRasDialin();
  76. BEGIN_COM_MAP(CRasDialin)
  77. COM_INTERFACE_ENTRY(IShellExtInit)
  78. COM_INTERFACE_ENTRY(IShellPropSheetExt)
  79. COM_INTERFACE_ENTRY(IExtendPropertySheet)
  80. #ifdef SINGLE_SDO_CONNECTION // for share the same sdo connection for multiple users
  81. COM_INTERFACE_ENTRY(IComponentData)
  82. #endif
  83. END_COM_MAP()
  84. // IRasDialin
  85. public:
  86. //IShellExtInit methods
  87. STDMETHODIMP Initialize(LPCITEMIDLIST pIDFolder, LPDATAOBJECT pDataObj, HKEY hKeyID);
  88. //IShellPropSheetExt methods
  89. STDMETHODIMP AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  90. STDMETHODIMP ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam);
  91. // IExtendPropertySheet :: added by WeiJiang 12/15/97 to support local sec extension
  92. STDMETHOD(CreatePropertyPages)(LPPROPERTYSHEETCALLBACK lpProvider,
  93. LONG_PTR handle, LPDATAOBJECT lpIDataObject);
  94. STDMETHOD(QueryPagesFor)(LPDATAOBJECT lpDataObject);
  95. DECLARE_REGISTRY(CRasDialin, _T("RasDialin.UserAdminExt.1"), _T("RasDialin.UserAdminExt"), 0, THREADFLAGS_APARTMENT)
  96. virtual const CLSID & GetCoClassID(){ return CLSID_RasDialin; };
  97. #ifdef SINGLE_SDO_CONNECTION // for share the same sdo connection for multiple users
  98. // IComponentData
  99. STDMETHOD(Initialize)(/* [in] */ LPUNKNOWN pUnknown)
  100. {
  101. TracePrintf(g_dwTraceHandle, _T("ComponentData::Initialize"));
  102. InterlockedIncrement(&g_lComponentDataSessions);
  103. return S_OK;
  104. };
  105. STDMETHOD(CreateComponent)(/* [out] */ LPCOMPONENT __RPC_FAR *ppComponent)
  106. {
  107. CComObject<CDoNothingComponent>* pComp = NULL;
  108. HRESULT hr = S_OK;
  109. hr = CComObject<CDoNothingComponent>::CreateInstance(&pComp);
  110. if(hr == S_OK && pComp)
  111. {
  112. hr = pComp->QueryInterface(IID_IComponent, (void**)ppComponent);
  113. }
  114. return hr;
  115. };
  116. STDMETHOD(Notify)(
  117. /* [in] */ LPDATAOBJECT lpDataObject,
  118. /* [in] */ MMC_NOTIFY_TYPE event,
  119. /* [in] */ LPARAM arg,
  120. /* [in] */ LPARAM param) SAYOK;
  121. STDMETHOD(Destroy)( void)
  122. {
  123. TracePrintf(g_dwTraceHandle, _T("ComponentData::Destroy"));
  124. LONG l = InterlockedDecrement(&g_lComponentDataSessions);
  125. if (l == 0)
  126. {
  127. delete g_pSdoServerPool;
  128. g_pSdoServerPool = NULL;
  129. }
  130. ASSERT(l >= 0);
  131. return S_OK;
  132. };
  133. STDMETHOD(QueryDataObject)(
  134. /* [in] */ MMC_COOKIE cookie,
  135. /* [in] */ DATA_OBJECT_TYPES type,
  136. /* [out] */ LPDATAOBJECT __RPC_FAR *ppDataObject) NOIMP;
  137. STDMETHOD(GetDisplayInfo)(
  138. /* [out][in] */ SCOPEDATAITEM __RPC_FAR *pScopeDataItem) NOIMP;
  139. STDMETHOD(CompareObjects)(
  140. /* [in] */ LPDATAOBJECT lpDataObjectA,
  141. /* [in] */ LPDATAOBJECT lpDataObjectB) NOIMP;
  142. #endif
  143. #ifdef _REGDS
  144. // registration of user object extension
  145. // only for testing purpose, retail version will have these information
  146. // register by setup program
  147. static HRESULT RegisterAdminPropertyPage(bool bRegister);
  148. #endif
  149. LPWSTR m_pwszObjName;
  150. LPWSTR m_pwszClass;
  151. CDlgRASDialin* m_pPage;
  152. CDlgRASDialinMerge* m_pMergedPage;
  153. STGMEDIUM m_ObjMedium;
  154. BOOL m_bShowPage;
  155. };
  156. #endif //__RASDIALIN_H_