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.9 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. wsutil.h
  5. Abstract:
  6. Private header file for the NT Workstation service included by every module
  7. module of the Workstation service.
  8. Author:
  9. Rita Wong (ritaw) 15-Feb-1991
  10. Revision History:
  11. --*/
  12. #ifndef _WSUTIL_INCLUDED_
  13. #define _WSUTIL_INCLUDED_
  14. #if _PNP_POWER
  15. #define RDR_PNP_POWER 1
  16. #endif
  17. //
  18. // This include file will be included by tstring.h if Unicode
  19. // is defined.
  20. //
  21. #ifndef UNICODE
  22. #include <stdlib.h> // Unicode string functions
  23. #endif
  24. #include "ws.h"
  25. #define INITIAL_USER_COUNT 10 // Initial table size is for
  26. // number of logged on users
  27. #define GROW_USER_COUNT 5 // When initial size is not enough,
  28. // grow table for additional users
  29. #define MAX_SINGLE_MESSAGE_SIZE 128 // Maximum size of a datagram message
  30. //
  31. // An invalid parameter is encountered. Return the value to identify
  32. // the parameter at fault.
  33. //
  34. #define RETURN_INVALID_PARAMETER(ErrorParameter, ParameterId) \
  35. if (ARGUMENT_PRESENT(ErrorParameter)) { \
  36. *ErrorParameter = ParameterId; \
  37. } \
  38. return ERROR_INVALID_PARAMETER;
  39. //-------------------------------------------------------------------//
  40. // //
  41. // Type definitions //
  42. // //
  43. //-------------------------------------------------------------------//
  44. typedef struct _PER_USER_ENTRY {
  45. PVOID List; // Pointer to linked list of user data
  46. LUID LogonId; // Logon Id of user
  47. } PER_USER_ENTRY, *PPER_USER_ENTRY;
  48. typedef struct _USERS_OBJECT {
  49. PPER_USER_ENTRY Table; // Table of users
  50. RTL_RESOURCE TableResource; // To serialize access to Table
  51. HANDLE TableMemory; // Relocatable Table memory
  52. DWORD TableSize; // Size of Table
  53. } USERS_OBJECT, *PUSERS_OBJECT;
  54. //-------------------------------------------------------------------//
  55. // //
  56. // Function prototypes of utility routines found in wsutil.c //
  57. // //
  58. //-------------------------------------------------------------------//
  59. NET_API_STATUS
  60. WsInitializeUsersObject(
  61. IN PUSERS_OBJECT Users
  62. );
  63. VOID
  64. WsDestroyUsersObject(
  65. IN PUSERS_OBJECT Users
  66. );
  67. NET_API_STATUS
  68. WsGetUserEntry(
  69. IN PUSERS_OBJECT Users,
  70. IN PLUID LogonId,
  71. OUT PULONG Index,
  72. IN BOOL IsAdd
  73. );
  74. NET_API_STATUS
  75. WsMapStatus(
  76. IN NTSTATUS NtStatus
  77. );
  78. int
  79. WsCompareString(
  80. IN LPTSTR String1,
  81. IN DWORD Length1,
  82. IN LPTSTR String2,
  83. IN DWORD Length2
  84. );
  85. int
  86. WsCompareStringU(
  87. IN LPWSTR String1,
  88. IN DWORD Length1,
  89. IN LPTSTR String2,
  90. IN DWORD Length2
  91. );
  92. BOOL
  93. WsCopyStringToBuffer(
  94. IN PUNICODE_STRING SourceString,
  95. IN LPBYTE FixedPortion,
  96. IN OUT LPTSTR *EndOfVariableData,
  97. OUT LPTSTR *DestinationStringPointer
  98. );
  99. NET_API_STATUS
  100. WsImpersonateClient(
  101. VOID
  102. );
  103. NET_API_STATUS
  104. WsRevertToSelf(
  105. VOID
  106. );
  107. NET_API_STATUS
  108. WsImpersonateAndGetLogonId(
  109. OUT PLUID LogonId
  110. );
  111. NET_API_STATUS
  112. WsImpersonateAndGetSessionId(
  113. OUT PULONG pSessionId
  114. );
  115. NET_API_STATUS
  116. WsOpenDestinationMailslot(
  117. IN LPWSTR TargetName,
  118. IN LPWSTR MailslotName,
  119. OUT PHANDLE MailslotHandle
  120. );
  121. DWORD
  122. WsInAWorkgroup(
  123. VOID
  124. );
  125. VOID
  126. WsPreInitializeMessageSend(
  127. VOID
  128. );
  129. #endif // ifndef _WSUTIL_INCLUDED_