ReactOS  0.4.14-dev-57-g333b8f1
hdlsterm.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for hdlsterm.c:

Go to the source code of this file.

Functions

FORCEINLINE KIRQL HdlspAcquireGlobalLock (VOID)
 
FORCEINLINE VOID HdlspReleaseGlobalLock (IN KIRQL OldIrql)
 
VOID NTAPI HdlspSendStringAtBaud (IN PUCHAR String)
 
VOID NTAPI HdlspPutData (IN PUCHAR Data, IN ULONG DataSize)
 
VOID NTAPI HdlspPutString (IN PUCHAR String)
 
NTSTATUS NTAPI HdlspEnableTerminal (IN BOOLEAN Enable)
 
INIT_FUNCTION VOID NTAPI HeadlessInit (IN PLOADER_PARAMETER_BLOCK LoaderBlock)
 
NTSTATUS NTAPI HdlspDispatch (IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
 
NTSTATUS NTAPI HeadlessDispatch (IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
 

Variables

PHEADLESS_GLOBALS HeadlessGlobals
 

Function Documentation

◆ HdlspAcquireGlobalLock()

FORCEINLINE KIRQL HdlspAcquireGlobalLock ( VOID  )

Definition at line 22 of file hdlsterm.c.

23 {
24  KIRQL OldIrql;
25 
26  /* Don't acquire the lock if we are bugchecking */
28  {
30  }
31  else
32  {
33  OldIrql = 0xFF;
34  }
35 
36  return OldIrql;
37 }
ULONG InBugCheck
Definition: hdl.h:97
UCHAR KIRQL
Definition: env_spec_w32.h:591
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
KSPIN_LOCK SpinLock
Definition: hdl.h:86
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803

Referenced by HdlspDispatch().

◆ HdlspDispatch()

NTSTATUS NTAPI HdlspDispatch ( IN HEADLESS_CMD  Command,
IN PVOID  InputBuffer,
IN SIZE_T  InputBufferSize,
OUT PVOID  OutputBuffer,
OUT PSIZE_T  OutputBufferSize 
)

Definition at line 250 of file hdlsterm.c.

255 {
256  KIRQL OldIrql;
258  PHEADLESS_RSP_QUERY_INFO HeadlessInfo;
259  PHEADLESS_CMD_PUT_STRING PutString;
260  PHEADLESS_CMD_ENABLE_TERMINAL EnableTerminal;
261  PHEADLESS_CMD_SET_COLOR SetColor;
263  PHEADLESS_RSP_GET_BYTE GetByte;
264  UCHAR DataBuffer[80];
265 
267  // ASSERT(HeadlessGlobals->PageLockHandle != NULL);
268 
269  /* Ignore non-reentrant commands */
270  if ((Command != HeadlessCmdAddLogEntry) &&
274  {
276 
278  {
280  return STATUS_UNSUCCESSFUL;
281  }
282 
283  /* Don't allow these commands next time */
286  }
287 
288  /* Handle each command */
289  switch (Command)
290  {
292  {
293  /* Make sure the caller passed valid data */
294  if (!(InputBuffer) ||
295  (InputBufferSize != sizeof(*EnableTerminal)))
296  {
297  DPRINT1("Invalid buffer\n");
299  break;
300  }
301 
302  /* Go and enable it */
303  EnableTerminal = InputBuffer;
304  Status = HdlspEnableTerminal(EnableTerminal->Enable);
305  break;
306  }
307 
309  break;
310 
312  {
313  /* Validate the existence of an input buffer */
314  if (!InputBuffer)
315  {
317  break;
318  }
319 
320  /* Terminal should be on */
322  {
323  /* Print each byte in the string making sure VT100 chars are used */
324  PutString = InputBuffer;
325  HdlspPutString(PutString->String);
326  }
327 
328  /* Return success either way */
330  break;
331  }
332 
338  case HeadlessCmdSetColor:
340  {
341  /* By default return success */
343 
344  /* Send the VT100 commands only if the terminal is enabled */
346  {
347  PUCHAR CommandStr = NULL;
348 
350  CommandStr = (PUCHAR)"\x1B[2J";
352  CommandStr = (PUCHAR)"\x1B[0J";
354  CommandStr = (PUCHAR)"\x1B[0K";
356  CommandStr = (PUCHAR)"\x1B[0m";
358  CommandStr = (PUCHAR)"\x1B[7m";
359  else if (Command == HeadlessCmdSetColor)
360  {
361  /* Make sure the caller passed valid data */
362  if (!InputBuffer ||
363  (InputBufferSize != sizeof(*SetColor)))
364  {
365  DPRINT1("Invalid buffer\n");
367  break;
368  }
369 
370  SetColor = InputBuffer;
371  Status = RtlStringCbPrintfA((PCHAR)DataBuffer, sizeof(DataBuffer),
372  "\x1B[%d;%dm",
373  SetColor->BkgdColor,
374  SetColor->TextColor);
375  if (!NT_SUCCESS(Status)) break;
376 
377  CommandStr = DataBuffer;
378  }
379  else // if (Command == HeadlessCmdPositionCursor)
380  {
381  /* Make sure the caller passed valid data */
382  if (!InputBuffer ||
383  (InputBufferSize != sizeof(*CursorPos)))
384  {
385  DPRINT1("Invalid buffer\n");
387  break;
388  }
389 
390  CursorPos = InputBuffer;
391  /* Cursor position is 1-based */
392  Status = RtlStringCbPrintfA((PCHAR)DataBuffer, sizeof(DataBuffer),
393  "\x1B[%d;%dH",
394  CursorPos->CursorRow + 1,
395  CursorPos->CursorCol + 1);
396  if (!NT_SUCCESS(Status)) break;
397 
398  CommandStr = DataBuffer;
399  }
400 
401  /* Send the command */
402  HdlspSendStringAtBaud(CommandStr);
403  }
404 
405  break;
406  }
407 
409  break;
410 
411  case HeadlessCmdGetByte:
412  {
413  /* Make sure the caller passed valid data */
414  if (!(OutputBuffer) ||
415  !(OutputBufferSize) ||
416  (*OutputBufferSize < sizeof(*GetByte)))
417  {
418  DPRINT1("Invalid buffer\n");
420  break;
421  }
422 
423  /* Make sure the terminal is enabled */
424  GetByte = OutputBuffer;
426  {
427  /* Poll if something is on the wire */
429  {
430  /* If so, read it */
432  &GetByte->Value);
433  }
434  else
435  {
436  /* Nothing is there, return 0 */
437  GetByte->Value = 0;
438  }
439  }
440  else
441  {
442  /* Otherwise return nothing */
443  GetByte->Value = 0;
444  }
445 
446  /* Return success either way */
448  break;
449  }
450 
451  case HeadlessCmdGetLine:
452  break;
454  break;
456  break;
457 
459  {
460  /* Make sure the caller passed valid data */
461  if (!(OutputBuffer) ||
462  !(OutputBufferSize) ||
463  (*OutputBufferSize < sizeof(*HeadlessInfo)))
464  {
465  DPRINT1("Invalid buffer\n");
467  break;
468  }
469 
470  /* If we got here, headless is enabled -- we know this much */
471  HeadlessInfo = OutputBuffer;
472  HeadlessInfo->PortType = HeadlessSerialPort;
473  HeadlessInfo->Serial.TerminalAttached = TRUE;
474  HeadlessInfo->Serial.UsedBiosSettings = HeadlessGlobals->UsedBiosSettings != 0;
475  HeadlessInfo->Serial.TerminalBaudRate = HeadlessGlobals->TerminalBaudRate;
476  HeadlessInfo->Serial.TerminalType = HeadlessGlobals->TerminalType;
477 
478  /* Now check on what port/baud it's enabled on */
479  if ((HeadlessGlobals->TerminalPortNumber >= 1) ||
481  {
482  /* Get the EMS information */
483  HeadlessInfo->Serial.TerminalPort = HeadlessGlobals->
484  TerminalPortNumber;
485  HeadlessInfo->Serial.TerminalPortBaseAddress = HeadlessGlobals->
486  TerminalPortAddress;
487  }
488  else
489  {
490  /* We don't know for sure */
491  HeadlessInfo->Serial.TerminalPort = SerialPortUndefined;
492  HeadlessInfo->Serial.TerminalPortBaseAddress = 0;
493  }
494 
495  /* All done */
497  break;
498  }
499 
501  break;
503  break;
504 
506  {
507  /* Validate the existence of an input buffer */
508  if (!InputBuffer)
509  {
511  break;
512  }
513 
514  /* Lie so that we can get Hdl bringup a little bit further */
517  break;
518  }
519 
521  break;
523  break;
524 
525  case HeadlessCmdPutData:
526  {
527  /* Validate the existence of an input buffer */
528  if (!(InputBuffer) || !(InputBufferSize))
529  {
531  break;
532  }
533 
534  /* Terminal should be on */
536  {
537  /* Print each byte in the string making sure VT100 chars are used */
538  PutString = InputBuffer;
539  HdlspPutData(PutString->String, InputBufferSize);
540  }
541 
542  /* Return success either way */
544  break;
545  }
546 
547  default:
548  break;
549  }
550 
551  /* Unset processing state */
552  if ((Command != HeadlessCmdAddLogEntry) &&
556  {
559  }
560 
561  /* All done */
562  return Status;
563 }
signed char * PCHAR
Definition: retypes.h:7
#define TRUE
Definition: types.h:120
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
unsigned char * PUCHAR
Definition: retypes.h:3
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI HdlspSendStringAtBaud(IN PUCHAR String)
Definition: hdlsterm.c:56
BOOLEAN NTAPI InbvPortGetByte(IN ULONG PortId, OUT PUCHAR Byte)
Definition: inbvport.c:38
Definition: shell.h:41
CHAR InputBuffer[80]
Definition: conmgr.c:33
UCHAR KIRQL
Definition: env_spec_w32.h:591
FORCEINLINE KIRQL HdlspAcquireGlobalLock(VOID)
Definition: hdlsterm.c:22
UCHAR TerminalType
Definition: hdl.h:115
ULONG TerminalPortNumber
Definition: hdl.h:105
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI HdlspEnableTerminal(IN BOOLEAN Enable)
Definition: hdlsterm.c:148
ULONG ProcessingCmd
Definition: hdl.h:102
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
ULONG TerminalPort
Definition: hdl.h:111
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
ULONG TerminalEnabled
Definition: hdl.h:96
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
HEADLESS_TERM_PORT_TYPE PortType
Definition: hdl.h:170
unsigned char UCHAR
Definition: xmlstorage.h:181
VOID NTAPI HdlspPutString(IN PUCHAR String)
Definition: hdlsterm.c:79
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
ULONG TerminalBaudRate
Definition: hdl.h:110
Status
Definition: gdiplustypes.h:24
struct _HEADLESS_RSP_QUERY_INFO::@1712::@1714 Serial
ULONG UsedBiosSettings
Definition: hdl.h:99
#define DPRINT1
Definition: precomp.h:8
#define UNIMPLEMENTED
Definition: debug.h:114
BOOLEAN NTAPI InbvPortPollOnly(IN ULONG PortId)
Definition: inbvport.c:28
return STATUS_SUCCESS
Definition: btrfs.c:2966
FORCEINLINE VOID HdlspReleaseGlobalLock(IN KIRQL OldIrql)
Definition: hdlsterm.c:41
VOID NTAPI HdlspPutData(IN PUCHAR Data, IN ULONG DataSize)
Definition: hdlsterm.c:67

Referenced by HeadlessDispatch().

◆ HdlspEnableTerminal()

NTSTATUS NTAPI HdlspEnableTerminal ( IN BOOLEAN  Enable)

Definition at line 148 of file hdlsterm.c.

149 {
150  /* Enable if requested, as long as this isn't a PCI serial port crashing */
151  if ((Enable) &&
154  {
155  /* Initialize the COM port with cportlib */
162  {
163  DPRINT1("Failed to initialize port through cportlib\n");
164  return STATUS_UNSUCCESSFUL;
165  }
166 
167  /* Cleanup the screen and reset the cursor */
168  HdlspSendStringAtBaud((PUCHAR)"\x1B[2J");
169  HdlspSendStringAtBaud((PUCHAR)"\x1B[H");
170 
171  /* Enable FIFO */
173  }
174  else if (!Enable)
175  {
176  /* Specific case when headless is being disabled */
180  }
181 
182  /* All done */
183  return STATUS_SUCCESS;
184 }
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
_In_ ULONGLONG _In_ ULONGLONG _In_ BOOLEAN Enable
Definition: ntddpcm.h:140
VOID NTAPI HdlspSendStringAtBaud(IN PUCHAR String)
Definition: hdlsterm.c:56
ULONG InBugCheck
Definition: hdl.h:97
VOID NTAPI InbvPortEnableFifo(IN ULONG PortId, IN BOOLEAN Enable)
Definition: inbvport.c:56
ULONG TerminalPortNumber
Definition: hdl.h:105
ULONG TerminalPort
Definition: hdl.h:111
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
ULONG TerminalEnabled
Definition: hdl.h:96
BOOLEAN NTAPI InbvPortInitialize(IN ULONG BaudRate, IN ULONG PortNumber, IN PUCHAR PortAddress, OUT PULONG PortId, IN BOOLEAN IsMMIODevice)
Definition: inbvport.c:73
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
PUCHAR TerminalPortAddress
Definition: hdl.h:112
ULONG TerminalBaudRate
Definition: hdl.h:110
VOID NTAPI InbvPortTerminate(IN ULONG PortId)
Definition: inbvport.c:65
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966
BOOLEAN IsMMIODevice
Definition: hdl.h:120

Referenced by HdlspDispatch(), and HeadlessInit().

◆ HdlspPutData()

VOID NTAPI HdlspPutData ( IN PUCHAR  Data,
IN ULONG  DataSize 
)

Definition at line 67 of file hdlsterm.c.

69 {
70  ULONG i;
71  for (i = 0; i < DataSize; i++)
72  {
74  }
75 }
VOID NTAPI InbvPortPutByte(IN ULONG PortId, IN UCHAR Byte)
Definition: inbvport.c:47
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG TerminalPort
Definition: hdl.h:111
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
unsigned int ULONG
Definition: retypes.h:1
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751

Referenced by HdlspDispatch().

◆ HdlspPutString()

VOID NTAPI HdlspPutString ( IN PUCHAR  String)

Definition at line 79 of file hdlsterm.c.

80 {
82  UCHAR Char = 0;
83 
84  /* Scan each character */
85  while (*String != ANSI_NULL)
86  {
87  /* Check for rotate, send existing buffer and restart from where we are */
88  if (Dest >= &HeadlessGlobals->TmpBuffer[79])
89  {
92  Dest = HeadlessGlobals->TmpBuffer;
93  }
94  else
95  {
96  /* Get the current character and check for special graphical chars */
97  Char = *String;
98  if (Char & 0x80)
99  {
100  switch (Char)
101  {
102  case 0xB0: case 0xB3: case 0xBA:
103  Char = '|';
104  break;
105  case 0xB1: case 0xDC: case 0xDD: case 0xDE: case 0xDF:
106  Char = '%';
107  break;
108  case 0xB2: case 0xDB:
109  Char = '#';
110  break;
111  case 0xA9: case 0xAA: case 0xBB: case 0xBC: case 0xBF:
112  case 0xC0: case 0xC8: case 0xC9: case 0xD9: case 0xDA:
113  Char = '+';
114  break;
115  case 0xC4:
116  Char = '-';
117  break;
118  case 0xCD:
119  Char = '=';
120  break;
121  }
122  }
123 
124  /* Anything else must be Unicode */
125  if (Char & 0x80)
126  {
127  /* Can't do Unicode yet */
129  }
130  else
131  {
132  /* Add the modified char to the temporary buffer */
133  *Dest++ = Char;
134  }
135 
136  /* Check the next char */
137  String++;
138  }
139  }
140 
141  /* Finish and send */
142  *Dest = ANSI_NULL;
144 }
unsigned char * PUCHAR
Definition: retypes.h:3
VOID NTAPI HdlspSendStringAtBaud(IN PUCHAR String)
Definition: hdlsterm.c:56
static WCHAR String[]
Definition: stringtable.c:55
PUCHAR TmpBuffer
Definition: hdl.h:89
#define ANSI_NULL
char Char
Definition: bzip2.c:161
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
unsigned char UCHAR
Definition: xmlstorage.h:181
#define UNIMPLEMENTED
Definition: debug.h:114

Referenced by HdlspDispatch().

◆ HdlspReleaseGlobalLock()

FORCEINLINE VOID HdlspReleaseGlobalLock ( IN KIRQL  OldIrql)

Definition at line 41 of file hdlsterm.c.

42 {
43  /* Only release the lock if we aren't bugchecking */
44  if (OldIrql != 0xFF)
45  {
47  }
48  else
49  {
51  }
52 }
#define TRUE
Definition: types.h:120
ULONG InBugCheck
Definition: hdl.h:97
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
KSPIN_LOCK SpinLock
Definition: hdl.h:86
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627

Referenced by HdlspDispatch().

◆ HdlspSendStringAtBaud()

VOID NTAPI HdlspSendStringAtBaud ( IN PUCHAR  String)

Definition at line 56 of file hdlsterm.c.

57 {
58  /* Send every byte */
59  while (*String != ANSI_NULL)
60  {
62  }
63 }
VOID NTAPI InbvPortPutByte(IN ULONG PortId, IN UCHAR Byte)
Definition: inbvport.c:47
static WCHAR String[]
Definition: stringtable.c:55
#define ANSI_NULL
ULONG TerminalPort
Definition: hdl.h:111
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16

Referenced by HdlspDispatch(), HdlspEnableTerminal(), and HdlspPutString().

◆ HeadlessDispatch()

NTSTATUS NTAPI HeadlessDispatch ( IN HEADLESS_CMD  Command,
IN PVOID  InputBuffer,
IN SIZE_T  InputBufferSize,
OUT PVOID  OutputBuffer,
OUT PSIZE_T  OutputBufferSize 
)

Definition at line 570 of file hdlsterm.c.

575 {
576  /* Check for stubs that will expect something even with headless off */
577  if (!HeadlessGlobals)
578  {
579  /* Don't allow the SAC to connect */
581 
582  /* Send bogus reply */
588  {
589  if (!(OutputBuffer) || !(OutputBufferSize))
590  {
592  }
593 
594  RtlZeroMemory(OutputBuffer, *OutputBufferSize);
595  }
596 
597  return STATUS_SUCCESS;
598  }
599 
600  /* Do the real work */
601  return HdlspDispatch(Command,
602  InputBuffer,
603  InputBufferSize,
604  OutputBuffer,
605  OutputBufferSize);
606 }
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
Definition: shell.h:41
CHAR InputBuffer[80]
Definition: conmgr.c:33
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
NTSTATUS NTAPI HdlspDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:250
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by ConMgrInitialize(), ConMgrProcessInputLine(), ConMgrWriteData(), DriverEntry(), InbvDisplayString(), InbvSetTextColor(), InbvSolidColorFill(), InitializeDeviceData(), InitializeMachineInformation(), RegisterBlueScreenMachineInformation(), TimerDpcRoutine(), and UTF8EncodeAndSend().

◆ HeadlessInit()

INIT_FUNCTION VOID NTAPI HeadlessInit ( IN PLOADER_PARAMETER_BLOCK  LoaderBlock)

Definition at line 189 of file hdlsterm.c.

190 {
191  PHEADLESS_LOADER_BLOCK HeadlessBlock;
192 
193  /* Only initialize further if the loader found EMS enabled */
194  HeadlessBlock = LoaderBlock->Extension->HeadlessLoaderBlock;
195  if (!HeadlessBlock) return;
196 
197  /* Ignore invalid EMS settings */
198  if ((HeadlessBlock->PortNumber > 4) && (HeadlessBlock->UsedBiosSettings)) return;
199 
200  /* Allocate the global headless data */
202  sizeof(*HeadlessGlobals),
203  'sldH');
204  if (!HeadlessGlobals) return;
205 
206  /* Zero and copy loader data */
210  HeadlessGlobals->TerminalBaudRate = HeadlessBlock->BaudRate;
211  HeadlessGlobals->TerminalParity = HeadlessBlock->Parity;
212  HeadlessGlobals->TerminalStopBits = HeadlessBlock->StopBits;
214  HeadlessGlobals->IsMMIODevice = HeadlessBlock->IsMMIODevice;
215  HeadlessGlobals->TerminalType = HeadlessBlock->TerminalType;
216  HeadlessGlobals->SystemGUID = HeadlessBlock->SystemGUID;
217  DPRINT1("EMS on Port %lu (0x%p) at %lu bps\n",
221 
222  /* These two are opposites of each other */
224 
225  /* Check for a PCI device, warn that this isn't supported */
226  if (HeadlessBlock->PciDeviceId != PCI_INVALID_VENDORID)
227  {
228  DPRINT1("PCI Serial Ports not supported\n");
229  }
230 
231  /* Log entries are not yet supported */
232  DPRINT1("FIXME: No Headless logging support\n");
233 
234  /* Allocate temporary buffer */
236  if (!HeadlessGlobals->TmpBuffer) return;
237 
238  /* Windows seems to apply some special hacks for 9600 bps */
239  if (HeadlessGlobals->TerminalBaudRate == 9600)
240  {
241  DPRINT1("Please use other baud rate than 9600bps for now\n");
242  }
243 
244  /* Enable the terminal */
246 }
#define TRUE
Definition: types.h:120
UCHAR UsedBiosSettings
Definition: arc.h:306
ULONG TerminalParity
Definition: hdl.h:103
PUCHAR TmpBuffer
Definition: hdl.h:89
PUCHAR PortAddress
Definition: arc.h:312
UCHAR TerminalType
Definition: hdl.h:115
GUID SystemGUID
Definition: hdl.h:119
ULONG TerminalStopBits
Definition: hdl.h:104
ULONG TerminalPortNumber
Definition: hdl.h:105
NTSTATUS NTAPI HdlspEnableTerminal(IN BOOLEAN Enable)
Definition: hdlsterm.c:148
UCHAR TerminalType
Definition: arc.h:321
PHEADLESS_GLOBALS HeadlessGlobals
Definition: hdlsterm.c:16
#define PCI_INVALID_VENDORID
Definition: iotypes.h:3245
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
USHORT PciDeviceId
Definition: arc.h:313
PUCHAR TerminalPortAddress
Definition: hdl.h:112
ULONG TerminalBaudRate
Definition: hdl.h:110
ULONG IsNonLegacyDevice
Definition: hdl.h:106
ULONG UsedBiosSettings
Definition: hdl.h:99
#define DPRINT1
Definition: precomp.h:8
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
BOOLEAN IsMMIODevice
Definition: hdl.h:120
UCHAR IsMMIODevice
Definition: arc.h:320

Referenced by ExpInitializeExecutive().

Variable Documentation

◆ HeadlessGlobals