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.

134 lines
3.8 KiB

  1. // RASrv.h : Declaration of the CRASrv
  2. #ifndef __RASRV_H_
  3. #define __RASRV_H_
  4. #include "resource.h" // main symbols
  5. #include <atlctl.h>
  6. #include <wininet.h>
  7. #include <exdisp.h>
  8. #include <shlguid.h>
  9. #include <msxml.h>
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CRASrv
  12. class ATL_NO_VTABLE CRASrv :
  13. public CComObjectRootEx<CComSingleThreadModel>,
  14. public IDispatchImpl<IRASrv, &IID_IRASrv, &LIBID_RASERVERLib>,
  15. public CComCoClass<CRASrv, &CLSID_RASrv>,
  16. public CComControl<CRASrv>,
  17. public IPersistStreamInitImpl<CRASrv>,
  18. public IOleControlImpl<CRASrv>,
  19. public IOleObjectImpl<CRASrv>,
  20. public IOleInPlaceActiveObjectImpl<CRASrv>,
  21. public IViewObjectExImpl<CRASrv>,
  22. public IOleInPlaceObjectWindowlessImpl<CRASrv>,
  23. public IPersistStorageImpl<CRASrv>,
  24. public ISpecifyPropertyPagesImpl<CRASrv>,
  25. public IQuickActivateImpl<CRASrv>,
  26. public IDataObjectImpl<CRASrv>,
  27. public IProvideClassInfo2Impl<&CLSID_RASrv, NULL, &LIBID_RASERVERLib>,
  28. public IObjectSafetyImpl<CRASrv, INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA >
  29. {
  30. public:
  31. CRASrv()
  32. {
  33. }
  34. ~CRASrv()
  35. {
  36. Cleanup();
  37. }
  38. DECLARE_REGISTRY_RESOURCEID(IDR_RASRV)
  39. DECLARE_PROTECT_FINAL_CONSTRUCT()
  40. BEGIN_COM_MAP(CRASrv)
  41. COM_INTERFACE_ENTRY(IRASrv)
  42. COM_INTERFACE_ENTRY(IDispatch)
  43. COM_INTERFACE_ENTRY(IViewObjectEx)
  44. COM_INTERFACE_ENTRY(IViewObject2)
  45. COM_INTERFACE_ENTRY(IViewObject)
  46. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  47. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  48. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  49. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  50. COM_INTERFACE_ENTRY(IOleControl)
  51. COM_INTERFACE_ENTRY(IOleObject)
  52. COM_INTERFACE_ENTRY(IPersistStreamInit)
  53. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  54. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  55. COM_INTERFACE_ENTRY(IQuickActivate)
  56. COM_INTERFACE_ENTRY(IPersistStorage)
  57. COM_INTERFACE_ENTRY(IDataObject)
  58. COM_INTERFACE_ENTRY(IProvideClassInfo)
  59. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  60. COM_INTERFACE_ENTRY(IObjectSafety)
  61. END_COM_MAP()
  62. BEGIN_PROP_MAP(CRASrv)
  63. //PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  64. //PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  65. // Example entries
  66. // PROP_ENTRY("Property Description", dispid, clsid)
  67. // PROP_PAGE(CLSID_StockColorPage)
  68. END_PROP_MAP()
  69. /*
  70. BEGIN_MSG_MAP(CRASrv)
  71. CHAIN_MSG_MAP(CComControl<CRASrv>)
  72. DEFAULT_REFLECTION_HANDLER()
  73. END_MSG_MAP()
  74. */
  75. // Handler prototypes:
  76. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  77. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  78. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  79. // IViewObjectEx
  80. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  81. // IRASrv
  82. public:
  83. // STDMETHOD(QueryOS)(long * pRes);
  84. STDMETHOD(StartRA)(BSTR strData, BSTR strPassword);
  85. HRESULT OnDraw(ATL_DRAWINFO& di)
  86. {/*
  87. RECT& rc = *(RECT*)di.prcBounds;
  88. Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
  89. SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
  90. LPCTSTR pszText = _T("ATL 3.0 : RASrv");
  91. TextOut(di.hdcDraw,
  92. (rc.left + rc.right) / 2,
  93. (rc.top + rc.bottom) / 2,
  94. pszText,
  95. lstrlen(pszText));
  96. */
  97. return S_OK;
  98. }
  99. // IObjectWithSite methods
  100. /* STDMETHODIMP SetSite(IUnknown *pUnkSite);
  101. STDMETHODIMP GetSite(REFIID riid, LPVOID* ppvSite);
  102. */
  103. bool InApprovedDomain();
  104. bool GetOurUrl(CComBSTR & cbOurURL);
  105. bool IsApprovedDomain(CComBSTR & cbOurURL);
  106. INTERNET_SCHEME GetScheme(CComBSTR & cbUrl);
  107. bool GetDomain(CComBSTR & cbUrl, CComBSTR & cbBuf);
  108. bool MatchDomains(CComBSTR& approvedDomain, CComBSTR& ourDomain);
  109. bool Cleanup();
  110. };
  111. #endif //__RASRV_H_