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.

330 lines
12 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. oscpkt.h
  5. Abstract:
  6. This file describes OSchooser packets.
  7. Author:
  8. Adam Barr (adamba) 25-July-1997
  9. Revision History:
  10. --*/
  11. #ifndef _OSCPKT_
  12. #define _OSCPKT_
  13. //
  14. // Defines NTLMSSP_MESSAGE_SIGNATURE_SIZE
  15. //
  16. #include <ntlmsp.h>
  17. //
  18. // The 4 byte signatures for our packets. They all start with hex 81
  19. // (for messages to the server) or hex 82 (for messages from the server).
  20. //
  21. static const PCHAR NegotiateSignature = "\x81" "NEG";
  22. static const PCHAR ChallengeSignature = "\x82" "CHL";
  23. static const PCHAR AuthenticateSignature = "\x81" "AUT";
  24. static const PCHAR AuthenticateFlippedSignature = "\x81" "AU2";
  25. static const PCHAR ResultSignature = "\x82" "RES";
  26. static const PCHAR RequestUnsignedSignature = "\x81" "RQU";
  27. static const PCHAR ResponseUnsignedSignature = "\x82" "RSU";
  28. static const PCHAR RequestSignedSignature = "\x81" "REQ";
  29. static const PCHAR ResponseSignedSignature = "\x82" "RSP";
  30. static const PCHAR ErrorSignedSignature = "\x82" "ERR";
  31. static const PCHAR UnrecognizedClientSignature = "\x82" "UNR";
  32. static const PCHAR LogoffSignature = "\x81" "OFF";
  33. static const PCHAR NegativeAckSignature = "\x82" "NAK";
  34. static const PCHAR NetcardRequestSignature = "\x81" "NCQ";
  35. static const PCHAR NetcardResponseSignature = "\x82" "NCR";
  36. static const PCHAR NetcardErrorSignature = "\x82" "NCE";
  37. static const PCHAR HalRequestSignature = "\x81" "HLQ";
  38. static const PCHAR HalResponseSignature = "\x82" "HLR";
  39. static const PCHAR SetupRequestSignature = "\x81" "SPQ";
  40. static const PCHAR SetupResponseSignature = "\x82" "SPS";
  41. //
  42. // Format for packets we exchange during login.
  43. //
  44. typedef struct _LOGIN_PACKET {
  45. UCHAR Signature[4]; // "AUT", "CHL", etc.
  46. ULONG Length; // of the rest of the packet.
  47. union {
  48. UCHAR Data[1]; // the NTLMSSP buffer.
  49. ULONG Status; // status for result packets.
  50. };
  51. } LOGIN_PACKET, *PLOGIN_PACKET;
  52. #define LOGIN_PACKET_DATA_OFFSET FIELD_OFFSET(LOGIN_PACKET, Data[0])
  53. //
  54. // Format for signed packets.
  55. //
  56. typedef struct _SIGNED_PACKET {
  57. UCHAR Signature[4]; // "REQ", "RSP".
  58. ULONG Length; // of the rest of the packet (starting after this field).
  59. ULONG SequenceNumber;
  60. USHORT FragmentNumber; // which fragment in a message this is
  61. USHORT FragmentTotal; // total number of fragments in this message
  62. ULONG SignLength;
  63. UCHAR Sign[NTLMSSP_MESSAGE_SIGNATURE_SIZE];
  64. UCHAR Data[1]; // the data.
  65. } SIGNED_PACKET, *PSIGNED_PACKET;
  66. #define SIGNED_PACKET_DATA_OFFSET FIELD_OFFSET(SIGNED_PACKET, Data[0])
  67. #define SIGNED_PACKET_EMPTY_LENGTH (FIELD_OFFSET(SIGNED_PACKET, Data[0]) - FIELD_OFFSET(SIGNED_PACKET, Length) - sizeof(ULONG))
  68. #define SIGNED_PACKET_ERROR_LENGTH (FIELD_OFFSET(SIGNED_PACKET, SequenceNumber) + sizeof(ULONG))
  69. //
  70. // Format for subsequent fragments of signed packets -- same as SIGNED_PACKET
  71. // except without the sign.
  72. //
  73. typedef struct _FRAGMENT_PACKET {
  74. UCHAR Signature[4]; // "RSP".
  75. ULONG Length; // of the rest of the packet (starting after this field).
  76. ULONG SequenceNumber;
  77. USHORT FragmentNumber; // which fragment in a message this is
  78. USHORT FragmentTotal; // total number of fragments in this message
  79. UCHAR Data[1]; // the data.
  80. } FRAGMENT_PACKET, *PFRAGMENT_PACKET;
  81. #define FRAGMENT_PACKET_DATA_OFFSET FIELD_OFFSET(FRAGMENT_PACKET, Data[0])
  82. #define FRAGMENT_PACKET_EMPTY_LENGTH (FIELD_OFFSET(FRAGMENT_PACKET, Data[0]) - FIELD_OFFSET(FRAGMENT_PACKET, Length) - sizeof(ULONG))
  83. //
  84. // These are definitions for RebootParameter inside the CREATE_DATA structure. They are used
  85. // to pass specific instructions and/or options for the next reboot.
  86. //
  87. #define OSC_REBOOT_COMMAND_CONSOLE_ONLY 0x1 // This means that the CREATE_DATA is a launch of a command console.
  88. #define OSC_REBOOT_ASR 0x2 // This means that the CREATE_DATA is a launch of ASR.
  89. //
  90. // Structure that goes in the Data section of a signed packet for
  91. // a create account response.
  92. //
  93. #define OSC_CREATE_DATA_VERSION 1
  94. typedef struct _CREATE_DATA {
  95. UCHAR Id[4]; // Contains "ACCT", where a normal screen has "NAME"
  96. ULONG VersionNumber;
  97. ULONG RebootParameter;
  98. UCHAR Sid[28];
  99. UCHAR Domain[32];
  100. UCHAR Name[32];
  101. UCHAR Password[32];
  102. ULONG UnicodePasswordLength; // in bytes
  103. WCHAR UnicodePassword[32];
  104. UCHAR Padding[24];
  105. UCHAR MachineType[6]; // 'i386\0' or 'Alpha\0'
  106. UCHAR NextBootfile[128];
  107. UCHAR SifFile[128];
  108. } CREATE_DATA, *PCREATE_DATA;
  109. //
  110. // The maximum length of a screen name
  111. //
  112. #define MAX_SCREEN_NAME_LENGTH 32
  113. //
  114. // The maximum number of flip servers we handle
  115. //
  116. #define MAX_FLIP_SERVER_COUNT 8
  117. //
  118. // This is the structure that is sent to the server to get information
  119. // about a card. It roughly corresponds to the PXENV_UNDI_GET_NIC_TYPE
  120. // structure, but is redefined here to make sure that it won't change.
  121. //
  122. typedef struct _NET_CARD_INFO {
  123. ULONG NicType; // 2=PCI, 3=PnP
  124. union{
  125. struct{
  126. USHORT Vendor_ID;
  127. USHORT Dev_ID;
  128. UCHAR Base_Class;
  129. UCHAR Sub_Class;
  130. UCHAR Prog_Intf;
  131. UCHAR Rev;
  132. USHORT BusDevFunc;
  133. USHORT Pad1;
  134. ULONG Subsys_ID;
  135. }pci;
  136. struct{
  137. ULONG EISA_Dev_ID;
  138. UCHAR Base_Class;
  139. UCHAR Sub_Class;
  140. UCHAR Prog_Intf;
  141. UCHAR Pad2;
  142. USHORT CardSelNum;
  143. USHORT Pad3;
  144. }pnp;
  145. };
  146. } NET_CARD_INFO, * PNET_CARD_INFO;
  147. //
  148. // Packets we exchange with the server.
  149. //
  150. #define OSCPKT_NETCARD_REQUEST_VERSION 2
  151. typedef struct _NETCARD_REQUEST_PACKET {
  152. UCHAR Signature[4]; // "NCQ".
  153. ULONG Length; // of the rest of the packet (starting after this field).
  154. ULONG Version; // set to OSCPKT_NETCARD_REQUEST_VERSION
  155. ULONG Architecture; // See NetPc spec for definitions for x86, Alpha, etc.
  156. UCHAR Guid[16]; // Guid of the NetPc
  157. NET_CARD_INFO CardInfo;
  158. USHORT SetupDirectoryLength;
  159. #if defined(REMOTE_BOOT)
  160. ULONG FileCheckAndCopy;// Should BINL check for this netcard and copy if necessary
  161. USHORT DriverDirectoryLength;
  162. UCHAR DriverDirectoryPath[ 1 ]; // only sent if FileCheckAndCopy is TRUE
  163. #endif
  164. // if REMOTE_BOOT is defined, the SetupDirectoryPath simply follows
  165. // DriverDirectoryPath
  166. UCHAR SetupDirectoryPath[ 1 ];
  167. } NETCARD_REQUEST_PACKET, * PNETCARD_REQUEST_PACKET;
  168. typedef struct _NETCARD_RESPONSE_PACKET {
  169. UCHAR Signature[4]; // "NCR" or "NCE"
  170. ULONG Length; // of the rest of the packet (starting after this field).
  171. ULONG Status; // if not SUCCESS, the packet ends here.
  172. ULONG Version; // currently 1
  173. //
  174. // these are offsets within the packet where the associated string starts
  175. // if the length is zero, the value is not present.
  176. //
  177. ULONG HardwareIdOffset; // string is in unicode, null terminated
  178. ULONG DriverNameOffset; // string is in unicode, null terminated
  179. ULONG ServiceNameOffset; // string is in unicode, null terminated
  180. ULONG RegistryLength;
  181. ULONG RegistryOffset; // string is in ansi, length of RegistryLength
  182. } NETCARD_RESPONSE_PACKET, * PNETCARD_RESPONSE_PACKET;
  183. #define NETCARD_RESPONSE_NO_REGISTRY_LENGTH (FIELD_OFFSET(NETCARD_RESPONSE_PACKET, Registry[0]) - FIELD_OFFSET(NETCARD_RESPONSE_PACKET, Length) - sizeof(ULONG))
  184. #define MAX_HAL_NAME_LENGTH 30 // Keep in sync with definition in setupblk.h
  185. typedef struct _HAL_REQUEST_PACKET {
  186. UCHAR Signature[4]; // "HLQ".
  187. ULONG Length; // of the rest of the packet (starting after this field).
  188. UCHAR Guid[16]; // Ugly, but defn of Guid will not change anytime soon...
  189. ULONG GuidLength; // number of bytes in Guid that are valid.
  190. CHAR HalName[MAX_HAL_NAME_LENGTH + 1];
  191. } HAL_REQUEST_PACKET, * PHAL_REQUEST_PACKET;
  192. typedef struct _HAL_RESPONSE_PACKET {
  193. UCHAR Signature[4]; // "NCR" or "NCE"
  194. ULONG Length; // of the rest of the packet (starting after this field).
  195. NTSTATUS Status; // if not SUCCESS, the packet ends here.
  196. } HAL_RESPONSE_PACKET, * PHAL_RESPONSE_PACKET;
  197. #define OSC_ADMIN_PASSWORD_LEN 64
  198. #define TFTP_RESTART_BLOCK_VERSION 2
  199. typedef struct _TFTP_RESTART_BLOCK_V1 {
  200. CHAR User[64];
  201. CHAR Domain[64];
  202. CHAR Password[64];
  203. CHAR SifFile[128];
  204. CHAR RebootFile[128];
  205. ULONGLONG RebootParameter;
  206. ULONG Checksum;
  207. ULONG Tag;
  208. } TFTP_RESTART_BLOCK_V1, *PTFTP_RESTART_BLOCK_V1;
  209. //
  210. // N.B. The TFTP_RESTART_BLOCK_V1 structure members must be properly aligned
  211. // working backwards. So make sure there isn't any problem packing the
  212. // structure.
  213. //
  214. // The structure itself will be placed in memory such that the TFTP_RESTART_BLOCK_V1 will
  215. // be on a mod-8 boundary. This structure is used by win2k clients.
  216. //
  217. // All offsets from AdministratorPassword on down MUST stay in order and in alignment
  218. // to allow WinXP Beta2 loaders to work. If you add any items, make sure you place
  219. // them at the top and add/use Filler fields to keep alignment correct.
  220. //
  221. typedef struct _TFTP_RESTART_BLOCK {
  222. ULONG Filler1; // mod-8
  223. ULONG HeadlessTerminalType; // mod-4
  224. CHAR AdministratorPassword[OSC_ADMIN_PASSWORD_LEN];// mod-8 Don't change the alignment from here down!
  225. ULONG HeadlessPortNumber; // mod-8
  226. ULONG HeadlessParity; // mod-4
  227. ULONG HeadlessBaudRate; // mod-8
  228. ULONG HeadlessStopBits; // mod-4
  229. ULONG HeadlessUsedBiosSettings; // mod-8
  230. ULONG HeadlessPciDeviceId; // mod-4
  231. ULONG HeadlessPciVendorId; // mod-8
  232. ULONG HeadlessPciBusNumber; // mod-4
  233. ULONG HeadlessPciSlotNumber; // mod-8
  234. ULONG HeadlessPciFunctionNumber; // mod-4
  235. ULONG HeadlessPciFlags; // mod-8
  236. PUCHAR HeadlessPortAddress; // mod-4
  237. ULONG TftpRestartBlockVersion; // mod-8
  238. ULONG NewCheckSumLength; // mod-4
  239. ULONG NewCheckSum; // mod-8 address.
  240. TFTP_RESTART_BLOCK_V1 RestartBlockV1; // this will start on a mod-8 address.
  241. } TFTP_RESTART_BLOCK, *PTFTP_RESTART_BLOCK;
  242. //
  243. // Packet used by textmode setup for requests and responses
  244. //
  245. typedef struct _SPUDP_PACKET {
  246. UCHAR Signature[4]; // "SPQ", "SPS".
  247. ULONG Length; // of the rest of the packet (starting after this field).
  248. ULONG RequestType; // Specific request needed.
  249. NTSTATUS Status; // Status of the operation (used in response packets)
  250. ULONG SequenceNumber;
  251. USHORT FragmentNumber; // which fragment in a message this is
  252. USHORT FragmentTotal; // total number of fragments in this message
  253. UCHAR Data[1]; // the data.
  254. } SPUDP_PACKET, *PSPUDP_PACKET;
  255. #define SPUDP_PACKET_DATA_OFFSET FIELD_OFFSET(SPUDP_PACKET, Data[0])
  256. #define SPUDP_PACKET_EMPTY_LENGTH (FIELD_OFFSET(SPUDP_PACKET, Data[0]) - FIELD_OFFSET(SPUDP_PACKET, Length) - sizeof(ULONG))
  257. typedef struct _SP_NETCARD_INFO_REQ {
  258. ULONG Version; // currently 0
  259. ULONG Architecture; // See NetPc spec for definitions for x86, Alpha, etc.
  260. NET_CARD_INFO CardInfo;
  261. WCHAR SetupPath[1];
  262. } SP_NETCARD_INFO_REQ, *PSP_NETCARD_INFO_REQ;
  263. typedef struct _SP_NETCARD_INFO_RSP {
  264. ULONG cFiles; // Count of the number of source/destination pairs below.
  265. WCHAR MultiSzFiles[1];
  266. } SP_NETCARD_INFO_RSP, *PSP_NETCARD_INFO_RSP;
  267. #endif // _OSCPKT_