ReactOS  0.4.13-dev-92-gf251225
conmgr.c File Reference
#include "sacdrv.h"
#include <initguid.h>
Include dependency graph for conmgr.c:

Go to the source code of this file.

Functions

 DEFINE_GUID (PRIMARY_SAC_CHANNEL_APPLICATION_GUID, 0x63D02270, 0x8AA4, 0x11D5, 0xBC, 0xCF, 0x80, 0x6D, 0x61, 0x72, 0x69, 0x6F)
 
VOID NTAPI SacPutString (IN PWCHAR String)
 
BOOLEAN NTAPI SacPutSimpleMessage (IN ULONG MessageIndex)
 
NTSTATUS NTAPI ConMgrDisplayCurrentChannel (VOID)
 
NTSTATUS NTAPI ConMgrWriteData (IN PSAC_CHANNEL Channel, IN PVOID Buffer, IN ULONG BufferLength)
 
NTSTATUS NTAPI ConMgrFlushData (IN PSAC_CHANNEL Channel)
 
BOOLEAN NTAPI ConMgrIsSacChannel (IN PSAC_CHANNEL Channel)
 
BOOLEAN NTAPI ConMgrIsWriteEnabled (IN PSAC_CHANNEL Channel)
 
NTSTATUS NTAPI ConMgrInitialize (VOID)
 
VOID NTAPI ConMgrEventMessage (IN PWCHAR EventMessage, IN BOOLEAN LockHeld)
 
BOOLEAN NTAPI ConMgrSimpleEventMessage (IN ULONG MessageIndex, IN BOOLEAN LockHeld)
 
NTSTATUS NTAPI ConMgrDisplayFastChannelSwitchingInterface (IN PSAC_CHANNEL Channel)
 
NTSTATUS NTAPI ConMgrSetCurrentChannel (IN PSAC_CHANNEL Channel)
 
NTSTATUS NTAPI ConMgrResetCurrentChannel (IN BOOLEAN KeepChannel)
 
NTSTATUS NTAPI ConMgrChannelClose (IN PSAC_CHANNEL Channel)
 
NTSTATUS NTAPI ConMgrShutdown (VOID)
 
NTSTATUS NTAPI ConMgrAdvanceCurrentChannel (VOID)
 
NTSTATUS NTAPI ConMgrChannelOWrite (IN PSAC_CHANNEL Channel, IN PVOID WriteBuffer)
 
VOID NTAPI ConMgrProcessInputLine (VOID)
 
VOID NTAPI ConMgrSerialPortConsumer (VOID)
 
VOID NTAPI ConMgrWorkerProcessEvents (IN PSAC_DEVICE_EXTENSION DeviceExtension)
 
NTSTATUS NTAPI ConMgrGetChannelCloseMessage (IN PSAC_CHANNEL Channel, IN NTSTATUS CloseStatus, OUT PWCHAR OutputBuffer)
 
NTSTATUS NTAPI ConMgrHandleEvent (IN ULONG EventCode, IN PSAC_CHANNEL Channel, OUT PVOID Data)
 

Variables

LONG CurrentChannelRefCount
 
KMUTEX CurrentChannelLock
 
PSAC_CHANNEL CurrentChannel
 
PSAC_CHANNEL SacChannel
 
ULONG ExecutePostConsumerCommand
 
PSAC_CHANNEL ExecutePostConsumerCommandData
 
BOOLEAN InputInEscape
 
BOOLEAN InputInEscTab
 
BOOLEAN ConMgrLastCharWasCR
 
CHAR InputBuffer [80]
 
BOOLEAN GlobalPagingNeeded
 
BOOLEAN GlobalDoThreads
 

Function Documentation

◆ ConMgrAdvanceCurrentChannel()

NTSTATUS NTAPI ConMgrAdvanceCurrentChannel ( VOID  )

Definition at line 410 of file conmgr.c.

