Synchronize with trunk revision 59781.
[reactos.git] / drivers / sac / driver / concmd.c
index 76d6edb..c515ce2 100644 (file)
@@ -17,58 +17,44 @@ ULONG GlobalBufferSize;
 
 /* FUNCTIONS *****************************************************************/
 
-VOID
-NTAPI
-DoRebootCommand(IN BOOLEAN Reboot)
+NTSTATUS
+DoChannelListCommand(
+       VOID
+       )
 {
-    LARGE_INTEGER Timeout, TickCount;
-    NTSTATUS Status;
-    KEVENT Event;
-    SAC_DBG(1, "SAC DoRebootCommand: Entering.\n");
-
-    /* Get the current time now, and setup a timeout in 1 second */
-    KeQueryTickCount(&TickCount);
-    Timeout.QuadPart = TickCount.QuadPart / (10000000 / KeQueryTimeIncrement());
-
-    /* Check if the timeout is small enough */
-    if (Timeout.QuadPart < 60 )
-    {
-        /* Show the prompt */
-        ConMgrSimpleEventMessage(Reboot ?
-                                 SAC_RESTART_PROMPT : SAC_SHUTDOWN_PROMPT,
-                                 TRUE);
-
-        /* Do the wait */
-        KeInitializeEvent(&Event, SynchronizationEvent, 0);
-        Timeout.QuadPart = -10000000 * (60 - Timeout.LowPart);
-        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &Timeout);
-    }
+       return STATUS_NOT_IMPLEMENTED;
+}
 
-    /* Do a shutdown or a reboot, based on the request */
-    Status = NtShutdownSystem(Reboot ? ShutdownReboot : ShutdownPowerOff);
+NTSTATUS
+DoChannelCloseByNameCommand(
+       IN PCHAR Count
+       )
+{
+       return STATUS_NOT_IMPLEMENTED;
+}
 
-    /* Check if anyone in the command channel already allocated this */
-    if (!GlobalBuffer)
-    {
-        /* Allocate it */
-        GlobalBuffer = SacAllocatePool(PAGE_SIZE, GLOBAL_BLOCK_TAG);
-        if (!GlobalBuffer)
-        {
-            /* We need the global buffer, bail out without it*/
-            SacPutSimpleMessage(SAC_OUT_OF_MEMORY_PROMPT);
-            SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting (1).\n");
-            return;
-        }
+NTSTATUS
+DoChannelCloseByIndexCommand(
+       IN ULONG ChannelIndex
+       )
+{
+       return STATUS_NOT_IMPLEMENTED;
+}
 
-        /* Set the size of the buffer */
-        GlobalBufferSize = PAGE_SIZE;
-    }
+NTSTATUS
+DoChannelSwitchByNameCommand(
+       IN PCHAR Count
+       )
+{
+       return STATUS_NOT_IMPLEMENTED;
+}
 
-    /* We came back from a reboot, this doesn't make sense, tell the user */
-    SacPutSimpleMessage(Reboot ? SAC_RESTART_FAIL_PROMPT : SAC_SHUTDOWN_FAIL_PROMPT);
-    swprintf(GlobalBuffer, GetMessage(SAC_FAIL_PROMPT), Status);
-    SacPutString(GlobalBuffer);
-    SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting.\n");
+NTSTATUS
+DoChannelSwitchByIndexCommand(
+       IN ULONG ChannelIndex
+       )
+{
+       return STATUS_NOT_IMPLEMENTED;
 }
 
 NTSTATUS
@@ -124,169 +110,201 @@ CallQueryIPIOCTL(
 }
 
 VOID
-DoFullInfoCommand(
-       VOID
-       )
+NTAPI
+DoRebootCommand(IN BOOLEAN Reboot)
 {
+    LARGE_INTEGER Timeout, TickCount;
+    NTSTATUS Status;
+    KEVENT Event;
+    SAC_DBG(1, "SAC DoRebootCommand: Entering.\n");
 
-}
+    /* Get the current time now, and setup a timeout in 1 second */
+    KeQueryTickCount(&TickCount);
+    Timeout.QuadPart = TickCount.QuadPart / (10000000 / KeQueryTimeIncrement());
 
-VOID
-DoPagingCommand(
-       VOID
-       )
-{
+    /* Check if the timeout is small enough */
+    if (Timeout.QuadPart < 60 )
+    {
+        /* Show the prompt */
+        ConMgrSimpleEventMessage(Reboot ?
+                                 SAC_RESTART_PROMPT : SAC_SHUTDOWN_PROMPT,
+                                 TRUE);
 
-}
+        /* Do the wait */
+        KeInitializeEvent(&Event, SynchronizationEvent, 0);
+        Timeout.QuadPart = -10000000 * (60 - Timeout.LowPart);
+        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, &Timeout);
+    }
 
-VOID
-DoSetTimeCommand(
-       IN PCHAR InputTime
-       )
-{
+    /* Do a shutdown or a reboot, based on the request */
+    Status = NtShutdownSystem(Reboot ? ShutdownReboot : ShutdownPowerOff);
 
+    /* Check if anyone in the command channel already allocated this */
+    if (!GlobalBuffer)
+    {
+        /* Allocate it */
+        GlobalBuffer = SacAllocatePool(PAGE_SIZE, GLOBAL_BLOCK_TAG);
+        if (!GlobalBuffer)
+        {
+            /* We need the global buffer, bail out without it*/
+            SacPutSimpleMessage(SAC_OUT_OF_MEMORY_PROMPT);
+            SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting (1).\n");
+            return;
+        }
+
+        /* Set the size of the buffer */
+        GlobalBufferSize = PAGE_SIZE;
+    }
+
+    /* We came back from a reboot, this doesn't make sense, tell the user */
+    SacPutSimpleMessage(Reboot ? SAC_RESTART_FAIL_PROMPT : SAC_SHUTDOWN_FAIL_PROMPT);
+    swprintf(GlobalBuffer, GetMessage(SAC_FAIL_PROMPT), Status);
+    SacPutString(GlobalBuffer);
+    SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting.\n");
 }
 
 VOID
