ReactOS 0.4.15-dev-7924-g5949c20
concmd.c File Reference
#include "sacdrv.h"
#include <ndk/exfuncs.h>
Include dependency graph for concmd.c:

Go to the source code of this file.

Classes

struct  _SAC_SYSTEM_INFORMATION
 

Typedefs

typedef struct _SAC_SYSTEM_INFORMATION SAC_SYSTEM_INFORMATION
 
typedef struct _SAC_SYSTEM_INFORMATIONPSAC_SYSTEM_INFORMATION
 

Functions

NTSTATUS DoChannelListCommand (VOID)
 
NTSTATUS DoChannelCloseByNameCommand (IN PCHAR Count)
 
NTSTATUS DoChannelCloseByIndexCommand (IN ULONG ChannelIndex)
 
NTSTATUS DoChannelSwitchByNameCommand (IN PCHAR Count)
 
NTSTATUS DoChannelSwitchByIndexCommand (IN ULONG ChannelIndex)
 
NTSTATUS NTAPI GetTListInfo (IN PSAC_SYSTEM_INFORMATION SacInfo, IN ULONG InputSize, OUT PULONG TotalSize)
 
VOID NTAPI PrintTListInfo (IN PSAC_SYSTEM_INFORMATION SacInfo)
 
VOID NTAPI PutMore (OUT PBOOLEAN ScreenFull)
 
BOOLEAN RetrieveIpAddressFromString (IN PWCHAR IpString, OUT PULONG IpAddress)
 
NTSTATUS CallQueryIPIOCTL (IN HANDLE DriverHandle, IN PVOID DriverObject, IN HANDLE WaitEvent, IN PIO_STATUS_BLOCK IoStatusBlock, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN PrintMessage, OUT PBOOLEAN MessagePrinted)
 
VOID NTAPI DoRebootCommand (IN BOOLEAN Reboot)
 
VOID NTAPI DoFullInfoCommand (VOID)
 
VOID NTAPI DoPagingCommand (VOID)
 
VOID NTAPI DoSetTimeCommand (IN PCHAR InputTime)
 
VOID NTAPI DoKillCommand (IN PCHAR KillString)
 
VOID NTAPI DoLowerPriorityCommand (IN PCHAR PrioString)
 
VOID NTAPI DoRaisePriorityCommand (IN PCHAR PrioString)
 
VOID NTAPI DoLimitMemoryCommand (IN PCHAR LimitString)
 
VOID NTAPI DoCrashCommand (VOID)
 
VOID NTAPI DoMachineInformationCommand (VOID)
 
VOID NTAPI DoChannelCommand (IN PCHAR ChannelString)
 
VOID NTAPI DoCmdCommand (IN PCHAR InputString)
 
VOID NTAPI DoLockCommand (VOID)
 
FORCEINLINE BOOLEAN PrintHelpMessage (IN ULONG MessageId, IN OUT PULONG Count)
 
VOID NTAPI DoHelpCommand (VOID)
 
VOID NTAPI DoGetNetInfo (IN BOOLEAN DoPrint)
 
VOID NTAPI DoSetIpAddressCommand (IN PCHAR IpString)
 
VOID NTAPI DoTlistCommand (VOID)
 

Variables

PVOID GlobalBuffer
 
ULONG GlobalBufferSize
 

Typedef Documentation

◆ PSAC_SYSTEM_INFORMATION

◆ SAC_SYSTEM_INFORMATION

Function Documentation

◆ CallQueryIPIOCTL()

NTSTATUS CallQueryIPIOCTL ( IN HANDLE  DriverHandle,
IN PVOID  DriverObject,
IN HANDLE  WaitEvent,
IN PIO_STATUS_BLOCK  IoStatusBlock,
IN PVOID  InputBuffer,
IN ULONG  InputBufferLength,
IN PVOID  OutputBuffer,
IN ULONG  OutputBufferLength,
IN BOOLEAN  PrintMessage,
OUT PBOOLEAN  MessagePrinted 
)

