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.

225 lines
6.5 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 CredentialsHandle;
  116. ULONG Flags;
  117. UNICODE_STRING_WOW64 AccountRealm;
  118. UNICODE_STRING_WOW64 AccountName;
  119. UNICODE_STRING_WOW64 Password;
  120. UNICODE_STRING_WOW64 ClientRealm;
  121. UNICODE_STRING_WOW64 ClientName;
  122. BOOLEAN Impersonating;
  123. UNICODE_STRING_WOW64 KdcAddress;
  124. ULONG KdcAddressType;
  125. }
  126. KERB_SETPASSWORD_EX_REQUEST_WOW64, *PKERB_SETPASSWORD_EX_REQUEST_WOW64;
  127. typedef struct _KERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64
  128. {
  129. KERB_PROTOCOL_MESSAGE_TYPE MessageType;
  130. UNICODE_STRING_WOW64 RealmName;
  131. UNICODE_STRING_WOW64 KdcAddress;
  132. ULONG AddressType; //dsgetdc.h DS_NETBIOS_ADDRESS||DS_INET_ADDRESS
  133. }
  134. KERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64, *PKERB_ADD_BINDING_CACHE_ENTRY_REQUEST_WOW64;
  135. //
  136. // WOW helper macros
  137. //
  138. #define UNICODE_STRING_FROM_WOW_STRING(pUnicodeString, pWOWString) \
  139. (pUnicodeString)->Length = (pWOWString)->Length; \
  140. (pUnicodeString)->MaximumLength = (pWOWString)->MaximumLength; \
  141. (pUnicodeString)->Buffer = (LPWSTR) UlongToPtr((pWOWString)->Buffer);
  142. //
  143. // WOW helper functions
  144. //
  145. NTSTATUS
  146. KerbConvertWOWLogonBuffer(
  147. IN PVOID ProtocolSubmitBuffer,
  148. IN PVOID ClientBufferBase,
  149. IN OUT PULONG pSubmitBufferSize,
  150. IN KERB_LOGON_SUBMIT_TYPE MessageType,
  151. OUT PVOID *ppTempSubmitBuffer
  152. );
  153. NTSTATUS
  154. KerbAllocateInteractiveWOWBuffer(
  155. OUT PKERB_INTERACTIVE_PROFILE *ProfileBuffer,
  156. OUT PULONG ProfileBufferSize,
  157. IN PNETLOGON_VALIDATION_SAM_INFO3 UserInfo,
  158. IN PKERB_LOGON_SESSION LogonSession,
  159. IN OPTIONAL PKERB_ENCRYPTED_TICKET LogonTicket,
  160. IN OPTIONAL PKERB_INTERACTIVE_LOGON KerbLogonInfo,
  161. IN PUCHAR *PClientBufferBase,
  162. IN BOOLEAN BuildSmartCardProfile,
  163. IN BOOLEAN BuildTicketProfile
  164. );
  165. NTSTATUS
  166. KerbPackExternalWOWTicket(
  167. PKERB_TICKET_CACHE_ENTRY pCacheEntry,
  168. PKERB_MESSAGE_BUFFER pEncodedTicket,
  169. PKERB_EXTERNAL_TICKET *pTicketResponse,
  170. PBYTE *pClientTicketResponse,
  171. PULONG pTicketSize
  172. );
  173. VOID
  174. KerbPutWOWString(
  175. IN PUNICODE_STRING InputString,
  176. OUT PUNICODE_STRING_WOW64 OutputString,
  177. IN LONG_PTR Offset,
  178. IN OUT PBYTE * Where
  179. );
  180. VOID
  181. KerbPutKdcNameAsWOWString(
  182. IN PKERB_INTERNAL_NAME InputName,
  183. OUT PUNICODE_STRING_WOW64 OutputName,
  184. IN LONG_PTR Offset,
  185. IN OUT PBYTE * Where
  186. );
  187. #endif // _WIN64
  188. #endif // __KERBWOW_H__