-DoKillCommand(
-       IN PCHAR KillString
-       )
+NTAPI
+DoFullInfoCommand(VOID)
 {
 
 }
 
 VOID
-DoLowerPriorityCommand(
-       IN PCHAR PrioString
-       )
+NTAPI
+DoPagingCommand(VOID)
 {
 
 }
 
 VOID
-DoRaisePriorityCommand(
-       IN PCHAR PrioString
-       )
+NTAPI
+DoSetTimeCommand(IN PCHAR InputTime)
 {
 
 }
 
 VOID
-DoLimitMemoryCommand(
-       IN PCHAR LimitString
-       )
+NTAPI
+DoKillCommand(IN PCHAR KillString)
 {
 
 }
 
 VOID
-DoCrashCommand(
-       VOID
-       )
+NTAPI
+DoLowerPriorityCommand(IN PCHAR PrioString)
 {
 
 }
 
 VOID
-DoMachineInformationCommand(
-       VOID
-       )
+NTAPI
+DoRaisePriorityCommand(IN PCHAR PrioString)
 {
 
 }
 
-NTSTATUS
-DoChannelListCommand(
-       VOID
-       )
+VOID
+NTAPI
+DoLimitMemoryCommand(IN PCHAR LimitString)
 {
-       return STATUS_NOT_IMPLEMENTED;
-}
 
-NTSTATUS
-DoChannelCloseByNameCommand(
-       IN PCHAR Count
-       )
-{
-       return STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS
-DoChannelCloseByIndexCommand(
-       IN ULONG ChannelIndex
-       )
+VOID
+NTAPI
+DoCrashCommand(VOID)
 {
-       return STATUS_NOT_IMPLEMENTED;
-}
 
-NTSTATUS
-DoChannelSwitchByNameCommand(
-       IN PCHAR Count
-       )
-{
-       return STATUS_NOT_IMPLEMENTED;
 }
 
-NTSTATUS
-DoChannelSwitchByIndexCommand(
-       IN ULONG ChannelIndex
-       )
+VOID
+NTAPI
+DoMachineInformationCommand(VOID)
 {
-       return STATUS_NOT_IMPLEMENTED;
+
 }
 
 VOID
-DoChannelCommand(
-       IN PCHAR ChannelString
-       )
+NTAPI
+DoChannelCommand(IN PCHAR ChannelString)
 {
 
 }
 
 VOID
-DoCmdCommand(
-       VOID
-       )
+NTAPI
+DoCmdCommand(IN PCHAR InputString)
 {
 
 }
 
 VOID
-DoLockCommand(
-       VOID
-       )
+NTAPI
+DoLockCommand(VOID)
 {
 
 }
 
+#define PRINT_HELP_MESSAGE(x)  \
+{   \
+    Count += NewCount; \
+    NewCount = GetMessageLineCount(x); \
+    if ( (NewCount + Count) > SAC_VTUTF8_COL_HEIGHT) \
+    { \
+        PutMore(&ScreenFull); \
+        if (ScreenFull) return; \
+        Count = 0; \
+    } \
+    SacPutSimpleMessage(x); \
+}
+
 VOID
-DoHelpCommand(
-       VOID
-       )
+NTAPI
+DoHelpCommand(VOID)
 {
-
+    ULONG NewCount = 0, Count = 0;
+    BOOLEAN ScreenFull = FALSE;
+
+    PRINT_HELP_MESSAGE(112);
+    PRINT_HELP_MESSAGE(12);
+    PRINT_HELP_MESSAGE(13);
+    PRINT_HELP_MESSAGE(14);
+    PRINT_HELP_MESSAGE(15);
+    PRINT_HELP_MESSAGE(16);
+    PRINT_HELP_MESSAGE(31);
+    PRINT_HELP_MESSAGE(18);
+    PRINT_HELP_MESSAGE(19);
+    PRINT_HELP_MESSAGE(32);
+    PRINT_HELP_MESSAGE(20);
+    PRINT_HELP_MESSAGE(21);
+    PRINT_HELP_MESSAGE(22);
+    PRINT_HELP_MESSAGE(23);
+    PRINT_HELP_MESSAGE(24);
+    PRINT_HELP_MESSAGE(25);
+    PRINT_HELP_MESSAGE(27);
+    PRINT_HELP_MESSAGE(28);
+    PRINT_HELP_MESSAGE(29);
 }
 
 VOID
-DoGetNetInfo(
-       IN BOOLEAN DoPrint
-       )
+NTAPI
+DoGetNetInfo(IN BOOLEAN DoPrint)
 {
 
 }
 
 VOID
-DoSetIpAddressCommand(
-       IN PCHAR IpString
-       )
+NTAPI
+DoSetIpAddressCommand(IN PCHAR IpString)
 {
-       
+
 }
 
 VOID
-DoTlistCommand(
-       VOID
-       )
+NTAPI
+DoTlistCommand(VOID)
 {
-       
-}
\ No newline at end of file
+
+}