Definition at line 337 of file concmd.c.

349{
351}
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:239

◆ DoChannelCloseByIndexCommand()

NTSTATUS DoChannelCloseByIndexCommand ( IN ULONG  ChannelIndex)

Definition at line 39 of file concmd.c.

42{
44}

◆ DoChannelCloseByNameCommand()

NTSTATUS DoChannelCloseByNameCommand ( IN PCHAR  Count)

Definition at line 31 of file concmd.c.

34{
36}

◆ DoChannelCommand()

VOID NTAPI DoChannelCommand ( IN PCHAR  ChannelString)

Definition at line 484 of file concmd.c.

485{
486 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
487}
#define SAC_DBG(x,...)
Definition: sacdrv.h:37
#define SAC_DBG_ENTRY_EXIT
Definition: sacdrv.h:32

Referenced by ConMgrProcessInputLine().

◆ DoChannelListCommand()

NTSTATUS DoChannelListCommand ( VOID  )

Definition at line 23 of file concmd.c.

26{
28}

◆ DoChannelSwitchByIndexCommand()

NTSTATUS DoChannelSwitchByIndexCommand ( IN ULONG  ChannelIndex)

Definition at line 55 of file concmd.c.

58{
60}

◆ DoChannelSwitchByNameCommand()

NTSTATUS DoChannelSwitchByNameCommand ( IN PCHAR  Count)

Definition at line 47 of file concmd.c.

50{
52}

◆ DoCmdCommand()

VOID NTAPI DoCmdCommand ( IN PCHAR  InputString)

Definition at line 491 of file concmd.c.

492{
493 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
494}

Referenced by ConMgrProcessInputLine().

◆ DoCrashCommand()

VOID NTAPI DoCrashCommand ( VOID  )

Definition at line 466 of file concmd.c.

467{
468 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoCrashCommand: Entering.\n");
469
470 /* Crash the machine */
471 KeBugCheckEx(MANUALLY_INITIATED_CRASH, 0, 0, 0, 0);
472 __debugbreak();
473}
void __cdecl __debugbreak(void)
Definition: intrin_ppc.h:698
VOID NTAPI KeBugCheckEx(_In_ ULONG BugCheckCode, _In_ ULONG_PTR BugCheckParameter1, _In_ ULONG_PTR BugCheckParameter2, _In_ ULONG_PTR BugCheckParameter3, _In_ ULONG_PTR BugCheckParameter4)
Definition: rtlcompat.c:108

Referenced by ConMgrProcessInputLine().

◆ DoFullInfoCommand()

VOID NTAPI DoFullInfoCommand ( VOID  )

Definition at line 409 of file concmd.c.

410{
411 /* Flip the flag */
413
414 /* Print out the new state */
416}
BOOLEAN GlobalDoThreads
Definition: conmgr.c:35
BOOLEAN NTAPI SacPutSimpleMessage(IN ULONG MessageIndex)
Definition: conmgr.c:57

Referenced by ConMgrProcessInputLine().

◆ DoGetNetInfo()

VOID NTAPI DoGetNetInfo ( IN BOOLEAN  DoPrint)

Definition at line 557 of file concmd.c.

558{
559 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
560}

◆ DoHelpCommand()

VOID NTAPI DoHelpCommand ( VOID  )

Definition at line 529 of file concmd.c.

