ReactOS 0.4.16-dev-122-g325d74c
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;
211 PAGED_CODE();
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
668
669 DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
671
672 return STATUS_SUCCESS;
673}
674
675/* Class 2 - Performance Information */
677{
678 LONG i;
679 ULONG IdleUser, IdleKernel;
680 PKPRCB Prcb;
683
685
686 *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
687
688 /* Check user buffer's size */
690 {
692 }
693
695
696 IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
704 for (i = 0; i < KeNumberProcessors; i ++)
705 {
706 Prcb = KiProcessorBlock[i];
707 if (Prcb)
708 {
715 }
716 }
717
719
721 /*
722 * Add up the full system total + pagefile.
723 * All this make Taskmgr happy but not sure it is the right numbers.
724 * This too, fixes some of GlobalMemoryStatusEx numbers.
725 */
727
729 Spi->PageFaultCount = 0; /* FIXME */
730 Spi->CopyOnWriteCount = 0; /* FIXME */
731 Spi->TransitionCount = 0; /* FIXME */
732 Spi->CacheTransitionCount = 0; /* FIXME */
733 Spi->DemandZeroCount = 0; /* FIXME */
734 Spi->PageReadCount = 0; /* FIXME */
735 Spi->PageReadIoCount = 0; /* FIXME */
736 Spi->CacheReadCount = 0; /* FIXME */
737 Spi->CacheIoCount = 0; /* FIXME */
738 Spi->DirtyPagesWriteCount = 0; /* FIXME */
739 Spi->DirtyWriteIoCount = 0; /* FIXME */
740 Spi->MappedPagesWriteCount = 0; /* FIXME */
741 Spi->MappedWriteIoCount = 0; /* FIXME */
742
743 Spi->PagedPoolPages = 0;
744 Spi->NonPagedPoolPages = 0;
745 Spi->PagedPoolAllocs = 0;
746 Spi->PagedPoolFrees = 0;
747 Spi->PagedPoolLookasideHits = 0;
748 Spi->NonPagedPoolAllocs = 0;
749 Spi->NonPagedPoolFrees = 0;
752 &Spi->NonPagedPoolPages,
753 &Spi->PagedPoolAllocs,
754 &Spi->PagedPoolFrees,
756 &Spi->NonPagedPoolAllocs,
757 &Spi->NonPagedPoolFrees,
759 Spi->FreeSystemPtes = 0; /* FIXME */
760
761 Spi->ResidentSystemCodePage = 0; /* FIXME */
762
763 Spi->TotalSystemDriverPages = 0; /* FIXME */
764 Spi->Spare3Count = 0; /* FIXME */
765
767 Spi->ResidentPagedPoolPage = 0; /* FIXME */
768
769 Spi->ResidentSystemDriverPage = 0; /* FIXME */
770 Spi->CcFastReadNoWait = 0; /* FIXME */
771 Spi->CcFastReadWait = 0; /* FIXME */
772 Spi->CcFastReadResourceMiss = 0; /* FIXME */
773 Spi->CcFastReadNotPossible = 0; /* FIXME */
774
775 Spi->CcFastMdlReadNoWait = 0; /* FIXME */
776 Spi->CcFastMdlReadWait = 0; /* FIXME */
777 Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
778 Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
779
782 Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
783 Spi->CcMapDataWaitMiss = 0; /* FIXME */
784
788 Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
789 Spi->CcPinReadWaitMiss = 0; /* FIXME */
790 Spi->CcCopyReadNoWait = 0; /* FIXME */
791 Spi->CcCopyReadWait = 0; /* FIXME */
792 Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
793 Spi->CcCopyReadWaitMiss = 0; /* FIXME */
794
795 Spi->CcMdlReadNoWait = 0; /* FIXME */
796 Spi->CcMdlReadWait = 0; /* FIXME */
797 Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
798 Spi->CcMdlReadWaitMiss = 0; /* FIXME */
799 Spi->CcReadAheadIos = 0; /* FIXME */
804
805 Spi->ContextSwitches = 0;
806 Spi->FirstLevelTbFills = 0;
807 Spi->SecondLevelTbFills = 0;
808 Spi->SystemCalls = 0;
809 for (i = 0; i < KeNumberProcessors; i ++)
810 {
811 Prcb = KiProcessorBlock[i];
812 if (Prcb)
813 {
815 Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
816 Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
817 Spi->SystemCalls += Prcb->KeSystemCalls;
818 }
819 }
820
821 return STATUS_SUCCESS;
822}
823
824/* Class 3 - Time Of Day Information */
826{
828 LARGE_INTEGER CurrentTime;
829
830 /* Set amount of written information to 0 */
831 *ReqSize = 0;
832
833 /* Check user buffer's size */
835 {
837 }
838
839 /* Get current time */
840 KeQuerySystemTime(&CurrentTime);
841
842 /* Zero local buffer */
844
845 /* Fill local time structure */
846 Sti.BootTime= KeBootTime;
847 Sti.CurrentTime = CurrentTime;
850 Sti.Reserved = 0;
851
852 /* Copy as much as requested by caller */
853 RtlCopyMemory(Buffer, &Sti, Size);
854
855 /* Set amount of information we copied */
856 *ReqSize = Size;
857
858 return STATUS_SUCCESS;
859}
860
861/* Class 4 - Path Information (DEPRECATED) */
863{
864 /*
865 * Since NT 3.51, this information class is trivially implemented.
866 * The path to the NT directory is now stored in KUSER_SHARED_DATA
867 * as the NtSystemRoot member.
868 * Windows Checked builds show the following message and break to
869 * the debugger before failing the function as not implemented.
870 */
871#if DBG
872 DPRINT1("EX: SystemPathInformation now available via SharedUserData\n");
873 // DbgBreakPoint(); // Not needed in ReactOS.
874#endif
876}
877
878/* Class 5 - Process Information */
880{
883 PEPROCESS Process = NULL, SystemProcess;
884 PETHREAD CurrentThread;
886 ULONG CurrentSize;
887 USHORT ImageNameMaximumLength; // image name length in bytes
888 USHORT ImageNameLength;
889 PLIST_ENTRY CurrentEntry;
890 ULONG TotalSize = 0, ThreadsCount;
891 ULONG TotalUser, TotalKernel;
892 PUCHAR Current;
894 PUNICODE_STRING TempProcessImageName;
895 _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
896 PWCHAR szSrc;
897 BOOLEAN Overflow = FALSE;
898
900 {
901 /* scan the process list */
902
905
906 *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
907
908 /* Check for overflow */
909 if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
910 {
911 Overflow = TRUE;
912 }
913
914 /* Zero user's buffer */
915 if (!Overflow) RtlZeroMemory(Spi, Size);
916
917 SystemProcess = PsIdleProcess;
918 Process = SystemProcess;
919 Current = (PUCHAR) Spi;
920
921 do
922 {
923 SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
924
925 /* Lock the Process */
927 ExAcquirePushLockShared(&Process->ProcessLock);
928
929 if ((Process->ProcessExiting) &&
930 (Process->Pcb.Header.SignalState) &&
931 !(Process->ActiveThreads) &&
932 (IsListEmpty(&Process->Pcb.ThreadListHead)))
933 {
934 DPRINT1("Process %p (%s:%p) is a zombie\n",
935 Process, Process->ImageFileName, Process->UniqueProcessId);
936 CurrentSize = 0;
937 ImageNameMaximumLength = 0;
938
939 /* Unlock the Process */
940 ExReleasePushLockShared(&Process->ProcessLock);
942 goto Skip;
943 }
944
945 ThreadsCount = 0;
946 CurrentEntry = Process->Pcb.ThreadListHead.Flink;
947 while (CurrentEntry != &Process->Pcb.ThreadListHead)
948 {
949 ThreadsCount++;
950 CurrentEntry = CurrentEntry->Flink;
951 }
952
953 // size of the structure for every process
954 CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
955 ImageNameLength = 0;
956 Status = SeLocateProcessImageName(Process, &TempProcessImageName);
957 ProcessImageName = TempProcessImageName;
958 szSrc = NULL;
959 if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
960 {
961 szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
962 /* Loop the file name*/
963 while (szSrc > ProcessImageName->Buffer)
964 {
965 /* Make sure this isn't a backslash */
966 if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
967 {
968 szSrc++;
969 break;
970 }
971 else
972 {
973 ImageNameLength += sizeof(WCHAR);
974 }
975 }
976 }
977 if (!ImageNameLength && Process != PsIdleProcess)
978 {
979 ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
980 }
981
982 /* Round up the image name length as NT does */
983 if (ImageNameLength > 0)
984 ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
985 else
986 ImageNameMaximumLength = 0;
987
988 TotalSize += CurrentSize + ImageNameMaximumLength;
989
990 /* Check for overflow */
991 if (TotalSize > Size)
992 {
993 Overflow = TRUE;
994 }
995
996 /* Fill system information */
997 if (!Overflow)
998 {
999 SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
1000 SpiCurrent->NumberOfThreads = ThreadsCount;
1001 SpiCurrent->CreateTime = Process->CreateTime;
1002 SpiCurrent->ImageName.Length = ImageNameLength;
1003 SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
1004 SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
1005
1006 /* Copy name to the end of the struct */
1007 if(Process != PsIdleProcess)
1008 {
1009 if (szSrc)
1010 {
1011 RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1012 }
1013 else
1014 {
1015 RtlInitAnsiString(&ImageName, Process->ImageFileName);
1017 if (!NT_SUCCESS(Status))
1018 {
1019 SpiCurrent->ImageName.Length = 0;
1020 }
1021 }
1022 }
1023 else
1024 {
1025 RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1026 }
1027
1028 SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1029 SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1030 SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1031
1032 /* PsIdleProcess shares its handle table with PsInitialSystemProcess,
1033 * so return the handle count for System only, not Idle one. */
1035
1036 SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1037 SpiCurrent->VirtualSize = Process->VirtualSize;
1038 SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1039 SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1040 SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1041 SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
1042 SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
1043 SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
1044 SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
1045 SpiCurrent->PagefileUsage = Process->QuotaUsage[PsPageFile];
1046 SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[PsPageFile];
1047 SpiCurrent->PrivatePageCount = Process->CommitCharge;
1048 ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1049
1050 CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1051 while (CurrentEntry != &Process->Pcb.ThreadListHead)
1052 {
1053 CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1054
1055 ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1056 ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1057 ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1058 ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1059 ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1060 ThreadInfo->ClientId = CurrentThread->Cid;
1061 ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1062 ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1063 ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1064 ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1065 ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1066
1067 ThreadInfo++;
1068 CurrentEntry = CurrentEntry->Flink;
1069 }
1070
1071 /* Query total user/kernel times of a process */
1072 TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1073 SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1074 SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1075 }
1076
1077 if (ProcessImageName)
1078 {
1079 /* Release the memory allocated by SeLocateProcessImageName */
1080 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1081 ProcessImageName = NULL;
1082 }
1083
1084 /* Unlock the Process */
1085 ExReleasePushLockShared(&Process->ProcessLock);
1087
1088 /* Handle idle process entry */
1089Skip:
1091
1093 ThreadsCount = 0;
1094 if ((Process == SystemProcess) || (Process == NULL))
1095 {
1096 if (!Overflow)
1097 SpiCurrent->NextEntryOffset = 0;
1098 break;
1099 }
1100 else
1101 Current += CurrentSize + ImageNameMaximumLength;
1102 } while ((Process != SystemProcess) && (Process != NULL));
1103
1104 if(Process != NULL)
1107 }
1109 {
1110 if(Process != NULL)
1112 if (ProcessImageName)
1113 {
1114 /* Release the memory allocated by SeLocateProcessImageName */
1115 ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1116 }
1117
1119 }
1120 _SEH2_END
1121
1122 if (Overflow)
1124
1125 *ReqSize = TotalSize;
1126 return Status;
1127}
1128
1129/* Class 6 - Call Count Information */
1131{
1132 /* FIXME */
1133 DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1135}
1136
1137/* Class 7 - Device Information */
1139{
1142 PCONFIGURATION_INFORMATION ConfigInfo;
1143
1144 *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1145
1146 /* Check user buffer's size */
1147 if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1148 {
1150 }
1151
1152 ConfigInfo = IoGetConfigurationInformation();
1153
1154 Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1155 Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1156 Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1157 Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1158 Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1159 Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1160
1161 return STATUS_SUCCESS;
1162}
1163
1164/* Class 8 - Processor Performance Information */
1166{
1169
1170 LONG i;
1171 ULONG TotalTime;
1172 PKPRCB Prcb;
1173
1175
1176 /* Check user buffer's size */
1177 if (Size < *ReqSize)
1178 {
1180 }
1181
1182 for (i = 0; i < KeNumberProcessors; i++)
1183 {
1184 /* Get the PRCB on this processor */
1185 Prcb = KiProcessorBlock[i];
1186
1187 /* Calculate total user and kernel times */
1188 TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1194 Spi->InterruptCount = Prcb->InterruptCount;
1195 Spi++;
1196 }
1197
1198 return STATUS_SUCCESS;
1199}
1200
1201/* Class 9 - Flags Information */
1203{
1204#if (NTDDI_VERSION >= NTDDI_VISTA)
1205 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1206#endif
1207
1208 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1209 {
1211 }
1212
1214#if (NTDDI_VERSION < NTDDI_VISTA)
1215 *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1216#endif
1217
1218 return STATUS_SUCCESS;
1219}
1220
1222{
1223 if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1224 {
1226 }
1227
1229 {
1230#if (NTDDI_VERSION < NTDDI_WIN7)
1232#else
1233 return STATUS_ACCESS_DENIED;
1234#endif
1235 }
1236
1238 return STATUS_SUCCESS;
1239}
1240
1241/* Class 10 - Call Time Information */
1243{
1244 /* FIXME */
1245 DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1247}
1248
1249/* Class 11 - Module Information */
1251{
1253
1254 /* Acquire system module list lock */
1257
1258 /* Call the generic handler with the system module list */
1262 Size,
1263 ReqSize);
1264
1265 /* Release list lock and return status */
1268 return Status;
1269}
1270
1271/* Class 12 - Locks Information */
1273{
1274 /* FIXME */
1275 DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1277}
1278
1279/* Class 13 - Stack Trace Information */
1281{
1282 /* FIXME */
1283 DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1285}
1286
1287/* Class 14 - Paged Pool Information */
1289{
1290 /* FIXME */
1291 DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1293}
1294
1295/* Class 15 - Non Paged Pool Information */
1297{
1298 /* FIXME */
1299 DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1301}
1302
1303/* Class 16 - Handle Information */
1305{
1307 PLIST_ENTRY NextTableEntry;
1309 PHANDLE_TABLE_ENTRY HandleTableEntry;
1311 ULONG Index = 0;
1313 PMDL Mdl;
1314 PAGED_CODE();
1315
1316 DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1317
1318 /* Set initial required buffer size */
1319 *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1320
1321 /* Check user's buffer size */
1322 if (Size < *ReqSize)
1323 {
1325 }
1326
1327 /* We need to lock down the memory */
1329 Size,
1333 &Mdl);
1334 if (!NT_SUCCESS(Status))
1335 {
1336 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1337 return Status;
1338 }
1339
1340 /* Reset of count of handles */
1341 HandleInformation->NumberOfHandles = 0;
1342
1343 /* Enter a critical region */
1345
1346 /* Acquire the handle table lock */
1348
1349 /* Enumerate all system handles */
1350 for (NextTableEntry = HandleTableListHead.Flink;
1351 NextTableEntry != &HandleTableListHead;
1352 NextTableEntry = NextTableEntry->Flink)
1353 {
1354 /* Get current handle table */
1355 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1356
1357 /* Set the initial value and loop the entries */
1358 Handle.Value = 0;
1359 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1360 {
1361 /* Validate the entry */
1362 if ((HandleTableEntry->Object) &&
1363 (HandleTableEntry->NextFreeTableEntry != -2))
1364 {
1365 /* Increase of count of handles */
1366 ++HandleInformation->NumberOfHandles;
1367
1368 /* Lock the entry */
1369 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1370 {
1371 /* Increase required buffer size */
1372 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1373
1374 /* Check user's buffer size */
1375 if (*ReqSize > Size)
1376 {
1378 }
1379 else
1380 {
1381 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1382
1383 /* Filling handle information */
1384 HandleInformation->Handles[Index].UniqueProcessId =
1385 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1386
1387 HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1388
1389#if 0 /* FIXME!!! Type field corrupted */
1390 HandleInformation->Handles[Index].ObjectTypeIndex =
1391 (UCHAR) ObjectHeader->Type->Index;
1392#else
1393 HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1394#endif
1395
1396 HandleInformation->Handles[Index].HandleAttributes =
1397 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1398
1399 HandleInformation->Handles[Index].HandleValue =
1400 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1401
1402 HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1403
1404 HandleInformation->Handles[Index].GrantedAccess =
1405 HandleTableEntry->GrantedAccess;
1406
1407 ++Index;
1408 }
1409
1410 /* Unlock it */
1411 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1412 }
1413 }
1414
1415 /* Go to the next entry */
1416 Handle.Value += sizeof(HANDLE);
1417 }
1418 }
1419
1420 /* Release the lock */
1422
1423 /* Leave the critical region */
1425
1426 /* Release the locked user buffer */
1428
1429 return Status;
1430}
1431
1432/* Class 17 - Information */
1434{
1435 /* FIXME */
1436 DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1438}
1439
1440/* Class 18 - Information */
1442{
1443 UNICODE_STRING FileName; /* FIXME */
1445
1446 if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1447 {
1448 * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1450 }
1451
1452 RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1453
1454 /* FIXME */
1455 Spfi->NextEntryOffset = 0;
1456
1459 Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1460 Spfi->PageFileName = FileName;
1461 return STATUS_SUCCESS;
1462}
1463
1464/* Class 19 - Vdm Instemul Information */
1466{
1467 /* FIXME */
1468 DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1470}
1471
1472/* Class 20 - Vdm Bop Information */
1474{
1475 /* FIXME */
1476 DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1478}
1479
1480/* Class 21 - File Cache Information */
1482{
1484
1485 *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1486
1487 if (Size < *ReqSize)
1488 {
1490 }
1491
1493
1494 /* Return the Byte size not the page size. */
1495 Sci->CurrentSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1496 Sci->PeakSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1497 /* Taskmgr multiplies this one by page size right away */
1499 /* system working set and standby pages. */
1500 Sci->PageFaultCount = 0; /* FIXME */
1501 Sci->MinimumWorkingSet = 0; /* FIXME */
1502 Sci->MaximumWorkingSet = 0; /* FIXME */
1503
1504 return STATUS_SUCCESS;
1505}
1506
1508{
1509 if (Size < sizeof(SYSTEM_FILECACHE_INFORMATION))
1510 {
1512 }
1513 /* FIXME */
1514 DPRINT1("NtSetSystemInformation - SystemFileCacheInformation not implemented\n");
1516}
1517
1518/* Class 22 - Pool Tag Information */
1520{
1522 return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1523}
1524
1525/* Class 23 - Interrupt Information for all processors */
1527{
1528 PKPRCB Prcb;
1529 LONG i;
1530 ULONG ti;
1532
1534 {
1536 }
1537
1538 ti = KeQueryTimeIncrement();
1539
1540 for (i = 0; i < KeNumberProcessors; i++)
1541 {
1542 Prcb = KiProcessorBlock[i];
1544 sii->DpcCount = Prcb->DpcData[0].DpcCount;
1545 sii->DpcRate = Prcb->DpcRequestRate;
1546 sii->TimeIncrement = ti;
1547 sii->DpcBypassCount = 0;
1548 sii->ApcBypassCount = 0;
1549 sii++;
1550 }
1551
1552 return STATUS_SUCCESS;
1553}
1554
1555/* Class 24 - DPC Behaviour Information */
1557{
1559
1561 {
1563 }
1564
1569
1570 return STATUS_SUCCESS;
1571}
1572
1574{
1575 /* FIXME */
1576 DPRINT1("NtSetSystemInformation - SystemDpcBehaviourInformation not implemented\n");
1578}
1579
1580/* Class 25 - Full Memory Information */
1582{
1583 PULONG Spi = (PULONG) Buffer;
1584
1586
1587 *ReqSize = sizeof(ULONG);
1588
1589 if (sizeof(ULONG) != Size)
1590 {
1592 }
1593
1594 DPRINT("SystemFullMemoryInformation\n");
1595
1597
1598 DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1603
1605
1606 return STATUS_SUCCESS;
1607}
1608
1609/* Class 26 - Load Image */
1611{
1614 PVOID ImageBase;
1615 PVOID SectionPointer;
1616 ULONG_PTR EntryPoint;
1618 ULONG DirSize;
1619 PIMAGE_NT_HEADERS NtHeader;
1620
1621 /* Validate size */
1622 if (Size != sizeof(SYSTEM_GDI_DRIVER_INFORMATION))
1623 {
1624 /* Incorrect buffer length, fail */
1626 }
1627
1628 /* Only kernel mode can call this function */
1630
1631 /* Load the driver */
1632 ImageName = DriverInfo->DriverName;
1634 NULL,
1635 NULL,
1636 0,
1637 &SectionPointer,
1638 &ImageBase);
1639 if (!NT_SUCCESS(Status)) return Status;
1640
1641 /* Return the export pointer */
1642 DriverInfo->ExportSectionPointer =
1644 TRUE,
1646 &DirSize);
1647
1648 /* Get the entrypoint */
1649 NtHeader = RtlImageNtHeader(ImageBase);
1650 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1651 EntryPoint += (ULONG_PTR)ImageBase;
1652
1653 /* Save other data */
1654 DriverInfo->ImageAddress = ImageBase;
1655 DriverInfo->SectionPointer = SectionPointer;
1656 DriverInfo->EntryPoint = (PVOID)EntryPoint;
1657 DriverInfo->ImageLength = NtHeader->OptionalHeader.SizeOfImage;
1658
1659 /* All is good */
1660 return STATUS_SUCCESS;
1661}
1662
1663/* Class 27 - Unload Image */
1665{
1666 PVOID *SectionPointer = Buffer;
1667
1668 /* Validate size */
1669 if (Size != sizeof(PVOID))
1670 {
1671 /* Incorrect length, fail */
1673 }
1674
1675 /* Only kernel mode can call this function */
1677
1678 /* Unload the image */
1679 MmUnloadSystemImage(*SectionPointer);
1680 return STATUS_SUCCESS;
1681}
1682
1683/* Class 28 - Time Adjustment Information */
1685{
1688
1689 /* Check if enough storage was provided */
1691 {
1692 * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1694 }
1695
1696 /* Give time values to our caller */
1698 TimeInfo->TimeAdjustment = KeTimeAdjustment;
1699 TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1700
1701 return STATUS_SUCCESS;
1702}
1703
1705{
1709
1710 /* Check size of a buffer, it must match our expectations */
1713
1714 /* Check who is calling */
1715 if (PreviousMode != KernelMode)
1716 {
1717 /* Check access rights */
1719 {
1721 }
1722 }
1723
1724 /* FIXME: behaviour suggests the member be named 'Disable' */
1725 if (TimeInfo->Enable)
1726 {
1727 /* Disable time adjustment and set default value */
1730 }
1731 else
1732 {
1733 /* Check if a valid time adjustment value is given */
1734 if (TimeInfo->TimeAdjustment == 0) return STATUS_INVALID_PARAMETER_2;
1735
1736 /* Enable time adjustment and set the adjustment value */
1738 KeTimeAdjustment = TimeInfo->TimeAdjustment;
1739 }
1740
1741 return STATUS_SUCCESS;
1742}
1743
1744/* Class 29 - Summary Memory Information */
1746{
1747 /* FIXME */
1748 DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1750}
1751
1752/* Class 30 - Next Event Id Information */
1754{
1755 /* FIXME */
1756 DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1758}
1759
1760/* Class 31 */
1762{
1763 /* FIXME */
1764 DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1766}
1767
1768/* Class 32 - Crash Dump Information */
1770{
1771 /* FIXME */
1772 DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1774}
1775
1776/* Class 33 - Exception Information */
1778{
1779 PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1781 PKPRCB Prcb;
1782 ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1783 ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1784 CHAR i;
1785
1786 /* Check size of a buffer, it must match our expectations */
1787 if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1789
1790 /* Sum up exception count information from all processors */
1791 for (i = 0; i < KeNumberProcessors; i++)
1792 {
1793 Prcb = KiProcessorBlock[i];
1794 if (Prcb)
1795 {
1796 AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1797 ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1798#ifndef _M_ARM
1799 FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1800#endif // _M_ARM
1801 }
1802 }
1803
1804 /* Save information in user's buffer */
1805 ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1806 ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1807 ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1808 ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1809
1810 return STATUS_SUCCESS;
1811}
1812
1813/* Class 34 - Crash Dump State Information */
1815{
1816 /* FIXME */
1817 DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1819}
1820
1821/* Class 35 - Kernel Debugger Information */
1823{
1825
1826#if (NTDDI_VERSION >= NTDDI_VISTA)
1827 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1828#endif
1829
1831 {
1833 }
1834
1837
1838#if (NTDDI_VERSION < NTDDI_VISTA)
1839 *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1840#endif
1841
1842 return STATUS_SUCCESS;
1843}
1844
1845/* Class 36 - Context Switch Information */
1847{
1848 PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1850 ULONG ContextSwitches;
1851 PKPRCB Prcb;
1852 CHAR i;
1853
1854 /* Check size of a buffer, it must match our expectations */
1857
1858 /* Calculate total value of context switches across all processors */
1859 ContextSwitches = 0;
1860 for (i = 0; i < KeNumberProcessors; i ++)
1861 {
1862 Prcb = KiProcessorBlock[i];
1863 if (Prcb)
1864 {
1865 ContextSwitches += KeGetContextSwitches(Prcb);
1866 }
1867 }
1868
1869 ContextSwitchInformation->ContextSwitches = ContextSwitches;
1870
1871 /* FIXME */
1872 ContextSwitchInformation->FindAny = 0;
1873 ContextSwitchInformation->FindLast = 0;
1874 ContextSwitchInformation->FindIdeal = 0;
1875 ContextSwitchInformation->IdleAny = 0;
1876 ContextSwitchInformation->IdleCurrent = 0;
1877 ContextSwitchInformation->IdleLast = 0;
1878 ContextSwitchInformation->IdleIdeal = 0;
1879 ContextSwitchInformation->PreemptAny = 0;
1880 ContextSwitchInformation->PreemptCurrent = 0;
1881 ContextSwitchInformation->PreemptLast = 0;
1882 ContextSwitchInformation->SwitchToIdle = 0;
1883
1884 return STATUS_SUCCESS;
1885}
1886
1887/* Class 37 - Registry Quota Information */
1889{
1891
1892 *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1894 {
1896 }
1897
1898 DPRINT1("Faking max registry size of 32 MB\n");
1899 srqi->RegistryQuotaAllowed = 0x2000000;
1900 srqi->RegistryQuotaUsed = 0x200000;
1901 srqi->PagedPoolSize = 0x200000;
1902
1903 return STATUS_SUCCESS;
1904}
1905
1907{
1908 /* FIXME */
1909 DPRINT1("NtSetSystemInformation - SystemRegistryQuotaInformation not implemented\n");
1911}
1912
1913/* Class 38 - Load And Call Image */
1915{
1918 PLDR_DATA_TABLE_ENTRY ModuleObject;
1920 PIMAGE_NT_HEADERS NtHeader;
1921 DRIVER_OBJECT Win32k;
1922 PDRIVER_INITIALIZE DriverInit;
1923 PVOID ImageBase;
1924 ULONG_PTR EntryPoint;
1925
1926 /* Validate the size */
1927 if (Size != sizeof(UNICODE_STRING)) return STATUS_INFO_LENGTH_MISMATCH;
1928
1929 /* Check who is calling */
1930 if (PreviousMode != KernelMode)
1931 {
1932 static const UNICODE_STRING Win32kName =
1933 RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
1934
1935 /* Make sure we can load drivers */
1937 {
1938 /* FIXME: We can't, fail */
1940 }
1941
1942 _SEH2_TRY
1943 {
1944 /* Probe and copy the unicode string */
1945 ProbeForRead(Buffer, sizeof(ImageName), 1);
1947
1948 /* Probe the string buffer */
1949 ProbeForRead(ImageName.Buffer, ImageName.Length, sizeof(WCHAR));
1950
1951 /* Check if we have the correct name (nothing else is allowed!) */
1952 if (!RtlEqualUnicodeString(&ImageName, &Win32kName, FALSE))
1953 {
1955 }
1956 }
1958 {
1960 }
1961 _SEH2_END;
1962
1963 /* Recursively call the function, so that we are from kernel mode */
1965 (PVOID)&Win32kName,
1966 sizeof(Win32kName));
1967 }
1968
1969 /* Load the image */
1971 NULL,
1972 NULL,
1973 0,
1974 (PVOID)&ModuleObject,
1975 &ImageBase);
1976
1977 if (!NT_SUCCESS(Status)) return Status;
1978
1979 /* Get the headers */
1980 NtHeader = RtlImageNtHeader(ImageBase);
1981 if (!NtHeader)
1982 {
1983 /* Fail */
1984 MmUnloadSystemImage(ModuleObject);
1986 }
1987
1988 /* Get the entrypoint */
1989 EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1990 EntryPoint += (ULONG_PTR)ImageBase;
1991 DriverInit = (PDRIVER_INITIALIZE)EntryPoint;
1992
1993 /* Create a dummy device */
1994 RtlZeroMemory(&Win32k, sizeof(Win32k));
1996 Win32k.DriverStart = ImageBase;
1997
1998 /* Call it */
1999 Status = (DriverInit)(&Win32k, NULL);
2001
2002 /* Unload if we failed */
2003 if (!NT_SUCCESS(Status)) MmUnloadSystemImage(ModuleObject);
2004 return Status;
2005}
2006
2007/* Class 39 - Priority Separation */
2009{
2010 /* Check if the size is correct */
2011 if (Size != sizeof(ULONG))
2012 {
2014 }
2015
2016 /* We need the TCB privilege */
2018 {
2020 }
2021
2022 /* Modify the quantum table */
2024
2025 return STATUS_SUCCESS;
2026}
2027
2028/* Class 40 */
2029QSI_DEF(SystemVerifierAddDriverInformation)
2030{
2031 /* FIXME */
2032 DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2034}
2035
2036/* Class 41 */
2037QSI_DEF(SystemVerifierRemoveDriverInformation)
2038{
2039 /* FIXME */
2040 DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2042}
2043
2044/* Class 42 - Power Information */
2045QSI_DEF(SystemProcessorIdleInformation)
2046{
2048
2050 {
2052 }
2053
2054 /* FIXME */
2055 DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2057}
2058
2059/* Class 43 */
2060QSI_DEF(SystemLegacyDriverInformation)
2061{
2062 /* FIXME */
2063 DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2065}
2066
2067/* Class 44 - Current Time Zone Information */
2069{
2070 *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2071
2072 if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2073 {
2075 }
2076
2077 /* Copy the time zone information struct */
2078 memcpy(Buffer,
2081
2082 return STATUS_SUCCESS;
2083}
2084
2086{
2087 /* Check user buffer's size */
2088 if (Size < sizeof(RTL_TIME_ZONE_INFORMATION))
2089 {
2091 }
2092
2094}
2095
2096static
2097VOID
2099 PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer,
2100 PULONG RemainingPointer,
2101 PLIST_ENTRY ListHead,
2102 BOOLEAN ListUsesMisses)
2103
2104{
2107 PLIST_ENTRY ListEntry;
2108 ULONG Remaining;
2109
2110 /* Get info pointer and remaining count of free array element */
2111 Info = *InfoPointer;
2112 Remaining = *RemainingPointer;
2113
2114 /* Loop as long as we have lookaside lists and free array elements */
2115 for (ListEntry = ListHead->Flink;
2116 (ListEntry != ListHead) && (Remaining > 0);
2117 ListEntry = ListEntry->Flink, Remaining--)
2118 {
2119 LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2120
2121 /* Fill the next array element */
2122 Info->CurrentDepth = LookasideList->Depth;
2123 Info->MaximumDepth = LookasideList->MaximumDepth;
2124 Info->TotalAllocates = LookasideList->TotalAllocates;
2125 Info->TotalFrees = LookasideList->TotalFrees;
2126 Info->Type = LookasideList->Type;
2127 Info->Tag = LookasideList->Tag;
2128 Info->Size = LookasideList->Size;
2129
2130 /* Check how the lists track misses/hits */
2131 if (ListUsesMisses)
2132 {
2133 /* Copy misses */
2134 Info->AllocateMisses = LookasideList->AllocateMisses;
2135 Info->FreeMisses = LookasideList->FreeMisses;
2136 }
2137 else
2138 {
2139 /* Calculate misses */
2140 Info->AllocateMisses = LookasideList->TotalAllocates
2141 - LookasideList->AllocateHits;
2142 Info->FreeMisses = LookasideList->TotalFrees
2143 - LookasideList->FreeHits;
2144 }
2145 }
2146
2147 /* Return the updated pointer and remaining count */
2148 *InfoPointer = Info;
2149 *RemainingPointer = Remaining;
2150}
2151
2152/* Class 45 - Lookaside Information */
2154{
2157 PMDL Mdl;
2158 ULONG MaxCount, Remaining;
2159 KIRQL OldIrql;
2161
2162 /* First we need to lock down the memory, since we are going to access it
2163 at high IRQL */
2166 Size,
2169 (PVOID*)&Info,
2170 &Mdl);
2171 if (!NT_SUCCESS(Status))
2172 {
2173 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2174 return Status;
2175 }
2176
2177 /* Calculate how many items we can store */
2178 Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2179 if (Remaining == 0)
2180 {
2181 goto Leave;
2182 }
2183
2184 /* Copy info from pool lookaside lists */
2186 &Remaining,
2188 FALSE);
2189 if (Remaining == 0)
2190 {
2191 goto Leave;
2192 }
2193
2194 /* Copy info from system lookaside lists */
2196 &Remaining,
2198 TRUE);
2199 if (Remaining == 0)
2200 {
2201 goto Leave;
2202 }
2203
2204 /* Acquire spinlock for ExpNonPagedLookasideListHead */
2206
2207 /* Copy info from non-paged lookaside lists */
2209 &Remaining,
2211 TRUE);
2212
2213 /* Release spinlock for ExpNonPagedLookasideListHead */
2215
2216 if (Remaining == 0)
2217 {
2218 goto Leave;
2219 }
2220
2221 /* Acquire spinlock for ExpPagedLookasideListHead */
2223
2224 /* Copy info from paged lookaside lists */
2226 &Remaining,
2228 TRUE);
2229
2230 /* Release spinlock for ExpPagedLookasideListHead */
2232
2233Leave:
2234
2235 /* Release the locked user buffer */
2237
2238 /* Return the size of the actually written data */
2239 *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2240 return STATUS_SUCCESS;
2241}
2242
2243/* Class 46 - Set time slip event */
2245{
2246 /* FIXME */
2247 DPRINT1("NtSetSystemInformation - SystemTimeSlipNotification not implemented\n");
2249}
2250
2252NTAPI
2254
2256NTAPI
2258
2259/* Class 47 - Create a new session (TSE) */
2261{
2265
2266 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2267
2268 if (PreviousMode != KernelMode)
2269 {
2271 {
2273 }
2274
2276 }
2277
2280
2281 return Status;
2282}
2283
2284/* Class 48 - Delete an existing session (TSE) */
2286{
2289
2290 if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2291
2292 if (PreviousMode != KernelMode)
2293 {
2295 {
2297 }
2298 }
2299
2301
2302 return MmSessionDelete(SessionId);
2303}
2304
2305/* Class 49 - UNKNOWN */
2307{
2308 /* FIXME */
2309 DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2311}
2312
2313/* Class 50 - System range start address */
2315{
2316 /* Check user buffer's size */
2317 if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2318
2320
2321 if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2322
2323 return STATUS_SUCCESS;
2324}
2325
2326/* Class 51 - Driver verifier information */
2328{
2329 /* FIXME */
2330 DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2332}
2333
2335{
2336 /* FIXME */
2337 DPRINT1("NtSetSystemInformation - SystemVerifierInformation not implemented\n");
2339}
2340
2341/* Class 52 */
2342SSI_DEF(SystemVerifierThunkExtend)
2343{
2344 /* FIXME */
2345 DPRINT1("NtSetSystemInformation - SystemVerifierThunkExtend not implemented\n");
2347}
2348
2349/* Class 53 - A session's processes */
2351{
2352 /* FIXME */
2353 DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2355}
2356
2357/* Class 54 - Load & map in system space */
2359{
2360 /* FIXME */
2361 DPRINT1("NtSetSystemInformation - SystemLoadGdiDriverInSystemSpaceInformation not implemented\n");
2363}
2364
2365/* Class 55 - NUMA processor information */
2367{
2368 ULONG MaxEntries, Node;
2370
2371 /* Validate input size */
2372 if (Size < sizeof(ULONG))
2373 {
2375 }
2376
2377 /* Return highest node */
2378 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2379
2380 /* Compute how much entries we will be able to put in output structure */
2381 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2382 /* Make sure we don't overflow KeNodeBlock */
2383 if (MaxEntries > KeNumberNodes)
2384 {
2385 MaxEntries = KeNumberNodes;
2386 }
2387
2388 /* If we have entries to write, and room for it */
2389 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2390 MaxEntries != 0)
2391 {
2392 /* Already set size we return */
2393 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2394 MaxEntries * sizeof(ULONGLONG);
2395
2396 /* For each node, return processor mask */
2397 for (Node = 0; Node < MaxEntries; ++Node)
2398 {
2400 }
2401 }
2402 else
2403 {
2404 /* We only returned highest node number */
2405 *ReqSize = sizeof(ULONG);
2406 }
2407
2408 return STATUS_SUCCESS;
2409}
2410
2411/* Class 56 - Prefetcher information */
2413{
2414 /* FIXME */
2415 DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2417}
2418
2419/* Class 57 - Extended process information */
2421{
2422 /* FIXME */
2423 DPRINT1("NtQuerySystemInformation - SystemExtendedProcessInformation not implemented\n");
2425}
2426
2427/* Class 58 - Recommended shared data alignment */
2429{
2430 /* FIXME */
2431 DPRINT1("NtQuerySystemInformation - SystemRecommendedSharedDataAlignment not implemented\n");
2433}
2434
2435/* Class 60 - NUMA memory information */
2437{
2438 ULONG MaxEntries, Node;
2440
2441 /* Validate input size */
2442 if (Size < sizeof(ULONG))
2443 {
2445 }
2446
2447 /* Return highest node */
2448 NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2449
2450 /* Compute how much entries we will be able to put in output structure */
2451 MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2452 /* Make sure we don't overflow KeNodeBlock */
2453 if (MaxEntries > KeNumberNodes)
2454 {
2455 MaxEntries = KeNumberNodes;
2456 }
2457
2458 /* If we have entries to write, and room for it */
2459 if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) &&
2460 MaxEntries != 0)
2461 {
2462 /* Already set size we return */
2463 *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) +
2464 MaxEntries * sizeof(ULONGLONG);
2465
2466 /* If we have a single entry (us), directly return MM information */
2467 if (MaxEntries == 1)
2468 {
2469 NumaInformation->AvailableMemory[0] = MmAvailablePages << PAGE_SHIFT;
2470 }
2471 else
2472 {
2473 /* Otherwise, for each node, return available bytes */
2474 for (Node = 0; Node < MaxEntries; ++Node)
2475 {
2476 NumaInformation->AvailableMemory[Node] = (KeNodeBlock[Node]->FreeCount[0] + KeNodeBlock[Node]->FreeCount[1]) << PAGE_SHIFT;
2477 }
2478 }
2479 }
2480 else
2481 {
2482 /* We only returned highest node number */
2483 *ReqSize = sizeof(ULONG);
2484 }
2485
2486 return STATUS_SUCCESS;
2487}
2488
2489/* Class 64 - Extended handle information */
2491{
2493 PLIST_ENTRY NextTableEntry;
2495 PHANDLE_TABLE_ENTRY HandleTableEntry;
2497 ULONG Index = 0;
2499 PMDL Mdl;
2500 PAGED_CODE();
2501
2502 DPRINT("NtQuerySystemInformation - SystemExtendedHandleInformation\n");
2503
2504 /* Set initial required buffer size */
2506
2507 /* Check user's buffer size */
2508 if (Size < *ReqSize)
2509 {
2511 }
2512
2513 /* We need to lock down the memory */
2515 Size,
2519 &Mdl);
2520 if (!NT_SUCCESS(Status))
2521 {
2522 DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2523 return Status;
2524 }
2525
2526 /* Reset of count of handles */
2527 HandleInformation->Count = 0;
2528
2529 /* Enter a critical region */
2531
2532 /* Acquire the handle table lock */
2534
2535 /* Enumerate all system handles */
2536 for (NextTableEntry = HandleTableListHead.Flink;
2537 NextTableEntry != &HandleTableListHead;
2538 NextTableEntry = NextTableEntry->Flink)
2539 {
2540 /* Get current handle table */
2541 HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
2542
2543 /* Set the initial value and loop the entries */
2544 Handle.Value = 0;
2545 while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
2546 {
2547 /* Validate the entry */
2548 if ((HandleTableEntry->Object) &&
2549 (HandleTableEntry->NextFreeTableEntry != -2))
2550 {
2551 /* Increase of count of handles */
2552 ++HandleInformation->Count;
2553
2554 /* Lock the entry */
2555 if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
2556 {
2557 /* Increase required buffer size */
2558 *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
2559
2560 /* Check user's buffer size */
2561 if (*ReqSize > Size)
2562 {
2564 }
2565 else
2566 {
2567 POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
2568
2569 /* Filling handle information */
2570 HandleInformation->Handle[Index].UniqueProcessId =
2571 (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
2572
2573 HandleInformation->Handle[Index].CreatorBackTraceIndex = 0;
2574
2575#if 0 /* FIXME!!! Type field corrupted */
2576 HandleInformation->Handles[Index].ObjectTypeIndex =
2577 (UCHAR) ObjectHeader->Type->Index;
2578#else
2579 HandleInformation->Handle[Index].ObjectTypeIndex = 0;
2580#endif
2581
2582 HandleInformation->Handle[Index].HandleAttributes =
2583 HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
2584
2585 HandleInformation->Handle[Index].HandleValue =
2586 (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
2587
2588 HandleInformation->Handle[Index].Object = &ObjectHeader->Body;
2589
2590 HandleInformation->Handle[Index].GrantedAccess =
2591 HandleTableEntry->GrantedAccess;
2592
2593 HandleInformation->Handle[Index].Reserved = 0;
2594
2595 ++Index;
2596 }
2597
2598 /* Unlock it */
2599 ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
2600 }
2601 }
2602
2603 /* Go to the next entry */
2604 Handle.Value += sizeof(HANDLE);
2605 }
2606 }
2607
2608 /* Release the lock */
2610
2611 /* Leave the critical region */
2613
2614 /* Release the locked user buffer */
2616
2617 return Status;
2618}
2619
2620/* Class 70 - System object security mode information */
2622{
2623 PULONG ObjectSecurityInfo = (PULONG)Buffer;
2624
2625 /* Validate input size */
2626 if (Size != sizeof(ULONG))
2627 {
2629 }
2630
2631 *ObjectSecurityInfo = ObpObjectSecurityMode;
2632
2633 return STATUS_SUCCESS;
2634}
2635
2636/* Class 73 - Logical processor information */
2638{
2639 LONG i;
2640 PKPRCB Prcb;
2641 KAFFINITY CurrentProc;
2643 ULONG DataSize = 0, ProcessorFlags;
2645
2646 /* First, browse active processors, thanks to the map */
2647 i = 0;
2648 CurrentInfo = Buffer;
2649 CurrentProc = KeActiveProcessors;
2650 do
2651 {
2652 /* If current processor is active and is main in case of HT/MC, return it */
2653 Prcb = KiProcessorBlock[i];
2654 if ((CurrentProc & 1) &&
2655 Prcb == Prcb->MultiThreadSetMaster)
2656 {
2657 /* Assume processor can do HT or multicore */
2658 ProcessorFlags = 1;
2659
2660 /* If set is the same for PRCB and multithread, then
2661 * actually, the processor is single core
2662 */
2663 if (Prcb->SetMember == Prcb->MultiThreadProcessorSet)
2664 {
2665 ProcessorFlags = 0;
2666 }
2667
2668 /* Check we have enough room to return */
2670 if (DataSize > Size)
2671 {
2673 }
2674 else
2675 {
2676 /* Zero output and return */
2678 CurrentInfo->ProcessorMask = Prcb->MultiThreadProcessorSet;
2679
2680 /* Processor core needs 1 if HT/MC is supported */
2681 CurrentInfo->Relationship = RelationProcessorCore;
2682 CurrentInfo->ProcessorCore.Flags = ProcessorFlags;
2683 ++CurrentInfo;
2684 }
2685 }
2686
2687 /* Move to the next proc */
2688 CurrentProc >>= 1;
2689 ++i;
2690 /* Loop while there's someone in the bitmask */
2691 } while (CurrentProc != 0);
2692
2693 /* Now, return the NUMA nodes */
2694 for (i = 0; i < KeNumberNodes; ++i)
2695 {
2696 /* Check we have enough room to return */
2698 if (DataSize > Size)
2699 {
2701 }
2702 else
2703 {
2704 /* Zero output and return */
2706 CurrentInfo->ProcessorMask = KeActiveProcessors;
2707
2708 /* NUMA node needs its ID */
2709 CurrentInfo->Relationship = RelationNumaNode;
2710 CurrentInfo->NumaNode.NodeNumber = i;
2711 ++CurrentInfo;
2712 }
2713 }
2714
2715 *ReqSize = DataSize;
2716
2717 return Status;
2718}
2719
2720/* Class 76 - System firmware table information */
2722{
2725 ULONG InputBufSize;
2726 ULONG DataSize = 0;
2727 ULONG TableCount = 0;
2728
2729 DPRINT("NtQuerySystemInformation - SystemFirmwareTableInformation\n");
2730
2731 /* Set initial required buffer size */
2732 *ReqSize = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
2733
2734 /* Check user's buffer size */
2735 if (Size < *ReqSize)
2736 {
2738 }
2739
2740 InputBufSize = SysFirmwareInfo->TableBufferLength;
2741 switch (SysFirmwareInfo->ProviderSignature)
2742 {
2743 /*
2744 * ExpFirmwareTableResource and ExpFirmwareTableProviderListHead
2745 * variables should be used there somehow...
2746 */
2747 case SIG_ACPI:
2748 {
2749 /* FIXME: Not implemented yet */
2750 DPRINT1("ACPI provider not implemented\n");
2752 break;
2753 }
2754 case SIG_FIRM:
2755 {
2756 /* FIXME: Not implemented yet */
2757 DPRINT1("FIRM provider not implemented\n");
2759 break;
2760 }
2761 case SIG_RSMB:
2762 {
2764 if (DataSize > 0)
2765 {
2766 TableCount = 1;
2767 if (SysFirmwareInfo->Action == SystemFirmwareTable_Enumerate)
2768 {
2769 DataSize = TableCount * sizeof(ULONG);
2770 if (DataSize <= InputBufSize)
2771 {
2772 *(ULONG *)SysFirmwareInfo->TableBuffer = 0;
2773 }
2774 }
2775 else if (SysFirmwareInfo->Action == SystemFirmwareTable_Get
2776 && DataSize <= InputBufSize)
2777 {
2778 Status = ExpGetRawSMBiosTable(SysFirmwareInfo->TableBuffer, &DataSize, InputBufSize);
2779 }
2780 SysFirmwareInfo->TableBufferLength = DataSize;
2781 }
2782 break;
2783 }
2784 default:
2785 {
2786 DPRINT1("SystemFirmwareTableInformation: Unsupported provider (0x%x)\n",
2787 SysFirmwareInfo->ProviderSignature);
2789 }
2790 }
2791
2792 if (NT_SUCCESS(Status))
2793 {
2794 switch (SysFirmwareInfo->Action)
2795 {
2798 {
2799 if (SysFirmwareInfo->TableBufferLength > InputBufSize)
2800 {
2802 }
2803 break;
2804 }
2805 default:
2806 {
2807 DPRINT1("SystemFirmwareTableInformation: Unsupported action (0x%x)\n",
2808 SysFirmwareInfo->Action);
2810 }
2811 }
2812 }
2813 else
2814 {
2815 SysFirmwareInfo->TableBufferLength = 0;
2816 }
2817 return Status;
2818}
2819
2820/* Query/Set Calls Table */
2821typedef
2822struct _QSSI_CALLS
2823{
2827
2828// QS Query & Set
2829// QX Query
2830// XS Set
2831// XX unknown behaviour
2832//
2833#define SI_QS(n) {QSI_USE(n),SSI_USE(n)}
2834#define SI_QX(n) {QSI_USE(n),NULL}
2835#define SI_XS(n) {NULL,SSI_USE(n)}
2836#define SI_XX(n) {NULL,NULL}
2837
2838static
2841{
2852 SI_QX(SystemCallTimeInformation), /* should be SI_XX */
2855 SI_QX(SystemStackTraceInformation), /* should be SI_XX */
2856 SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
2857 SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
2862 SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
2867 SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
2871 SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
2872 SI_QX(SystemNextEventIdInformation), /* it should be SI_XX */
2873 SI_QX(SystemPerformanceTraceInformation), /* it should be SI_XX */
2882 SI_QX(SystemVerifierAddDriverInformation), /* it should be SI_XX */
2883 SI_QX(SystemVerifierRemoveDriverInformation), /* it should be SI_XX */
2884 SI_QX(SystemProcessorIdleInformation), /* it should be SI_XX */
2885 SI_QX(SystemLegacyDriverInformation), /* it should be SI_XX */
2886 SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
2891 SI_QX(SystemSessionInformation), /* it should be SI_XX */
2894 SI_XS(SystemVerifierThunkExtend),
2903 SI_XX(SystemProcessorPowerInformation), /* FIXME: not implemented */
2904 SI_XX(SystemEmulationBasicInformation), /* FIXME: not implemented */
2905 SI_XX(SystemEmulationProcessorInformation), /* FIXME: not implemented */
2907 SI_XX(SystemLostDelayedWriteInformation), /* FIXME: not implemented */
2908 SI_XX(SystemBigPoolInformation), /* FIXME: not implemented */
2909 SI_XX(SystemSessionPoolTagInformation), /* FIXME: not implemented */
2910 SI_XX(SystemSessionMappedViewInformation), /* FIXME: not implemented */
2911 SI_XX(SystemHotpatchInformation), /* FIXME: not implemented */
2913 SI_XX(SystemWatchdogTimerHandler), /* FIXME: not implemented */
2914 SI_XX(SystemWatchdogTimerInformation), /* FIXME: not implemented */
2916 SI_XX(SystemWow64SharedInformation), /* FIXME: not implemented */
2917 SI_XX(SystemRegisterFirmwareTableInformationHandler), /* FIXME: not implemented */
2919};
2920
2922#define MIN_SYSTEM_INFO_CLASS (SystemBasicInformation)
2923#define MAX_SYSTEM_INFO_CLASS RTL_NUMBER_OF(CallQS)
2924
2925/*
2926 * @implemented
2927 */
2930NTAPI
2932 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
2933 _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation,
2934 _In_ ULONG SystemInformationLength,
2936{
2938 ULONG CapturedResultLength = 0;
2941
2942 PAGED_CODE();
2943
2945
2946 _SEH2_TRY
2947 {
2948#if (NTDDI_VERSION >= NTDDI_VISTA)
2949 /*
2950 * Check whether the request is valid.
2951 */
2952 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2953 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2954 {
2956 }
2957#endif
2958
2959 if (PreviousMode != KernelMode)
2960 {
2961 /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
2962 if (SystemInformationClass == SystemKernelDebuggerInformation)
2964
2965 ProbeForWrite(SystemInformation, SystemInformationLength, Alignment);
2966 if (ReturnLength != NULL)
2968 }
2969
2970 if (ReturnLength)
2971 *ReturnLength = 0;
2972
2973#if (NTDDI_VERSION < NTDDI_VISTA)
2974 /*
2975 * Check whether the request is valid.
2976 */
2977 if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2978 SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2979 {
2981 }
2982#endif
2983
2984 if (CallQS[SystemInformationClass].Query != NULL)
2985 {
2986 /* Hand the request to a subhandler */
2987 Status = CallQS[SystemInformationClass].Query(SystemInformation,
2988 SystemInformationLength,
2989 &CapturedResultLength);
2990
2991 /* Save the result length to the caller */
2992 if (ReturnLength)
2993 *ReturnLength = CapturedResultLength;
2994 }
2995 }
2997 {
2999 }
3000 _SEH2_END;
3001
3002 return Status;
3003}
3004
3007NTAPI
3009 _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
3010 _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation,
3011 _In_ ULONG SystemInformationLength)
3012{
3015
3016 PAGED_CODE();
3017
3019
3020 _SEH2_TRY
3021 {
3022 /*
3023 * If called from user mode, check possible unsafe arguments.
3024 */
3025 if (PreviousMode != KernelMode)
3026 {
3027 ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3028 }
3029
3030 /*
3031 * Check whether the request is valid.
3032 */
3033 if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3034 (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3035 {
3036 if (CallQS[SystemInformationClass].Set != NULL)
3037 {
3038 /* Hand the request to a subhandler */
3039 Status = CallQS[SystemInformationClass].Set(SystemInformation,
3040 SystemInformationLength);
3041 }
3042 }
3043 }
3045 {
3047 }
3048 _SEH2_END;
3049
3050 return Status;
3051}
3052
3053ULONG
3054NTAPI
3056{
3057 /* Just use Ke */
3059}
3060
3061#undef ExGetPreviousMode
3063NTAPI
3065{
3066 /* Just use Ke */
3067 return KeGetPreviousMode();
3068}
#define PAGED_CODE()
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define SystemLoadGdiDriverInformation
Definition: DriverTester.h:34
#define SystemExtendServiceTableInformation
Definition: DriverTester.h:35
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: debug.h:118
Definition: bufpool.h:45
#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:21
#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
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
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 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:140
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1105
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1213
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
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
@ 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
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
@ PsNonPagedPool
Definition: pstypes.h:1022
@ PsPageFile
Definition: pstypes.h:1024
@ PsPagedPool
Definition: pstypes.h:1023
NTSYSAPI ULONG WINAPI NtGetCurrentProcessorNumber(void)
Definition: sysinfo.c:3055
@ SystemWatchdogTimerHandler
Definition: winternl.h:990
@ SystemWatchdogTimerInformation
Definition: winternl.h:991
@ SystemWow64SharedInformation
Definition: winternl.h:993
@ SystemDpcBehaviourInformation
Definition: winternl.h:944
#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
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
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
#define _Out_opt_
Definition: ms_sal.h:346
#define _In_reads_bytes_(size)
Definition: ms_sal.h:321
#define _Inout_
Definition: ms_sal.h:378
#define _Out_
Definition: ms_sal.h:345
#define _Out_writes_bytes_to_opt_(size, count)
Definition: ms_sal.h:361
#define _In_
Definition: ms_sal.h:308
#define _In_reads_bytes_opt_(size)
Definition: ms_sal.h:322
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
#define KernelMode
Definition: asm.h:34
#define UserMode
Definition: asm.h:35
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1161
#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
_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
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:391
#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:3008
#define SIG_ACPI
Definition: sysinfo.c:22
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2923
struct _QSSI_CALLS QSSI_CALLS
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:29
#define SI_QX(n)
Definition: sysinfo.c:2834
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:2922
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:2835
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:2836
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2840
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:2098
#define SI_QS(n)
Definition: sysinfo.c:2833
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
BOOLEAN KiTimeAdjustmentEnabled
Definition: time.c:19
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
ULONG KeTimeAdjustment
Definition: time.c:18
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
ULONG KeFeatureBits
Definition: krnlinit.c:22
USHORT KeProcessorLevel
Definition: krnlinit.c:20
ULONG KiMinimumDpcRate
Definition: dpc.c:20
PKNODE KeNodeBlock[1]
Definition: krnlinit.c:39
ULONG KiIdealDpcRate
Definition: dpc.c:22
LARGE_INTEGER KeBootTime
Definition: clock.c:17
UCHAR KeNumberNodes
Definition: krnlinit.c:40
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:2938
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
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_NOT_IMPLEMENTED
Definition: ntstatus.h:239
#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:165
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_VOLATILE
Definition: pseh2_64.h:169
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
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
#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:820
struct _KTHREAD * IdleThread
Definition: ketypes.h:652
ULONG UserTime
Definition: ketypes.h:818
struct _KPRCB * MultiThreadSetMaster
Definition: ketypes.h:837
ULONG InterruptCount
Definition: ketypes.h:816
USHORT Number
Definition: ketypes.h:643
KDPC_DATA DpcData[2]
Definition: ketypes.h:760
ULONG DpcTime
Definition: ketypes.h:819
ULONG KeExceptionDispatchCount
Definition: ketypes.h:785
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:747
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:749
ULONG KeSystemCalls
Definition: ketypes.h:731
LONG IoReadOperationCount
Definition: ketypes.h:744
LONG IoWriteOperationCount
Definition: ketypes.h:745
UINT64 SetMember
Definition: ketypes.h:662
LONG IoOtherOperationCount
Definition: ketypes.h:746
ULONG KernelTime
Definition: ketypes.h:817
ULONG DpcRequestRate
Definition: ketypes.h:768
UINT64 MultiThreadProcessorSet
Definition: ketypes.h:836
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:748
ULONG KeAlignmentFixupCount
Definition: ketypes.h:880
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:457
POBJECT_TYPE Type
Definition: obtypes.h:493
ULONG Index
Definition: obtypes.h:385
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2824
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2825
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1127
SYSTEM_FIRMWARE_TABLE_ACTION Action
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4098::@4100 NumaNode
LOGICAL_PROCESSOR_RELATIONSHIP Relationship
Definition: ketypes.h:99
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@4098::@4099 ProcessorCore
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1408
ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1409
UNICODE_STRING PageFileName
Definition: extypes.h:1075
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:900
UNICODE_STRING ImageName
Definition: extypes.h:902
LARGE_INTEGER CreateTime
Definition: extypes.h:899
LARGE_INTEGER KernelTime
Definition: extypes.h:901
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:905
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:859
LARGE_INTEGER CurrentTime
Definition: extypes.h:858
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:156
#define TAG_MDL
Definition: tag.h:89
#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:87
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
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
unsigned char UCHAR
Definition: xmlstorage.h:181
__wchar_t WCHAR
Definition: xmlstorage.h:180
char CHAR
Definition: xmlstorage.h:175