ReactOS 0.4.17-dev-497-g795f69c
sysinfo.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: ntoskrnl/ex/sysinfo.c
5 * PURPOSE: System information functions
6 *
7 * PROGRAMMERS: David Welch (welch@mcmail.com)
8 * Aleksey Bragin (aleksey@reactos.org)
9 */
10
11/* INCLUDES *****************************************************************/
12
13#include <ntoskrnl.h>
14#include <wmidata.h>
15#include <wmistr.h>
16#define NDEBUG
17#include <debug.h>
18
19/* The maximum size of an environment value (in bytes) */
20#define MAX_ENVVAL_SIZE 1024
21
22#define SIG_ACPI 0x41435049
23#define SIG_FIRM 0x4649524D
24#define SIG_RSMB 0x52534D42
25
28
32
38{
39 PCHAR p;
42
43 /* Fill it out */
44 ModuleInfo->MappedBase = NULL;
45 ModuleInfo->ImageBase = LdrEntry->DllBase;
46 ModuleInfo->ImageSize = LdrEntry->SizeOfImage;
47 ModuleInfo->Flags = LdrEntry->Flags;
48 ModuleInfo->LoadCount = LdrEntry->LoadCount;
49 ModuleInfo->LoadOrderIndex = (USHORT)ModuleCount;
50 ModuleInfo->InitOrderIndex = 0;
51
52 /* Setup name */
53 RtlInitEmptyAnsiString(&ModuleName,
55 sizeof(ModuleInfo->FullPathName));
56
57 /* Convert it */
59 &LdrEntry->FullDllName,
60 FALSE);
62 {
63 /* Calculate offset to name */
64 p = ModuleName.Buffer + ModuleName.Length;
65 while ((p > ModuleName.Buffer) && (*--p))
66 {
67 /* Check if we found the separator */
69 {
70 /* We did, break out */
71 p++;
72 break;
73 }
74 }
75
76 /* Set the offset */
77 ModuleInfo->OffsetToFileName = (USHORT)(p - ModuleName.Buffer);
78 }
79 else
80 {
81 /* Return empty name */
83 ModuleInfo->OffsetToFileName = 0;
84 }
85
86 return Status;
87}
88
92 IN PLIST_ENTRY UserModeList,
96{
100 PLDR_DATA_TABLE_ENTRY LdrEntry;
101 ULONG ModuleCount = 0;
102 PLIST_ENTRY NextEntry;
103
104 /* Setup defaults */
106 ModuleInfo = &Modules->Modules[0];
107
108 /* Loop the kernel list */
109 NextEntry = KernelModeList->Flink;
110 while (NextEntry != KernelModeList)
111 {
112 /* Get the entry */
113 LdrEntry = CONTAINING_RECORD(NextEntry,
115 InLoadOrderLinks);
116
117 /* Update size and check if we can manage one more entry */
119 if (Length >= RequiredLength)
120 {
122 LdrEntry,
123 ModuleInfo);
124
125 /* Go to the next module */
126 ModuleInfo++;
127 }
128 else
129 {
130 /* Set error code */
132 }
133
134 /* Update count and move to next entry */
135 ModuleCount++;
136 NextEntry = NextEntry->Flink;
137 }
138
139 /* Check if caller also wanted user modules */
140 if (UserModeList)
141 {
142 NextEntry = UserModeList->Flink;
143 while (NextEntry != UserModeList)
144 {
145 /* Get the entry */
146 LdrEntry = CONTAINING_RECORD(NextEntry,
148 InLoadOrderLinks);
149
150 /* Update size and check if we can manage one more entry */
152 if (Length >= RequiredLength)
153 {
155 LdrEntry,
156 ModuleInfo);
157
158 /* Go to the next module */
159 ModuleInfo++;
160 }
161 else
162 {
163 /* Set error code */
165 }
166
167 /* Update count and move to next entry */
168 ModuleCount++;
169 NextEntry = NextEntry->Flink;
170 }
171 }
172
173 /* Update return length */
175
176 /* Validate the length again */
177 if (Length >= FIELD_OFFSET(RTL_PROCESS_MODULES, Modules))
178 {
179 /* Set the final count */
180 Modules->NumberOfModules = ModuleCount;
181 }
182 else
183 {
184 /* Otherwise, we failed */
186 }
187
188 /* Done */
189 return Status;
190}
191
192VOID
193NTAPI
195{
198}
199
201NTAPI
207 PVOID *MappedSystemVa,
208 PMDL *OutMdl)
209{
210 PMDL Mdl;
212
213 *MappedSystemVa = NULL;
214 *OutMdl = NULL;
215
216 /* Allocate an MDL for the buffer */
218 if (Mdl == NULL)
219 {
221 }
222
223 /* Enter SEH for probing */
225 {
227 }
229 {
232 }
233 _SEH2_END;
234
235 /* Return the safe kernel mode buffer */
237 if (*MappedSystemVa == NULL)
238 {
241 }
242
243 /* Return the MDL */
244 *OutMdl = Mdl;
245 return STATUS_SUCCESS;
246}
247
249NTAPI
252 _Out_ ULONG * OutSize,
254{
256 PVOID DataBlockObject;
257 PWNODE_ALL_DATA AllData;
258 ULONG WMIBufSize;
259
260 ASSERT(OutSize != NULL);
261 *OutSize = 0;
262
263 /* Open the data block object for the SMBIOS table */
266 &DataBlockObject);
267 if (!NT_SUCCESS(Status))
268 {
269 DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
270 return Status;
271 }
272
273 /* Query the required buffer size */
274 WMIBufSize = 0;
275 Status = IoWMIQueryAllData(DataBlockObject, &WMIBufSize, NULL);
276 if (!NT_SUCCESS(Status))
277 {
278 DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
279 return Status;
280 }
281
282 AllData = ExAllocatePoolWithTag(PagedPool, WMIBufSize, 'itfS');
283 if (AllData == NULL)
284 {
285 DPRINT1("Failed to allocate %lu bytes for SMBIOS tables\n", WMIBufSize);
287 }
288
289 /* Query the buffer data */
290 Status = IoWMIQueryAllData(DataBlockObject, &WMIBufSize, AllData);
291 if (!NT_SUCCESS(Status))
292 {
293 DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
294 ExFreePoolWithTag(AllData, 'itfS');
295 return Status;
296 }
297
299 *OutSize = AllData->FixedInstanceSize;
300 if (Buffer != NULL)
301 {
302 if (BufferSize >= *OutSize)
303 {
304 RtlMoveMemory(Buffer, AllData + 1, *OutSize);
305 }
306 else
307 {
309 }
310 }
311
312 /* Free the buffer */
313 ExFreePoolWithTag(AllData, 'itfS');
314 return Status;
315}
316
317/* FUNCTIONS *****************************************************************/
318
319/*
320 * @implemented
321 */
322VOID
323NTAPI
325{
326 PKPRCB Prcb;
327 ULONG TotalTime;
328 ULONGLONG ScaledIdle;
329
330 Prcb = KeGetCurrentPrcb();
331
332 ScaledIdle = (ULONGLONG)Prcb->IdleThread->KernelTime * 100;
333 TotalTime = Prcb->KernelTime + Prcb->UserTime;
334 if (TotalTime != 0)
335 *CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime));
336 else
337 *CpuUsage = 0;
338}
339
340/*
341 * @implemented
342 */
343VOID
344NTAPI
346 PULONG KernelAndUserTime,
347 PULONG ProcessorNumber)
348{
349 PKPRCB Prcb;
350
351 Prcb = KeGetCurrentPrcb();
352
353 *IdleTime = Prcb->IdleThread->KernelTime;
354 *KernelAndUserTime = Prcb->KernelTime + Prcb->UserTime;
355 *ProcessorNumber = (ULONG)Prcb->Number;
356}
357
358/*
359 * @implemented
360 */
362NTAPI
364{
365 /* Quick check to see if it exists at all */
366 if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return(FALSE);
367
368 /* Return our support for it */
369 return(SharedUserData->ProcessorFeatures[ProcessorFeature]);
370}
371
372/*
373 * @implemented
374 */
376NTAPI
378{
379 if (SuiteType == Personal) return TRUE;
380 return FALSE;
381}
382
384NTAPI
386 OUT PWSTR ValueBuffer,
387 IN ULONG ValueBufferLength,
389{
390 ANSI_STRING AName;
391 UNICODE_STRING WName;
393 PCH AnsiValueBuffer;
394 ANSI_STRING AValue;
395 UNICODE_STRING WValue;
398 PAGED_CODE();
399
400 /* Check if the call came from user mode */
403 {
405 {
406 /* Probe the input and output buffers */
407 ProbeForRead(VariableName, sizeof(UNICODE_STRING), sizeof(ULONG));
408 ProbeForWrite(ValueBuffer, ValueBufferLength, sizeof(WCHAR));
410 }
412 {
413 /* Return the exception code */
415 }
416 _SEH2_END;
417 }
418
419 /* According to NTInternals the SeSystemEnvironmentName privilege is required! */
421 {
422 DPRINT1("NtQuerySystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
424 }
425
426 /* Copy the name to kernel space if necessary */
427 Status = ProbeAndCaptureUnicodeString(&WName, PreviousMode, VariableName);
428 if (!NT_SUCCESS(Status)) return Status;
429
430 /* Convert the name to ANSI and release the captured UNICODE string */
431 Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE);
433 if (!NT_SUCCESS(Status)) return Status;
434
435 /* Allocate a buffer for the ANSI environment variable */
436 AnsiValueBuffer = ExAllocatePoolWithTag(NonPagedPool, MAX_ENVVAL_SIZE, 'rvnE');
437 if (AnsiValueBuffer == NULL)
438 {
439 RtlFreeAnsiString(&AName);
441 }
442
443 /* Get the environment variable and free the ANSI name */
446 AnsiValueBuffer);
447 RtlFreeAnsiString(&AName);
448
449 /* Check if we had success */
450 if (Result == ESUCCESS)
451 {
452 /* Copy the result back to the caller. */
454 {
455 /* Initialize ANSI string from the result */
456 RtlInitAnsiString(&AValue, AnsiValueBuffer);
457
458 /* Initialize a UNICODE string from the callers buffer */
459 RtlInitEmptyUnicodeString(&WValue, ValueBuffer, (USHORT)ValueBufferLength);
460
461 /* Convert the result to UNICODE */
462 Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
463
464 if (ReturnLength != NULL)
465 *ReturnLength = WValue.Length;
466 }
468 {
470 }
471 _SEH2_END;
472 }
473 else
474 {
476 }
477
478 /* Free the allocated ANSI value buffer */
479 ExFreePoolWithTag(AnsiValueBuffer, 'rvnE');
480
481 return Status;
482}
483
484
486NTAPI
489{
490 UNICODE_STRING CapturedName, CapturedValue;
491 ANSI_STRING AName, AValue;
494
495 PAGED_CODE();
496
498
499 /*
500 * Copy the strings to kernel space if necessary
501 */
502 Status = ProbeAndCaptureUnicodeString(&CapturedName,
504 VariableName);
505 if (NT_SUCCESS(Status))
506 {
507 Status = ProbeAndCaptureUnicodeString(&CapturedValue,
509 Value);
510 if (NT_SUCCESS(Status))
511 {
512 /*
513 * according to ntinternals the SeSystemEnvironmentName privilege is required!
514 */
517 {
518 /*
519 * convert the strings to ANSI
520 */
522 &CapturedName,
523 TRUE);
524 if (NT_SUCCESS(Status))
525 {
527 &CapturedValue,
528 TRUE);
529 if (NT_SUCCESS(Status))
530 {
532 AValue.Buffer);
533
535 }
536 }
537 }
538 else
539 {
540 DPRINT1("NtSetSystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
542 }
543
544 ReleaseCapturedUnicodeString(&CapturedValue,
546 }
547
548 ReleaseCapturedUnicodeString(&CapturedName,
550 }
551
552 return Status;
553}
554
556NTAPI
560{
563}
564
566NTAPI
568 _In_ PUNICODE_STRING VariableName,
569 _In_ LPGUID VendorGuid,
573{
576}
577
579NTAPI
581 _In_ PUNICODE_STRING VariableName,
582 _In_ LPGUID VendorGuid,
586{
589}
590
591/* --- Query/Set System Information --- */
592
593/*
594 * NOTE: QSI_DEF(n) and SSI_DEF(n) define _cdecl function symbols
595 * so the stack is popped only in one place on x86 platform.
596 */
597#define QSI_USE(n) QSI##n
598#define QSI_DEF(n) \
599static NTSTATUS QSI_USE(n) (PVOID Buffer, ULONG Size, PULONG ReqSize)
600
601#define SSI_USE(n) SSI##n
602#define SSI_DEF(n) \
603static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
604
605VOID
606NTAPI
607ExQueryPoolUsage(OUT PULONG PagedPoolPages,
608 OUT PULONG NonPagedPoolPages,
609 OUT PULONG PagedPoolAllocs,
610 OUT PULONG PagedPoolFrees,
611 OUT PULONG PagedPoolLookasideHits,
612 OUT PULONG NonPagedPoolAllocs,
613 OUT PULONG NonPagedPoolFrees,
614 OUT PULONG NonPagedPoolLookasideHits);
615
616/* Class 0 - Basic Information */
618{
621
622 *ReqSize = sizeof(SYSTEM_BASIC_INFORMATION);
623
624 /* Check user buffer's size */
625 if (Size != sizeof(SYSTEM_BASIC_INFORMATION))
626 {
628 }
629
630 RtlZeroMemory(Sbi, Size);
631 Sbi->Reserved = 0;
633 Sbi->PageSize = PAGE_SIZE;
637 Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
638 Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */
642
643 return STATUS_SUCCESS;
644}
645
646/* Class 1 - Processor Information */
648{
651
652 *ReqSize = sizeof(SYSTEM_PROCESSOR_INFORMATION);
653
654 /* Check user buffer's size */
656 {
658 }
662#if (NTDDI_VERSION < NTDDI_WIN8)
663 Spi->Reserved = 0;
664#else
665 Spi->MaximumProcessors = 0;
666#endif
667
668 /* According to Geoff Chappell, on Win 8.1 x64 / Win 10 x86, where this
669 field is extended to 64 bits, it continues to produce only the low 32
670 bits. For the full value, use SYSTEM_PROCESSOR_FEATURES_INFORMATION.
671 See https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/processor.htm
672 */
674
675 DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
677
678 return STATUS_SUCCESS;
679}
680
681/* Class 2 - Performance Information */
683{
684 LONG i;
685 ULONG IdleUser, IdleKernel;
686 PKPRCB Prcb;
689
691
692 *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
693
694 /* Check user buffer's size */
696 {
698 }
699
701
702 IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
710 for (i = 0; i < KeNumberProcessors; i ++)
711 {
712 Prcb = KiProcessorBlock[i];
713 if (Prcb)
714 {
721 }
722 }
723
725
727 /*
728 * Add up the full system total + pagefile.
729 * All this make Taskmgr happy but not sure it is the right numbers.
730 * This too, fixes some of GlobalMemoryStatusEx numbers.
731 */
733
735 Spi->PageFaultCount = 0; /* FIXME */
736 Spi->CopyOnWriteCount = 0; /* FIXME */
737 Spi->TransitionCount = 0; /* FIXME */
738 Spi->CacheTransitionCount = 0; /* FIXME */
739 Spi->DemandZeroCount = 0; /* FIXME */
740 Spi->PageReadCount = 0; /* FIXME */
741 Spi->PageReadIoCount = 0; /* FIXME */
742 Spi->CacheReadCount = 0; /* FIXME */
743 Spi->CacheIoCount = 0; /* FIXME */
744 Spi->DirtyPagesWriteCount = 0; /* FIXME */
745 Spi->DirtyWriteIoCount = 0; /* FIXME */
746 Spi->MappedPagesWriteCount = 0; /* FIXME */
747 Spi->MappedWriteIoCount = 0; /* FIXME */
748
749 Spi->PagedPoolPages = 0;
750 Spi->NonPagedPoolPages = 0;
751 Spi->PagedPoolAllocs = 0;
752 Spi->PagedPoolFrees = 0;
753 Spi->PagedPoolLookasideHits = 0;
754 Spi->NonPagedPoolAllocs = 0;
755 Spi->NonPagedPoolFrees = 0;
758 &Spi->NonPagedPoolPages,
759 &Spi->PagedPoolAllocs,
760 &Spi->PagedPoolFrees,
762 &Spi->NonPagedPoolAllocs,
763 &Spi->NonPagedPoolFrees,
765 Spi->FreeSystemPtes = 0; /* FIXME */
766
767 Spi->ResidentSystemCodePage = 0; /* FIXME */
768
769 Spi->TotalSystemDriverPages = 0; /* FIXME */
770 Spi->Spare3Count = 0; /* FIXME */
771
773 Spi->ResidentPagedPoolPage = 0; /* FIXME */
774
775 Spi->ResidentSystemDriverPage = 0; /* FIXME */
776 Spi->CcFastReadNoWait = 0; /* FIXME */
777 Spi->CcFastReadWait = 0; /* FIXME */
778 Spi->CcFastReadResourceMiss = 0; /* FIXME */
779 Spi->CcFastReadNotPossible = 0; /* FIXME */
780
781 Spi->CcFastMdlReadNoWait = 0; /* FIXME */
782 Spi->CcFastMdlReadWait = 0; /* FIXME */
783 Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
784 Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
785
788 Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
789 Spi->CcMapDataWaitMiss = 0; /* FIXME */
790
794 Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
795 Spi->CcPinReadWaitMiss = 0; /* FIXME */
796 Spi->CcCopyReadNoWait = 0; /* FIXME */
797 Spi->CcCopyReadWait = 0; /* FIXME */
798 Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
799 Spi->CcCopyReadWaitMiss = 0; /* FIXME */
800
801 Spi->CcMdlReadNoWait = 0; /* FIXME */
802 Spi->CcMdlReadWait = 0; /* FIXME */
803 Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
804 Spi->CcMdlReadWaitMiss = 0; /* FIXME */
805 Spi->CcReadAheadIos = 0; /* FIXME */
810
811 Spi->ContextSwitches = 0;
812 Spi->FirstLevelTbFills = 0;
813 Spi->SecondLevelTbFills = 0;
814 Spi->SystemCalls = 0;
815 for (i = 0; i < KeNumberProcessors; i ++)
816 {
817 Prcb = KiProcessorBlock[i];
818 if (Prcb)
819 {
821 Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
822 Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
823 Spi->SystemCalls += Prcb->KeSystemCalls;
824 }
825 }
826
827 return STATUS_SUCCESS;
828}
829
830/* Class 3 - Time Of Day Information */
832{
834 LARGE_INTEGER CurrentTime;
835
836 /* Set amount of written information to 0 */
837 *ReqSize = 0;
838
839 /* Check user buffer's size */
841 {
843 }
844
845 /* Get current time */
846 KeQuerySystemTime(&CurrentTime);
847
848 /* Zero local buffer */
850
851 /* Fill local time structure */
852 Sti.BootTime= KeBootTime;
853 Sti.CurrentTime = CurrentTime;
856 Sti.Reserved = 0;
857
858 /* Copy as much as requested by caller */
859 RtlCopyMemory(Buffer, &Sti, Size);
860
861 /* Set amount of information we copied */
862 *ReqSize = Size;
863
864 return STATUS_SUCCESS;
865}
866
867/* Class 4 - Path Information (DEPRECATED) */
869{
870 /*
871 * Since NT 3.51, this information class is trivially implemented.
872 * The path to the NT directory is now stored in KUSER_SHARED_DATA
873 * as the NtSystemRoot member.
874 * Windows Checked builds show the following message and break to
875 * the debugger before failing the function as not implemented.
876 */
877#if DBG
878 DPRINT1("EX: SystemPathInformation now available via SharedUserData\n");
879 // DbgBreakPoint(); // Not needed in ReactOS.
880#endif
882}
883
884/* Class 5 - Process Information / 57 - SystemExtendedProcessInformation */
885static
890 _Out_ PULONG ReqSize,
891 _In_ BOOLEAN Extended)
892{
893 const ULONG ThreadInfoSize = Extended ? sizeof(SYSTEM_EXTENDED_THREAD_INFORMATION) : sizeof(SYSTEM_THREAD_INFORMATION);
897 PEPROCESS Process = NULL, SystemProcess;
898 PETHREAD CurrentThread;
900 ULONG CurrentSize;
901 USHORT ImageNameMaximumLength; // image name length in bytes
902 USHORT ImageNameLength;
903 PLIST_ENTRY CurrentEntry;
904 ULONG TotalSize = 0, ThreadsCount;
905 ULONG TotalUser, TotalKernel;
906 PUCHAR Current;
908 PUNICODE_STRING TempProcessImageName;
909 _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
910 PWCHAR szSrc;
911 BOOLEAN Overflow = FALSE;
912
914 {
915 /* scan the process list */
916
919
920 *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
921
922 /* Check for overflow */
923 if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
924 {
925 Overflow = TRUE;
926 }
927
928 /* Zero user's buffer */
929 if (!Overflow) RtlZeroMemory(Spi, Size);
930
931 SystemProcess = PsIdleProcess;
932 Process = SystemProcess;
933 Current = (PUCHAR) Spi;
934
935 do
936 {
937 SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
938
939 /* Lock the Process */
941 ExAcquirePushLockShared(&Process->ProcessLock);
942
943 if ((Process->ProcessExiting) &&
944 (Process->Pcb.Header.SignalState) &&
945 !(Process->ActiveThreads) &&
946 (IsListEmpty(&Process->Pcb.ThreadListHead)))
947 {
948 DPRINT1("Process %p (%s:%p) is a zombie\n",
949 Process, Process->ImageFileName, Process->UniqueProcessId);
950 CurrentSize = 0;
951 ImageNameMaximumLength = 0;
952
953 /* Unlock the Process */
954 ExReleasePushLockShared(&Process->ProcessLock);
956 goto Skip;
957 }
958
959 ThreadsCount = 0;
960 CurrentEntry = Process->Pcb.ThreadListHead.Flink;
961 while (CurrentEntry != &Process->Pcb.ThreadListHead)
962 {
963 CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
964 ThreadsCount++;
965 CurrentEntry = CurrentEntry->Flink;
966 }
967
968 // size of the structure for every process
969 CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + ThreadInfoSize * ThreadsCount;
970 ImageNameLength = 0;
971 Status = SeLocateProcessImageName(Process, &TempProcessImageName);
972 ProcessImageName = TempProcessImageName;
973 szSrc = NULL;
974 if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
975 {
976 szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
977 /* Loop the file name*/
978 while (szSrc > ProcessImageName->Buffer)
979 {
980 /* Make sure this isn't a backslash */
981 if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
982 {
983 szSrc++;
984 break;
985 }
986 else
987 {
988 ImageNameLength += sizeof(WCHAR);
989 }
990 }
991 }
992 if (!ImageNameLength && Process != PsIdleProcess)
993 {
994 ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
995 }
996
997 /* Round up the image name length as NT does */
998 if (ImageNameLength > 0)
999 ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
1000 else
1001 ImageNameMaximumLength = 0;
1002
1003 TotalSize += CurrentSize + ImageNameMaximumLength;
1004
1005 /* Check for overflow */
1006 if (TotalSize > Size)
1007 {
1008 Overflow = TRUE;
1009 }
1010
1011 /* Fill system information */
1012 if (!Overflow)
1013 {
1014 SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
1015 SpiCurrent->NumberOfThreads = ThreadsCount;
1016 SpiCurrent->CreateTime = Process->CreateTime;
1017 SpiCurrent->ImageName.Length = ImageNameLength;
1018 SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
1019 SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
1020
1021 /* Copy name to the end of the struct */
1022 if(Process != PsIdleProcess)
1023 {
1024 if (szSrc)
1025 {
1026 RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1027 }
1028 else
1029 {
1030 RtlInitAnsiString(&ImageName, Process->ImageFileName);
1032 if (!NT_SUCCESS(Status))
1033 {
1034 SpiCurrent->ImageName.Length = 0;
1035 }
1036 }
1037 }
1038 else
1039 {
1040 RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1041 }
1042
1043 SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1044 SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1045 SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1046
1047 /* PsIdleProcess shares its handle table with PsInitialSystemProcess,
1048 * so return the handle count for System only, not Idle one. */
1050
1051 SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1052 SpiCurrent->VirtualSize = Process->VirtualSize;
1053 SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1054 SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1055 SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1056 SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
1057 SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
1058 SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
1059 SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
1060 SpiCurrent->PagefileUsage = Process->QuotaUsage[PsPageFile];
1061 SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[PsPageFile];
1062 SpiCurrent->PrivatePageCount = Process->CommitCharge;
1063
1064 /* Now do the threads */
1065 ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1066 for (CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1067 CurrentEntry != &Process->Pcb.ThreadListHead;
1068 CurrentEntry = CurrentEntry->Flink)
1069 {
1070 CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1071
1072 ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1073 ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1074 ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1075 ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1076 ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1077 ThreadInfo->ClientId = CurrentThread->Cid;
1078 ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1079 ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1080 ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1081 ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1082 ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1083 if (Extended)
1084 {
1086 ThreadInfoEx->StackBase = CurrentThread->Tcb.StackBase;
1087 ThreadInfoEx->StackLimit = (PVOID)CurrentThread->Tcb.StackLimit;
1088 ThreadInfoEx->Win32StartAddress = (CurrentThread->Win32StartAddress ?
1089 CurrentThread->Win32StartAddress : CurrentThread->StartAddress);
1090 ThreadInfoEx->TebBase = CurrentThread->Tcb.Teb;
1091 }
1092
1094 }
1095
1096 /* Query total user/kernel times of a process */
1097 TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1098 SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1099 SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1100 }
1101
1102 if (ProcessImageName)
1103 {
1104 /* Release the memory allocated by SeLocateProcessImageName */
1105 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1106 ProcessImageName = NULL;
1107 }
1108
1109 /* Unlock the Process */
1110 ExReleasePushLockShared(&Process->ProcessLock);
1112
1113 /* Handle idle process entry */
1114Skip:
1116
1118 ThreadsCount = 0;
1119 if ((Process == SystemProcess) || (Process == NULL))
1120 {
1121 if (!Overflow)
1122 SpiCurrent->NextEntryOffset = 0;
1123 break;
1124 }
1125 else
1126 Current += CurrentSize + ImageNameMaximumLength;
1127 } while ((Process != SystemProcess) && (Process != NULL));
1128
1129 if(Process != NULL)
1132 }
1134 {
1135 if(Process != NULL)
1137 if (ProcessImageName)
1138 {
1139 /* Release the memory allocated by SeLocateProcessImageName */
1140 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1141 }
1142
1144 }
1145 _SEH2_END
1146
1147 if (Overflow)
1149
1150 *ReqSize = TotalSize;
1151 return Status;
1152}
1153
1154/* Class 5 - Process Information */
1156{
1158}
1159
1160/* Class 6 - Call Count Information */
1162{
1163 /* FIXME */
1164 DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1166}
1167
1168/* Class 7 - Device Information */
1170{
1173 PCONFIGURATION_INFORMATION ConfigInfo;
1174
1175 *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1176
1177 /* Check user buffer's size */
1178 if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1179 {
1181 }
1182
1183 ConfigInfo = IoGetConfigurationInformation();
1184
1185 Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1186 Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1187 Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1188 Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1189 Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1190 Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1191
1192 return STATUS_SUCCESS;
1193}
1194
1195/* Class 8 - Processor Performance Information */
1197{
1200
1201 LONG i;
1202 ULONG TotalTime;
1203 PKPRCB Prcb;
1204
1206
1207 /* Check user buffer's size */
1208 if (Size < *ReqSize)
1209 {
1211 }
1212
1213 for (i = 0; i < KeNumberProcessors; i++)
1214 {
1215 /* Get the PRCB on this processor */
1216 Prcb = KiProcessorBlock[i];
1217
1218 /* Calculate total user and kernel times */
1219 TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1225 Spi->InterruptCount = Prcb->InterruptCount;
1226 Spi++;
1227 }
1228
1229 return STATUS_SUCCESS;
1230}
1231
1232/* Class 9 - Flags Information */
1234{
1235#if (NTDDI_VERSION >= NTDDI_VISTA)
1236 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1237#endif
1238
1239 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1240 {
1242 }
1243
1245#if (NTDDI_VERSION < NTDDI_VISTA)
1246 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1247#endif
1248
1249 return STATUS_SUCCESS;
1250}
1251
1253{
1254 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1255 {
1257 }
1258
1260 {
1261#if (NTDDI_VERSION < NTDDI_WIN7)
1263#else
1264 return STATUS_ACCESS_DENIED;
1265#endif
1266 }
1267
1269 return STATUS_SUCCESS;
1270}
1271
1272/* Class 10 - Call Time Information */
1274{
1275 /* FIXME */
1276 DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1278}
1279
1280/* Class 11 - Module Information */
1282{
1284
1285 /* Acquire system module list lock */
1288
1289 /* Call the generic handler with the system module list */
1293 Size,
1294 ReqSize);
1295
1296 /* Release list lock and return status */
1299 return Status;
1300}
1301
1302/* Class 12 - Locks Information */
1304{
1305 /* FIXME */
1306 DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1308}
1309
1310/* Class 13 - Stack Trace Information */
1312{
1313 /* FIXME */
1314 DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1316}
1317
1318/* Class 14 - Paged Pool Information */
1320{
1321 /* FIXME */
1322 DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1324}
1325
1326/* Class 15 - Non Paged Pool Information */
1328{
1329 /* FIXME */
1330 DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1332}
1333
1334/* Class 16 - Handle Information */
1336{
1338 PLIST_ENTRY NextTableEntry;
1340 PHANDLE_TABLE_ENTRY HandleTableEntry;
1342 ULONG Index = 0;
1344 PMDL Mdl;
1345 PAGED_CODE();
1346
1347 DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1348
1349 /* Set initial required buffer size */
1350 *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1351
1352 /* Check user's buffer size */
1353 if (Size < *ReqSize)
1354 {
1356 }
1357
1358 /* We need to lock down the memory */
1360 Size,
1364 &Mdl);
1365 if (!NT_SUCCESS(Status))
1366 {
1367 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1368 return Status;
1369 }
1370
1371 /* Reset of count of handles */
1372 HandleInformation->NumberOfHandles = 0;
1373
1374 /* Enter a critical region */
1376
1377 /* Acquire the handle table lock */
1379
1380 /* Enumerate all system handles */
1381 for (NextTableEntry = HandleTableListHead.Flink;
1382 NextTableEntry != &HandleTableListHead;
1383 NextTableEntry = NextTableEntry->Flink)
1384 {
1385 /* Get current handle table */
1386 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1387
1388 /* Set the initial value and loop the entries */
1389 Handle.Value = 0;
1390 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1391 {
1392 /* Validate the entry */
1393 if ((HandleTableEntry->Object) &&
1394 (HandleTableEntry->NextFreeTableEntry != -2))
1395 {
1396 /* Increase of count of handles */
1397 ++HandleInformation->NumberOfHandles;
1398
1399 /* Lock the entry */
1400 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1401 {
1402 /* Increase required buffer size */
1403 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1404
1405 /* Check user's buffer size */
1406 if (*ReqSize > Size)
1407 {
1409 }
1410 else
1411 {
1412 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1413
1414 /* Filling handle information */
1415 HandleInformation->Handles[Index].UniqueProcessId =
1416 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1417
1418 HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1419
1420#if 0 /* FIXME!!! Type field corrupted */
1421 HandleInformation->Handles[Index].ObjectTypeIndex =
1422 (UCHAR) ObjectHeader->Type->Index;
1423#else
1424 HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1425#endif
1426
1427 HandleInformation->Handles[Index].HandleAttributes =
1428 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1429
1430 HandleInformation->Handles[Index].HandleValue =
1431 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1432
1433 HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1434
1435 HandleInformation->Handles[Index].GrantedAccess =
1436 HandleTableEntry->GrantedAccess;
1437
1438 ++Index;
1439 }
1440
1441 /* Unlock it */
1442 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1443 }
1444 }
1445
1446 /* Go to the next entry */
1447 Handle.Value += sizeof(HANDLE);
1448 }
1449 }
1450
1451 /* Release the lock */
1453
1454 /* Leave the critical region */
1456
1457 /* Release the locked user buffer */
1459
1460 return Status;
1461}
1462
1463/* Class 17 - Information */
1465{
1466 /* FIXME */
1467 DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1469}
1470
1471/* Class 18 - Information */
1473{
1474 UNICODE_STRING FileName; /* FIXME */
1476
1477 if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1478 {
1479 * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1481 }
1482
1483 RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1484
1485 /* FIXME */
1486 Spfi->NextEntryOffset = 0;
1487
1490 Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1491 Spfi->PageFileName = FileName;
1492 return STATUS_SUCCESS;
1493}
1494
1495/* Class 19 - Vdm Instemul Information */
1497{
1498 /* FIXME */
1499 DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1501}
1502
1503/* Class 20 - Vdm Bop Information */
1505{
1506 /* FIXME */
1507 DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1509}
1510
1511/* Class 21 - File Cache Information */
1513{
1515
1516 *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1517
1518 if (Size < *ReqSize)
1519 {
1521 }
1522
1524
1525 /* Return the Byte size not the page size. */
1526 Sci->CurrentSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1527 Sci->PeakSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1528 /* Taskmgr multiplies this one by page size right away */
1530 /* system working set and standby pages. */
1531 Sci->PageFaultCount = 0; /* FIXME */
1532 Sci->MinimumWorkingSet = 0; /* FIXME */
1533 Sci->MaximumWorkingSet = 0; /* FIXME */
1534
1535 return STATUS_SUCCESS;
1536}
1537
1539{
1540 if (Size < sizeof(SYSTEM_FILECACHE_INFORMATION))
1541 {
1543 }
1544 /* FIXME */
1545 DPRINT1("NtSetSystemInformation - SystemFileCacheInformation not implemented\n");
1547}
1548
1549/* Class 22 - Pool Tag Information */
1551{
1553 return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1554}
1555
1556/* Class 23 - Interrupt Information for all processors */
1558{
1559 PKPRCB Prcb;
1560 LONG i;
1561 ULONG ti;
1563
1565 if (Size < *ReqSize)
1566 {
1568 }
1569
1570 ti = KeQueryTimeIncrement();
1571
1572 for (i = 0; i < KeNumberProcessors; i++)
1573 {
1574 Prcb = KiProcessorBlock[i];
1576 sii->DpcCount = Prcb->DpcData[DPC_NORMAL].DpcCount;
1577 sii->DpcRate = Prcb->DpcRequestRate;
1578 sii->TimeIncrement = ti;
1579 sii->DpcBypassCount = 0;
1580 sii->ApcBypassCount = 0;
1581 sii++;
1582 }
1583
1584 return STATUS_SUCCESS;
1585}
1586
1587/* Class 24 - DPC Behaviour Information */
1589{
1591
1593 {
1595 }
1596
1601
1602 return STATUS_SUCCESS;
1603}
1604
1606{
1607 /* FIXME */
1608 DPRINT1("NtSetSystemInformation - SystemDpcBehaviorInformation not implemented\n");
1610}
1611
1612/* Class 25 - Full Memory Information */
1614{
1615 PULONG Spi = (PULONG) Buffer;
1616
1618
1619 *ReqSize = sizeof(ULONG);
1620
1621 if (sizeof(ULONG) != Size)
1622 {
1624 }
1625
1626 DPRINT("SystemFullMemoryInformation\n");
1627
1629
1630 DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1635
1637
1638 return STATUS_SUCCESS;
1639}
1640
1641/* Class 26 - Load Image */
1643{
1646 PVOID ImageBase;
1647 PVOID SectionPointer;
1648 ULONG_PTR EntryPoint;
1650 ULONG DirSize;
1651 PIMAGE_NT_HEADERS NtHeader;
1652
1653 /* Validate size */
1654 if (Size != sizeof(SYSTEM_GDI_DRIVER_INFORMATION))
1655 {
1656 /* Incorrect buffer length, fail */
1658 }
1659
1660 /* Only kernel mode can call this function */
1662
1663 /* Load the driver */
1664 ImageName = DriverInfo->DriverName;
1666 NULL,
1667 NULL,
1668 0,
1669 &SectionPointer,
1670 &ImageBase);
1671 if (!NT_SUCCESS(Status)) return Status;
1672
1673 /* Return the export pointer */
1674 DriverInfo->ExportSectionPointer =
1676 TRUE,
1678 &DirSize);
1679
1680 /* Get the entrypoint */
1681 NtHeader = RtlImageNtHeader(ImageBase);
1682 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1683 EntryPoint += (ULONG_PTR)ImageBase;
1684
1685 /* Save other data */
1686 DriverInfo->ImageAddress = ImageBase;
1687 DriverInfo->SectionPointer = SectionPointer;
1688 DriverInfo->EntryPoint = (PVOID)EntryPoint;
1689 DriverInfo->ImageLength = NtHeader->OptionalHeader.SizeOfImage;
1690
1691 /* All is good */
1692 return STATUS_SUCCESS;
1693}
1694
1695/* Class 27 - Unload Image */
1697{
1698 PVOID *SectionPointer = Buffer;
1699
1700 /* Validate size */
1701 if (Size != sizeof(PVOID))
1702 {
1703 /* Incorrect length, fail */
1705 }
1706
1707 /* Only kernel mode can call this function */
1709
1710 /* Unload the image */
1711 MmUnloadSystemImage(*SectionPointer);
1712 return STATUS_SUCCESS;
1713}
1714
1715/* Class 28 - Time Adjustment Information */
1717{
1720
1721 /* Check if enough storage was provided */
1722 *ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1723 if (Size != *ReqSize)
1724 {
1726 }
1727
1728 /* Give time values to our caller */
1730 TimeInfo->TimeAdjustment = KeTimeAdjustment;
1731 TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1732
1733 return STATUS_SUCCESS;
1734}
1735
1737{
1741
1742 /* Check size of a buffer, it must match our expectations */
1745
1746 /* Check who is calling */
1747 if (PreviousMode != KernelMode)
1748 {
1749 /* Check access rights */
1751 {
1753 }
1754 }
1755
1756 /* FIXME: behaviour suggests the member be named 'Disable' */
1757 if (TimeInfo->Enable)
1758 {
1759 /* Disable time adjustment and set default value */
1762 }
1763 else
1764 {
1765 /* Check if a valid time adjustment value is given */
1766 if (TimeInfo->TimeAdjustment == 0) return STATUS_INVALID_PARAMETER_2;
1767
1768 /* Enable time adjustment and set the adjustment value */
1770 KeTimeAdjustment = TimeInfo->TimeAdjustment;
1771 }
1772
1773 return STATUS_SUCCESS;
1774}
1775
1776/* Class 29 - Summary Memory Information */
1778{
1779 /* FIXME */
1780 DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1782}
1783
1784/* Class 30 - Memory mirroring Information */
1786{
1787 /* FIXME */
1788 DPRINT1("NtQuerySystemInformation - SystemMirrorMemoryInformation not implemented\n");
1790}
1791
1792/* Class 31 */
1794{
1795 /* FIXME */
1796 DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1798}
1799
1800/* Class 32 - Obsolete (previously: Crash Dump Information) */
1802{
1803 /* FIXME */
1804 DPRINT1("NtQuerySystemInformation - SystemObsolete0 not implemented\n");
1806}
1807
1808/* Class 33 - Exception Information */
1810{
1811 PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1813 PKPRCB Prcb;
1814 ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1815 ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1816 CHAR i;
1817
1818 /* Check size of a buffer, it must match our expectations */
1819 if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1821
1822 /* Sum up exception count information from all processors */
1823 for (i = 0; i < KeNumberProcessors; i++)
1824 {
1825 Prcb = KiProcessorBlock[i];
1826 if (Prcb)
1827 {
1828 AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1829 ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1830#ifndef _M_ARM
1831 FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1832#endif // _M_ARM
1833 }
1834 }
1835
1836 /* Save information in user's buffer */
1837 ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1838 ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1839 ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1840 ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1841
1842 return STATUS_SUCCESS;
1843}
1844
1845/* Class 34 - Crash Dump State Information */
1847{
1848 /* FIXME */
1849 DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1851}
1852
1853/* Class 35 - Kernel Debugger Information */
1855{
1857
1858#if (NTDDI_VERSION >= NTDDI_VISTA)
1859 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1860#endif
1861
1863 {
1865 }
1866
1869
1870#if (NTDDI_VERSION < NTDDI_VISTA)
1871 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1872#endif
1873
1874 return STATUS_SUCCESS;
1875}
1876
1877/* Class 36 - Context Switch Information */
1879{
1880 PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1882 ULONG ContextSwitches;
1883 PKPRCB Prcb;
1884 CHAR i;
1885
1886 /* Check size of a buffer, it must match our expectations */
1889
1890 /* Calculate total value of context switches across all processors */
1891 ContextSwitches = 0;
1892 for (i = 0; i < KeNumberProcessors; i ++)
1893 {
1894 Prcb = KiProcessorBlock[i];
1895 if (Prcb)
1896 {
1897 ContextSwitches += KeGetContextSwitches(Prcb);
1898 }
1899 }
1900
1901 ContextSwitchInformation->ContextSwitches = ContextSwitches;
1902
1903 /* FIXME */
1904 ContextSwitchInformation->FindAny = 0;
1905 ContextSwitchInformation->FindLast = 0;
1906 ContextSwitchInformation->FindIdeal = 0;
1907 ContextSwitchInformation->IdleAny = 0;
1908 ContextSwitchInformation->IdleCurrent = 0;
1909 ContextSwitchInformation->IdleLast = 0;
1910 ContextSwitchInformation->IdleIdeal = 0;
1911 ContextSwitchInformation->PreemptAny = 0;
1912 ContextSwitchInformation->PreemptCurrent = 0;
1913 ContextSwitchInformation->PreemptLast = 0;
1914 ContextSwitchInformation->SwitchToIdle = 0;
1915
1916 return STATUS_SUCCESS;
1917}
1918
1919/* Class 37 - Registry Quota Information */
1921{
1923
1924 *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1926 {
1928 }
1929
1930 DPRINT1("Faking max registry size of 32 MB\n");
1931 srqi->RegistryQuotaAllowed = 0x2000000;
1932 srqi->RegistryQuotaUsed = 0x200000;
1933 srqi->PagedPoolSize = 0x200000;
1934
1935 return STATUS_SUCCESS;
1936}
1937
1939{
1940 /* FIXME */
1941 DPRINT1("NtSetSystemInformation - SystemRegistryQuotaInformation not implemented\n");
1943}
1944
1945/* Class 38 - Load And Call Image */
1947{
1950 PLDR_DATA_TABLE_ENTRY ModuleObject;
1952 PIMAGE_NT_HEADERS NtHeader;
1953 DRIVER_OBJECT Win32k;
1954 PDRIVER_INITIALIZE DriverInit;
1955 PVOID ImageBase;
1956 ULONG_PTR EntryPoint;
1957
1958 /* Validate the size */
1959 if (Size != sizeof(UNICODE_STRING)) return STATUS_INFO_LENGTH_MISMATCH;
1960
1961 /* Check who is calling */
1962 if (PreviousMode != KernelMode)
1963 {
1964 static const UNICODE_STRING Win32kName =
1965 RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
1966
1967 /* Make sure we can load drivers */
1969 {
1970 /* FIXME: We can't, fail */
1972 }
1973
1974 _SEH2_TRY
1975 {
1976 /* Probe and copy the unicode string */
1977 ProbeForRead(Buffer, sizeof(ImageName), 1);
1979
1980 /* Probe the string buffer */
1981 ProbeForRead(ImageName.Buffer, ImageName.Length, sizeof(WCHAR));
1982
1983 /* Check if we have the correct name (nothing else is allowed!) */
1984 if (!RtlEqualUnicodeString(&ImageName, &Win32kName, FALSE))
1985 {
1987 }
1988 }
1990 {
1992 }
1993 _SEH2_END;
1994
1995 /* Recursively call the function, so that we are from kernel mode */
1997 (PVOID)&Win32kName,
1998 sizeof(Win32kName));
1999 }
2000
2001 /* Load the image */
2003 NULL,
2004 NULL,
2005 0,
2006 (PVOID)&ModuleObject,
2007 &ImageBase);
2008
2009 if (!NT_SUCCESS(Status)) return Status;
2010
2011 /* Get the headers */
2012 NtHeader = RtlImageNtHeader(ImageBase);
2013 if (!NtHeader)
2014 {
2015 /* Fail */
2016 MmUnloadSystemImage(ModuleObject);
2018 }
2019
2020 /* Get the entrypoint */
2021 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
2022 EntryPoint += (ULONG_PTR)ImageBase;
2023 DriverInit = (PDRIVER_INITIALIZE)EntryPoint;
2024
2025 /* Create a dummy device */
2026 RtlZeroMemory(&Win32k, sizeof(Win32k));
2028 Win32k.DriverStart = ImageBase;
2029
2030 /* Call it */
2031 Status = (DriverInit)(&Win32k, NULL);
2033
2034 /* Unload if we failed */
2035 if (!NT_SUCCESS(Status)) MmUnloadSystemImage(ModuleObject);
2036 return Status;
2037}
2038
2039/* Class 39 - Priority Separation */
2041{
2042 /* Check if the size is correct */
2043 if (Size != sizeof(ULONG))
2044 {
2046 }
2047
2048 /* We need the TCB privilege */
2050 {
2052 }
2053
2054 /* Modify the quantum table */
2056
2057 return STATUS_SUCCESS;
2058}
2059
2060/* Class 40 */
2062{
2063 /* FIXME */
2064 DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2066}
2067
2068/* Class 41 */
2070{
2071 /* FIXME */
2072 DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2074}
2075
2076/* Class 42 - Power Information */
2078{
2080
2082 {
2084 }
2085
2086 /* FIXME */
2087 DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2089}
2090
2091/* Class 43 */
2093{
2094 /* FIXME */
2095 DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2097}
2098
2099/* Class 44 - Current Time Zone Information */
2101{
2102 *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2103
2104 if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2105 {
2107 }
2108
2109 /* Copy the time zone information struct */
2110 memcpy(Buffer,
2113
2114 return STATUS_SUCCESS;
2115}
2116
2118{
2119 /* Check user buffer's size */
2120 if (Size < sizeof(RTL_TIME_ZONE_INFORMATION))
2121 {
2123 }
2124
2126}
2127
2128static
2129VOID
2131 PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer,
2132 PULONG RemainingPointer,
2133 PLIST_ENTRY ListHead,
2134 BOOLEAN ListUsesMisses)
2135
2136{
2139 PLIST_ENTRY ListEntry;
2140 ULONG Remaining;
2141
2142 /* Get info pointer and remaining count of free array element */
2143 Info = *InfoPointer;
2144 Remaining = *RemainingPointer;
2145
2146 /* Loop as long as we have lookaside lists and free array elements */
2147 for (ListEntry = ListHead->Flink;
2148 (ListEntry != ListHead) && (Remaining > 0);
2149 ListEntry = ListEntry->Flink, Info++, Remaining--)
2150 {
2151 LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2152
2153 /* Fill the next array element */
2154 Info->CurrentDepth = LookasideList->Depth;
2155 Info->MaximumDepth = LookasideList->MaximumDepth;
2156 Info->TotalAllocates = LookasideList->TotalAllocates;
2157 Info->TotalFrees = LookasideList->TotalFrees;
2158 Info->Type = LookasideList->Type;
2159 Info->Tag = LookasideList->Tag;
2160 Info->Size = LookasideList->Size;
2161
2162 /* Check how the lists track misses/hits */
2163 if (ListUsesMisses)
2164 {
2165 /* Copy misses */
2166 Info->AllocateMisses = LookasideList->AllocateMisses;
2167 Info->FreeMisses = LookasideList->FreeMisses;
2168 }
2169 else
2170 {
2171 /* Calculate misses */
2172 Info->AllocateMisses = LookasideList->TotalAllocates
2173 - LookasideList->AllocateHits;
2174 Info->FreeMisses = LookasideList->TotalFrees
2175 - LookasideList->FreeHits;
2176 }
2177 }
2178
2179 /* Return the updated pointer and remaining count */
2180 *InfoPointer = Info;
2181 *RemainingPointer = Remaining;
2182}
2183
2184/* Class 45 - Lookaside Information */
2186{
2189 PMDL Mdl;
2190 ULONG MaxCount, Remaining;
2191 KIRQL OldIrql;
2193
2194 /* Calculate how many items we can store */
2195 Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2196 if (Remaining == 0)
2197 {
2199 }
2200
2201 /* First we need to lock down the memory, since we are going to access it
2202 at high IRQL */
2205 Size,
2208 (PVOID*)&Info,
2209 &Mdl);
2210 if (!NT_SUCCESS(Status))
2211 {
2212 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2213 return Status;
2214 }
2215
2216 /* Copy info from pool lookaside lists */
2218 &Remaining,
2220 FALSE);
2221 if (Remaining == 0)
2222 {
2223 goto Leave;
2224 }
2225
2226 /* Copy info from system lookaside lists */
2228 &Remaining,
2230 TRUE);
2231 if (Remaining == 0)
2232 {
2233 goto Leave;
2234 }
2235
2236 /* Acquire spinlock for ExpNonPagedLookasideListHead */
2238
2239 /* Copy info from non-paged lookaside lists */
2241 &Remaining,
2243 TRUE);
2244
2245 /* Release spinlock for ExpNonPagedLookasideListHead */
2247
2248 if (Remaining == 0)
2249 {
2250 goto Leave;
2251 }
2252
2253 /* Acquire spinlock for ExpPagedLookasideListHead */
2255
2256 /* Copy info from paged lookaside lists */
2258 &Remaining,
2260 TRUE);
2261
2262 /* Release spinlock for ExpPagedLookasideListHead */
2264
2265Leave:
2266
2267 /* Release the locked user buffer */
2269
2270 /* Return the size of the actually written data */
2271 *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2272 return STATUS_SUCCESS;
2273}
2274
2275/* Class 46 - Set time slip event */
2277{
2278 /* FIXME */
2279 DPRINT1("NtSetSystemInformation - SystemTimeSlipNotification not implemented\n");
2281}
2282
2284NTAPI
2286
2288NTAPI
2290
2291/* Class 47 - Create a new session (TSE) */
2293{
2297
2298 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2299
2300 if (PreviousMode != KernelMode)
2301 {
2303 {
2305 }
2306
2308 }
2309
2312
2313 return Status;
2314}
2315
2316/* Class 48 - Delete an existing session (TSE) */
2318{
2321
2322 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2323
2324 if (PreviousMode != KernelMode)
2325 {
2327 {
2329 }
2330 }
2331
2333
2334 return MmSessionDelete(SessionId);
2335}
2336
2337/* Class 49 - UNKNOWN */
2339{
2340 /* FIXME */
2341 DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2343}
2344
2345/* Class 50 - System range start address */
2347{
2348 /* Check user buffer's size */
2349 if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2350
2352
2353 if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2354
2355 return STATUS_SUCCESS;
2356}
2357
2358/* Class 51 - Driver verifier information */
2360{
2361 /* FIXME */
2362 DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2364}
2365
2367{
2368 /* FIXME */
2369 DPRINT1("NtSetSystemInformation - SystemVerifierInformation not implemented\n");
2371}
2372
2373/* Class 52 */
2375{
2376 /* FIXME */
2377 DPRINT1("NtSetSystemInformation - SystemVerifierThunkExtend not implemented\n");
2379}
2380
2381/* Class 53 - A session's processes */
2383{
2384 /* FIXME */
2385 DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2387}
2388
2389/* Class 54 - Load & map in system space */
2391{
2392 /* Similar to SystemLoadGdiDriverInformation */
2394}
2395
2396/* Class 55 - NUMA processor information */
2398{
2399 ULONG MaxEntries, Node;
2401
2402 /* Validate input size */
2403 if (Size < sizeof(ULONG))
2404 {
2406 }
2407
2408 /* Return highest node */
2409 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2410
2411 /* Compute how much entries we will be able to put in output structure */
2412 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2413 /* Make sure we don't overflow KeNodeBlock */
2414 if (MaxEntries > KeNumberNodes)
2415 {
2416 MaxEntries = KeNumberNodes;
2417 }
2418
2419 /* If we have entries to write, and room for it */
2420 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2421 MaxEntries != 0)
2422 {
2423 /* Already set size we return */
2424 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2425 MaxEntries * sizeof(ULONGLONG);
2426
2427 /* For each node, return processor mask */
2428 for (Node = 0; Node < MaxEntries; ++Node)
2429 {
2431 }
2432 }
2433 else
2434 {
2435 /* We only returned highest node number */
2436 *ReqSize = sizeof(ULONG);
2437 }
2438
2439 return STATUS_SUCCESS;
2440}
2441
2442/* Class 56 - Prefetcher information */
2444{
2445 /* FIXME */
2446 DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2448}
2449
2450/* Class 57 - Extended process information */
2452{
2454}
2455
2456/* Class 58 - Recommended shared data alignment */
2458{
2460
2461 /* Check user buffer's size */
2462 *ReqSize = sizeof(ULONG);
2463 if (Size < *ReqSize)
2464 {
2466 }
2467
2469 return STATUS_SUCCESS;
2470}
2471
2472/* Class 60 - NUMA memory information */
2474{
2475 ULONG MaxEntries, Node;
2477
2478 /* Validate input size */
2479 if (Size < sizeof(ULONG))
2480 {
2482 }
2483
2484 /* Return highest node */
2485 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2486
2487 /* Compute how much entries we will be able to put in output structure */
2488 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2489 /* Make sure we don't overflow KeNodeBlock */
2490 if (MaxEntries > KeNumberNodes)
2491 {
2492 MaxEntries = KeNumberNodes;
2493 }
2494
2495 /* If we have entries to write, and room for it */
2496 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) &&
2497 MaxEntries != 0)
2498 {
2499 /* Already set size we return */
2500 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) +
2501 MaxEntries * sizeof(ULONGLONG);
2502
2503 /* If we have a single entry (us), directly return MM information */
2504 if (MaxEntries == 1)
2505 {
2506 NumaInformation->AvailableMemory[0] = MmAvailablePages << PAGE_SHIFT;
2507 }
2508 else
2509 {
2510 /* Otherwise, for each node, return available bytes */
2511 for (Node = 0; Node < MaxEntries; ++Node)
2512 {
2513 NumaInformation->AvailableMemory[Node] = (KeNodeBlock[Node]->FreeCount[0] + KeNodeBlock[Node]->FreeCount[1]) << PAGE_SHIFT;
2514 }
2515 }
2516 }
2517 else
2518 {
2519 /* We only returned highest node number */
2520 *ReqSize = sizeof(ULONG);
2521 }
2522
2523 return STATUS_SUCCESS;
2524}
2525
2526/* Class 62 - Emulation Basic Information */
2528{
2529 return QSISystemBasicInformation(Buffer, Size, ReqSize);
2530}
2531
2532/* Class 63 - Emulation Processor Information */
2534{
2536
2537 /* Query native information */
2538 Status = QSISystemProcessorInformation(Buffer, Size, ReqSize);
2539#if defined(_M_AMD64) || defined(_M_ARM64)
2540 if (NT_SUCCESS(Status))
2541 {
2543#if defined(_M_AMD64)
2545#elif defined(_M_ARM64)
2547#endif /* _M_AMD64 | _M_ARM64 */
2548 }
2549#endif /* defined(_M_AMD64) || defined(_M_ARM64) */
2550
2551 return Status;
2552}
2553
2554/* Class 64 - Extended handle information */
2556{
2558 PLIST_ENTRY NextTableEntry;
2560 PHANDLE_TABLE_ENTRY HandleTableEntry;
2562 ULONG Index = 0;
2564 PMDL Mdl;
2565 PAGED_CODE();
2566
2567 DPRINT("NtQuerySystemInformation - SystemExtendedHandleInformation\n");
2568
2569 /* Set initial required buffer size */
2570 *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles);
2571
2572 /* Check user's buffer size */
2573 if (Size < *ReqSize)
2574 {
2576 }
2577
2578 /* We need to lock down the memory */
2580 Size,
2584 &Mdl);
2585 if (!NT_SUCCESS(Status))
2586 {
2587 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2588 return Status;
2589 }
2590
2591 /* Reset of count of handles */
2592 HandleInformation->NumberOfHandles = 0;
2593
2594 /* Enter a critical region */
2596
2597 /* Acquire the handle table lock */
2599
2600 /* Enumerate all system handles */
2601 for (NextTableEntry = HandleTableListHead.Flink;
2602 NextTableEntry != &HandleTableListHead;
2603 NextTableEntry = NextTableEntry->Flink)
2604 {
2605 /* Get current handle table */
2606 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
2607
2608 /* Set the initial value and loop the entries */
2609 Handle.Value = 0;
2610 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
2611 {
2612 /* Validate the entry */
2613 if ((HandleTableEntry->Object) &&
2614 (HandleTableEntry->NextFreeTableEntry != -2))
2615 {
2616 /* Increase of count of handles */
2617 ++HandleInformation->NumberOfHandles;
2618
2619 /* Lock the entry */
2620 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
2621 {
2622 /* Increase required buffer size */
2623 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
2624
2625 /* Check user's buffer size */
2626 if (*ReqSize > Size)
2627 {
2629 }
2630 else
2631 {
2632 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
2633
2634 /* Filling handle information */
2635 HandleInformation->Handles[Index].UniqueProcessId =
2636 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
2637
2638 HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
2639
2640#if 0 /* FIXME!!! Type field corrupted */
2641 HandleInformation->Handles[Index].ObjectTypeIndex =
2642 (UCHAR) ObjectHeader->Type->Index;
2643#else
2644 HandleInformation->Handles[Index].ObjectTypeIndex = 0;
2645#endif
2646
2647 HandleInformation->Handles[Index].HandleAttributes =
2648 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
2649
2650 HandleInformation->Handles[Index].HandleValue =
2651 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
2652
2653 HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
2654
2655 HandleInformation->Handles[Index].GrantedAccess =
2656 HandleTableEntry->GrantedAccess;
2657
2658 HandleInformation->Handles[Index].Reserved = 0;
2659
2660 ++Index;
2661 }
2662
2663 /* Unlock it */
2664 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
2665 }
2666 }
2667
2668 /* Go to the next entry */
2669 Handle.Value += sizeof(HANDLE);
2670 }
2671 }
2672
2673 /* Release the lock */
2675
2676 /* Leave the critical region */
2678
2679 /* Release the locked user buffer */
2681
2682 return Status;
2683}
2684
2685/* Class 70 - System object security mode information */
2687{
2688 PULONG ObjectSecurityInfo = (PULONG)Buffer;
2689
2690 /* Validate input size */
2691 if (Size != sizeof(ULONG))
2692 {
2694 }
2695
2696 *ObjectSecurityInfo = ObpObjectSecurityMode;
2697
2698 return STATUS_SUCCESS;
2699}
2700
2701/* Class 73 - Logical processor information */
2703{
2704 LONG i;
2705 PKPRCB Prcb;
2706 KAFFINITY CurrentProc;
2708 ULONG DataSize = 0, ProcessorFlags;
2710
2711 /* First, browse active processors, thanks to the map */
2712 i = 0;
2713 CurrentInfo = Buffer;
2714 CurrentProc = KeActiveProcessors;
2715 do
2716 {
2717 /* If current processor is active and is main in case of HT/MC, return it */
2718 Prcb = KiProcessorBlock[i];
2719 if ((CurrentProc & 1) &&
2720 Prcb == Prcb->MultiThreadSetMaster)
2721 {
2722 /* Assume processor can do HT or multicore */
2723 ProcessorFlags = 1;
2724
2725 /* If set is the same for PRCB and multithread, then
2726 * actually, the processor is single core
2727 */
2728 if (Prcb->SetMember == Prcb->MultiThreadProcessorSet)
2729 {
2730 ProcessorFlags = 0;
2731 }
2732
2733 /* Check we have enough room to return */
2735 if (DataSize > Size)
2736 {
2738 }
2739 else
2740 {
2741 /* Zero output and return */
2743 CurrentInfo->ProcessorMask = Prcb->MultiThreadProcessorSet;
2744
2745 /* Processor core needs 1 if HT/MC is supported */
2746 CurrentInfo->Relationship = RelationProcessorCore;
2747 CurrentInfo->ProcessorCore.Flags = ProcessorFlags;
2748 ++CurrentInfo;
2749 }
2750 }
2751
2752 /* Move to the next proc */
2753 CurrentProc >>= 1;
2754 ++i;
2755 /* Loop while there's someone in the bitmask */
2756 } while (CurrentProc != 0);
2757
2758 /* Now, return the NUMA nodes */
2759 for (i = 0; i < KeNumberNodes; ++i)
2760 {
2761 /* Check we have enough room to return */
2763 if (DataSize > Size)
2764 {
2766 }
2767 else
2768 {
2769 /* Zero output and return */
2771 CurrentInfo->ProcessorMask = KeActiveProcessors;
2772
2773 /* NUMA node needs its ID */
2774 CurrentInfo->Relationship = RelationNumaNode;
2775 CurrentInfo->NumaNode.NodeNumber = i;
2776 ++CurrentInfo;
2777 }
2778 }
2779
2780 *ReqSize = DataSize;
2781
2782 return Status;
2783}
2784
2785/* Class 76 - System firmware table information */
2787{
2790 ULONG DataBufSize;
2791 ULONG DataSize = 0;
2792 ULONG TableCount = 0;
2793
2794 DPRINT("NtQuerySystemInformation - SystemFirmwareTableInformation\n");
2795
2796 /* Set initial required buffer size */
2797 *ReqSize = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
2798
2799 /* Check user's buffer size */
2800 if (Size < *ReqSize)
2801 {
2803 }
2804
2805 DataBufSize = Size - *ReqSize;
2806 switch (SysFirmwareInfo->ProviderSignature)
2807 {
2808 /*
2809 * ExpFirmwareTableResource and ExpFirmwareTableProviderListHead
2810 * variables should be used there somehow...
2811 */
2812 case SIG_ACPI:
2813 {
2814 /* FIXME: Not implemented yet */
2815 DPRINT1("ACPI provider not implemented\n");
2817 break;
2818 }
2819 case SIG_FIRM:
2820 {
2821 /* FIXME: Not implemented yet */
2822 DPRINT1("FIRM provider not implemented\n");
2824 break;
2825 }
2826 case SIG_RSMB:
2827 {
2829 if (DataSize > 0)
2830 {
2831 TableCount = 1;
2832 if (SysFirmwareInfo->Action == SystemFirmwareTable_Enumerate)
2833 {
2834 DataSize = TableCount * sizeof(ULONG);
2835 if (DataSize <= DataBufSize)
2836 {
2837 *(ULONG *)SysFirmwareInfo->TableBuffer = 0;
2838 }
2839 }
2840 else if (SysFirmwareInfo->Action == SystemFirmwareTable_Get
2841 && DataSize <= DataBufSize)
2842 {
2843 Status = ExpGetRawSMBiosTable(SysFirmwareInfo->TableBuffer, &DataSize, DataBufSize);
2844 }
2845 SysFirmwareInfo->TableBufferLength = DataSize;
2846 *ReqSize += DataSize;
2847 }
2848 break;
2849 }
2850 default:
2851 {
2852 DPRINT1("SystemFirmwareTableInformation: Unsupported provider (0x%x)\n",
2853 SysFirmwareInfo->ProviderSignature);
2854 *ReqSize = 0;
2856 }
2857 }
2858
2859 if (NT_SUCCESS(Status))
2860 {
2861 switch (SysFirmwareInfo->Action)
2862 {
2865 {
2866 if (SysFirmwareInfo->TableBufferLength > DataBufSize)
2867 {
2869 }
2870 break;
2871 }
2872 default:
2873 {
2874 DPRINT1("SystemFirmwareTableInformation: Unsupported action (0x%x)\n",
2875 SysFirmwareInfo->Action);
2877 }
2878 }
2879 }
2880 else
2881 {
2882 SysFirmwareInfo->TableBufferLength = 0;
2883 }
2884 return Status;
2885}
2886
2887/* Class 77 - Extended module information */
2889{
2890 /* For now return STATUS_INVALID_INFO_CLASS to avoid crashing in wine tests */
2892}
2893
2894/* Class 105 - Processor Brand String */
2896{
2897 CHAR BrandString[128];
2899
2900 /* Call hal to query the brand string */
2902 sizeof(BrandString),
2903 BrandString,
2904 ReqSize);
2905 if (!NT_SUCCESS(Status))
2906 {
2907 DPRINT1("HalQuerySystemInformation failed: 0x%lx\n", Status);
2908 return Status;
2909 }
2910
2911 if (Size < *ReqSize)
2912 {
2913 DPRINT1("Buffer too small for processor brand string\n");
2915 }
2916
2917 /* Copy the brand string to the user buffer */
2918 RtlCopyMemory(Buffer, BrandString, *ReqSize);
2919
2920 return STATUS_SUCCESS;
2921}
2922
2923/* Query/Set Calls Table */
2924typedef
2925struct _QSSI_CALLS
2926{
2930
2931// QS Query & Set
2932// QX Query
2933// XS Set
2934// XX unknown behaviour
2935//
2936#define SI_QS(n) [n] = {QSI_USE(n),SSI_USE(n)}
2937#define SI_QX(n) [n] = {QSI_USE(n),NULL}
2938#define SI_XS(n) [n] = {NULL,SSI_USE(n)}
2939#define SI_XX(n) [n] = {NULL,NULL}
2940
2941static
2944{
2955 SI_QX(SystemCallTimeInformation), /* should be SI_XX */
2958 SI_QX(SystemStackTraceInformation), /* should be SI_XX */
2959 SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
2960 SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
2965 SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
2970 SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
2974 SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
2975 SI_QX(SystemMirrorMemoryInformation), /* it should be SI_XX */
2976 SI_QX(SystemPerformanceTraceInformation), /* it should be SI_XX */
2985 SI_QX(SystemVerifierAddDriverInformation), /* it should be SI_XX */
2986 SI_QX(SystemVerifierRemoveDriverInformation), /* it should be SI_XX */
2987 SI_QX(SystemProcessorIdleInformation), /* it should be SI_XX */
2988 SI_QX(SystemLegacyDriverInformation), /* it should be SI_XX */
2989 SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
2994 SI_QX(SystemSessionInformation), /* it should be SI_XX */
3006 SI_XX(SystemProcessorPowerInformation), /* FIXME: not implemented */
3010 SI_XX(SystemLostDelayedWriteInformation), /* FIXME: not implemented */
3011 SI_XX(SystemBigPoolInformation), /* FIXME: not implemented */
3012 SI_XX(SystemSessionPoolTagInformation), /* FIXME: not implemented */
3013 SI_XX(SystemSessionMappedViewInformation), /* FIXME: not implemented */
3014 SI_XX(SystemHotpatchInformation), /* FIXME: not implemented */
3016 SI_XX(SystemWatchdogTimerHandler), /* FIXME: not implemented */
3017 SI_XX(SystemWatchdogTimerInformation), /* FIXME: not implemented */
3019 SI_XX(SystemWow64SharedInformationObsolete), /* FIXME: not implemented */
3020 SI_XX(SystemRegisterFirmwareTableInformationHandler), /* FIXME: not implemented */
3022
3023 // Vista and later
3026};
3027
3029#define MIN_SYSTEM_INFO_CLASS (SystemBasicInformation)
3030#define MAX_SYSTEM_INFO_CLASS RTL_NUMBER_OF(CallQS)
3031
3032/*
3033 * @implemented
3034 */
3037NTAPI
3039 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
3040 _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation,
3041 _In_ ULONG SystemInformationLength,
3043{
3045 ULONG CapturedResultLength = 0;
3048
3049 PAGED_CODE();
3050
3052
3053 _SEH2_TRY
3054 {
3055#if (NTDDI_VERSION >= NTDDI_VISTA)
3056 /*
3057 * Check whether the request is valid.
3058 */
3059 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
3060 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
3061 {
3063 }
3064#endif
3065
3066 if (PreviousMode != KernelMode)
3067 {
3068 /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
3069 if (SystemInformationClass == SystemKernelDebuggerInformation)
3071
3072 ProbeForWrite(SystemInformation, SystemInformationLength, Alignment);
3073 if (ReturnLength != NULL)
3075 }
3076
3077 if (ReturnLength)
3078 *ReturnLength = 0;
3079
3080#if (NTDDI_VERSION < NTDDI_VISTA)
3081 /*
3082 * Check whether the request is valid.
3083 */
3084 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
3085 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
3086 {
3088 }
3089#endif
3090
3091 if (CallQS[SystemInformationClass].Query != NULL)
3092 {
3093 /* Hand the request to a subhandler */
3094 Status = CallQS[SystemInformationClass].Query(SystemInformation,
3095 SystemInformationLength,
3096 &CapturedResultLength);
3097
3098 /* Save the result length to the caller */
3099 if (ReturnLength)
3100 *ReturnLength = CapturedResultLength;
3101 }
3102 }
3104 {
3106 }
3107 _SEH2_END;
3108
3109 return Status;
3110}
3111
3114NTAPI
3116 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
3117 _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation,
3118 _In_ ULONG SystemInformationLength)
3119{
3122
3123 PAGED_CODE();
3124
3126
3127 _SEH2_TRY
3128 {
3129 /*
3130 * If called from user mode, check possible unsafe arguments.
3131 */
3132 if (PreviousMode != KernelMode)
3133 {
3134 ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3135 }
3136
3137 /*
3138 * Check whether the request is valid.
3139 */
3140 if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3141 (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3142 {
3143 if (CallQS[SystemInformationClass].Set != NULL)
3144 {
3145 /* Hand the request to a subhandler */
3146 Status = CallQS[SystemInformationClass].Set(SystemInformation,
3147 SystemInformationLength);
3148 }
3149 }
3150 }
3152 {
3154 }
3155 _SEH2_END;
3156
3157 return Status;
3158}
3159
3160ULONG
3161NTAPI
3163{
3164 /* Just use Ke */
3166}
3167
3168#undef ExGetPreviousMode
3170NTAPI
3172{
3173 /* Just use Ke */
3174 return KeGetPreviousMode();
3175}
#define PAGED_CODE()
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define SystemLoadGdiDriverInformation
Definition: DriverTester.h:34
#define SystemExtendServiceTableInformation
Definition: DriverTester.h:35
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG ReturnLength
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG _In_ KPROCESSOR_MODE PreviousMode
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1280
unsigned char BOOLEAN
Definition: actypes.h:127
ULONG64 KeFeatureBits
Definition: krnlinit.c:22
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
_In_ ULONG _Out_writes_bytes_opt_ InformationLength PAUX_MODULE_EXTENDED_INFO ModuleInfo
Definition: aux_klib.h:65
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
PVOID MmHighestUserAddress
Definition: libsupp.c:23
Definition: bufpool.h:45
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
union node Node
Definition: types.h:1255
#define NTSTATUS
Definition: precomp.h:19
#define RTL_CONSTANT_STRING(s)
Definition: combase.c:35
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:151
ULONG_PTR KAFFINITY
Definition: compat.h:85
#define RtlImageDirectoryEntryToData
Definition: compat.h:809
#define RtlImageNtHeader
Definition: compat.h:806
ULONG SessionId
Definition: dllmain.c:28
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define IsListEmpty(ListHead)
Definition: env_spec_w32.h:954
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
#define NonPagedPool
Definition: env_spec_w32.h:307
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define DISPATCH_LEVEL
Definition: env_spec_w32.h:696
#define PagedPool
Definition: env_spec_w32.h:308
#define ROUND_UP(n, align)
Definition: eventvwr.h:34
NTSTATUS NTAPI ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation, IN ULONG SystemInformationLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: expool.c:1356
#define ExGetPreviousMode
Definition: ex.h:143
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1108
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1216
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
struct _FileName FileName
Definition: fatprocs.h:897
@ SystemCurrentTimeZoneInformation
Definition: ntddk_ex.h:59
@ SystemKernelDebuggerInformation
Definition: ntddk_ex.h:46
@ SystemTimeOfDayInformation
Definition: ntddk_ex.h:14
@ SystemProcessorInformation
Definition: ntddk_ex.h:12
@ SystemModuleInformation
Definition: ntddk_ex.h:22
@ SystemExceptionInformation
Definition: ntddk_ex.h:44
@ SystemBasicInformation
Definition: ntddk_ex.h:11
@ SystemDpcBehaviorInformation
Definition: ntddk_ex.h:35
@ SystemPathInformation
Definition: ntddk_ex.h:15
@ SystemVdmInstemulInformation
Definition: ntddk_ex.h:30
@ SystemLookasideInformation
Definition: ntddk_ex.h:60
@ SystemRegistryQuotaInformation
Definition: ntddk_ex.h:48
@ SystemNonPagedPoolInformation
Definition: ntddk_ex.h:26
@ SystemInterruptInformation
Definition: ntddk_ex.h:34
@ SystemUnloadGdiDriverInformation
Definition: ntddk_ex.h:38
@ SystemFileCacheInformation
Definition: ntddk_ex.h:32
@ SystemLocksInformation
Definition: ntddk_ex.h:23
@ SystemHandleInformation
Definition: ntddk_ex.h:27
@ SystemProcessInformation
Definition: ntddk_ex.h:16
@ SystemVdmBopInformation
Definition: ntddk_ex.h:31
@ SystemCallTimeInformation
Definition: ntddk_ex.h:21
@ SystemContextSwitchInformation
Definition: ntddk_ex.h:47
@ SystemTimeAdjustmentInformation
Definition: ntddk_ex.h:39
@ SystemFullMemoryInformation
Definition: ntddk_ex.h:36
@ SystemPrioritySeperation
Definition: ntddk_ex.h:50
@ SystemPageFileInformation
Definition: ntddk_ex.h:29
@ SystemStackTraceInformation
Definition: ntddk_ex.h:24
@ SystemObjectInformation
Definition: ntddk_ex.h:28
@ SystemFlagsInformation
Definition: ntddk_ex.h:20
@ SystemDeviceInformation
Definition: ntddk_ex.h:18
@ SystemSummaryMemoryInformation
Definition: ntddk_ex.h:40
@ SystemPagedPoolInformation
Definition: ntddk_ex.h:25
@ SystemCrashDumpStateInformation
Definition: ntddk_ex.h:45
@ SystemProcessorPerformanceInformation
Definition: ntddk_ex.h:19
@ SystemCallCountInformation
Definition: ntddk_ex.h:17
@ SystemPoolTagInformation
Definition: ntddk_ex.h:33
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
_Must_inspect_result_ _In_ LPCGUID _In_ ULONG _In_ FSRTL_ALLOCATE_ECP_FLAGS _In_opt_ PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK _Inout_ PVOID LookasideList
Definition: fltkernel.h:2554
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
#define STATUS_ACCESS_VIOLATION
FP_OP Operation
Definition: fpcontrol.c:150
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
#define IoAllocateMdl
Definition: fxmdl.h:88
ULONG Handle
Definition: gdb_input.c:15
Status
Definition: gdiplustypes.h:24
GLfloat GLfloat p
Definition: glext.h:8902
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
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:349
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
@ PsNonPagedPool
Definition: pstypes.h:1104
@ PsPageFile
Definition: pstypes.h:1106
@ PsPagedPool
Definition: pstypes.h:1105
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
#define C_ASSERT(e)
Definition: intsafe.h:73
ULONG IoWriteOperationCount
Definition: iomgr.c:41
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
ULONG IoOtherOperationCount
Definition: iomgr.c:43
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
ULONG IoReadOperationCount
Definition: iomgr.c:39
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Returns a pointer to the I/O manager's global configuration information structure.
Definition: iorsrce.c:998
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
ULONG CcLazyWritePages
Definition: lazywrite.c:20
ULONG CcLazyWriteIos
Definition: lazywrite.c:21
if(dx< 0)
Definition: linetemp.h:194
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:20
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:22
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:18
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:19
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21
LIST_ENTRY ExpNonPagedLookasideListHead
Definition: lookas.c:17
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
struct _SYSTEM_PERFORMANCE_INFORMATION * PSYSTEM_PERFORMANCE_INFORMATION
#define SystemPerformanceInformation
Definition: memtest.h:87
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
struct _ThreadInfo ThreadInfo
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
@ NormalPagePriority
Definition: imports.h:54
static const char * ImageName
Definition: image.c:34
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1187
#define KeGetPreviousMode()
Definition: ketypes.h:1115
NTSYSAPI NTSTATUS NTAPI ZwSetSystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation, _In_ ULONG SystemInformationLength)
struct _SYSTEM_PAGEFILE_INFORMATION SYSTEM_PAGEFILE_INFORMATION
struct _SYSTEM_FILECACHE_INFORMATION SYSTEM_FILECACHE_INFORMATION
struct _SYSTEM_EXTENDED_THREAD_INFORMATION SYSTEM_EXTENDED_THREAD_INFORMATION
struct _SYSTEM_DPC_BEHAVIOR_INFORMATION * PSYSTEM_DPC_BEHAVIOR_INFORMATION
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
struct _SYSTEM_SET_TIME_ADJUST_INFORMATION * PSYSTEM_SET_TIME_ADJUST_INFORMATION
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_LOOKASIDE_INFORMATION SYSTEM_LOOKASIDE_INFORMATION
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION SYSTEM_REGISTRY_QUOTA_INFORMATION
struct _SYSTEM_THREAD_INFORMATION * PSYSTEM_THREAD_INFORMATION
struct _SYSTEM_NUMA_INFORMATION * PSYSTEM_NUMA_INFORMATION
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO SYSTEM_HANDLE_TABLE_ENTRY_INFO
struct _SYSTEM_CONTEXT_SWITCH_INFORMATION * PSYSTEM_CONTEXT_SWITCH_INFORMATION
struct _SYSTEM_DEVICE_INFORMATION * PSYSTEM_DEVICE_INFORMATION
struct _SYSTEM_EXTENDED_THREAD_INFORMATION * PSYSTEM_EXTENDED_THREAD_INFORMATION
struct _SYSTEM_INTERRUPT_INFORMATION * PSYSTEM_INTERRUPT_INFORMATION
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION SYSTEM_KERNEL_DEBUGGER_INFORMATION
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION * PSYSTEM_QUERY_TIME_ADJUST_INFORMATION
struct _SYSTEM_PROCESSOR_INFORMATION * PSYSTEM_PROCESSOR_INFORMATION
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION SYSTEM_QUERY_TIME_ADJUST_INFORMATION
struct _SYSTEM_FLAGS_INFORMATION SYSTEM_FLAGS_INFORMATION
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION * PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
struct _SYSTEM_INTERRUPT_INFORMATION SYSTEM_INTERRUPT_INFORMATION
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION * PSYSTEM_REGISTRY_QUOTA_INFORMATION
@ SystemSessionInformation
Definition: extypes.h:266
@ SystemTimeSlipNotification
Definition: extypes.h:263
@ SystemProcessorPowerInformation
Definition: extypes.h:278
@ SystemFirmwareTableInformation
Definition: extypes.h:293
@ SystemProcessorBrandString
Definition: extypes.h:324
@ SystemLogicalProcessorInformation
Definition: extypes.h:290
@ SystemVerifierInformation
Definition: extypes.h:268
@ SystemEmulationBasicInformation
Definition: extypes.h:279
@ SystemBigPoolInformation
Definition: extypes.h:283
@ SystemVerifierAddDriverInformation
Definition: extypes.h:257
@ SystemModuleInformationEx
Definition: extypes.h:296
@ SystemMirrorMemoryInformation
Definition: extypes.h:247
@ SystemLostDelayedWriteInformation
Definition: extypes.h:282
@ SystemRecommendedSharedDataAlignment
Definition: extypes.h:275
@ SystemExtendedHandleInformation
Definition: extypes.h:281
@ SystemWatchdogTimerHandler
Definition: extypes.h:288
@ SystemObsolete0
Definition: extypes.h:249
@ SystemSessionCreate
Definition: extypes.h:264
@ SystemProcessorIdleInformation
Definition: extypes.h:259
@ SystemSessionMappedViewInformation
Definition: extypes.h:285
@ SystemEmulationProcessorInformation
Definition: extypes.h:280
@ SystemVerifierRemoveDriverInformation
Definition: extypes.h:258
@ SystemWatchdogTimerInformation
Definition: extypes.h:289
@ SystemExtendedProcessInformation
Definition: extypes.h:274
@ SystemNumaProcessorMap
Definition: extypes.h:272
@ SystemRangeStartInformation
Definition: extypes.h:267
@ SystemObjectSecurityMode
Definition: extypes.h:287
@ SystemRegisterFirmwareTableInformationHandler
Definition: extypes.h:292
@ SystemVerifierThunkExtend
Definition: extypes.h:269
@ SystemComPlusPackage
Definition: extypes.h:276
@ SystemSessionPoolTagInformation
Definition: extypes.h:284
@ SystemSessionDetach
Definition: extypes.h:265
@ SystemHotpatchInformation
Definition: extypes.h:286
@ SystemWow64SharedInformationObsolete
Definition: extypes.h:291
@ SystemPerformanceTraceInformation
Definition: extypes.h:248
@ SystemLoadGdiDriverInSystemSpace
Definition: extypes.h:271
@ SystemSessionProcessInformation
Definition: extypes.h:270
@ SystemNumaAvailableMemory
Definition: extypes.h:277
@ SystemLegacyDriverInformation
Definition: extypes.h:260
@ SystemPrefetcherInformation
Definition: extypes.h:273
struct _SYSTEM_EXCEPTION_INFORMATION * PSYSTEM_EXCEPTION_INFORMATION
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION * PSYSTEM_KERNEL_DEBUGGER_INFORMATION
struct _SYSTEM_FLAGS_INFORMATION * PSYSTEM_FLAGS_INFORMATION
struct _SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION
struct _SYSTEM_PROCESSOR_INFORMATION SYSTEM_PROCESSOR_INFORMATION
struct _SYSTEM_DEVICE_INFORMATION SYSTEM_DEVICE_INFORMATION
#define KernelMode
Definition: asm.h:38
#define UserMode
Definition: asm.h:39
#define PROCESSOR_ARCHITECTURE_ARM
Definition: ketypes.h:110
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize _Pre_valid_ PVOID * BaseAddress
Definition: mmfuncs.h:408
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
struct _RTL_TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION
DRIVER_INFORMATION DriverInfo
Definition: main.c:60
#define _In_reads_bytes_(s)
Definition: no_sal2.h:170
#define _Out_opt_
Definition: no_sal2.h:214
#define _Inout_
Definition: no_sal2.h:162
#define _Out_
Definition: no_sal2.h:160
#define _In_
Definition: no_sal2.h:158
#define _Out_writes_bytes_to_opt_(s, c)
Definition: no_sal2.h:240
#define _Out_writes_bytes_(s)
Definition: no_sal2.h:178
#define _In_reads_bytes_opt_(s)
Definition: no_sal2.h:224
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
CHAR * PCH
Definition: ntbasedef.h:403
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
ULONG CcDataPages
Definition: copy.c:43
ULONG CcDataFlushes
Definition: copy.c:44
ULONG CcMapDataWait
Definition: pin.c:28
ULONG CcMapDataNoWait
Definition: pin.c:29
ULONG CcPinReadWait
Definition: pin.c:30
ULONG CcPinMappedDataCount
Definition: pin.c:32
ULONG CcPinReadNoWait
Definition: pin.c:31
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:43
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:884
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:923
ULONG NtGlobalFlag
Definition: init.c:54
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1822
BOOLEAN NTAPI ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
Definition: sysinfo.c:363
NTSTATUS NTAPI NtQuerySystemEnvironmentValue(IN PUNICODE_STRING VariableName, OUT PWSTR ValueBuffer, IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: sysinfo.c:385
NTSTATUS NTAPI MmSessionCreate(OUT PULONG SessionId)
Definition: session.c:827
VOID NTAPI ExQueryPoolUsage(OUT PULONG PagedPoolPages, OUT PULONG NonPagedPoolPages, OUT PULONG PagedPoolAllocs, OUT PULONG PagedPoolFrees, OUT PULONG PagedPoolLookasideHits, OUT PULONG NonPagedPoolAllocs, OUT PULONG NonPagedPoolFrees, OUT PULONG NonPagedPoolLookasideHits)
Definition: expool.c:1768
#define QSI_DEF(n)
Definition: sysinfo.c:598
#define SIG_RSMB
Definition: sysinfo.c:24
#define SIG_FIRM
Definition: sysinfo.c:23
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
LIST_ENTRY ExpFirmwareTableProviderListHead
Definition: sysinfo.c:31
#define SSI_USE(n)
Definition: sysinfo.c:601
VOID NTAPI ExGetCurrentProcessorCounts(PULONG IdleTime, PULONG KernelAndUserTime, PULONG ProcessorNumber)
Definition: sysinfo.c:345
__kernel_entry NTSTATUS NTAPI NtSetSystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation, _In_ ULONG SystemInformationLength)
Definition: sysinfo.c:3115
#define SIG_ACPI
Definition: sysinfo.c:22
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:3030
struct _QSSI_CALLS QSSI_CALLS
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:29
#define SI_QX(n)
Definition: sysinfo.c:2937
NTSTATUS NTAPI NtEnumerateSystemEnvironmentValuesEx(IN ULONG InformationClass, IN PVOID Buffer, IN ULONG BufferLength)
Definition: sysinfo.c:557
NTSTATUS NTAPI NtSetSystemEnvironmentValueEx(_In_ PUNICODE_STRING VariableName, _In_ LPGUID VendorGuid, _In_reads_bytes_opt_(ValueLength) PVOID Value, _In_ ULONG ValueLength, _In_ ULONG Attributes)
Definition: sysinfo.c:580
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:3029
NTSTATUS NTAPI MmSessionDelete(IN ULONG SessionId)
Definition: session.c:887
BOOLEAN NTAPI ExVerifySuite(SUITE_TYPE SuiteType)
Definition: sysinfo.c:377
#define SI_XS(n)
Definition: sysinfo.c:2938
LIST_ENTRY HandleTableListHead
Definition: handle.c:18
NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx(_In_ PUNICODE_STRING VariableName, _In_ LPGUID VendorGuid, _Out_opt_ PVOID Value, _Inout_ PULONG ReturnLength, _Out_opt_ PULONG Attributes)
Definition: sysinfo.c:567
ERESOURCE ExpFirmwareTableResource
Definition: sysinfo.c:30
#define SI_XX(n)
Definition: sysinfo.c:2939
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2943
NTSTATUS NTAPI ExpQueryModuleInformation(IN PLIST_ENTRY KernelModeList, IN PLIST_ENTRY UserModeList, OUT PRTL_PROCESS_MODULES Modules, IN ULONG Length, OUT PULONG ReturnLength)
Definition: sysinfo.c:91
#define SSI_DEF(n)
Definition: sysinfo.c:602
NTSTATUS NTAPI ExpGetRawSMBiosTable(_Out_opt_ PVOID Buffer, _Out_ ULONG *OutSize, _In_ ULONG BufferSize)
Definition: sysinfo.c:250
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:202
static VOID ExpCopyLookasideInformation(PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer, PULONG RemainingPointer, PLIST_ENTRY ListHead, BOOLEAN ListUsesMisses)
Definition: sysinfo.c:2130
static NTSTATUS ExpQuerySystemProcessInformation(_Out_writes_bytes_(Size) PVOID Buffer, _In_ ULONG Size, _Out_ PULONG ReqSize, _In_ BOOLEAN Extended)
Definition: sysinfo.c:887
#define SI_QS(n)
Definition: sysinfo.c:2936
NTSTATUS NTAPI NtSetSystemEnvironmentValue(IN PUNICODE_STRING VariableName, IN PUNICODE_STRING Value)
Definition: sysinfo.c:487
VOID NTAPI ExGetCurrentProcessorCpuUsage(PULONG CpuUsage)
Definition: sysinfo.c:324
FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule(IN ULONG ModuleCount, IN PLDR_DATA_TABLE_ENTRY LdrEntry, OUT PRTL_PROCESS_MODULE_INFORMATION ModuleInfo)
Definition: sysinfo.c:35
#define MAX_ENVVAL_SIZE
Definition: sysinfo.c:20
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
Definition: time.c:21
ULONG ExpTimeZoneId
Definition: time.c:25
NTSTATUS ExpSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
Definition: time.c:357
#define KeGetContextSwitches(Prcb)
Definition: ke.h:218
#define MmSystemRangeStart
Definition: mm.h:32
BOOLEAN KiTimeAdjustmentEnabled
Definition: time.c:19
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
ULONG KeTimeAdjustment
Definition: time.c:18
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:31
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
KAFFINITY KeActiveProcessors
Definition: processor.c:16
USHORT KeProcessorLevel
Definition: krnlinit.c:20
ULONG KiMinimumDpcRate
Definition: dpc.c:20
PKNODE KeNodeBlock[1]
Definition: krnlinit.c:35
ULONG KiIdealDpcRate
Definition: dpc.c:22
LARGE_INTEGER KeBootTime
Definition: clock.c:17
UCHAR KeNumberNodes
Definition: krnlinit.c:36
USHORT KeProcessorRevision
Definition: krnlinit.c:21
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
NTSTATUS NTAPI MmLoadSystemImage(IN PUNICODE_STRING FileName, IN PUNICODE_STRING NamePrefix OPTIONAL, IN PUNICODE_STRING LoadedName OPTIONAL, IN ULONG Flags, OUT PVOID *ModuleObject, OUT PVOID *ImageBaseAddress)
Definition: sysldr.c:2949
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:28
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:22
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
#define MC_USER
Definition: mm.h:112
#define MM_VIRTMEM_GRANULARITY
Definition: mm.h:102
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:66
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:945
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
SIZE_T MmTotalCommittedPages
Definition: freelist.c:30
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:69
SIZE_T MmPeakCommitment
Definition: freelist.c:35
const LUID SeDebugPrivilege
Definition: priv.c:39
const LUID SeSystemtimePrivilege
Definition: priv.c:31
const LUID SeTcbPrivilege
Definition: priv.c:26
const LUID SeLoadDriverPrivilege
Definition: priv.c:29
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:41
ULONG NTAPI KeGetRecommendedSharedDataAlignment(VOID)
Definition: cpu.c:709
ULONG KeMaximumIncrement
Definition: clock.c:20
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:151
CCHAR KeNumberProcessors
Definition: processor.c:19
NTSTATUS NTAPI SeLocateProcessImageName(_In_ PEPROCESS Process, _Out_ PUNICODE_STRING *ProcessImageName)
Finds the process image name of a specific process.
Definition: audit.c:199
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
NTSTATUS NTAPI IoWMIOpenBlock(_In_ LPCGUID DataBlockGuid, _In_ ULONG DesiredAccess, _Out_ PVOID *DataBlockObject)
Definition: wmi.c:140
NTSTATUS NTAPI IoWMIQueryAllData(IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer)
Definition: wmi.c:169
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:453
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:570
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:333
#define STATUS_ILLEGAL_FUNCTION
Definition: ntstatus.h:505
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:56
#define OBJ_HANDLE_ATTRIBUTES
Definition: ob.h:52
#define ObpGetHandleObject(x)
Definition: ob.h:91
ULONG ObpObjectSecurityMode
Definition: obinit.c:56
static BOOL Set
Definition: pageheap.c:10
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
char CHAR
Definition: pedump.c:57
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
ERESOURCE PsLoadedModuleResource
Definition: sysldr.c:24
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:235
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:204
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:104
#define _SEH2_VOLATILE
Definition: pseh2_64.h:208
#define _SEH2_END
Definition: pseh2_64.h:194
#define _SEH2_TRY
Definition: pseh2_64.h:93
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:207
ARC_STATUS NTAPI HalGetEnvironmentVariable(IN PCH Name, IN USHORT ValueLength, IN PCH Value)
Definition: rtc.c:70
ARC_STATUS NTAPI HalSetEnvironmentVariable(IN PCH Name, IN PCH Value)
Definition: rtc.c:57
@ ESUCCESS
Definition: arc.h:32
ULONG ARC_STATUS
Definition: arc.h:4
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
Definition: probe.h:142
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:239
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:341
#define SharedUserData
#define STATUS_SUCCESS
Definition: shellext.h:65
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
STDMETHOD() Skip(THIS_ ULONG celt) PURE
#define DPRINT
Definition: sndvol32.h:73
#define __kernel_entry
Definition: specstrings.h:355
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
struct _SYSTEM_BASIC_INFORMATION * PSYSTEM_BASIC_INFORMATION
struct _SYSTEM_BASIC_INFORMATION SYSTEM_BASIC_INFORMATION
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
CHAR FullPathName[AUX_KLIB_MODULE_PATH_LEN]
Definition: aux_klib.h:41
PVOID DriverStart
Definition: iotypes.h:2281
KPROCESS Pcb
Definition: pstypes.h:1350
HANDLE UniqueProcessId
Definition: pstypes.h:1355
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1238
KTHREAD Tcb
Definition: pstypes.h:1186
PVOID Win32StartAddress
Definition: pstypes.h:1235
CLIENT_ID Cid
Definition: pstypes.h:1211
LARGE_INTEGER CreateTime
Definition: pstypes.h:1187
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1241
Definition: extypes.h:767
PVOID Object
Definition: extypes.h:770
ULONG GrantedAccess
Definition: extypes.h:777
ULONG_PTR ObAttributes
Definition: extypes.h:771
LONG NextFreeTableEntry
Definition: extypes.h:783
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
ULONG DpcCount
Definition: ketypes.h:1004
ULONG_PTR FreeCount[2]
Definition: ketypes.h:1040
KAFFINITY ProcessorMask
Definition: ketypes.h:1031
ULONG InterruptTime
Definition: ketypes.h:834
struct _KTHREAD * IdleThread
Definition: ketypes.h:666
ULONG UserTime
Definition: ketypes.h:832
struct _KPRCB * MultiThreadSetMaster
Definition: ketypes.h:851
ULONG InterruptCount
Definition: ketypes.h:830
USHORT Number
Definition: ketypes.h:657
KDPC_DATA DpcData[2]
Definition: ketypes.h:774
ULONG DpcTime
Definition: ketypes.h:833
ULONG KeExceptionDispatchCount
Definition: ketypes.h:799
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:761
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:763
ULONG KeSystemCalls
Definition: ketypes.h:745
LONG IoReadOperationCount
Definition: ketypes.h:758
LONG IoWriteOperationCount
Definition: ketypes.h:759
UINT64 SetMember
Definition: ketypes.h:676
LONG IoOtherOperationCount
Definition: ketypes.h:760
ULONG KernelTime
Definition: ketypes.h:831
ULONG DpcRequestRate
Definition: ketypes.h:782
UINT64 MultiThreadProcessorSet
Definition: ketypes.h:850
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:762
ULONG KeAlignmentFixupCount
Definition: ketypes.h:894
ULONG KernelTime
Definition: ketypes.h:2249
SCHAR Priority
Definition: ketypes.h:1929
PVOID Teb
Definition: ketypes.h:1954
ULONG KernelTime
Definition: ketypes.h:2134
CHAR BasePriority
Definition: ketypes.h:2064
ULONG WaitTime
Definition: ketypes.h:2022
UCHAR WaitReason
Definition: ketypes.h:2111
PVOID StackBase
Definition: ketypes.h:1813
ULONG ContextSwitches
Definition: ketypes.h:1935
volatile VOID * StackLimit
Definition: ketypes.h:1812
ULONG UserTime
Definition: ketypes.h:2150
volatile UCHAR State
Definition: ketypes.h:1936
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG PagesUsed
Definition: mm.h:476
POBJECT_TYPE Type
Definition: obtypes.h:493
ULONG Index
Definition: obtypes.h:385
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2927
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2928
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1321
SYSTEM_FIRMWARE_TABLE_ACTION Action
Definition: winternl.h:3224
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4600::@4602 NumaNode
LOGICAL_PROCESSOR_RELATIONSHIP Relationship
Definition: ketypes.h:103
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4600::@4601 ProcessorCore
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1603
ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1604
UNICODE_STRING PageFileName
Definition: extypes.h:1269
LARGE_INTEGER IoOtherTransferCount
Definition: memtest.h:14
LARGE_INTEGER IoWriteTransferCount
Definition: memtest.h:13
LARGE_INTEGER IdleProcessTime
Definition: memtest.h:11
LARGE_INTEGER IoReadTransferCount
Definition: memtest.h:12
LARGE_INTEGER UserTime
Definition: extypes.h:1094
UNICODE_STRING ImageName
Definition: extypes.h:1096
LARGE_INTEGER CreateTime
Definition: extypes.h:1093
LARGE_INTEGER KernelTime
Definition: extypes.h:1095
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:1034
USHORT MaximumLength
Definition: env_spec_w32.h:370
ACPI_SIZE Length
Definition: actypes.h:1053
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define TAG_SEPA
Definition: tag.h:157
#define TAG_MDL
Definition: tag.h:88
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
unsigned char UCHAR
Definition: typedefs.h:53
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define NTAPI
Definition: typedefs.h:36
void * PVOID
Definition: typedefs.h:50
PVOID HANDLE
Definition: typedefs.h:73
uint64_t ULONGLONG
Definition: typedefs.h:67
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define IN
Definition: typedefs.h:39
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
uint16_t * PWCHAR
Definition: typedefs.h:56
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
unsigned char * PUCHAR
Definition: typedefs.h:53
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
char * PCHAR
Definition: typedefs.h:51
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: ex.h:90
LONGLONG QuadPart
Definition: typedefs.h:114
Definition: dlist.c:348
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4539
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3777
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _In_ ULONG ValueLength
Definition: wdfregistry.h:275
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:413
#define FORCEINLINE
Definition: wdftypes.h:67
#define PROCESSOR_FEATURE_MAX
Definition: wdm.h:10
NTSYSAPI ULONG WINAPI NtGetCurrentProcessorNumber(void)
Definition: sysinfo.c:3162
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION * PSYSTEM_FIRMWARE_TABLE_INFORMATION
@ SystemFirmwareTable_Enumerate
Definition: winternl.h:3215
@ SystemFirmwareTable_Get
Definition: winternl.h:3216
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:30
#define WMIGUID_QUERY
Definition: wmistr.h:159
_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:409
@ Personal
Definition: extypes.h:29
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
FAST_MUTEX
Definition: extypes.h:17
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
enum _SUITE_TYPE SUITE_TYPE
#define HalQuerySystemInformation
Definition: haltypes.h:304
@ HalProcessorBrandString
Definition: haltypes.h:52
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
Definition: iotypes.h:2237
#define KD_DEBUGGER_ENABLED
Definition: kdfuncs.h:130
#define KD_DEBUGGER_NOT_PRESENT
Definition: kdfuncs.h:133
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
enum _LOCK_OPERATION LOCK_OPERATION
@ IoWriteAccess
Definition: ketypes.h:932
#define DPC_NORMAL
@ RelationNumaNode
Definition: ketypes.h:83
@ RelationProcessorCore
Definition: ketypes.h:82
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION SYSTEM_LOGICAL_PROCESSOR_INFORMATION
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
_In_ ACCESS_MASK _In_opt_ POBJECT_TYPE _In_ KPROCESSOR_MODE _Out_ PVOID _Out_opt_ POBJECT_HANDLE_INFORMATION HandleInformation
Definition: obfuncs.h:44
#define ObDereferenceObject
Definition: obfuncs.h:203