530{
531 ULONG Count = 0;
532
533 /* Print out all the help messages */
534 if (!PrintHelpMessage(112, &Count)) return;
535 if (!PrintHelpMessage(12, &Count)) return;
536 if (!PrintHelpMessage(13, &Count)) return;
537 if (!PrintHelpMessage(14, &Count)) return;
538 if (!PrintHelpMessage(15, &Count)) return;
539 if (!PrintHelpMessage(16, &Count)) return;
540 if (!PrintHelpMessage(31, &Count)) return;
541 if (!PrintHelpMessage(18, &Count)) return;
542 if (!PrintHelpMessage(19, &Count)) return;
543 if (!PrintHelpMessage(32, &Count)) return;
544 if (!PrintHelpMessage(20, &Count)) return;
545 if (!PrintHelpMessage(21, &Count)) return;
546 if (!PrintHelpMessage(22, &Count)) return;
547 if (!PrintHelpMessage(23, &Count)) return;
548 if (!PrintHelpMessage(24, &Count)) return;
549 if (!PrintHelpMessage(25, &Count)) return;
550 if (!PrintHelpMessage(27, &Count)) return;
551 if (!PrintHelpMessage(28, &Count)) return;
552 if (!PrintHelpMessage(29, &Count)) return;
553}
FORCEINLINE BOOLEAN PrintHelpMessage(IN ULONG MessageId, IN OUT PULONG Count)
Definition: concmd.c:505
int Count
Definition: noreturn.cpp:7
uint32_t ULONG
Definition: typedefs.h:59

Referenced by ConMgrProcessInputLine().

◆ DoKillCommand()

VOID NTAPI DoKillCommand ( IN PCHAR  KillString)

Definition at line 438 of file concmd.c.

439{
440 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
441}

Referenced by ConMgrProcessInputLine().

◆ DoLimitMemoryCommand()

VOID NTAPI DoLimitMemoryCommand ( IN PCHAR  LimitString)

Definition at line 459 of file concmd.c.

460{
461 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
462}

Referenced by ConMgrProcessInputLine().

◆ DoLockCommand()

VOID NTAPI DoLockCommand ( VOID  )

Definition at line 498 of file concmd.c.

499{
500 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
501}

Referenced by ConMgrProcessInputLine().

◆ DoLowerPriorityCommand()

VOID NTAPI DoLowerPriorityCommand ( IN PCHAR  PrioString)

Definition at line 445 of file concmd.c.

446{
447 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
448}

Referenced by ConMgrProcessInputLine().

◆ DoMachineInformationCommand()

VOID NTAPI DoMachineInformationCommand ( VOID  )

Definition at line 477 of file concmd.c.

478{
479 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
480}

Referenced by ConMgrProcessInputLine().

◆ DoPagingCommand()

VOID NTAPI DoPagingCommand ( VOID  )

Definition at line 420 of file concmd.c.

421{
422 /* Flip the flag */
424
425 /* Print out the new state */
427}
BOOLEAN GlobalPagingNeeded
Definition: conmgr.c:35

Referenced by ConMgrProcessInputLine().

◆ DoRaisePriorityCommand()

VOID NTAPI DoRaisePriorityCommand ( IN PCHAR  PrioString)

Definition at line 452 of file concmd.c.

453{
454 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
455}

Referenced by ConMgrProcessInputLine().

◆ DoRebootCommand()

VOID NTAPI DoRebootCommand ( IN BOOLEAN  Reboot)

Definition at line 355 of file concmd.c.

