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.

171 lines
3.6 KiB

  1. /*++
  2. Copyright (c) 1999-2000 Microsoft Corporation
  3. Module Name:
  4. RemoteDesktopUtils
  5. Abstract:
  6. Misc. RD Utils
  7. Author:
  8. Tad Brockway 02/00
  9. Revision History:
  10. --*/
  11. #ifndef __REMOTEDESKTOPUTILS_H__
  12. #define __REMOTEDESKTOPUTILS_H__
  13. #include <atlbase.h>
  14. //
  15. // Version stamp for first supported connect parm, Whistler
  16. // beta 1 does not have this version stamp.
  17. //
  18. #define SALEM_FIRST_VALID_CONNECTPARM_VERSION 0x00010001
  19. //
  20. // Changes to Salem connect parm.
  21. //
  22. // Changes Start Compatible with previous build
  23. // ---------------------------------- -------------------- ------------------------------
  24. // Add version stamp as first field Whister Beta 2 No
  25. // Remove helpassistant from connect parm Build 2406 No
  26. // Add security blob as protocol specfic Build 2476+ Yes
  27. // parameter
  28. //
  29. //
  30. //
  31. // Version that does not have security blob as protocol specific
  32. // parameters (last field in our connect parm).
  33. //
  34. #define SALEM_CONNECTPARM_NOSECURITYBLOB_VERSION 0x00010001
  35. //
  36. // Starting version having security blob as protocol specific
  37. // parameters (last field in our connect parm).
  38. //
  39. #define SALEM_CONNECTPARM_SECURITYBLOB_VERSION 0x00010002
  40. //
  41. //
  42. // Current version stamp for Salem connect parm.
  43. //
  44. #define SALEM_CURRENT_CONNECTPARM_VERSION SALEM_CONNECTPARM_SECURITYBLOB_VERSION
  45. #define SALEM_CONNECTPARM_UNUSEFILED_SUBSTITUTE _TEXT("*")
  46. //
  47. // Compare two BSTR's.
  48. //
  49. struct CompareBSTR
  50. {
  51. bool operator()(BSTR str1, BSTR str2) const {
  52. if ((str1 == NULL) || (str2 == NULL)) {
  53. return false;
  54. }
  55. return (wcscmp(str1, str2) < 0);
  56. }
  57. };
  58. struct BSTREqual
  59. {
  60. bool operator()(BSTR str1, BSTR str2) const {
  61. if ((str1 == NULL) || (str2 == NULL)) {
  62. return false;
  63. }
  64. int minLen = SysStringByteLen(str1) < SysStringByteLen(str2) ?
  65. SysStringByteLen(str1) : SysStringByteLen(str2);
  66. return (memcmp(str1, str2, minLen) == 0);
  67. }
  68. };
  69. //
  70. // Create a connect parms string.
  71. //
  72. BSTR
  73. CreateConnectParmsString(
  74. IN DWORD protocolType,
  75. IN CComBSTR &machineAddressList,
  76. IN CComBSTR &assistantAccount,
  77. IN CComBSTR &assistantAccountPwd,
  78. IN CComBSTR &helpSessionId,
  79. IN CComBSTR &helpSessionName,
  80. IN CComBSTR &helpSessionPwd,
  81. IN CComBSTR &protocolSpecificParms
  82. );
  83. //
  84. // Parse a connect string created by a call to CreateConnectParmsString.
  85. //
  86. DWORD
  87. ParseConnectParmsString(
  88. IN BSTR parmsString,
  89. OUT DWORD* pdwVersion,
  90. OUT DWORD *protocolType,
  91. OUT CComBSTR &machineAddressList,
  92. OUT CComBSTR &assistantAccount,
  93. OUT CComBSTR &assistantAccountPwd,
  94. OUT CComBSTR &helpSessionId,
  95. OUT CComBSTR &helpSessionName,
  96. OUT CComBSTR &helpSessionPwd,
  97. OUT CComBSTR &protocolSpecificParms
  98. );
  99. //
  100. // Realloc a BSTR
  101. //
  102. BSTR
  103. ReallocBSTR(
  104. IN BSTR origStr,
  105. IN DWORD requiredByteLen
  106. );
  107. //
  108. // Create a SYSTEM SID.
  109. //
  110. DWORD CreateSystemSid(
  111. PSID *ppSystemSid
  112. );
  113. //
  114. // Returns whether the current thread is running under SYSTEM security.
  115. //
  116. BOOL IsCallerSystem(PSID pSystemSid);
  117. //
  118. // Routine to attach debugger is asked.
  119. //
  120. void
  121. AttachDebuggerIfAsked(HINSTANCE hInst);
  122. DWORD
  123. HashSecurityData(
  124. IN PBYTE const pbData,
  125. IN DWORD cbData,
  126. OUT CComBSTR& bstrHashedKey
  127. );
  128. DWORD
  129. WaitForRAGPDisableNotification(
  130. IN HANDLE hShutdown
  131. );
  132. void
  133. LogRemoteAssistanceEventString(
  134. IN DWORD dwEventType,
  135. IN DWORD dwEventId,
  136. IN DWORD numStrings,
  137. IN LPTSTR* lpStrings
  138. );
  139. #endif