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.

161 lines
4.5 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 512
  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 *lpBuf=NULL;
  17. DWORD dwCnt;
  18. WCHAR buf1[BUF_SZ];
  19. m_bstrSupportEngineer = L"";
  20. dwCnt = GetEnvironmentVariable(L"PCHUSERBLOB", buf1, BUF_SZ);
  21. if (!dwCnt)
  22. m_bstruserSupportBlob = L"";
  23. else if (dwCnt <= BUF_SZ)
  24. m_bstruserSupportBlob = buf1;
  25. else
  26. {
  27. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  28. GetEnvironmentVariable(L"PCHUSERBLOB", lpBuf, dwCnt);
  29. m_bstruserSupportBlob = lpBuf;
  30. LocalFree(lpBuf);
  31. lpBuf = NULL;
  32. }
  33. dwCnt = GetEnvironmentVariable(L"PCHEXPERTBLOB", buf1, BUF_SZ);
  34. if (!dwCnt)
  35. m_bstrexpertSupportBlob = L"";
  36. else if (dwCnt <= BUF_SZ)
  37. m_bstrexpertSupportBlob = buf1;
  38. else
  39. {
  40. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  41. GetEnvironmentVariable(L"PCHEXPERTBLOB", lpBuf, dwCnt);
  42. m_bstrexpertSupportBlob = lpBuf;
  43. LocalFree(lpBuf);
  44. lpBuf = NULL;
  45. }
  46. dwCnt = GetEnvironmentVariable(L"PCHCONNECTPARMS", buf1, BUF_SZ);
  47. if (!dwCnt)
  48. m_bstrRCTicket = L"";
  49. else if (dwCnt <= BUF_SZ)
  50. m_bstrRCTicket = buf1;
  51. else
  52. {
  53. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  54. GetEnvironmentVariable(L"PCHCONNECTPARMS", lpBuf, dwCnt);
  55. m_bstrRCTicket = lpBuf;
  56. LocalFree(lpBuf);
  57. lpBuf = NULL;
  58. }
  59. dwCnt = GetEnvironmentVariable(L"PCHSESSIONENUM", buf1, BUF_SZ);
  60. if (!dwCnt)
  61. m_bstrSessionEnum = L"";
  62. else if (dwCnt <= BUF_SZ)
  63. m_bstrSessionEnum = buf1;
  64. else
  65. {
  66. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  67. GetEnvironmentVariable(L"PCHSESSIONENUM", lpBuf, dwCnt);
  68. m_bstrSessionEnum = lpBuf;
  69. LocalFree(lpBuf);
  70. lpBuf = NULL;
  71. }
  72. dwCnt = GetEnvironmentVariable(L"PCHEVENTNAME", buf1, BUF_SZ);
  73. if (!dwCnt)
  74. m_bstrEventName = L"";
  75. else if (dwCnt <= BUF_SZ)
  76. m_bstrEventName = buf1;
  77. else
  78. {
  79. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  80. GetEnvironmentVariable(L"PCHEVENTNAME", lpBuf, dwCnt);
  81. m_bstrEventName = lpBuf;
  82. LocalFree(lpBuf);
  83. lpBuf = NULL;
  84. }
  85. dwCnt = GetEnvironmentVariable(L"PCHMutexName", buf1, BUF_SZ);
  86. if (!dwCnt)
  87. m_bstrMutexName = L"";
  88. else if (dwCnt <= BUF_SZ)
  89. m_bstrMutexName = buf1;
  90. else
  91. {
  92. lpBuf = (WCHAR *)LocalAlloc(LPTR, dwCnt * sizeof(WCHAR));
  93. GetEnvironmentVariable(L"PCHMutexName", lpBuf, dwCnt);
  94. m_bstrMutexName = lpBuf;
  95. LocalFree(lpBuf);
  96. lpBuf = NULL;
  97. }
  98. m_boolConnectionValid = TRUE;
  99. m_boolDesktopUnknown = FALSE;
  100. m_boolAcceptReserved = FALSE;
  101. }
  102. ~CSAFRemoteDesktopManager()
  103. {
  104. m_bstrRCTicket.Empty();
  105. m_bstrSupportEngineer.Empty();
  106. m_bstruserSupportBlob.Empty();
  107. m_bstrexpertSupportBlob.Empty();
  108. m_bstrSessionEnum.Empty();
  109. m_bstrEventName.Empty();
  110. m_bstrMutexName.Empty();
  111. }
  112. DECLARE_REGISTRY_RESOURCEID(IDR_SAFREMOTEDESKTOPMANAGER)
  113. DECLARE_PROTECT_FINAL_CONSTRUCT()
  114. BEGIN_COM_MAP(CSAFRemoteDesktopManager)
  115. COM_INTERFACE_ENTRY(ISAFRemoteDesktopManager)
  116. COM_INTERFACE_ENTRY(IDispatch)
  117. END_COM_MAP()
  118. // ISAFRemoteDesktopManager
  119. public:
  120. STDMETHOD(get_userHelpBlob)(/*[out, retval]*/ BSTR *pVal);
  121. STDMETHOD(get_expertHelpBlob)(/*[out, retval]*/ BSTR *pVal);
  122. STDMETHOD(get_SupportEngineer)(/*[out, retval]*/ BSTR *pVal);
  123. STDMETHOD(get_DesktopUnknown)(/*[out, retval]*/ BOOL *pVal);
  124. STDMETHOD(get_RCTicket)(/*[out, retval]*/ BSTR *pVal);
  125. STDMETHOD(Aborted)(/*[in]*/ BSTR Val);
  126. STDMETHOD(Rejected)();
  127. STDMETHOD(Accepted)();
  128. STDMETHOD(ReserveAcceptedLock)();
  129. STDMETHOD(SwitchDesktopMode)(/*[in]*/ int Mode, /*[in]*/ int nRAType);
  130. private:
  131. CComBSTR m_bstrMutexName;
  132. CComBSTR m_bstrEventName;
  133. CComBSTR m_bstrSessionEnum;
  134. CComBSTR m_bstrSupportEngineer;
  135. CComBSTR m_bstruserSupportBlob;
  136. CComBSTR m_bstrexpertSupportBlob;
  137. CComBSTR m_bstrRCTicket;
  138. BOOL m_boolConnectionValid;
  139. BOOL m_boolDesktopUnknown;
  140. BOOL m_boolAcceptReserved;
  141. // HRESULT SignalResolver(BOOL yn);
  142. };
  143. #endif //__SAFREMOTEDESKTOPMANAGER_H_