356{
357 LARGE_INTEGER Timeout, TickCount;
360 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Entering.\n");
361
362 /* Get the current time now, and setup a timeout in 1 second */
363 KeQueryTickCount(&TickCount);
364 Timeout.QuadPart = TickCount.QuadPart / (10000000 / KeQueryTimeIncrement());
365
366 /* Check if the timeout is small enough */
367 if (Timeout.QuadPart < 60 )
368 {
369 /* Show the prompt */
371 SAC_RESTART_PROMPT : SAC_SHUTDOWN_PROMPT,
372 TRUE);
373
374 /* Do the wait */
376 Timeout.QuadPart = -10000000 * (60 - Timeout.LowPart);
378 }
379
380 /* Do a shutdown or a reboot, based on the request */
382
383 /* Check if anyone in the command channel already allocated this */
384 if (!GlobalBuffer)
385 {
386 /* Allocate it */
388 if (!GlobalBuffer)
389 {
390 /* We need the global buffer, bail out without it*/
391 SacPutSimpleMessage(SAC_OUT_OF_MEMORY_PROMPT);
392 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting (1).\n");
393 return;
394 }
395
396 /* Set the size of the buffer */
398 }
399
400 /* We came back from a reboot, this doesn't make sense, tell the user */
401 SacPutSimpleMessage(Reboot ? SAC_RESTART_FAIL_PROMPT : SAC_SHUTDOWN_FAIL_PROMPT);
402 swprintf(GlobalBuffer, GetMessage(SAC_FAIL_PROMPT), Status);
404 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoRebootCommand: Exiting.\n");
405}
LONG NTSTATUS
Definition: precomp.h:26
@ Reboot
Definition: bl.h:891
PVOID GlobalBuffer
Definition: concmd.c:17
ULONG GlobalBufferSize
Definition: concmd.c:18
BOOLEAN NTAPI ConMgrSimpleEventMessage(IN ULONG MessageIndex, IN BOOLEAN LockHeld)
Definition: conmgr.c:252
VOID NTAPI SacPutString(IN PWCHAR String)
Definition: conmgr.c:41
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define swprintf
Definition: precomp.h:40
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Status
Definition: gdiplustypes.h:25
#define KernelMode
Definition: asm.h:34
@ ShutdownReboot
Definition: extypes.h:177
@ ShutdownPowerOff
Definition: extypes.h:178
@ SynchronizationEvent
NTSTATUS NTAPI NtShutdownSystem(IN SHUTDOWN_ACTION Action)
Definition: shutdown.c:43
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
static ULONG Timeout
Definition: ping.c:61
#define SacAllocatePool(Length, Tag)
Definition: sacdrv.h:24
#define GLOBAL_BLOCK_TAG
Definition: sacdrv.h:142
#define KeQueryTickCount(CurrentCount)
Definition: ke.h:43
LONGLONG QuadPart
Definition: typedefs.h:114
#define GetMessage
Definition: winuser.h:5790
@ Executive
Definition: ketypes.h:415

Referenced by ConMgrWorkerProcessEvents().

◆ DoSetIpAddressCommand()

VOID NTAPI DoSetIpAddressCommand ( IN PCHAR  IpString)

Definition at line 564 of file concmd.c.

565{
566 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
567}

Referenced by ConMgrProcessInputLine().

◆ DoSetTimeCommand()

VOID NTAPI DoSetTimeCommand ( IN PCHAR  InputTime)

Definition at line 431 of file concmd.c.

432{
433 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering\n");
434}

Referenced by ConMgrProcessInputLine().

◆ DoTlistCommand()

VOID NTAPI DoTlistCommand ( VOID  )

Definition at line 571 of file concmd.c.

