ReactOS  0.4.13-dev-464-g6b95727
conmgr.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS Drivers
3  * LICENSE: BSD - See COPYING.ARM in the top level directory
4  * FILE: drivers/sac/driver/conmgr.c
5  * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6  * PROGRAMMERS: ReactOS Portable Systems Group
7  */
8 
9 /* INCLUDES *******************************************************************/
10 
11 #include "sacdrv.h"
12 
13 #include <initguid.h>
14 
15 /* GLOBALS ********************************************************************/
16 
17 DEFINE_GUID(PRIMARY_SAC_CHANNEL_APPLICATION_GUID,
18  0x63D02270,
19  0x8AA4,
20  0x11D5,
21  0xBC, 0xCF, 0x80, 0x6D, 0x61, 0x72, 0x69, 0x6F);
22 
25 
28 
31 
34 
36 
37 /* FUNCTIONS ******************************************************************/
38 
39 VOID
40 NTAPI
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 }
54 
55 BOOLEAN
56 NTAPI
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 }
78 
80 NTAPI
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 }
108 
109 NTSTATUS
110 NTAPI
112  IN PVOID Buffer,
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 }
136 
137 NTSTATUS
138 NTAPI
140 {
141  /* Nothing to do */
142  return STATUS_SUCCESS;
143 }
144 
145 BOOLEAN
146 NTAPI
148 {
149  /* Check which channel is active */
150  return Channel == SacChannel;
151 }
152 
153 BOOLEAN
154 NTAPI
156 {
157  /* If the current channel is active, allow writes */
158  return ChannelIsEqual(Channel, &CurrentChannel->ChannelId);
159 }
160 
161 NTSTATUS
162 NTAPI
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 }
232 
233 VOID
234 NTAPI
236  IN BOOLEAN LockHeld)
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 }
249 
250 BOOLEAN
251 NTAPI
253  IN BOOLEAN LockHeld)
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 }
275 
276 NTSTATUS
277 NTAPI
279 {
280  /* FIXME: TODO */
281  ASSERT(FALSE);
282  return STATUS_NOT_IMPLEMENTED;
283 }
284 
285 NTSTATUS
286 NTAPI
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 }
314 
315 NTSTATUS
316 NTAPI
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 }
351 
352 NTSTATUS
353 NTAPI
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 }
369 
370 NTSTATUS
371 NTAPI
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 }
407 
408 NTSTATUS
409 NTAPI
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 }
435 
436 NTSTATUS
437 NTAPI
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 }
453 
454 VOID
455 NTAPI
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 }
571 
572 VOID
573 NTAPI
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 }
832 
833 VOID
834 NTAPI
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 }
875 
876 NTSTATUS
877 NTAPI
879  IN NTSTATUS CloseStatus,
881 {
882  ASSERT(FALSE);
883  return STATUS_NOT_IMPLEMENTED;
884 }
885 
886 NTSTATUS
887 NTAPI
889  IN PSAC_CHANNEL Channel,
890  OUT PVOID Data)
891 {
892  ASSERT(FALSE);
893  return STATUS_NOT_IMPLEMENTED;
894 }
BOOLEAN GlobalDoThreads
Definition: conmgr.c:35
NTSTATUS NTAPI ChannelIWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:116
#define SAC_CHANNEL_FLAG_INTERNAL
Definition: sacdrv.h:168
signed char * PCHAR
Definition: retypes.h:7
NTSTATUS NTAPI ConMgrHandleEvent(IN ULONG EventCode, IN PSAC_CHANNEL Channel, OUT PVOID Data)
Definition: conmgr.c:888
VOID NTAPI DoMachineInformationCommand(VOID)
Definition: concmd.c:477
#define IN
Definition: typedefs.h:38
BOOLEAN NTAPI ConMgrIsWriteEnabled(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:155
#define TRUE
Definition: types.h:120
_In_ NDIS_STATUS EventCode
Definition: ndis.h:4751
VOID NTAPI DoFullInfoCommand(VOID)
Definition: concmd.c:409
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
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
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
BOOLEAN InputInEscape
Definition: conmgr.c:32
Definition: sacdrv.h:276
VOID NTAPI DoCmdCommand(IN PCHAR InputString)
Definition: concmd.c:491
WCHAR DescriptionBuffer[SAC_CHANNEL_DESCRIPTION_SIZE+1]
Definition: sacdrv.h:479
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
long __cdecl _InterlockedExchange(_Interlocked_operand_ long volatile *_Target, long _Value)
char CHAR
Definition: xmlstorage.h:175
BOOLEAN GlobalPagingNeeded
Definition: conmgr.c:35
VOID NTAPI ConMgrWorkerProcessEvents(IN PSAC_DEVICE_EXTENSION DeviceExtension)
Definition: conmgr.c:835
NTSTATUS NTAPI ConMgrInitialize(VOID)
Definition: conmgr.c:163
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI DoSetTimeCommand(IN PCHAR InputTime)
Definition: concmd.c:431
#define ReadBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:339
VOID NTAPI DoPagingCommand(VOID)
Definition: concmd.c:420
static WCHAR String[]
Definition: stringtable.c:55
BOOLEAN NTAPI ChannelIsEqual(IN PSAC_CHANNEL Channel, IN PSAC_CHANNEL_ID ChannelId)
Definition: channel.c:25
uint16_t * PWCHAR
Definition: typedefs.h:54
#define SAC_CHANNEL_DESCRIPTION_SIZE
Definition: sacdrv.h:152
NTSTATUS NTAPI ConMgrShutdown(VOID)
Definition: conmgr.c:372
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
CHAR InputBuffer[80]
Definition: conmgr.c:33
VOID NTAPI DoHelpCommand(VOID)
Definition: concmd.c:529
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
VOID NTAPI DoCrashCommand(VOID)
Definition: concmd.c:466
SAC_CHANNEL_TYPE ChannelType
Definition: sacdrv.h:477
BOOLEAN CommandConsoleLaunchingEnabled
Definition: data.c:16
LONG CurrentChannelRefCount
Definition: conmgr.c:23
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
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
NTSTATUS NTAPI ChannelHasRedrawEvent(IN PSAC_CHANNEL Channel, OUT PBOOLEAN Present)
Definition: channel.c:209
#define ANSI_NULL
NTSTATUS NTAPI ChannelSetRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:176
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
char Char
Definition: bzip2.c:161
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE VOID SacAssertMutexLockHeld(VOID)
Definition: sacdrv.h:1285
_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
Definition: bufpool.h:45
ULONG ExecutePostConsumerCommand
Definition: conmgr.c:29
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
NTSTATUS NTAPI ChanMgrCreateChannel(OUT PSAC_CHANNEL *Channel, IN PSAC_CHANNEL_ATTRIBUTES Attributes)
Definition: chanmgr.c:345
DWORD Interval
Definition: netstat.c:30
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
NTSTATUS NTAPI ConMgrFlushData(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:139
#define STATUS_NOT_FOUND
Definition: shellext.h:67
NTSTATUS NTAPI ChanMgrGetNextActiveChannel(IN PSAC_CHANNEL CurrentChannel, IN PULONG TargetIndex, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:521
NTSTATUS NTAPI ChannelOWrite(IN PSAC_CHANNEL Channel, IN PCHAR Buffer, IN ULONG BufferSize)
Definition: channel.c:87
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
PSAC_CHANNEL ExecutePostConsumerCommandData
Definition: conmgr.c:30
VOID NTAPI DoLowerPriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:445
FORCEINLINE VOID SacReleaseMutexLock(VOID)
Definition: sacdrv.h:1319
#define SAC_CHANNEL_FLAG_APPLICATION
Definition: sacdrv.h:173
#define swprintf(buf, format,...)
Definition: sprintf.c:56
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
static const UCHAR Index[8]
Definition: usbohci.c:18
NTSTATUS NTAPI ConMgrGetChannelCloseMessage(IN PSAC_CHANNEL Channel, IN NTSTATUS CloseStatus, OUT PWCHAR OutputBuffer)
Definition: conmgr.c:878
#define SAC_DBG_MACHINE
Definition: sacdrv.h:36
DEFINE_GUID(PRIMARY_SAC_CHANNEL_APPLICATION_GUID, 0x63D02270, 0x8AA4, 0x11D5, 0xBC, 0xCF, 0x80, 0x6D, 0x61, 0x72, 0x69, 0x6F)
NTSTATUS NTAPI ConMgrAdvanceCurrentChannel(VOID)
Definition: conmgr.c:410
VOID NTAPI DoRaisePriorityCommand(IN PCHAR PrioString)
Definition: concmd.c:452
FORCEINLINE VOID SacAcquireMutexLock(VOID)
Definition: sacdrv.h:1307
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
NTSTATUS NTAPI ChannelClose(IN PSAC_CHANNEL Channel)
Definition: channel.c:558
static const WCHAR L[]
Definition: oid.c:1250
#define SAC_DBG_INIT
Definition: sacdrv.h:34
NTSTATUS NTAPI SerialBufferGetChar(OUT PCHAR Char)
Definition: util.c:1209
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
VOID NTAPI DoChannelCommand(IN PCHAR ChannelString)
Definition: concmd.c:484
NTSTATUS NTAPI ChannelOFlush(IN PSAC_CHANNEL Channel)
Definition: channel.c:103
BOOLEAN NTAPI ConMgrIsSacChannel(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:147
#define STATUS_NO_DATA_DETECTED
Definition: udferr_usr.h:131
#define SAC_VTUTF8_COL_WIDTH
Definition: sacdrv.h:156
NTSTATUS NTAPI ChannelClearRedrawEvent(IN PSAC_CHANNEL Channel)
Definition: channel.c:198
VOID NTAPI ConMgrSerialPortConsumer(VOID)
Definition: conmgr.c:574
VOID NTAPI DoLockCommand(VOID)
Definition: concmd.c:498
Status
Definition: gdiplustypes.h:24
VOID NTAPI ConMgrEventMessage(IN PWCHAR EventMessage, IN BOOLEAN LockHeld)
Definition: conmgr.c:235
NTSTATUS NTAPI ConMgrWriteData(IN PSAC_CHANNEL Channel, IN PVOID Buffer, IN ULONG BufferLength)
Definition: conmgr.c:111
NTSTATUS NTAPI ConMgrDisplayFastChannelSwitchingInterface(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:278
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57
KMUTEX CurrentChannelLock
Definition: conmgr.c:24
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
Definition: sacdrv.h:267
NTSTATUS NTAPI ConMgrSetCurrentChannel(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:287
VOID NTAPI DoSetIpAddressCommand(IN PCHAR IpString)
Definition: concmd.c:564
VOID NTAPI DoKillCommand(IN PCHAR KillString)
Definition: concmd.c:438
BOOLEAN NTAPI ConMgrSimpleEventMessage(IN ULONG MessageIndex, IN BOOLEAN LockHeld)
Definition: conmgr.c:252
#define GetMessage
Definition: winuser.h:5656
NTSTATUS NTAPI ConMgrChannelClose(IN PSAC_CHANNEL Channel)
Definition: conmgr.c:354
VOID NTAPI DoRebootCommand(IN BOOLEAN Reboot)
Definition: concmd.c:355
VOID NTAPI DoTlistCommand(VOID)
Definition: concmd.c:571
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define SAC_DBG_ENTRY_EXIT
Definition: sacdrv.h:32
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
NTSTATUS NTAPI ChanMgrGetByHandle(IN SAC_CHANNEL_ID ChannelId, OUT PSAC_CHANNEL *TargetChannel)
Definition: chanmgr.c:202
VOID NTAPI DoLimitMemoryCommand(IN PCHAR LimitString)
Definition: concmd.c:459
return STATUS_SUCCESS
Definition: btrfs.c:2777
#define CHAR(Char)
WCHAR StringBuffer[156]
Definition: ldrinit.c:41
FORCEINLINE VOID SacInitializeMutexLock(VOID)
Definition: sacdrv.h:1296
#define SAC_CHANNEL_NAME_SIZE
Definition: sacdrv.h:151
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
NTSTATUS NTAPI ChanMgrCloseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:593
#define WriteBuffer(BaseIoAddress, Buffer, Count)
Definition: atapi.h:344
NTSTATUS NTAPI ConMgrChannelOWrite(IN PSAC_CHANNEL Channel, IN PVOID WriteBuffer)
Definition: conmgr.c:438
NTSTATUS NTAPI ConMgrDisplayCurrentChannel(VOID)
Definition: conmgr.c:81
LONG WriteEnabled
Definition: sacdrv.h:446
NTSTATUS NTAPI ChanMgrReleaseChannel(IN PSAC_CHANNEL Channel)
Definition: chanmgr.c:243
SAC_CHANNEL_ID ChannelId
Definition: sacdrv.h:426