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.

307 lines
8.2 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. hdlsterm.h
  5. Abstract:
  6. This module contains the public header information (function prototypes,
  7. data and type declarations) for the Headless Terminal effort.
  8. Author:
  9. Sean Selitrennikoff (v-seans) Oct, 1999
  10. Revision History:
  11. --*/
  12. #ifndef _HDLSTERM_
  13. #define _HDLSTERM_
  14. //
  15. // Defines for string codes that can be passed to HeadlessAddLogEntry()
  16. //
  17. #define HEADLESS_LOG_LOADING_FILENAME 0x01 // expects parameter.
  18. #define HEADLESS_LOG_LOAD_SUCCESSFUL 0x02
  19. #define HEADLESS_LOG_LOAD_FAILED 0x03
  20. #define HEADLESS_LOG_EVENT_CREATE_FAILED 0x04
  21. #define HEADLESS_LOG_OBJECT_TYPE_CREATE_FAILED 0x05
  22. #define HEADLESS_LOG_ROOT_DIR_CREATE_FAILED 0x06
  23. #define HEADLESS_LOG_PNP_PHASE0_INIT_FAILED 0x07
  24. #define HEADLESS_LOG_PNP_PHASE1_INIT_FAILED 0x08
  25. #define HEADLESS_LOG_BOOT_DRIVERS_INIT_FAILED 0x09
  26. #define HEADLESS_LOG_LOCATE_SYSTEM_DLL_FAILED 0x0A
  27. #define HEADLESS_LOG_SYSTEM_DRIVERS_INIT_FAILED 0x0B
  28. #define HEADLESS_LOG_ASSIGN_SYSTEM_ROOT_FAILED 0x0C
  29. #define HEADLESS_LOG_PROTECT_SYSTEM_ROOT_FAILED 0x0D
  30. #define HEADLESS_LOG_UNICODE_TO_ANSI_FAILED 0x0E
  31. #define HEADLESS_LOG_ANSI_TO_UNICODE_FAILED 0x0F
  32. #define HEADLESS_LOG_FIND_GROUPS_FAILED 0x10
  33. #define HEADLESS_LOG_OUT_OF_MEMORY 0x11
  34. #define HEADLESS_LOG_WAIT_BOOT_DEVICES_DELETE_FAILED 0x12
  35. #define HEADLESS_LOG_WAIT_BOOT_DEVICES_START_FAILED 0x13
  36. #define HEADLESS_LOG_WAIT_BOOT_DEVICES_REINIT_FAILED 0x14
  37. #define HEADLESS_LOG_MARK_BOOT_PARTITION_FAILED 0x15
  38. //
  39. // Global defines for a default vt100 terminal. May be used by clients to size the
  40. // local monitor to match the headless monitor.
  41. //
  42. #define HEADLESS_TERM_DEFAULT_BKGD_COLOR 40
  43. #define HEADLESS_TERM_DEFAULT_TEXT_COLOR 37
  44. #define HEADLESS_SCREEN_HEIGHT 24
  45. //
  46. // Commands that can be submitted to HeadlessDispatch.
  47. //
  48. typedef enum _HEADLESS_CMD {
  49. HeadlessCmdEnableTerminal = 1,
  50. HeadlessCmdCheckForReboot,
  51. HeadlessCmdPutString,
  52. HeadlessCmdClearDisplay,
  53. HeadlessCmdClearToEndOfDisplay,
  54. HeadlessCmdClearToEndOfLine,
  55. HeadlessCmdDisplayAttributesOff,
  56. HeadlessCmdDisplayInverseVideo,
  57. HeadlessCmdSetColor,
  58. HeadlessCmdPositionCursor,
  59. HeadlessCmdTerminalPoll,
  60. HeadlessCmdGetByte,
  61. HeadlessCmdGetLine,
  62. HeadlessCmdStartBugCheck,
  63. HeadlessCmdDoBugCheckProcessing,
  64. HeadlessCmdQueryInformation,
  65. HeadlessCmdAddLogEntry,
  66. HeadlessCmdDisplayLog,
  67. HeadlessCmdSetBlueScreenData,
  68. HeadlessCmdSendBlueScreenData,
  69. HeadlessCmdQueryGUID,
  70. HeadlessCmdPutData
  71. } HEADLESS_CMD, *PHEADLESS_CMD;
  72. //
  73. //
  74. // Structure definitions for the input buffer for each command type.
  75. //
  76. //
  77. //
  78. // HeadlessCmdEnableTerminal:
  79. // Input structure: Enable, TRUE if to attempt to enable, FALSE if attempt to disable.
  80. //
  81. typedef struct _HEADLESS_CMD_ENABLE_TERMINAL {
  82. BOOLEAN Enable;
  83. } HEADLESS_CMD_ENABLE_TERMINAL, *PHEADLESS_CMD_ENABLE_TERMINAL;
  84. //
  85. // HeadlessCmdCheckForReboot:
  86. // Response structure: Reboot, TRUE if user typed reboot command on the terminal.
  87. //
  88. typedef struct _HEADLESS_RSP_REBOOT {
  89. BOOLEAN Reboot;
  90. } HEADLESS_RSP_REBOOT, *PHEADLESS_RSP_REBOOT;
  91. //
  92. // HeadlessCmdPutString:
  93. // Input structure: String, A NULL-terminated string.
  94. //
  95. typedef struct _HEADLESS_CMD_PUT_STRING {
  96. UCHAR String[1];
  97. } HEADLESS_CMD_PUT_STRING, *PHEADLESS_CMD_PUT_STRING;
  98. //
  99. // HeadlessCmdClearDisplay:
  100. // HeadlessCmdClearToEndOfDisplay:
  101. // HeadlessCmdClearToEndOfLine:
  102. // HeadlessCmdDisplayAttributesOff:
  103. // HeadlessCmdDisplayInverseVideo:
  104. // HeadlessCmdStartBugCheck:
  105. // HeadlessCmdDoBugCheckProcessing:
  106. // No Input nor Output parameters expected.
  107. //
  108. //
  109. // HeadlessCmdSetColor:
  110. // Input structure: FgColor, BkgColor: Both colors set according to ANSI terminal
  111. // definitons.
  112. //
  113. typedef struct _HEADLESS_CMD_SET_COLOR {
  114. ULONG FgColor;
  115. ULONG BkgColor;
  116. } HEADLESS_CMD_SET_COLOR, *PHEADLESS_CMD_SET_COLOR;
  117. //
  118. // HeadlessCmdPositionCursor:
  119. // Input structure: X, Y: Both values are zero base, with upper left being (0, 0).
  120. //
  121. typedef struct _HEADLESS_CMD_POSITION_CURSOR {
  122. ULONG X;
  123. ULONG Y;
  124. } HEADLESS_CMD_POSITION_CURSOR, *PHEADLESS_CMD_POSITION_CURSOR;
  125. //
  126. // HeadlessCmdTerminalPoll:
  127. // Response structure: QueuedInput, TRUE if input is available, else FALSE.
  128. //
  129. typedef struct _HEADLESS_RSP_POLL {
  130. BOOLEAN QueuedInput;
  131. } HEADLESS_RSP_POLL, *PHEADLESS_RSP_POLL;
  132. //
  133. // HeadlessCmdGetByte:
  134. // Response structure: Value, 0 if no input is available, else a single byte of input.
  135. //
  136. typedef struct _HEADLESS_RSP_GET_BYTE {
  137. UCHAR Value;
  138. } HEADLESS_RSP_GET_BYTE, *PHEADLESS_RSP_GET_BYTE;
  139. //
  140. // HeadlessCmdGetLine:
  141. // Response structure: LineComplete, TRUE if the string is filled in, else FALSE becuase
  142. // the user has not yet pressed enter.
  143. // String, the string entered by the user, NULL terminated, with
  144. // leading and trailing whitespace removed.
  145. //
  146. typedef struct _HEADLESS_RSP_GET_LINE {
  147. BOOLEAN LineComplete;
  148. UCHAR Buffer[1];
  149. } HEADLESS_RSP_GET_LINE, *PHEADLESS_RSP_GET_LINE;
  150. //
  151. // HeadlessCmdQueryInformation:
  152. // Response structure:
  153. //
  154. // PortType - Determines what kind of connection is being used to connect the
  155. // headless terminal to the machine.
  156. //
  157. // If SerialPort, then
  158. // TerminalAttached, TRUE if there is a terminal connected.
  159. // TerminalPort, the port settings used by headless.
  160. //
  161. typedef enum _HEADLESS_TERM_PORT_TYPE {
  162. HeadlessUndefinedPortType = 0,
  163. HeadlessSerialPort
  164. } HEADLESS_TERM_PORT_TYPE, *PHEADLESS_TERM_PORT_TYPE;
  165. typedef enum _HEADLESS_TERM_SERIAL_PORT {
  166. SerialPortUndefined = 0,
  167. ComPort1,
  168. ComPort2,
  169. ComPort3,
  170. ComPort4
  171. } HEADLESS_TERM_SERIAL_PORT, *PHEADLESS_TERM_SERIAL_PORT;
  172. typedef struct _HEADLESS_RSP_QUERY_INFO {
  173. HEADLESS_TERM_PORT_TYPE PortType;
  174. //
  175. // All the possible parameters for each connection type.
  176. //
  177. union {
  178. struct {
  179. BOOLEAN TerminalAttached;
  180. BOOLEAN UsedBiosSettings;
  181. HEADLESS_TERM_SERIAL_PORT TerminalPort;
  182. PUCHAR TerminalPortBaseAddress;
  183. ULONG TerminalBaudRate;
  184. UCHAR TerminalType;
  185. } Serial;
  186. };
  187. } HEADLESS_RSP_QUERY_INFO, *PHEADLESS_RSP_QUERY_INFO;
  188. //
  189. // HeadlessCmdAddLogEntry:
  190. // Input structure: String, A NULL-terminated string.
  191. //
  192. typedef struct _HEADLESS_CMD_ADD_LOG_ENTRY {
  193. WCHAR String[1];
  194. } HEADLESS_CMD_ADD_LOG_ENTRY, *PHEADLESS_CMD_ADD_LOG_ENTRY;
  195. //
  196. // HeadlessCmdDisplayLog:
  197. // Response structure: Paging, TRUE if paging is to be applied, else FALSE.
  198. //
  199. typedef struct _HEADLESS_CMD_DISPLAY_LOG {
  200. BOOLEAN Paging;
  201. } HEADLESS_CMD_DISPLAY_LOG, *PHEADLESS_CMD_DISPLAY_LOG;
  202. //
  203. // HeadlessCmdSetBlueScreenData
  204. //
  205. // External structure from the API.
  206. // ValueIndex is the index into the data where the XML Data is
  207. // located. Strings are null terminated.
  208. //
  209. // For cross checking, the UCHAR in the Data array before the ValueIndex
  210. // must be a null character. Similarly the last character in the
  211. // entire data buffer passed in must be a null character.
  212. //
  213. typedef struct _HEADLESS_CMD_SET_BLUE_SCREEN_DATA {
  214. ULONG ValueIndex;
  215. UCHAR Data[1];
  216. } HEADLESS_CMD_SET_BLUE_SCREEN_DATA, *PHEADLESS_CMD_SET_BLUE_SCREEN_DATA;
  217. //
  218. // HeadlessCmdSendBlueScreenData
  219. // The only parameter is the bugcheck code
  220. //
  221. typedef struct _HEADLESS_CMD_SEND_BLUE_SCREEN_DATA {
  222. ULONG BugcheckCode;
  223. } HEADLESS_CMD_SEND_BLUE_SCREEN_DATA, *PHEADLESS_CMD_SEND_BLUE_SCREEN_DATA;
  224. //
  225. // Headless routines
  226. //
  227. VOID
  228. HeadlessInit(
  229. IN PLOADER_PARAMETER_BLOCK LoaderBlock
  230. );
  231. NTSTATUS
  232. HeadlessTerminalAddResources(
  233. PCM_RESOURCE_LIST Resources,
  234. ULONG ResourceListSize,
  235. BOOLEAN TranslatedList,
  236. PCM_RESOURCE_LIST *NewList,
  237. PULONG NewListSize
  238. );
  239. VOID
  240. HeadlessKernelAddLogEntry(
  241. IN ULONG StringCode,
  242. IN PUNICODE_STRING DriverName OPTIONAL
  243. );
  244. NTSTATUS
  245. HeadlessDispatch(
  246. IN HEADLESS_CMD Command,
  247. IN PVOID InputBuffer OPTIONAL,
  248. IN SIZE_T InputBufferSize OPTIONAL,
  249. OUT PVOID OutputBuffer OPTIONAL,
  250. OUT PSIZE_T OutputBufferSize OPTIONAL
  251. );
  252. #endif // _HDLSTERM_