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.

120 lines
2.6 KiB

  1. #include "termsrvpch.h"
  2. #pragma hdrstop
  3. #include <wtsapi32.h>
  4. //
  5. // Caution! Many of these functions must perform a SetLastError() because
  6. // the callers will call GetLastError() and try to recover based on the
  7. // error code. Even more interesting, Taskmgr will sometimes pass the
  8. // error code to FormatMessage and display it to the end user. So
  9. // we can't use ERROR_PROC_NOT_FOUND = "The specified procedure could not be
  10. // found", because it is meaningless to the end user.
  11. //
  12. // I have chosen to use ERROR_FUNCTION_NOT_CALLED = "Function could not be
  13. // executed".
  14. //
  15. static
  16. BOOL
  17. WINAPI
  18. WTSDisconnectSession(
  19. IN HANDLE hServer,
  20. IN DWORD SessionId,
  21. IN BOOL bWait
  22. )
  23. {
  24. // Taskmgr needs an error code here
  25. SetLastError(ERROR_FUNCTION_NOT_CALLED);
  26. return FALSE;
  27. }
  28. BOOL
  29. WINAPI
  30. WTSEnumerateSessionsW(
  31. IN HANDLE hServer,
  32. IN DWORD Reserved,
  33. IN DWORD Version,
  34. OUT PWTS_SESSION_INFOW * ppSessionInfo,
  35. OUT DWORD * pCount
  36. )
  37. {
  38. // Windows Update needs an error code here
  39. SetLastError(ERROR_FUNCTION_NOT_CALLED);
  40. return FALSE;
  41. }
  42. VOID
  43. WINAPI
  44. WTSFreeMemory(
  45. IN PVOID pMemory
  46. )
  47. {
  48. // May as well just implement it directly since we're in kernel32 already.
  49. // Though theoretically nobody should call us since the only time you
  50. // WTSFreeMemory is after a successful WTSQuerySessionInformation.
  51. LocalFree( pMemory );
  52. }
  53. BOOL
  54. WINAPI
  55. WTSLogoffSession(
  56. IN HANDLE hServer,
  57. IN DWORD SessionId,
  58. IN BOOL bWait
  59. )
  60. {
  61. // Taskmgr needs an error code here
  62. SetLastError(ERROR_FUNCTION_NOT_CALLED);
  63. return FALSE;
  64. }
  65. BOOL
  66. WINAPI
  67. WTSQuerySessionInformationW(
  68. IN HANDLE hServer,
  69. IN DWORD SessionId,
  70. IN WTS_INFO_CLASS WTSInfoClass,
  71. OUT LPWSTR * ppBuffer,
  72. OUT DWORD * pBytesReturned
  73. )
  74. {
  75. // SessMgr.exe needs an error code here
  76. SetLastError(ERROR_FUNCTION_NOT_CALLED);
  77. return FALSE;
  78. }
  79. BOOL
  80. WINAPI
  81. WTSSendMessageW(
  82. IN HANDLE hServer,
  83. IN DWORD SessionId,
  84. IN LPWSTR pTitle,
  85. IN DWORD TitleLength,
  86. IN LPWSTR pMessage,
  87. IN DWORD MessageLength,
  88. IN DWORD Style,
  89. IN DWORD Timeout,
  90. OUT DWORD * pResponse,
  91. IN BOOL bWait
  92. )
  93. {
  94. // Taskmgr needs an error code here
  95. SetLastError(ERROR_FUNCTION_NOT_CALLED);
  96. return FALSE;
  97. }
  98. //
  99. // !! WARNING !! The entries below must be in alphabetical order, and are CASE SENSITIVE (eg lower case comes last!)
  100. //
  101. DEFINE_PROCNAME_ENTRIES(wtsapi32)
  102. {
  103. DLPENTRY(WTSDisconnectSession)
  104. DLPENTRY(WTSEnumerateSessionsW)
  105. DLPENTRY(WTSFreeMemory)
  106. DLPENTRY(WTSLogoffSession)
  107. DLPENTRY(WTSQuerySessionInformationW)
  108. DLPENTRY(WTSSendMessageW)
  109. };
  110. DEFINE_PROCNAME_MAP(wtsapi32)