572{
574 PVOID NewGlobalBuffer;
575 ULONG Size;
576 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoTlistCommand: Entering.\n");
577
578 /* Check if a global buffer already exists */
579 if (!GlobalBuffer)
580 {
581 /* It doesn't, allocate one */
583 if (GlobalBuffer)
584 {
585 /* Remember its current size */
586 GlobalBufferSize = 4096;
587 }
588 else
589 {
590 /* Out of memory, bail out */
592 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoTlistCommand: Exiting.\n");
593 return;
594 }
595 }
596
597 /* Loop as long as the buffer is too small */
598 while (TRUE)
599 {
600 /* Get the process list */
602 if ((Status != STATUS_NO_MEMORY) &&
604 {
605 /* It fits! Bail out */
606 break;
607 }
608
609 /* We need a new bigger buffer */
610 NewGlobalBuffer = SacAllocatePool(GlobalBufferSize + 4096,
612 if (!NewGlobalBuffer)
613 {
614 /* Out of memory, bail out */
616 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoTlistCommand: Exiting.\n");
617 return;
618 }
619
620 /* Free the old one, update state */
622 GlobalBufferSize += 4096;
623 GlobalBuffer = NewGlobalBuffer;
624 }
625
626 /* Did we get here because we have the whole list? */
627 if (!NT_SUCCESS(Status))
628 {
629 /* Nope, print out a failure message */
633 }
634 else
635 {
636 /* Yep, print out the list */
638 }
639
640 SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC DoTlistCommand: Exiting.\n");
641}
VOID NTAPI PrintTListInfo(IN PSAC_SYSTEM_INFORMATION SacInfo)
Definition: concmd.c:312
NTSTATUS NTAPI GetTListInfo(IN PSAC_SYSTEM_INFORMATION SacInfo, IN ULONG InputSize, OUT PULONG TotalSize)
Definition: concmd.c:76
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_NO_MEMORY
Definition: ntstatus.h:260
#define SacFreePool(Pointer)
Definition: sacdrv.h:26
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533

Referenced by ConMgrProcessInputLine().

◆ GetTListInfo()

NTSTATUS NTAPI GetTListInfo ( IN PSAC_SYSTEM_INFORMATION  SacInfo,
IN ULONG  InputSize,
OUT PULONG  TotalSize 
)

Definition at line 76 of file concmd.c.

79{
81 ULONG BufferLength, ReturnLength, RemainingSize;
85 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Entering.\n");
86
87 /* Assume failure */
88 *TotalSize = 0;
89
90 /* Bail out if the buffer is way too small */
91 if (InputSize < 4)
92 {
93 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory.\n");
94 return STATUS_NO_MEMORY;
95 }
96
97 /* Make sure it's at least big enough to hold the static structure */
98 BufferLength = InputSize - sizeof(SAC_SYSTEM_INFORMATION);
99 if (InputSize < sizeof(SAC_SYSTEM_INFORMATION))
100 {
101 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory (2).\n");
102 return STATUS_NO_MEMORY;
103 }
104
105 /* Query the time */
107 &SacInfo->TimeInfo,
108 sizeof(SacInfo->TimeInfo),
109 NULL);
110 if (!NT_SUCCESS(Status))
111 {
112 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error.\n");
113 return Status;
114 }
115
116 /* Query basic information */
118 &SacInfo->BasicInfo,
119 sizeof(SacInfo->BasicInfo),
120 NULL);
121 if (!NT_SUCCESS(Status))
122 {
123 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error (2).\n");
124 return Status;
125 }
126
127 /* Now query the pagefile information, which comes right after */
128 P = (ULONG_PTR)(SacInfo + 1);
129 PageFileInfo = (PSYSTEM_PAGEFILE_INFORMATION)P;
131 PageFileInfo,
133 &ReturnLength);
134 if (!NT_SUCCESS(Status) || !(ReturnLength))
135 {
136 /* We failed -- is it because our buffer was too small? */
138 {
139 /* Bail out */
140 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory(5).\n");
141 return STATUS_NO_MEMORY;
142 }
143
144 /* Some other reason, assume the buffer is now full */
145 SacInfo->RemainingSize = 0;
146 }
147 else
148 {
149 /* This is the leftover data */
150 SacInfo->RemainingSize = InputSize - BufferLength;
151
152 /* This much has now been consumed, and where we are now */
154 P += ReturnLength;
155
156 /* Are we out of memory? */
157 if ((LONG)BufferLength < 0)
158 {
159 /* Bail out */
160 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory(3).\n");
161 return STATUS_NO_MEMORY;
162 }
163
164 /* All good, loop the pagefile data now */
165 while (TRUE)
166 {
167 /* Is the pagefile name too big to fit? */
168 if (PageFileInfo->PageFileName.Length > (LONG)BufferLength)
169 {
170 /* Bail out */
171 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error(3).\n");
173 }
174
175 /* Copy the name into our own buffer */
177 PageFileInfo->PageFileName.Buffer,
178 PageFileInfo->PageFileName.Length);
179 PageFileInfo->PageFileName.Buffer = (PWCHAR)P;
180
181 /* Update buffer lengths and offset */
182 BufferLength -= PageFileInfo->PageFileName.Length;
183 P += PageFileInfo->PageFileName.Length;
184
185 /* Are we out of memory? */
186 if ((LONG)BufferLength < 0)
187 {
188 /* Bail out */
189 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory(4).\n");
190 return STATUS_NO_MEMORY;
191 }
192
193 /* If this was the only pagefile, break out */
194 if (!PageFileInfo->NextEntryOffset) break;
195
196 /* Otherwise, move to the next one */
197 PageFileInfo = (PVOID)((ULONG_PTR)PageFileInfo +
198 PageFileInfo->NextEntryOffset);
199 }
200 }
201
202 /* Next, query the file cache information */
204 &SacInfo->CacheInfo,
205 sizeof(SacInfo->CacheInfo),
206 NULL);
207 if (!NT_SUCCESS(Status))
208 {
209 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error (4).\n");
210 return Status;
211 }
212
213 /* And then the performance information */
215 &SacInfo->PerfInfo,
216 sizeof(SacInfo->PerfInfo),
217 NULL);
218 if (!NT_SUCCESS(Status))
219 {
220 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error(5).\n");
221 return Status;
222 }
223
224 /* Finally, align the buffer to query process and thread information */
226 RemainingSize = (ULONG_PTR)SacInfo + InputSize - P;
227
228 /* Are we out of memory? */
229 if ((LONG)RemainingSize < 0)
230 {
231 /* Bail out */
232 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory (6).\n");
233 return STATUS_NO_MEMORY;
234 }
235
236 /* Now query the processes and threads */
237 ProcessInfo = (PSYSTEM_PROCESS_INFORMATION)P;
239 ProcessInfo,
240 RemainingSize,
241 &ReturnLength);
242 if (!NT_SUCCESS(Status))
243 {
244 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error(6).\n");
245 return Status;
246 }
247
248 /* The first process name will be right after this buffer */
249 P += ReturnLength;
250
251 /* The caller should look for process info over here */
252 SacInfo->ProcessDataOffset = InputSize - RemainingSize;
253
254 /* This is how much buffer data we have left -- are we out? */
255 BufferLength = RemainingSize - ReturnLength;
256 if ((LONG)BufferLength < 0)
257 {
258 /* Bail out */
259 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory(7).\n");
260 return STATUS_NO_MEMORY;
261 }
262
263 /* All good and ready to parse the process and thread list */
264 while (TRUE)
265 {
266 /* Does the process have a name? */
267 if (ProcessInfo->ImageName.Buffer)
268 {
269 /* Is the process name too big to fit? */
270 if ((LONG)BufferLength < ProcessInfo->ImageName.Length)
271 {
272 /* Bail out */
273 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, error(7).\n");
275 }
276
277 /* Copy the name into our own buffer */
279 ProcessInfo->ImageName.Buffer,
280 ProcessInfo->ImageName.Length);
281 ProcessInfo->ImageName.Buffer = (PWCHAR)P;
282
283 /* Update buffer lengths and offset */
284 BufferLength -= ProcessInfo->ImageName.Length;
285 P += ProcessInfo->ImageName.Length;
286
287 /* Are we out of memory? */
288 if ((LONG)BufferLength < 0)
289 {
290 /* Bail out */
291 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting, no memory(8).\n");
292 return STATUS_NO_MEMORY;
293 }
294 }
295
296 /* If this was the only process, break out */
297 if (!ProcessInfo->NextEntryOffset) break;
298
299 /* Otherwise, move to the next one */
300 ProcessInfo = (PVOID)((ULONG_PTR)ProcessInfo +
301 ProcessInfo->NextEntryOffset);
302 }
303
304 /* All done! */
305 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Exiting.\n");
306 *TotalSize = InputSize - BufferLength;
307 return STATUS_SUCCESS;
308}
struct _SAC_SYSTEM_INFORMATION SAC_SYSTEM_INFORMATION
#define NULL
Definition: types.h:112
#define P(row, col)
#define ULONG_PTR
Definition: config.h:101
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
NTSYSAPI NTSTATUS NTAPI ZwQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
@ SystemTimeOfDayInformation
Definition: ntddk_ex.h:14
@ SystemBasicInformation
Definition: ntddk_ex.h:11
@ SystemFileCacheInformation
Definition: ntddk_ex.h:32
@ SystemProcessInformation
Definition: ntddk_ex.h:16
@ SystemPageFileInformation
Definition: ntddk_ex.h:29
#define SystemPerformanceInformation
Definition: memtest.h:87
static const char * ImageName
Definition: image.c:34
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
struct _SYSTEM_PAGEFILE_INFORMATION * PSYSTEM_PAGEFILE_INFORMATION
long LONG
Definition: pedump.c:60
#define STATUS_SUCCESS
Definition: shellext.h:65
UNICODE_STRING PageFileName
Definition: extypes.h:1075
UNICODE_STRING ImageName
Definition: extypes.h:902
void * PVOID
Definition: typedefs.h:50
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
#define ALIGN_UP(size, type)
Definition: umtypes.h:91
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771

