2 * PROJECT: ReactOS Drivers
3 * LICENSE: BSD - See COPYING.ARM in the top level directory
4 * FILE: drivers/sac/driver/concmd.c
5 * PURPOSE: Driver for the Server Administration Console (SAC) for EMS
6 * PROGRAMMERS: ReactOS Portable Systems Group
9 /* INCLUDES ******************************************************************/
13 /* GLOBALS *******************************************************************/
16 ULONG GlobalBufferSize
;
18 /* FUNCTIONS *****************************************************************/
25 return STATUS_NOT_IMPLEMENTED
;
29 DoChannelCloseByNameCommand(
33 return STATUS_NOT_IMPLEMENTED
;
37 DoChannelCloseByIndexCommand(
41 return STATUS_NOT_IMPLEMENTED
;
45 DoChannelSwitchByNameCommand(
49 return STATUS_NOT_IMPLEMENTED
;
53 DoChannelSwitchByIndexCommand(
57 return STATUS_NOT_IMPLEMENTED
;
67 return STATUS_NOT_IMPLEMENTED
;
80 OUT PBOOLEAN ScreenFull
87 RetrieveIpAddressFromString(
97 IN HANDLE DriverHandle
,
98 IN PVOID DriverObject
,
100 IN PIO_STATUS_BLOCK IoStatusBlock
,
101 IN PVOID InputBuffer
,
102 IN ULONG InputBufferLength
,
103 IN PVOID OutputBuffer
,
104 IN ULONG OutputBufferLength
,
105 IN BOOLEAN PrintMessage
,
106 OUT PBOOLEAN MessagePrinted
109 return STATUS_NOT_IMPLEMENTED
;
114 DoRebootCommand(IN BOOLEAN Reboot
)
116 LARGE_INTEGER Timeout
, TickCount
;
119 SAC_DBG(1, "SAC DoRebootCommand: Entering.\n");
121 /* Get the current time now, and setup a timeout in 1 second */
122 KeQueryTickCount(&TickCount
);
123 Timeout
.QuadPart
= TickCount
.QuadPart
/ (10000000 / KeQueryTimeIncrement());
125 /* Check if the timeout is small enough */
126 if (Timeout
.QuadPart
< 60 )
128 /* Show the prompt */
129 ConMgrSimpleEventMessage(Reboot
?
130 SAC_RESTART_PROMPT
: SAC_SHUTDOWN_PROMPT
,
134 KeInitializeEvent(&Event
, SynchronizationEvent
, 0);
135 Timeout
.QuadPart
= -10000000 * (60 - Timeout
.LowPart
);
136 KeWaitForSingleObject(&Event
, Executive
, KernelMode
, FALSE
, &Timeout
);
139 /* Do a shutdown or a reboot, based on the request */
140 Status
= NtShutdownSystem(Reboot
? ShutdownReboot
: ShutdownPowerOff
);
142 /* Check if anyone in the command channel already allocated this */
146 GlobalBuffer
= SacAllocatePool(PAGE_SIZE
, GLOBAL_BLOCK_TAG
);
149 /* We need the global buffer, bail out without it*/
150 SacPutSimpleMessage(SAC_OUT_OF_MEMORY_PROMPT
);
151 SAC_DBG(SAC_DBG_ENTRY_EXIT
, "SAC DoRebootCommand: Exiting (1).\n");
155 /* Set the size of the buffer */
156 GlobalBufferSize
= PAGE_SIZE
;
159 /* We came back from a reboot, this doesn't make sense, tell the user */
160 SacPutSimpleMessage(Reboot
? SAC_RESTART_FAIL_PROMPT
: SAC_SHUTDOWN_FAIL_PROMPT
);
161 swprintf(GlobalBuffer
, GetMessage(SAC_FAIL_PROMPT
), Status
);
162 SacPutString(GlobalBuffer
);
163 SAC_DBG(SAC_DBG_ENTRY_EXIT
, "SAC DoRebootCommand: Exiting.\n");
168 DoFullInfoCommand(VOID
)
175 DoPagingCommand(VOID
)
182 DoSetTimeCommand(IN PCHAR InputTime
)
189 DoKillCommand(IN PCHAR KillString
)
196 DoLowerPriorityCommand(IN PCHAR PrioString
)
203 DoRaisePriorityCommand(IN PCHAR PrioString
)
210 DoLimitMemoryCommand(IN PCHAR LimitString
)
224 DoMachineInformationCommand(VOID
)
231 DoChannelCommand(IN PCHAR ChannelString
)
238 DoCmdCommand(IN PCHAR InputString
)
250 #define PRINT_HELP_MESSAGE(x) \
253 NewCount = GetMessageLineCount(x); \
254 if ( (NewCount + Count) > SAC_VTUTF8_COL_HEIGHT) \
256 PutMore(&ScreenFull); \
257 if (ScreenFull) return; \
260 SacPutSimpleMessage(x); \
267 ULONG NewCount
= 0, Count
= 0;
268 BOOLEAN ScreenFull
= FALSE
;
270 PRINT_HELP_MESSAGE(112);
271 PRINT_HELP_MESSAGE(12);
272 PRINT_HELP_MESSAGE(13);
273 PRINT_HELP_MESSAGE(14);
274 PRINT_HELP_MESSAGE(15);
275 PRINT_HELP_MESSAGE(16);
276 PRINT_HELP_MESSAGE(31);
277 PRINT_HELP_MESSAGE(18);
278 PRINT_HELP_MESSAGE(19);
279 PRINT_HELP_MESSAGE(32);
280 PRINT_HELP_MESSAGE(20);
281 PRINT_HELP_MESSAGE(21);
282 PRINT_HELP_MESSAGE(22);
283 PRINT_HELP_MESSAGE(23);
284 PRINT_HELP_MESSAGE(24);
285 PRINT_HELP_MESSAGE(25);
286 PRINT_HELP_MESSAGE(27);
287 PRINT_HELP_MESSAGE(28);
288 PRINT_HELP_MESSAGE(29);
293 DoGetNetInfo(IN BOOLEAN DoPrint
)
300 DoSetIpAddressCommand(IN PCHAR IpString
)