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.

171 lines
3.5 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. int
  108. GetClientmachineAddressList(
  109. OUT CComBSTR& clientmachineAddressList
  110. );
  111. DWORD
  112. ParseHelpAccountName(
  113. IN BSTR helpAccount,
  114. OUT CComBSTR& machineAddressList,
  115. OUT CComBSTR& AccountName
  116. );
  117. //
  118. // Create a SYSTEM SID.
  119. //
  120. DWORD CreateSystemSid(
  121. PSID *ppSystemSid
  122. );
  123. //
  124. // Returns whether the current thread is running under SYSTEM security.
  125. //
  126. BOOL IsCallerSystem(PSID pSystemSid);
  127. //
  128. // Routine to attach debugger is asked.
  129. //
  130. void
  131. AttachDebuggerIfAsked(HINSTANCE hInst);
  132. DWORD
  133. HashSecurityData(
  134. IN PBYTE const pbData,
  135. IN DWORD cbData,
  136. OUT CComBSTR& bstrHashedKey
  137. );
  138. #endif