Referenced by DoTlistCommand().

◆ PrintHelpMessage()

FORCEINLINE BOOLEAN PrintHelpMessage ( IN ULONG  MessageId,
IN OUT PULONG  Count 
)

Definition at line 505 of file concmd.c.

507{
508 BOOLEAN ScreenFull;
509 ULONG NewCount;
510
511 /* Get the amount of lines this message will take */
512 NewCount = GetMessageLineCount(MessageId);
513 if ((NewCount + *Count) > SAC_VTUTF8_ROW_HEIGHT)
514 {
515 /* We are going to overflow the screen, wait for input */
516 PutMore(&ScreenFull);
517 if (ScreenFull) return FALSE;
518 *Count = 0;
519 }
520
521 /* Print out the message and update the amount of lines printed */
522 SacPutSimpleMessage(MessageId);
523 *Count += NewCount;
524 return TRUE;
525}
unsigned char BOOLEAN
VOID NTAPI PutMore(OUT PBOOLEAN ScreenFull)
Definition: concmd.c:322
ULONG NTAPI GetMessageLineCount(IN ULONG MessageIndex)
Definition: util.c:1233
#define SAC_VTUTF8_ROW_HEIGHT
Definition: sacdrv.h:159

Referenced by DoHelpCommand().

◆ PrintTListInfo()

