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.

160 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 1994-95 Microsoft Corporation
  3. Module Name:
  4. llsimp.h
  5. Abstract:
  6. Imported definitions (dirty laundry).
  7. Author:
  8. Don Ryan (donryan) 29-Jan-1994
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. --*/
  13. #ifndef _LLSIMP_H_
  14. #define _LLSIMP_H_
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define IN
  19. #define OUT
  20. typedef long NTSTATUS;
  21. #define NT_SUCCESS(Status) ((NTSTATUS)Status >= 0)
  22. #define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
  23. #define STATUS_UNSUCCESSFUL ((NTSTATUS)0x00000001L)
  24. #define STATUS_MORE_ENTRIES ((NTSTATUS)0x00000105L)
  25. #define STATUS_NO_MORE_ENTRIES ((NTSTATUS)0x8000001AL)
  26. #define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL)
  27. #define STATUS_INVALID_HANDLE ((NTSTATUS)0xC0000008L)
  28. #define STATUS_ACCESS_DENIED ((NTSTATUS)0xC0000022L)
  29. #define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS)0xC0000034L)
  30. #define STATUS_MEMBER_IN_GROUP ((NTSTATUS)0xC0000067L)
  31. #define STATUS_NOT_SUPPORTED ((NTSTATUS)0xC00000BBL)
  32. #define STATUS_NOT_FOUND ((NTSTATUS)0xC0000225L)
  33. #define RPC_NT_SERVER_UNAVAILABLE ((NTSTATUS)0xC0020017L)
  34. #define RPC_NT_SS_CONTEXT_MISMATCH ((NTSTATUS)0xC0030005L)
  35. #define IsConnectionDropped(Status) \
  36. (((NTSTATUS)(Status) == STATUS_INVALID_HANDLE) || \
  37. ((NTSTATUS)(Status) == RPC_NT_SERVER_UNAVAILABLE) || \
  38. ((NTSTATUS)(Status) == RPC_NT_SS_CONTEXT_MISMATCH) || \
  39. ((NTSTATUS)(Status) == RPC_S_SERVER_UNAVAILABLE) || \
  40. ((NTSTATUS)(Status) == RPC_S_CALL_FAILED))
  41. #define LLS_PREFERRED_LENGTH ((DWORD)-1L)
  42. #define V_ISVOID(va) \
  43. ( \
  44. (V_VT(va) == VT_EMPTY) || \
  45. (V_VT(va) == VT_ERROR && V_ERROR(va) == DISP_E_PARAMNOTFOUND) \
  46. )
  47. #define POLICY_VIEW_LOCAL_INFORMATION 0x00000001L
  48. #define POLICY_LOOKUP_NAMES 0x00000800L
  49. #define LLS_DESIRED_ACCESS (STANDARD_RIGHTS_REQUIRED |\
  50. POLICY_VIEW_LOCAL_INFORMATION |\
  51. POLICY_LOOKUP_NAMES )
  52. typedef PVOID LSA_HANDLE, *PLSA_HANDLE;
  53. typedef ULONG LSA_ENUMERATION_HANDLE, *PLSA_ENUMERATION_HANDLE;
  54. typedef struct _LSA_UNICODE_STRING {
  55. USHORT Length;
  56. USHORT MaximumLength;
  57. PWSTR Buffer;
  58. } LSA_UNICODE_STRING, *PLSA_UNICODE_STRING;
  59. typedef struct _LSA_OBJECT_ATTRIBUTES {
  60. ULONG Length;
  61. HANDLE RootDirectory;
  62. PLSA_UNICODE_STRING ObjectName;
  63. ULONG Attributes;
  64. PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR
  65. PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE
  66. } LSA_OBJECT_ATTRIBUTES, *PLSA_OBJECT_ATTRIBUTES;
  67. typedef struct _LSA_TRUST_INFORMATION {
  68. LSA_UNICODE_STRING Name;
  69. LPVOID Sid; // PSID Sid;
  70. } LSA_TRUST_INFORMATION, *PLSA_TRUST_INFORMATION;
  71. NTSTATUS
  72. NTAPI
  73. LsaOpenPolicy(
  74. IN PLSA_UNICODE_STRING SystemName,
  75. IN PLSA_OBJECT_ATTRIBUTES ObjectAttributes,
  76. IN ACCESS_MASK DesiredAccess,
  77. IN OUT PLSA_HANDLE PolicyHandle
  78. );
  79. NTSTATUS
  80. NTAPI
  81. LsaEnumerateTrustedDomains(
  82. IN LSA_HANDLE PolicyHandle,
  83. IN OUT PLSA_ENUMERATION_HANDLE EnumerationContext,
  84. OUT PVOID *Buffer,
  85. IN ULONG PreferedMaximumLength,
  86. OUT PULONG CountReturned
  87. );
  88. NTSTATUS
  89. NTAPI
  90. LsaFreeMemory(
  91. IN PVOID Buffer
  92. );
  93. NTSTATUS
  94. NTAPI
  95. LsaClose(
  96. IN LSA_HANDLE ObjectHandle
  97. );
  98. #define InitializeObjectAttributes( p, n, a, r, s ) { \
  99. (p)->Length = sizeof( LSA_OBJECT_ATTRIBUTES ); \
  100. (p)->RootDirectory = r; \
  101. (p)->Attributes = a; \
  102. (p)->ObjectName = n; \
  103. (p)->SecurityDescriptor = s; \
  104. (p)->SecurityQualityOfService = NULL; \
  105. }
  106. NTSYSAPI
  107. VOID
  108. NTAPI
  109. RtlSecondsSince1980ToTime (
  110. ULONG ElapsedSeconds,
  111. PLARGE_INTEGER Time
  112. );
  113. NTSYSAPI
  114. VOID
  115. NTAPI
  116. RtlInitUnicodeString(
  117. PLSA_UNICODE_STRING DestinationString,
  118. PCWSTR SourceString
  119. );
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif // _LLSIMP_H_