411 {
413  ULONG Index;
414  PSAC_CHANNEL Channel;
415 
416  /* Should always be called with the lock held */
418 
419  /* Get the next active channel */
421  if (NT_SUCCESS(Status))
422  {
423  /* Set it as the new channel */
424  Status = ConMgrSetCurrentChannel(Channel);
425  if (NT_SUCCESS(Status))
426  {
427  /* Let the user switch to it */
429  }
430  }
431 
432  /* All done */
433  return Status;
434 }
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
NTSTATUS NTAPI ChanMgrGetNextActiveChannel(IN PSAC_CHANNEL CurrentChannel, IN PULONG TargetIndex, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:521
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static const UCHAR Index[8]
Definition: usbohci.c:18
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConMgrDisplayFastChannelSwitchingInterface(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:278
NTSTATUS NTAPI ConMgrSetCurrentChannel(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:287
unsigned int ULONG
Definition: retypes.h:1

Referenced by ConMgrSerialPortConsumer().

◆ ConMgrChannelClose()

NTSTATUS NTAPI ConMgrChannelClose ( IN PSAC_CHANNEL  Channel)

Definition at line 354 of file conmgr.c.

355 {
357 
358  /* Check if we're in the right channel */
359  if (ConMgrIsWriteEnabled(Channel))
360  {
361  /* Yep, reset it */
364  }
365 
366  /* All done */
367  return Status;
368 }
BOOLEAN NTAPI ConMgrIsWriteEnabled(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:155
NTSTATUS NTAPI ConMgrResetCurrentChannel(IN BOOLEAN KeepChannel)
Definition: conmgr.c:317
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2725

◆ ConMgrChannelOWrite()

NTSTATUS NTAPI ConMgrChannelOWrite ( IN PSAC_CHANNEL  Channel,
IN PVOID  WriteBuffer 
)

Definition at line 438 of file conmgr.c.

440 {
442 
443  /* Do the write with the lock held */
445  ASSERT(FALSE);
446  Status = STATUS_NOT_IMPLEMENTED;// ChannelOWrite(Channel, WriteBuffer + 24, *(WriteBuffer + 20));
448 
449  /* Return back to the caller */
451  return Status;
452 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
LONG NTSTATUS
Definition: precomp.h:26
#define STATUS_NOT_FOUND
Definition: shellext.h:67
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Status
Definition: gdiplustypes.h:24

◆ ConMgrDisplayCurrentChannel()

NTSTATUS NTAPI ConMgrDisplayCurrentChannel ( VOID  )

Definition at line 81 of file conmgr.c.

82 {
84  BOOLEAN HasRedraw;
85 
86  /* Make sure the lock is held */
88 
89  /* Check if we can redraw */
91  if (NT_SUCCESS(Status))
92  {
93  /* Enable writes */
95  if (HasRedraw)
96  {
97  /* If we can redraw, set the event */
99  }
100 
101  /* Flush the output */
103  }
104 
105  /* All done, return the status */
106  return Status;
107 }
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ChannelHasRedrawEvent(IN PSAC_CHANNEL Channel, OUT PBOOLEAN Present)
Definition: channel.c:209
NTSTATUS NTAPI ChannelSetRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:176
unsigned char BOOLEAN
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: channel.c:103
Status
Definition: gdiplustypes.h:24
LONG WriteEnabled
Definition: sacdrv.h:446

Referenced by ConMgrInitialize(), ConMgrResetCurrentChannel(), and ConMgrSerialPortConsumer().

◆ ConMgrDisplayFastChannelSwitchingInterface()

NTSTATUS NTAPI ConMgrDisplayFastChannelSwitchingInterface ( IN PSAC_CHANNEL  Channel)

Definition at line 278 of file conmgr.c.

279 {
280  /* FIXME: TODO */
281  ASSERT(FALSE);
282  return STATUS_NOT_IMPLEMENTED;
283 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by ConMgrAdvanceCurrentChannel(), and ConMgrResetCurrentChannel().

◆ ConMgrEventMessage()

VOID NTAPI ConMgrEventMessage ( IN PWCHAR  EventMessage,
IN BOOLEAN  LockHeld 
)

Definition at line 235 of file conmgr.c.

237 {
238  /* Acquire the current channel lock if needed */
239  if (!LockHeld) SacAcquireMutexLock();
240 
241  /* Send out the event message */
243  SacPutString(EventMessage);
245 
246  /* Release the current channel lock if needed */
247  if (!LockHeld) SacReleaseMutexLock();
248 }
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57

Referenced by ConMgrSimpleEventMessage().

◆ ConMgrFlushData()

NTSTATUS NTAPI ConMgrFlushData ( IN PSAC_CHANNEL  Channel)

Definition at line 139 of file conmgr.c.

140 {
141  /* Nothing to do */
142  return STATUS_SUCCESS;
143 }
return STATUS_SUCCESS
Definition: btrfs.c:2725

Referenced by RawChannelOEcho(), RawChannelOFlush(), VTUTF8ChannelAnsiDispatch(), VTUTF8ChannelOEcho(), and VTUTF8ChannelOFlush().

◆ ConMgrGetChannelCloseMessage()

NTSTATUS NTAPI ConMgrGetChannelCloseMessage ( IN PSAC_CHANNEL  Channel,
IN NTSTATUS  CloseStatus,
OUT PWCHAR  OutputBuffer 
)

Definition at line 878 of file conmgr.c.

881 {
882  ASSERT(FALSE);
883  return STATUS_NOT_IMPLEMENTED;
884 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

◆ ConMgrHandleEvent()

NTSTATUS NTAPI ConMgrHandleEvent ( IN ULONG  EventCode,
IN PSAC_CHANNEL  Channel,
OUT PVOID  Data 
)

Definition at line 888 of file conmgr.c.

891 {
892  ASSERT(FALSE);
893  return STATUS_NOT_IMPLEMENTED;
894 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)

Referenced by ChanMgrCloseChannel().

◆ ConMgrInitialize()

NTSTATUS NTAPI ConMgrInitialize ( VOID  )

Definition at line 163 of file conmgr.c.

164 {
165  PWCHAR pcwch;
166  PSAC_CHANNEL FoundChannel;
167  SAC_CHANNEL_ATTRIBUTES SacChannelAttributes;
169 
170  /* Initialize the connection manager lock */
173 
174  /* Setup the attributes for the raw SAC channel */
175  RtlZeroMemory(&SacChannelAttributes, sizeof(SacChannelAttributes));
176  SacChannelAttributes.ChannelType = VtUtf8;
177 
178  /* Get the right name for it */
179  pcwch = GetMessage(SAC_CHANNEL_NAME);
180  ASSERT(pcwch);
181  wcsncpy(SacChannelAttributes.NameBuffer, pcwch, SAC_CHANNEL_NAME_SIZE);
182  SacChannelAttributes.NameBuffer[SAC_CHANNEL_NAME_SIZE] = ANSI_NULL;
183 
184  /* Get the right description for it */
185  pcwch = GetMessage(SAC_CHANNEL_DESCRIPTION);
186  ASSERT(pcwch);
187  wcsncpy(SacChannelAttributes.DescriptionBuffer, pcwch, SAC_CHANNEL_DESCRIPTION_SIZE);
189 
190  /* Set all the right flags */
192  SacChannelAttributes.CloseEvent = NULL;
193  SacChannelAttributes.HasNewDataEvent = NULL;
194  SacChannelAttributes.LockEvent = NULL;
195  SacChannelAttributes.RedrawEvent = NULL;
196  SacChannelAttributes.ChannelId = PRIMARY_SAC_CHANNEL_APPLICATION_GUID;
197 
198  /* Now create it */
199  Status = ChanMgrCreateChannel(&SacChannel, &SacChannelAttributes);
200  if (NT_SUCCESS(Status))
201  {
202  /* Try to get it back */
203  Status = ChanMgrGetByHandle(SacChannel->ChannelId, &FoundChannel);
204  if (NT_SUCCESS(Status))
205  {
206  /* Set it as the current and SAC channel */
207  SacChannel = CurrentChannel = FoundChannel;
208 
209  /* Disable writes for now and clear the display */
210  _InterlockedExchange(&FoundChannel->WriteEnabled, FALSE);
212  if (!NT_SUCCESS(Status))
213  {
214  SAC_DBG(SAC_DBG_INIT, "SAC ConMgrInitialize: Failed dispatch\n");
215  }
216 
217  /* Display the initial prompt */
218  SacPutSimpleMessage(SAC_NEWLINE);
219  SacPutSimpleMessage(SAC_INIT_STATUS);
220  SacPutSimpleMessage(SAC_NEWLINE);
221  SacPutSimpleMessage(SAC_PROMPT);
222 
223  /* Display the current channel */
225  }
226  }
227 
228  /* Release the channel lock */
230  return STATUS_SUCCESS;
231 }
#define SAC_CHANNEL_FLAG_INTERNAL
Definition: sacdrv.h:168
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27
Definition: sacdrv.h:276
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:479
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
LONG NTSTATUS
Definition: precomp.h:26
uint16_t * PWCHAR
Definition: typedefs.h:54
#define SAC_CHANNEL_DESCRIPTION_SIZE
Definition: sacdrv.h:152
WCHAR NameBuffer[SAC_CHANNEL_NAME_SIZE+1]
Definition: sacdrv.h:478
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
SAC_CHANNEL_TYPE ChannelType
Definition: sacdrv.h:477
#define ANSI_NULL
smooth NULL
Definition: ftsmooth.c:416
NTSTATUS NTAPI ChanMgrCreateChannel(OUT PSAC_CHANNEL *Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes)
Definition: chanmgr.c:345
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
#define SAC_CHANNEL_FLAG_APPLICATION
Definition: sacdrv.h:173
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define SAC_DBG_INIT
Definition: sacdrv.h:34
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
Status
Definition: gdiplustypes.h:24
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
#define GetMessage
Definition: winuser.h:5656
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI ChanMgrGetByHandle(IN SAC_CHANNEL_ID ChannelId, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:202
return STATUS_SUCCESS
Definition: btrfs.c:2725
FORCEINLINE VOID SacInitializeMutexLock(VOID)
Definition: sacdrv.h:1296
#define SAC_CHANNEL_NAME_SIZE
Definition: sacdrv.h:151
NTSTATUS NTAPI ConMgrDisplayCurrentChannel(VOID)
Definition: conmgr.c:81
LONG WriteEnabled
Definition: sacdrv.h:446
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:426

Referenced by InitializeDeviceData().

◆ ConMgrIsSacChannel()

BOOLEAN NTAPI ConMgrIsSacChannel ( IN PSAC_CHANNEL  Channel)

Definition at line 147 of file conmgr.c.

148 {
149  /* Check which channel is active */
150  return Channel == SacChannel;
151 }
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27

◆ ConMgrIsWriteEnabled()

BOOLEAN NTAPI ConMgrIsWriteEnabled ( IN PSAC_CHANNEL  Channel)

Definition at line 155 of file conmgr.c.

156 {
157  /* If the current channel is active, allow writes */
158  return ChannelIsEqual(Channel, &CurrentChannel->ChannelId);
159 }
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
BOOLEAN NTAPI ChannelIsEqual(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ID ChannelId)
Definition: channel.c:25
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:426

Referenced by ConMgrChannelClose(), RawChannelOWrite(), and VTUTF8ChannelOWrite().

◆ ConMgrProcessInputLine()

VOID NTAPI ConMgrProcessInputLine ( VOID  )

Definition at line 456 of file conmgr.c.

457 {
458  BOOLEAN EnablePaging;
460 
461  SAC_DBG(SAC_DBG_INIT, "SAC Input Test: %s\n", InputBuffer);
462 
463  if (!strncmp(InputBuffer, "t", 1))
464  {
465  DoTlistCommand();
466  }
467  else if (!strncmp(InputBuffer, "?", 1))
468  {
469  DoHelpCommand();
470  }
471  else if (!strncmp(InputBuffer, "help", 4))
472  {
473  DoHelpCommand();
474  }
475  else if (!strncmp(InputBuffer, "f", 1))
476  {
478  }
479  else if (!strncmp(InputBuffer, "p", 1))
480  {
481  DoPagingCommand();
482  }
483  else if (!strncmp(InputBuffer, "id", 2))
484  {
486  }
487  else if (!strncmp(InputBuffer, "crashdump", 9))
488  {
489  DoCrashCommand();
490  }
491  else if (!strncmp(InputBuffer, "lock", 4))
492  {
493  DoLockCommand();
494  }
495  else if (!strncmp(InputBuffer, "shutdown", 8))
496  {
498  }
499  else if (!strncmp(InputBuffer, "restart", 7))
500  {
502  }
503  else if (!strncmp(InputBuffer, "d", 1))
504  {
505  EnablePaging = GlobalPagingNeeded;
507  &EnablePaging,
508  sizeof(EnablePaging),
509  NULL,
510  0);
511  if (!NT_SUCCESS(Status)) SAC_DBG(SAC_DBG_INIT, "SAC Display Log failed.\n");
512  }
513  else if (!strncmp(InputBuffer, "cmd", 3))
514  {
516  {
518  }
519  else
520  {
521  SacPutSimpleMessage(148);
522  }
523  }
524  else if (!(strncmp(InputBuffer, "ch", 2)) &&
525  (((strlen(InputBuffer) > 1) && (InputBuffer[2] == ' ')) ||
526  (strlen(InputBuffer) == 2)))
527  {
529  }
530  else if (!(strncmp(InputBuffer, "k", 1)) &&
531  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
532  (strlen(InputBuffer) == 1)))
533  {
535  }
536  else if (!(strncmp(InputBuffer, "l", 1)) &&
537  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
538  (strlen(InputBuffer) == 1)))
539  {
541  }
542  else if (!(strncmp(InputBuffer, "r", 1)) &&
543  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
544  (strlen(InputBuffer) == 1)))
545  {
547  }
548  else if (!(strncmp(InputBuffer, "m", 1)) &&
549  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
550  (strlen(InputBuffer) == 1)))
551  {
553  }
554  else if (!(strncmp(InputBuffer, "s", 1)) &&
555  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
556  (strlen(InputBuffer) == 1)))
557  {
559  }
560  else if (!(strncmp(InputBuffer, "i", 1)) &&
561  (((strlen(InputBuffer) > 1) && (InputBuffer[1] == ' ')) ||
562  (strlen(InputBuffer) == 1)))
563  {
565  }
566  else if ((InputBuffer[0] != '\n') && (InputBuffer[0] != ANSI_NULL))
567  {
568  SacPutSimpleMessage(SAC_UNKNOWN_COMMAND);
569  }
570 }
VOID NTAPI DoMachineInformationCommand(VOID)
Definition: concmd.c:477
VOID NTAPI DoFullInfoCommand(VOID)
Definition: concmd.c:409
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
VOID NTAPI DoCmdCommand(IN PCHAR InputString)
Definition: concmd.c:491
BOOLEAN GlobalPagingNeeded
Definition: conmgr.c:35
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI DoSetTimeCommand(IN PCHAR InputTime)
Definition: concmd.c:431
VOID NTAPI DoPagingCommand(VOID)
Definition: concmd.c:420
CHAR InputBuffer[80]
Definition: conmgr.c:33
VOID NTAPI DoHelpCommand(VOID)
Definition: concmd.c:529
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
VOID NTAPI DoCrashCommand(VOID)
Definition: concmd.c:466
BOOLEAN CommandConsoleLaunchingEnabled
Definition: data.c:16
#define ANSI_NULL
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
ULONG ExecutePostConsumerCommand
Definition: conmgr.c:29
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
VOID NTAPI DoLowerPriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:445
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
VOID NTAPI DoRaisePriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:452
#define SAC_DBG_INIT
Definition: sacdrv.h:34
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
VOID NTAPI DoChannelCommand(IN PCHAR ChannelString)
Definition: concmd.c:484
VOID NTAPI DoLockCommand(VOID)
Definition: concmd.c:498
Status
Definition: gdiplustypes.h:24
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
VOID NTAPI DoSetIpAddressCommand(IN PCHAR IpString)
Definition: concmd.c:564
VOID NTAPI DoKillCommand(IN PCHAR KillString)
Definition: concmd.c:438
VOID NTAPI DoTlistCommand(VOID)
Definition: concmd.c:571
VOID NTAPI DoLimitMemoryCommand(IN PCHAR LimitString)
Definition: concmd.c:459

Referenced by ConMgrSerialPortConsumer().

◆ ConMgrResetCurrentChannel()

NTSTATUS NTAPI ConMgrResetCurrentChannel ( IN BOOLEAN  KeepChannel)

Definition at line 317 of file conmgr.c.

318 {
320  PSAC_CHANNEL Channel;
321 
322  /* Make sure the lock is held */
324 
325  /* Get the current SAC channel */
327  if (NT_SUCCESS(Status))
328  {
329  /* Set this as the current SAC channel*/
330  SacChannel = Channel;
331  Status = ConMgrSetCurrentChannel(Channel);
332  if (NT_SUCCESS(Status))
333  {
334  /* Check if the caller wants to switch or not */
335  if (KeepChannel)
336  {
337  /* Nope, keep the same channel */
339  }
340  else
341  {
342  /* Yep, show the switching interface */
344  }
345  }
346  }
347 
348  /* All done */
349  return Status;
350 }
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
LONG NTSTATUS
Definition: precomp.h:26
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI ConMgrDisplayFastChannelSwitchingInterface(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:278
NTSTATUS NTAPI ConMgrSetCurrentChannel(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:287
NTSTATUS NTAPI ChanMgrGetByHandle(IN SAC_CHANNEL_ID ChannelId, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:202
NTSTATUS NTAPI ConMgrDisplayCurrentChannel(VOID)
Definition: conmgr.c:81
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:426

Referenced by ConMgrChannelClose(), and ConMgrSerialPortConsumer().

◆ ConMgrSerialPortConsumer()

VOID NTAPI ConMgrSerialPortConsumer ( VOID  )

Definition at line 574 of file conmgr.c.

575 {
577  CHAR Char;
578  WCHAR LastChar;
579  CHAR ReadBuffer[2];
580  ULONG ReadBufferSize, i;
581  WCHAR StringBuffer[2];
582  SAC_DBG(SAC_DBG_MACHINE, "SAC TimerDpcRoutine: Entering.\n"); //bug
583 
584  /* Acquire the manager lock and make sure a channel is selected */
587 
588  /* Read whatever came off the serial port */
592  {
593  /* If nothing came through, bail out */
594  if (Status == STATUS_NO_DATA_DETECTED) break;
595 
596  /* Check if ESC was pressed */
597  if (Char == '\x1B')
598  {
599  /* Was it already pressed? */
600  if (!InputInEscape)
601  {
602  /* First time ESC is pressed! Remember and reset TAB state */
605  continue;
606  }
607  }
608  else if (Char == '\t')
609  {
610  /* TAB was pressed, is it following ESC (VT-100 sequence)? */
611  if (InputInEscape)
612  {
613  /* Yes! This must be the only ESC-TAB we see in once moment */
615 
616  /* No longer treat us as being in ESC */
618 
619  /* ESC-TAB is the sequence for changing channels */
621  if (!NT_SUCCESS(Status)) break;
622 
623  /* Remember ESC-TAB was pressed */
625  continue;
626  }
627  }
628  else if ((Char == '0') && (InputInEscTab))
629  {
630  /* It this ESC-TAB-0? */
633 
634  /* If writes are already enabled, don't do this */
636  {
637  /* Reset the channel, this is our special sequence */
639  if (!NT_SUCCESS(Status)) break;
640  }
641 
642  continue;
643  }
644  else
645  {
646  /* This is ESC-TAB-something else */
648 
649  /* If writes are already enabled, don't do this */
651  {
652  /* Display the current channel */
655  if (!NT_SUCCESS(Status)) break;
656  continue;
657  }
658  }
659 
660  /* Check if an ESC-sequence was being typed into a command channel */
662  {
663  /* Store the ESC in the current channel buffer */
664  ReadBuffer[0] = '\x1B';
666  }
667 
668  /* Check if we are no longer pressing ESC and exit the mode if so */
669  if (Char != '\x1B') InputInEscape = FALSE;
670 
671  /* Whatever was typed in, save it int eh current channel */
673 
674  /* If this is a command channel, we're done, nothing to process */
675  if (CurrentChannel != SacChannel) continue;
676 
677  /* Check for line feed right after a carriage return */
678  if ((ConMgrLastCharWasCR) && (Char == '\n'))
679  {
680  /* Ignore the line feed, but clear the carriage return */
683  continue;
684  }
685 
686  /* Check if the user did a carriage return */
687  ConMgrLastCharWasCR = (Char == '\n');
688 
689  /* If the user did an "ENTER", we need to run the command */
690  if ((Char == '\n') || (Char == '\r'))
691  {
692  /* Echo back to the terminal */
693  SacPutString(L"\r\n");
694 
695 DoLineParsing:
696  /* Inhibit the character (either CR or LF) */
698 
699  /* NULL-terminate the channel's input buffer */
700  ReadBuffer[0] = ANSI_NULL;
702 
703  /* Loop over every last character */
704  do
705  {
706  /* Read every character in the channel, and strip whitespace */
707  LastChar = ChannelIReadLast(CurrentChannel);
708  ReadBuffer[0] = (CHAR) LastChar;
709  } while ((!(LastChar) ||
710  (LastChar == L' ') ||
711  (LastChar == L'\t')) &&
713 
714  /* Write back into the channel the last character */
716 
717  /* NULL-terminate the input buffer */
718  ReadBuffer[0] = ANSI_NULL;
720 
721  /* Now loop over every first character */
722  do
723  {
724  /* Read every character in the channel, and strip whitespace */
726  ReadBuffer,
727  sizeof(ReadBuffer),
728  &ReadBufferSize);
729  } while ((ReadBufferSize) &&
730  ((ReadBuffer[0] == ' ') || (ReadBuffer[0] == '\t')));
731 
732  /* We read one more than we should, so treat that as our first one */
733  InputBuffer[0] = ReadBuffer[0];
734  i = 1;
735 
736  /* And now loop reading all the others */
737  do
738  {
739  /* Read each character -- there should be max 80 */
741  ReadBuffer,
742  sizeof(ReadBuffer),
743  &ReadBufferSize);
745  InputBuffer[i++] = ReadBuffer[0];
746  } while (ReadBufferSize);
747 
748  /* Now go over the entire input stream */
749  for (i = 0; InputBuffer[i]; i++)
750  {
751  /* Again it should be less than 80 characters */
753 
754  /* And downbase each character */
755  Char = InputBuffer[i];
756  if ((Char >= 'A') && (Char <= 'Z')) InputBuffer[i] = Char + ' ';
757  }
758 
759  /* Ok, at this point, no pending command should exist */
761 
762  /* Go and process the input, then show the prompt again */
764  SacPutSimpleMessage(SAC_PROMPT);
765 
766  /* If the user typed a valid command, get out of here */
767  if (ExecutePostConsumerCommand != Nothing) break;
768 
769  /* Keep going */
770  continue;
771  }
772 
773  /* Check if the user typed backspace or delete */
774  if ((Char == '\b') || (Char == '\x7F'))
775  {
776  /* Omit the last character, which should be the DEL/BS itself */
778  {
780  }
781 
782  /* Omit the before-last character, which is the one to delete */
784  {
785  /* Also send two backspaces back to the console */
786  SacPutString(L"\b \b");
788  }
789 
790  /* Keep going */
791  continue;
792  }
793 
794  /* If the user pressed CTRL-C at this point, treat it like ENTER */
795  if (Char == '\x03') goto DoLineParsing;
796 
797  /* Check if the user pressed TAB */
798  if (Char == '\t')
799  {
800  /* Omit it, send a BELL, and keep going. We ignore TABs */
802  SacPutString(L"\a");
803  continue;
804  }
805 
806  /* Check if the user is getting close to the end of the screen */
808  {
809  /* Delete the last character, replacing it with this one instead */
810  swprintf(StringBuffer, L"\b%c", Char);
812 
813  /* Omit the last two characters from the buffer */
816 
817  /* Write the last character that was just typed in */
818  ReadBuffer[0] = Char;
820  continue;
821  }
822 
823  /* Nothing of interest happened, just write the character back */
824  swprintf(StringBuffer, L"%c", Char);
826  }
827 
828  /* We're done, release the lock */
830  SAC_DBG(SAC_DBG_MACHINE, "SAC TimerDpcRoutine: Exiting.\n"); //bug
831 }
NTSTATUS NTAPI ChannelIWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:116
#define TRUE
Definition: types.h:120
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27
VOID NTAPI ConMgrProcessInputLine(VOID)
Definition: conmgr.c:456
NTSTATUS NTAPI ConMgrResetCurrentChannel(IN BOOLEAN KeepChannel)
Definition: conmgr.c:317
BOOLEAN InputInEscape
Definition: conmgr.c:32
WCHAR NTAPI ChannelIReadLast(IN PSAC_CHANNEL Channel)
Definition: channel.c:150
NTSTATUS NTAPI ChannelIRead(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize, IN OUT PULONG ResultBufferSize)
Definition: channel.c:131
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
char CHAR
Definition: xmlstorage.h:175
LONG NTSTATUS
Definition: precomp.h:26
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
CHAR InputBuffer[80]
Definition: conmgr.c:33
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
BOOLEAN InputInEscTab
Definition: conmgr.c:32
#define ANSI_NULL
char Char
Definition: bzip2.c:161
ULONG ExecutePostConsumerCommand
Definition: conmgr.c:29
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
BOOLEAN ConMgrLastCharWasCR
Definition: conmgr.c:32
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ULONG NTAPI ChannelIBufferLength(IN PSAC_CHANNEL Channel)
Definition: channel.c:163
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define SAC_DBG_MACHINE
Definition: sacdrv.h:36
NTSTATUS NTAPI ConMgrAdvanceCurrentChannel(VOID)
Definition: conmgr.c:410
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
NTSTATUS NTAPI SerialBufferGetChar(OUT PCHAR Char)
Definition: util.c:1209
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
#define STATUS_NO_DATA_DETECTED
Definition: udferr_usr.h:131
#define SAC_VTUTF8_COL_WIDTH
Definition: sacdrv.h:156
Status
Definition: gdiplustypes.h:24
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
unsigned int ULONG
Definition: retypes.h:1
#define CHAR(Char)
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
NTSTATUS NTAPI ConMgrDisplayCurrentChannel(VOID)
Definition: conmgr.c:81
LONG WriteEnabled
Definition: sacdrv.h:446

Referenced by ConMgrWorkerProcessEvents().

◆ ConMgrSetCurrentChannel()

NTSTATUS NTAPI ConMgrSetCurrentChannel ( IN PSAC_CHANNEL  Channel)

Definition at line 287 of file conmgr.c.

288 {
290  BOOLEAN HasRedrawEvent;
291 
292  /* Make sure the lock is held */
294 
295  /* Check if we have a redraw event */
296  Status = ChannelHasRedrawEvent(CurrentChannel, &HasRedrawEvent);
297  if (!NT_SUCCESS(Status)) return Status;
298 
299  /* Clear it */
300  if (HasRedrawEvent) ChannelClearRedrawEvent(CurrentChannel);
301 
302  /* Disable writes on the current channel */
304 
305  /* Release the current channel */
307  if (!NT_SUCCESS(Status)) return Status;
308 
309  /* Set the new channel and also disable writes on it */
310  CurrentChannel = Channel;
311  _InterlockedExchange(&Channel->WriteEnabled, 0);
312  return STATUS_SUCCESS;
313 }
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI ChannelHasRedrawEvent(IN PSAC_CHANNEL Channel, OUT PBOOLEAN Present)
Definition: channel.c:209
unsigned char BOOLEAN
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ChannelClearRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:198
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2725
LONG WriteEnabled
Definition: sacdrv.h:446
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243

Referenced by ConMgrAdvanceCurrentChannel(), and ConMgrResetCurrentChannel().

◆ ConMgrShutdown()

NTSTATUS NTAPI ConMgrShutdown ( VOID  )

Definition at line 372 of file conmgr.c.

373 {
375 
376  /* Check if we have a SAC channel */
377  if (SacChannel)
378  {
379  /* Close it */
381  if (!NT_SUCCESS(Status))
382  {
383  SAC_DBG(SAC_DBG_INIT, "SAC ConMgrShutdown: failed closing SAC channel.\n");
384  }
385 
386  /* No longer have one */
387  SacChannel = NULL;
388  }
389 
390  /* Check if we have a current channel */
391  if (CurrentChannel)
392  {
393  /* Release it */
395  if (!NT_SUCCESS(Status))
396  {
397  SAC_DBG(SAC_DBG_INIT, "SAC ConMgrShutdown: failed releasing current channel\n");
398  }
399 
400  /* No longer have one */
402  }
403 
404  /* All done */
405  return STATUS_SUCCESS;
406 }
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27
PSAC_CHANNEL CurrentChannel
Definition: conmgr.c:26
LONG NTSTATUS
Definition: precomp.h:26
smooth NULL
Definition: ftsmooth.c:416
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI ChannelClose(IN PSAC_CHANNEL Channel)
Definition: channel.c:558
#define SAC_DBG_INIT
Definition: sacdrv.h:34
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
Status
Definition: gdiplustypes.h:24
return STATUS_SUCCESS
Definition: btrfs.c:2725
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243

Referenced by FreeGlobalData().

◆ ConMgrSimpleEventMessage()

BOOLEAN NTAPI ConMgrSimpleEventMessage ( IN ULONG  MessageIndex,
IN BOOLEAN  LockHeld 
)

Definition at line 252 of file conmgr.c.

254 {
255  PWCHAR MessageBuffer;
256  BOOLEAN Result;
257 
258  /* Get the message to send out */
259  MessageBuffer = GetMessage(MessageIndex);
260  if (MessageBuffer)
261  {
262  /* Send it */
263  ConMgrEventMessage(MessageBuffer, LockHeld);
264  Result = TRUE;
265  }
266  else
267  {
268  /* It doesn't exist, fail */
269  Result = FALSE;
270  }
271 
272  /* Return if the message was sent or not */
273  return Result;
274 }
#define TRUE
Definition: types.h:120
uint16_t * PWCHAR
Definition: typedefs.h:54
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
VOID NTAPI ConMgrEventMessage(IN PWCHAR EventMessage, IN BOOLEAN LockHeld)
Definition: conmgr.c:235
#define GetMessage
Definition: winuser.h:5656

Referenced by DoRebootCommand().

◆ ConMgrWorkerProcessEvents()

VOID NTAPI ConMgrWorkerProcessEvents ( IN PSAC_DEVICE_EXTENSION  DeviceExtension)

Definition at line 835 of file conmgr.c.

836 {
837  SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC WorkerProcessEvents: Entering.\n");
838 
839  /* Enter the main loop */
840  while (TRUE)
841  {
842  /* Wait for something to do */
843  KeWaitForSingleObject(&DeviceExtension->Event,
844  Executive,
845  KernelMode,
846  FALSE,
847  NULL);
848 
849  /* Consume data off the serial port */
852  {
853  case Restart:
854  /* A reboot was sent, do it */
856  break;
857 
858  case Close:
859  /* A close was sent, do it */
862  break;
863 
864  case Shutdown:
865  /* A shutdown was sent, do it */
867  break;
868  }
869 
870  /* Clear the serial port consumer state */
873  }
874 }
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
smooth NULL
Definition: ftsmooth.c:416
ULONG ExecutePostConsumerCommand
Definition: conmgr.c:29
PSAC_CHANNEL ExecutePostConsumerCommandData
Definition: conmgr.c:30
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
VOID NTAPI ConMgrSerialPortConsumer(VOID)
Definition: conmgr.c:574
Definition: sacdrv.h:267
VOID NTAPI DoRebootCommand(IN BOOLEAN Reboot)
Definition: concmd.c:355
#define SAC_DBG_ENTRY_EXIT
Definition: sacdrv.h:32
NTSTATUS NTAPI ChanMgrCloseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:593
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243

Referenced by WorkerProcessEvents().

◆ ConMgrWriteData()

NTSTATUS NTAPI ConMgrWriteData ( IN PSAC_CHANNEL  Channel,
IN PVOID  Buffer,
IN ULONG  BufferLength 
)

Definition at line 111 of file conmgr.c.

114 {
115  ULONG i;
118 
119  /* Loop up to 32 times */
120  for (i = 0; i < 32; i++)
121  {
122  /* Attempt sending the data */
124  if (Status != STATUS_UNSUCCESSFUL) break;
125 
126  /* Sending the data on the port failed, wait a second... */
127  Interval.HighPart = -1;
128  Interval.LowPart = -100000;
130  }
131 
132  /* After 32 attempts it should really have worked... */
134  return Status;
135 }
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS NTAPI HeadlessDispatch(IN HEADLESS_CMD Command, IN PVOID InputBuffer, IN SIZE_T InputBufferSize, OUT PVOID OutputBuffer, OUT PSIZE_T OutputBufferSize)
Definition: hdlsterm.c:570
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
_In_ ULONG BufferLength
Definition: usbdlib.h:225
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
DWORD Interval
Definition: netstat.c:30
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
Status
Definition: gdiplustypes.h:24
unsigned int ULONG
Definition: retypes.h:1

Referenced by RawChannelOEcho(), RawChannelOFlush(), VTUTF8ChannelAnsiDispatch(), VTUTF8ChannelOEcho(), and VTUTF8ChannelOFlush().

◆ DEFINE_GUID()

DEFINE_GUID ( PRIMARY_SAC_CHANNEL_APPLICATION_GUID  ,
0x63D02270  ,
0x8AA4  ,
0x11D5  ,
0xBC  ,
0xCF  ,
0x80  ,
0x6D  ,
0x61  ,
0x72  ,
0x69  ,
0x6F   
)

◆ SacPutSimpleMessage()

BOOLEAN NTAPI SacPutSimpleMessage ( IN ULONG  MessageIndex)

Definition at line 57 of file conmgr.c.

58 {
59  PWCHAR MessageBuffer;
61 
62  /* Get the message */
63  MessageBuffer = GetMessage(MessageIndex);
64  if (MessageBuffer)
65  {
66  /* Output it */
67  SacPutString(MessageBuffer);
68  Result = TRUE;
69  }
70  else
71  {
72  Result = FALSE;
73  }
74 
75  /* All done */
76  return Result;
77 }
#define TRUE
Definition: types.h:120
uint16_t * PWCHAR
Definition: typedefs.h:54
unsigned char BOOLEAN
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
#define GetMessage
Definition: winuser.h:5656

Referenced by ConMgrEventMessage(), ConMgrInitialize(), ConMgrProcessInputLine(), ConMgrSerialPortConsumer(), DoFullInfoCommand(), DoPagingCommand(), DoRebootCommand(), DoTlistCommand(), and PrintHelpMessage().

◆ SacPutString()

VOID NTAPI SacPutString ( IN PWCHAR  String)

Definition at line 41 of file conmgr.c.

42 {
44 
45  /* Write the string on the main SAC channel */
47  (PCHAR)String,
48  wcslen(String) * sizeof(WCHAR));
49  if (!NT_SUCCESS(Status))
50  {
51  SAC_DBG(SAC_DBG_INIT, "SAC XmlMgrSacPutString: OWrite failed\n");
52  }
53 }
signed char * PCHAR
Definition: retypes.h:7
PSAC_CHANNEL SacChannel
Definition: conmgr.c:27
LONG NTSTATUS
Definition: precomp.h:26
static WCHAR String[]
Definition: stringtable.c:55
NTSTATUS NTAPI ChannelOWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:87
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SAC_DBG_INIT
Definition: sacdrv.h:34
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
Status
Definition: gdiplustypes.h:24
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)

Referenced by ConMgrEventMessage(), ConMgrSerialPortConsumer(), DoRebootCommand(), DoTlistCommand(), and SacPutSimpleMessage().

Variable Documentation

◆ ConMgrLastCharWasCR

BOOLEAN ConMgrLastCharWasCR

Definition at line 32 of file conmgr.c.

Referenced by ConMgrSerialPortConsumer().

◆ CurrentChannel

◆ CurrentChannelLock

KMUTEX CurrentChannelLock

◆ CurrentChannelRefCount

LONG CurrentChannelRefCount

◆ ExecutePostConsumerCommand

ULONG ExecutePostConsumerCommand

◆ ExecutePostConsumerCommandData

PSAC_CHANNEL ExecutePostConsumerCommandData

Definition at line 30 of file conmgr.c.

Referenced by ConMgrWorkerProcessEvents().

◆ GlobalDoThreads

BOOLEAN GlobalDoThreads

Definition at line 35 of file conmgr.c.

Referenced by DoFullInfoCommand().

◆ GlobalPagingNeeded

BOOLEAN GlobalPagingNeeded

Definition at line 35 of file conmgr.c.

Referenced by ConMgrProcessInputLine(), and DoPagingCommand().

◆ InputBuffer

CHAR InputBuffer[80]

Definition at line 33 of file conmgr.c.

Referenced by _Function_class_(), _tmain(), BatteryIoctl(), CdPerformDevIoCtrlEx(), CmBattGetPsrData(), CmBattGetStaData(), CmBattGetUniqueId(), CmBattSendDownStreamIrp(), CmBattSetTripPpoint(), CompBattGetBatteryGranularity(), CompBattGetBatteryInformation(), CRawCodec::Compress(), CMSZipCodec::Compress(), ConDrvFlushConsoleInputBuffer(), ConDrvGetConsoleInput(), ConDrvGetConsoleMode(), ConDrvGetConsoleNumberOfInputEvents(), ConDrvReadConsole(), ConDrvSetConsoleMode(), ConDrvWriteConsoleInput(), ConMgrProcessInputLine(), ConMgrSerialPortConsumer(), ConSrvCloseHandleEntry(), ConSrvTermReadStream(), CreateExtendedPartitionPage(), CreateLogicalPartitionPage(), CreatePrimaryPartitionPage(), CSR_API(), dev_ioctl(), DeviceIoControl(), Dispatch_fnFastDeviceIoControl(), DispTdiQueryInformationEx(), DosInt21h(), EfiLocateHandleBuffer(), Ext2DiskIoControl(), Ext2SetReparsePoint(), FatPerformDevIoCtrl(), FFSDiskIoControl(), FltpFastIoDeviceControl(), GetNtfsFileRecord(), GreenDeviceIoControl(), HandleFile(), HdlspDispatch(), HeadlessDispatch(), i8042SendHookWorkItem(), IoBuildDeviceIoControlRequest(), IopDeviceFsIoControl(), KbdHid_SubmitRequest(), KdSystemDebugControl(), KsecDeviceIoControl(), MouHid_SubmitRequest(), MSZipCodecUncompress(), MupBuildIoControlRequest(), NpControlPipe(), NpSetClientProcess(), NtDeviceIoControlFile(), NtFsControlFile(), NtfsDeviceIoControl(), NtPowerInformation(), NtSystemDebugControl(), PciGetHotPlugParameters(), PciIsSlotPresentInParentMethod(), PciSendIoctl(), PiceSendIoctl(), RawCodecUncompress(), ReadChars(), ReadInputBuffer(), RfsdDiskIoControl(), SermouseDeviceIoControl(), ShowPartitionSizeInputBox(), TdiQueryDeviceControl(), telProcessConsole(), TranslateCharToScanCodes(), UDFGetRetrievalPointers(), UDFPhSendIOCTL(), UDFSetFileAllocModeFromICB(), UDFTSendIOCTL(), CRawCodec::Uncompress(), CMSZipCodec::Uncompress(), VfatBlockDeviceIoControl(), and VfatFastIoDeviceControl().

◆ InputInEscape

BOOLEAN InputInEscape

Definition at line 32 of file conmgr.c.

Referenced by ConMgrSerialPortConsumer().

◆ InputInEscTab

BOOLEAN InputInEscTab

Definition at line 32 of file conmgr.c.

Referenced by ConMgrSerialPortConsumer().

◆ SacChannel