ReactOS  0.4.15-dev-2985-g54406bf
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 
36  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
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 */
68  if (*p == OBJ_NAME_PATH_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 
90 NTAPI
92  IN PLIST_ENTRY UserModeList,
93  OUT PRTL_PROCESS_MODULES Modules,
94  IN ULONG Length,
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 
192 VOID
193 NTAPI
195 {
198 }
199 
200 NTSTATUS
201 NTAPI
204  ULONG Length,
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 */
224  _SEH2_TRY
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 
248 NTSTATUS
249 NTAPI
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  */
322 VOID
323 NTAPI
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  */
343 VOID
344 NTAPI
346  PULONG TotalCpuTime,
347  PULONG ProcessorNumber)
348 {
349  PKPRCB Prcb;
350 
351  Prcb = KeGetCurrentPrcb();
352 
353  *ThreadKernelTime = Prcb->KernelTime + Prcb->UserTime;
354  *TotalCpuTime = Prcb->CurrentThread->KernelTime;
355  *ProcessorNumber = KeGetCurrentProcessorNumber();
356 }
357 
358 /*
359  * @implemented
360  */
361 BOOLEAN
362 NTAPI
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  */
375 BOOLEAN
376 NTAPI
378 {
379  if (SuiteType == Personal) return TRUE;
380  return FALSE;
381 }
382 
383 NTSTATUS
384 NTAPI
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 */
402  if (PreviousMode != KernelMode)
403  {
404  _SEH2_TRY
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. */
453  _SEH2_TRY
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 
485 NTSTATUS
486 NTAPI
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,
503  PreviousMode,
504  VariableName);
505  if (NT_SUCCESS(Status))
506  {
507  Status = ProbeAndCaptureUnicodeString(&CapturedValue,
508  PreviousMode,
509  Value);
510  if (NT_SUCCESS(Status))
511  {
512  /*
513  * according to ntinternals the SeSystemEnvironmentName privilege is required!
514  */
516  PreviousMode))
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,
545  PreviousMode);
546  }
547 
548  ReleaseCapturedUnicodeString(&CapturedName,
549  PreviousMode);
550  }
551 
552  return Status;
553 }
554 
555 NTSTATUS
556 NTAPI
558  IN PVOID Buffer,
560 {
562  return STATUS_NOT_IMPLEMENTED;
563 }
564 
565 NTSTATUS
566 NTAPI
568  IN LPGUID VendorGuid,
569  IN PVOID Value,
572 {
574  return STATUS_NOT_IMPLEMENTED;
575 }
576 
577 NTSTATUS
578 NTAPI
580  IN LPGUID VendorGuid,
581  IN PVOID Value,
584 {
586  return STATUS_NOT_IMPLEMENTED;
587 }
588 
589 /* --- Query/Set System Information --- */
590 
591 /*
592  * NOTE: QSI_DEF(n) and SSI_DEF(n) define _cdecl function symbols
593  * so the stack is popped only in one place on x86 platform.
594  */
595 #define QSI_USE(n) QSI##n
596 #define QSI_DEF(n) \
597 static NTSTATUS QSI_USE(n) (PVOID Buffer, ULONG Size, PULONG ReqSize)
598 
599 #define SSI_USE(n) SSI##n
600 #define SSI_DEF(n) \
601 static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
602 
603 VOID
604 NTAPI
605 ExQueryPoolUsage(OUT PULONG PagedPoolPages,
606  OUT PULONG NonPagedPoolPages,
607  OUT PULONG PagedPoolAllocs,
608  OUT PULONG PagedPoolFrees,
609  OUT PULONG PagedPoolLookasideHits,
610  OUT PULONG NonPagedPoolAllocs,
611  OUT PULONG NonPagedPoolFrees,
612  OUT PULONG NonPagedPoolLookasideHits);
613 
614 /* Class 0 - Basic Information */
616 {
619 
620  *ReqSize = sizeof(SYSTEM_BASIC_INFORMATION);
621 
622  /* Check user buffer's size */
623  if (Size != sizeof(SYSTEM_BASIC_INFORMATION))
624  {
626  }
627 
628  RtlZeroMemory(Sbi, Size);
629  Sbi->Reserved = 0;
631  Sbi->PageSize = PAGE_SIZE;
635  Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
636  Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */
640 
641  return STATUS_SUCCESS;
642 }
643 
644 /* Class 1 - Processor Information */
646 {
649 
650  *ReqSize = sizeof(SYSTEM_PROCESSOR_INFORMATION);
651 
652  /* Check user buffer's size */
653  if (Size < sizeof(SYSTEM_PROCESSOR_INFORMATION))
654  {
656  }
660 #if (NTDDI_VERSION < NTDDI_WIN8)
661  Spi->Reserved = 0;
662 #else
663  Spi->MaximumProcessors = 0;
664 #endif
666 
667  DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
668  Spi->ProcessorLevel, Spi->ProcessorRevision);
669 
670  return STATUS_SUCCESS;
671 }
672 
673 /* Class 2 - Performance Information */
675 {
676  LONG i;
677  ULONG IdleUser, IdleKernel;
678  PKPRCB Prcb;
681 
683 
684  *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
685 
686  /* Check user buffer's size */
687  if (Size < sizeof(SYSTEM_PERFORMANCE_INFORMATION))
688  {
690  }
691 
693 
694  IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
702  for (i = 0; i < KeNumberProcessors; i ++)
703  {
704  Prcb = KiProcessorBlock[i];
705  if (Prcb)
706  {
713  }
714  }
715 
717  /*
718  * Add up all the used "Committed" memory + pagefile.
719  * Not sure this is right. 8^\
720  */
724  /*
725  * Add up the full system total + pagefile.
726  * All this make Taskmgr happy but not sure it is the right numbers.
727  * This too, fixes some of GlobalMemoryStatusEx numbers.
728  */
730 
731  Spi->PeakCommitment = 0; /* FIXME */
732  Spi->PageFaultCount = 0; /* FIXME */
733  Spi->CopyOnWriteCount = 0; /* FIXME */
734  Spi->TransitionCount = 0; /* FIXME */
735  Spi->CacheTransitionCount = 0; /* FIXME */
736  Spi->DemandZeroCount = 0; /* FIXME */
737  Spi->PageReadCount = 0; /* FIXME */
738  Spi->PageReadIoCount = 0; /* FIXME */
739  Spi->CacheReadCount = 0; /* FIXME */
740  Spi->CacheIoCount = 0; /* FIXME */
741  Spi->DirtyPagesWriteCount = 0; /* FIXME */
742  Spi->DirtyWriteIoCount = 0; /* FIXME */
743  Spi->MappedPagesWriteCount = 0; /* FIXME */
744  Spi->MappedWriteIoCount = 0; /* FIXME */
745 
746  Spi->PagedPoolPages = 0;
747  Spi->NonPagedPoolPages = 0;
748  Spi->PagedPoolAllocs = 0;
749  Spi->PagedPoolFrees = 0;
750  Spi->PagedPoolLookasideHits = 0;
751  Spi->NonPagedPoolAllocs = 0;
752  Spi->NonPagedPoolFrees = 0;
753  Spi->NonPagedPoolLookasideHits = 0;
755  &Spi->NonPagedPoolPages,
756  &Spi->PagedPoolAllocs,
757  &Spi->PagedPoolFrees,
759  &Spi->NonPagedPoolAllocs,
760  &Spi->NonPagedPoolFrees,
762  Spi->FreeSystemPtes = 0; /* FIXME */
763 
764  Spi->ResidentSystemCodePage = 0; /* FIXME */
765 
766  Spi->TotalSystemDriverPages = 0; /* FIXME */
767  Spi->Spare3Count = 0; /* FIXME */
768 
770  Spi->ResidentPagedPoolPage = 0; /* FIXME */
771 
772  Spi->ResidentSystemDriverPage = 0; /* FIXME */
773  Spi->CcFastReadNoWait = 0; /* FIXME */
774  Spi->CcFastReadWait = 0; /* FIXME */
775  Spi->CcFastReadResourceMiss = 0; /* FIXME */
776  Spi->CcFastReadNotPossible = 0; /* FIXME */
777 
778  Spi->CcFastMdlReadNoWait = 0; /* FIXME */
779  Spi->CcFastMdlReadWait = 0; /* FIXME */
780  Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
781  Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
782 
785  Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
786  Spi->CcMapDataWaitMiss = 0; /* FIXME */
787 
791  Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
792  Spi->CcPinReadWaitMiss = 0; /* FIXME */
793  Spi->CcCopyReadNoWait = 0; /* FIXME */
794  Spi->CcCopyReadWait = 0; /* FIXME */
795  Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
796  Spi->CcCopyReadWaitMiss = 0; /* FIXME */
797 
798  Spi->CcMdlReadNoWait = 0; /* FIXME */
799  Spi->CcMdlReadWait = 0; /* FIXME */
800  Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
801  Spi->CcMdlReadWaitMiss = 0; /* FIXME */
802  Spi->CcReadAheadIos = 0; /* FIXME */
806  Spi->CcDataPages = CcDataPages;
807 
808  Spi->ContextSwitches = 0;
809  Spi->FirstLevelTbFills = 0;
810  Spi->SecondLevelTbFills = 0;
811  Spi->SystemCalls = 0;
812  for (i = 0; i < KeNumberProcessors; i ++)
813  {
814  Prcb = KiProcessorBlock[i];
815  if (Prcb)
816  {
818  Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
819  Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
820  Spi->SystemCalls += Prcb->KeSystemCalls;
821  }
822  }
823 
824  return STATUS_SUCCESS;
825 }
826 
827 /* Class 3 - Time Of Day Information */
829 {
831  LARGE_INTEGER CurrentTime;
832 
833  /* Set amount of written information to 0 */
834  *ReqSize = 0;
835 
836  /* Check user buffer's size */
837  if (Size > sizeof(SYSTEM_TIMEOFDAY_INFORMATION))
838  {
840  }
841 
842  /* Get current time */
843  KeQuerySystemTime(&CurrentTime);
844 
845  /* Zero local buffer */
847 
848  /* Fill local time structure */
849  Sti.BootTime= KeBootTime;
850  Sti.CurrentTime = CurrentTime;
853  Sti.Reserved = 0;
854 
855  /* Copy as much as requested by caller */
856  RtlCopyMemory(Buffer, &Sti, Size);
857 
858  /* Set amount of information we copied */
859  *ReqSize = Size;
860 
861  return STATUS_SUCCESS;
862 }
863 
864 /* Class 4 - Path Information */
866 {
867  /* FIXME: QSI returns STATUS_BREAKPOINT. Why? */
868  DPRINT1("NtQuerySystemInformation - SystemPathInformation not implemented\n");
869 
870  return STATUS_BREAKPOINT;
871 }
872 
873 /* Class 5 - Process Information */
875 {
876  PSYSTEM_PROCESS_INFORMATION SpiCurrent;
878  PEPROCESS Process = NULL, SystemProcess;
879  PETHREAD CurrentThread;
881  ULONG CurrentSize;
882  USHORT ImageNameMaximumLength; // image name length in bytes
883  USHORT ImageNameLength;
884  PLIST_ENTRY CurrentEntry;
885  ULONG TotalSize = 0, ThreadsCount;
886  ULONG TotalUser, TotalKernel;
887  PUCHAR Current;
889  PUNICODE_STRING TempProcessImageName;
890  _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
891  PWCHAR szSrc;
892  BOOLEAN Overflow = FALSE;
893 
894  _SEH2_TRY
895  {
896  /* scan the process list */
897 
900 
901  *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
902 
903  /* Check for overflow */
904  if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
905  {
906  Overflow = TRUE;
907  }
908 
909  /* Zero user's buffer */
910  if (!Overflow) RtlZeroMemory(Spi, Size);
911 
912  SystemProcess = PsIdleProcess;
913  Process = SystemProcess;
914  Current = (PUCHAR) Spi;
915 
916  do
917  {
918  SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
919 
920  /* Lock the Process */
922  ExAcquirePushLockShared(&Process->ProcessLock);
923 
924  if ((Process->ProcessExiting) &&
925  (Process->Pcb.Header.SignalState) &&
926  !(Process->ActiveThreads) &&
927  (IsListEmpty(&Process->Pcb.ThreadListHead)))
928  {
929  DPRINT1("Process %p (%s:%p) is a zombie\n",
930  Process, Process->ImageFileName, Process->UniqueProcessId);
931  CurrentSize = 0;
932  ImageNameMaximumLength = 0;
933 
934  /* Unlock the Process */
935  ExReleasePushLockShared(&Process->ProcessLock);
937  goto Skip;
938  }
939 
940  ThreadsCount = 0;
941  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
942  while (CurrentEntry != &Process->Pcb.ThreadListHead)
943  {
944  ThreadsCount++;
945  CurrentEntry = CurrentEntry->Flink;
946  }
947 
948  // size of the structure for every process
949  CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
950  ImageNameLength = 0;
951  Status = SeLocateProcessImageName(Process, &TempProcessImageName);
952  ProcessImageName = TempProcessImageName;
953  szSrc = NULL;
954  if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
955  {
956  szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
957  /* Loop the file name*/
958  while (szSrc > ProcessImageName->Buffer)
959  {
960  /* Make sure this isn't a backslash */
961  if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
962  {
963  szSrc++;
964  break;
965  }
966  else
967  {
968  ImageNameLength += sizeof(WCHAR);
969  }
970  }
971  }
972  if (!ImageNameLength && Process != PsIdleProcess)
973  {
974  ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
975  }
976 
977  /* Round up the image name length as NT does */
978  if (ImageNameLength > 0)
979  ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
980  else
981  ImageNameMaximumLength = 0;
982 
983  TotalSize += CurrentSize + ImageNameMaximumLength;
984 
985  /* Check for overflow */
986  if (TotalSize > Size)
987  {
988  Overflow = TRUE;
989  }
990 
991  /* Fill system information */
992  if (!Overflow)
993  {
994  SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
995  SpiCurrent->NumberOfThreads = ThreadsCount;
996  SpiCurrent->CreateTime = Process->CreateTime;
997  SpiCurrent->ImageName.Length = ImageNameLength;
998  SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
999  SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
1000 
1001  /* Copy name to the end of the struct */
1002  if(Process != PsIdleProcess)
1003  {
1004  if (szSrc)
1005  {
1006  RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1007  }
1008  else
1009  {
1010  RtlInitAnsiString(&ImageName, Process->ImageFileName);
1012  if (!NT_SUCCESS(Status))
1013  {
1014  SpiCurrent->ImageName.Length = 0;
1015  }
1016  }
1017  }
1018  else
1019  {
1020  RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1021  }
1022 
1023  SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1024  SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1025  SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1027  SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1028  SpiCurrent->VirtualSize = Process->VirtualSize;
1029  SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1030  SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1031  SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1032  SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
1033  SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
1034  SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
1035  SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
1036  SpiCurrent->PagefileUsage = Process->QuotaUsage[PsPageFile];
1037  SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[PsPageFile];
1038  SpiCurrent->PrivatePageCount = Process->CommitCharge;
1039  ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1040 
1041  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1042  while (CurrentEntry != &Process->Pcb.ThreadListHead)
1043  {
1044  CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1045 
1046  ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1047  ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1048  ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1049  ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1050  ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1051  ThreadInfo->ClientId = CurrentThread->Cid;
1052  ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1053  ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1054  ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1055  ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1056  ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1057 
1058  ThreadInfo++;
1059  CurrentEntry = CurrentEntry->Flink;
1060  }
1061 
1062  /* Query total user/kernel times of a process */
1063  TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1064  SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1065  SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1066  }
1067 
1068  if (ProcessImageName)
1069  {
1070  /* Release the memory allocated by SeLocateProcessImageName */
1071  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1072  ProcessImageName = NULL;
1073  }
1074 
1075  /* Unlock the Process */
1076  ExReleasePushLockShared(&Process->ProcessLock);
1078 
1079  /* Handle idle process entry */
1080 Skip:
1081  if (Process == PsIdleProcess) Process = NULL;
1082 
1084  ThreadsCount = 0;
1085  if ((Process == SystemProcess) || (Process == NULL))
1086  {
1087  if (!Overflow)
1088  SpiCurrent->NextEntryOffset = 0;
1089  break;
1090  }
1091  else
1092  Current += CurrentSize + ImageNameMaximumLength;
1093  } while ((Process != SystemProcess) && (Process != NULL));
1094 
1095  if(Process != NULL)
1098  }
1100  {
1101  if(Process != NULL)
1103  if (ProcessImageName)
1104  {
1105  /* Release the memory allocated by SeLocateProcessImageName */
1106  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1107  }
1108 
1110  }
1111  _SEH2_END
1112 
1113  if (Overflow)
1115 
1116  *ReqSize = TotalSize;
1117  return Status;
1118 }
1119 
1120 /* Class 6 - Call Count Information */
1122 {
1123  /* FIXME */
1124  DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1125  return STATUS_NOT_IMPLEMENTED;
1126 }
1127 
1128 /* Class 7 - Device Information */
1130 {
1133  PCONFIGURATION_INFORMATION ConfigInfo;
1134 
1135  *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1136 
1137  /* Check user buffer's size */
1138  if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1139  {
1141  }
1142 
1143  ConfigInfo = IoGetConfigurationInformation();
1144 
1145  Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1146  Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1147  Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1148  Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1149  Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1150  Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1151 
1152  return STATUS_SUCCESS;
1153 }
1154 
1155 /* Class 8 - Processor Performance Information */
1157 {
1160 
1161  LONG i;
1162  ULONG TotalTime;
1163  PKPRCB Prcb;
1164 
1166 
1167  /* Check user buffer's size */
1168  if (Size < *ReqSize)
1169  {
1171  }
1172 
1173  for (i = 0; i < KeNumberProcessors; i++)
1174  {
1175  /* Get the PRCB on this processor */
1176  Prcb = KiProcessorBlock[i];
1177 
1178  /* Calculate total user and kernel times */
1179  TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1185  Spi->InterruptCount = Prcb->InterruptCount;
1186  Spi++;
1187  }
1188 
1189  return STATUS_SUCCESS;
1190 }
1191 
1192 /* Class 9 - Flags Information */
1194 {
1195 #if (NTDDI_VERSION >= NTDDI_VISTA)
1196  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1197 #endif
1198 
1199  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1200  {
1202  }
1203 
1205 #if (NTDDI_VERSION < NTDDI_VISTA)
1206  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1207 #endif
1208 
1209  return STATUS_SUCCESS;
1210 }
1211 
1213 {
1214  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1215  {
1217  }
1218 
1220  {
1221  return STATUS_ACCESS_DENIED;
1222  }
1223 
1225  return STATUS_SUCCESS;
1226 }
1227 
1228 /* Class 10 - Call Time Information */
1230 {
1231  /* FIXME */
1232  DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1233  return STATUS_NOT_IMPLEMENTED;
1234 }
1235 
1236 /* Class 11 - Module Information */
1238 {
1239  NTSTATUS Status;
1240 
1241  /* Acquire system module list lock */
1244 
1245  /* Call the generic handler with the system module list */
1249  Size,
1250  ReqSize);
1251 
1252  /* Release list lock and return status */
1255  return Status;
1256 }
1257 
1258 /* Class 12 - Locks Information */
1260 {
1261  /* FIXME */
1262  DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1263  return STATUS_NOT_IMPLEMENTED;
1264 }
1265 
1266 /* Class 13 - Stack Trace Information */
1268 {
1269  /* FIXME */
1270  DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1271  return STATUS_NOT_IMPLEMENTED;
1272 }
1273 
1274 /* Class 14 - Paged Pool Information */
1276 {
1277  /* FIXME */
1278  DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1279  return STATUS_NOT_IMPLEMENTED;
1280 }
1281 
1282 /* Class 15 - Non Paged Pool Information */
1284 {
1285  /* FIXME */
1286  DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1287  return STATUS_NOT_IMPLEMENTED;
1288 }
1289 
1290 
1291 /* Class 16 - Handle Information */
1293 {
1295  PLIST_ENTRY NextTableEntry;
1297  PHANDLE_TABLE_ENTRY HandleTableEntry;
1298  EXHANDLE Handle;
1299  ULONG Index = 0;
1300  NTSTATUS Status;
1301  PMDL Mdl;
1302  PAGED_CODE();
1303 
1304  DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1305 
1306  /* Set initial required buffer size */
1307  *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1308 
1309  /* Check user's buffer size */
1310  if (Size < *ReqSize)
1311  {
1313  }
1314 
1315  /* We need to lock down the memory */
1317  Size,
1319  IoWriteAccess,
1321  &Mdl);
1322  if (!NT_SUCCESS(Status))
1323  {
1324  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1325  return Status;
1326  }
1327 
1328  /* Reset of count of handles */
1329  HandleInformation->NumberOfHandles = 0;
1330 
1331  /* Enter a critical region */
1333 
1334  /* Acquire the handle table lock */
1336 
1337  /* Enumerate all system handles */
1338  for (NextTableEntry = HandleTableListHead.Flink;
1339  NextTableEntry != &HandleTableListHead;
1340  NextTableEntry = NextTableEntry->Flink)
1341  {
1342  /* Get current handle table */
1343  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1344 
1345  /* Set the initial value and loop the entries */
1346  Handle.Value = 0;
1347  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1348  {
1349  /* Validate the entry */
1350  if ((HandleTableEntry->Object) &&
1351  (HandleTableEntry->NextFreeTableEntry != -2))
1352  {
1353  /* Increase of count of handles */
1354  ++HandleInformation->NumberOfHandles;
1355 
1356  /* Lock the entry */
1357  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1358  {
1359  /* Increase required buffer size */
1360  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1361 
1362  /* Check user's buffer size */
1363  if (*ReqSize > Size)
1364  {
1366  }
1367  else
1368  {
1369  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1370 
1371  /* Filling handle information */
1372  HandleInformation->Handles[Index].UniqueProcessId =
1373  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1374 
1375  HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1376 
1377 #if 0 /* FIXME!!! Type field currupted */
1378  HandleInformation->Handles[Index].ObjectTypeIndex =
1379  (UCHAR) ObjectHeader->Type->Index;
1380 #else
1381  HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1382 #endif
1383 
1384  HandleInformation->Handles[Index].HandleAttributes =
1385  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1386 
1387  HandleInformation->Handles[Index].HandleValue =
1388  (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1389 
1390  HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1391 
1392  HandleInformation->Handles[Index].GrantedAccess =
1393  HandleTableEntry->GrantedAccess;
1394 
1395  ++Index;
1396  }
1397 
1398  /* Unlock it */
1399  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1400  }
1401  }
1402 
1403  /* Go to the next entry */
1404  Handle.Value += sizeof(HANDLE);
1405  }
1406  }
1407 
1408  /* Release the lock */
1410 
1411  /* Leave the critical region */
1413 
1414  /* Release the locked user buffer */
1416 
1417  return Status;
1418 }
1419 
1420 /* Class 17 - Information */
1422 {
1423  /* FIXME */
1424  DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1425  return STATUS_NOT_IMPLEMENTED;
1426 }
1427 
1428 /* Class 18 - Information */
1430 {
1431  UNICODE_STRING FileName; /* FIXME */
1433 
1434  if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1435  {
1436  * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1438  }
1439 
1440  RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1441 
1442  /* FIXME */
1443  Spfi->NextEntryOffset = 0;
1444 
1446  Spfi->TotalInUse = MiUsedSwapPages;
1447  Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1448  Spfi->PageFileName = FileName;
1449  return STATUS_SUCCESS;
1450 }
1451 
1452 /* Class 19 - Vdm Instemul Information */
1454 {
1455  /* FIXME */
1456  DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1457  return STATUS_NOT_IMPLEMENTED;
1458 }
1459 
1460 /* Class 20 - Vdm Bop Information */
1462 {
1463  /* FIXME */
1464  DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1465  return STATUS_NOT_IMPLEMENTED;
1466 }
1467 
1468 /* Class 21 - File Cache Information */
1470 {
1472 
1473  *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1474 
1475  if (Size < *ReqSize)
1476  {
1478  }
1479 
1481 
1482  /* Return the Byte size not the page size. */
1483  Sci->CurrentSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1484  Sci->PeakSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1485  /* Taskmgr multiplies this one by page size right away */
1487  /* system working set and standby pages. */
1488  Sci->PageFaultCount = 0; /* FIXME */
1489  Sci->MinimumWorkingSet = 0; /* FIXME */
1490  Sci->MaximumWorkingSet = 0; /* FIXME */
1491 
1492  return STATUS_SUCCESS;
1493 }
1494 
1496 {
1497  if (Size < sizeof(SYSTEM_FILECACHE_INFORMATION))
1498  {
1500  }
1501  /* FIXME */
1502  DPRINT1("NtSetSystemInformation - SystemFileCacheInformation not implemented\n");
1503  return STATUS_NOT_IMPLEMENTED;
1504 }
1505 
1506 /* Class 22 - Pool Tag Information */
1508 {
1510  return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1511 }
1512 
1513 /* Class 23 - Interrupt Information for all processors */
1515 {
1516  PKPRCB Prcb;
1517  LONG i;
1518  ULONG ti;
1520 
1522  {
1524  }
1525 
1526  ti = KeQueryTimeIncrement();
1527 
1528  for (i = 0; i < KeNumberProcessors; i++)
1529  {
1530  Prcb = KiProcessorBlock[i];
1532  sii->DpcCount = Prcb->DpcData[0].DpcCount;
1533  sii->DpcRate = Prcb->DpcRequestRate;
1534  sii->TimeIncrement = ti;
1535  sii->DpcBypassCount = 0;
1536  sii->ApcBypassCount = 0;
1537  sii++;
1538  }
1539 
1540  return STATUS_SUCCESS;
1541 }
1542 
1543 /* Class 24 - DPC Behaviour Information */
1545 {
1547 
1548  if (Size < sizeof(SYSTEM_DPC_BEHAVIOR_INFORMATION))
1549  {
1551  }
1552 
1556  sdbi->IdealDpcRate = KiIdealDpcRate;
1557 
1558  return STATUS_SUCCESS;
1559 }
1560 
1562 {
1563  /* FIXME */
1564  DPRINT1("NtSetSystemInformation - SystemDpcBehaviourInformation not implemented\n");
1565  return STATUS_NOT_IMPLEMENTED;
1566 }
1567 
1568 /* Class 25 - Full Memory Information */
1570 {
1571  PULONG Spi = (PULONG) Buffer;
1572 
1574 
1575  *ReqSize = sizeof(ULONG);
1576 
1577  if (sizeof(ULONG) != Size)
1578  {
1580  }
1581 
1582  DPRINT("SystemFullMemoryInformation\n");
1583 
1585 
1586  DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1590  MiUsedSwapPages);
1591 
1593 
1594  return STATUS_SUCCESS;
1595 }
1596 
1597 /* Class 26 - Load Image */
1599 {
1602  PVOID ImageBase;
1603  PVOID SectionPointer;
1604  ULONG_PTR EntryPoint;
1605  NTSTATUS Status;
1606  ULONG DirSize;
1607  PIMAGE_NT_HEADERS NtHeader;
1608 
1609  /* Validate size */
1610  if (Size != sizeof(SYSTEM_GDI_DRIVER_INFORMATION))
1611  {
1612  /* Incorrect buffer length, fail */
1614  }
1615 
1616  /* Only kernel mode can call this function */
1618 
1619  /* Load the driver */
1620  ImageName = DriverInfo->DriverName;
1622  NULL,
1623  NULL,
1624  0,
1625  &SectionPointer,
1626  &ImageBase);
1627  if (!NT_SUCCESS(Status)) return Status;
1628 
1629  /* Return the export pointer */
1630  DriverInfo->ExportSectionPointer =
1631  RtlImageDirectoryEntryToData(ImageBase,
1632  TRUE,
1634  &DirSize);
1635 
1636  /* Get the entrypoint */
1637  NtHeader = RtlImageNtHeader(ImageBase);
1638  EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1639  EntryPoint += (ULONG_PTR)ImageBase;
1640 
1641  /* Save other data */
1642  DriverInfo->ImageAddress = ImageBase;
1643  DriverInfo->SectionPointer = SectionPointer;
1644  DriverInfo->EntryPoint = (PVOID)EntryPoint;
1645  DriverInfo->ImageLength = NtHeader->OptionalHeader.SizeOfImage;
1646 
1647  /* All is good */
1648  return STATUS_SUCCESS;
1649 }
1650 
1651 /* Class 27 - Unload Image */
1653 {
1654  PVOID *SectionPointer = Buffer;
1655 
1656  /* Validate size */
1657  if (Size != sizeof(PVOID))
1658  {
1659  /* Incorrect length, fail */
1661  }
1662 
1663  /* Only kernel mode can call this function */
1665 
1666  /* Unload the image */
1667  MmUnloadSystemImage(*SectionPointer);
1668  return STATUS_SUCCESS;
1669 }
1670 
1671 /* Class 28 - Time Adjustment Information */
1673 {
1676 
1677  /* Check if enough storage was provided */
1679  {
1680  * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1682  }
1683 
1684  /* Give time values to our caller */
1685  TimeInfo->TimeIncrement = KeMaximumIncrement;
1686  TimeInfo->TimeAdjustment = KeTimeAdjustment;
1687  TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1688 
1689  return STATUS_SUCCESS;
1690 }
1691 
1693 {
1697 
1698  /* Check size of a buffer, it must match our expectations */
1701 
1702  /* Check who is calling */
1703  if (PreviousMode != KernelMode)
1704  {
1705  /* Check access rights */
1707  {
1709  }
1710  }
1711 
1712  /* FIXME: behaviour suggests the member be named 'Disable' */
1713  if (TimeInfo->Enable)
1714  {
1715  /* Disable time adjustment and set default value */
1718  }
1719  else
1720  {
1721  /* Check if a valid time adjustment value is given */
1722  if (TimeInfo->TimeAdjustment == 0) return STATUS_INVALID_PARAMETER_2;
1723 
1724  /* Enable time adjustment and set the adjustment value */
1726  KeTimeAdjustment = TimeInfo->TimeAdjustment;
1727  }
1728 
1729  return STATUS_SUCCESS;
1730 }
1731 
1732 /* Class 29 - Summary Memory Information */
1734 {
1735  /* FIXME */
1736  DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1737  return STATUS_NOT_IMPLEMENTED;
1738 }
1739 
1740 /* Class 30 - Next Event Id Information */
1742 {
1743  /* FIXME */
1744  DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1745  return STATUS_NOT_IMPLEMENTED;
1746 }
1747 
1748 /* Class 31 */
1750 {
1751  /* FIXME */
1752  DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1753  return STATUS_NOT_IMPLEMENTED;
1754 }
1755 
1756 /* Class 32 - Crash Dump Information */
1758 {
1759  /* FIXME */
1760  DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1761  return STATUS_NOT_IMPLEMENTED;
1762 }
1763 
1764 /* Class 33 - Exception Information */
1766 {
1767  PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1769  PKPRCB Prcb;
1770  ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1771  ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1772  CHAR i;
1773 
1774  /* Check size of a buffer, it must match our expectations */
1775  if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1777 
1778  /* Sum up exception count information from all processors */
1779  for (i = 0; i < KeNumberProcessors; i++)
1780  {
1781  Prcb = KiProcessorBlock[i];
1782  if (Prcb)
1783  {
1784  AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1785  ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1786 #ifndef _M_ARM
1787  FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1788 #endif // _M_ARM
1789  }
1790  }
1791 
1792  /* Save information in user's buffer */
1793  ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1794  ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1795  ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1796  ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1797 
1798  return STATUS_SUCCESS;
1799 }
1800 
1801 /* Class 34 - Crash Dump State Information */
1803 {
1804  /* FIXME */
1805  DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1806  return STATUS_NOT_IMPLEMENTED;
1807 }
1808 
1809 /* Class 35 - Kernel Debugger Information */
1811 {
1813 
1814 #if (NTDDI_VERSION >= NTDDI_VISTA)
1815  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1816 #endif
1817 
1819  {
1821  }
1822 
1825 
1826 #if (NTDDI_VERSION < NTDDI_VISTA)
1827  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1828 #endif
1829 
1830  return STATUS_SUCCESS;
1831 }
1832 
1833 /* Class 36 - Context Switch Information */
1835 {
1836  PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1838  ULONG ContextSwitches;
1839  PKPRCB Prcb;
1840  CHAR i;
1841 
1842  /* Check size of a buffer, it must match our expectations */
1843  if (sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION) != Size)
1845 
1846  /* Calculate total value of context switches across all processors */
1847  ContextSwitches = 0;
1848  for (i = 0; i < KeNumberProcessors; i ++)
1849  {
1850  Prcb = KiProcessorBlock[i];
1851  if (Prcb)
1852  {
1853  ContextSwitches += KeGetContextSwitches(Prcb);
1854  }
1855  }
1856 
1857  ContextSwitchInformation->ContextSwitches = ContextSwitches;
1858 
1859  /* FIXME */
1860  ContextSwitchInformation->FindAny = 0;
1861  ContextSwitchInformation->FindLast = 0;
1862  ContextSwitchInformation->FindIdeal = 0;
1863  ContextSwitchInformation->IdleAny = 0;
1864  ContextSwitchInformation->IdleCurrent = 0;
1865  ContextSwitchInformation->IdleLast = 0;
1866  ContextSwitchInformation->IdleIdeal = 0;
1867  ContextSwitchInformation->PreemptAny = 0;
1868  ContextSwitchInformation->PreemptCurrent = 0;
1869  ContextSwitchInformation->PreemptLast = 0;
1870  ContextSwitchInformation->SwitchToIdle = 0;
1871 
1872  return STATUS_SUCCESS;
1873 }
1874 
1875 /* Class 37 - Registry Quota Information */
1877 {
1879 
1880  *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1882  {
1884  }
1885 
1886  DPRINT1("Faking max registry size of 32 MB\n");
1887  srqi->RegistryQuotaAllowed = 0x2000000;
1888  srqi->RegistryQuotaUsed = 0x200000;
1889  srqi->PagedPoolSize = 0x200000;
1890 
1891  return STATUS_SUCCESS;
1892 }
1893 
1895 {
1896  /* FIXME */
1897  DPRINT1("NtSetSystemInformation - SystemRegistryQuotaInformation not implemented\n");
1898  return STATUS_NOT_IMPLEMENTED;
1899 }
1900 
1901 /* Class 38 - Load And Call Image */
1903 {
1906  PLDR_DATA_TABLE_ENTRY ModuleObject;
1907  NTSTATUS Status;
1908  PIMAGE_NT_HEADERS NtHeader;
1909  DRIVER_OBJECT Win32k;
1910  PDRIVER_INITIALIZE DriverInit;
1911  PVOID ImageBase;
1912  ULONG_PTR EntryPoint;
1913 
1914  /* Validate the size */
1915  if (Size != sizeof(UNICODE_STRING)) return STATUS_INFO_LENGTH_MISMATCH;
1916 
1917  /* Check who is calling */
1918  if (PreviousMode != KernelMode)
1919  {
1920  static const UNICODE_STRING Win32kName =
1921  RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
1922 
1923  /* Make sure we can load drivers */
1925  {
1926  /* FIXME: We can't, fail */
1928  }
1929 
1930  _SEH2_TRY
1931  {
1932  /* Probe and copy the unicode string */
1933  ProbeForRead(Buffer, sizeof(ImageName), 1);
1935 
1936  /* Probe the string buffer */
1937  ProbeForRead(ImageName.Buffer, ImageName.Length, sizeof(WCHAR));
1938 
1939  /* Check if we have the correct name (nothing else is allowed!) */
1940  if (!RtlEqualUnicodeString(&ImageName, &Win32kName, FALSE))
1941  {
1943  }
1944  }
1946  {
1948  }
1949  _SEH2_END;
1950 
1951  /* Recursively call the function, so that we are from kernel mode */
1953  (PVOID)&Win32kName,
1954  sizeof(Win32kName));
1955  }
1956 
1957  /* Load the image */
1959  NULL,
1960  NULL,
1961  0,
1962  (PVOID)&ModuleObject,
1963  &ImageBase);
1964 
1965  if (!NT_SUCCESS(Status)) return Status;
1966 
1967  /* Get the headers */
1968  NtHeader = RtlImageNtHeader(ImageBase);
1969  if (!NtHeader)
1970  {
1971  /* Fail */
1972  MmUnloadSystemImage(ModuleObject);
1974  }
1975 
1976  /* Get the entrypoint */
1977  EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1978  EntryPoint += (ULONG_PTR)ImageBase;
1979  DriverInit = (PDRIVER_INITIALIZE)EntryPoint;
1980 
1981  /* Create a dummy device */
1982  RtlZeroMemory(&Win32k, sizeof(Win32k));
1984  Win32k.DriverStart = ImageBase;
1985 
1986  /* Call it */
1987  Status = (DriverInit)(&Win32k, NULL);
1989 
1990  /* Unload if we failed */
1991  if (!NT_SUCCESS(Status)) MmUnloadSystemImage(ModuleObject);
1992  return Status;
1993 }
1994 
1995 /* Class 39 - Priority Separation */
1997 {
1998  /* Check if the size is correct */
1999  if (Size != sizeof(ULONG))
2000  {
2002  }
2003 
2004  /* We need the TCB privilege */
2006  {
2008  }
2009 
2010  /* Modify the quantum table */
2012 
2013  return STATUS_SUCCESS;
2014 }
2015 
2016 /* Class 40 */
2017 QSI_DEF(SystemVerifierAddDriverInformation)
2018 {
2019  /* FIXME */
2020  DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2021  return STATUS_NOT_IMPLEMENTED;
2022 }
2023 
2024 /* Class 41 */
2025 QSI_DEF(SystemVerifierRemoveDriverInformation)
2026 {
2027  /* FIXME */
2028  DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2029  return STATUS_NOT_IMPLEMENTED;
2030 }
2031 
2032 /* Class 42 - Power Information */
2033 QSI_DEF(SystemProcessorIdleInformation)
2034 {
2035  *ReqSize = sizeof(PROCESSOR_POWER_INFORMATION) * KeNumberProcessors;
2036 
2038  {
2040  }
2041 
2042  /* FIXME */
2043  DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2044  return STATUS_NOT_IMPLEMENTED;
2045 }
2046 
2047 /* Class 43 */
2048 QSI_DEF(SystemLegacyDriverInformation)
2049 {
2050  /* FIXME */
2051  DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2052  return STATUS_NOT_IMPLEMENTED;
2053 }
2054 
2055 /* Class 44 - Current Time Zone Information */
2057 {
2058  *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2059 
2060  if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2061  {
2063  }
2064 
2065  /* Copy the time zone information struct */
2066  memcpy(Buffer,
2067  &ExpTimeZoneInfo,
2068  sizeof(RTL_TIME_ZONE_INFORMATION));
2069 
2070  return STATUS_SUCCESS;
2071 }
2072 
2073 
2075 {
2076  /* Check user buffer's size */
2077  if (Size < sizeof(RTL_TIME_ZONE_INFORMATION))
2078  {
2080  }
2081 
2083 }
2084 
2085 static
2086 VOID
2088  PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer,
2089  PULONG RemainingPointer,
2090  PLIST_ENTRY ListHead,
2091  BOOLEAN ListUsesMisses)
2092 
2093 {
2096  PLIST_ENTRY ListEntry;
2097  ULONG Remaining;
2098 
2099  /* Get info pointer and remaining count of free array element */
2100  Info = *InfoPointer;
2101  Remaining = *RemainingPointer;
2102 
2103  /* Loop as long as we have lookaside lists and free array elements */
2104  for (ListEntry = ListHead->Flink;
2105  (ListEntry != ListHead) && (Remaining > 0);
2106  ListEntry = ListEntry->Flink, Remaining--)
2107  {
2108  LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2109 
2110  /* Fill the next array element */
2111  Info->CurrentDepth = LookasideList->Depth;
2112  Info->MaximumDepth = LookasideList->MaximumDepth;
2113  Info->TotalAllocates = LookasideList->TotalAllocates;
2114  Info->TotalFrees = LookasideList->TotalFrees;
2115  Info->Type = LookasideList->Type;
2116  Info->Tag = LookasideList->Tag;
2117  Info->Size = LookasideList->Size;
2118 
2119  /* Check how the lists track misses/hits */
2120  if (ListUsesMisses)
2121  {
2122  /* Copy misses */
2123  Info->AllocateMisses = LookasideList->AllocateMisses;
2124  Info->FreeMisses = LookasideList->FreeMisses;
2125  }
2126  else
2127  {
2128  /* Calculate misses */
2129  Info->AllocateMisses = LookasideList->TotalAllocates
2130  - LookasideList->AllocateHits;
2131  Info->FreeMisses = LookasideList->TotalFrees
2132  - LookasideList->FreeHits;
2133  }
2134  }
2135 
2136  /* Return the updated pointer and remaining count */
2137  *InfoPointer = Info;
2138  *RemainingPointer = Remaining;
2139 }
2140 
2141 /* Class 45 - Lookaside Information */
2143 {
2146  PMDL Mdl;
2147  ULONG MaxCount, Remaining;
2148  KIRQL OldIrql;
2149  NTSTATUS Status;
2150 
2151  /* First we need to lock down the memory, since we are going to access it
2152  at high IRQL */
2155  Size,
2156  PreviousMode,
2157  IoWriteAccess,
2158  (PVOID*)&Info,
2159  &Mdl);
2160  if (!NT_SUCCESS(Status))
2161  {
2162  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2163  return Status;
2164  }
2165 
2166  /* Calculate how many items we can store */
2167  Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2168  if (Remaining == 0)
2169  {
2170  goto Leave;
2171  }
2172 
2173  /* Copy info from pool lookaside lists */
2175  &Remaining,
2177  FALSE);
2178  if (Remaining == 0)
2179  {
2180  goto Leave;
2181  }
2182 
2183  /* Copy info from system lookaside lists */
2185  &Remaining,
2187  TRUE);
2188  if (Remaining == 0)
2189  {
2190  goto Leave;
2191  }
2192 
2193  /* Acquire spinlock for ExpNonPagedLookasideListHead */
2195 
2196  /* Copy info from non-paged lookaside lists */
2198  &Remaining,
2200  TRUE);
2201 
2202  /* Release spinlock for ExpNonPagedLookasideListHead */
2204 
2205  if (Remaining == 0)
2206  {
2207  goto Leave;
2208  }
2209 
2210  /* Acquire spinlock for ExpPagedLookasideListHead */
2212 
2213  /* Copy info from paged lookaside lists */
2215  &Remaining,
2217  TRUE);
2218 
2219  /* Release spinlock for ExpPagedLookasideListHead */
2221 
2222 Leave:
2223 
2224  /* Release the locked user buffer */
2226 
2227  /* Return the size of the actually written data */
2228  *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2229  return STATUS_SUCCESS;
2230 }
2231 
2232 
2233 /* Class 46 - Set time slip event */
2235 {
2236  /* FIXME */
2237  DPRINT1("NtSetSystemInformation - SystemTimeSlipNotification not implemented\n");
2238  return STATUS_NOT_IMPLEMENTED;
2239 }
2240 
2241 NTSTATUS
2242 NTAPI
2244 
2245 NTSTATUS
2246 NTAPI
2248 
2249 /* Class 47 - Create a new session (TSE) */
2251 {
2252  ULONG SessionId;
2254  NTSTATUS Status;
2255 
2256  if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2257 
2258  if (PreviousMode != KernelMode)
2259  {
2261  {
2263  }
2264 
2266  }
2267 
2270 
2271  return Status;
2272 }
2273 
2274 
2275 /* Class 48 - Delete an existing session (TSE) */
2277 {
2278  ULONG SessionId;
2280 
2281  if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2282 
2283  if (PreviousMode != KernelMode)
2284  {
2286  {
2288  }
2289  }
2290 
2291  SessionId = *(PULONG)Buffer;
2292 
2293  return MmSessionDelete(SessionId);
2294 }
2295 
2296 
2297 /* Class 49 - UNKNOWN */
2299 {
2300  /* FIXME */
2301  DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2302  return STATUS_NOT_IMPLEMENTED;
2303 }
2304 
2305 
2306 /* Class 50 - System range start address */
2308 {
2309  /* Check user buffer's size */
2310  if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2311 
2313 
2314  if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2315 
2316  return STATUS_SUCCESS;
2317 }
2318 
2319 /* Class 51 - Driver verifier information */
2321 {
2322  /* FIXME */
2323  DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2324  return STATUS_NOT_IMPLEMENTED;
2325 }
2326 
2327 
2329 {
2330  /* FIXME */
2331  DPRINT1("NtSetSystemInformation - SystemVerifierInformation not implemented\n");
2332  return STATUS_NOT_IMPLEMENTED;
2333 }
2334 
2335 
2336 /* Class 52 */
2337 SSI_DEF(SystemVerifierThunkExtend)
2338 {
2339  /* FIXME */
2340  DPRINT1("NtSetSystemInformation - SystemVerifierThunkExtend not implemented\n");
2341  return STATUS_NOT_IMPLEMENTED;
2342 }
2343 
2344 
2345 /* Class 53 - A session's processes */
2347 {
2348  /* FIXME */
2349  DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2350  return STATUS_NOT_IMPLEMENTED;
2351 }
2352 
2353 
2354 /* Class 54 - Load & map in system space */
2356 {
2357  /* FIXME */
2358  DPRINT1("NtSetSystemInformation - SystemLoadGdiDriverInSystemSpaceInformation not implemented\n");
2359  return STATUS_NOT_IMPLEMENTED;
2360 }
2361 
2362 
2363 /* Class 55 - NUMA processor information */
2365 {
2366  ULONG MaxEntries, Node;
2368 
2369  /* Validate input size */
2370  if (Size < sizeof(ULONG))
2371  {
2373  }
2374 
2375  /* Return highest node */
2376  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2377 
2378  /* Compute how much entries we will be able to put in output structure */
2379  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2380  /* Make sure we don't overflow KeNodeBlock */
2381  if (MaxEntries > KeNumberNodes)
2382  {
2383  MaxEntries = KeNumberNodes;
2384  }
2385 
2386  /* If we have entries to write, and room for it */
2387  if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2388  MaxEntries != 0)
2389  {
2390  /* Already set size we return */
2391  *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2392  MaxEntries * sizeof(ULONGLONG);
2393 
2394  /* For each node, return processor mask */
2395  for (Node = 0; Node < MaxEntries; ++Node)
2396  {
2398  }
2399  }
2400  else
2401  {
2402  /* We only returned highest node number */
2403  *ReqSize = sizeof(ULONG);
2404  }
2405 
2406  return STATUS_SUCCESS;
2407 }
2408 
2409 
2410 /* Class 56 - Prefetcher information */
2412 {
2413  /* FIXME */
2414  DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2415  return STATUS_NOT_IMPLEMENTED;
2416 }
2417 
2418 
2419 /* Class 57 - Extended process information */
2421 {
2422  /* FIXME */
2423  DPRINT1("NtQuerySystemInformation - SystemExtendedProcessInformation not implemented\n");
2424  return STATUS_NOT_IMPLEMENTED;
2425 }
2426 
2427 
2428 /* Class 58 - Recommended shared ata alignment */
2430 {
2431  /* FIXME */
2432  DPRINT1("NtQuerySystemInformation - SystemRecommendedSharedDataAlignment not implemented\n");
2433  return STATUS_NOT_IMPLEMENTED;
2434 }
2435 
2436 
2437 /* Class 60 - NUMA memory information */
2439 {
2440  ULONG MaxEntries, Node;
2442 
2443  /* Validate input size */
2444  if (Size < sizeof(ULONG))
2445  {
2447  }
2448 
2449  /* Return highest node */
2450  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2451 
2452  /* Compute how much entries we will be able to put in output structure */
2453  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2454  /* Make sure we don't overflow KeNodeBlock */
2455  if (MaxEntries > KeNumberNodes)
2456  {
2457  MaxEntries = KeNumberNodes;
2458  }
2459 
2460  /* If we have entries to write, and room for it */
2461  if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) &&
2462  MaxEntries != 0)
2463  {
2464  /* Already set size we return */
2465  *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) +
2466  MaxEntries * sizeof(ULONGLONG);
2467 
2468  /* If we have a single entry (us), directly return MM information */
2469  if (MaxEntries == 1)
2470  {
2471  NumaInformation->AvailableMemory[0] = MmAvailablePages << PAGE_SHIFT;
2472  }
2473  else
2474  {
2475  /* Otherwise, for each node, return available bytes */
2476  for (Node = 0; Node < MaxEntries; ++Node)
2477  {
2478  NumaInformation->AvailableMemory[Node] = (KeNodeBlock[Node]->FreeCount[0] + KeNodeBlock[Node]->FreeCount[1]) << PAGE_SHIFT;
2479  }
2480  }
2481  }
2482  else
2483  {
2484  /* We only returned highest node number */
2485  *ReqSize = sizeof(ULONG);
2486  }
2487 
2488  return STATUS_SUCCESS;
2489 }
2490 
2491 /* Class 64 - Extended handle information */
2493 {
2495  PLIST_ENTRY NextTableEntry;
2497  PHANDLE_TABLE_ENTRY HandleTableEntry;
2498  EXHANDLE Handle;
2499  ULONG Index = 0;
2500  NTSTATUS Status;
2501  PMDL Mdl;
2502  PAGED_CODE();
2503 
2504  DPRINT("NtQuerySystemInformation - SystemExtendedHandleInformation\n");
2505 
2506  /* Set initial required buffer size */
2508 
2509  /* Check user's buffer size */
2510  if (Size < *ReqSize)
2511  {
2513  }
2514 
2515  /* We need to lock down the memory */
2517  Size,
2519  IoWriteAccess,
2521  &Mdl);
2522  if (!NT_SUCCESS(Status))
2523  {
2524  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2525  return Status;
2526  }
2527 
2528  /* Reset of count of handles */
2529  HandleInformation->Count = 0;
2530 
2531  /* Enter a critical region */
2533 
2534  /* Acquire the handle table lock */
2536 
2537  /* Enumerate all system handles */
2538  for (NextTableEntry = HandleTableListHead.Flink;
2539  NextTableEntry != &HandleTableListHead;
2540  NextTableEntry = NextTableEntry->Flink)
2541  {
2542  /* Get current handle table */
2543  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
2544 
2545  /* Set the initial value and loop the entries */
2546  Handle.Value = 0;
2547  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
2548  {
2549  /* Validate the entry */
2550  if ((HandleTableEntry->Object) &&
2551  (HandleTableEntry->NextFreeTableEntry != -2))
2552  {
2553  /* Increase of count of handles */
2554  ++HandleInformation->Count;
2555 
2556  /* Lock the entry */
2557  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
2558  {
2559  /* Increase required buffer size */
2560  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
2561 
2562  /* Check user's buffer size */
2563  if (*ReqSize > Size)
2564  {
2566  }
2567  else
2568  {
2569  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
2570 
2571  /* Filling handle information */
2572  HandleInformation->Handle[Index].UniqueProcessId =
2573  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
2574 
2575  HandleInformation->Handle[Index].CreatorBackTraceIndex = 0;
2576 
2577 #if 0 /* FIXME!!! Type field currupted */
2578  HandleInformation->Handles[Index].ObjectTypeIndex =
2579  (UCHAR) ObjectHeader->Type->Index;
2580 #else
2581  HandleInformation->Handle[Index].ObjectTypeIndex = 0;
2582 #endif
2583 
2584  HandleInformation->Handle[Index].HandleAttributes =
2585  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
2586 
2587  HandleInformation->Handle[Index].HandleValue =
2588  (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
2589 
2590  HandleInformation->Handle[Index].Object = &ObjectHeader->Body;
2591 
2592  HandleInformation->Handle[Index].GrantedAccess =
2593  HandleTableEntry->GrantedAccess;
2594 
2595  HandleInformation->Handle[Index].Reserved = 0;
2596 
2597  ++Index;
2598  }
2599 
2600  /* Unlock it */
2601  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
2602  }
2603  }
2604 
2605  /* Go to the next entry */
2606  Handle.Value += sizeof(HANDLE);
2607  }
2608  }
2609 
2610  /* Release the lock */
2612 
2613  /* Leave the critical region */
2615 
2616  /* Release the locked user buffer */
2618 
2619  return Status;
2620 }
2621 
2622 /* Class 70 - System object security mode information */
2624 {
2625  PULONG ObjectSecurityInfo = (PULONG)Buffer;
2626 
2627  /* Validate input size */
2628  if (Size != sizeof(ULONG))
2629  {
2631  }
2632 
2633  *ObjectSecurityInfo = ObpObjectSecurityMode;
2634 
2635  return STATUS_SUCCESS;
2636 }
2637 
2638 /* Class 73 - Logical processor information */
2640 {
2641  LONG i;
2642  PKPRCB Prcb;
2643  KAFFINITY CurrentProc;
2645  ULONG DataSize = 0, ProcessorFlags;
2647 
2648  /* First, browse active processors, thanks to the map */
2649  i = 0;
2650  CurrentInfo = Buffer;
2651  CurrentProc = KeActiveProcessors;
2652  do
2653  {
2654  /* If current processor is active and is main in case of HT/MC, return it */
2655  Prcb = KiProcessorBlock[i];
2656  if ((CurrentProc & 1) &&
2657  Prcb == Prcb->MultiThreadSetMaster)
2658  {
2659  /* Assume processor can do HT or multicore */
2660  ProcessorFlags = 1;
2661 
2662  /* If set is the same for PRCB and multithread, then
2663  * actually, the processor is single core
2664  */
2665  if (Prcb->SetMember == Prcb->MultiThreadProcessorSet)
2666  {
2667  ProcessorFlags = 0;
2668  }
2669 
2670  /* Check we have enough room to return */
2672  if (DataSize > Size)
2673  {
2675  }
2676  else
2677  {
2678  /* Zero output and return */
2680  CurrentInfo->ProcessorMask = Prcb->MultiThreadProcessorSet;
2681 
2682  /* Processor core needs 1 if HT/MC is supported */
2683  CurrentInfo->Relationship = RelationProcessorCore;
2684  CurrentInfo->ProcessorCore.Flags = ProcessorFlags;
2685  ++CurrentInfo;
2686  }
2687  }
2688 
2689  /* Move to the next proc */
2690  CurrentProc >>= 1;
2691  ++i;
2692  /* Loop while there's someone in the bitmask */
2693  } while (CurrentProc != 0);
2694 
2695  /* Now, return the NUMA nodes */
2696  for (i = 0; i < KeNumberNodes; ++i)
2697  {
2698  /* Check we have enough room to return */
2700  if (DataSize > Size)
2701  {
2703  }
2704  else
2705  {
2706  /* Zero output and return */
2708  CurrentInfo->ProcessorMask = KeActiveProcessors;
2709 
2710  /* NUMA node needs its ID */
2711  CurrentInfo->Relationship = RelationNumaNode;
2712  CurrentInfo->NumaNode.NodeNumber = i;
2713  ++CurrentInfo;
2714  }
2715  }
2716 
2717  *ReqSize = DataSize;
2718 
2719  return Status;
2720 }
2721 
2722 /* Class 76 - System firmware table information */
2724 {
2727  ULONG InputBufSize;
2728  ULONG DataSize = 0;
2729  ULONG TableCount = 0;
2730 
2731  DPRINT("NtQuerySystemInformation - SystemFirmwareTableInformation\n");
2732 
2733  /* Set initial required buffer size */
2734  *ReqSize = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
2735 
2736  /* Check user's buffer size */
2737  if (Size < *ReqSize)
2738  {
2740  }
2741 
2742  InputBufSize = SysFirmwareInfo->TableBufferLength;
2743  switch (SysFirmwareInfo->ProviderSignature)
2744  {
2745  /*
2746  * ExpFirmwareTableResource and ExpFirmwareTableProviderListHead
2747  * variables should be used there somehow...
2748  */
2749  case SIG_ACPI:
2750  {
2751  /* FIXME: Not implemented yet */
2752  DPRINT1("ACPI provider not implemented\n");
2754  break;
2755  }
2756  case SIG_FIRM:
2757  {
2758  /* FIXME: Not implemented yet */
2759  DPRINT1("FIRM provider not implemented\n");
2761  break;
2762  }
2763  case SIG_RSMB:
2764  {
2766  if (DataSize > 0)
2767  {
2768  TableCount = 1;
2769  if (SysFirmwareInfo->Action == SystemFirmwareTable_Enumerate)
2770  {
2771  DataSize = TableCount * sizeof(ULONG);
2772  if (DataSize <= InputBufSize)
2773  {
2774  *(ULONG *)SysFirmwareInfo->TableBuffer = 0;
2775  }
2776  }
2777  else if (SysFirmwareInfo->Action == SystemFirmwareTable_Get
2778  && DataSize <= InputBufSize)
2779  {
2780  Status = ExpGetRawSMBiosTable(SysFirmwareInfo->TableBuffer, &DataSize, InputBufSize);
2781  }
2782  SysFirmwareInfo->TableBufferLength = DataSize;
2783  }
2784  break;
2785  }
2786  default:
2787  {
2788  DPRINT1("SystemFirmwareTableInformation: Unsupported provider (0x%x)\n",
2789  SysFirmwareInfo->ProviderSignature);
2791  }
2792  }
2793 
2794  if (NT_SUCCESS(Status))
2795  {
2796  switch (SysFirmwareInfo->Action)
2797  {
2800  {
2801  if (SysFirmwareInfo->TableBufferLength > InputBufSize)
2802  {
2804  }
2805  break;
2806  }
2807  default:
2808  {
2809  DPRINT1("SystemFirmwareTableInformation: Unsupported action (0x%x)\n",
2810  SysFirmwareInfo->Action);
2812  }
2813  }
2814  }
2815  else
2816  {
2817  SysFirmwareInfo->TableBufferLength = 0;
2818  }
2819  return Status;
2820 }
2821 
2822 /* Query/Set Calls Table */
2823 typedef
2824 struct _QSSI_CALLS
2825 {
2828 } QSSI_CALLS;
2829 
2830 // QS Query & Set
2831 // QX Query
2832 // XS Set
2833 // XX unknown behaviour
2834 //
2835 #define SI_QS(n) {QSI_USE(n),SSI_USE(n)}
2836 #define SI_QX(n) {QSI_USE(n),NULL}
2837 #define SI_XS(n) {NULL,SSI_USE(n)}
2838 #define SI_XX(n) {NULL,NULL}
2839 
2840 static
2841 QSSI_CALLS
2843 {
2848  SI_QX(SystemPathInformation), /* should be SI_XX */
2854  SI_QX(SystemCallTimeInformation), /* should be SI_XX */
2857  SI_QX(SystemStackTraceInformation), /* should be SI_XX */
2858  SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
2859  SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
2864  SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
2869  SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
2873  SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
2874  SI_QX(SystemNextEventIdInformation), /* it should be SI_XX */
2875  SI_QX(SystemPerformanceTraceInformation), /* it should be SI_XX */
2884  SI_QX(SystemVerifierAddDriverInformation), /* it should be SI_XX */
2885  SI_QX(SystemVerifierRemoveDriverInformation), /* it should be SI_XX */
2886  SI_QX(SystemProcessorIdleInformation), /* it should be SI_XX */
2887  SI_QX(SystemLegacyDriverInformation), /* it should be SI_XX */
2888  SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
2893  SI_QX(SystemSessionInformation), /* it should be SI_XX */
2896  SI_XS(SystemVerifierThunkExtend),
2905  SI_XX(SystemProcessorPowerInformation), /* FIXME: not implemented */
2906  SI_XX(SystemEmulationBasicInformation), /* FIXME: not implemented */
2907  SI_XX(SystemEmulationProcessorInformation), /* FIXME: not implemented */
2909  SI_XX(SystemLostDelayedWriteInformation), /* FIXME: not implemented */
2910  SI_XX(SystemBigPoolInformation), /* FIXME: not implemented */
2911  SI_XX(SystemSessionPoolTagInformation), /* FIXME: not implemented */
2912  SI_XX(SystemSessionMappedViewInformation), /* FIXME: not implemented */
2913  SI_XX(SystemHotpatchInformation), /* FIXME: not implemented */
2915  SI_XX(SystemWatchdogTimerHandler), /* FIXME: not implemented */
2916  SI_XX(SystemWatchdogTimerInformation), /* FIXME: not implemented */
2918  SI_XX(SystemWow64SharedInformation), /* FIXME: not implemented */
2919  SI_XX(SystemRegisterFirmwareTableInformationHandler), /* FIXME: not implemented */
2921 };
2922 
2924 #define MIN_SYSTEM_INFO_CLASS (SystemBasicInformation)
2925 #define MAX_SYSTEM_INFO_CLASS (sizeof(CallQS) / sizeof(CallQS[0]))
2926 
2927 /*
2928  * @implemented
2929  */
2931 NTSTATUS
2932 NTAPI
2934  _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
2935  _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation,
2936  _In_ ULONG Length,
2937  _Out_opt_ PULONG UnsafeResultLength)
2938 {
2940  ULONG ResultLength = 0;
2942  NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
2943 
2944  PAGED_CODE();
2945 
2947 
2948  _SEH2_TRY
2949  {
2950 #if (NTDDI_VERSION >= NTDDI_VISTA)
2951  /*
2952  * Check if the request is valid.
2953  */
2954  if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2955  SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2956  {
2958  }
2959 #endif
2960 
2961  if (PreviousMode != KernelMode)
2962  {
2963  /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
2964  if (SystemInformationClass == SystemKernelDebuggerInformation)
2966 
2967  ProbeForWrite(SystemInformation, Length, Alignment);
2968  if (UnsafeResultLength != NULL)
2969  ProbeForWriteUlong(UnsafeResultLength);
2970  }
2971 
2972  if (UnsafeResultLength)
2973  *UnsafeResultLength = 0;
2974 
2975 #if (NTDDI_VERSION < NTDDI_VISTA)
2976  /*
2977  * Check if the request is valid.
2978  */
2979  if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2980  SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2981  {
2983  }
2984 #endif
2985 
2986  if (NULL != CallQS [SystemInformationClass].Query)
2987  {
2988  /*
2989  * Hand the request to a subhandler.
2990  */
2991  FStatus = CallQS [SystemInformationClass].Query(SystemInformation,
2992  Length,
2993  &ResultLength);
2994 
2995  /* Save the result length to the caller */
2996  if (UnsafeResultLength)
2997  *UnsafeResultLength = ResultLength;
2998  }
2999  }
3001  {
3002  FStatus = _SEH2_GetExceptionCode();
3003  }
3004  _SEH2_END;
3005 
3006  return FStatus;
3007 }
3008 
3009 
3010 NTSTATUS
3011 NTAPI
3013  IN PVOID SystemInformation,
3014  IN ULONG SystemInformationLength)
3015 {
3018 
3019  PAGED_CODE();
3020 
3022 
3023  _SEH2_TRY
3024  {
3025  /*
3026  * If called from user mode, check
3027  * possible unsafe arguments.
3028  */
3029  if (PreviousMode != KernelMode)
3030  {
3031  ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3032  }
3033 
3034  /*
3035  * Check the request is valid.
3036  */
3037  if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3038  (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3039  {
3040  if (NULL != CallQS [SystemInformationClass].Set)
3041  {
3042  /*
3043  * Hand the request to a subhandler.
3044  */
3045  Status = CallQS [SystemInformationClass].Set(SystemInformation,
3046  SystemInformationLength);
3047  }
3048  }
3049  }
3051  {
3053  }
3054  _SEH2_END;
3055 
3056  return Status;
3057 }
3058 
3059 ULONG
3060 NTAPI
3062 {
3063  /* Just use Ke */
3064  return KeGetCurrentProcessorNumber();
3065 }
3066 
3067 #undef ExGetPreviousMode
3069 NTAPI
3071 {
3072  /* Just use Ke */
3073  return KeGetPreviousMode();
3074 }
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
Definition: probe.h:142
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
ULONG CcLazyWriteIos
Definition: lazywrite.c:21
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:39
signed char * PCHAR
Definition: retypes.h:7
ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1401
ULONG KeMaximumIncrement
Definition: clock.c:20
NTSTATUS NTAPI MmSessionCreate(OUT PULONG SessionId)
Definition: session.c:827
#define QSI_DEF(n)
Definition: sysinfo.c:596
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
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 PAGE_SHIFT
Definition: env_spec_w32.h:45
#define IN
Definition: typedefs.h:39
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:37
#define MM_VIRTMEM_GRANULARITY
Definition: mm.h:91
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
ERESOURCE ExpFirmwareTableResource
Definition: sysinfo.c:30
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION SYSTEM_REGISTRY_QUOTA_INFORMATION
LOGICAL_PROCESSOR_RELATIONSHIP Relationship
Definition: ketypes.h:99
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1158
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
const LUID SeSystemtimePrivilege
Definition: priv.c:29
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:30
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG Index
Definition: obtypes.h:385
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define ROUND_UP(n, align)
Definition: eventvwr.h:31
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG InterruptTime
Definition: ketypes.h:740
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
LONG IoWriteOperationCount
Definition: ketypes.h:665
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:22
BOOLEAN NTAPI ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
Definition: sysinfo.c:363
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define _Out_
Definition: ms_sal.h:345
Definition: arc.h:32
struct _SYSTEM_NUMA_INFORMATION * PSYSTEM_NUMA_INFORMATION
const LUID SeDebugPrivilege
Definition: priv.c:37
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@3865::@3867 NumaNode
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
IN BOOLEAN OUT PSTR Buffer
Definition: progress.h:34
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
ULONG_PTR ObAttributes
Definition: extypes.h:600
KDPC_DATA DpcData[2]
Definition: ketypes.h:680
#define SI_XS(n)
Definition: sysinfo.c:2837
#define TRUE
Definition: types.h:120
NTSTATUS NTAPI NtSetSystemEnvironmentValueEx(IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
Definition: sysinfo.c:579
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
#define MC_USER
Definition: mm.h:103
uint16_t * PWSTR
Definition: typedefs.h:56
ULONG CcDataFlushes
Definition: copy.c:44
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION * PSYSTEM_QUERY_TIME_ADJUST_INFORMATION
unsigned char * PUCHAR
Definition: retypes.h:3
ACPI_SIZE Length
Definition: actypes.h:1044
char CHAR
Definition: xmlstorage.h:175
LARGE_INTEGER CreateTime
Definition: pstypes.h:1104
NTSTATUS NTAPI SeLocateProcessImageName(IN PEPROCESS Process, OUT PUNICODE_STRING *ProcessImageName)
Definition: audit.c:122
static VOID ExpCopyLookasideInformation(PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer, PULONG RemainingPointer, PLIST_ENTRY ListHead, BOOLEAN ListUsesMisses)
Definition: sysinfo.c:2087
ULONG SessionId
Definition: dllmain.c:28
#define SI_QS(n)
Definition: sysinfo.c:2835
#define KeGetPreviousMode()
Definition: ketypes.h:1107
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION::@3865::@3866 ProcessorCore
LONG NTSTATUS
Definition: precomp.h:26
PVOID DriverStart
Definition: iotypes.h:2279
KTHREAD Tcb
Definition: pstypes.h:1103
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1079
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
#define SIG_RSMB
Definition: sysinfo.c:24
SCHAR Priority
Definition: ketypes.h:1714
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:668
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:29
ULONG CcLazyWritePages
Definition: lazywrite.c:20
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:520
ULONG KeFeatureBits
Definition: krnlinit.c:22
struct _ThreadInfo ThreadInfo
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1426
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3070
ULONG ARC_STATUS
Definition: arc.h:4
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
#define MC_SYSTEM
Definition: mm.h:104
NTSTATUS NTAPI NtEnumerateSystemEnvironmentValuesEx(IN ULONG InformationClass, IN PVOID Buffer, IN ULONG BufferLength)
Definition: sysinfo.c:557
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
#define KD_DEBUGGER_NOT_PRESENT
Definition: kdfuncs.h:133
struct _SYSTEM_PERFORMANCE_INFORMATION * PSYSTEM_PERFORMANCE_INFORMATION
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:1274
VOID NTAPI ExGetCurrentProcessorCounts(PULONG ThreadKernelTime, PULONG TotalCpuTime, PULONG ProcessorNumber)
Definition: sysinfo.c:345
NTSTATUS NTAPI ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation, IN ULONG SystemInformationLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: expool.c:1353
uint16_t * PWCHAR
Definition: typedefs.h:56
ARC_STATUS NTAPI HalGetEnvironmentVariable(IN PCH Name, IN USHORT ValueLength, IN PCH Value)
Definition: rtc.c:70
LARGE_INTEGER IoWriteTransferCount
Definition: memtest.h:13
if(dx==0 &&dy==0)
Definition: linetemp.h:174
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
BOOLEAN NTAPI ExVerifySuite(SUITE_TYPE SuiteType)
Definition: sysinfo.c:377
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
LARGE_INTEGER CreateTime
Definition: extypes.h:891
struct _SYSTEM_PROCESSOR_INFORMATION SYSTEM_PROCESSOR_INFORMATION
ULONG DpcTime
Definition: ketypes.h:739
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:887
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
HANDLE UniqueProcessId
Definition: pstypes.h:1267
ULONG IoWriteOperationCount
Definition: iomgr.c:41
static BOOL Set
Definition: pageheap.c:10
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:202
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
#define MAX_ENVVAL_SIZE
Definition: sysinfo.c:20
_SEH2_TRY
Definition: create.c:4226
BOOLEAN KiTimeAdjustmentEnabled
Definition: time.c:19
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1155
ULONG IoReadOperationCount
Definition: iomgr.c:39
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
ERESOURCE PsLoadedModuleResource
Definition: sysldr.c:37
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
ULONG NTAPI NtGetCurrentProcessorNumber(VOID)
Definition: sysinfo.c:3061
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
LARGE_INTEGER KeBootTime
Definition: clock.c:17
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
struct _SYSTEM_PROCESSOR_INFORMATION * PSYSTEM_PROCESSOR_INFORMATION
UCHAR KIRQL
Definition: env_spec_w32.h:591
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
UNICODE_STRING PageFileName
Definition: extypes.h:1067
return STATUS_NOT_IMPLEMENTED
LARGE_INTEGER CurrentTime
Definition: extypes.h:850
NTSTATUS NTAPI MmSessionDelete(IN ULONG SessionId)
Definition: session.c:887
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION * PSYSTEM_REGISTRY_QUOTA_INFORMATION
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2842
#define FALSE
Definition: types.h:117
#define ANSI_NULL
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1119
long LONG
Definition: pedump.c:60
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
ULONG KeAlignmentFixupCount
Definition: ketypes.h:800
union node Node
Definition: types.h:1255
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:58
NTSTATUS NTAPI NtSetSystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
Definition: sysinfo.c:3012
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:395
LARGE_INTEGER IdleProcessTime
Definition: memtest.h:11
NTSTATUS NTAPI IoWMIQueryAllData(IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer)
Definition: wmi.c:169
CHAR * PCH
Definition: ntbasedef.h:391
struct _SYSTEM_FLAGS_INFORMATION SYSTEM_FLAGS_INFORMATION
Definition: extypes.h:595
struct _KTHREAD * CurrentThread
Definition: ketypes.h:570
struct _RTL_TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION
LONG IoReadOperationCount
Definition: ketypes.h:664
unsigned char BOOLEAN
ULONG CcMapDataWait
Definition: pin.c:28
_In_ ULONG _Out_writes_bytes_opt_ InformationLength PAUX_MODULE_EXTENDED_INFO ModuleInfo
Definition: aux_klib.h:65
#define ObpGetHandleObject(x)
Definition: ob.h:86
#define STATUS_BREAKPOINT
Definition: ntstatus.h:184
const LUID SeLoadDriverPrivilege
Definition: priv.c:27
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:476
#define SIG_ACPI
Definition: sysinfo.c:22
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
_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:426
#define _In_
Definition: ms_sal.h:308
struct _KPRCB * MultiThreadSetMaster
Definition: ketypes.h:757
struct _SYSTEM_FLAGS_INFORMATION * PSYSTEM_FLAGS_INFORMATION
ULONG KeTimeAdjustment
Definition: time.c:18
ULONG KiIdealDpcRate
Definition: dpc.c:22
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:235
Definition: bufpool.h:45
ULONG KernelTime
Definition: ketypes.h:737
#define SystemPerformanceInformation
Definition: memtest.h:87
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
void * PVOID
Definition: retypes.h:9
ULONG ExpTimeZoneId
Definition: time.c:25
ULONG DpcCount
Definition: ketypes.h:790
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
ULONG InterruptCount
Definition: ketypes.h:736
UCHAR WaitReason
Definition: ketypes.h:1896
CHAR BasePriority
Definition: ketypes.h:1849
KIRQL OldIrql
Definition: mm.h:1502
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:911
struct _SYSTEM_SET_TIME_ADJUST_INFORMATION * PSYSTEM_SET_TIME_ADJUST_INFORMATION
Status
Definition: gdiplustypes.h:24
#define SIG_FIRM
Definition: sysinfo.c:23
FAST_MUTEX
Definition: extypes.h:17
NTSTATUS NTAPI ExpGetRawSMBiosTable(_Out_opt_ PVOID Buffer, _Out_ ULONG *OutSize, _In_ ULONG BufferSize)
Definition: sysinfo.c:250
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:239
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
USHORT KeProcessorRevision
Definition: krnlinit.c:21
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
LIST_ENTRY ExpNonPagedLookasideListHead
Definition: lookas.c:17
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION SYSTEM_QUERY_TIME_ADJUST_INFORMATION
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
ULONG CcDataPages
Definition: copy.c:43
ULONG KernelTime
Definition: ketypes.h:1919
struct _SYSTEM_THREAD_INFORMATION * PSYSTEM_THREAD_INFORMATION
struct _SYSTEM_PAGEFILE_INFORMATION SYSTEM_PAGEFILE_INFORMATION
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:359
#define __kernel_entry
Definition: specstrings.h:355
#define ASSERT(a)
Definition: mode.c:44
ULONG ObpObjectSecurityMode
Definition: obinit.c:56
#define PROCESSOR_FEATURE_MAX
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION * PSYSTEM_KERNEL_DEBUGGER_INFORMATION
#define SSI_DEF(n)
Definition: sysinfo.c:600
LIST_ENTRY HandleTableListHead
Definition: handle.c:18
struct _SYSTEM_CONTEXT_SWITCH_INFORMATION * PSYSTEM_CONTEXT_SWITCH_INFORMATION
_In_ WDFCOLLECTION _In_ ULONG Index
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define TAG_MDL
Definition: tag.h:86
uint64_t ULONGLONG
Definition: typedefs.h:67
NTSTATUS NTAPI NtSetSystemEnvironmentValue(IN PUNICODE_STRING VariableName, IN PUNICODE_STRING Value)
Definition: sysinfo.c:487
ULONG CcPinReadNoWait
Definition: pin.c:31
CLIENT_ID Cid
Definition: pstypes.h:1128
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION SYSTEM_LOGICAL_PROCESSOR_INFORMATION
struct _SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
ULONG GrantedAccess
Definition: extypes.h:606
#define ObDereferenceObject
Definition: obfuncs.h:203
PKNODE KeNodeBlock[1]
Definition: krnlinit.c:39
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:848
ULONG KiMinimumDpcRate
Definition: dpc.c:20
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
PVOID HANDLE
Definition: typedefs.h:73
ULONG KeSystemCalls
Definition: ketypes.h:651
#define KD_DEBUGGER_ENABLED
Definition: kdfuncs.h:130
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION SYSTEM_KERNEL_DEBUGGER_INFORMATION
_In_ ACCESS_MASK _In_opt_ POBJECT_TYPE _In_ KPROCESSOR_MODE _Out_ PVOID _Out_opt_ POBJECT_HANDLE_INFORMATION HandleInformation
Definition: obfuncs.h:40
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
struct _SYSTEM_FIRMWARE_TABLE_INFORMATION * PSYSTEM_FIRMWARE_TABLE_INFORMATION
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION * PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_FILECACHE_INFORMATION SYSTEM_FILECACHE_INFORMATION
FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule(IN ULONG ModuleCount, IN PLDR_DATA_TABLE_ENTRY LdrEntry, OUT PRTL_PROCESS_MODULE_INFORMATION ModuleInfo)
Definition: sysinfo.c:35
NTSYSAPI NTSTATUS NTAPI ZwSetSystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _In_ PVOID SystemInformation, _In_ SIZE_T SystemInformationLength)
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:669
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:20
#define KeGetContextSwitches(Prcb)
Definition: ke.h:212
UNICODE_STRING ImageName
Definition: extypes.h:894
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
LONG IoOtherOperationCount
Definition: ketypes.h:666
ULONG CcMapDataNoWait
Definition: pin.c:29
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2827
#define SharedUserData
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: ex.h:84
static const char * ImageName
Definition: image.c:34
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
Definition: iotypes.h:2235
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
static const WCHAR L[]
Definition: oid.c:1250
#define RtlImageDirectoryEntryToData
Definition: compat.h:668
#define NTSTATUS
Definition: precomp.h:20
C_ASSERT(SystemBasicInformation==0)
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:897
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:18
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
Definition: btrfs_drv.h:1922
NTSTATUS NTAPI NtQuerySystemEnvironmentValue(IN PUNICODE_STRING VariableName, OUT PWSTR ValueBuffer, IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: sysinfo.c:385
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
ULONG UserTime
Definition: ketypes.h:738
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:1765
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Definition: typedefs.h:119
#define SystemExtendServiceTableInformation
Definition: DriverTester.h:35
KPROCESS Pcb
Definition: pstypes.h:1262
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define _Out_writes_bytes_to_opt_(size, count)
Definition: ms_sal.h:361
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2924
ULONG CcPinMappedDataCount
Definition: pin.c:32
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:151
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
VOID NTAPI ExGetCurrentProcessorCpuUsage(PULONG CpuUsage)
Definition: sysinfo.c:324
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
UCHAR KeNumberNodes
Definition: krnlinit.c:40
const LUID SeTcbPrivilege
Definition: priv.c:24
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:667
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
UINT64 SetMember
Definition: ketypes.h:582
LARGE_INTEGER IoReadTransferCount
Definition: memtest.h:12
struct _KTHREAD * IdleThread
Definition: ketypes.h:572
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
#define SystemLoadGdiDriverInformation
Definition: DriverTester.h:34
NTSTATUS NTAPI IoWMIOpenBlock(_In_ LPCGUID DataBlockGuid, _In_ ULONG DesiredAccess, _Out_ PVOID *DataBlockObject)
Definition: wmi.c:140
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1103
#define _SEH2_VOLATILE
Definition: pseh2_64.h:169
struct _SYSTEM_EXCEPTION_INFORMATION * PSYSTEM_EXCEPTION_INFORMATION
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
ARC_STATUS NTAPI HalSetEnvironmentVariable(IN PCH Name, IN PCH Value)
Definition: rtc.c:57
struct _FileName FileName
Definition: fatprocs.h:893
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
_SEH2_END
Definition: create.c:4400
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
LARGE_INTEGER KernelTime
Definition: extypes.h:893
struct _SYSTEM_LOOKASIDE_INFORMATION SYSTEM_LOOKASIDE_INFORMATION
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:922
struct _SYSTEM_DEVICE_INFORMATION * PSYSTEM_DEVICE_INFORMATION
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
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2826
enum _LOCK_OPERATION LOCK_OPERATION
RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
Definition: time.c:21
CHAR FullPathName[AUX_KLIB_MODULE_PATH_LEN]
Definition: aux_klib.h:41
unsigned short USHORT
Definition: pedump.c:61
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:851
#define SI_XX(n)
Definition: sysinfo.c:2838
UINT64 MultiThreadProcessorSet
Definition: ketypes.h:756
ULONG KeExceptionDispatchCount
Definition: ketypes.h:705
ULONG_PTR KAFFINITY
Definition: compat.h:85
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define WMIGUID_QUERY
Definition: wmistr.h:159
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:52
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
ULONG CcPinReadWait
Definition: pin.c:30
#define FORCEINLINE
Definition: wdftypes.h:67
SYSTEM_FIRMWARE_TABLE_ACTION Action
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
NTSTATUS ExpSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
Definition: time.c:333
#define _Out_opt_
Definition: ms_sal.h:346
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
unsigned int * PULONG
Definition: retypes.h:1
struct _SYSTEM_BASIC_INFORMATION SYSTEM_BASIC_INFORMATION
struct _SYSTEM_INTERRUPT_INFORMATION * PSYSTEM_INTERRUPT_INFORMATION
#define NULL
Definition: types.h:112
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
LIST_ENTRY ExpFirmwareTableProviderListHead
Definition: sysinfo.c:31
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
LONG NextFreeTableEntry
Definition: extypes.h:612
UNICODE_STRING * PUNICODE_STRING
Definition: env_spec_w32.h:373
ULONG KernelTime
Definition: ketypes.h:2034
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
enum _SUITE_TYPE SUITE_TYPE
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1400
LARGE_INTEGER IoOtherTransferCount
Definition: memtest.h:14
#define DPRINT1
Definition: precomp.h:8
#define RtlImageNtHeader
Definition: compat.h:665
ULONG UserTime
Definition: ketypes.h:1935
struct _SYSTEM_BASIC_INFORMATION * PSYSTEM_BASIC_INFORMATION
USHORT KeProcessorLevel
Definition: krnlinit.c:20
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
_In_ HANDLE Handle
Definition: extypes.h:390
#define OUT
Definition: typedefs.h:40
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1211
volatile UCHAR State
Definition: ketypes.h:1721
ULONG ERESOURCE
Definition: env_spec_w32.h:594
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:49
unsigned int ULONG
Definition: retypes.h:1
ULONG ContextSwitches
Definition: ketypes.h:1720
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:115
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
LARGE_INTEGER UserTime
Definition: extypes.h:892
#define ULONG_PTR
Definition: config.h:101
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1467
uint32_t * PULONG_PTR
Definition: typedefs.h:65
PVOID Object
Definition: extypes.h:599
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ULONG WaitTime
Definition: ketypes.h:1807
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG _Out_ PULONG ResultLength
Definition: wdfdevice.h:3776
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO SYSTEM_HANDLE_TABLE_ENTRY_INFO
ULONG PagesUsed
Definition: mm.h:446
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
#define TAG_SEPA
Definition: tag.h:191
#define STATUS_SUCCESS
Definition: shellext.h:65
KAFFINITY ProcessorMask
Definition: ketypes.h:818
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
ULONG IoOtherOperationCount
Definition: iomgr.c:43
struct _QSSI_CALLS QSSI_CALLS
GLfloat GLfloat p
Definition: glext.h:8902
#define DPRINT
Definition: sndvol32.h:71
#define SI_QX(n)
Definition: sysinfo.c:2836
ULONG DpcRequestRate
Definition: ketypes.h:688
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1713
POBJECT_TYPE Type
Definition: obtypes.h:493
#define OBJ_HANDLE_ATTRIBUTES
Definition: ob.h:52
ULONG NtGlobalFlag
Definition: init.c:52
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2925
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define STATUS_ILLEGAL_FUNCTION
Definition: ntstatus.h:411
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx(IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
Definition: sysinfo.c:567
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
__kernel_entry NTSTATUS NTAPI NtQuerySystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation, _In_ ULONG Length, _Out_opt_ PULONG UnsafeResultLength)
Definition: sysinfo.c:2933
struct _SYSTEM_DEVICE_INFORMATION SYSTEM_DEVICE_INFORMATION
#define MmSystemRangeStart
Definition: mm.h:32
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4751
ULONG FreeCount[2]
Definition: ketypes.h:827
struct _SYSTEM_DPC_BEHAVIOR_INFORMATION * PSYSTEM_DPC_BEHAVIOR_INFORMATION
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:19
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251
LONGLONG QuadPart
Definition: typedefs.h:114
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:2898
_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:2550
Definition: dlist.c:348
#define PAGED_CODE()
_Must_inspect_result_ _In_ WDFDMAENABLER _In_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68