ReactOS 0.4.16-dev-965-gf669426
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 */
886{
889 PEPROCESS Process = NULL, SystemProcess;
890 PETHREAD CurrentThread;
892 ULONG CurrentSize;
893 USHORT ImageNameMaximumLength; // image name length in bytes
894 USHORT ImageNameLength;
895 PLIST_ENTRY CurrentEntry;
896 ULONG TotalSize = 0, ThreadsCount;
897 ULONG TotalUser, TotalKernel;
898 PUCHAR Current;
900 PUNICODE_STRING TempProcessImageName;
901 _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
902 PWCHAR szSrc;
903 BOOLEAN Overflow = FALSE;
904
906 {
907 /* scan the process list */
908
911
912 *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
913
914 /* Check for overflow */
915 if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
916 {
917 Overflow = TRUE;
918 }
919
920 /* Zero user's buffer */
921 if (!Overflow) RtlZeroMemory(Spi, Size);
922
923 SystemProcess = PsIdleProcess;
924 Process = SystemProcess;
925 Current = (PUCHAR) Spi;
926
927 do
928 {
929 SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
930
931 /* Lock the Process */
933 ExAcquirePushLockShared(&Process->ProcessLock);
934
935 if ((Process->ProcessExiting) &&
936 (Process->Pcb.Header.SignalState) &&
937 !(Process->ActiveThreads) &&
938 (IsListEmpty(&Process->Pcb.ThreadListHead)))
939 {
940 DPRINT1("Process %p (%s:%p) is a zombie\n",
941 Process, Process->ImageFileName, Process->UniqueProcessId);
942 CurrentSize = 0;
943 ImageNameMaximumLength = 0;
944
945 /* Unlock the Process */
946 ExReleasePushLockShared(&Process->ProcessLock);
948 goto Skip;
949 }
950
951 ThreadsCount = 0;
952 CurrentEntry = Process->Pcb.ThreadListHead.Flink;
953 while (CurrentEntry != &Process->Pcb.ThreadListHead)
954 {
955 ThreadsCount++;
956 CurrentEntry = CurrentEntry->Flink;
957 }
958
959 // size of the structure for every process
960 CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
961 ImageNameLength = 0;
962 Status = SeLocateProcessImageName(Process, &TempProcessImageName);
963 ProcessImageName = TempProcessImageName;
964 szSrc = NULL;
965 if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
966 {
967 szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
968 /* Loop the file name*/
969 while (szSrc > ProcessImageName->Buffer)
970 {
971 /* Make sure this isn't a backslash */
972 if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
973 {
974 szSrc++;
975 break;
976 }
977 else
978 {
979 ImageNameLength += sizeof(WCHAR);
980 }
981 }
982 }
983 if (!ImageNameLength && Process != PsIdleProcess)
984 {
985 ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
986 }
987
988 /* Round up the image name length as NT does */
989 if (ImageNameLength > 0)
990 ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
991 else
992 ImageNameMaximumLength = 0;
993
994 TotalSize += CurrentSize + ImageNameMaximumLength;
995
996 /* Check for overflow */
997 if (TotalSize > Size)
998 {
999 Overflow = TRUE;
1000 }
1001
1002 /* Fill system information */
1003 if (!Overflow)
1004 {
1005 SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
1006 SpiCurrent->NumberOfThreads = ThreadsCount;
1007 SpiCurrent->CreateTime = Process->CreateTime;
1008 SpiCurrent->ImageName.Length = ImageNameLength;
1009 SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
1010 SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
1011
1012 /* Copy name to the end of the struct */
1013 if(Process != PsIdleProcess)
1014 {
1015 if (szSrc)
1016 {
1017 RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1018 }
1019 else
1020 {
1021 RtlInitAnsiString(&ImageName, Process->ImageFileName);
1023 if (!NT_SUCCESS(Status))
1024 {
1025 SpiCurrent->ImageName.Length = 0;
1026 }
1027 }
1028 }
1029 else
1030 {
1031 RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1032 }
1033
1034 SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1035 SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1036 SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1037
1038 /* PsIdleProcess shares its handle table with PsInitialSystemProcess,
1039 * so return the handle count for System only, not Idle one. */
1041
1042 SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1043 SpiCurrent->VirtualSize = Process->VirtualSize;
1044 SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1045 SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1046 SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1047 SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
1048 SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
1049 SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
1050 SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
1051 SpiCurrent->PagefileUsage = Process->QuotaUsage[PsPageFile];
1052 SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[PsPageFile];
1053 SpiCurrent->PrivatePageCount = Process->CommitCharge;
1054 ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1055
1056 CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1057 while (CurrentEntry != &Process->Pcb.ThreadListHead)
1058 {
1059 CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1060
1061 ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1062 ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1063 ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1064 ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1065 ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1066 ThreadInfo->ClientId = CurrentThread->Cid;
1067 ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1068 ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1069 ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1070 ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1071 ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1072
1073 ThreadInfo++;
1074 CurrentEntry = CurrentEntry->Flink;
1075 }
1076
1077 /* Query total user/kernel times of a process */
1078 TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1079 SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1080 SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1081 }
1082
1083 if (ProcessImageName)
1084 {
1085 /* Release the memory allocated by SeLocateProcessImageName */
1086 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1087 ProcessImageName = NULL;
1088 }
1089
1090 /* Unlock the Process */
1091 ExReleasePushLockShared(&Process->ProcessLock);
1093
1094 /* Handle idle process entry */
1095Skip:
1097
1099 ThreadsCount = 0;
1100 if ((Process == SystemProcess) || (Process == NULL))
1101 {
1102 if (!Overflow)
1103 SpiCurrent->NextEntryOffset = 0;
1104 break;
1105 }
1106 else
1107 Current += CurrentSize + ImageNameMaximumLength;
1108 } while ((Process != SystemProcess) && (Process != NULL));
1109
1110 if(Process != NULL)
1113 }
1115 {
1116 if(Process != NULL)
1118 if (ProcessImageName)
1119 {
1120 /* Release the memory allocated by SeLocateProcessImageName */
1121 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1122 }
1123
1125 }
1126 _SEH2_END
1127
1128 if (Overflow)
1130
1131 *ReqSize = TotalSize;
1132 return Status;
1133}
1134
1135/* Class 6 - Call Count Information */
1137{
1138 /* FIXME */
1139 DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1141}
1142
1143/* Class 7 - Device Information */
1145{
1148 PCONFIGURATION_INFORMATION ConfigInfo;
1149
1150 *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1151
1152 /* Check user buffer's size */
1153 if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1154 {
1156 }
1157
1158 ConfigInfo = IoGetConfigurationInformation();
1159
1160 Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1161 Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1162 Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1163 Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1164 Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1165 Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1166
1167 return STATUS_SUCCESS;
1168}
1169
1170/* Class 8 - Processor Performance Information */
1172{
1175
1176 LONG i;
1177 ULONG TotalTime;
1178 PKPRCB Prcb;
1179
1181
1182 /* Check user buffer's size */
1183 if (Size < *ReqSize)
1184 {
1186 }
1187
1188 for (i = 0; i < KeNumberProcessors; i++)
1189 {
1190 /* Get the PRCB on this processor */
1191 Prcb = KiProcessorBlock[i];
1192
1193 /* Calculate total user and kernel times */
1194 TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1200 Spi->InterruptCount = Prcb->InterruptCount;
1201 Spi++;
1202 }
1203
1204 return STATUS_SUCCESS;
1205}
1206
1207/* Class 9 - Flags Information */
1209{
1210#if (NTDDI_VERSION >= NTDDI_VISTA)
1211 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1212#endif
1213
1214 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1215 {
1217 }
1218
1220#if (NTDDI_VERSION < NTDDI_VISTA)
1221 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1222#endif
1223
1224 return STATUS_SUCCESS;
1225}
1226
1228{
1229 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1230 {
1232 }
1233
1235 {
1236#if (NTDDI_VERSION < NTDDI_WIN7)
1238#else
1239 return STATUS_ACCESS_DENIED;
1240#endif
1241 }
1242
1244 return STATUS_SUCCESS;
1245}
1246
1247/* Class 10 - Call Time Information */
1249{
1250 /* FIXME */
1251 DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1253}
1254
1255/* Class 11 - Module Information */
1257{
1259
1260 /* Acquire system module list lock */
1263
1264 /* Call the generic handler with the system module list */
1268 Size,
1269 ReqSize);
1270
1271 /* Release list lock and return status */
1274 return Status;
1275}
1276
1277/* Class 12 - Locks Information */
1279{
1280 /* FIXME */
1281 DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1283}
1284
1285/* Class 13 - Stack Trace Information */
1287{
1288 /* FIXME */
1289 DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1291}
1292
1293/* Class 14 - Paged Pool Information */
1295{
1296 /* FIXME */
1297 DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1299}
1300
1301/* Class 15 - Non Paged Pool Information */
1303{
1304 /* FIXME */
1305 DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1307}
1308
1309/* Class 16 - Handle Information */
1311{
1313 PLIST_ENTRY NextTableEntry;
1315 PHANDLE_TABLE_ENTRY HandleTableEntry;
1317 ULONG Index = 0;
1319 PMDL Mdl;
1320 PAGED_CODE();
1321
1322 DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1323
1324 /* Set initial required buffer size */
1325 *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1326
1327 /* Check user's buffer size */
1328 if (Size < *ReqSize)
1329 {
1331 }
1332
1333 /* We need to lock down the memory */
1335 Size,
1339 &Mdl);
1340 if (!NT_SUCCESS(Status))
1341 {
1342 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1343 return Status;
1344 }
1345
1346 /* Reset of count of handles */
1347 HandleInformation->NumberOfHandles = 0;
1348
1349 /* Enter a critical region */
1351
1352 /* Acquire the handle table lock */
1354
1355 /* Enumerate all system handles */
1356 for (NextTableEntry = HandleTableListHead.Flink;
1357 NextTableEntry != &HandleTableListHead;
1358 NextTableEntry = NextTableEntry->Flink)
1359 {
1360 /* Get current handle table */
1361 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1362
1363 /* Set the initial value and loop the entries */
1364 Handle.Value = 0;
1365 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1366 {
1367 /* Validate the entry */
1368 if ((HandleTableEntry->Object) &&
1369 (HandleTableEntry->NextFreeTableEntry != -2))
1370 {
1371 /* Increase of count of handles */
1372 ++HandleInformation->NumberOfHandles;
1373
1374 /* Lock the entry */
1375 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1376 {
1377 /* Increase required buffer size */
1378 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1379
1380 /* Check user's buffer size */
1381 if (*ReqSize > Size)
1382 {
1384 }
1385 else
1386 {
1387 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1388
1389 /* Filling handle information */
1390 HandleInformation->Handles[Index].UniqueProcessId =
1391 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1392
1393 HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1394
1395#if 0 /* FIXME!!! Type field corrupted */
1396 HandleInformation->Handles[Index].ObjectTypeIndex =
1397 (UCHAR) ObjectHeader->Type->Index;
1398#else
1399 HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1400#endif
1401
1402 HandleInformation->Handles[Index].HandleAttributes =
1403 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1404
1405 HandleInformation->Handles[Index].HandleValue =
1406 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1407
1408 HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1409
1410 HandleInformation->Handles[Index].GrantedAccess =
1411 HandleTableEntry->GrantedAccess;
1412
1413 ++Index;
1414 }
1415
1416 /* Unlock it */
1417 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1418 }
1419 }
1420
1421 /* Go to the next entry */
1422 Handle.Value += sizeof(HANDLE);
1423 }
1424 }
1425
1426 /* Release the lock */
1428
1429 /* Leave the critical region */
1431
1432 /* Release the locked user buffer */
1434
1435 return Status;
1436}
1437
1438/* Class 17 - Information */
1440{
1441 /* FIXME */
1442 DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1444}
1445
1446/* Class 18 - Information */
1448{
1449 UNICODE_STRING FileName; /* FIXME */
1451
1452 if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1453 {
1454 * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1456 }
1457
1458 RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1459
1460 /* FIXME */
1461 Spfi->NextEntryOffset = 0;
1462
1465 Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1466 Spfi->PageFileName = FileName;
1467 return STATUS_SUCCESS;
1468}
1469
1470/* Class 19 - Vdm Instemul Information */
1472{
1473 /* FIXME */
1474 DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1476}
1477
1478/* Class 20 - Vdm Bop Information */
1480{
1481 /* FIXME */
1482 DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1484}
1485
1486/* Class 21 - File Cache Information */
1488{
1490
1491 *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1492
1493 if (Size < *ReqSize)
1494 {
1496 }
1497
1499
1500 /* Return the Byte size not the page size. */
1501 Sci->CurrentSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1502 Sci->PeakSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1503 /* Taskmgr multiplies this one by page size right away */
1505 /* system working set and standby pages. */
1506 Sci->PageFaultCount = 0; /* FIXME */
1507 Sci->MinimumWorkingSet = 0; /* FIXME */
1508 Sci->MaximumWorkingSet = 0; /* FIXME */
1509
1510 return STATUS_SUCCESS;
1511}
1512
1514{
1515 if (Size < sizeof(SYSTEM_FILECACHE_INFORMATION))
1516 {
1518 }
1519 /* FIXME */
1520 DPRINT1("NtSetSystemInformation - SystemFileCacheInformation not implemented\n");
1522}
1523
1524/* Class 22 - Pool Tag Information */
1526{
1528 return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1529}
1530
1531/* Class 23 - Interrupt Information for all processors */
1533{
1534 PKPRCB Prcb;
1535 LONG i;
1536 ULONG ti;
1538
1540 {
1542 }
1543
1544 ti = KeQueryTimeIncrement();
1545
1546 for (i = 0; i < KeNumberProcessors; i++)
1547 {
1548 Prcb = KiProcessorBlock[i];
1550 sii->DpcCount = Prcb->DpcData[0].DpcCount;
1551 sii->DpcRate = Prcb->DpcRequestRate;
1552 sii->TimeIncrement = ti;
1553 sii->DpcBypassCount = 0;
1554 sii->ApcBypassCount = 0;
1555 sii++;
1556 }
1557
1558 return STATUS_SUCCESS;
1559}
1560
1561/* Class 24 - DPC Behaviour Information */
1563{
1565
1567 {
1569 }
1570
1575
1576 return STATUS_SUCCESS;
1577}
1578
1580{
1581 /* FIXME */
1582 DPRINT1("NtSetSystemInformation - SystemDpcBehaviourInformation not implemented\n");
1584}
1585
1586/* Class 25 - Full Memory Information */
1588{
1589 PULONG Spi = (PULONG) Buffer;
1590
1592
1593 *ReqSize = sizeof(ULONG);
1594
1595 if (sizeof(ULONG) != Size)
1596 {
1598 }
1599
1600 DPRINT("SystemFullMemoryInformation\n");
1601
1603
1604 DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1609
1611
1612 return STATUS_SUCCESS;
1613}
1614
1615/* Class 26 - Load Image */
1617{
1620 PVOID ImageBase;
1621 PVOID SectionPointer;
1622 ULONG_PTR EntryPoint;
1624 ULONG DirSize;
1625 PIMAGE_NT_HEADERS NtHeader;
1626
1627 /* Validate size */
1628 if (Size != sizeof(SYSTEM_GDI_DRIVER_INFORMATION))
1629 {
1630 /* Incorrect buffer length, fail */
1632 }
1633
1634 /* Only kernel mode can call this function */
1636
1637 /* Load the driver */
1638 ImageName = DriverInfo->DriverName;
1640 NULL,
1641 NULL,
1642 0,
1643 &SectionPointer,
1644 &ImageBase);
1645 if (!NT_SUCCESS(Status)) return Status;
1646
1647 /* Return the export pointer */
1648 DriverInfo->ExportSectionPointer =
1650 TRUE,
1652 &DirSize);
1653
1654 /* Get the entrypoint */
1655 NtHeader = RtlImageNtHeader(ImageBase);
1656 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1657 EntryPoint += (ULONG_PTR)ImageBase;
1658
1659 /* Save other data */
1660 DriverInfo->ImageAddress = ImageBase;
1661 DriverInfo->SectionPointer = SectionPointer;
1662 DriverInfo->EntryPoint = (PVOID)EntryPoint;
1663 DriverInfo->ImageLength = NtHeader->OptionalHeader.SizeOfImage;
1664
1665 /* All is good */
1666 return STATUS_SUCCESS;
1667}
1668
1669/* Class 27 - Unload Image */
1671{
1672 PVOID *SectionPointer = Buffer;
1673
1674 /* Validate size */
1675 if (Size != sizeof(PVOID))
1676 {
1677 /* Incorrect length, fail */
1679 }
1680
1681 /* Only kernel mode can call this function */
1683
1684 /* Unload the image */
1685 MmUnloadSystemImage(*SectionPointer);
1686 return STATUS_SUCCESS;
1687}
1688
1689/* Class 28 - Time Adjustment Information */
1691{
1694
1695 /* Check if enough storage was provided */
1697 {
1698 * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1700 }
1701
1702 /* Give time values to our caller */
1704 TimeInfo->TimeAdjustment = KeTimeAdjustment;
1705 TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1706
1707 return STATUS_SUCCESS;
1708}
1709
1711{
1715
1716 /* Check size of a buffer, it must match our expectations */
1719
1720 /* Check who is calling */
1721 if (PreviousMode != KernelMode)
1722 {
1723 /* Check access rights */
1725 {
1727 }
1728 }
1729
1730 /* FIXME: behaviour suggests the member be named 'Disable' */
1731 if (TimeInfo->Enable)
1732 {
1733 /* Disable time adjustment and set default value */
1736 }
1737 else
1738 {
1739 /* Check if a valid time adjustment value is given */
1740 if (TimeInfo->TimeAdjustment == 0) return STATUS_INVALID_PARAMETER_2;
1741
1742 /* Enable time adjustment and set the adjustment value */
1744 KeTimeAdjustment = TimeInfo->TimeAdjustment;
1745 }
1746
1747 return STATUS_SUCCESS;
1748}
1749
1750/* Class 29 - Summary Memory Information */
1752{
1753 /* FIXME */
1754 DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1756}
1757
1758/* Class 30 - Next Event Id Information */
1760{
1761 /* FIXME */
1762 DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1764}
1765
1766/* Class 31 */
1768{
1769 /* FIXME */
1770 DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1772}
1773
1774/* Class 32 - Crash Dump Information */
1776{
1777 /* FIXME */
1778 DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1780}
1781
1782/* Class 33 - Exception Information */
1784{
1785 PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1787 PKPRCB Prcb;
1788 ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1789 ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1790 CHAR i;
1791
1792 /* Check size of a buffer, it must match our expectations */
1793 if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1795
1796 /* Sum up exception count information from all processors */
1797 for (i = 0; i < KeNumberProcessors; i++)
1798 {
1799 Prcb = KiProcessorBlock[i];
1800 if (Prcb)
1801 {
1802 AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1803 ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1804#ifndef _M_ARM
1805 FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1806#endif // _M_ARM
1807 }
1808 }
1809
1810 /* Save information in user's buffer */
1811 ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1812 ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1813 ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1814 ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1815
1816 return STATUS_SUCCESS;
1817}
1818
1819/* Class 34 - Crash Dump State Information */
1821{
1822 /* FIXME */
1823 DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1825}
1826
1827/* Class 35 - Kernel Debugger Information */
1829{
1831
1832#if (NTDDI_VERSION >= NTDDI_VISTA)
1833 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1834#endif
1835
1837 {
1839 }
1840
1843
1844#if (NTDDI_VERSION < NTDDI_VISTA)
1845 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1846#endif
1847
1848 return STATUS_SUCCESS;
1849}
1850
1851/* Class 36 - Context Switch Information */
1853{
1854 PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1856 ULONG ContextSwitches;
1857 PKPRCB Prcb;
1858 CHAR i;
1859
1860 /* Check size of a buffer, it must match our expectations */
1863
1864 /* Calculate total value of context switches across all processors */
1865 ContextSwitches = 0;
1866 for (i = 0; i < KeNumberProcessors; i ++)
1867 {
1868 Prcb = KiProcessorBlock[i];
1869 if (Prcb)
1870 {
1871 ContextSwitches += KeGetContextSwitches(Prcb);
1872 }
1873 }
1874
1875 ContextSwitchInformation->ContextSwitches = ContextSwitches;
1876
1877 /* FIXME */
1878 ContextSwitchInformation->FindAny = 0;
1879 ContextSwitchInformation->FindLast = 0;
1880 ContextSwitchInformation->FindIdeal = 0;
1881 ContextSwitchInformation->IdleAny = 0;
1882 ContextSwitchInformation->IdleCurrent = 0;
1883 ContextSwitchInformation->IdleLast = 0;
1884 ContextSwitchInformation->IdleIdeal = 0;
1885 ContextSwitchInformation->PreemptAny = 0;
1886 ContextSwitchInformation->PreemptCurrent = 0;
1887 ContextSwitchInformation->PreemptLast = 0;
1888 ContextSwitchInformation->SwitchToIdle = 0;
1889
1890 return STATUS_SUCCESS;
1891}
1892
1893/* Class 37 - Registry Quota Information */
1895{
1897
1898 *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1900 {
1902 }
1903
1904 DPRINT1("Faking max registry size of 32 MB\n");
1905 srqi->RegistryQuotaAllowed = 0x2000000;
1906 srqi->RegistryQuotaUsed = 0x200000;
1907 srqi->PagedPoolSize = 0x200000;
1908
1909 return STATUS_SUCCESS;
1910}
1911
1913{
1914 /* FIXME */
1915 DPRINT1("NtSetSystemInformation - SystemRegistryQuotaInformation not implemented\n");
1917}
1918
1919/* Class 38 - Load And Call Image */
1921{
1924 PLDR_DATA_TABLE_ENTRY ModuleObject;
1926 PIMAGE_NT_HEADERS NtHeader;
1927 DRIVER_OBJECT Win32k;
1928 PDRIVER_INITIALIZE DriverInit;
1929 PVOID ImageBase;
1930 ULONG_PTR EntryPoint;
1931
1932 /* Validate the size */
1933 if (Size != sizeof(UNICODE_STRING)) return STATUS_INFO_LENGTH_MISMATCH;
1934
1935 /* Check who is calling */
1936 if (PreviousMode != KernelMode)
1937 {
1938 static const UNICODE_STRING Win32kName =
1939 RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
1940
1941 /* Make sure we can load drivers */
1943 {
1944 /* FIXME: We can't, fail */
1946 }
1947
1948 _SEH2_TRY
1949 {
1950 /* Probe and copy the unicode string */
1951 ProbeForRead(Buffer, sizeof(ImageName), 1);
1953
1954 /* Probe the string buffer */
1955 ProbeForRead(ImageName.Buffer, ImageName.Length, sizeof(WCHAR));
1956
1957 /* Check if we have the correct name (nothing else is allowed!) */
1958 if (!RtlEqualUnicodeString(&ImageName, &Win32kName, FALSE))
1959 {
1961 }
1962 }
1964 {
1966 }
1967 _SEH2_END;
1968
1969 /* Recursively call the function, so that we are from kernel mode */
1971 (PVOID)&Win32kName,
1972 sizeof(Win32kName));
1973 }
1974
1975 /* Load the image */
1977 NULL,
1978 NULL,
1979 0,
1980 (PVOID)&ModuleObject,
1981 &ImageBase);
1982
1983 if (!NT_SUCCESS(Status)) return Status;
1984
1985 /* Get the headers */
1986 NtHeader = RtlImageNtHeader(ImageBase);
1987 if (!NtHeader)
1988 {
1989 /* Fail */
1990 MmUnloadSystemImage(ModuleObject);
1992 }
1993
1994 /* Get the entrypoint */
1995 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1996 EntryPoint += (ULONG_PTR)ImageBase;
1997 DriverInit = (PDRIVER_INITIALIZE)EntryPoint;
1998
1999 /* Create a dummy device */
2000 RtlZeroMemory(&Win32k, sizeof(Win32k));
2002 Win32k.DriverStart = ImageBase;
2003
2004 /* Call it */
2005 Status = (DriverInit)(&Win32k, NULL);
2007
2008 /* Unload if we failed */
2009 if (!NT_SUCCESS(Status)) MmUnloadSystemImage(ModuleObject);
2010 return Status;
2011}
2012
2013/* Class 39 - Priority Separation */
2015{
2016 /* Check if the size is correct */
2017 if (Size != sizeof(ULONG))
2018 {
2020 }
2021
2022 /* We need the TCB privilege */
2024 {
2026 }
2027
2028 /* Modify the quantum table */
2030
2031 return STATUS_SUCCESS;
2032}
2033
2034/* Class 40 */
2035QSI_DEF(SystemVerifierAddDriverInformation)
2036{
2037 /* FIXME */
2038 DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2040}
2041
2042/* Class 41 */
2043QSI_DEF(SystemVerifierRemoveDriverInformation)
2044{
2045 /* FIXME */
2046 DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2048}
2049
2050/* Class 42 - Power Information */
2051QSI_DEF(SystemProcessorIdleInformation)
2052{
2054
2056 {
2058 }
2059
2060 /* FIXME */
2061 DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2063}
2064
2065/* Class 43 */
2066QSI_DEF(SystemLegacyDriverInformation)
2067{
2068 /* FIXME */
2069 DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2071}
2072
2073/* Class 44 - Current Time Zone Information */
2075{
2076 *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2077
2078 if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2079 {
2081 }
2082
2083 /* Copy the time zone information struct */
2084 memcpy(Buffer,
2087
2088 return STATUS_SUCCESS;
2089}
2090
2092{
2093 /* Check user buffer's size */
2094 if (Size < sizeof(RTL_TIME_ZONE_INFORMATION))
2095 {
2097 }
2098
2100}
2101
2102static
2103VOID
2105 PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer,
2106 PULONG RemainingPointer,
2107 PLIST_ENTRY ListHead,
2108 BOOLEAN ListUsesMisses)
2109
2110{
2113 PLIST_ENTRY ListEntry;
2114 ULONG Remaining;
2115
2116 /* Get info pointer and remaining count of free array element */
2117 Info = *InfoPointer;
2118 Remaining = *RemainingPointer;
2119
2120 /* Loop as long as we have lookaside lists and free array elements */
2121 for (ListEntry = ListHead->Flink;
2122 (ListEntry != ListHead) && (Remaining > 0);
2123 ListEntry = ListEntry->Flink, Remaining--)
2124 {
2125 LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2126
2127 /* Fill the next array element */
2128 Info->CurrentDepth = LookasideList->Depth;
2129 Info->MaximumDepth = LookasideList->MaximumDepth;
2130 Info->TotalAllocates = LookasideList->TotalAllocates;
2131 Info->TotalFrees = LookasideList->TotalFrees;
2132 Info->Type = LookasideList->Type;
2133 Info->Tag = LookasideList->Tag;
2134 Info->Size = LookasideList->Size;
2135
2136 /* Check how the lists track misses/hits */
2137 if (ListUsesMisses)
2138 {
2139 /* Copy misses */
2140 Info->AllocateMisses = LookasideList->AllocateMisses;
2141 Info->FreeMisses = LookasideList->FreeMisses;
2142 }
2143 else
2144 {
2145 /* Calculate misses */
2146 Info->AllocateMisses = LookasideList->TotalAllocates
2147 - LookasideList->AllocateHits;
2148 Info->FreeMisses = LookasideList->TotalFrees
2149 - LookasideList->FreeHits;
2150 }
2151 }
2152
2153 /* Return the updated pointer and remaining count */
2154 *InfoPointer = Info;
2155 *RemainingPointer = Remaining;
2156}
2157
2158/* Class 45 - Lookaside Information */
2160{
2163 PMDL Mdl;
2164 ULONG MaxCount, Remaining;
2165 KIRQL OldIrql;
2167
2168 /* First we need to lock down the memory, since we are going to access it
2169 at high IRQL */
2172 Size,
2175 (PVOID*)&Info,
2176 &Mdl);
2177 if (!NT_SUCCESS(Status))
2178 {
2179 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2180 return Status;
2181 }
2182
2183 /* Calculate how many items we can store */
2184 Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2185 if (Remaining == 0)
2186 {
2187 goto Leave;
2188 }
2189
2190 /* Copy info from pool lookaside lists */
2192 &Remaining,
2194 FALSE);
2195 if (Remaining == 0)
2196 {
2197 goto Leave;
2198 }
2199
2200 /* Copy info from system lookaside lists */
2202 &Remaining,
2204 TRUE);
2205 if (Remaining == 0)
2206 {
2207 goto Leave;
2208 }
2209
2210 /* Acquire spinlock for ExpNonPagedLookasideListHead */
2212
2213 /* Copy info from non-paged lookaside lists */
2215 &Remaining,
2217 TRUE);
2218
2219 /* Release spinlock for ExpNonPagedLookasideListHead */
2221
2222 if (Remaining == 0)
2223 {
2224 goto Leave;
2225 }
2226
2227 /* Acquire spinlock for ExpPagedLookasideListHead */
2229
2230 /* Copy info from paged lookaside lists */
2232 &Remaining,
2234 TRUE);
2235
2236 /* Release spinlock for ExpPagedLookasideListHead */
2238
2239Leave:
2240
2241 /* Release the locked user buffer */
2243
2244 /* Return the size of the actually written data */
2245 *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2246 return STATUS_SUCCESS;
2247}
2248
2249/* Class 46 - Set time slip event */
2251{
2252 /* FIXME */
2253 DPRINT1("NtSetSystemInformation - SystemTimeSlipNotification not implemented\n");
2255}
2256
2258NTAPI
2260
2262NTAPI
2264
2265/* Class 47 - Create a new session (TSE) */
2267{
2271
2272 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2273
2274 if (PreviousMode != KernelMode)
2275 {
2277 {
2279 }
2280
2282 }
2283
2286
2287 return Status;
2288}
2289
2290/* Class 48 - Delete an existing session (TSE) */
2292{
2295
2296 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2297
2298 if (PreviousMode != KernelMode)
2299 {
2301 {
2303 }
2304 }
2305
2307
2308 return MmSessionDelete(SessionId);
2309}
2310
2311/* Class 49 - UNKNOWN */
2313{
2314 /* FIXME */
2315 DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2317}
2318
2319/* Class 50 - System range start address */
2321{
2322 /* Check user buffer's size */
2323 if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2324
2326
2327 if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2328
2329 return STATUS_SUCCESS;
2330}
2331
2332/* Class 51 - Driver verifier information */
2334{
2335 /* FIXME */
2336 DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2338}
2339
2341{
2342 /* FIXME */
2343 DPRINT1("NtSetSystemInformation - SystemVerifierInformation not implemented\n");
2345}
2346
2347/* Class 52 */
2348SSI_DEF(SystemVerifierThunkExtend)
2349{
2350 /* FIXME */
2351 DPRINT1("NtSetSystemInformation - SystemVerifierThunkExtend not implemented\n");
2353}
2354
2355/* Class 53 - A session's processes */
2357{
2358 /* FIXME */
2359 DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2361}
2362
2363/* Class 54 - Load & map in system space */
2365{
2366 /* FIXME */
2367 DPRINT1("NtSetSystemInformation - SystemLoadGdiDriverInSystemSpaceInformation not implemented\n");
2369}
2370
2371/* Class 55 - NUMA processor information */
2373{
2374 ULONG MaxEntries, Node;
2376
2377 /* Validate input size */
2378 if (Size < sizeof(ULONG))
2379 {
2381 }
2382
2383 /* Return highest node */
2384 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2385
2386 /* Compute how much entries we will be able to put in output structure */
2387 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2388 /* Make sure we don't overflow KeNodeBlock */
2389 if (MaxEntries > KeNumberNodes)
2390 {
2391 MaxEntries = KeNumberNodes;
2392 }
2393
2394 /* If we have entries to write, and room for it */
2395 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2396 MaxEntries != 0)
2397 {
2398 /* Already set size we return */
2399 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2400 MaxEntries * sizeof(ULONGLONG);
2401
2402 /* For each node, return processor mask */
2403 for (Node = 0; Node < MaxEntries; ++Node)
2404 {
2406 }
2407 }
2408 else
2409 {
2410 /* We only returned highest node number */
2411 *ReqSize = sizeof(ULONG);
2412 }
2413
2414 return STATUS_SUCCESS;
2415}
2416
2417/* Class 56 - Prefetcher information */
2419{
2420 /* FIXME */
2421 DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2423}
2424
2425/* Class 57 - Extended process information */
2427{
2428 /* FIXME */
2429 DPRINT1("NtQuerySystemInformation - SystemExtendedProcessInformation not implemented\n");
2431}
2432
2433/* Class 58 - Recommended shared data alignment */
2435{
2436 /* FIXME */
2437 DPRINT1("NtQuerySystemInformation - SystemRecommendedSharedDataAlignment not implemented\n");
2439}
2440
2441/* Class 60 - NUMA memory information */
2443{
2444 ULONG MaxEntries, Node;
2446
2447 /* Validate input size */
2448 if (Size < sizeof(ULONG))
2449 {
2451 }
2452
2453 /* Return highest node */
2454 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2455
2456 /* Compute how much entries we will be able to put in output structure */
2457 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2458 /* Make sure we don't overflow KeNodeBlock */
2459 if (MaxEntries > KeNumberNodes)
2460 {
2461 MaxEntries = KeNumberNodes;
2462 }
2463
2464 /* If we have entries to write, and room for it */
2465 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) &&
2466 MaxEntries != 0)
2467 {
2468 /* Already set size we return */
2469 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) +
2470 MaxEntries * sizeof(ULONGLONG);
2471
2472 /* If we have a single entry (us), directly return MM information */
2473 if (MaxEntries == 1)
2474 {
2475 NumaInformation->AvailableMemory[0] = MmAvailablePages << PAGE_SHIFT;
2476 }
2477 else
2478 {
2479 /* Otherwise, for each node, return available bytes */
2480 for (Node = 0; Node < MaxEntries; ++Node)
2481 {
2482 NumaInformation->AvailableMemory[Node] = (KeNodeBlock[Node]->FreeCount[0] + KeNodeBlock[Node]->FreeCount[1]) << PAGE_SHIFT;
2483 }
2484 }
2485 }
2486 else
2487 {
2488 /* We only returned highest node number */
2489 *ReqSize = sizeof(ULONG);
2490 }
2491
2492 return STATUS_SUCCESS;
2493}
2494
2495/* Class 64 - Extended handle information */
2497{
2499 PLIST_ENTRY NextTableEntry;
2501 PHANDLE_TABLE_ENTRY HandleTableEntry;
2503 ULONG Index = 0;
2505 PMDL Mdl;
2506 PAGED_CODE();
2507
2508 DPRINT("NtQuerySystemInformation - SystemExtendedHandleInformation\n");
2509
2510 /* Set initial required buffer size */
2512
2513 /* Check user's buffer size */
2514 if (Size < *ReqSize)
2515 {
2517 }
2518
2519 /* We need to lock down the memory */
2521 Size,
2525 &Mdl);
2526 if (!NT_SUCCESS(Status))
2527 {
2528 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2529 return Status;
2530 }
2531
2532 /* Reset of count of handles */
2533 HandleInformation->Count = 0;
2534
2535 /* Enter a critical region */
2537
2538 /* Acquire the handle table lock */
2540
2541 /* Enumerate all system handles */
2542 for (NextTableEntry = HandleTableListHead.Flink;
2543 NextTableEntry != &HandleTableListHead;
2544 NextTableEntry = NextTableEntry->Flink)
2545 {
2546 /* Get current handle table */
2547 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
2548
2549 /* Set the initial value and loop the entries */
2550 Handle.Value = 0;
2551 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
2552 {
2553 /* Validate the entry */
2554 if ((HandleTableEntry->Object) &&
2555 (HandleTableEntry->NextFreeTableEntry != -2))
2556 {
2557 /* Increase of count of handles */
2558 ++HandleInformation->Count;
2559
2560 /* Lock the entry */
2561 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
2562 {
2563 /* Increase required buffer size */
2564 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
2565
2566 /* Check user's buffer size */
2567 if (*ReqSize > Size)
2568 {
2570 }
2571 else
2572 {
2573 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
2574
2575 /* Filling handle information */
2576 HandleInformation->Handle[Index].UniqueProcessId =
2577 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
2578
2579 HandleInformation->Handle[Index].CreatorBackTraceIndex = 0;
2580
2581#if 0 /* FIXME!!! Type field corrupted */
2582 HandleInformation->Handles[Index].ObjectTypeIndex =
2583 (UCHAR) ObjectHeader->Type->Index;
2584#else
2585 HandleInformation->Handle[Index].ObjectTypeIndex = 0;
2586#endif
2587
2588 HandleInformation->Handle[Index].HandleAttributes =
2589 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
2590
2591 HandleInformation->Handle[Index].HandleValue =
2592 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
2593
2594 HandleInformation->Handle[Index].Object = &ObjectHeader->Body;
2595
2596 HandleInformation->Handle[Index].GrantedAccess =
2597 HandleTableEntry->GrantedAccess;
2598
2599 HandleInformation->Handle[Index].Reserved = 0;
2600
2601 ++Index;
2602 }
2603
2604 /* Unlock it */
2605 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
2606 }
2607 }
2608
2609 /* Go to the next entry */
2610 Handle.Value += sizeof(HANDLE);
2611 }
2612 }
2613
2614 /* Release the lock */
2616
2617 /* Leave the critical region */
2619
2620 /* Release the locked user buffer */
2622
2623 return Status;
2624}
2625
2626/* Class 70 - System object security mode information */
2628{
2629 PULONG ObjectSecurityInfo = (PULONG)Buffer;
2630
2631 /* Validate input size */
2632 if (Size != sizeof(ULONG))
2633 {
2635 }
2636
2637 *ObjectSecurityInfo = ObpObjectSecurityMode;
2638
2639 return STATUS_SUCCESS;
2640}
2641
2642/* Class 73 - Logical processor information */
2644{
2645 LONG i;
2646 PKPRCB Prcb;
2647 KAFFINITY CurrentProc;
2649 ULONG DataSize = 0, ProcessorFlags;
2651
2652 /* First, browse active processors, thanks to the map */
2653 i = 0;
2654 CurrentInfo = Buffer;
2655 CurrentProc = KeActiveProcessors;
2656 do
2657 {
2658 /* If current processor is active and is main in case of HT/MC, return it */
2659 Prcb = KiProcessorBlock[i];
2660 if ((CurrentProc & 1) &&
2661 Prcb == Prcb->MultiThreadSetMaster)
2662 {
2663 /* Assume processor can do HT or multicore */
2664 ProcessorFlags = 1;
2665
2666 /* If set is the same for PRCB and multithread, then
2667 * actually, the processor is single core
2668 */
2669 if (Prcb->SetMember == Prcb->MultiThreadProcessorSet)
2670 {
2671 ProcessorFlags = 0;
2672 }
2673
2674 /* Check we have enough room to return */
2676 if (DataSize > Size)
2677 {
2679 }
2680 else
2681 {
2682 /* Zero output and return */
2684 CurrentInfo->ProcessorMask = Prcb->MultiThreadProcessorSet;
2685
2686 /* Processor core needs 1 if HT/MC is supported */
2687 CurrentInfo->Relationship = RelationProcessorCore;
2688 CurrentInfo->ProcessorCore.Flags = ProcessorFlags;
2689 ++CurrentInfo;
2690 }
2691 }
2692
2693 /* Move to the next proc */
2694 CurrentProc >>= 1;
2695 ++i;
2696 /* Loop while there's someone in the bitmask */
2697 } while (CurrentProc != 0);
2698
2699 /* Now, return the NUMA nodes */
2700 for (i = 0; i < KeNumberNodes; ++i)
2701 {
2702 /* Check we have enough room to return */
2704 if (DataSize > Size)
2705 {
2707 }
2708 else
2709 {
2710 /* Zero output and return */
2712 CurrentInfo->ProcessorMask = KeActiveProcessors;
2713
2714 /* NUMA node needs its ID */
2715 CurrentInfo->Relationship = RelationNumaNode;
2716 CurrentInfo->NumaNode.NodeNumber = i;
2717 ++CurrentInfo;
2718 }
2719 }
2720
2721 *ReqSize = DataSize;
2722
2723 return Status;
2724}
2725
2726/* Class 76 - System firmware table information */
2728{
2731 ULONG InputBufSize;
2732 ULONG DataSize = 0;
2733 ULONG TableCount = 0;
2734
2735 DPRINT("NtQuerySystemInformation - SystemFirmwareTableInformation\n");
2736
2737 /* Set initial required buffer size */
2738 *ReqSize = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
2739
2740 /* Check user's buffer size */
2741 if (Size < *ReqSize)
2742 {
2744 }
2745
2746 InputBufSize = SysFirmwareInfo->TableBufferLength;
2747 switch (SysFirmwareInfo->ProviderSignature)
2748 {
2749 /*
2750 * ExpFirmwareTableResource and ExpFirmwareTableProviderListHead
2751 * variables should be used there somehow...
2752 */
2753 case SIG_ACPI:
2754 {
2755 /* FIXME: Not implemented yet */
2756 DPRINT1("ACPI provider not implemented\n");
2758 break;
2759 }
2760 case SIG_FIRM:
2761 {
2762 /* FIXME: Not implemented yet */
2763 DPRINT1("FIRM provider not implemented\n");
2765 break;
2766 }
2767 case SIG_RSMB:
2768 {
2770 if (DataSize > 0)
2771 {
2772 TableCount = 1;
2773 if (SysFirmwareInfo->Action == SystemFirmwareTable_Enumerate)
2774 {
2775 DataSize = TableCount * sizeof(ULONG);
2776 if (DataSize <= InputBufSize)
2777 {
2778 *(ULONG *)SysFirmwareInfo->TableBuffer = 0;
2779 }
2780 }
2781 else if (SysFirmwareInfo->Action == SystemFirmwareTable_Get
2782 && DataSize <= InputBufSize)
2783 {
2784 Status = ExpGetRawSMBiosTable(SysFirmwareInfo->TableBuffer, &DataSize, InputBufSize);
2785 }
2786 SysFirmwareInfo->TableBufferLength = DataSize;
2787 }
2788 break;
2789 }
2790 default:
2791 {
2792 DPRINT1("SystemFirmwareTableInformation: Unsupported provider (0x%x)\n",
2793 SysFirmwareInfo->ProviderSignature);
2795 }
2796 }
2797
2798 if (NT_SUCCESS(Status))
2799 {
2800 switch (SysFirmwareInfo->Action)
2801 {
2804 {
2805 if (SysFirmwareInfo->TableBufferLength > InputBufSize)
2806 {
2808 }
2809 break;
2810 }
2811 default:
2812 {
2813 DPRINT1("SystemFirmwareTableInformation: Unsupported action (0x%x)\n",
2814 SysFirmwareInfo->Action);
2816 }
2817 }
2818 }
2819 else
2820 {
2821 SysFirmwareInfo->TableBufferLength = 0;
2822 }
2823 return Status;
2824}
2825
2826/* Query/Set Calls Table */
2827typedef
2828struct _QSSI_CALLS
2829{
2833
2834// QS Query & Set
2835// QX Query
2836// XS Set
2837// XX unknown behaviour
2838//
2839#define SI_QS(n) {QSI_USE(n),SSI_USE(n)}
2840#define SI_QX(n) {QSI_USE(n),NULL}
2841#define SI_XS(n) {NULL,SSI_USE(n)}
2842#define SI_XX(n) {NULL,NULL}
2843
2844static
2847{
2858 SI_QX(SystemCallTimeInformation), /* should be SI_XX */
2861 SI_QX(SystemStackTraceInformation), /* should be SI_XX */
2862 SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
2863 SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
2868 SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
2873 SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
2877 SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
2878 SI_QX(SystemNextEventIdInformation), /* it should be SI_XX */
2879 SI_QX(SystemPerformanceTraceInformation), /* it should be SI_XX */
2888 SI_QX(SystemVerifierAddDriverInformation), /* it should be SI_XX */
2889 SI_QX(SystemVerifierRemoveDriverInformation), /* it should be SI_XX */
2890 SI_QX(SystemProcessorIdleInformation), /* it should be SI_XX */
2891 SI_QX(SystemLegacyDriverInformation), /* it should be SI_XX */
2892 SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
2897 SI_QX(SystemSessionInformation), /* it should be SI_XX */
2900 SI_XS(SystemVerifierThunkExtend),
2909 SI_XX(SystemProcessorPowerInformation), /* FIXME: not implemented */
2910 SI_XX(SystemEmulationBasicInformation), /* FIXME: not implemented */
2911 SI_XX(SystemEmulationProcessorInformation), /* FIXME: not implemented */
2913 SI_XX(SystemLostDelayedWriteInformation), /* FIXME: not implemented */
2914 SI_XX(SystemBigPoolInformation), /* FIXME: not implemented */
2915 SI_XX(SystemSessionPoolTagInformation), /* FIXME: not implemented */
2916 SI_XX(SystemSessionMappedViewInformation), /* FIXME: not implemented */
2917 SI_XX(SystemHotpatchInformation), /* FIXME: not implemented */
2919 SI_XX(SystemWatchdogTimerHandler), /* FIXME: not implemented */
2920 SI_XX(SystemWatchdogTimerInformation), /* FIXME: not implemented */
2922 SI_XX(SystemWow64SharedInformation), /* FIXME: not implemented */
2923 SI_XX(SystemRegisterFirmwareTableInformationHandler), /* FIXME: not implemented */
2925};
2926
2928#define MIN_SYSTEM_INFO_CLASS (SystemBasicInformation)
2929#define MAX_SYSTEM_INFO_CLASS RTL_NUMBER_OF(CallQS)
2930
2931/*
2932 * @implemented
2933 */
2936NTAPI
2938 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
2939 _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation,
2940 _In_ ULONG SystemInformationLength,
2942{
2944 ULONG CapturedResultLength = 0;
2947
2948 PAGED_CODE();
2949
2951
2952 _SEH2_TRY
2953 {
2954#if (NTDDI_VERSION >= NTDDI_VISTA)
2955 /*
2956 * Check whether the request is valid.
2957 */
2958 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2959 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2960 {
2962 }
2963#endif
2964
2965 if (PreviousMode != KernelMode)
2966 {
2967 /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
2968 if (SystemInformationClass == SystemKernelDebuggerInformation)
2970
2971 ProbeForWrite(SystemInformation, SystemInformationLength, Alignment);
2972 if (ReturnLength != NULL)
2974 }
2975
2976 if (ReturnLength)
2977 *ReturnLength = 0;
2978
2979#if (NTDDI_VERSION < NTDDI_VISTA)
2980 /*
2981 * Check whether the request is valid.
2982 */
2983 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2984 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2985 {
2987 }
2988#endif
2989
2990 if (CallQS[SystemInformationClass].Query != NULL)
2991 {
2992 /* Hand the request to a subhandler */
2993 Status = CallQS[SystemInformationClass].Query(SystemInformation,
2994 SystemInformationLength,
2995 &CapturedResultLength);
2996
2997 /* Save the result length to the caller */
2998 if (ReturnLength)
2999 *ReturnLength = CapturedResultLength;
3000 }
3001 }
3003 {
3005 }
3006 _SEH2_END;
3007
3008 return Status;
3009}
3010
3013NTAPI
3015 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
3016 _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation,
3017 _In_ ULONG SystemInformationLength)
3018{
3021
3022 PAGED_CODE();
3023
3025
3026 _SEH2_TRY
3027 {
3028 /*
3029 * If called from user mode, check possible unsafe arguments.
3030 */
3031 if (PreviousMode != KernelMode)
3032 {
3033 ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3034 }
3035
3036 /*
3037 * Check whether the request is valid.
3038 */
3039 if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3040 (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3041 {
3042 if (CallQS[SystemInformationClass].Set != NULL)
3043 {
3044 /* Hand the request to a subhandler */
3045 Status = CallQS[SystemInformationClass].Set(SystemInformation,
3046 SystemInformationLength);
3047 }
3048 }
3049 }
3051 {
3053 }
3054 _SEH2_END;
3055
3056 return Status;
3057}
3058
3059ULONG
3060NTAPI
3062{
3063 /* Just use Ke */
3065}
3066
3067#undef ExGetPreviousMode
3069NTAPI
3071{
3072 /* Just use Ke */
3073 return KeGetPreviousMode();
3074}
#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
unsigned char BOOLEAN
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
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
#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
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 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
#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
@ 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
@ SystemCrashDumpInformation
Definition: ntddk_ex.h:43
@ SystemInterruptInformation
Definition: ntddk_ex.h:34
@ SystemNextEventIdInformation
Definition: ntddk_ex.h:41
@ 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
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:25
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:1022
@ PsPageFile
Definition: pstypes.h:1024
@ PsPagedPool
Definition: pstypes.h:1023
NTSYSAPI ULONG WINAPI NtGetCurrentProcessorNumber(void)
Definition: sysinfo.c:3061
@ SystemWatchdogTimerHandler
Definition: winternl.h:990
@ SystemWatchdogTimerInformation
Definition: winternl.h:991
@ SystemWow64SharedInformation
Definition: winternl.h:993
@ SystemDpcBehaviourInformation
Definition: winternl.h:944
#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:1182
#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_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_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_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
@ SystemLogicalProcessorInformation
Definition: extypes.h:290
@ SystemVerifierInformation
Definition: extypes.h:268
@ SystemEmulationBasicInformation
Definition: extypes.h:279
@ SystemBigPoolInformation
Definition: extypes.h:283
@ SystemSessionProcessesInformation
Definition: extypes.h:270
@ SystemLostDelayedWriteInformation
Definition: extypes.h:282
@ SystemRecommendedSharedDataAlignment
Definition: extypes.h:275
@ SystemExtendedHandleInformation
Definition: extypes.h:281
@ SystemSessionCreate
Definition: extypes.h:264
@ SystemSessionMappedViewInformation
Definition: extypes.h:285
@ SystemEmulationProcessorInformation
Definition: extypes.h:280
@ 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
@ SystemLoadGdiDriverInSystemSpaceInformation
Definition: extypes.h:271
@ SystemComPlusPackage
Definition: extypes.h:276
@ SystemSessionPoolTagInformation
Definition: extypes.h:284
@ SystemSessionDetach
Definition: extypes.h:265
@ SystemHotpatchInformation
Definition: extypes.h:286
@ SystemPerformanceTraceInformation
Definition: extypes.h:248
@ SystemNumaAvailableMemory
Definition: extypes.h:277
@ 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
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
struct _RTL_TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
#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 _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:399
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
#define ANSI_NULL
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION * PSYSTEM_FIRMWARE_TABLE_INFORMATION
@ SystemFirmwareTable_Enumerate
@ SystemFirmwareTable_Get
_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
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:3014
#define SIG_ACPI
Definition: sysinfo.c:22
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2929
struct _QSSI_CALLS QSSI_CALLS
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:29
#define SI_QX(n)
Definition: sysinfo.c:2840
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:2928
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:2841
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:2842
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2846
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:2104
#define SI_QS(n)
Definition: sysinfo.c:2839
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:361
#define KeGetContextSwitches(Prcb)
Definition: ke.h:216
#define MmSystemRangeStart
Definition: mm.h:32
ULONG64 KeFeatureBits
Definition: krnlinit.c:22
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:114
#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 KeMaximumIncrement
Definition: clock.c:20
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
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:359
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define STATUS_ACCESS_VIOLATION
Definition: ntstatus.h:242
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
#define STATUS_ILLEGAL_FUNCTION
Definition: ntstatus.h:411
#define L(x)
Definition: ntvdm.h:50
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
long LONG
Definition: pedump.c:60
unsigned short USHORT
Definition: pedump.c:61
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:181
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_VOLATILE
Definition: pseh2_64.h:185
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:184
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
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
@ 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:2279
KPROCESS Pcb
Definition: pstypes.h:1263
HANDLE UniqueProcessId
Definition: pstypes.h:1268
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1156
KTHREAD Tcb
Definition: pstypes.h:1104
CLIENT_ID Cid
Definition: pstypes.h:1129
LARGE_INTEGER CreateTime
Definition: pstypes.h:1105
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1159
Definition: extypes.h:596
PVOID Object
Definition: extypes.h:599
ULONG GrantedAccess
Definition: extypes.h:606
ULONG_PTR ObAttributes
Definition: extypes.h:600
LONG NextFreeTableEntry
Definition: extypes.h:612
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
ULONG DpcCount
Definition: ketypes.h:860
ULONG_PTR FreeCount[2]
Definition: ketypes.h:896
KAFFINITY ProcessorMask
Definition: ketypes.h:887
ULONG InterruptTime
Definition: ketypes.h:829
struct _KTHREAD * IdleThread
Definition: ketypes.h:661
ULONG UserTime
Definition: ketypes.h:827
struct _KPRCB * MultiThreadSetMaster
Definition: ketypes.h:846
ULONG InterruptCount
Definition: ketypes.h:825
USHORT Number
Definition: ketypes.h:652
KDPC_DATA DpcData[2]
Definition: ketypes.h:769
ULONG DpcTime
Definition: ketypes.h:828
ULONG KeExceptionDispatchCount
Definition: ketypes.h:794
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:756
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:758
ULONG KeSystemCalls
Definition: ketypes.h:740
LONG IoReadOperationCount
Definition: ketypes.h:753
LONG IoWriteOperationCount
Definition: ketypes.h:754
UINT64 SetMember
Definition: ketypes.h:671
LONG IoOtherOperationCount
Definition: ketypes.h:755
ULONG KernelTime
Definition: ketypes.h:826
ULONG DpcRequestRate
Definition: ketypes.h:777
UINT64 MultiThreadProcessorSet
Definition: ketypes.h:845
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:757
ULONG KeAlignmentFixupCount
Definition: ketypes.h:889
ULONG KernelTime
Definition: ketypes.h:2102
SCHAR Priority
Definition: ketypes.h:1782
ULONG KernelTime
Definition: ketypes.h:1987
CHAR BasePriority
Definition: ketypes.h:1917
ULONG WaitTime
Definition: ketypes.h:1875
UCHAR WaitReason
Definition: ketypes.h:1964
ULONG ContextSwitches
Definition: ketypes.h:1788
ULONG UserTime
Definition: ketypes.h:2003
volatile UCHAR State
Definition: ketypes.h:1789
Definition: btrfs_drv.h:1876
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG PagesUsed
Definition: mm.h:464
POBJECT_TYPE Type
Definition: obtypes.h:493
ULONG Index
Definition: obtypes.h:385
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2830
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2831
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1131
SYSTEM_FIRMWARE_TABLE_ACTION Action
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4227::@4228 ProcessorCore
LOGICAL_PROCESSOR_RELATIONSHIP Relationship
Definition: ketypes.h:99
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4227::@4229 NumaNode
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1412
ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1413
UNICODE_STRING PageFileName
Definition: extypes.h:1079
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:904
UNICODE_STRING ImageName
Definition: extypes.h:906
LARGE_INTEGER CreateTime
Definition: extypes.h:903
LARGE_INTEGER KernelTime
Definition: extypes.h:905
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:909
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:863
LARGE_INTEGER CurrentTime
Definition: extypes.h:862
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:155
#define TAG_MDL
Definition: tag.h:88
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
uint16_t * PWSTR
Definition: typedefs.h:56
uint32_t * PULONG_PTR
Definition: typedefs.h:65
uint32_t * PULONG
Definition: typedefs.h:59
#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
#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
uint64_t ULONGLONG
Definition: typedefs.h:67
#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:4533
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_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
_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
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
Definition: iotypes.h:2235
#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
#define PROCESSOR_FEATURE_MAX
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
enum _LOCK_OPERATION LOCK_OPERATION
@ IoWriteAccess
Definition: ketypes.h:864
@ 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
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175