VOID NTAPI PrintTListInfo ( IN PSAC_SYSTEM_INFORMATION  SacInfo)

Definition at line 312 of file concmd.c.

313{
314 SAC_DBG(SAC_DBG_ENTRY_EXIT, "Testing: %d %d %I64d\n",
315 SacInfo->BasicInfo.NumberOfPhysicalPages,
316 SacInfo->PerfInfo.AvailablePages,
317 SacInfo->TimeInfo.BootTime);
318}

Referenced by DoTlistCommand().

◆ PutMore()

VOID NTAPI PutMore ( OUT PBOOLEAN  ScreenFull)

Definition at line 322 of file concmd.c.

323{
324 *ScreenFull = FALSE;
325}

Referenced by PrintHelpMessage().

◆ RetrieveIpAddressFromString()

BOOLEAN RetrieveIpAddressFromString ( IN PWCHAR  IpString,
OUT PULONG  IpAddress 
)

Definition at line 328 of file concmd.c.

332{
333 return FALSE;
334}

Variable Documentation

◆ GlobalBuffer

PVOID GlobalBuffer

Definition at line 17 of file concmd.c.

Referenced by DoRebootCommand(), and DoTlistCommand().

◆ GlobalBufferSize

ULONG GlobalBufferSize

Definition at line 18 of file concmd.c.

Referenced by DoRebootCommand(), and DoTlistCommand().