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.

84 lines
2.4 KiB

  1. // SAFRemoteDesktopManager.h : Declaration of the CSAFRemoteDesktopManager
  2. #ifndef __SAFREMOTEDESKTOPMANAGER_H_
  3. #define __SAFREMOTEDESKTOPMANAGER_H_
  4. #include "resource.h" // main symbols
  5. #define BUF_SZ 256
  6. /////////////////////////////////////////////////////////////////////////////
  7. // CSAFRemoteDesktopManager
  8. class ATL_NO_VTABLE CSAFRemoteDesktopManager :
  9. public CComObjectRootEx<CComSingleThreadModel>,
  10. public CComCoClass<CSAFRemoteDesktopManager, &CLSID_SAFRemoteDesktopManager>,
  11. public IDispatchImpl<ISAFRemoteDesktopManager, &IID_ISAFRemoteDesktopManager, &LIBID_ISAFRDMLib>
  12. {
  13. public:
  14. CSAFRemoteDesktopManager()
  15. {
  16. WCHAR buf1[BUF_SZ];
  17. m_bstrSupportEngineer = ((GetEnvironmentVariable(L"PCHSE",
  18. buf1, BUF_SZ) > 0) ? buf1 : L"Support Engineer Unknown");
  19. m_bstrRCTicket = ((GetEnvironmentVariable(L"PCHCONNECTPARMS",
  20. buf1, BUF_SZ) > 0) ? buf1 : L"none provided");
  21. m_bstrSessionEnum = ((GetEnvironmentVariable(L"PCHSESSIONENUM",
  22. buf1, BUF_SZ) > 0) ? buf1 : NULL);
  23. m_bstrEventName = ((GetEnvironmentVariable(L"PCHEVENTNAME",
  24. buf1, BUF_SZ) > 0) ? buf1 : NULL);
  25. m_boolDesktopUnknown = FALSE;
  26. m_boolConnectionValid = FALSE;
  27. if (m_bstrEventName && m_bstrSessionEnum)
  28. {
  29. if (StrCmp(buf1, L"singleConnect"))
  30. m_boolDesktopUnknown = TRUE;
  31. if (ERROR_SUCCESS == m_hkSession.Open(HKEY_CURRENT_USER, L"Software/Microsoft/PCHealth", KEY_ALL_ACCESS))
  32. m_boolConnectionValid = TRUE;
  33. }
  34. }
  35. ~CSAFRemoteDesktopManager()
  36. {
  37. m_bstrRCTicket.Empty();
  38. m_bstrSupportEngineer.Empty();
  39. m_bstrSessionEnum.Empty();
  40. m_hkSession.Close();
  41. }
  42. DECLARE_REGISTRY_RESOURCEID(IDR_SAFREMOTEDESKTOPMANAGER)
  43. DECLARE_PROTECT_FINAL_CONSTRUCT()
  44. BEGIN_COM_MAP(CSAFRemoteDesktopManager)
  45. COM_INTERFACE_ENTRY(ISAFRemoteDesktopManager)
  46. COM_INTERFACE_ENTRY(IDispatch)
  47. END_COM_MAP()
  48. // ISAFRemoteDesktopManager
  49. public:
  50. STDMETHOD(get_SupportEngineer)(/*[out, retval]*/ BSTR *pVal);
  51. STDMETHOD(get_DesktopUnknown)(/*[out, retval]*/ BOOL *pVal);
  52. STDMETHOD(get_RCTicket)(/*[out, retval]*/ BSTR *pVal);
  53. STDMETHOD(Aborted)(/*[in]*/ BSTR Val);
  54. STDMETHOD(Rejected)();
  55. STDMETHOD(Accepted)();
  56. private:
  57. CComBSTR m_bstrEventName;
  58. void SignalResolver(void);
  59. CComBSTR m_bstrSessionEnum;
  60. CRegKey m_hkSession;
  61. BOOL m_boolConnectionValid;
  62. CComBSTR m_bstrSupportEngineer;
  63. CComBSTR m_bstrRCTicket;
  64. BOOL m_boolDesktopUnknown;
  65. };
  66. #endif //__SAFREMOTEDESKTOPMANAGER_H_