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.

141 lines
3.5 KiB

  1. // rdsgp.h : Declaration of the CCRemoteDesktopSystemPolicy
  2. #ifndef __CREMOTEDESKTOPPOLICY_H_
  3. #define __CREMOTEDESKTOPPOLICY_H_
  4. #include "sessmgr.h"
  5. #include "helper.h"
  6. #include "resource.h" // main symbols
  7. #include "policy.h"
  8. #include "helpmgr.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // CCRemoteDesktopSystemPolicy
  11. class ATL_NO_VTABLE CRemoteDesktopSystemPolicy :
  12. public CComObjectRootEx<CComMultiThreadModel>,
  13. public CComCoClass<CRemoteDesktopSystemPolicy, &CLSID_RemoteDesktopSystemPolicy>,
  14. public IDispatchImpl<ISAFRemoteDesktopSystemPolicy, &IID_ISAFRemoteDesktopSystemPolicy, &LIBID_RDSESSMGRLib>
  15. {
  16. public:
  17. CRemoteDesktopSystemPolicy()
  18. {
  19. }
  20. DECLARE_REGISTRY_RESOURCEID(IDR_REMOTEDESKTOPSYSTEMPOLICY)
  21. //
  22. // Can't use SINGLETON here
  23. // It is idea to use Singleton here since there can only
  24. // be one system policy setting, we also need to support
  25. // self-shutdown via AddRef()/Release() on _Module;However,
  26. // ATL creates one CRemoteDesktopSystemPolicy at initialization
  27. // time so we can't AddRef()/Release() on _Module, on the other
  28. // hand, we can't self shutdown if we don't AddRef() or Release()
  29. //
  30. //DECLARE_CLASSFACTORY_SINGLETON(CRemoteDesktopSystemPolicy)
  31. DECLARE_PROTECT_FINAL_CONSTRUCT()
  32. BEGIN_COM_MAP(CRemoteDesktopSystemPolicy)
  33. COM_INTERFACE_ENTRY(ISAFRemoteDesktopSystemPolicy)
  34. COM_INTERFACE_ENTRY(IDispatch)
  35. END_COM_MAP()
  36. HRESULT
  37. FinalConstruct()
  38. {
  39. _Module.AddRef();
  40. DebugPrintf( _TEXT("Module AddRef by CRemoteDesktopSystemPolicy()...\n") );
  41. return S_OK;
  42. }
  43. void
  44. FinalRelease()
  45. {
  46. DebugPrintf( _TEXT("Module Release by CRemoteDesktopSystemPolicy()...\n") );
  47. _Module.Release();
  48. }
  49. // IRemoteDesktopSystemPolicy
  50. public:
  51. STDMETHOD(get_AllowGetHelp)(
  52. /*[out, retval]*/ BOOL *pVal
  53. );
  54. STDMETHOD(put_AllowGetHelp)(
  55. /*[in]*/ BOOL Val
  56. );
  57. STDMETHOD(get_RemoteDesktopSharingSetting)(
  58. /*[out, retval]*/ REMOTE_DESKTOP_SHARING_CLASS *pLevel
  59. );
  60. STDMETHOD(put_RemoteDesktopSharingSetting)(
  61. /*[in]*/ REMOTE_DESKTOP_SHARING_CLASS Level
  62. );
  63. private:
  64. static CCriticalSection m_Lock;
  65. };
  66. // rdsgp.h.h : Declaration of the CRemoteDesktopUserPolicy
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CRemoteDesktopUserPolicy
  69. class ATL_NO_VTABLE CRemoteDesktopUserPolicy :
  70. public CComObjectRootEx<CComMultiThreadModel>,
  71. public CComCoClass<CRemoteDesktopUserPolicy, &CLSID_RemoteDesktopUserPolicy>,
  72. public IDispatchImpl<ISAFRemoteDesktopUserPolicy, &IID_ISAFRemoteDesktopUserPolicy, &LIBID_RDSESSMGRLib>
  73. {
  74. public:
  75. CRemoteDesktopUserPolicy()
  76. {
  77. }
  78. DECLARE_REGISTRY_RESOURCEID(IDR_REMOTEDESKTOPUSERPOLICY)
  79. DECLARE_PROTECT_FINAL_CONSTRUCT()
  80. BEGIN_COM_MAP(CRemoteDesktopUserPolicy)
  81. COM_INTERFACE_ENTRY(ISAFRemoteDesktopUserPolicy)
  82. COM_INTERFACE_ENTRY(IDispatch)
  83. END_COM_MAP()
  84. HRESULT
  85. FinalConstruct()
  86. {
  87. DebugPrintf( _TEXT("Module AddRef by CRemoteDesktopUserPolicy()...\n") );
  88. _Module.AddRef();
  89. return S_OK;
  90. }
  91. void
  92. FinalRelease()
  93. {
  94. DebugPrintf( _TEXT("Module Release by CRemoteDesktopUserPolicy()...\n") );
  95. _Module.Release();
  96. }
  97. // IRemoteDesktopUserPolicy
  98. public:
  99. STDMETHOD(get_AllowGetHelp)(
  100. /*[out, retval]*/ BOOL* pVal
  101. );
  102. STDMETHOD(get_RemoteDesktopSharingSetting)(
  103. /*[out, retval]*/ REMOTE_DESKTOP_SHARING_CLASS* pLevel
  104. );
  105. };
  106. #endif //__CREMOTEDESKTOPSYSTEMPOLICY_H_