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.

235 lines
7.0 KiB

  1. //+-----------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (c) Microsoft Corporation 1992 - 2000
  6. //
  7. // File: kerbwow.h
  8. //
  9. // Contents: prototypes for 32-64 bit interop for the Kerberos package
  10. //
  11. //
  12. // History: 25-Oct-2000 JSchwart Created
  13. //
  14. //------------------------------------------------------------------------
  15. #ifndef __KERBWOW_H__
  16. #define __KERBWOW_H__
  17. #ifdef _WIN64
  18. //
  19. // WOW versions of native structures
  20. //
  21. typedef UNICODE_STRING32 UNICODE_STRING_WOW64;
  22. typedef UNICODE_STRING_WOW64 *PUNICODE_STRING_WOW64;
  23. typedef struct _SECHANDLE_WOW64
  24. {
  25. ULONG dwLower;
  26. ULONG dwUpper;
  27. }
  28. SECHANDLE_WOW64, *PSECHANDLE_WOW64;
  29. typedef struct _KERB_TICKET_CACHE_INFO_WOW64
  30. {
  31. UNICODE_STRING_WOW64 ServerName;
  32. UNICODE_STRING_WOW64 RealmName;
  33. LARGE_INTEGER StartTime;
  34. LARGE_INTEGER EndTime;
  35. LARGE_INTEGER RenewTime;
  36. LONG EncryptionType;
  37. ULONG TicketFlags;
  38. }
  39. KERB_TICKET_CACHE_INFO_WOW64, *PKERB_TICKET_CACHE_INFO_WOW64;
  40. typedef struct _KERB_TICKET_CACHE_INFO_EX_WOW64
  41. {
  42. UNICODE_STRING_WOW64 ClientName;
  43. UNICODE_STRING_WOW64 ClientRealm;
  44. UNICODE_STRING_WOW64 ServerName;
  45. UNICODE_STRING_WOW64 ServerRealm;
  46. LARGE_INTEGER StartTime;
  47. LARGE_INTEGER EndTime;
  48. LARGE_INTEGER RenewTime;
  49. LONG EncryptionType;
  50. ULONG TicketFlags;
  51. }
  52. KERB_TICKET_CACHE_INFO_EX_WOW64, *PKERB_TICKET_CACHE_INFO_EX_WOW64;
  53. typedef struct _KERB_CHANGE_MACH_PWD_REQUEST_WOW64
  54. {
  55. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  56. UNICODE_STRING_WOW64 NewPassword;
  57. UNICODE_STRING_WOW64 OldPassword;
  58. }
  59. KERB_CHANGE_MACH_PWD_REQUEST_WOW64, *PKERB_CHANGE_MACH_PWD_REQUEST_WOW64;
  60. typedef struct _KERB_CHANGEPASSWORD_REQUEST_WOW64
  61. {
  62. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  63. UNICODE_STRING_WOW64 DomainName;
  64. UNICODE_STRING_WOW64 AccountName;
  65. UNICODE_STRING_WOW64 OldPassword;
  66. UNICODE_STRING_WOW64 NewPassword;
  67. BOOLEAN Impersonating;
  68. }
  69. KERB_CHANGEPASSWORD_REQUEST_WOW64, *PKERB_CHANGEPASSWORD_REQUEST_WOW64;
  70. typedef struct _KERB_PURGE_TKT_CACHE_REQUEST_WOW64
  71. {
  72. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  73. LUID LogonId;
  74. UNICODE_STRING_WOW64 ServerName;
  75. UNICODE_STRING_WOW64 RealmName;
  76. }
  77. KERB_PURGE_TKT_CACHE_REQUEST_WOW64, *PKERB_PURGE_TKT_CACHE_REQUEST_WOW64;
  78. typedef struct _KERB_PURGE_TKT_CACHE_EX_REQUEST_WOW64
  79. {
  80. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  81. LUID LogonId;
  82. ULONG Flags;
  83. KERB_TICKET_CACHE_INFO_EX_WOW64 TicketTemplate;
  84. }
  85. KERB_PURGE_TKT_CACHE_EX_REQUEST_WOW64, *PKERB_PURGE_TKT_CACHE_EX_REQUEST_WOW64;
  86. typedef struct _KERB_QUERY_TKT_CACHE_RESPONSE_WOW64
  87. {
  88. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  89. ULONG CountOfTickets;
  90. KERB_TICKET_CACHE_INFO_WOW64 Tickets[ANYSIZE_ARRAY];
  91. }
  92. KERB_QUERY_TKT_CACHE_RESPONSE_WOW64, *PKERB_QUERY_TKT_CACHE_RESPONSE_WOW64;
  93. typedef struct _KERB_QUERY_TKT_CACHE_EX_RESPONSE_WOW64
  94. {
  95. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  96. ULONG CountOfTickets;
  97. KERB_TICKET_CACHE_INFO_EX_WOW64 Tickets[ANYSIZE_ARRAY];
  98. }
  99. KERB_QUERY_TKT_CACHE_EX_RESPONSE_WOW64, *PKERB_QUERY_TKT_CACHE_EX_RESPONSE_WOW64;
  100. typedef struct _KERB_SETPASSWORD_REQUEST_WOW64
  101. {
  102. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  103. LUID LogonId;
  104. SECHANDLE_WOW64 CredentialsHandle;
  105. ULONG Flags;
  106. UNICODE_STRING_WOW64 DomainName;
  107. UNICODE_STRING_WOW64 AccountName;
  108. UNICODE_STRING_WOW64 Password;
  109. }
  110. KERB_SETPASSWORD_REQUEST_WOW64, *PKERB_SETPASSWORD_REQUEST_WOW64;
  111. typedef struct _KERB_SETPASSWORD_EX_REQUEST_WOW64
  112. {
  113. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  114. LUID LogonId;
  115. SECHANDLE_WOW64 Unused;
  116. ULONG Flags;
  117. UNICODE_STRING_WOW64 AccountRealm;
  118. UNICODE_STRING_WOW64 AccountName;
  119. UNICODE_STRING_WOW64 Password;
  120. UNICODE_STRING_WOW64 OldPassword;
  121. UNICODE_STRING_WOW64 ClientRealm;
  122. UNICODE_STRING_WOW64 ClientName;
  123. BOOLEAN Impersonating;
  124. UNICODE_STRING_WOW64 KdcAddress;
  125. ULONG KdcAddressType;
  126. }
  127. KERB_SETPASSWORD_EX_REQUEST_WOW64, *PKERB_SETPASSWORD_EX_REQUEST_WOW64;
  128. typedef struct _KERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64
  129. {
  130. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  131. UNICODE_STRING_WOW64 RealmName;
  132. UNICODE_STRING_WOW64 KdcAddress;
  133. ULONG AddressType; //dsgetdc.h DS_NETBIOS_ADDRESS||DS_INET_ADDRESS
  134. }
  135. KERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64, *PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64;
  136. typedef struct _SecPkgContext_NativeNamesW_WOW64
  137. {
  138. ULONG sClientName;
  139. ULONG sServerName;
  140. }
  141. SecPkgContext_NativeNamesW_WOW64, *PSecPkgContext_NativeNamesW_WOW64;
  142. //
  143. // WOW helper macros
  144. //
  145. #define UNICODE_STRING_FROM_WOW_STRING(pUnicodeString, pWOWString) \
  146. (pUnicodeString)->Length = (pWOWString)->Length; \
  147. (pUnicodeString)->MaximumLength = (pWOWString)->MaximumLength; \
  148. (pUnicodeString)->Buffer = (LPWSTR) UlongToPtr((pWOWString)->Buffer);
  149. //
  150. // WOW helper functions
  151. //
  152. NTSTATUS
  153. KerbConvertWOWLogonBuffer(
  154. IN PVOID ProtocolSubmitBuffer,
  155. IN PVOID ClientBufferBase,
  156. IN OUT PULONG pSubmitBufferSize,
  157. IN KERB_LOGON_SUBMIT_TYPE MessageType,
  158. OUT PVOID *ppTempSubmitBuffer
  159. );
  160. NTSTATUS
  161. KerbAllocateInteractiveWOWBuffer(
  162. OUT PKERB_INTERACTIVE_PROFILE *ProfileBuffer,
  163. OUT PULONG ProfileBufferSize,
  164. IN PNETLOGON_VALIDATION_SAM_INFO3 UserInfo,
  165. IN PKERB_LOGON_SESSION LogonSession,
  166. IN OPTIONAL PKERB_ENCRYPTED_TICKET LogonTicket,
  167. IN OPTIONAL PKERB_INTERACTIVE_LOGON KerbLogonInfo,
  168. IN PUCHAR *PClientBufferBase,
  169. IN BOOLEAN BuildSmartCardProfile,
  170. IN BOOLEAN BuildTicketProfile
  171. );
  172. NTSTATUS
  173. KerbPackExternalWOWTicket(
  174. PKERB_TICKET_CACHE_ENTRY pCacheEntry,
  175. PKERB_MESSAGE_BUFFER pEncodedTicket,
  176. PKERB_EXTERNAL_TICKET *pTicketResponse,
  177. PBYTE *pClientTicketResponse,
  178. PULONG pTicketSize
  179. );
  180. VOID
  181. KerbPutWOWString(
  182. IN PUNICODE_STRING InputString,
  183. OUT PUNICODE_STRING_WOW64 OutputString,
  184. IN LONG_PTR Offset,
  185. IN OUT PBYTE * Where
  186. );
  187. VOID
  188. KerbPutKdcNameAsWOWString(
  189. IN PKERB_INTERNAL_NAME InputName,
  190. OUT PUNICODE_STRING_WOW64 OutputName,
  191. IN LONG_PTR Offset,
  192. IN OUT PBYTE * Where
  193. );
  194. #endif // _WIN64
  195. #endif // __KERBWOW_H__