ReactOS  r75907
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 #define NDEBUG
15 #include <debug.h>
16 
17 /* The maximum size of an environment value (in bytes) */
18 #define MAX_ENVVAL_SIZE 1024
19 
22 
26 
30  IN PLDR_DATA_TABLE_ENTRY LdrEntry,
32 {
33  PCHAR p;
36 
37  /* Fill it out */
38  ModuleInfo->MappedBase = NULL;
39  ModuleInfo->ImageBase = LdrEntry->DllBase;
40  ModuleInfo->ImageSize = LdrEntry->SizeOfImage;
41  ModuleInfo->Flags = LdrEntry->Flags;
42  ModuleInfo->LoadCount = LdrEntry->LoadCount;
43  ModuleInfo->LoadOrderIndex = (USHORT)ModuleCount;
44  ModuleInfo->InitOrderIndex = 0;
45 
46  /* Setup name */
47  RtlInitEmptyAnsiString(&ModuleName,
48  ModuleInfo->FullPathName,
49  sizeof(ModuleInfo->FullPathName));
50 
51  /* Convert it */
52  Status = RtlUnicodeStringToAnsiString(&ModuleName,
53  &LdrEntry->FullDllName,
54  FALSE);
55  if ((NT_SUCCESS(Status)) || (Status == STATUS_BUFFER_OVERFLOW))
56  {
57  /* Calculate offset to name */
58  p = ModuleName.Buffer + ModuleName.Length;
59  while ((p > ModuleName.Buffer) && (*--p))
60  {
61  /* Check if we found the separator */
62  if (*p == OBJ_NAME_PATH_SEPARATOR)
63  {
64  /* We did, break out */
65  p++;
66  break;
67  }
68  }
69 
70  /* Set the offset */
71  ModuleInfo->OffsetToFileName = (USHORT)(p - ModuleName.Buffer);
72  }
73  else
74  {
75  /* Return empty name */
76  ModuleInfo->FullPathName[0] = ANSI_NULL;
77  ModuleInfo->OffsetToFileName = 0;
78  }
79 
80  return Status;
81 }
82 
84 NTAPI
86  IN PLIST_ENTRY UserModeList,
87  OUT PRTL_PROCESS_MODULES Modules,
88  IN ULONG Length,
90 {
94  PLDR_DATA_TABLE_ENTRY LdrEntry;
95  ULONG ModuleCount = 0;
96  PLIST_ENTRY NextEntry;
97 
98  /* Setup defaults */
99  RequiredLength = FIELD_OFFSET(RTL_PROCESS_MODULES, Modules);
100  ModuleInfo = &Modules->Modules[0];
101 
102  /* Loop the kernel list */
103  NextEntry = KernelModeList->Flink;
104  while (NextEntry != KernelModeList)
105  {
106  /* Get the entry */
107  LdrEntry = CONTAINING_RECORD(NextEntry,
109  InLoadOrderLinks);
110 
111  /* Update size and check if we can manage one more entry */
112  RequiredLength += sizeof(RTL_PROCESS_MODULE_INFORMATION);
113  if (Length >= RequiredLength)
114  {
115  Status = ExpConvertLdrModuleToRtlModule(ModuleCount,
116  LdrEntry,
117  ModuleInfo);
118 
119  /* Go to the next module */
120  ModuleInfo++;
121  }
122  else
123  {
124  /* Set error code */
126  }
127 
128  /* Update count and move to next entry */
129  ModuleCount++;
130  NextEntry = NextEntry->Flink;
131  }
132 
133  /* Check if caller also wanted user modules */
134  if (UserModeList)
135  {
136  NextEntry = UserModeList->Flink;
137  while (NextEntry != UserModeList)
138  {
139  /* Get the entry */
140  LdrEntry = CONTAINING_RECORD(NextEntry,
142  InLoadOrderLinks);
143 
144  /* Update size and check if we can manage one more entry */
145  RequiredLength += sizeof(RTL_PROCESS_MODULE_INFORMATION);
146  if (Length >= RequiredLength)
147  {
148  Status = ExpConvertLdrModuleToRtlModule(ModuleCount,
149  LdrEntry,
150  ModuleInfo);
151 
152  /* Go to the next module */
153  ModuleInfo++;
154  }
155  else
156  {
157  /* Set error code */
159  }
160 
161  /* Update count and move to next entry */
162  ModuleCount++;
163  NextEntry = NextEntry->Flink;
164  }
165  }
166 
167  /* Update return length */
168  if (ReturnLength) *ReturnLength = RequiredLength;
169 
170  /* Validate the length again */
171  if (Length >= FIELD_OFFSET(RTL_PROCESS_MODULES, Modules))
172  {
173  /* Set the final count */
174  Modules->NumberOfModules = ModuleCount;
175  }
176  else
177  {
178  /* Otherwise, we failed */
180  }
181 
182  /* Done */
183  return Status;
184 }
185 
186 VOID
187 NTAPI
189 {
190  MmUnlockPages(Mdl);
192 }
193 
194 NTSTATUS
195 NTAPI
198  ULONG Length,
201  PVOID *MappedSystemVa,
202  PMDL *OutMdl)
203 {
204  PMDL Mdl;
205  PAGED_CODE();
206 
207  *MappedSystemVa = NULL;
208  *OutMdl = NULL;
209 
210  /* Allocate an MDL for the buffer */
211  Mdl = IoAllocateMdl(BaseAddress, Length, FALSE, TRUE, NULL);
212  if (Mdl == NULL)
213  {
215  }
216 
217  /* Enter SEH for probing */
218  _SEH2_TRY
219  {
220  MmProbeAndLockPages(Mdl, AccessMode, Operation);
221  }
223  {
226  }
227  _SEH2_END;
228 
229  /* Return the safe kernel mode buffer */
230  *MappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
231  if (*MappedSystemVa == NULL)
232  {
233  ExUnlockUserBuffer(Mdl);
235  }
236 
237  /* Return the MDL */
238  *OutMdl = Mdl;
239  return STATUS_SUCCESS;
240 }
241 
242 /* FUNCTIONS *****************************************************************/
243 
244 /*
245  * @implemented
246  */
247 VOID
248 NTAPI
250 {
251  PKPRCB Prcb;
252  ULONG TotalTime;
253  ULONGLONG ScaledIdle;
254 
255  Prcb = KeGetCurrentPrcb();
256 
257  ScaledIdle = (ULONGLONG)Prcb->IdleThread->KernelTime * 100;
258  TotalTime = Prcb->KernelTime + Prcb->UserTime;
259  if (TotalTime != 0)
260  *CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime));
261  else
262  *CpuUsage = 0;
263 }
264 
265 /*
266  * @implemented
267  */
268 VOID
269 NTAPI
271  PULONG TotalCpuTime,
272  PULONG ProcessorNumber)
273 {
274  PKPRCB Prcb;
275 
276  Prcb = KeGetCurrentPrcb();
277 
278  *ThreadKernelTime = Prcb->KernelTime + Prcb->UserTime;
279  *TotalCpuTime = Prcb->CurrentThread->KernelTime;
280  *ProcessorNumber = KeGetCurrentProcessorNumber();
281 }
282 
283 /*
284  * @implemented
285  */
286 BOOLEAN
287 NTAPI
289 {
290  /* Quick check to see if it exists at all */
291  if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return(FALSE);
292 
293  /* Return our support for it */
294  return(SharedUserData->ProcessorFeatures[ProcessorFeature]);
295 }
296 
297 /*
298  * @implemented
299  */
300 BOOLEAN
301 NTAPI
303 {
304  if (SuiteType == Personal) return TRUE;
305  return FALSE;
306 }
307 
308 NTSTATUS
309 NTAPI
311  OUT PWSTR ValueBuffer,
312  IN ULONG ValueBufferLength,
314 {
315  ANSI_STRING AName;
316  UNICODE_STRING WName;
318  PCH AnsiValueBuffer;
319  ANSI_STRING AValue;
320  UNICODE_STRING WValue;
323  PAGED_CODE();
324 
325  /* Check if the call came from user mode */
326  PreviousMode = ExGetPreviousMode();
327  if (PreviousMode != KernelMode)
328  {
329  _SEH2_TRY
330  {
331  /* Probe the input and output buffers */
332  ProbeForRead(VariableName, sizeof(UNICODE_STRING), sizeof(ULONG));
333  ProbeForWrite(ValueBuffer, ValueBufferLength, sizeof(WCHAR));
335  }
337  {
338  /* Return the exception code */
340  }
341  _SEH2_END;
342  }
343 
344  /* According to NTInternals the SeSystemEnvironmentName privilege is required! */
346  {
347  DPRINT1("NtQuerySystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
349  }
350 
351  /* Copy the name to kernel space if necessary */
352  Status = ProbeAndCaptureUnicodeString(&WName, PreviousMode, VariableName);
353  if (!NT_SUCCESS(Status)) return Status;
354 
355  /* Convert the name to ANSI and release the captured UNICODE string */
356  Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE);
357  ReleaseCapturedUnicodeString(&WName, PreviousMode);
358  if (!NT_SUCCESS(Status)) return Status;
359 
360  /* Allocate a buffer for the ANSI environment variable */
361  AnsiValueBuffer = ExAllocatePoolWithTag(NonPagedPool, MAX_ENVVAL_SIZE, 'rvnE');
362  if (AnsiValueBuffer == NULL)
363  {
364  RtlFreeAnsiString(&AName);
366  }
367 
368  /* Get the environment variable and free the ANSI name */
369  Result = HalGetEnvironmentVariable(AName.Buffer,
371  AnsiValueBuffer);
372  RtlFreeAnsiString(&AName);
373 
374  /* Check if we had success */
375  if (Result == ESUCCESS)
376  {
377  /* Copy the result back to the caller. */
378  _SEH2_TRY
379  {
380  /* Initialize ANSI string from the result */
381  RtlInitAnsiString(&AValue, AnsiValueBuffer);
382 
383  /* Initialize a UNICODE string from the callers buffer */
384  RtlInitEmptyUnicodeString(&WValue, ValueBuffer, (USHORT)ValueBufferLength);
385 
386  /* Convert the result to UNICODE */
387  Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
388 
389  if (ReturnLength != NULL)
390  *ReturnLength = WValue.Length;
391  }
393  {
394  Status = _SEH2_GetExceptionCode();
395  }
396  _SEH2_END;
397  }
398  else
399  {
400  Status = STATUS_UNSUCCESSFUL;
401  }
402 
403  /* Free the allocated ANSI value buffer */
404  ExFreePoolWithTag(AnsiValueBuffer, 'rvnE');
405 
406  return Status;
407 }
408 
409 
410 NTSTATUS
411 NTAPI
414 {
415  UNICODE_STRING CapturedName, CapturedValue;
416  ANSI_STRING AName, AValue;
419 
420  PAGED_CODE();
421 
422  PreviousMode = ExGetPreviousMode();
423 
424  /*
425  * Copy the strings to kernel space if necessary
426  */
427  Status = ProbeAndCaptureUnicodeString(&CapturedName,
428  PreviousMode,
429  VariableName);
430  if (NT_SUCCESS(Status))
431  {
432  Status = ProbeAndCaptureUnicodeString(&CapturedValue,
433  PreviousMode,
434  Value);
435  if (NT_SUCCESS(Status))
436  {
437  /*
438  * according to ntinternals the SeSystemEnvironmentName privilege is required!
439  */
441  PreviousMode))
442  {
443  /*
444  * convert the strings to ANSI
445  */
446  Status = RtlUnicodeStringToAnsiString(&AName,
447  &CapturedName,
448  TRUE);
449  if (NT_SUCCESS(Status))
450  {
451  Status = RtlUnicodeStringToAnsiString(&AValue,
452  &CapturedValue,
453  TRUE);
454  if (NT_SUCCESS(Status))
455  {
457  AValue.Buffer);
458 
459  Status = (Result ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
460  }
461  }
462  }
463  else
464  {
465  DPRINT1("NtSetSystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
466  Status = STATUS_PRIVILEGE_NOT_HELD;
467  }
468 
469  ReleaseCapturedUnicodeString(&CapturedValue,
470  PreviousMode);
471  }
472 
473  ReleaseCapturedUnicodeString(&CapturedName,
474  PreviousMode);
475  }
476 
477  return Status;
478 }
479 
480 NTSTATUS
481 NTAPI
483  IN PVOID Buffer,
485 {
487  return STATUS_NOT_IMPLEMENTED;
488 }
489 
490 NTSTATUS
491 NTAPI
493  IN LPGUID VendorGuid,
494  IN PVOID Value,
497 {
499  return STATUS_NOT_IMPLEMENTED;
500 }
501 
502 NTSTATUS
503 NTAPI
505  IN LPGUID VendorGuid,
506  IN PVOID Value,
509 {
511  return STATUS_NOT_IMPLEMENTED;
512 }
513 
514 /* --- Query/Set System Information --- */
515 
516 /*
517  * NOTE: QSI_DEF(n) and SSI_DEF(n) define _cdecl function symbols
518  * so the stack is popped only in one place on x86 platform.
519  */
520 #define QSI_USE(n) QSI##n
521 #define QSI_DEF(n) \
522 static NTSTATUS QSI_USE(n) (PVOID Buffer, ULONG Size, PULONG ReqSize)
523 
524 #define SSI_USE(n) SSI##n
525 #define SSI_DEF(n) \
526 static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
527 
528 VOID
529 NTAPI
530 ExQueryPoolUsage(OUT PULONG PagedPoolPages,
531  OUT PULONG NonPagedPoolPages,
532  OUT PULONG PagedPoolAllocs,
533  OUT PULONG PagedPoolFrees,
534  OUT PULONG PagedPoolLookasideHits,
535  OUT PULONG NonPagedPoolAllocs,
536  OUT PULONG NonPagedPoolFrees,
537  OUT PULONG NonPagedPoolLookasideHits);
538 
539 /* Class 0 - Basic Information */
541 {
544 
545  *ReqSize = sizeof(SYSTEM_BASIC_INFORMATION);
546 
547  /* Check user buffer's size */
548  if (Size != sizeof(SYSTEM_BASIC_INFORMATION))
549  {
551  }
552 
553  RtlZeroMemory(Sbi, Size);
554  Sbi->Reserved = 0;
556  Sbi->PageSize = PAGE_SIZE;
560  Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
561  Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */
565 
566  return STATUS_SUCCESS;
567 }
568 
569 /* Class 1 - Processor Information */
571 {
574 
575  *ReqSize = sizeof(SYSTEM_PROCESSOR_INFORMATION);
576 
577  /* Check user buffer's size */
578  if (Size < sizeof(SYSTEM_PROCESSOR_INFORMATION))
579  {
581  }
585  Spi->Reserved = 0;
587 
588  DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
589  Spi->ProcessorLevel, Spi->ProcessorRevision);
590 
591  return STATUS_SUCCESS;
592 }
593 
594 /* Class 2 - Performance Information */
596 {
597  ULONG IdleUser, IdleKernel;
600 
602 
603  *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
604 
605  /* Check user buffer's size */
606  if (Size < sizeof(SYSTEM_PERFORMANCE_INFORMATION))
607  {
609  }
610 
611  TheIdleProcess = PsIdleProcess;
612 
613  IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
621 
623  /*
624  * Add up all the used "Committed" memory + pagefile.
625  * Not sure this is right. 8^\
626  */
631  /*
632  * Add up the full system total + pagefile.
633  * All this make Taskmgr happy but not sure it is the right numbers.
634  * This too, fixes some of GlobalMemoryStatusEx numbers.
635  */
637 
638  Spi->PeakCommitment = 0; /* FIXME */
639  Spi->PageFaultCount = 0; /* FIXME */
640  Spi->CopyOnWriteCount = 0; /* FIXME */
641  Spi->TransitionCount = 0; /* FIXME */
642  Spi->CacheTransitionCount = 0; /* FIXME */
643  Spi->DemandZeroCount = 0; /* FIXME */
644  Spi->PageReadCount = 0; /* FIXME */
645  Spi->PageReadIoCount = 0; /* FIXME */
646  Spi->CacheReadCount = 0; /* FIXME */
647  Spi->CacheIoCount = 0; /* FIXME */
648  Spi->DirtyPagesWriteCount = 0; /* FIXME */
649  Spi->DirtyWriteIoCount = 0; /* FIXME */
650  Spi->MappedPagesWriteCount = 0; /* FIXME */
651  Spi->MappedWriteIoCount = 0; /* FIXME */
652 
653  Spi->PagedPoolPages = 0;
654  Spi->NonPagedPoolPages = 0;
655  Spi->PagedPoolAllocs = 0;
656  Spi->PagedPoolFrees = 0;
657  Spi->PagedPoolLookasideHits = 0;
658  Spi->NonPagedPoolAllocs = 0;
659  Spi->NonPagedPoolFrees = 0;
660  Spi->NonPagedPoolLookasideHits = 0;
662  &Spi->NonPagedPoolPages,
663  &Spi->PagedPoolAllocs,
664  &Spi->PagedPoolFrees,
666  &Spi->NonPagedPoolAllocs,
667  &Spi->NonPagedPoolFrees,
669  Spi->FreeSystemPtes = 0; /* FIXME */
670 
671  Spi->ResidentSystemCodePage = 0; /* FIXME */
672 
673  Spi->TotalSystemDriverPages = 0; /* FIXME */
674  Spi->Spare3Count = 0; /* FIXME */
675 
677  Spi->ResidentPagedPoolPage = 0; /* FIXME */
678 
679  Spi->ResidentSystemDriverPage = 0; /* FIXME */
680  Spi->CcFastReadNoWait = 0; /* FIXME */
681  Spi->CcFastReadWait = 0; /* FIXME */
682  Spi->CcFastReadResourceMiss = 0; /* FIXME */
683  Spi->CcFastReadNotPossible = 0; /* FIXME */
684 
685  Spi->CcFastMdlReadNoWait = 0; /* FIXME */
686  Spi->CcFastMdlReadWait = 0; /* FIXME */
687  Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
688  Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
689 
690  Spi->CcMapDataNoWait = 0; /* FIXME */
691  Spi->CcMapDataWait = 0; /* FIXME */
692  Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
693  Spi->CcMapDataWaitMiss = 0; /* FIXME */
694 
695  Spi->CcPinMappedDataCount = 0; /* FIXME */
696  Spi->CcPinReadNoWait = 0; /* FIXME */
697  Spi->CcPinReadWait = 0; /* FIXME */
698  Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
699  Spi->CcPinReadWaitMiss = 0; /* FIXME */
700  Spi->CcCopyReadNoWait = 0; /* FIXME */
701  Spi->CcCopyReadWait = 0; /* FIXME */
702  Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
703  Spi->CcCopyReadWaitMiss = 0; /* FIXME */
704 
705  Spi->CcMdlReadNoWait = 0; /* FIXME */
706  Spi->CcMdlReadWait = 0; /* FIXME */
707  Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
708  Spi->CcMdlReadWaitMiss = 0; /* FIXME */
709  Spi->CcReadAheadIos = 0; /* FIXME */
710  Spi->CcLazyWriteIos = 0; /* FIXME */
711  Spi->CcLazyWritePages = 0; /* FIXME */
712  Spi->CcDataFlushes = 0; /* FIXME */
713  Spi->CcDataPages = 0; /* FIXME */
714  Spi->ContextSwitches = 0; /* FIXME */
715  Spi->FirstLevelTbFills = 0; /* FIXME */
716  Spi->SecondLevelTbFills = 0; /* FIXME */
717  Spi->SystemCalls = 0; /* FIXME */
718 
719  return STATUS_SUCCESS;
720 }
721 
722 /* Class 3 - Time Of Day Information */
724 {
726  LARGE_INTEGER CurrentTime;
727 
728  /* Set amount of written information to 0 */
729  *ReqSize = 0;
730 
731  /* Check user buffer's size */
732  if (Size > sizeof(SYSTEM_TIMEOFDAY_INFORMATION))
733  {
735  }
736 
737  /* Get current time */
738  KeQuerySystemTime(&CurrentTime);
739 
740  /* Zero local buffer */
742 
743  /* Fill local time structure */
744  Sti.BootTime= KeBootTime;
745  Sti.CurrentTime = CurrentTime;
748  Sti.Reserved = 0;
749 
750  /* Copy as much as requested by caller */
751  RtlCopyMemory(Buffer, &Sti, Size);
752 
753  /* Set amount of information we copied */
754  *ReqSize = Size;
755 
756  return STATUS_SUCCESS;
757 }
758 
759 /* Class 4 - Path Information */
761 {
762  /* FIXME: QSI returns STATUS_BREAKPOINT. Why? */
763  DPRINT1("NtQuerySystemInformation - SystemPathInformation not implemented\n");
764 
765  return STATUS_BREAKPOINT;
766 }
767 
768 /* Class 5 - Process Information */
770 {
771  PSYSTEM_PROCESS_INFORMATION SpiCurrent;
773  PEPROCESS Process = NULL, SystemProcess;
774  PETHREAD CurrentThread;
776  ULONG CurrentSize;
777  USHORT ImageNameMaximumLength; // image name length in bytes
778  USHORT ImageNameLength;
779  PLIST_ENTRY CurrentEntry;
780  ULONG TotalSize = 0, ThreadsCount;
781  ULONG TotalUser, TotalKernel;
782  PUCHAR Current;
784  PUNICODE_STRING TempProcessImageName;
785  _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
786  PWCHAR szSrc;
787  BOOLEAN Overflow = FALSE;
788 
789  _SEH2_TRY
790  {
791  /* scan the process list */
792 
795 
796  *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
797 
798  /* Check for overflow */
799  if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
800  {
801  Overflow = TRUE;
802  }
803 
804  /* Zero user's buffer */
805  if (!Overflow) RtlZeroMemory(Spi, Size);
806 
807  SystemProcess = PsIdleProcess;
808  Process = SystemProcess;
809  Current = (PUCHAR) Spi;
810 
811  do
812  {
813  SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
814 
815  /* Lock the Process */
818 
819  if ((Process->ProcessExiting) &&
820  (Process->Pcb.Header.SignalState) &&
821  !(Process->ActiveThreads) &&
822  (IsListEmpty(&Process->Pcb.ThreadListHead)))
823  {
824  DPRINT1("Process %p (%s:%p) is a zombie\n",
825  Process, Process->ImageFileName, Process->UniqueProcessId);
826  CurrentSize = 0;
827  ImageNameMaximumLength = 0;
828 
829  /* Unlock the Process */
832  goto Skip;
833  }
834 
835  ThreadsCount = 0;
836  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
837  while (CurrentEntry != &Process->Pcb.ThreadListHead)
838  {
839  ThreadsCount++;
840  CurrentEntry = CurrentEntry->Flink;
841  }
842 
843  // size of the structure for every process
844  CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
845  ImageNameLength = 0;
846  Status = SeLocateProcessImageName(Process, &TempProcessImageName);
847  ProcessImageName = TempProcessImageName;
848  szSrc = NULL;
849  if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
850  {
851  szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
852  /* Loop the file name*/
853  while (szSrc > ProcessImageName->Buffer)
854  {
855  /* Make sure this isn't a backslash */
856  if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
857  {
858  szSrc++;
859  break;
860  }
861  else
862  {
863  ImageNameLength += sizeof(WCHAR);
864  }
865  }
866  }
867  if (!ImageNameLength && Process != PsIdleProcess)
868  {
869  ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
870  }
871 
872  /* Round up the image name length as NT does */
873  if (ImageNameLength > 0)
874  ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
875  else
876  ImageNameMaximumLength = 0;
877 
878  TotalSize += CurrentSize + ImageNameMaximumLength;
879 
880  /* Check for overflow */
881  if (TotalSize > Size)
882  {
883  Overflow = TRUE;
884  }
885 
886  /* Fill system information */
887  if (!Overflow)
888  {
889  SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
890  SpiCurrent->NumberOfThreads = ThreadsCount;
891  SpiCurrent->CreateTime = Process->CreateTime;
892  SpiCurrent->ImageName.Length = ImageNameLength;
893  SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
894  SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
895 
896  /* Copy name to the end of the struct */
897  if(Process != PsIdleProcess)
898  {
899  if (szSrc)
900  {
901  RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
902  }
903  else
904  {
905  RtlInitAnsiString(&ImageName, Process->ImageFileName);
906  RtlAnsiStringToUnicodeString(&SpiCurrent->ImageName, &ImageName, FALSE);
907  }
908  }
909  else
910  {
911  RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
912  }
913 
914  SpiCurrent->BasePriority = Process->Pcb.BasePriority;
915  SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
917  SpiCurrent->HandleCount = ObGetProcessHandleCount(Process);
918  SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
919  SpiCurrent->VirtualSize = Process->VirtualSize;
920  SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
921  SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
922  SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
923  SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[0];
924  SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[0];
925  SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[1];
926  SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[1];
927  SpiCurrent->PagefileUsage = Process->QuotaUsage[2];
928  SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[2];
929  SpiCurrent->PrivatePageCount = Process->CommitCharge;
930  ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
931 
932  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
933  while (CurrentEntry != &Process->Pcb.ThreadListHead)
934  {
935  CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
936 
937  ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
938  ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
939  ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
940  ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
941  ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
942  ThreadInfo->ClientId = CurrentThread->Cid;
943  ThreadInfo->Priority = CurrentThread->Tcb.Priority;
944  ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
945  ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
946  ThreadInfo->ThreadState = CurrentThread->Tcb.State;
947  ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
948 
949  ThreadInfo++;
950  CurrentEntry = CurrentEntry->Flink;
951  }
952 
953  /* Query total user/kernel times of a process */
954  TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
955  SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
956  SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
957  }
958 
959  if (ProcessImageName)
960  {
961  /* Release the memory allocated by SeLocateProcessImageName */
962  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
963  ProcessImageName = NULL;
964  }
965 
966  /* Unlock the Process */
969 
970  /* Handle idle process entry */
971 Skip:
972  if (Process == PsIdleProcess) Process = NULL;
973 
974  Process = PsGetNextProcess(Process);
975  ThreadsCount = 0;
976  if ((Process == SystemProcess) || (Process == NULL))
977  {
978  if (!Overflow)
979  SpiCurrent->NextEntryOffset = 0;
980  break;
981  }
982  else
983  Current += CurrentSize + ImageNameMaximumLength;
984  } while ((Process != SystemProcess) && (Process != NULL));
985 
986  if(Process != NULL)
987  ObDereferenceObject(Process);
988  Status = STATUS_SUCCESS;
989  }
991  {
992  if(Process != NULL)
993  ObDereferenceObject(Process);
994  if (ProcessImageName)
995  {
996  /* Release the memory allocated by SeLocateProcessImageName */
997  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
998  }
999 
1000  Status = _SEH2_GetExceptionCode();
1001  }
1002  _SEH2_END
1003 
1004  if (Overflow)
1005  Status = STATUS_INFO_LENGTH_MISMATCH;
1006 
1007  *ReqSize = TotalSize;
1008  return Status;
1009 }
1010 
1011 /* Class 6 - Call Count Information */
1013 {
1014  /* FIXME */
1015  DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1016  return STATUS_NOT_IMPLEMENTED;
1017 }
1018 
1019 /* Class 7 - Device Information */
1021 {
1025 
1026  *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1027 
1028  /* Check user buffer's size */
1029  if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1030  {
1032  }
1033 
1034  ConfigInfo = IoGetConfigurationInformation();
1035 
1036  Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1037  Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1038  Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1039  Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1040  Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1041  Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1042 
1043  return STATUS_SUCCESS;
1044 }
1045 
1046 /* Class 8 - Processor Performance Information */
1048 {
1051 
1052  LONG i;
1053  ULONG TotalTime;
1054  PKPRCB Prcb;
1055 
1057 
1058  /* Check user buffer's size */
1059  if (Size < *ReqSize)
1060  {
1062  }
1063 
1064  for (i = 0; i < KeNumberProcessors; i++)
1065  {
1066  /* Get the PRCB on this processor */
1067  Prcb = KiProcessorBlock[i];
1068 
1069  /* Calculate total user and kernel times */
1070  TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1076  Spi->InterruptCount = Prcb->InterruptCount;
1077  Spi++;
1078  }
1079 
1080  return STATUS_SUCCESS;
1081 }
1082 
1083 /* Class 9 - Flags Information */
1085 {
1086 #if (NTDDI_VERSION >= NTDDI_VISTA)
1087  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1088 #endif
1089 
1090  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1091  {
1093  }
1094 
1096 #if (NTDDI_VERSION < NTDDI_VISTA)
1097  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1098 #endif
1099 
1100  return STATUS_SUCCESS;
1101 }
1102 
1104 {
1105  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1106  {
1108  }
1109 
1111  {
1112  return STATUS_ACCESS_DENIED;
1113  }
1114 
1116  return STATUS_SUCCESS;
1117 }
1118 
1119 /* Class 10 - Call Time Information */
1121 {
1122  /* FIXME */
1123  DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1124  return STATUS_NOT_IMPLEMENTED;
1125 }
1126 
1127 /* Class 11 - Module Information */
1129 {
1130  NTSTATUS Status;
1131 
1132  /* Acquire system module list lock */
1135 
1136  /* Call the generic handler with the system module list */
1140  Size,
1141  ReqSize);
1142 
1143  /* Release list lock and return status */
1146  return Status;
1147 }
1148 
1149 /* Class 12 - Locks Information */
1151 {
1152  /* FIXME */
1153  DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1154  return STATUS_NOT_IMPLEMENTED;
1155 }
1156 
1157 /* Class 13 - Stack Trace Information */
1159 {
1160  /* FIXME */
1161  DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1162  return STATUS_NOT_IMPLEMENTED;
1163 }
1164 
1165 /* Class 14 - Paged Pool Information */
1167 {
1168  /* FIXME */
1169  DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1170  return STATUS_NOT_IMPLEMENTED;
1171 }
1172 
1173 /* Class 15 - Non Paged Pool Information */
1175 {
1176  /* FIXME */
1177  DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1178  return STATUS_NOT_IMPLEMENTED;
1179 }
1180 
1181 
1182 /* Class 16 - Handle Information */
1184 {
1186  PLIST_ENTRY NextTableEntry;
1188  PHANDLE_TABLE_ENTRY HandleTableEntry;
1189  EXHANDLE Handle;
1190  ULONG Index = 0;
1191  NTSTATUS Status;
1192  PMDL Mdl;
1193  PAGED_CODE();
1194 
1195  DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1196 
1197  /* Set initial required buffer size */
1198  *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1199 
1200  /* Check user's buffer size */
1201  if (Size < *ReqSize)
1202  {
1204  }
1205 
1206  /* We need to lock down the memory */
1207  Status = ExLockUserBuffer(Buffer,
1208  Size,
1210  IoWriteAccess,
1211  (PVOID*)&HandleInformation,
1212  &Mdl);
1213  if (!NT_SUCCESS(Status))
1214  {
1215  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1216  return Status;
1217  }
1218 
1219  /* Reset of count of handles */
1220  HandleInformation->NumberOfHandles = 0;
1221 
1222  /* Enter a critical region */
1224 
1225  /* Acquire the handle table lock */
1226  ExAcquirePushLockShared(&HandleTableListLock);
1227 
1228  /* Enumerate all system handles */
1229  for (NextTableEntry = HandleTableListHead.Flink;
1230  NextTableEntry != &HandleTableListHead;
1231  NextTableEntry = NextTableEntry->Flink)
1232  {
1233  /* Get current handle table */
1234  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1235 
1236  /* Set the initial value and loop the entries */
1237  Handle.Value = 0;
1238  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1239  {
1240  /* Validate the entry */
1241  if ((HandleTableEntry->Object) &&
1242  (HandleTableEntry->NextFreeTableEntry != -2))
1243  {
1244  /* Increase of count of handles */
1245  ++HandleInformation->NumberOfHandles;
1246 
1247  /* Lock the entry */
1248  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1249  {
1250  /* Increase required buffer size */
1251  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1252 
1253  /* Check user's buffer size */
1254  if (*ReqSize > Size)
1255  {
1256  Status = STATUS_INFO_LENGTH_MISMATCH;
1257  }
1258  else
1259  {
1260  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1261 
1262  /* Filling handle information */
1263  HandleInformation->Handles[Index].UniqueProcessId =
1264  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1265 
1266  HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1267 
1268 #if 0 /* FIXME!!! Type field currupted */
1269  HandleInformation->Handles[Index].ObjectTypeIndex =
1270  (UCHAR) ObjectHeader->Type->Index;
1271 #else
1272  HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1273 #endif
1274 
1275  HandleInformation->Handles[Index].HandleAttributes =
1276  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1277 
1278  HandleInformation->Handles[Index].HandleValue =
1280 
1281  HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1282 
1283  HandleInformation->Handles[Index].GrantedAccess =
1284  HandleTableEntry->GrantedAccess;
1285 
1286  ++Index;
1287  }
1288 
1289  /* Unlock it */
1290  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1291  }
1292  }
1293 
1294  /* Go to the next entry */
1295  Handle.Value += sizeof(HANDLE);
1296  }
1297  }
1298 
1299  /* Release the lock */
1300  ExReleasePushLockShared(&HandleTableListLock);
1301 
1302  /* Leave the critical region */
1304 
1305  /* Release the locked user buffer */
1306  ExUnlockUserBuffer(Mdl);
1307 
1308  return Status;
1309 }
1310 
1311 /* Class 17 - Information */
1313 {
1314  /* FIXME */
1315  DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1316  return STATUS_NOT_IMPLEMENTED;
1317 }
1318 
1319 /* Class 18 - Information */
1321 {
1322  UNICODE_STRING FileName; /* FIXME */
1324 
1325  if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1326  {
1327  * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1329  }
1330 
1331  RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1332 
1333  /* FIXME */
1334  Spfi->NextEntryOffset = 0;
1335 
1337  Spfi->TotalInUse = MiUsedSwapPages;
1338  Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1339  Spfi->PageFileName = FileName;
1340  return STATUS_SUCCESS;
1341 }
1342 
1343 /* Class 19 - Vdm Instemul Information */
1345 {
1346  /* FIXME */
1347  DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1348  return STATUS_NOT_IMPLEMENTED;
1349 }
1350 
1351 /* Class 20 - Vdm Bop Information */
1353 {
1354  /* FIXME */
1355  DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1356  return STATUS_NOT_IMPLEMENTED;
1357 }
1358 
1359 /* Class 21 - File Cache Information */
1361 {
1363 
1364  *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1365 
1366  if (Size < *ReqSize)
1367  {
1369  }
1370 
1372 
1373  /* Return the Byte size not the page size. */
1374  Sci->CurrentSize =
1376  Sci->PeakSize =
1378  /* Taskmgr multiplies this one by page size right away */
1380  MiMemoryConsumers[MC_CACHE].PagesUsed; /* FIXME: Should be */
1381  /* system working set and standby pages. */
1382  Sci->PageFaultCount = 0; /* FIXME */
1383  Sci->MinimumWorkingSet = 0; /* FIXME */
1384  Sci->MaximumWorkingSet = 0; /* FIXME */
1385 
1386  return STATUS_SUCCESS;
1387 }
1388 
1390 {
1391  if (Size < sizeof(SYSTEM_FILECACHE_INFORMATION))
1392  {
1394  }
1395  /* FIXME */
1396  DPRINT1("NtSetSystemInformation - SystemFileCacheInformation not implemented\n");
1397  return STATUS_NOT_IMPLEMENTED;
1398 }
1399 
1400 /* Class 22 - Pool Tag Information */
1402 {
1404  return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1405 }
1406 
1407 /* Class 23 - Interrupt Information for all processors */
1409 {
1410  PKPRCB Prcb;
1411  LONG i;
1412  ULONG ti;
1414 
1416  {
1418  }
1419 
1420  ti = KeQueryTimeIncrement();
1421 
1422  for (i = 0; i < KeNumberProcessors; i++)
1423  {
1424  Prcb = KiProcessorBlock[i];
1426  sii->DpcCount = Prcb->DpcData[0].DpcCount;
1427  sii->DpcRate = Prcb->DpcRequestRate;
1428  sii->TimeIncrement = ti;
1429  sii->DpcBypassCount = 0;
1430  sii->ApcBypassCount = 0;
1431  sii++;
1432  }
1433 
1434  return STATUS_SUCCESS;
1435 }
1436 
1437 /* Class 24 - DPC Behaviour Information */
1439 {
1440  /* FIXME */
1441  DPRINT1("NtQuerySystemInformation - SystemDpcBehaviourInformation not implemented\n");
1442  return STATUS_NOT_IMPLEMENTED;
1443 }
1444 
1446 {
1447  /* FIXME */
1448  DPRINT1("NtSetSystemInformation - SystemDpcBehaviourInformation not implemented\n");
1449  return STATUS_NOT_IMPLEMENTED;
1450 }
1451 
1452 /* Class 25 - Full Memory Information */
1454 {
1455  PULONG Spi = (PULONG) Buffer;
1456 
1458 
1459  *ReqSize = sizeof(ULONG);
1460 
1461  if (sizeof(ULONG) != Size)
1462  {
1464  }
1465 
1466  DPRINT("SystemFullMemoryInformation\n");
1467 
1468  TheIdleProcess = PsIdleProcess;
1469 
1470  DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1471  TheIdleProcess->UniqueProcessId,
1472  TheIdleProcess->Pcb.KernelTime,
1474  MiUsedSwapPages);
1475 
1477 
1478  return STATUS_SUCCESS;
1479 }
1480 
1481 /* Class 26 - Load Image */
1483 {
1486  PVOID ImageBase;
1487  PVOID SectionPointer;
1488  ULONG_PTR EntryPoint;
1489  NTSTATUS Status;
1490  ULONG DirSize;
1491  PIMAGE_NT_HEADERS NtHeader;
1492 
1493  /* Validate size */
1494  if (Size != sizeof(SYSTEM_GDI_DRIVER_INFORMATION))
1495  {
1496  /* Incorrect buffer length, fail */
1498  }
1499 
1500  /* Only kernel mode can call this function */
1502 
1503  /* Load the driver */
1504  ImageName = DriverInfo->DriverName;
1505  Status = MmLoadSystemImage(&ImageName,
1506  NULL,
1507  NULL,
1508  0,
1509  &SectionPointer,
1510  &ImageBase);
1511  if (!NT_SUCCESS(Status)) return Status;
1512 
1513  /* Return the export pointer */
1514  DriverInfo->ExportSectionPointer =
1515  RtlImageDirectoryEntryToData(ImageBase,
1516  TRUE,
1518  &DirSize);
1519 
1520  /* Get the entrypoint */
1521  NtHeader = RtlImageNtHeader(ImageBase);
1522  EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1523  EntryPoint += (ULONG_PTR)ImageBase;
1524 
1525  /* Save other data */
1526  DriverInfo->ImageAddress = ImageBase;
1527  DriverInfo->SectionPointer = SectionPointer;
1528  DriverInfo->EntryPoint = (PVOID)EntryPoint;
1529  DriverInfo->ImageLength = NtHeader->OptionalHeader.SizeOfImage;
1530 
1531  /* All is good */
1532  return STATUS_SUCCESS;
1533 }
1534 
1535 /* Class 27 - Unload Image */
1537 {
1538  PVOID *SectionPointer = Buffer;
1539 
1540  /* Validate size */
1541  if (Size != sizeof(PVOID))
1542  {
1543  /* Incorrect length, fail */
1545  }
1546 
1547  /* Only kernel mode can call this function */
1549 
1550  /* Unload the image */
1551  MmUnloadSystemImage(*SectionPointer);
1552  return STATUS_SUCCESS;
1553 }
1554 
1555 /* Class 28 - Time Adjustment Information */
1557 {
1560 
1561  /* Check if enough storage was provided */
1563  {
1564  * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1566  }
1567 
1568  /* Give time values to our caller */
1569  TimeInfo->TimeIncrement = KeMaximumIncrement;
1570  TimeInfo->TimeAdjustment = KeTimeAdjustment;
1571  TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1572 
1573  return STATUS_SUCCESS;
1574 }
1575 
1577 {
1581 
1582  /* Check size of a buffer, it must match our expectations */
1585 
1586  /* Check who is calling */
1587  if (PreviousMode != KernelMode)
1588  {
1589  /* Check access rights */
1590  if (!SeSinglePrivilegeCheck(SeSystemtimePrivilege, PreviousMode))
1591  {
1593  }
1594  }
1595 
1596  /* FIXME: behaviour suggests the member be named 'Disable' */
1597  if (TimeInfo->Enable)
1598  {
1599  /* Disable time adjustment and set default value */
1602  }
1603  else
1604  {
1605  /* Check if a valid time adjustment value is given */
1606  if (TimeInfo->TimeAdjustment == 0) return STATUS_INVALID_PARAMETER_2;
1607 
1608  /* Enable time adjustment and set the adjustment value */
1610  KeTimeAdjustment = TimeInfo->TimeAdjustment;
1611  }
1612 
1613  return STATUS_SUCCESS;
1614 }
1615 
1616 /* Class 29 - Summary Memory Information */
1618 {
1619  /* FIXME */
1620  DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1621  return STATUS_NOT_IMPLEMENTED;
1622 }
1623 
1624 /* Class 30 - Next Event Id Information */
1626 {
1627  /* FIXME */
1628  DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1629  return STATUS_NOT_IMPLEMENTED;
1630 }
1631 
1632 /* Class 31 */
1634 {
1635  /* FIXME */
1636  DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1637  return STATUS_NOT_IMPLEMENTED;
1638 }
1639 
1640 /* Class 32 - Crash Dump Information */
1642 {
1643  /* FIXME */
1644  DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1645  return STATUS_NOT_IMPLEMENTED;
1646 }
1647 
1648 /* Class 33 - Exception Information */
1650 {
1651  PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1653  PKPRCB Prcb;
1654  ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1655  ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1656  CHAR i;
1657 
1658  /* Check size of a buffer, it must match our expectations */
1659  if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1661 
1662  /* Sum up exception count information from all processors */
1663  for (i = 0; i < KeNumberProcessors; i++)
1664  {
1665  Prcb = KiProcessorBlock[i];
1666  if (Prcb)
1667  {
1668  AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1669  ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1670 #ifndef _M_ARM
1671  FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1672 #endif // _M_ARM
1673  }
1674  }
1675 
1676  /* Save information in user's buffer */
1677  ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1678  ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1679  ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1680  ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1681 
1682  return STATUS_SUCCESS;
1683 }
1684 
1685 /* Class 34 - Crash Dump State Information */
1687 {
1688  /* FIXME */
1689  DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1690  return STATUS_NOT_IMPLEMENTED;
1691 }
1692 
1693 /* Class 35 - Kernel Debugger Information */
1695 {
1697 
1698 #if (NTDDI_VERSION >= NTDDI_VISTA)
1699  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1700 #endif
1701 
1703  {
1705  }
1706 
1709 
1710 #if (NTDDI_VERSION < NTDDI_VISTA)
1711  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1712 #endif
1713 
1714  return STATUS_SUCCESS;
1715 }
1716 
1717 /* Class 36 - Context Switch Information */
1719 {
1720  PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1722  ULONG ContextSwitches;
1723  PKPRCB Prcb;
1724  CHAR i;
1725 
1726  /* Check size of a buffer, it must match our expectations */
1727  if (sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION) != Size)
1729 
1730  /* Calculate total value of context switches across all processors */
1731  ContextSwitches = 0;
1732  for (i = 0; i < KeNumberProcessors; i ++)
1733  {
1734  Prcb = KiProcessorBlock[i];
1735  if (Prcb)
1736  {
1737  ContextSwitches += KeGetContextSwitches(Prcb);
1738  }
1739  }
1740 
1741  ContextSwitchInformation->ContextSwitches = ContextSwitches;
1742 
1743  /* FIXME */
1744  ContextSwitchInformation->FindAny = 0;
1745  ContextSwitchInformation->FindLast = 0;
1746  ContextSwitchInformation->FindIdeal = 0;
1747  ContextSwitchInformation->IdleAny = 0;
1748  ContextSwitchInformation->IdleCurrent = 0;
1749  ContextSwitchInformation->IdleLast = 0;
1750  ContextSwitchInformation->IdleIdeal = 0;
1751  ContextSwitchInformation->PreemptAny = 0;
1752  ContextSwitchInformation->PreemptCurrent = 0;
1753  ContextSwitchInformation->PreemptLast = 0;
1754  ContextSwitchInformation->SwitchToIdle = 0;
1755 
1756  return STATUS_SUCCESS;
1757 }
1758 
1759 /* Class 37 - Registry Quota Information */
1761 {
1763 
1764  *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1766  {
1768  }
1769 
1770  DPRINT1("Faking max registry size of 32 MB\n");
1771  srqi->RegistryQuotaAllowed = 0x2000000;
1772  srqi->RegistryQuotaUsed = 0x200000;
1773  srqi->PagedPoolSize = 0x200000;
1774 
1775  return STATUS_SUCCESS;
1776 }
1777 
1779 {
1780  /* FIXME */
1781  DPRINT1("NtSetSystemInformation - SystemRegistryQuotaInformation not implemented\n");
1782  return STATUS_NOT_IMPLEMENTED;
1783 }
1784 
1785 /* Class 38 - Load And Call Image */
1787 {
1790  PLDR_DATA_TABLE_ENTRY ModuleObject;
1791  NTSTATUS Status;
1792  PIMAGE_NT_HEADERS NtHeader;
1793  DRIVER_OBJECT Win32k;
1794  PDRIVER_INITIALIZE DriverInit;
1795  PVOID ImageBase;
1796  ULONG_PTR EntryPoint;
1797 
1798  /* Validate the size */
1799  if (Size != sizeof(UNICODE_STRING)) return STATUS_INFO_LENGTH_MISMATCH;
1800 
1801  /* Check who is calling */
1802  if (PreviousMode != KernelMode)
1803  {
1804  static const UNICODE_STRING Win32kName =
1805  RTL_CONSTANT_STRING(L"\\SystemRoot\\System32\\win32k.sys");
1806 
1807  /* Make sure we can load drivers */
1809  {
1810  /* FIXME: We can't, fail */
1812  }
1813 
1814  _SEH2_TRY
1815  {
1816  /* Probe and copy the unicode string */
1817  ProbeForRead(Buffer, sizeof(ImageName), 1);
1818  ImageName = *(PUNICODE_STRING)Buffer;
1819 
1820  /* Probe the string buffer */
1821  ProbeForRead(ImageName.Buffer, ImageName.Length, sizeof(WCHAR));
1822 
1823  /* Check if we have the correct name (nothing else is allowed!) */
1824  if (!RtlEqualUnicodeString(&ImageName, &Win32kName, FALSE))
1825  {
1827  }
1828  }
1830  {
1832  }
1833  _SEH2_END;
1834 
1835  /* Recursively call the function, so that we are from kernel mode */
1837  (PVOID)&Win32kName,
1838  sizeof(Win32kName));
1839  }
1840 
1841  /* Load the image */
1843  NULL,
1844  NULL,
1845  0,
1846  (PVOID)&ModuleObject,
1847  &ImageBase);
1848 
1849  if (!NT_SUCCESS(Status)) return Status;
1850 
1851  /* Get the headers */
1852  NtHeader = RtlImageNtHeader(ImageBase);
1853  if (!NtHeader)
1854  {
1855  /* Fail */
1856  MmUnloadSystemImage(ModuleObject);
1858  }
1859 
1860  /* Get the entrypoint */
1861  EntryPoint = NtHeader->OptionalHeader.AddressOfEntryPoint;
1862  EntryPoint += (ULONG_PTR)ImageBase;
1863  DriverInit = (PDRIVER_INITIALIZE)EntryPoint;
1864 
1865  /* Create a dummy device */
1866  RtlZeroMemory(&Win32k, sizeof(Win32k));
1868  Win32k.DriverStart = ImageBase;
1869 
1870  /* Call it */
1871  Status = (DriverInit)(&Win32k, NULL);
1873 
1874  /* Unload if we failed */
1875  if (!NT_SUCCESS(Status)) MmUnloadSystemImage(ModuleObject);
1876  return Status;
1877 }
1878 
1879 /* Class 39 - Priority Separation */
1881 {
1882  /* Check if the size is correct */
1883  if (Size != sizeof(ULONG))
1884  {
1886  }
1887 
1888  /* We need the TCB privilege */
1890  {
1892  }
1893 
1894  /* Modify the quantum table */
1896 
1897  return STATUS_SUCCESS;
1898 }
1899 
1900 /* Class 40 */
1901 QSI_DEF(SystemVerifierAddDriverInformation)
1902 {
1903  /* FIXME */
1904  DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
1905  return STATUS_NOT_IMPLEMENTED;
1906 }
1907 
1908 /* Class 41 */
1909 QSI_DEF(SystemVerifierRemoveDriverInformation)
1910 {
1911  /* FIXME */
1912  DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
1913  return STATUS_NOT_IMPLEMENTED;
1914 }
1915 
1916 /* Class 42 - Power Information */
1917 QSI_DEF(SystemProcessorIdleInformation)
1918 {
1919  *ReqSize = sizeof(PROCESSOR_POWER_INFORMATION) * KeNumberProcessors;
1920 
1922  {
1924  }
1925 
1926  /* FIXME */
1927  DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
1928  return STATUS_NOT_IMPLEMENTED;
1929 }
1930 
1931 /* Class 43 */
1932 QSI_DEF(SystemLegacyDriverInformation)
1933 {
1934  /* FIXME */
1935  DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
1936  return STATUS_NOT_IMPLEMENTED;
1937 }
1938 
1939 /* Class 44 - Current Time Zone Information */
1941 {
1942  *ReqSize = sizeof(TIME_ZONE_INFORMATION);
1943 
1944  if (sizeof(TIME_ZONE_INFORMATION) != Size)
1945  {
1947  }
1948 
1949  /* Copy the time zone information struct */
1950  memcpy(Buffer,
1951  &ExpTimeZoneInfo,
1952  sizeof(TIME_ZONE_INFORMATION));
1953 
1954  return STATUS_SUCCESS;
1955 }
1956 
1957 
1959 {
1960  /* Check user buffer's size */
1961  if (Size < sizeof(TIME_ZONE_INFORMATION))
1962  {
1964  }
1965 
1967 }
1968 
1969 static
1970 VOID
1972  PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer,
1973  PULONG RemainingPointer,
1974  PLIST_ENTRY ListHead,
1975  BOOLEAN ListUsesMisses)
1976 
1977 {
1980  PLIST_ENTRY ListEntry;
1981  ULONG Remaining;
1982 
1983  /* Get info pointer and remaining count of free array element */
1984  Info = *InfoPointer;
1985  Remaining = *RemainingPointer;
1986 
1987  /* Loop as long as we have lookaside lists and free array elements */
1988  for (ListEntry = ListHead->Flink;
1989  (ListEntry != ListHead) && (Remaining > 0);
1990  ListEntry = ListEntry->Flink, Remaining--)
1991  {
1992  LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
1993 
1994  /* Fill the next array element */
1995  Info->CurrentDepth = LookasideList->Depth;
1996  Info->MaximumDepth = LookasideList->MaximumDepth;
1997  Info->TotalAllocates = LookasideList->TotalAllocates;
1998  Info->TotalFrees = LookasideList->TotalFrees;
1999  Info->Type = LookasideList->Type;
2000  Info->Tag = LookasideList->Tag;
2001  Info->Size = LookasideList->Size;
2002 
2003  /* Check how the lists track misses/hits */
2004  if (ListUsesMisses)
2005  {
2006  /* Copy misses */
2007  Info->AllocateMisses = LookasideList->AllocateMisses;
2008  Info->FreeMisses = LookasideList->FreeMisses;
2009  }
2010  else
2011  {
2012  /* Calculate misses */
2013  Info->AllocateMisses = LookasideList->TotalAllocates
2014  - LookasideList->AllocateHits;
2015  Info->FreeMisses = LookasideList->TotalFrees
2016  - LookasideList->FreeHits;
2017  }
2018  }
2019 
2020  /* Return the updated pointer and remaining count */
2021  *InfoPointer = Info;
2022  *RemainingPointer = Remaining;
2023 }
2024 
2025 /* Class 45 - Lookaside Information */
2027 {
2030  PMDL Mdl;
2031  ULONG MaxCount, Remaining;
2032  KIRQL OldIrql;
2033  NTSTATUS Status;
2034 
2035  /* First we need to lock down the memory, since we are going to access it
2036  at high IRQL */
2037  PreviousMode = ExGetPreviousMode();
2038  Status = ExLockUserBuffer(Buffer,
2039  Size,
2040  PreviousMode,
2041  IoWriteAccess,
2042  (PVOID*)&Info,
2043  &Mdl);
2044  if (!NT_SUCCESS(Status))
2045  {
2046  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2047  return Status;
2048  }
2049 
2050  /* Calculate how many items we can store */
2051  Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2052  if (Remaining == 0)
2053  {
2054  goto Leave;
2055  }
2056 
2057  /* Copy info from pool lookaside lists */
2059  &Remaining,
2061  FALSE);
2062  if (Remaining == 0)
2063  {
2064  goto Leave;
2065  }
2066 
2067  /* Copy info from system lookaside lists */
2069  &Remaining,
2071  TRUE);
2072  if (Remaining == 0)
2073  {
2074  goto Leave;
2075  }
2076 
2077  /* Acquire spinlock for ExpNonPagedLookasideListHead */
2079 
2080  /* Copy info from non-paged lookaside lists */
2082  &Remaining,
2084  TRUE);
2085 
2086  /* Release spinlock for ExpNonPagedLookasideListHead */
2088 
2089  if (Remaining == 0)
2090  {
2091  goto Leave;
2092  }
2093 
2094  /* Acquire spinlock for ExpPagedLookasideListHead */
2096 
2097  /* Copy info from paged lookaside lists */
2099  &Remaining,
2101  TRUE);
2102 
2103  /* Release spinlock for ExpPagedLookasideListHead */
2105 
2106 Leave:
2107 
2108  /* Release the locked user buffer */
2109  ExUnlockUserBuffer(Mdl);
2110 
2111  /* Return the size of the actually written data */
2112  *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2113  return STATUS_SUCCESS;
2114 }
2115 
2116 
2117 /* Class 46 - Set time slip event */
2119 {
2120  /* FIXME */
2121  DPRINT1("NtSetSystemInformation - SystemTimeSlipNotification not implemented\n");
2122  return STATUS_NOT_IMPLEMENTED;
2123 }
2124 
2125 NTSTATUS
2126 NTAPI
2128 
2129 NTSTATUS
2130 NTAPI
2132 
2133 /* Class 47 - Create a new session (TSE) */
2135 {
2136  ULONG SessionId;
2138  NTSTATUS Status;
2139 
2140  if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2141 
2142  if (PreviousMode != KernelMode)
2143  {
2144  if (!SeSinglePrivilegeCheck(SeLoadDriverPrivilege, PreviousMode))
2145  {
2147  }
2148 
2150  }
2151 
2152  Status = MmSessionCreate(&SessionId);
2153  if (NT_SUCCESS(Status)) *(PULONG)Buffer = SessionId;
2154 
2155  return Status;
2156 }
2157 
2158 
2159 /* Class 48 - Delete an existing session (TSE) */
2161 {
2162  ULONG SessionId;
2164 
2165  if (Size != sizeof(ULONG)) return STATUS_INFO_LENGTH_MISMATCH;
2166 
2167  if (PreviousMode != KernelMode)
2168  {
2169  if (!SeSinglePrivilegeCheck(SeLoadDriverPrivilege, PreviousMode))
2170  {
2172  }
2173  }
2174 
2175  SessionId = *(PULONG)Buffer;
2176 
2177  return MmSessionDelete(SessionId);
2178 }
2179 
2180 
2181 /* Class 49 - UNKNOWN */
2183 {
2184  /* FIXME */
2185  DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2186  return STATUS_NOT_IMPLEMENTED;
2187 }
2188 
2189 
2190 /* Class 50 - System range start address */
2192 {
2193  /* Check user buffer's size */
2194  if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2195 
2197 
2198  if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2199 
2200  return STATUS_SUCCESS;
2201 }
2202 
2203 /* Class 51 - Driver verifier information */
2205 {
2206  /* FIXME */
2207  DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2208  return STATUS_NOT_IMPLEMENTED;
2209 }
2210 
2211 
2213 {
2214  /* FIXME */
2215  DPRINT1("NtSetSystemInformation - SystemVerifierInformation not implemented\n");
2216  return STATUS_NOT_IMPLEMENTED;
2217 }
2218 
2219 
2220 /* Class 52 */
2221 SSI_DEF(SystemVerifierThunkExtend)
2222 {
2223  /* FIXME */
2224  DPRINT1("NtSetSystemInformation - SystemVerifierThunkExtend not implemented\n");
2225  return STATUS_NOT_IMPLEMENTED;
2226 }
2227 
2228 
2229 /* Class 53 - A session's processes */
2231 {
2232  /* FIXME */
2233  DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2234  return STATUS_NOT_IMPLEMENTED;
2235 }
2236 
2237 
2238 /* Class 54 - Load & map in system space */
2240 {
2241  /* FIXME */
2242  DPRINT1("NtSetSystemInformation - SystemLoadGdiDriverInSystemSpaceInformation not implemented\n");
2243  return STATUS_NOT_IMPLEMENTED;
2244 }
2245 
2246 
2247 /* Class 55 - NUMA processor information */
2249 {
2250  ULONG MaxEntries, Node;
2252 
2253  /* Validate input size */
2254  if (Size < sizeof(ULONG))
2255  {
2257  }
2258 
2259  /* Return highest node */
2260  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2261 
2262  /* Compute how much entries we will be able to put in output structure */
2263  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2264  /* Make sure we don't overflow KeNodeBlock */
2265  if (MaxEntries > KeNumberNodes)
2266  {
2267  MaxEntries = KeNumberNodes;
2268  }
2269 
2270  /* If we have entries to write, and room for it */
2271  if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2272  MaxEntries != 0)
2273  {
2274  /* Already set size we return */
2275  *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2276  MaxEntries * sizeof(ULONGLONG);
2277 
2278  /* For each node, return processor mask */
2279  for (Node = 0; Node < MaxEntries; ++Node)
2280  {
2282  }
2283  }
2284  else
2285  {
2286  /* We only returned highest node number */
2287  *ReqSize = sizeof(ULONG);
2288  }
2289 
2290  return STATUS_SUCCESS;
2291 }
2292 
2293 
2294 /* Class 56 - Prefetcher information */
2296 {
2297  /* FIXME */
2298  DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2299  return STATUS_NOT_IMPLEMENTED;
2300 }
2301 
2302 
2303 /* Class 57 - Extended process information */
2305 {
2306  /* FIXME */
2307  DPRINT1("NtQuerySystemInformation - SystemExtendedProcessInformation not implemented\n");
2308  return STATUS_NOT_IMPLEMENTED;
2309 }
2310 
2311 
2312 /* Class 58 - Recommended shared ata alignment */
2314 {
2315  /* FIXME */
2316  DPRINT1("NtQuerySystemInformation - SystemRecommendedSharedDataAlignment not implemented\n");
2317  return STATUS_NOT_IMPLEMENTED;
2318 }
2319 
2320 
2321 /* Class 60 - NUMA memory information */
2323 {
2324  ULONG MaxEntries, Node;
2326 
2327  /* Validate input size */
2328  if (Size < sizeof(ULONG))
2329  {
2331  }
2332 
2333  /* Return highest node */
2334  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2335 
2336  /* Compute how much entries we will be able to put in output structure */
2337  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2338  /* Make sure we don't overflow KeNodeBlock */
2339  if (MaxEntries > KeNumberNodes)
2340  {
2341  MaxEntries = KeNumberNodes;
2342  }
2343 
2344  /* If we have entries to write, and room for it */
2345  if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) &&
2346  MaxEntries != 0)
2347  {
2348  /* Already set size we return */
2349  *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory) +
2350  MaxEntries * sizeof(ULONGLONG);
2351 
2352  /* If we have a single entry (us), directly return MM information */
2353  if (MaxEntries == 1)
2354  {
2355  NumaInformation->AvailableMemory[0] = MmAvailablePages << PAGE_SHIFT;
2356  }
2357  else
2358  {
2359  /* Otherwise, for each node, return available bytes */
2360  for (Node = 0; Node < MaxEntries; ++Node)
2361  {
2362  NumaInformation->AvailableMemory[Node] = (KeNodeBlock[Node]->FreeCount[0] + KeNodeBlock[Node]->FreeCount[1]) << PAGE_SHIFT;
2363  }
2364  }
2365  }
2366  else
2367  {
2368  /* We only returned highest node number */
2369  *ReqSize = sizeof(ULONG);
2370  }
2371 
2372  return STATUS_SUCCESS;
2373 }
2374 
2375 /* Class 64 - Extended handle information */
2377 {
2379  PLIST_ENTRY NextTableEntry;
2381  PHANDLE_TABLE_ENTRY HandleTableEntry;
2382  EXHANDLE Handle;
2383  ULONG Index = 0;
2384  NTSTATUS Status;
2385  PMDL Mdl;
2386  PAGED_CODE();
2387 
2388  DPRINT("NtQuerySystemInformation - SystemExtendedHandleInformation\n");
2389 
2390  /* Set initial required buffer size */
2391  *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handle);
2392 
2393  /* Check user's buffer size */
2394  if (Size < *ReqSize)
2395  {
2397  }
2398 
2399  /* We need to lock down the memory */
2400  Status = ExLockUserBuffer(Buffer,
2401  Size,
2403  IoWriteAccess,
2404  (PVOID*)&HandleInformation,
2405  &Mdl);
2406  if (!NT_SUCCESS(Status))
2407  {
2408  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2409  return Status;
2410  }
2411 
2412  /* Reset of count of handles */
2413  HandleInformation->Count = 0;
2414 
2415  /* Enter a critical region */
2417 
2418  /* Acquire the handle table lock */
2419  ExAcquirePushLockShared(&HandleTableListLock);
2420 
2421  /* Enumerate all system handles */
2422  for (NextTableEntry = HandleTableListHead.Flink;
2423  NextTableEntry != &HandleTableListHead;
2424  NextTableEntry = NextTableEntry->Flink)
2425  {
2426  /* Get current handle table */
2427  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
2428 
2429  /* Set the initial value and loop the entries */
2430  Handle.Value = 0;
2431  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
2432  {
2433  /* Validate the entry */
2434  if ((HandleTableEntry->Object) &&
2435  (HandleTableEntry->NextFreeTableEntry != -2))
2436  {
2437  /* Increase of count of handles */
2438  ++HandleInformation->Count;
2439 
2440  /* Lock the entry */
2441  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
2442  {
2443  /* Increase required buffer size */
2444  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX);
2445 
2446  /* Check user's buffer size */
2447  if (*ReqSize > Size)
2448  {
2449  Status = STATUS_INFO_LENGTH_MISMATCH;
2450  }
2451  else
2452  {
2453  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
2454 
2455  /* Filling handle information */
2456  HandleInformation->Handle[Index].UniqueProcessId =
2457  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
2458 
2459  HandleInformation->Handle[Index].CreatorBackTraceIndex = 0;
2460 
2461 #if 0 /* FIXME!!! Type field currupted */
2462  HandleInformation->Handles[Index].ObjectTypeIndex =
2463  (UCHAR) ObjectHeader->Type->Index;
2464 #else
2465  HandleInformation->Handle[Index].ObjectTypeIndex = 0;
2466 #endif
2467 
2468  HandleInformation->Handle[Index].HandleAttributes =
2469  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
2470 
2471  HandleInformation->Handle[Index].HandleValue =
2473 
2474  HandleInformation->Handle[Index].Object = &ObjectHeader->Body;
2475 
2476  HandleInformation->Handle[Index].GrantedAccess =
2477  HandleTableEntry->GrantedAccess;
2478 
2479  HandleInformation->Handle[Index].Reserved = 0;
2480 
2481  ++Index;
2482  }
2483 
2484  /* Unlock it */
2485  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
2486  }
2487  }
2488 
2489  /* Go to the next entry */
2490  Handle.Value += sizeof(HANDLE);
2491  }
2492  }
2493 
2494  /* Release the lock */
2495  ExReleasePushLockShared(&HandleTableListLock);
2496 
2497  /* Leave the critical region */
2499 
2500  /* Release the locked user buffer */
2501  ExUnlockUserBuffer(Mdl);
2502 
2503  return Status;
2504 }
2505 
2506 /* Query/Set Calls Table */
2507 typedef
2508 struct _QSSI_CALLS
2509 {
2512 } QSSI_CALLS;
2513 
2514 // QS Query & Set
2515 // QX Query
2516 // XS Set
2517 // XX unknown behaviour
2518 //
2519 #define SI_QS(n) {QSI_USE(n),SSI_USE(n)}
2520 #define SI_QX(n) {QSI_USE(n),NULL}
2521 #define SI_XS(n) {NULL,SSI_USE(n)}
2522 #define SI_XX(n) {NULL,NULL}
2523 
2524 static
2525 QSSI_CALLS
2527 {
2532  SI_QX(SystemPathInformation), /* should be SI_XX */
2538  SI_QX(SystemCallTimeInformation), /* should be SI_XX */
2541  SI_QX(SystemStackTraceInformation), /* should be SI_XX */
2542  SI_QX(SystemPagedPoolInformation), /* should be SI_XX */
2543  SI_QX(SystemNonPagedPoolInformation), /* should be SI_XX */
2548  SI_QX(SystemVdmBopInformation), /* it should be SI_XX */
2553  SI_QX(SystemFullMemoryInformation), /* it should be SI_XX */
2557  SI_QX(SystemSummaryMemoryInformation), /* it should be SI_XX */
2558  SI_QX(SystemNextEventIdInformation), /* it should be SI_XX */
2559  SI_QX(SystemPerformanceTraceInformation), /* it should be SI_XX */
2568  SI_QX(SystemVerifierAddDriverInformation), /* it should be SI_XX */
2569  SI_QX(SystemVerifierRemoveDriverInformation), /* it should be SI_XX */
2570  SI_QX(SystemProcessorIdleInformation), /* it should be SI_XX */
2571  SI_QX(SystemLegacyDriverInformation), /* it should be SI_XX */
2572  SI_QS(SystemCurrentTimeZoneInformation), /* it should be SI_QX */
2577  SI_QX(SystemSessionInformation), /* it should be SI_XX */
2580  SI_XS(SystemVerifierThunkExtend),
2589  SI_XX(SystemProcessorPowerInformation), /* FIXME: not implemented */
2590  SI_XX(SystemEmulationBasicInformation), /* FIXME: not implemented */
2591  SI_XX(SystemEmulationProcessorInformation), /* FIXME: not implemented */
2593 };
2594 
2596 #define MIN_SYSTEM_INFO_CLASS (SystemBasicInformation)
2597 #define MAX_SYSTEM_INFO_CLASS (sizeof(CallQS) / sizeof(CallQS[0]))
2598 
2599 /*
2600  * @implemented
2601  */
2603 NTSTATUS
2604 NTAPI
2606  _In_ SYSTEM_INFORMATION_CLASS SystemInformationClass,
2607  _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation,
2608  _In_ ULONG Length,
2609  _Out_opt_ PULONG UnsafeResultLength)
2610 {
2612  ULONG ResultLength = 0;
2614  NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
2615 
2616  PAGED_CODE();
2617 
2618  PreviousMode = ExGetPreviousMode();
2619 
2620  _SEH2_TRY
2621  {
2622 #if (NTDDI_VERSION >= NTDDI_VISTA)
2623  /*
2624  * Check if the request is valid.
2625  */
2626  if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2627  {
2629  }
2630 #endif
2631 
2632  if (PreviousMode != KernelMode)
2633  {
2634  /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
2635  if (SystemInformationClass == SystemKernelDebuggerInformation)
2636  Alignment = TYPE_ALIGNMENT(BOOLEAN);
2637 
2638  ProbeForWrite(SystemInformation, Length, Alignment);
2639  if (UnsafeResultLength != NULL)
2640  ProbeForWriteUlong(UnsafeResultLength);
2641  }
2642 
2643  if (UnsafeResultLength)
2644  *UnsafeResultLength = 0;
2645 
2646 #if (NTDDI_VERSION < NTDDI_VISTA)
2647  /*
2648  * Check if the request is valid.
2649  */
2650  if (SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2651  {
2653  }
2654 #endif
2655 
2656  if (NULL != CallQS [SystemInformationClass].Query)
2657  {
2658  /*
2659  * Hand the request to a subhandler.
2660  */
2661  FStatus = CallQS [SystemInformationClass].Query(SystemInformation,
2662  Length,
2663  &ResultLength);
2664 
2665  /* Save the result length to the caller */
2666  if (UnsafeResultLength)
2667  *UnsafeResultLength = ResultLength;
2668  }
2669  }
2671  {
2672  FStatus = _SEH2_GetExceptionCode();
2673  }
2674  _SEH2_END;
2675 
2676  return FStatus;
2677 }
2678 
2679 
2680 NTSTATUS
2681 NTAPI
2683  IN PVOID SystemInformation,
2684  IN ULONG SystemInformationLength)
2685 {
2688 
2689  PAGED_CODE();
2690 
2691  PreviousMode = ExGetPreviousMode();
2692 
2693  _SEH2_TRY
2694  {
2695  /*
2696  * If called from user mode, check
2697  * possible unsafe arguments.
2698  */
2699  if (PreviousMode != KernelMode)
2700  {
2701  ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
2702  }
2703 
2704  /*
2705  * Check the request is valid.
2706  */
2707  if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
2708  (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
2709  {
2710  if (NULL != CallQS [SystemInformationClass].Set)
2711  {
2712  /*
2713  * Hand the request to a subhandler.
2714  */
2715  Status = CallQS [SystemInformationClass].Set(SystemInformation,
2716  SystemInformationLength);
2717  }
2718  }
2719  }
2721  {
2722  Status = _SEH2_GetExceptionCode();
2723  }
2724  _SEH2_END;
2725 
2726  return Status;
2727 }
2728 
2729 ULONG
2730 NTAPI
2732 {
2733  /* Just use Ke */
2734  return KeGetCurrentProcessorNumber();
2735 }
2736 
2737 #undef ExGetPreviousMode
2739 NTAPI
2741 {
2742  /* Just use Ke */
2743  return KeGetPreviousMode();
2744 }
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
DWORD *typedef PVOID
Definition: winlogon.h:52
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define KeGetCurrentIrql()
Definition: env_spec_w32.h:706
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:43
signed char * PCHAR
Definition: retypes.h:7
ULONG HandleAttributes
Definition: extypes.h:1412
Definition: video.h:583
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 const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1256
ULONGLONG AvailableMemory[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1397
ULONG KeMaximumIncrement
Definition: clock.c:20
NTSTATUS NTAPI MmSessionCreate(OUT PULONG SessionId)
Definition: session.c:822
#define QSI_DEF(n)
Definition: sysinfo.c:521
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:85
#define PAGE_SHIFT
Definition: env_spec_w32.h:45
PVOID Object
Definition: extypes.h:1406
#define IN
Definition: typedefs.h:39
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:36
#define MM_VIRTMEM_GRANULARITY
Definition: mm.h:76
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
ERESOURCE ExpFirmwareTableResource
Definition: sysinfo.c:24
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION SYSTEM_REGISTRY_QUOTA_INFORMATION
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1090
USHORT ObjectTypeIndex
Definition: extypes.h:1411
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
const LUID SeSystemtimePrivilege
Definition: priv.c:33
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
ULONG Index
Definition: obtypes.h:385
#define ROUND_UP(n, align)
Definition: eventvwr.h:31
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG InterruptTime
Definition: ketypes.h:736
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:26
BOOLEAN NTAPI ExIsProcessorFeaturePresent(IN ULONG ProcessorFeature)
Definition: sysinfo.c:288
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
USHORT CreatorBackTraceIndex
Definition: extypes.h:1410
USHORT MaximumLength
Definition: env_spec_w32.h:370
Definition: bidi.c:75
#define _Out_writes_bytes_to_opt_(size, count)
Definition: no_sal2.h:375
Definition: arc.h:32
struct _SYSTEM_NUMA_INFORMATION * PSYSTEM_NUMA_INFORMATION
const LUID SeDebugPrivilege
Definition: priv.c:41
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
ULONG_PTR ObAttributes
Definition: extypes.h:600
SIZE_T QuotaPeak[3]
Definition: pstypes.h:1202
KDPC_DATA DpcData[2]
Definition: ketypes.h:676
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel)?(CompletionRoutine!=NULL):TRUE)
#define SI_XS(n)
Definition: sysinfo.c:2521
NTSTATUS NTAPI NtSetSystemEnvironmentValueEx(IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
Definition: sysinfo.c:504
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MC_USER
Definition: mm.h:92
HANDLE InheritedFromUniqueProcessId
Definition: pstypes.h:1241
SIZE_T PeakVirtualSize
Definition: pstypes.h:1204
SCHAR BasePriority
Definition: ketypes.h:1417
return STATUS_SUCCESS
Definition: btrfs.c:2664
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION * PSYSTEM_QUERY_TIME_ADJUST_INFORMATION
unsigned char * PUCHAR
Definition: retypes.h:3
char CHAR
Definition: xmlstorage.h:175
LARGE_INTEGER CreateTime
Definition: pstypes.h:1036
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:1971
ULONG SessionId
Definition: dllmain.c:28
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2511
#define SI_QS(n)
Definition: sysinfo.c:2519
#define KeGetPreviousMode()
Definition: ketypes.h:1081
PVOID DriverStart
Definition: iotypes.h:2165
KTHREAD Tcb
Definition: pstypes.h:1035
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1054
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
PVOID *typedef PWSTR
Definition: winlogon.h:57
SCHAR Priority
Definition: ketypes.h:974
FAST_MUTEX ExpEnvironmentLock
Definition: sysinfo.c:23
__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:2605
static EMS_HANDLE HandleTable[EMS_MAX_HANDLES]
Definition: emsdrv.c:40
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:524
ULONG KeFeatureBits
Definition: krnlinit.c:22
struct _ThreadInfo ThreadInfo
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1409
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:2740
ULONG ARC_STATUS
Definition: arc.h:4
#define MC_SYSTEM
Definition: mm.h:93
NTSTATUS NTAPI NtEnumerateSystemEnvironmentValuesEx(IN ULONG InformationClass, IN PVOID Buffer, IN ULONG BufferLength)
Definition: sysinfo.c:482
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:267
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:188
#define KD_DEBUGGER_NOT_PRESENT
Definition: kdfuncs.h:133
struct _SYSTEM_PERFORMANCE_INFORMATION * PSYSTEM_PERFORMANCE_INFORMATION
_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
VOID NTAPI ExGetCurrentProcessorCounts(PULONG ThreadKernelTime, PULONG TotalCpuTime, PULONG ProcessorNumber)
Definition: sysinfo.c:270
NTSTATUS NTAPI ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation, IN ULONG SystemInformationLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: expool.c:1182
uint16_t * PWCHAR
Definition: typedefs.h:55
ARC_STATUS NTAPI HalGetEnvironmentVariable(IN PCH Name, IN USHORT ValueLength, IN PCH Value)
Definition: rtc.c:70
_Must_inspect_result_ _In_ ULONG Index
Definition: fltkernel.h:1824
LARGE_INTEGER IoWriteTransferCount
Definition: memtest.h:13
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
BOOLEAN NTAPI ExVerifySuite(SUITE_TYPE SuiteType)
Definition: sysinfo.c:302
#define WCHAR
Definition: msvc.h:43
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
PVOID PMDL
Definition: usb.h:39
LARGE_INTEGER CreateTime
Definition: extypes.h:887
struct _SYSTEM_PROCESSOR_INFORMATION SYSTEM_PROCESSOR_INFORMATION
ULONG DpcTime
Definition: ketypes.h:735
_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:883
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
HANDLE UniqueProcessId
Definition: pstypes.h:1199
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
ULONG IoWriteOperationCount
Definition: iomgr.c:41
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:196
SIZE_T QuotaUsage[3]
Definition: pstypes.h:1201
#define MAX_ENVVAL_SIZE
Definition: sysinfo.c:18
BOOLEAN KiTimeAdjustmentEnabled
Definition: time.c:19
SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[1]
Definition: extypes.h:1021
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1087
ULONG IoReadOperationCount
Definition: iomgr.c:39
uint32_t ULONG_PTR
Definition: typedefs.h:64
LARGE_INTEGER CreateTime
Definition: pstypes.h:1196
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
#define OBJ_NAME_PATH_SEPARATOR
Definition: nt_native.h:1240
ERESOURCE PsLoadedModuleResource
Definition: sysldr.c:37
ULONG NTAPI NtGetCurrentProcessorNumber(VOID)
Definition: sysinfo.c:2731
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
LARGE_INTEGER KeBootTime
Definition: clock.c:17
UCHAR ObjectTypeIndex
Definition: extypes.h:1011
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:325
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:1063
GLenum GLclampf GLint i
Definition: glfuncs.h:14
LARGE_INTEGER CurrentTime
Definition: extypes.h:846
NTSTATUS NTAPI MmSessionDelete(IN ULONG SessionId)
Definition: session.c:882
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:2526
#define FALSE
Definition: types.h:117
#define ANSI_NULL
NTSTATUS ExpSetTimeZoneInformation(PTIME_ZONE_INFORMATION TimeZoneInformation)
Definition: time.c:278
ULONG ProcessExiting
Definition: pstypes.h:1327
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1115
long LONG
Definition: pedump.c:60
_In_ ULONG BufferLength
Definition: usbdlib.h:225
ULONG GrantedAccess
Definition: extypes.h:1409
ULONG KeAlignmentFixupCount
Definition: ketypes.h:796
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
#define _SEH2_END
Definition: pseh2_64.h:7
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:59
NTSTATUS NTAPI NtSetSystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
Definition: sysinfo.c:2682
ULONG ActiveThreads
Definition: pstypes.h:1268
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
LARGE_INTEGER IdleProcessTime
Definition: memtest.h:11
CHAR * PCH
Definition: ntbasedef.h:390
struct _SYSTEM_FLAGS_INFORMATION SYSTEM_FLAGS_INFORMATION
Definition: extypes.h:595
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX Handle[1]
Definition: extypes.h:1420
smooth NULL
Definition: ftsmooth.c:513
#define ObpGetHandleObject(x)
Definition: ob.h:81
#define STATUS_BREAKPOINT
Definition: ntstatus.h:172
const LUID SeLoadDriverPrivilege
Definition: priv.c:31
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:462
LARGE_INTEGER CreateTime
Definition: extypes.h:864
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
#define FORCEINLINE
Definition: ntbasedef.h:213
void DPRINT(...)
Definition: polytest.cpp:61
struct _SYSTEM_FLAGS_INFORMATION * PSYSTEM_FLAGS_INFORMATION
ULONG KeTimeAdjustment
Definition: time.c:18
VOID NTAPI PsChangeQuantumTable(IN BOOLEAN Immediate, IN ULONG PrioritySeparation)
Definition: process.c:235
Definition: bufpool.h:45
struct _FileName FileName
ULONG KernelTime
Definition: ketypes.h:733
#define SystemPerformanceInformation
Definition: memtest.h:87
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
ULONG ExpTimeZoneId
Definition: time.c:25
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2510
LIST_ENTRY ThreadListHead
Definition: ketypes.h:1403
ULONG DpcCount
Definition: ketypes.h:748
ULONG InterruptCount
Definition: ketypes.h:732
UCHAR WaitReason
Definition: ketypes.h:1249
UCHAR HandleAttributes
Definition: extypes.h:1012
UINTN Size
Definition: acefiex.h:555
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:911
struct _SYSTEM_SET_TIME_ADJUST_INFORMATION * PSYSTEM_SET_TIME_ADJUST_INFORMATION
FAST_MUTEX
Definition: extypes.h:17
SCHAR BasePriority
Definition: ketypes.h:1209
LARGE_INTEGER UserTime
Definition: extypes.h:863
#define _Out_opt_
Definition: no_sal2.h:339
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
_In_ HANDLE Handle
Definition: extypes.h:390
ULONG PageFaultCount
Definition: mmtypes.h:908
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:228
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
unsigned char BOOLEAN
_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:21
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION SYSTEM_QUERY_TIME_ADJUST_INFORMATION
ULONG_PTR HandleValue
Definition: extypes.h:1408
ULONG KernelTime
Definition: ketypes.h:1305
struct _SYSTEM_THREAD_INFORMATION * PSYSTEM_THREAD_INFORMATION
struct _SYSTEM_PAGEFILE_INFORMATION SYSTEM_PAGEFILE_INFORMATION
#define STATUS_INVALID_IMAGE_FORMAT
Definition: ntstatus.h:345
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define __kernel_entry
Definition: specstrings.h:50
LARGE_INTEGER KernelTime
Definition: extypes.h:862
if(!(yy_init))
Definition: macro.lex.yy.c:704
#define PROCESSOR_FEATURE_MAX
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION * PSYSTEM_KERNEL_DEBUGGER_INFORMATION
#define SSI_DEF(n)
Definition: sysinfo.c:525
ULONG_PTR UniqueProcessId
Definition: extypes.h:1407
LIST_ENTRY HandleTableListHead
Definition: handle.c:18
struct _SYSTEM_CONTEXT_SWITCH_INFORMATION * PSYSTEM_CONTEXT_SWITCH_INFORMATION
#define TAG_MDL
Definition: tag.h:86
uint64_t ULONGLONG
Definition: typedefs.h:66
NTSTATUS NTAPI NtSetSystemEnvironmentValue(IN PUNICODE_STRING VariableName, IN PUNICODE_STRING Value)
Definition: sysinfo.c:412
PVOID Object
Definition: extypes.h:1014
CLIENT_ID Cid
Definition: pstypes.h:1060
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
struct _SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION
HANDLE GenericHandleOverlay
Definition: ex.h:88
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
ULONG GrantedAccess
Definition: extypes.h:1015
ULONG GrantedAccess
Definition: extypes.h:606
PKNODE KeNodeBlock[1]
Definition: krnlinit.c:39
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:844
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
#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
#define PAGED_CODE()
Definition: video.h:57
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:155
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
UINTN VOID * Buffer
Definition: acefiex.h:370
FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule(IN ULONG ModuleCount, IN PLDR_DATA_TABLE_ENTRY LdrEntry, OUT PRTL_PROCESS_MODULE_INFORMATION ModuleInfo)
Definition: sysinfo.c:29
NTSYSAPI NTSTATUS NTAPI ZwSetSystemInformation(_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _In_ PVOID SystemInformation, _In_ SIZE_T SystemInformationLength)
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:24
#define KeGetContextSwitches(Prcb)
Definition: ke.h:129
UNICODE_STRING ImageName
Definition: extypes.h:890
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
#define SharedUserData
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: ex.h:73
static const char * ImageName
Definition: image.c:34
DRIVER_INITIALIZE * PDRIVER_INITIALIZE
Definition: iotypes.h:2121
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:226
VOID UINTN Length
Definition: acefiex.h:744
#define RtlImageDirectoryEntryToData
Definition: compat.h:460
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
C_ASSERT(SystemBasicInformation==0)
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:893
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:22
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
Definition: btrfs_drv.h:1710
NTSTATUS NTAPI NtQuerySystemEnvironmentValue(IN PUNICODE_STRING VariableName, OUT PWSTR ValueBuffer, IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: sysinfo.c:310
#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:734
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:1450
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Definition: typedefs.h:118
#define SystemExtendServiceTableInformation
Definition: DriverTester.h:35
KPROCESS Pcb
Definition: pstypes.h:1194
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX SYSTEM_HANDLE_TABLE_ENTRY_INFO_EX
#define PASSIVE_LEVEL
Definition: env_spec_w32.h:693
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2596
#define IMAGE_DIRECTORY_ENTRY_EXPORT
Definition: compat.h:140
UINTN UINT8 Value
Definition: acefiex.h:751
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
VOID NTAPI ExGetCurrentProcessorCpuUsage(PULONG CpuUsage)
Definition: sysinfo.c:249
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
MMSUPPORT Vm
Definition: pstypes.h:1288
UCHAR KeNumberNodes
Definition: krnlinit.c:40
static BOOL Set
Definition: gflags.c:18
Status
Definition: gdiplustypes.h:24
const LUID SeTcbPrivilege
Definition: priv.c:28
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
LARGE_INTEGER IoReadTransferCount
Definition: memtest.h:12
struct _KTHREAD * IdleThread
Definition: ketypes.h:568
#define _In_
Definition: no_sal2.h:204
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
#define SystemLoadGdiDriverInformation
Definition: DriverTester.h:34
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1035
ULONG PeakWorkingSetSize
Definition: mmtypes.h:909
struct _SYSTEM_EXCEPTION_INFORMATION * PSYSTEM_EXCEPTION_INFORMATION
ARC_STATUS NTAPI HalSetEnvironmentVariable(IN PCH Name, IN PCH Value)
Definition: rtc.c:57
#define NT_SUCCESS(StatCode)
Definition: cmd.c:149
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
DWORD *typedef HANDLE
Definition: winlogon.h:52
USHORT HandleValue
Definition: extypes.h:1013
LONG NTSTATUS
Definition: DriverTester.h:11
DRIVER_INFORMATION DriverInfo
Definition: main.c:59
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:325
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:171
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:47
LARGE_INTEGER KernelTime
Definition: extypes.h:889
struct _SYSTEM_LOOKASIDE_INFORMATION SYSTEM_LOOKASIDE_INFORMATION
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:905
struct _SYSTEM_DEVICE_INFORMATION * PSYSTEM_DEVICE_INFORMATION
enum _LOCK_OPERATION LOCK_OPERATION
unsigned short USHORT
Definition: pedump.c:61
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:847
#define SI_XX(n)
Definition: sysinfo.c:2522
ULONG KeExceptionDispatchCount
Definition: ketypes.h:701
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:86
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:805
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
#define _SEH2_TRY
Definition: pseh2_64.h:5
#define SystemBasicInformation
Definition: xboxvmp.h:35
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
unsigned int * PULONG
Definition: retypes.h:1
struct _SYSTEM_BASIC_INFORMATION SYSTEM_BASIC_INFORMATION
struct _SYSTEM_INTERRUPT_INFORMATION * PSYSTEM_INTERRUPT_INFORMATION
PVOID MmHighestUserAddress
Definition: rtlcompat.c:26
LIST_ENTRY ExpFirmwareTableProviderListHead
Definition: sysinfo.c:25
#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:1398
enum _SUITE_TYPE SUITE_TYPE
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1396
LARGE_INTEGER IoOtherTransferCount
Definition: memtest.h:14
#define DPRINT1
Definition: precomp.h:8
#define RtlImageNtHeader
Definition: compat.h:457
ULONG UserTime
Definition: ketypes.h:1335
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
TIME_ZONE_INFORMATION ExpTimeZoneInfo
Definition: time.c:21
#define MC_CACHE
Definition: mm.h:91
#define OUT
Definition: typedefs.h:40
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1143
volatile UCHAR State
Definition: ketypes.h:997
ULONG ERESOURCE
Definition: env_spec_w32.h:594
CHAR ImageFileName[16]
Definition: pstypes.h:1258
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:83
unsigned int ULONG
Definition: retypes.h:1
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
ULONG ContextSwitches
Definition: ketypes.h:996
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define UNIMPLEMENTED
Definition: debug.h:114
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
LARGE_INTEGER UserTime
Definition: extypes.h:888
#define ULONG_PTR
Definition: config.h:101
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
uint32_t * PULONG_PTR
Definition: typedefs.h:64
PVOID Object
Definition: extypes.h:599
ULONG WaitTime
Definition: ketypes.h:1046
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO SYSTEM_HANDLE_TABLE_ENTRY_INFO
#define NTSTATUS
Definition: env_spec_w32.h:77
ULONG PagesUsed
Definition: mm.h:381
EX_PUSH_LOCK ProcessLock
Definition: pstypes.h:1195
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
#define TAG_SEPA
Definition: tag.h:189
ULONG_PTR Value
Definition: ex.h:89
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1097
KAFFINITY ProcessorMask
Definition: ketypes.h:776
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
ULONG IoOtherOperationCount
Definition: iomgr.c:43
struct _QSSI_CALLS QSSI_CALLS
struct _TIME_ZONE_INFORMATION TIME_ZONE_INFORMATION
GLfloat GLfloat p
Definition: glext.h:8902
#define SI_QX(n)
Definition: sysinfo.c:2520
ULONG DpcRequestRate
Definition: ketypes.h:684
_In_ FILTER_INFORMATION_CLASS InformationClass
Definition: fltkernel.h:1714
POBJECT_TYPE Type
Definition: obtypes.h:487
#define OBJ_HANDLE_ATTRIBUTES
Definition: ob.h:52
SIZE_T VirtualSize
Definition: pstypes.h:1205
IN PVOID IN PVOID IN PCHAR IN OUT PPORT_CONFIGURATION_INFORMATION ConfigInfo
Definition: srb.h:462
SIZE_T CommitCharge
Definition: pstypes.h:1203
ULONG WorkingSetSize
Definition: mmtypes.h:931
ULONG NtGlobalFlag
Definition: init.c:51
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2597
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19
USHORT UniqueProcessId
Definition: extypes.h:1009
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx(IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
Definition: sysinfo.c:492
NTSYSAPI BOOLEAN NTAPI RtlEqualUnicodeString(PUNICODE_STRING String1, PUNICODE_STRING String2, BOOLEAN CaseInSensitive)
struct _SYSTEM_DEVICE_INFORMATION SYSTEM_DEVICE_INFORMATION
#define MmSystemRangeStart
Definition: mm.h:25
PIMAGE_EXPORT_DIRECTORY ExportSectionPointer
Definition: DriverTester.h:49
IN HDEVINFO IN PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
Definition: devinst.c:44
ULONG FreeCount[2]
Definition: ketypes.h:785
union gl_dlist_node Node
Definition: dlist.c:302
PVOID UniqueProcessId
Definition: extypes.h:624
ULONG Reserved
Definition: extypes.h:1413
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:23
USHORT CreatorBackTraceIndex
Definition: extypes.h:1010
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:25
struct _ACPI_EFI_FILE_HANDLE CHAR16 UINT64 UINT64 Attributes
Definition: acefiex.h:335
DISPATCHER_HEADER Header
Definition: ketypes.h:1380
LONGLONG QuadPart
Definition: typedefs.h:113
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:2841
_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:2551
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14