ReactOS  0.4.15-dev-5640-g0dde428
sysinfo.c File Reference
#include <ntoskrnl.h>
#include <wmidata.h>
#include <wmistr.h>
#include <debug.h>
Include dependency graph for sysinfo.c:

Go to the source code of this file.

Classes

struct  _QSSI_CALLS
 

Macros

#define NDEBUG
 
#define MAX_ENVVAL_SIZE   1024
 
#define SIG_ACPI   0x41435049
 
#define SIG_FIRM   0x4649524D
 
#define SIG_RSMB   0x52534D42
 
#define QSI_USE(n)   QSI##n
 
#define QSI_DEF(n)   static NTSTATUS QSI_USE(n) (PVOID Buffer, ULONG Size, PULONG ReqSize)
 
#define SSI_USE(n)   SSI##n
 
#define SSI_DEF(n)   static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)
 
#define SI_QS(n)   {QSI_USE(n),SSI_USE(n)}
 
#define SI_QX(n)   {QSI_USE(n),NULL}
 
#define SI_XS(n)   {NULL,SSI_USE(n)}
 
#define SI_XX(n)   {NULL,NULL}
 
#define MIN_SYSTEM_INFO_CLASS   (SystemBasicInformation)
 
#define MAX_SYSTEM_INFO_CLASS   RTL_NUMBER_OF(CallQS)
 

Typedefs

typedef struct _QSSI_CALLS QSSI_CALLS
 

Functions

FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule (IN ULONG ModuleCount, IN PLDR_DATA_TABLE_ENTRY LdrEntry, OUT PRTL_PROCESS_MODULE_INFORMATION ModuleInfo)
 
NTSTATUS NTAPI ExpQueryModuleInformation (IN PLIST_ENTRY KernelModeList, IN PLIST_ENTRY UserModeList, OUT PRTL_PROCESS_MODULES Modules, IN ULONG Length, OUT PULONG ReturnLength)
 
VOID NTAPI ExUnlockUserBuffer (PMDL Mdl)
 
NTSTATUS NTAPI ExLockUserBuffer (PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
 
NTSTATUS NTAPI ExpGetRawSMBiosTable (_Out_opt_ PVOID Buffer, _Out_ ULONG *OutSize, _In_ ULONG BufferSize)
 
VOID NTAPI ExGetCurrentProcessorCpuUsage (PULONG CpuUsage)
 
VOID NTAPI ExGetCurrentProcessorCounts (PULONG ThreadKernelTime, PULONG TotalCpuTime, PULONG ProcessorNumber)
 
BOOLEAN NTAPI ExIsProcessorFeaturePresent (IN ULONG ProcessorFeature)
 
BOOLEAN NTAPI ExVerifySuite (SUITE_TYPE SuiteType)
 
NTSTATUS NTAPI NtQuerySystemEnvironmentValue (IN PUNICODE_STRING VariableName, OUT PWSTR ValueBuffer, IN ULONG ValueBufferLength, IN OUT PULONG ReturnLength OPTIONAL)
 
NTSTATUS NTAPI NtSetSystemEnvironmentValue (IN PUNICODE_STRING VariableName, IN PUNICODE_STRING Value)
 
NTSTATUS NTAPI NtEnumerateSystemEnvironmentValuesEx (IN ULONG InformationClass, IN PVOID Buffer, IN ULONG BufferLength)
 
NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx (IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
 
NTSTATUS NTAPI NtSetSystemEnvironmentValueEx (IN PUNICODE_STRING VariableName, IN LPGUID VendorGuid, IN PVOID Value, IN OUT PULONG ReturnLength, IN OUT PULONG Attributes)
 
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)
 
 QSI_DEF (SystemBasicInformation)
 
 QSI_DEF (SystemProcessorInformation)
 
 QSI_DEF (SystemPerformanceInformation)
 
 QSI_DEF (SystemTimeOfDayInformation)
 
 QSI_DEF (SystemPathInformation)
 
 QSI_DEF (SystemProcessInformation)
 
 QSI_DEF (SystemCallCountInformation)
 
 QSI_DEF (SystemDeviceInformation)
 
 QSI_DEF (SystemProcessorPerformanceInformation)
 
 QSI_DEF (SystemFlagsInformation)
 
 SSI_DEF (SystemFlagsInformation)
 
 QSI_DEF (SystemCallTimeInformation)
 
 QSI_DEF (SystemModuleInformation)
 
 QSI_DEF (SystemLocksInformation)
 
 QSI_DEF (SystemStackTraceInformation)
 
 QSI_DEF (SystemPagedPoolInformation)
 
 QSI_DEF (SystemNonPagedPoolInformation)
 
 QSI_DEF (SystemHandleInformation)
 
 QSI_DEF (SystemObjectInformation)
 
 QSI_DEF (SystemPageFileInformation)
 
 QSI_DEF (SystemVdmInstemulInformation)
 
 QSI_DEF (SystemVdmBopInformation)
 
 QSI_DEF (SystemFileCacheInformation)
 
 SSI_DEF (SystemFileCacheInformation)
 
 QSI_DEF (SystemPoolTagInformation)
 
 QSI_DEF (SystemInterruptInformation)
 
 QSI_DEF (SystemDpcBehaviourInformation)
 
 SSI_DEF (SystemDpcBehaviourInformation)
 
 QSI_DEF (SystemFullMemoryInformation)
 
 SSI_DEF (SystemLoadGdiDriverInformation)
 
 SSI_DEF (SystemUnloadGdiDriverInformation)
 
 QSI_DEF (SystemTimeAdjustmentInformation)
 
 SSI_DEF (SystemTimeAdjustmentInformation)
 
 QSI_DEF (SystemSummaryMemoryInformation)
 
 QSI_DEF (SystemNextEventIdInformation)
 
 QSI_DEF (SystemPerformanceTraceInformation)
 
 QSI_DEF (SystemCrashDumpInformation)
 
 QSI_DEF (SystemExceptionInformation)
 
 QSI_DEF (SystemCrashDumpStateInformation)
 
 QSI_DEF (SystemKernelDebuggerInformation)
 
 QSI_DEF (SystemContextSwitchInformation)
 
 QSI_DEF (SystemRegistryQuotaInformation)
 
 SSI_DEF (SystemRegistryQuotaInformation)
 
 SSI_DEF (SystemExtendServiceTableInformation)
 
 SSI_DEF (SystemPrioritySeperation)
 
 QSI_DEF (SystemVerifierAddDriverInformation)
 
 QSI_DEF (SystemVerifierRemoveDriverInformation)
 
 QSI_DEF (SystemProcessorIdleInformation)
 
 QSI_DEF (SystemLegacyDriverInformation)
 
 QSI_DEF (SystemCurrentTimeZoneInformation)
 
 SSI_DEF (SystemCurrentTimeZoneInformation)
 
static VOID ExpCopyLookasideInformation (PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer, PULONG RemainingPointer, PLIST_ENTRY ListHead, BOOLEAN ListUsesMisses)
 
 QSI_DEF (SystemLookasideInformation)
 
 SSI_DEF (SystemTimeSlipNotification)
 
NTSTATUS NTAPI MmSessionCreate (OUT PULONG SessionId)
 
NTSTATUS NTAPI MmSessionDelete (IN ULONG SessionId)
 
 SSI_DEF (SystemSessionCreate)
 
 SSI_DEF (SystemSessionDetach)
 
 QSI_DEF (SystemSessionInformation)
 
 QSI_DEF (SystemRangeStartInformation)
 
 QSI_DEF (SystemVerifierInformation)
 
 SSI_DEF (SystemVerifierInformation)
 
 SSI_DEF (SystemVerifierThunkExtend)
 
 QSI_DEF (SystemSessionProcessesInformation)
 
 SSI_DEF (SystemLoadGdiDriverInSystemSpaceInformation)
 
 QSI_DEF (SystemNumaProcessorMap)
 
 QSI_DEF (SystemPrefetcherInformation)
 
 QSI_DEF (SystemExtendedProcessInformation)
 
 QSI_DEF (SystemRecommendedSharedDataAlignment)
 
 QSI_DEF (SystemNumaAvailableMemory)
 
 QSI_DEF (SystemExtendedHandleInformation)
 
 QSI_DEF (SystemObjectSecurityMode)
 
 QSI_DEF (SystemLogicalProcessorInformation)
 
 QSI_DEF (SystemFirmwareTableInformation)
 
 C_ASSERT (SystemBasicInformation==0)
 
__kernel_entry NTSTATUS NTAPI NtQuerySystemInformation (_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID SystemInformation, _In_ ULONG SystemInformationLength, _Out_opt_ PULONG ReturnLength)
 
__kernel_entry NTSTATUS NTAPI NtSetSystemInformation (_In_ SYSTEM_INFORMATION_CLASS SystemInformationClass, _In_reads_bytes_(SystemInformationLength) PVOID SystemInformation, _In_ ULONG SystemInformationLength)
 
ULONG NTAPI NtGetCurrentProcessorNumber (VOID)
 
KPROCESSOR_MODE NTAPI ExGetPreviousMode (VOID)
 

Variables

LIST_ENTRY HandleTableListHead
 
EX_PUSH_LOCK HandleTableListLock
 
FAST_MUTEX ExpEnvironmentLock
 
ERESOURCE ExpFirmwareTableResource
 
LIST_ENTRY ExpFirmwareTableProviderListHead
 
static QSSI_CALLS CallQS []
 

Macro Definition Documentation

◆ MAX_ENVVAL_SIZE

#define MAX_ENVVAL_SIZE   1024

Definition at line 20 of file sysinfo.c.

◆ MAX_SYSTEM_INFO_CLASS

#define MAX_SYSTEM_INFO_CLASS   RTL_NUMBER_OF(CallQS)

Definition at line 2921 of file sysinfo.c.

◆ MIN_SYSTEM_INFO_CLASS

#define MIN_SYSTEM_INFO_CLASS   (SystemBasicInformation)

Definition at line 2920 of file sysinfo.c.

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file sysinfo.c.

◆ QSI_DEF

#define QSI_DEF (   n)    static NTSTATUS QSI_USE(n) (PVOID Buffer, ULONG Size, PULONG ReqSize)

Definition at line 596 of file sysinfo.c.

◆ QSI_USE

#define QSI_USE (   n)    QSI##n

Definition at line 595 of file sysinfo.c.

◆ SI_QS

#define SI_QS (   n)    {QSI_USE(n),SSI_USE(n)}

Definition at line 2831 of file sysinfo.c.

◆ SI_QX

#define SI_QX (   n)    {QSI_USE(n),NULL}

Definition at line 2832 of file sysinfo.c.

◆ SI_XS

#define SI_XS (   n)    {NULL,SSI_USE(n)}

Definition at line 2833 of file sysinfo.c.

◆ SI_XX

#define SI_XX (   n)    {NULL,NULL}

Definition at line 2834 of file sysinfo.c.

◆ SIG_ACPI

#define SIG_ACPI   0x41435049

Definition at line 22 of file sysinfo.c.

◆ SIG_FIRM

#define SIG_FIRM   0x4649524D

Definition at line 23 of file sysinfo.c.

◆ SIG_RSMB

#define SIG_RSMB   0x52534D42

Definition at line 24 of file sysinfo.c.

◆ SSI_DEF

#define SSI_DEF (   n)    static NTSTATUS SSI_USE(n) (PVOID Buffer, ULONG Size)

Definition at line 600 of file sysinfo.c.

◆ SSI_USE

#define SSI_USE (   n)    SSI##n

Definition at line 599 of file sysinfo.c.

Typedef Documentation

◆ QSSI_CALLS

Function Documentation

◆ C_ASSERT()

C_ASSERT ( SystemBasicInformation  = =0)

◆ ExGetCurrentProcessorCounts()

VOID NTAPI ExGetCurrentProcessorCounts ( PULONG  ThreadKernelTime,
PULONG  TotalCpuTime,
PULONG  ProcessorNumber 
)

Definition at line 345 of file sysinfo.c.

348 {
349  PKPRCB Prcb;
350 
351  Prcb = KeGetCurrentPrcb();
352 
353  *ThreadKernelTime = Prcb->KernelTime + Prcb->UserTime;
354  *TotalCpuTime = Prcb->CurrentThread->KernelTime;
355  *ProcessorNumber = KeGetCurrentProcessorNumber();
356 }
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1080
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337
struct _KTHREAD * CurrentThread
Definition: ketypes.h:571
ULONG KernelTime
Definition: ketypes.h:738
ULONG UserTime
Definition: ketypes.h:739

Referenced by NdisGetCurrentProcessorCounts().

◆ ExGetCurrentProcessorCpuUsage()

VOID NTAPI ExGetCurrentProcessorCpuUsage ( PULONG  CpuUsage)

Definition at line 324 of file sysinfo.c.

325 {
326  PKPRCB Prcb;
327  ULONG TotalTime;
328  ULONGLONG ScaledIdle;
329 
330  Prcb = KeGetCurrentPrcb();
331 
332  ScaledIdle = (ULONGLONG)Prcb->IdleThread->KernelTime * 100;
333  TotalTime = Prcb->KernelTime + Prcb->UserTime;
334  if (TotalTime != 0)
335  *CpuUsage = (ULONG)(100 - (ScaledIdle / TotalTime));
336  else
337  *CpuUsage = 0;
338 }
FORCEINLINE struct _KPRCB * KeGetCurrentPrcb(VOID)
Definition: ketypes.h:1080
if(dx==0 &&dy==0)
Definition: linetemp.h:174
ULONG KernelTime
Definition: ketypes.h:738
uint64_t ULONGLONG
Definition: typedefs.h:67
ULONG UserTime
Definition: ketypes.h:739
struct _KTHREAD * IdleThread
Definition: ketypes.h:573
unsigned int ULONG
Definition: retypes.h:1

Referenced by NdisGetCurrentProcessorCpuUsage().

◆ ExGetPreviousMode()

KPROCESSOR_MODE NTAPI ExGetPreviousMode ( VOID  )

Definition at line 3062 of file sysinfo.c.

3063 {
3064  /* Just use Ke */
3065  return KeGetPreviousMode();
3066 }
#define KeGetPreviousMode()
Definition: ketypes.h:1108

Referenced by _Function_class_(), _IRQL_requires_max_(), ApphelpCacheAccessCheck(), CreateClientPort(), DbgkMapViewOfSection(), DbgkUnMapViewOfSection(), IKsPin_PinMasterClock(), IopCreateFile(), IopDeviceFsIoControl(), IopGetSetSecurityObject(), IopQueryAttributesFile(), IopUnloadDriver(), KdpLoggerThread(), KernelModeTest(), KsFastMethodHandler(), KsFastPropertyHandler(), KsInstallBusEnumInterface(), KsReadFile(), KsRemoveBusEnumInterface(), KsStreamIo(), KsWriteFile(), MiQueryMemoryBasicInformation(), MiQueryMemorySectionName(), MmCreateArm3Section(), MmCreateDataFileSection(), MmCreateImageSection(), MmCreatePhysicalMemorySection(), MmCreateSection(), MmMapViewOfSection(), NtAccessCheck(), NtAddAtom(), NtAdjustGroupsToken(), NtAlertResumeThread(), NtAlertThread(), NtAllocateLocallyUniqueId(), NtAllocateUuids(), NtAssignProcessToJobObject(), NtCancelTimer(), NtClearEvent(), NtClose(), NtCloseObjectAuditAlarm(), NtCompareTokens(), NtCreateDebugObject(), NtCreateDirectoryObject(), NtCreateEvent(), NtCreateEventPair(), NtCreateIoCompletion(), NtCreateJobObject(), NtCreateKey(), NtCreateMutant(), NtCreatePagingFile(), NtCreateProcessEx(), NtCreateProfile(), NtCreateSection(), NtCreateSemaphore(), NtCreateSymbolicLinkObject(), NtCreateTimer(), NtCreateToken(), NtDebugActiveProcess(), NtDebugContinue(), NtDelayExecution(), NtDeleteKey(), NtDeleteValueKey(), NtDisplayString(), NtDuplicateObject(), NtEnumerateKey(), NtEnumerateValueKey(), NtExtendSection(), NtFilterToken(), NtFindAtom(), NtFlushInstructionCache(), NtFlushKey(), NtFlushVirtualMemory(), NtGetContextThread(), NtGetWriteWatch(), NtImpersonateAnonymousToken(), NtImpersonateThread(), NtIsProcessInJob(), NtLoadKeyEx(), NtLockProductActivationKeys(), NtLockVirtualMemory(), NtMakePermanentObject(), NtMapViewOfSection(), NtNotifyChangeDirectoryFile(), NtOpenDirectoryObject(), NtOpenEvent(), NtOpenEventPair(), NtOpenIoCompletion(), NtOpenJobObject(), NtOpenKey(), NtOpenMutant(), NtOpenObjectAuditAlarm(), NtOpenProcessTokenEx(), NtOpenSection(), NtOpenSemaphore(), NtOpenSymbolicLinkObject(), NtOpenThreadTokenEx(), NtOpenTimer(), NtPrivilegedServiceAuditAlarm(), NtProtectVirtualMemory(), NtPulseEvent(), NtQueryDirectoryFile(), NtQueryDirectoryObject(), NtQueryEvent(), NtQueryInformationAtom(), NtQueryInformationFile(), NtQueryInformationJobObject(), NtQueryInformationProcess(), NtQueryInformationThread(), NtQueryInformationToken(), NtQueryIntervalProfile(), NtQueryIoCompletion(), NtQueryKey(), NtQueryMutant(), NtQueryObject(), NtQueryPerformanceCounter(), NtQuerySection(), NtQuerySecurityObject(), NtQuerySemaphore(), NtQuerySymbolicLinkObject(), NtQuerySystemEnvironmentValue(), NtQuerySystemInformation(), NtQuerySystemTime(), NtQueryTimer(), NtQueryTimerResolution(), NtQueryValueKey(), NtQueryVirtualMemory(), NtQueueApcThreadEx(), NtRaiseHardError(), NtReadVirtualMemory(), NtReleaseMutant(), NtReleaseSemaphore(), NtRemoveIoCompletion(), NtRemoveProcessDebug(), NtResetEvent(), NtResetWriteWatch(), NtResumeProcess(), NtResumeThread(), NtSaveKeyEx(), NtSaveMergedKeys(), NtSetContextThread(), NtSetDebugFilterState(), NtSetDefaultHardErrorPort(), NtSetEvent(), NtSetEventBoostPriority(), NtSetHighEventPair(), NtSetHighWaitLowEventPair(), NtSetInformationDebugObject(), NtSetInformationFile(), NtSetInformationJobObject(), NtSetInformationObject(), NtSetInformationProcess(), NtSetInformationThread(), NtSetInformationToken(), NtSetIoCompletion(), NtSetLowEventPair(), NtSetLowWaitHighEventPair(), NtSetSecurityObject(), NtSetSystemEnvironmentValue(), NtSetSystemInformation(), NtSetSystemTime(), NtSetTimer(), NtSetTimerResolution(), NtSetValueKey(), NtSignalAndWaitForSingleObject(), NtStartProfile(), NtStopProfile(), NtSuspendProcess(), NtSuspendThread(), NtTerminateJobObject(), NtTestAlert(), NtUnloadKey2(), NtUnlockVirtualMemory(), NtUnmapViewOfSection(), NtUserGetGuiResources(), NtWaitForDebugEvent(), NtWaitForMultipleObjects(), NtWaitForSingleObject(), NtWaitHighEventPair(), NtWaitLowEventPair(), NtWriteVirtualMemory(), ObpCreateHandle(), ObQueryObjectAuditingByHandle(), PsOpenTokenOfProcess(), PspAssignPrimaryToken(), PspCreateProcess(), PspCreateThread(), PspSetPrimaryToken(), QSI_DEF(), SepAccessCheckAndAuditAlarm(), SSI_DEF(), START_TEST(), TestMessageHandler(), UserModeTest(), VfatSetRenameInformation(), WmipOpenGuidForEvents(), and WmipRegisterGuids().

◆ ExIsProcessorFeaturePresent()

BOOLEAN NTAPI ExIsProcessorFeaturePresent ( IN ULONG  ProcessorFeature)

Definition at line 363 of file sysinfo.c.

364 {
365  /* Quick check to see if it exists at all */
366  if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return(FALSE);
367 
368  /* Return our support for it */
369  return(SharedUserData->ProcessorFeatures[ProcessorFeature]);
370 }
#define FALSE
Definition: types.h:117
#define PROCESSOR_FEATURE_MAX
#define SharedUserData

Referenced by KsecReadMachineSpecificCounters(), PciApplyHacks(), PciQueryRequirements(), and START_TEST().

◆ ExLockUserBuffer()

NTSTATUS NTAPI ExLockUserBuffer ( PVOID  BaseAddress,
ULONG  Length,
KPROCESSOR_MODE  AccessMode,
LOCK_OPERATION  Operation,
PVOID MappedSystemVa,
PMDL OutMdl 
)

Definition at line 202 of file sysinfo.c.

209 {
210  PMDL Mdl;
211  PAGED_CODE();
212 
213  *MappedSystemVa = NULL;
214  *OutMdl = NULL;
215 
216  /* Allocate an MDL for the buffer */
218  if (Mdl == NULL)
219  {
221  }
222 
223  /* Enter SEH for probing */
224  _SEH2_TRY
225  {
227  }
229  {
232  }
233  _SEH2_END;
234 
235  /* Return the safe kernel mode buffer */
237  if (*MappedSystemVa == NULL)
238  {
241  }
242 
243  /* Return the MDL */
244  *OutMdl = Mdl;
245  return STATUS_SUCCESS;
246 }
_SEH2_TRY
Definition: create.c:4226
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define TRUE
Definition: types.h:120
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
_SEH2_END
Definition: create.c:4400
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define FALSE
Definition: types.h:117
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:395
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
FP_OP Operation
Definition: fpcontrol.c:150
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define TAG_MDL
Definition: tag.h:89
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:931
#define NULL
Definition: types.h:112
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define PAGED_CODE()

Referenced by QSI_DEF().

◆ ExpConvertLdrModuleToRtlModule()

FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule ( IN ULONG  ModuleCount,
IN PLDR_DATA_TABLE_ENTRY  LdrEntry,
OUT PRTL_PROCESS_MODULE_INFORMATION  ModuleInfo 
)

Definition at line 35 of file sysinfo.c.

38 {
39  PCHAR p;
42 
43  /* Fill it out */
44  ModuleInfo->MappedBase = NULL;
45  ModuleInfo->ImageBase = LdrEntry->DllBase;
46  ModuleInfo->ImageSize = LdrEntry->SizeOfImage;
47  ModuleInfo->Flags = LdrEntry->Flags;
48  ModuleInfo->LoadCount = LdrEntry->LoadCount;
49  ModuleInfo->LoadOrderIndex = (USHORT)ModuleCount;
50  ModuleInfo->InitOrderIndex = 0;
51 
52  /* Setup name */
53  RtlInitEmptyAnsiString(&ModuleName,
55  sizeof(ModuleInfo->FullPathName));
56 
57  /* Convert it */
59  &LdrEntry->FullDllName,
60  FALSE);
62  {
63  /* Calculate offset to name */
64  p = ModuleName.Buffer + ModuleName.Length;
65  while ((p > ModuleName.Buffer) && (*--p))
66  {
67  /* Check if we found the separator */
68  if (*p == OBJ_NAME_PATH_SEPARATOR)
69  {
70  /* We did, break out */
71  p++;
72  break;
73  }
74  }
75 
76  /* Set the offset */
77  ModuleInfo->OffsetToFileName = (USHORT)(p - ModuleName.Buffer);
78  }
79  else
80  {
81  /* Return empty name */
83  ModuleInfo->OffsetToFileName = 0;
84  }
85 
86  return Status;
87 }
signed char * PCHAR
Definition: retypes.h:7
ACPI_SIZE Length
Definition: actypes.h:1053
LONG NTSTATUS
Definition: precomp.h:26
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char * ModuleName
Definition: acpixf.h:1278
#define FALSE
Definition: types.h:117
#define ANSI_NULL
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
_In_ ULONG _Out_writes_bytes_opt_ InformationLength PAUX_MODULE_EXTENDED_INFO ModuleInfo
Definition: aux_klib.h:65
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
Status
Definition: gdiplustypes.h:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
CHAR FullPathName[AUX_KLIB_MODULE_PATH_LEN]
Definition: aux_klib.h:41
unsigned short USHORT
Definition: pedump.c:61
#define NULL
Definition: types.h:112
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ExpQueryModuleInformation().

◆ ExpCopyLookasideInformation()

static VOID ExpCopyLookasideInformation ( PSYSTEM_LOOKASIDE_INFORMATION InfoPointer,
PULONG  RemainingPointer,
PLIST_ENTRY  ListHead,
BOOLEAN  ListUsesMisses 
)
static

Definition at line 2096 of file sysinfo.c.

2102 {
2105  PLIST_ENTRY ListEntry;
2106  ULONG Remaining;
2107 
2108  /* Get info pointer and remaining count of free array element */
2109  Info = *InfoPointer;
2110  Remaining = *RemainingPointer;
2111 
2112  /* Loop as long as we have lookaside lists and free array elements */
2113  for (ListEntry = ListHead->Flink;
2114  (ListEntry != ListHead) && (Remaining > 0);
2115  ListEntry = ListEntry->Flink, Remaining--)
2116  {
2117  LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2118 
2119  /* Fill the next array element */
2120  Info->CurrentDepth = LookasideList->Depth;
2121  Info->MaximumDepth = LookasideList->MaximumDepth;
2122  Info->TotalAllocates = LookasideList->TotalAllocates;
2123  Info->TotalFrees = LookasideList->TotalFrees;
2124  Info->Type = LookasideList->Type;
2125  Info->Tag = LookasideList->Tag;
2126  Info->Size = LookasideList->Size;
2127 
2128  /* Check how the lists track misses/hits */
2129  if (ListUsesMisses)
2130  {
2131  /* Copy misses */
2132  Info->AllocateMisses = LookasideList->AllocateMisses;
2133  Info->FreeMisses = LookasideList->FreeMisses;
2134  }
2135  else
2136  {
2137  /* Calculate misses */
2138  Info->AllocateMisses = LookasideList->TotalAllocates
2139  - LookasideList->AllocateHits;
2140  Info->FreeMisses = LookasideList->TotalFrees
2141  - LookasideList->FreeHits;
2142  }
2143  }
2144 
2145  /* Return the updated pointer and remaining count */
2146  *InfoPointer = Info;
2147  *RemainingPointer = Remaining;
2148 }
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
Definition: typedefs.h:119
unsigned int ULONG
Definition: retypes.h:1
_Must_inspect_result_ _In_ LPCGUID _In_ ULONG _In_ FSRTL_ALLOCATE_ECP_FLAGS _In_opt_ PFSRTL_EXTRA_CREATE_PARAMETER_CLEANUP_CALLBACK _Inout_ PVOID LookasideList
Definition: fltkernel.h:2550

Referenced by QSI_DEF().

◆ ExpGetRawSMBiosTable()

NTSTATUS NTAPI ExpGetRawSMBiosTable ( _Out_opt_ PVOID  Buffer,
_Out_ ULONG OutSize,
_In_ ULONG  BufferSize 
)

Definition at line 250 of file sysinfo.c.

254 {
256  PVOID DataBlockObject;
257  PWNODE_ALL_DATA AllData;
258  ULONG WMIBufSize;
259 
260  ASSERT(OutSize != NULL);
261  *OutSize = 0;
262 
263  /* Open the data block object for the SMBIOS table */
266  &DataBlockObject);
267  if (!NT_SUCCESS(Status))
268  {
269  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
270  return Status;
271  }
272 
273  /* Query the required buffer size */
274  WMIBufSize = 0;
275  Status = IoWMIQueryAllData(DataBlockObject, &WMIBufSize, NULL);
276  if (!NT_SUCCESS(Status))
277  {
278  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
279  return Status;
280  }
281 
282  AllData = ExAllocatePoolWithTag(PagedPool, WMIBufSize, 'itfS');
283  if (AllData == NULL)
284  {
285  DPRINT1("Failed to allocate %lu bytes for SMBIOS tables\n", WMIBufSize);
287  }
288 
289  /* Query the buffer data */
290  Status = IoWMIQueryAllData(DataBlockObject, &WMIBufSize, AllData);
291  if (!NT_SUCCESS(Status))
292  {
293  DPRINT1("IoWMIOpenBlock failed: 0x%08lx\n", Status);
294  ExFreePoolWithTag(AllData, 'itfS');
295  return Status;
296  }
297 
299  *OutSize = AllData->FixedInstanceSize;
300  if (Buffer != NULL)
301  {
302  if (BufferSize >= *OutSize)
303  {
304  RtlMoveMemory(Buffer, AllData + 1, *OutSize);
305  }
306  else
307  {
309  }
310  }
311 
312  /* Free the buffer */
313  ExFreePoolWithTag(AllData, 'itfS');
314  return Status;
315 }
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
LONG NTSTATUS
Definition: precomp.h:26
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69
NTSTATUS NTAPI IoWMIQueryAllData(IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer)
Definition: wmi.c:169
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
NTSTATUS NTAPI IoWMIOpenBlock(_In_ LPCGUID DataBlockGuid, _In_ ULONG DesiredAccess, _Out_ PVOID *DataBlockObject)
Definition: wmi.c:140
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define WMIGUID_QUERY
Definition: wmistr.h:159
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Referenced by QSI_DEF().

◆ ExpQueryModuleInformation()

NTSTATUS NTAPI ExpQueryModuleInformation ( IN PLIST_ENTRY  KernelModeList,
IN PLIST_ENTRY  UserModeList,
OUT PRTL_PROCESS_MODULES  Modules,
IN ULONG  Length,
OUT PULONG  ReturnLength 
)

Definition at line 91 of file sysinfo.c.

96 {
100  PLDR_DATA_TABLE_ENTRY LdrEntry;
101  ULONG ModuleCount = 0;
102  PLIST_ENTRY NextEntry;
103 
104  /* Setup defaults */
106  ModuleInfo = &Modules->Modules[0];
107 
108  /* Loop the kernel list */
109  NextEntry = KernelModeList->Flink;
110  while (NextEntry != KernelModeList)
111  {
112  /* Get the entry */
113  LdrEntry = CONTAINING_RECORD(NextEntry,
115  InLoadOrderLinks);
116 
117  /* Update size and check if we can manage one more entry */
119  if (Length >= RequiredLength)
120  {
122  LdrEntry,
123  ModuleInfo);
124 
125  /* Go to the next module */
126  ModuleInfo++;
127  }
128  else
129  {
130  /* Set error code */
132  }
133 
134  /* Update count and move to next entry */
135  ModuleCount++;
136  NextEntry = NextEntry->Flink;
137  }
138 
139  /* Check if caller also wanted user modules */
140  if (UserModeList)
141  {
142  NextEntry = UserModeList->Flink;
143  while (NextEntry != UserModeList)
144  {
145  /* Get the entry */
146  LdrEntry = CONTAINING_RECORD(NextEntry,
148  InLoadOrderLinks);
149 
150  /* Update size and check if we can manage one more entry */
152  if (Length >= RequiredLength)
153  {
155  LdrEntry,
156  ModuleInfo);
157 
158  /* Go to the next module */
159  ModuleInfo++;
160  }
161  else
162  {
163  /* Set error code */
165  }
166 
167  /* Update count and move to next entry */
168  ModuleCount++;
169  NextEntry = NextEntry->Flink;
170  }
171  }
172 
173  /* Update return length */
175 
176  /* Validate the length again */
177  if (Length >= FIELD_OFFSET(RTL_PROCESS_MODULES, Modules))
178  {
179  /* Set the final count */
180  Modules->NumberOfModules = ModuleCount;
181  }
182  else
183  {
184  /* Otherwise, we failed */
186  }
187 
188  /* Done */
189  return Status;
190 }
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
_In_ ULONG _Out_writes_bytes_opt_ InformationLength PAUX_MODULE_EXTENDED_INFO ModuleInfo
Definition: aux_klib.h:65
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
FORCEINLINE NTSTATUS ExpConvertLdrModuleToRtlModule(IN ULONG ModuleCount, IN PLDR_DATA_TABLE_ENTRY LdrEntry, OUT PRTL_PROCESS_MODULE_INFORMATION ModuleInfo)
Definition: sysinfo.c:35
struct _RTL_PROCESS_MODULE_INFORMATION RTL_PROCESS_MODULE_INFORMATION
Definition: btrfs_drv.h:1876
Definition: typedefs.h:119
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by QSI_DEF().

◆ ExQueryPoolUsage()

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 at line 1765 of file expool.c.

1773 {
1774  ULONG i;
1775  PPOOL_DESCRIPTOR PoolDesc;
1776 
1777  //
1778  // Assume all failures
1779  //
1780  *PagedPoolPages = 0;
1781  *PagedPoolAllocs = 0;
1782  *PagedPoolFrees = 0;
1783 
1784  //
1785  // Tally up the totals for all the apged pool
1786  //
1787  for (i = 0; i < ExpNumberOfPagedPools + 1; i++)
1788  {
1789  PoolDesc = ExpPagedPoolDescriptor[i];
1790  *PagedPoolPages += PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1791  *PagedPoolAllocs += PoolDesc->RunningAllocs;
1792  *PagedPoolFrees += PoolDesc->RunningDeAllocs;
1793  }
1794 
1795  //
1796  // The first non-paged pool has a hardcoded well-known descriptor name
1797  //
1798  PoolDesc = &NonPagedPoolDescriptor;
1799  *NonPagedPoolPages = PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1800  *NonPagedPoolAllocs = PoolDesc->RunningAllocs;
1801  *NonPagedPoolFrees = PoolDesc->RunningDeAllocs;
1802 
1803  //
1804  // If the system has more than one non-paged pool, copy the other descriptor
1805  // totals as well
1806  //
1807 #if 0
1808  if (ExpNumberOfNonPagedPools > 1)
1809  {
1810  for (i = 0; i < ExpNumberOfNonPagedPools; i++)
1811  {
1812  PoolDesc = ExpNonPagedPoolDescriptor[i];
1813  *NonPagedPoolPages += PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1814  *NonPagedPoolAllocs += PoolDesc->RunningAllocs;
1815  *NonPagedPoolFrees += PoolDesc->RunningDeAllocs;
1816  }
1817  }
1818 #endif
1819 
1820  //
1821  // Get the amount of hits in the system lookaside lists
1822  //
1824  {
1825  PLIST_ENTRY ListEntry;
1826 
1827  for (ListEntry = ExPoolLookasideListHead.Flink;
1828  ListEntry != &ExPoolLookasideListHead;
1829  ListEntry = ListEntry->Flink)
1830  {
1832 
1833  Lookaside = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
1834 
1835  if (Lookaside->Type == NonPagedPool)
1836  {
1837  *NonPagedPoolLookasideHits += Lookaside->AllocateHits;
1838  }
1839  else
1840  {
1841  *PagedPoolLookasideHits += Lookaside->AllocateHits;
1842  }
1843  }
1844  }
1845 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:22
ULONG RunningDeAllocs
Definition: miarm.h:319
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
ULONG ExpNumberOfPagedPools
Definition: expool.c:41
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG RunningAllocs
Definition: miarm.h:318
PPOOL_DESCRIPTOR ExpPagedPoolDescriptor[16+1]
Definition: expool.c:43
POOL_DESCRIPTOR NonPagedPoolDescriptor
Definition: expool.c:42
ULONG TotalPages
Definition: miarm.h:320
Definition: typedefs.h:119
ULONG TotalBigPages
Definition: miarm.h:321
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1

Referenced by QSI_DEF().

◆ ExUnlockUserBuffer()

VOID NTAPI ExUnlockUserBuffer ( PMDL  Mdl)

Definition at line 194 of file sysinfo.c.

195 {
198 }
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1435
#define TAG_MDL
Definition: tag.h:89
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099

Referenced by ExLockUserBuffer(), and QSI_DEF().

◆ ExVerifySuite()

BOOLEAN NTAPI ExVerifySuite ( SUITE_TYPE  SuiteType)

Definition at line 377 of file sysinfo.c.

378 {
379  if (SuiteType == Personal) return TRUE;
380  return FALSE;
381 }
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by DisplayBootBitmap(), and InitializeMachineInformation().

◆ MmSessionCreate()

NTSTATUS NTAPI MmSessionCreate ( OUT PULONG  SessionId)

Definition at line 827 of file session.c.

828 {
830  ULONG SessionLeaderExists;
832 
833  /* Fail if the process is already in a session */
834  if (Process->Flags & PSF_PROCESS_IN_SESSION_BIT)
835  {
836  DPRINT1("Process already in session\n");
838  }
839 
840  /* Check if the process is already the session leader */
841  if (!Process->Vm.Flags.SessionLeader)
842  {
843  /* Atomically set it as the leader */
844  SessionLeaderExists = InterlockedCompareExchange(&MiSessionLeaderExists, 1, 0);
845  if (SessionLeaderExists)
846  {
847  DPRINT1("Session leader race\n");
849  }
850 
851  /* Do the work required to upgrade him */
853  }
854 
855  /* Create the session */
858  if (!NT_SUCCESS(Status))
859  {
861  return Status;
862  }
863 
864  /* Set up the session working set */
866  if (!NT_SUCCESS(Status))
867  {
868  /* Fail */
869  //MiDereferenceSession();
870  ASSERT(FALSE);
872  return Status;
873  }
874 
875  /* All done */
877 
878  /* Set and assert the flags, and return */
882  return Status;
883 }
ULONG SessionId
Definition: dllmain.c:28
LONG NTSTATUS
Definition: precomp.h:26
PMM_SESSION_SPACE MmSessionSpace
Definition: session.c:21
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define PSF_PROCESS_IN_SESSION_BIT
Definition: pstypes.h:288
#define STATUS_ALREADY_COMMITTED
Definition: ntstatus.h:270
VOID NTAPI MiSessionLeader(IN PEPROCESS Process)
Definition: session.c:167
volatile LONG MiSessionLeaderExists
Definition: session.c:27
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI MiSessionInitializeWorkingSetList(VOID)
Definition: session.c:461
#define PsGetCurrentProcess
Definition: psfuncs.h:17
NTSTATUS NTAPI MiSessionCreateInternal(OUT PULONG SessionId)
Definition: session.c:599
Status
Definition: gdiplustypes.h:24
MM_SESSION_SPACE_FLAGS Flags
Definition: miarm.h:480
#define ASSERT(a)
Definition: mode.c:44
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define PspSetProcessFlag(Process, Flag)
Definition: ps_x.h:33
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_INVALID_SYSTEM_SERVICE
Definition: ntstatus.h:265
union _MM_SESSION_SPACE::@1811 u

Referenced by SSI_DEF().

◆ MmSessionDelete()

NTSTATUS NTAPI MmSessionDelete ( IN ULONG  SessionId)

Definition at line 887 of file session.c.

888 {
890 
891  /* Process must be in a session */
892  if (!(Process->Flags & PSF_PROCESS_IN_SESSION_BIT))
893  {
894  DPRINT1("Not in a session!\n");
896  }
897 
898  /* It must be the session leader */
899  if (!Process->Vm.Flags.SessionLeader)
900  {
901  DPRINT1("Not a session leader!\n");
903  }
904 
905  /* Remove one reference count */
909 
910  /* All done */
911  return STATUS_SUCCESS;
912 }
#define PSF_PROCESS_IN_SESSION_BIT
Definition: pstypes.h:288
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define STATUS_UNABLE_TO_FREE_VM
Definition: ntstatus.h:263
VOID NTAPI MiDereferenceSession(VOID)
Definition: session.c:339
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
#define DPRINT1
Definition: precomp.h:8
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
#define STATUS_SUCCESS
Definition: shellext.h:65

Referenced by SSI_DEF().

◆ NtEnumerateSystemEnvironmentValuesEx()

NTSTATUS NTAPI NtEnumerateSystemEnvironmentValuesEx ( IN ULONG  InformationClass,
IN PVOID  Buffer,
IN ULONG  BufferLength 
)

Definition at line 557 of file sysinfo.c.

560 {
562  return STATUS_NOT_IMPLEMENTED;
563 }
return STATUS_NOT_IMPLEMENTED
#define UNIMPLEMENTED
Definition: debug.h:115

◆ NtGetCurrentProcessorNumber()

ULONG NTAPI NtGetCurrentProcessorNumber ( VOID  )

Definition at line 3053 of file sysinfo.c.

3054 {
3055  /* Just use Ke */
3056  return KeGetCurrentProcessorNumber();
3057 }
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:337

Referenced by RtlGetCurrentProcessorNumber().

◆ NtQuerySystemEnvironmentValue()

NTSTATUS NTAPI NtQuerySystemEnvironmentValue ( IN PUNICODE_STRING  VariableName,
OUT PWSTR  ValueBuffer,
IN ULONG  ValueBufferLength,
IN OUT PULONG ReturnLength  OPTIONAL 
)

Definition at line 385 of file sysinfo.c.

389 {
390  ANSI_STRING AName;
391  UNICODE_STRING WName;
393  PCH AnsiValueBuffer;
394  ANSI_STRING AValue;
395  UNICODE_STRING WValue;
398  PAGED_CODE();
399 
400  /* Check if the call came from user mode */
402  if (PreviousMode != KernelMode)
403  {
404  _SEH2_TRY
405  {
406  /* Probe the input and output buffers */
407  ProbeForRead(VariableName, sizeof(UNICODE_STRING), sizeof(ULONG));
408  ProbeForWrite(ValueBuffer, ValueBufferLength, sizeof(WCHAR));
410  }
412  {
413  /* Return the exception code */
415  }
416  _SEH2_END;
417  }
418 
419  /* According to NTInternals the SeSystemEnvironmentName privilege is required! */
421  {
422  DPRINT1("NtQuerySystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
424  }
425 
426  /* Copy the name to kernel space if necessary */
427  Status = ProbeAndCaptureUnicodeString(&WName, PreviousMode, VariableName);
428  if (!NT_SUCCESS(Status)) return Status;
429 
430  /* Convert the name to ANSI and release the captured UNICODE string */
431  Status = RtlUnicodeStringToAnsiString(&AName, &WName, TRUE);
433  if (!NT_SUCCESS(Status)) return Status;
434 
435  /* Allocate a buffer for the ANSI environment variable */
436  AnsiValueBuffer = ExAllocatePoolWithTag(NonPagedPool, MAX_ENVVAL_SIZE, 'rvnE');
437  if (AnsiValueBuffer == NULL)
438  {
439  RtlFreeAnsiString(&AName);
441  }
442 
443  /* Get the environment variable and free the ANSI name */
446  AnsiValueBuffer);
447  RtlFreeAnsiString(&AName);
448 
449  /* Check if we had success */
450  if (Result == ESUCCESS)
451  {
452  /* Copy the result back to the caller. */
453  _SEH2_TRY
454  {
455  /* Initialize ANSI string from the result */
456  RtlInitAnsiString(&AValue, AnsiValueBuffer);
457 
458  /* Initialize a UNICODE string from the callers buffer */
459  RtlInitEmptyUnicodeString(&WValue, ValueBuffer, (USHORT)ValueBufferLength);
460 
461  /* Convert the result to UNICODE */
462  Status = RtlAnsiStringToUnicodeString(&WValue, &AValue, FALSE);
463 
464  if (ReturnLength != NULL)
465  *ReturnLength = WValue.Length;
466  }
468  {
470  }
471  _SEH2_END;
472  }
473  else
474  {
476  }
477 
478  /* Free the allocated ANSI value buffer */
479  ExFreePoolWithTag(AnsiValueBuffer, 'rvnE');
480 
481  return Status;
482 }
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
_SEH2_TRY
Definition: create.c:4226
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:41
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: arc.h:32
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
ULONG ARC_STATUS
Definition: arc.h:4
ARC_STATUS NTAPI HalGetEnvironmentVariable(IN PCH Name, IN USHORT ValueLength, IN PCH Value)
Definition: rtc.c:70
_SEH2_END
Definition: create.c:4400
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define MAX_ENVVAL_SIZE
Definition: sysinfo.c:20
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
#define FALSE
Definition: types.h:117
CHAR * PCH
Definition: ntbasedef.h:391
_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
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
Status
Definition: gdiplustypes.h:24
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:239
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
NTSYSAPI VOID NTAPI RtlFreeAnsiString(PANSI_STRING AnsiString)
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:349
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define PAGED_CODE()

Referenced by Test_API().

◆ NtQuerySystemEnvironmentValueEx()

NTSTATUS NTAPI NtQuerySystemEnvironmentValueEx ( IN PUNICODE_STRING  VariableName,
IN LPGUID  VendorGuid,
IN PVOID  Value,
IN OUT PULONG  ReturnLength,
IN OUT PULONG  Attributes 
)

Definition at line 567 of file sysinfo.c.

572 {
574  return STATUS_NOT_IMPLEMENTED;
575 }
return STATUS_NOT_IMPLEMENTED
#define UNIMPLEMENTED
Definition: debug.h:115

◆ NtQuerySystemInformation()

__kernel_entry NTSTATUS NTAPI NtQuerySystemInformation ( _In_ SYSTEM_INFORMATION_CLASS  SystemInformationClass,
_Out_writes_bytes_to_opt_(SystemInformationLength, *ReturnLength) PVOID  SystemInformation,
_In_ ULONG  SystemInformationLength,
_Out_opt_ PULONG  ReturnLength 
)

Definition at line 2929 of file sysinfo.c.

2934 {
2936  ULONG CapturedResultLength = 0;
2939 
2940  PAGED_CODE();
2941 
2943 
2944  _SEH2_TRY
2945  {
2946 #if (NTDDI_VERSION >= NTDDI_VISTA)
2947  /*
2948  * Check whether the request is valid.
2949  */
2950  if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2951  SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2952  {
2954  }
2955 #endif
2956 
2957  if (PreviousMode != KernelMode)
2958  {
2959  /* SystemKernelDebuggerInformation needs only BOOLEAN alignment */
2960  if (SystemInformationClass == SystemKernelDebuggerInformation)
2962 
2963  ProbeForWrite(SystemInformation, SystemInformationLength, Alignment);
2964  if (ReturnLength != NULL)
2966  }
2967 
2968  if (ReturnLength)
2969  *ReturnLength = 0;
2970 
2971 #if (NTDDI_VERSION < NTDDI_VISTA)
2972  /*
2973  * Check whether the request is valid.
2974  */
2975  if (SystemInformationClass < MIN_SYSTEM_INFO_CLASS ||
2976  SystemInformationClass >= MAX_SYSTEM_INFO_CLASS)
2977  {
2979  }
2980 #endif
2981 
2982  if (CallQS[SystemInformationClass].Query != NULL)
2983  {
2984  /* Hand the request to a subhandler */
2985  Status = CallQS[SystemInformationClass].Query(SystemInformation,
2986  SystemInformationLength,
2987  &CapturedResultLength);
2988 
2989  /* Save the result length to the caller */
2990  if (ReturnLength)
2991  *ReturnLength = CapturedResultLength;
2992  }
2993  }
2995  {
2997  }
2998  _SEH2_END;
2999 
3000  return Status;
3001 }
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
_SEH2_TRY
Definition: create.c:4226
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
_SEH2_END
Definition: create.c:4400
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
return STATUS_NOT_IMPLEMENTED
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2838
unsigned char BOOLEAN
Status
Definition: gdiplustypes.h:24
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
BOOL Query(LPCTSTR *ServiceArgs, DWORD ArgCount, BOOL bExtended)
Definition: query.c:292
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2920
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:349
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2822
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:168
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2921
#define PAGED_CODE()

Referenced by BaseQuerySystemFirmware(), GetLogicalProcessorInformation(), GetNumaAvailableMemoryNode(), GetNumaHighestNodeNumber(), GetNumaNodeProcessorMask(), GetNumaProcessorNode(), GetSystemInfo(), and GetSystemRegistryQuota().

◆ NtSetSystemEnvironmentValue()

NTSTATUS NTAPI NtSetSystemEnvironmentValue ( IN PUNICODE_STRING  VariableName,
IN PUNICODE_STRING  Value 
)

Definition at line 487 of file sysinfo.c.

489 {
490  UNICODE_STRING CapturedName, CapturedValue;
491  ANSI_STRING AName, AValue;
494 
495  PAGED_CODE();
496 
498 
499  /*
500  * Copy the strings to kernel space if necessary
501  */
502  Status = ProbeAndCaptureUnicodeString(&CapturedName,
503  PreviousMode,
504  VariableName);
505  if (NT_SUCCESS(Status))
506  {
507  Status = ProbeAndCaptureUnicodeString(&CapturedValue,
508  PreviousMode,
509  Value);
510  if (NT_SUCCESS(Status))
511  {
512  /*
513  * according to ntinternals the SeSystemEnvironmentName privilege is required!
514  */
516  PreviousMode))
517  {
518  /*
519  * convert the strings to ANSI
520  */
522  &CapturedName,
523  TRUE);
524  if (NT_SUCCESS(Status))
525  {
527  &CapturedValue,
528  TRUE);
529  if (NT_SUCCESS(Status))
530  {
532  AValue.Buffer);
533 
535  }
536  }
537  }
538  else
539  {
540  DPRINT1("NtSetSystemEnvironmentValue: Caller requires the SeSystemEnvironmentPrivilege privilege!\n");
542  }
543 
544  ReleaseCapturedUnicodeString(&CapturedValue,
545  PreviousMode);
546  }
547 
548  ReleaseCapturedUnicodeString(&CapturedName,
549  PreviousMode);
550  }
551 
552  return Status;
553 }
static __inline NTSTATUS ProbeAndCaptureUnicodeString(OUT PUNICODE_STRING Dest, IN KPROCESSOR_MODE CurrentMode, IN const UNICODE_STRING *UnsafeSrc)
Definition: probe.h:142
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:41
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
ULONG ARC_STATUS
Definition: arc.h:4
_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
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
Definition: wdfregistry.h:406
Status
Definition: gdiplustypes.h:24
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:239
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
ARC_STATUS NTAPI HalSetEnvironmentVariable(IN PCH Name, IN PCH Value)
Definition: rtc.c:57
#define DPRINT1
Definition: precomp.h:8
BOOLEAN NTAPI SeSinglePrivilegeCheck(_In_ LUID PrivilegeValue, _In_ KPROCESSOR_MODE PreviousMode)
Checks if a single privilege is present in the context of the calling thread.
Definition: priv.c:744
#define STATUS_SUCCESS
Definition: shellext.h:65
#define PAGED_CODE()

◆ NtSetSystemEnvironmentValueEx()

NTSTATUS NTAPI NtSetSystemEnvironmentValueEx ( IN PUNICODE_STRING  VariableName,
IN LPGUID  VendorGuid,
IN PVOID  Value,
IN OUT PULONG  ReturnLength,
IN OUT PULONG  Attributes 
)

Definition at line 579 of file sysinfo.c.

584 {
586  return STATUS_NOT_IMPLEMENTED;
587 }
return STATUS_NOT_IMPLEMENTED
#define UNIMPLEMENTED
Definition: debug.h:115

◆ NtSetSystemInformation()

__kernel_entry NTSTATUS NTAPI NtSetSystemInformation ( _In_ SYSTEM_INFORMATION_CLASS  SystemInformationClass,
_In_reads_bytes_(SystemInformationLength) PVOID  SystemInformation,
_In_ ULONG  SystemInformationLength 
)

Definition at line 3006 of file sysinfo.c.

3010 {
3013 
3014  PAGED_CODE();
3015 
3017 
3018  _SEH2_TRY
3019  {
3020  /*
3021  * If called from user mode, check possible unsafe arguments.
3022  */
3023  if (PreviousMode != KernelMode)
3024  {
3025  ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3026  }
3027 
3028  /*
3029  * Check whether the request is valid.
3030  */
3031  if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3032  (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3033  {
3034  if (CallQS[SystemInformationClass].Set != NULL)
3035  {
3036  /* Hand the request to a subhandler */
3037  Status = CallQS[SystemInformationClass].Set(SystemInformation,
3038  SystemInformationLength);
3039  }
3040  }
3041  }
3043  {
3045  }
3046  _SEH2_END;
3047 
3048  return Status;
3049 }
_SEH2_TRY
Definition: create.c:4226
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
_SEH2_END
Definition: create.c:4400
static BOOL Set
Definition: pageheap.c:10
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2838
Status
Definition: gdiplustypes.h:24
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
NTSTATUS(* Set)(PVOID, ULONG)
Definition: sysinfo.c:2823
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:240
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2920
#define NULL
Definition: types.h:112
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2921
#define PAGED_CODE()

◆ QSI_DEF() [1/55]

QSI_DEF ( SystemBasicInformation  )

Definition at line 615 of file sysinfo.c.

616 {
619 
620  *ReqSize = sizeof(SYSTEM_BASIC_INFORMATION);
621 
622  /* Check user buffer's size */
623  if (Size != sizeof(SYSTEM_BASIC_INFORMATION))
624  {
626  }
627 
628  RtlZeroMemory(Sbi, Size);
629  Sbi->Reserved = 0;
631  Sbi->PageSize = PAGE_SIZE;
635  Sbi->AllocationGranularity = MM_VIRTMEM_GRANULARITY; /* hard coded on Intel? */
636  Sbi->MinimumUserModeAddress = 0x10000; /* Top of 64k */
640 
641  return STATUS_SUCCESS;
642 }
ULONG KeMaximumIncrement
Definition: clock.c:20
#define MM_VIRTMEM_GRANULARITY
Definition: mm.h:102
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
Definition: bufpool.h:45
#define PAGE_SIZE
Definition: env_spec_w32.h:49
KAFFINITY KeActiveProcessors
Definition: krnlinit.c:23
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
struct _SYSTEM_BASIC_INFORMATION SYSTEM_BASIC_INFORMATION
PVOID MmHighestUserAddress
Definition: rtlcompat.c:29
struct _SYSTEM_BASIC_INFORMATION * PSYSTEM_BASIC_INFORMATION
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define ULONG_PTR
Definition: config.h:101
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [2/55]

Definition at line 645 of file sysinfo.c.

646 {
649 
650  *ReqSize = sizeof(SYSTEM_PROCESSOR_INFORMATION);
651 
652  /* Check user buffer's size */
653  if (Size < sizeof(SYSTEM_PROCESSOR_INFORMATION))
654  {
656  }
660 #if (NTDDI_VERSION < NTDDI_WIN8)
661  Spi->Reserved = 0;
662 #else
663  Spi->MaximumProcessors = 0;
664 #endif
666 
667  DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
668  Spi->ProcessorLevel, Spi->ProcessorRevision);
669 
670  return STATUS_SUCCESS;
671 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG KeFeatureBits
Definition: krnlinit.c:22
struct _SYSTEM_PROCESSOR_INFORMATION SYSTEM_PROCESSOR_INFORMATION
struct _SYSTEM_PROCESSOR_INFORMATION * PSYSTEM_PROCESSOR_INFORMATION
Definition: bufpool.h:45
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
USHORT KeProcessorRevision
Definition: krnlinit.c:21
USHORT KeProcessorLevel
Definition: krnlinit.c:20
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71

◆ QSI_DEF() [3/55]

Definition at line 674 of file sysinfo.c.

675 {
676  LONG i;
677  ULONG IdleUser, IdleKernel;
678  PKPRCB Prcb;
681 
683 
684  *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
685 
686  /* Check user buffer's size */
687  if (Size < sizeof(SYSTEM_PERFORMANCE_INFORMATION))
688  {
690  }
691 
693 
694  IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
702  for (i = 0; i < KeNumberProcessors; i ++)
703  {
704  Prcb = KiProcessorBlock[i];
705  if (Prcb)
706  {
713  }
714  }
715 
717 
719  /*
720  * Add up the full system total + pagefile.
721  * All this make Taskmgr happy but not sure it is the right numbers.
722  * This too, fixes some of GlobalMemoryStatusEx numbers.
723  */
725 
727  Spi->PageFaultCount = 0; /* FIXME */
728  Spi->CopyOnWriteCount = 0; /* FIXME */
729  Spi->TransitionCount = 0; /* FIXME */
730  Spi->CacheTransitionCount = 0; /* FIXME */
731  Spi->DemandZeroCount = 0; /* FIXME */
732  Spi->PageReadCount = 0; /* FIXME */
733  Spi->PageReadIoCount = 0; /* FIXME */
734  Spi->CacheReadCount = 0; /* FIXME */
735  Spi->CacheIoCount = 0; /* FIXME */
736  Spi->DirtyPagesWriteCount = 0; /* FIXME */
737  Spi->DirtyWriteIoCount = 0; /* FIXME */
738  Spi->MappedPagesWriteCount = 0; /* FIXME */
739  Spi->MappedWriteIoCount = 0; /* FIXME */
740 
741  Spi->PagedPoolPages = 0;
742  Spi->NonPagedPoolPages = 0;
743  Spi->PagedPoolAllocs = 0;
744  Spi->PagedPoolFrees = 0;
745  Spi->PagedPoolLookasideHits = 0;
746  Spi->NonPagedPoolAllocs = 0;
747  Spi->NonPagedPoolFrees = 0;
748  Spi->NonPagedPoolLookasideHits = 0;
750  &Spi->NonPagedPoolPages,
751  &Spi->PagedPoolAllocs,
752  &Spi->PagedPoolFrees,
754  &Spi->NonPagedPoolAllocs,
755  &Spi->NonPagedPoolFrees,
757  Spi->FreeSystemPtes = 0; /* FIXME */
758 
759  Spi->ResidentSystemCodePage = 0; /* FIXME */
760 
761  Spi->TotalSystemDriverPages = 0; /* FIXME */
762  Spi->Spare3Count = 0; /* FIXME */
763 
765  Spi->ResidentPagedPoolPage = 0; /* FIXME */
766 
767  Spi->ResidentSystemDriverPage = 0; /* FIXME */
768  Spi->CcFastReadNoWait = 0; /* FIXME */
769  Spi->CcFastReadWait = 0; /* FIXME */
770  Spi->CcFastReadResourceMiss = 0; /* FIXME */
771  Spi->CcFastReadNotPossible = 0; /* FIXME */
772 
773  Spi->CcFastMdlReadNoWait = 0; /* FIXME */
774  Spi->CcFastMdlReadWait = 0; /* FIXME */
775  Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
776  Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
777 
780  Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
781  Spi->CcMapDataWaitMiss = 0; /* FIXME */
782 
786  Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
787  Spi->CcPinReadWaitMiss = 0; /* FIXME */
788  Spi->CcCopyReadNoWait = 0; /* FIXME */
789  Spi->CcCopyReadWait = 0; /* FIXME */
790  Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
791  Spi->CcCopyReadWaitMiss = 0; /* FIXME */
792 
793  Spi->CcMdlReadNoWait = 0; /* FIXME */
794  Spi->CcMdlReadWait = 0; /* FIXME */
795  Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
796  Spi->CcMdlReadWaitMiss = 0; /* FIXME */
797  Spi->CcReadAheadIos = 0; /* FIXME */
801  Spi->CcDataPages = CcDataPages;
802 
803  Spi->ContextSwitches = 0;
804  Spi->FirstLevelTbFills = 0;
805  Spi->SecondLevelTbFills = 0;
806  Spi->SystemCalls = 0;
807  for (i = 0; i < KeNumberProcessors; i ++)
808  {
809  Prcb = KiProcessorBlock[i];
810  if (Prcb)
811  {
813  Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
814  Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
815  Spi->SystemCalls += Prcb->KeSystemCalls;
816  }
817  }
818 
819  return STATUS_SUCCESS;
820 }
ULONG CcLazyWriteIos
Definition: lazywrite.c:21
ULONG KeMaximumIncrement
Definition: clock.c:20
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:30
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
LONG IoWriteOperationCount
Definition: ketypes.h:666
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
#define MC_USER
Definition: mm.h:114
ULONG CcDataFlushes
Definition: copy.c:44
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:669
ULONG CcLazyWritePages
Definition: lazywrite.c:20
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _SYSTEM_PERFORMANCE_INFORMATION * PSYSTEM_PERFORMANCE_INFORMATION
LARGE_INTEGER IoWriteTransferCount
Definition: memtest.h:13
PFN_NUMBER MmAvailablePages
Definition: freelist.c:26
ULONG IoWriteOperationCount
Definition: iomgr.c:41
ULONG IoReadOperationCount
Definition: iomgr.c:39
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
long LONG
Definition: pedump.c:60
LARGE_INTEGER IdleProcessTime
Definition: memtest.h:11
LONG IoReadOperationCount
Definition: ketypes.h:665
ULONG CcMapDataWait
Definition: pin.c:28
SIZE_T MmPeakCommitment
Definition: freelist.c:35
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
Definition: bufpool.h:45
SIZE_T MmTotalCommittedPages
Definition: freelist.c:30
ULONG CcDataPages
Definition: copy.c:43
ULONG CcPinReadNoWait
Definition: pin.c:31
ULONG KeSystemCalls
Definition: ketypes.h:652
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:670
#define KeGetContextSwitches(Prcb)
Definition: ke.h:216
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
LONG IoOtherOperationCount
Definition: ketypes.h:667
ULONG CcMapDataNoWait
Definition: pin.c:29
VOID NTAPI ExQueryPoolUsage(OUT PULONG PagedPoolPages, OUT PULONG NonPagedPoolPages, OUT PULONG PagedPoolAllocs, OUT PULONG PagedPoolFrees, OUT PULONG PagedPoolLookasideHits, OUT PULONG NonPagedPoolAllocs, OUT PULONG NonPagedPoolFrees, OUT PULONG NonPagedPoolLookasideHits)
Definition: expool.c:1765
KPROCESS Pcb
Definition: pstypes.h:1262
ULONG CcPinMappedDataCount
Definition: pin.c:32
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:668
LARGE_INTEGER IoReadTransferCount
Definition: memtest.h:12
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:69
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
ULONG CcPinReadWait
Definition: pin.c:30
LARGE_INTEGER IoOtherTransferCount
Definition: memtest.h:14
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:66
unsigned int ULONG
Definition: retypes.h:1
ULONG PagesUsed
Definition: mm.h:457
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG IoOtherOperationCount
Definition: iomgr.c:43
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
LONGLONG QuadPart
Definition: typedefs.h:114

◆ QSI_DEF() [4/55]

Definition at line 823 of file sysinfo.c.

824 {
826  LARGE_INTEGER CurrentTime;
827 
828  /* Set amount of written information to 0 */
829  *ReqSize = 0;
830 
831  /* Check user buffer's size */
832  if (Size > sizeof(SYSTEM_TIMEOFDAY_INFORMATION))
833  {
835  }
836 
837  /* Get current time */
838  KeQuerySystemTime(&CurrentTime);
839 
840  /* Zero local buffer */
842 
843  /* Fill local time structure */
844  Sti.BootTime= KeBootTime;
845  Sti.CurrentTime = CurrentTime;
848  Sti.Reserved = 0;
849 
850  /* Copy as much as requested by caller */
851  RtlCopyMemory(Buffer, &Sti, Size);
852 
853  /* Set amount of information we copied */
854  *ReqSize = Size;
855 
856  return STATUS_SUCCESS;
857 }
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
LARGE_INTEGER KeBootTime
Definition: clock.c:17
LARGE_INTEGER CurrentTime
Definition: extypes.h:850
LARGE_INTEGER ExpTimeZoneBias
Definition: time.c:23
Definition: bufpool.h:45
ULONG ExpTimeZoneId
Definition: time.c:25
LARGE_INTEGER TimeZoneBias
Definition: extypes.h:851
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define STATUS_SUCCESS
Definition: shellext.h:65
LONGLONG QuadPart
Definition: typedefs.h:114

◆ QSI_DEF() [5/55]

QSI_DEF ( SystemPathInformation  )

Definition at line 860 of file sysinfo.c.

861 {
862  /*
863  * Since NT 3.51, this information class is trivially implemented.
864  * The path to the NT directory is now stored in KUSER_SHARED_DATA
865  * as the NtSystemRoot member.
866  * Windows Checked builds show the following message and break to
867  * the debugger before failing the function as not implemented.
868  */
869 #if DBG
870  DPRINT1("EX: SystemPathInformation now available via SharedUserData\n");
871  // DbgBreakPoint(); // Not needed in ReactOS.
872 #endif
873  return STATUS_NOT_IMPLEMENTED;
874 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [6/55]

QSI_DEF ( SystemProcessInformation  )

Definition at line 877 of file sysinfo.c.

878 {
879  PSYSTEM_PROCESS_INFORMATION SpiCurrent;
881  PEPROCESS Process = NULL, SystemProcess;
882  PETHREAD CurrentThread;
884  ULONG CurrentSize;
885  USHORT ImageNameMaximumLength; // image name length in bytes
886  USHORT ImageNameLength;
887  PLIST_ENTRY CurrentEntry;
888  ULONG TotalSize = 0, ThreadsCount;
889  ULONG TotalUser, TotalKernel;
890  PUCHAR Current;
892  PUNICODE_STRING TempProcessImageName;
893  _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
894  PWCHAR szSrc;
895  BOOLEAN Overflow = FALSE;
896 
897  _SEH2_TRY
898  {
899  /* scan the process list */
900 
903 
904  *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
905 
906  /* Check for overflow */
907  if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
908  {
909  Overflow = TRUE;
910  }
911 
912  /* Zero user's buffer */
913  if (!Overflow) RtlZeroMemory(Spi, Size);
914 
915  SystemProcess = PsIdleProcess;
916  Process = SystemProcess;
917  Current = (PUCHAR) Spi;
918 
919  do
920  {
921  SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
922 
923  /* Lock the Process */
925  ExAcquirePushLockShared(&Process->ProcessLock);
926 
927  if ((Process->ProcessExiting) &&
928  (Process->Pcb.Header.SignalState) &&
929  !(Process->ActiveThreads) &&
930  (IsListEmpty(&Process->Pcb.ThreadListHead)))
931  {
932  DPRINT1("Process %p (%s:%p) is a zombie\n",
933  Process, Process->ImageFileName, Process->UniqueProcessId);
934  CurrentSize = 0;
935  ImageNameMaximumLength = 0;
936 
937  /* Unlock the Process */
938  ExReleasePushLockShared(&Process->ProcessLock);
940  goto Skip;
941  }
942 
943  ThreadsCount = 0;
944  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
945  while (CurrentEntry != &Process->Pcb.ThreadListHead)
946  {
947  ThreadsCount++;
948  CurrentEntry = CurrentEntry->Flink;
949  }
950 
951  // size of the structure for every process
952  CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
953  ImageNameLength = 0;
954  Status = SeLocateProcessImageName(Process, &TempProcessImageName);
955  ProcessImageName = TempProcessImageName;
956  szSrc = NULL;
957  if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
958  {
959  szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
960  /* Loop the file name*/
961  while (szSrc > ProcessImageName->Buffer)
962  {
963  /* Make sure this isn't a backslash */
964  if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
965  {
966  szSrc++;
967  break;
968  }
969  else
970  {
971  ImageNameLength += sizeof(WCHAR);
972  }
973  }
974  }
975  if (!ImageNameLength && Process != PsIdleProcess)
976  {
977  ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
978  }
979 
980  /* Round up the image name length as NT does */
981  if (ImageNameLength > 0)
982  ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
983  else
984  ImageNameMaximumLength = 0;
985 
986  TotalSize += CurrentSize + ImageNameMaximumLength;
987 
988  /* Check for overflow */
989  if (TotalSize > Size)
990  {
991  Overflow = TRUE;
992  }
993 
994  /* Fill system information */
995  if (!Overflow)
996  {
997  SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
998  SpiCurrent->NumberOfThreads = ThreadsCount;
999  SpiCurrent->CreateTime = Process->CreateTime;
1000  SpiCurrent->ImageName.Length = ImageNameLength;
1001  SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
1002  SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
1003 
1004  /* Copy name to the end of the struct */
1005  if(Process != PsIdleProcess)
1006  {
1007  if (szSrc)
1008  {
1009  RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1010  }
1011  else
1012  {
1013  RtlInitAnsiString(&ImageName, Process->ImageFileName);
1015  if (!NT_SUCCESS(Status))
1016  {
1017  SpiCurrent->ImageName.Length = 0;
1018  }
1019  }
1020  }
1021  else
1022  {
1023  RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1024  }
1025 
1026  SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1027  SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1028  SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1029 
1030  /* PsIdleProcess shares its handle table with PsInitialSystemProcess,
1031  * so return the handle count for System only, not Idle one. */
1033 
1034  SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1035  SpiCurrent->VirtualSize = Process->VirtualSize;
1036  SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1037  SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1038  SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1039  SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[PsPagedPool];
1040  SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[PsPagedPool];
1041  SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[PsNonPagedPool];
1042  SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[PsNonPagedPool];
1043  SpiCurrent->PagefileUsage = Process->QuotaUsage[PsPageFile];
1044  SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[PsPageFile];
1045  SpiCurrent->PrivatePageCount = Process->CommitCharge;
1046  ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1047 
1048  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1049  while (CurrentEntry != &Process->Pcb.ThreadListHead)
1050  {
1051  CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1052 
1053  ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1054  ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1055  ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1056  ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1057  ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1058  ThreadInfo->ClientId = CurrentThread->Cid;
1059  ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1060  ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1061  ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1062  ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1063  ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1064 
1065  ThreadInfo++;
1066  CurrentEntry = CurrentEntry->Flink;
1067  }
1068 
1069  /* Query total user/kernel times of a process */
1070  TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1071  SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1072  SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1073  }
1074 
1075  if (ProcessImageName)
1076  {
1077  /* Release the memory allocated by SeLocateProcessImageName */
1078  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1079  ProcessImageName = NULL;
1080  }
1081 
1082  /* Unlock the Process */
1083  ExReleasePushLockShared(&Process->ProcessLock);
1085 
1086  /* Handle idle process entry */
1087 Skip:
1088  if (Process == PsIdleProcess) Process = NULL;
1089 
1091  ThreadsCount = 0;
1092  if ((Process == SystemProcess) || (Process == NULL))
1093  {
1094  if (!Overflow)
1095  SpiCurrent->NextEntryOffset = 0;
1096  break;
1097  }
1098  else
1099  Current += CurrentSize + ImageNameMaximumLength;
1100  } while ((Process != SystemProcess) && (Process != NULL));
1101 
1102  if(Process != NULL)
1105  }
1107  {
1108  if(Process != NULL)
1110  if (ProcessImageName)
1111  {
1112  /* Release the memory allocated by SeLocateProcessImageName */
1113  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1114  }
1115 
1117  }
1118  _SEH2_END
1119 
1120  if (Overflow)
1122 
1123  *ReqSize = TotalSize;
1124  return Status;
1125 }
_SEH2_TRY
Definition: create.c:4226
signed char * PCHAR
Definition: retypes.h:7
ULONG KeMaximumIncrement
Definition: clock.c:20
NTSTATUS NTAPI SeLocateProcessImageName(_In_ PEPROCESS Process, _Out_ PUNICODE_STRING *ProcessImageName)
Finds the process image name of a specific process.
Definition: audit.c:199
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1158
#define ROUND_UP(n, align)
Definition: eventvwr.h:34
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
USHORT MaximumLength
Definition: env_spec_w32.h:370
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
LARGE_INTEGER CreateTime
Definition: pstypes.h:1104
LONG NTSTATUS
Definition: precomp.h:26
KTHREAD Tcb
Definition: pstypes.h:1103
SCHAR Priority
Definition: ketypes.h:1722
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _ThreadInfo ThreadInfo
uint16_t * PWCHAR
Definition: typedefs.h:56
_SEH2_END
Definition: create.c:4400
LARGE_INTEGER CreateTime
Definition: extypes.h:891
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1155
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
#define FALSE
Definition: types.h:117
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:56
unsigned char BOOLEAN
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
UCHAR WaitReason
Definition: ketypes.h:1904
CHAR BasePriority
Definition: ketypes.h:1857
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
ULONG KernelTime
Definition: ketypes.h:1927
struct _SYSTEM_THREAD_INFORMATION * PSYSTEM_THREAD_INFORMATION
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
CLIENT_ID Cid
Definition: pstypes.h:1128
struct _SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION
#define ObDereferenceObject
Definition: obfuncs.h:203
UNICODE_STRING ImageName
Definition: extypes.h:894
static const char * ImageName
Definition: image.c:34
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:897
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
Definition: typedefs.h:119
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1104
#define _SEH2_VOLATILE
Definition: pseh2_64.h:169
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
LARGE_INTEGER KernelTime
Definition: extypes.h:893
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:860
#define NULL
Definition: types.h:112
#define DPRINT1
Definition: precomp.h:8
ULONG UserTime
Definition: ketypes.h:1943
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:219
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1212
volatile UCHAR State
Definition: ketypes.h:1729
unsigned int ULONG
Definition: retypes.h:1
ULONG ContextSwitches
Definition: ketypes.h:1728
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
LARGE_INTEGER UserTime
Definition: extypes.h:892
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
ULONG WaitTime
Definition: ketypes.h:1815
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define TAG_SEPA
Definition: tag.h:156
#define STATUS_SUCCESS
Definition: shellext.h:65
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:165
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
LONGLONG QuadPart
Definition: typedefs.h:114

◆ QSI_DEF() [7/55]

Definition at line 1128 of file sysinfo.c.

1129 {
1130  /* FIXME */
1131  DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1132  return STATUS_NOT_IMPLEMENTED;
1133 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [8/55]

QSI_DEF ( SystemDeviceInformation  )

Definition at line 1136 of file sysinfo.c.

1137 {
1140  PCONFIGURATION_INFORMATION ConfigInfo;
1141 
1142  *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1143 
1144  /* Check user buffer's size */
1145  if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1146  {
1148  }
1149 
1150  ConfigInfo = IoGetConfigurationInformation();
1151 
1152  Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1153  Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1154  Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1155  Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1156  Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1157  Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1158 
1159  return STATUS_SUCCESS;
1160 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
Definition: bufpool.h:45
struct _SYSTEM_DEVICE_INFORMATION * PSYSTEM_DEVICE_INFORMATION
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _SYSTEM_DEVICE_INFORMATION SYSTEM_DEVICE_INFORMATION

◆ QSI_DEF() [9/55]

Definition at line 1163 of file sysinfo.c.

1164 {
1167 
1168  LONG i;
1169  ULONG TotalTime;
1170  PKPRCB Prcb;
1171 
1173 
1174  /* Check user buffer's size */
1175  if (Size < *ReqSize)
1176  {
1178  }
1179 
1180  for (i = 0; i < KeNumberProcessors; i++)
1181  {
1182  /* Get the PRCB on this processor */
1183  Prcb = KiProcessorBlock[i];
1184 
1185  /* Calculate total user and kernel times */
1186  TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1192  Spi->InterruptCount = Prcb->InterruptCount;
1193  Spi++;
1194  }
1195 
1196  return STATUS_SUCCESS;
1197 }
ULONG KeMaximumIncrement
Definition: clock.c:20
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG InterruptTime
Definition: ketypes.h:741
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG DpcTime
Definition: ketypes.h:740
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
long LONG
Definition: pedump.c:60
Definition: bufpool.h:45
ULONG KernelTime
Definition: ketypes.h:738
ULONG InterruptCount
Definition: ketypes.h:737
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION * PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
ULONG UserTime
Definition: ketypes.h:739
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
struct _KTHREAD * IdleThread
Definition: ketypes.h:573
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
#define UInt32x32To64(a, b)
Definition: intsafe.h:252
LONGLONG QuadPart
Definition: typedefs.h:114

◆ QSI_DEF() [10/55]

QSI_DEF ( SystemFlagsInformation  )

Definition at line 1200 of file sysinfo.c.

1201 {
1202 #if (NTDDI_VERSION >= NTDDI_VISTA)
1203  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1204 #endif
1205 
1206  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1207  {
1209  }
1210 
1212 #if (NTDDI_VERSION < NTDDI_VISTA)
1213  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1214 #endif
1215 
1216  return STATUS_SUCCESS;
1217 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _SYSTEM_FLAGS_INFORMATION SYSTEM_FLAGS_INFORMATION
struct _SYSTEM_FLAGS_INFORMATION * PSYSTEM_FLAGS_INFORMATION
Definition: bufpool.h:45
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG NtGlobalFlag
Definition: init.c:54

◆ QSI_DEF() [11/55]

Definition at line 1240 of file sysinfo.c.

1241 {
1242  /* FIXME */
1243  DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1244  return STATUS_NOT_IMPLEMENTED;
1245 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [12/55]

QSI_DEF ( SystemModuleInformation  )

Definition at line 1248 of file sysinfo.c.

1249 {
1250  NTSTATUS Status;
1251 
1252  /* Acquire system module list lock */
1255 
1256  /* Call the generic handler with the system module list */
1260  Size,
1261  ReqSize);
1262 
1263  /* Release list lock and return status */
1266  return Status;
1267 }
NTSTATUS NTAPI ExpQueryModuleInformation(IN PLIST_ENTRY KernelModeList, IN PLIST_ENTRY UserModeList, OUT PRTL_PROCESS_MODULES Modules, IN ULONG Length, OUT PULONG ReturnLength)
Definition: sysinfo.c:91
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ERESOURCE PsLoadedModuleResource
Definition: sysldr.c:24
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:22
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119

◆ QSI_DEF() [13/55]

QSI_DEF ( SystemLocksInformation  )

Definition at line 1270 of file sysinfo.c.

1271 {
1272  /* FIXME */
1273  DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1274  return STATUS_NOT_IMPLEMENTED;
1275 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [14/55]

Definition at line 1278 of file sysinfo.c.

1279 {
1280  /* FIXME */
1281  DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1282  return STATUS_NOT_IMPLEMENTED;
1283 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [15/55]

Definition at line 1286 of file sysinfo.c.

1287 {
1288  /* FIXME */
1289  DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1290  return STATUS_NOT_IMPLEMENTED;
1291 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [16/55]

Definition at line 1294 of file sysinfo.c.

1295 {
1296  /* FIXME */
1297  DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1298  return STATUS_NOT_IMPLEMENTED;
1299 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [17/55]

QSI_DEF ( SystemHandleInformation  )

Definition at line 1302 of file sysinfo.c.

1303 {
1305  PLIST_ENTRY NextTableEntry;
1307  PHANDLE_TABLE_ENTRY HandleTableEntry;
1308  EXHANDLE Handle;
1309  ULONG Index = 0;
1310  NTSTATUS Status;
1311  PMDL Mdl;
1312  PAGED_CODE();
1313 
1314  DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1315 
1316  /* Set initial required buffer size */
1317  *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1318 
1319  /* Check user's buffer size */
1320  if (Size < *ReqSize)
1321  {
1323  }
1324 
1325  /* We need to lock down the memory */
1327  Size,
1329  IoWriteAccess,
1331  &Mdl);
1332  if (!NT_SUCCESS(Status))
1333  {
1334  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1335  return Status;
1336  }
1337 
1338  /* Reset of count of handles */
1339  HandleInformation->NumberOfHandles = 0;
1340 
1341  /* Enter a critical region */
1343 
1344  /* Acquire the handle table lock */
1346 
1347  /* Enumerate all system handles */
1348  for (NextTableEntry = HandleTableListHead.Flink;
1349  NextTableEntry != &HandleTableListHead;
1350  NextTableEntry = NextTableEntry->Flink)
1351  {
1352  /* Get current handle table */
1353  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1354 
1355  /* Set the initial value and loop the entries */
1356  Handle.Value = 0;
1357  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1358  {
1359  /* Validate the entry */
1360  if ((HandleTableEntry->Object) &&
1361  (HandleTableEntry->NextFreeTableEntry != -2))
1362  {
1363  /* Increase of count of handles */
1364  ++HandleInformation->NumberOfHandles;
1365 
1366  /* Lock the entry */
1367  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1368  {
1369  /* Increase required buffer size */
1370  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1371 
1372  /* Check user's buffer size */
1373  if (*ReqSize > Size)
1374  {
1376  }
1377  else
1378  {
1379  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1380 
1381  /* Filling handle information */
1382  HandleInformation->Handles[Index].UniqueProcessId =
1383  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1384 
1385  HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1386 
1387 #if 0 /* FIXME!!! Type field currupted */
1388  HandleInformation->Handles[Index].ObjectTypeIndex =
1389  (UCHAR) ObjectHeader->Type->Index;
1390 #else
1391  HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1392 #endif
1393 
1394  HandleInformation->Handles[Index].HandleAttributes =
1395  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1396 
1397  HandleInformation->Handles[Index].HandleValue =
1398  (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1399 
1400  HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1401 
1402  HandleInformation->Handles[Index].GrantedAccess =
1403  HandleTableEntry->GrantedAccess;
1404 
1405  ++Index;
1406  }
1407 
1408  /* Unlock it */
1409  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1410  }
1411  }
1412 
1413  /* Go to the next entry */
1414  Handle.Value += sizeof(HANDLE);
1415  }
1416  }
1417 
1418  /* Release the lock */
1420 
1421  /* Leave the critical region */
1423 
1424  /* Release the locked user buffer */
1426 
1427  return Status;
1428 }
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:43
ULONG Index
Definition: obtypes.h:385
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG_PTR ObAttributes
Definition: extypes.h:600
LONG NTSTATUS
Definition: precomp.h:26
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:923
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:202
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: extypes.h:595
#define ObpGetHandleObject(x)
Definition: ob.h:91
Definition: bufpool.h:45
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Status
Definition: gdiplustypes.h:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LIST_ENTRY HandleTableListHead
Definition: handle.c:18
_In_ WDFCOLLECTION _In_ ULONG Index
ULONG GrantedAccess
Definition: extypes.h:606
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:884
PVOID HANDLE
Definition: typedefs.h:73
_In_ ACCESS_MASK _In_opt_ POBJECT_TYPE _In_ KPROCESSOR_MODE _Out_ PVOID _Out_opt_ POBJECT_HANDLE_INFORMATION HandleInformation
Definition: obfuncs.h:40
unsigned char UCHAR
Definition: xmlstorage.h:181
Definition: ex.h:85
#define KeEnterCriticalRegion()
Definition: ke_x.h:88
Definition: typedefs.h:119
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1104
#define KeLeaveCriticalRegion()
Definition: ke_x.h:119
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
LONG NextFreeTableEntry
Definition: extypes.h:612
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define DPRINT1
Definition: precomp.h:8
_In_ HANDLE Handle
Definition: extypes.h:390
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1212
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
PVOID Object
Definition: extypes.h:599
struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO SYSTEM_HANDLE_TABLE_ENTRY_INFO
#define DPRINT
Definition: sndvol32.h:71
POBJECT_TYPE Type
Definition: obtypes.h:493
#define OBJ_HANDLE_ATTRIBUTES
Definition: ob.h:52
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19
#define PAGED_CODE()

◆ QSI_DEF() [18/55]

QSI_DEF ( SystemObjectInformation  )

Definition at line 1431 of file sysinfo.c.

1432 {
1433  /* FIXME */
1434  DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1435  return STATUS_NOT_IMPLEMENTED;
1436 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [19/55]

Definition at line 1439 of file sysinfo.c.

1440 {
1441  UNICODE_STRING FileName; /* FIXME */
1443 
1444  if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1445  {
1446  * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1448  }
1449 
1450  RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1451 
1452  /* FIXME */
1453  Spfi->NextEntryOffset = 0;
1454 
1456  Spfi->TotalInUse = MiUsedSwapPages;
1457  Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1458  Spfi->PageFileName = FileName;
1459  return STATUS_SUCCESS;
1460 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
UNICODE_STRING PageFileName
Definition: extypes.h:1067
Definition: bufpool.h:45
struct _SYSTEM_PAGEFILE_INFORMATION SYSTEM_PAGEFILE_INFORMATION
struct _FileName FileName
Definition: fatprocs.h:893
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:69
#define NULL
Definition: types.h:112
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:66
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [20/55]

Definition at line 1463 of file sysinfo.c.

1464 {
1465  /* FIXME */
1466  DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1467  return STATUS_NOT_IMPLEMENTED;
1468 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [21/55]

QSI_DEF ( SystemVdmBopInformation  )

Definition at line 1471 of file sysinfo.c.

1472 {
1473  /* FIXME */
1474  DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1475  return STATUS_NOT_IMPLEMENTED;
1476 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [22/55]

Definition at line 1479 of file sysinfo.c.

1480 {
1482 
1483  *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1484 
1485  if (Size < *ReqSize)
1486  {
1488  }
1489 
1491 
1492  /* Return the Byte size not the page size. */
1493  Sci->CurrentSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1494  Sci->PeakSize = MiMemoryConsumers[MC_USER].PagesUsed; /* FIXME */
1495  /* Taskmgr multiplies this one by page size right away */
1497  /* system working set and standby pages. */
1498  Sci->PageFaultCount = 0; /* FIXME */
1499  Sci->MinimumWorkingSet = 0; /* FIXME */
1500  Sci->MaximumWorkingSet = 0; /* FIXME */
1501 
1502  return STATUS_SUCCESS;
1503 }
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:30
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define MC_USER
Definition: mm.h:114
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1119
Definition: bufpool.h:45
struct _SYSTEM_FILECACHE_INFORMATION SYSTEM_FILECACHE_INFORMATION
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
ULONG PagesUsed
Definition: mm.h:457
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [23/55]

QSI_DEF ( SystemPoolTagInformation  )

Definition at line 1517 of file sysinfo.c.

1518 {
1520  return ExGetPoolTagInfo(Buffer, Size, ReqSize);
1521 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
NTSTATUS NTAPI ExGetPoolTagInfo(IN PSYSTEM_POOLTAG_INFORMATION SystemInformation, IN ULONG SystemInformationLength, IN OUT PULONG ReturnLength OPTIONAL)
Definition: expool.c:1353
Definition: bufpool.h:45

◆ QSI_DEF() [24/55]

Definition at line 1524 of file sysinfo.c.

1525 {
1526  PKPRCB Prcb;
1527  LONG i;
1528  ULONG ti;
1530 
1532  {
1534  }
1535 
1536  ti = KeQueryTimeIncrement();
1537 
1538  for (i = 0; i < KeNumberProcessors; i++)
1539  {
1540  Prcb = KiProcessorBlock[i];
1542  sii->DpcCount = Prcb->DpcData[0].DpcCount;
1543  sii->DpcRate = Prcb->DpcRequestRate;
1544  sii->TimeIncrement = ti;
1545  sii->DpcBypassCount = 0;
1546  sii->ApcBypassCount = 0;
1547  sii++;
1548  }
1549 
1550  return STATUS_SUCCESS;
1551 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
KDPC_DATA DpcData[2]
Definition: ketypes.h:681
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
long LONG
Definition: pedump.c:60
Definition: bufpool.h:45
ULONG DpcCount
Definition: ketypes.h:800
#define KeGetContextSwitches(Prcb)
Definition: ke.h:216
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
struct _SYSTEM_INTERRUPT_INFORMATION * PSYSTEM_INTERRUPT_INFORMATION
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
ULONG DpcRequestRate
Definition: ketypes.h:689

◆ QSI_DEF() [25/55]

Definition at line 1554 of file sysinfo.c.

1555 {
1557 
1558  if (Size < sizeof(SYSTEM_DPC_BEHAVIOR_INFORMATION))
1559  {
1561  }
1562 
1566  sdbi->IdealDpcRate = KiIdealDpcRate;
1567 
1568  return STATUS_SUCCESS;
1569 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
ULONG KiIdealDpcRate
Definition: dpc.c:22
Definition: bufpool.h:45
ULONG KiMinimumDpcRate
Definition: dpc.c:20
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
#define STATUS_SUCCESS
Definition: shellext.h:65
struct _SYSTEM_DPC_BEHAVIOR_INFORMATION * PSYSTEM_DPC_BEHAVIOR_INFORMATION

◆ QSI_DEF() [26/55]

Definition at line 1579 of file sysinfo.c.

1580 {
1581  PULONG Spi = (PULONG) Buffer;
1582 
1584 
1585  *ReqSize = sizeof(ULONG);
1586 
1587  if (sizeof(ULONG) != Size)
1588  {
1590  }
1591 
1592  DPRINT("SystemFullMemoryInformation\n");
1593 
1595 
1596  DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1600  MiUsedSwapPages);
1601 
1603 
1604  return STATUS_SUCCESS;
1605 }
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:30
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define MC_USER
Definition: mm.h:114
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
HANDLE UniqueProcessId
Definition: pstypes.h:1267
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
Definition: bufpool.h:45
KPROCESS Pcb
Definition: pstypes.h:1262
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:69
unsigned int * PULONG
Definition: retypes.h:1
ULONG KernelTime
Definition: ketypes.h:2042
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:66
unsigned int ULONG
Definition: retypes.h:1
ULONG PagesUsed
Definition: mm.h:457
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71

◆ QSI_DEF() [27/55]

Definition at line 1682 of file sysinfo.c.

1683 {
1686 
1687  /* Check if enough storage was provided */
1689  {
1690  * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1692  }
1693 
1694  /* Give time values to our caller */
1695  TimeInfo->TimeIncrement = KeMaximumIncrement;
1696  TimeInfo->TimeAdjustment = KeTimeAdjustment;
1697  TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1698 
1699  return STATUS_SUCCESS;
1700 }
ULONG KeMaximumIncrement
Definition: clock.c:20
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION * PSYSTEM_QUERY_TIME_ADJUST_INFORMATION
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
BOOLEAN KiTimeAdjustmentEnabled
Definition: time.c:19
ULONG KeTimeAdjustment
Definition: time.c:18
Definition: bufpool.h:45
struct _SYSTEM_QUERY_TIME_ADJUST_INFORMATION SYSTEM_QUERY_TIME_ADJUST_INFORMATION
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [28/55]

Definition at line 1743 of file sysinfo.c.

1744 {
1745  /* FIXME */
1746  DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1747  return STATUS_NOT_IMPLEMENTED;
1748 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [29/55]

Definition at line 1751 of file sysinfo.c.

1752 {
1753  /* FIXME */
1754  DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1755  return STATUS_NOT_IMPLEMENTED;
1756 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [30/55]

Definition at line 1759 of file sysinfo.c.

1760 {
1761  /* FIXME */
1762  DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1763  return STATUS_NOT_IMPLEMENTED;
1764 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [31/55]

Definition at line 1767 of file sysinfo.c.

1768 {
1769  /* FIXME */
1770  DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1771  return STATUS_NOT_IMPLEMENTED;
1772 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [32/55]

Definition at line 1775 of file sysinfo.c.

1776 {
1777  PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1779  PKPRCB Prcb;
1780  ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1781  ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1782  CHAR i;
1783 
1784  /* Check size of a buffer, it must match our expectations */
1785  if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1787 
1788  /* Sum up exception count information from all processors */
1789  for (i = 0; i < KeNumberProcessors; i++)
1790  {
1791  Prcb = KiProcessorBlock[i];
1792  if (Prcb)
1793  {
1794  AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1795  ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1796 #ifndef _M_ARM
1797  FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1798 #endif // _M_ARM
1799  }
1800  }
1801 
1802  /* Save information in user's buffer */
1803  ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1804  ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1805  ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1806  ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1807 
1808  return STATUS_SUCCESS;
1809 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
char CHAR
Definition: xmlstorage.h:175
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
ULONG KeAlignmentFixupCount
Definition: ketypes.h:801
Definition: bufpool.h:45
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
struct _SYSTEM_EXCEPTION_INFORMATION * PSYSTEM_EXCEPTION_INFORMATION
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
ULONG KeExceptionDispatchCount
Definition: ketypes.h:706
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [33/55]

Definition at line 1812 of file sysinfo.c.

1813 {
1814  /* FIXME */
1815  DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1816  return STATUS_NOT_IMPLEMENTED;
1817 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [34/55]

Definition at line 1820 of file sysinfo.c.

1821 {
1823 
1824 #if (NTDDI_VERSION >= NTDDI_VISTA)
1825  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1826 #endif
1827 
1829  {
1831  }
1832 
1835 
1836 #if (NTDDI_VERSION < NTDDI_VISTA)
1837  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1838 #endif
1839 
1840  return STATUS_SUCCESS;
1841 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define KD_DEBUGGER_NOT_PRESENT
Definition: kdfuncs.h:133
Definition: bufpool.h:45
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION * PSYSTEM_KERNEL_DEBUGGER_INFORMATION
#define KD_DEBUGGER_ENABLED
Definition: kdfuncs.h:130
struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION SYSTEM_KERNEL_DEBUGGER_INFORMATION
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [35/55]

Definition at line 1844 of file sysinfo.c.

1845 {
1846  PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1848  ULONG ContextSwitches;
1849  PKPRCB Prcb;
1850  CHAR i;
1851 
1852  /* Check size of a buffer, it must match our expectations */
1853  if (sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION) != Size)
1855 
1856  /* Calculate total value of context switches across all processors */
1857  ContextSwitches = 0;
1858  for (i = 0; i < KeNumberProcessors; i ++)
1859  {
1860  Prcb = KiProcessorBlock[i];
1861  if (Prcb)
1862  {
1863  ContextSwitches += KeGetContextSwitches(Prcb);
1864  }
1865  }
1866 
1867  ContextSwitchInformation->ContextSwitches = ContextSwitches;
1868 
1869  /* FIXME */
1870  ContextSwitchInformation->FindAny = 0;
1871  ContextSwitchInformation->FindLast = 0;
1872  ContextSwitchInformation->FindIdeal = 0;
1873  ContextSwitchInformation->IdleAny = 0;
1874  ContextSwitchInformation->IdleCurrent = 0;
1875  ContextSwitchInformation->IdleLast = 0;
1876  ContextSwitchInformation->IdleIdeal = 0;
1877  ContextSwitchInformation->PreemptAny = 0;
1878  ContextSwitchInformation->PreemptCurrent = 0;
1879  ContextSwitchInformation->PreemptLast = 0;
1880  ContextSwitchInformation->SwitchToIdle = 0;
1881 
1882  return STATUS_SUCCESS;
1883 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
char CHAR
Definition: xmlstorage.h:175
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
Definition: bufpool.h:45
struct _SYSTEM_CONTEXT_SWITCH_INFORMATION * PSYSTEM_CONTEXT_SWITCH_INFORMATION
#define KeGetContextSwitches(Prcb)
Definition: ke.h:216
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [36/55]

Definition at line 1886 of file sysinfo.c.

1887 {
1889 
1890  *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1892  {
1894  }
1895 
1896  DPRINT1("Faking max registry size of 32 MB\n");
1897  srqi->RegistryQuotaAllowed = 0x2000000;
1898  srqi->RegistryQuotaUsed = 0x200000;
1899  srqi->PagedPoolSize = 0x200000;
1900 
1901  return STATUS_SUCCESS;
1902 }
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION SYSTEM_REGISTRY_QUOTA_INFORMATION
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION * PSYSTEM_REGISTRY_QUOTA_INFORMATION
Definition: bufpool.h:45
#define DPRINT1
Definition: precomp.h:8
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [37/55]

QSI_DEF ( SystemVerifierAddDriverInformation  )

Definition at line 2027 of file sysinfo.c.

2028 {
2029  /* FIXME */
2030  DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2031  return STATUS_NOT_IMPLEMENTED;
2032 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [38/55]

QSI_DEF ( SystemVerifierRemoveDriverInformation  )

Definition at line 2035 of file sysinfo.c.

2036 {
2037  /* FIXME */
2038  DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2039  return STATUS_NOT_IMPLEMENTED;
2040 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [39/55]

QSI_DEF ( SystemProcessorIdleInformation  )

Definition at line 2043 of file sysinfo.c.

2044 {
2045  *ReqSize = sizeof(PROCESSOR_POWER_INFORMATION) * KeNumberProcessors;
2046 
2048  {
2050  }
2051 
2052  /* FIXME */
2053  DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2054  return STATUS_NOT_IMPLEMENTED;
2055 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
return STATUS_NOT_IMPLEMENTED
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [40/55]

QSI_DEF ( SystemLegacyDriverInformation  )

Definition at line 2058 of file sysinfo.c.

2059 {
2060  /* FIXME */
2061  DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2062  return STATUS_NOT_IMPLEMENTED;
2063 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [41/55]

Definition at line 2066 of file sysinfo.c.

2067 {
2068  *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2069 
2070  if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2071  {
2073  }
2074 
2075  /* Copy the time zone information struct */
2076  memcpy(Buffer,
2077  &ExpTimeZoneInfo,
2078  sizeof(RTL_TIME_ZONE_INFORMATION));
2079 
2080  return STATUS_SUCCESS;
2081 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
struct _RTL_TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION
Definition: bufpool.h:45
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
Definition: time.c:21
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ QSI_DEF() [42/55]

Definition at line 2151 of file sysinfo.c.

2152 {
2155  PMDL Mdl;
2156  ULONG MaxCount, Remaining;
2157  KIRQL OldIrql;
2158  NTSTATUS Status;
2159 
2160  /* First we need to lock down the memory, since we are going to access it
2161  at high IRQL */
2164  Size,
2165  PreviousMode,
2166  IoWriteAccess,
2167  (PVOID*)&Info,
2168  &Mdl);
2169  if (!NT_SUCCESS(Status))
2170  {
2171  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2172  return Status;
2173  }
2174 
2175  /* Calculate how many items we can store */
2176  Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2177  if (Remaining == 0)
2178  {
2179  goto Leave;
2180  }
2181 
2182  /* Copy info from pool lookaside lists */
2184  &Remaining,
2186  FALSE);
2187  if (Remaining == 0)
2188  {
2189  goto Leave;
2190  }
2191 
2192  /* Copy info from system lookaside lists */
2194  &Remaining,
2196  TRUE);
2197  if (Remaining == 0)
2198  {
2199  goto Leave;
2200  }
2201 
2202  /* Acquire spinlock for ExpNonPagedLookasideListHead */
2204 
2205  /* Copy info from non-paged lookaside lists */
2207  &Remaining,
2209  TRUE);
2210 
2211  /* Release spinlock for ExpNonPagedLookasideListHead */
2213 
2214  if (Remaining == 0)
2215  {
2216  goto Leave;
2217  }
2218 
2219  /* Acquire spinlock for ExpPagedLookasideListHead */
2221 
2222  /* Copy info from paged lookaside lists */
2224  &Remaining,
2226  TRUE);
2227 
2228  /* Release spinlock for ExpPagedLookasideListHead */
2230 
2231 Leave:
2232 
2233  /* Release the locked user buffer */
2235 
2236  /* Return the size of the actually written data */
2237  *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2238  return STATUS_SUCCESS;
2239 }
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:22
#define TRUE
Definition: types.h:120
static VOID ExpCopyLookasideInformation(PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer, PULONG RemainingPointer, PLIST_ENTRY ListHead, BOOLEAN ListUsesMisses)
Definition: sysinfo.c:2096
LONG NTSTATUS
Definition: precomp.h:26
VOID NTAPI KeAcquireSpinLock(PKSPIN_LOCK SpinLock, PKIRQL OldIrql)
Definition: spinlock.c:50
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3062
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:202
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:683
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define FALSE
Definition: types.h:117
Definition: bufpool.h:45
Status
Definition: gdiplustypes.h:24
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
LIST_ENTRY ExpNonPagedLookasideListHead
Definition: lookas.c:17
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:20
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:792
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:18
struct _SYSTEM_LOOKASIDE_INFORMATION SYSTEM_LOOKASIDE_INFORMATION
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:19
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:21

◆ QSI_DEF() [43/55]

QSI_DEF ( SystemSessionInformation  )

Definition at line 2304 of file sysinfo.c.

2305 {
2306  /* FIXME */
2307  DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2308  return STATUS_NOT_IMPLEMENTED;
2309 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [44/55]

Definition at line 2312 of file sysinfo.c.

2313 {
2314  /* Check user buffer's size */
2315  if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2316 
2318 
2319  if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2320 
2321  return STATUS_SUCCESS;
2322 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
uint32_t ULONG_PTR
Definition: typedefs.h:65
Definition: bufpool.h:45
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:65
#define STATUS_SUCCESS
Definition: shellext.h:65
#define MmSystemRangeStart
Definition: mm.h:32

◆ QSI_DEF() [45/55]

Definition at line 2325 of file sysinfo.c.

2326 {
2327  /* FIXME */
2328  DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2329  return STATUS_NOT_IMPLEMENTED;
2330 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [46/55]

Definition at line 2348 of file sysinfo.c.

2349 {
2350  /* FIXME */
2351  DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2352  return STATUS_NOT_IMPLEMENTED;
2353 }
return STATUS_NOT_IMPLEMENTED
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [47/55]

QSI_DEF ( SystemNumaProcessorMap  )

Definition at line 2364 of file sysinfo.c.

2365 {
2366  ULONG MaxEntries, Node;
2368 
2369  /* Validate input size */
2370  if (Size < sizeof(ULONG))
2371  {
2373  }
2374 
2375  /* Return highest node */
2376  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2377 
2378  /* Compute how much entries we will be able to put in output structure */
2379  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask)) / sizeof(ULONGLONG);
2380  /* Make sure we don't overflow KeNodeBlock */
2381  if (MaxEntries > KeNumberNodes)
2382  {
2383  MaxEntries = KeNumberNodes;
2384  }
2385 
2386  /* If we have entries to write, and room for it */
2387  if (Size >= FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) &&
2388  MaxEntries != 0)
2389  {
2390  /* Already set size we return */
2391  *ReqSize = FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, ActiveProcessorsAffinityMask) +
2392  MaxEntries * sizeof(ULONGLONG);
2393 
2394  /* For each node, return processor mask */
2395  for (Node = 0; Node < MaxEntries; ++Node)
2396  {
2398  }
2399  }
2400  else
2401  {
2402  /* We only returned highest node number */
2403  *ReqSize = sizeof(ULONG);
2404  }
2405 
2406  return STATUS_SUCCESS;
2407 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _SYSTEM_NUMA_INFORMATION * PSYSTEM_NUMA_INFORMATION
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
union node Node
Definition: types.h:1255
Definition: bufpool.h:45
uint64_t ULONGLONG
Definition: typedefs.h:67
PKNODE KeNodeBlock[1]
Definition: krnlinit.c:39
UCHAR KeNumberNodes
Definition: krnlinit.c:40
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONGLONG ActiveProcessorsAffinityMask[MAXIMUM_NUMA_NODES]
Definition: extypes.h:1400
unsigned int ULONG
Definition: retypes.h:1
#define STATUS_SUCCESS
Definition: shellext.h:65
KAFFINITY ProcessorMask
Definition: ketypes.h:827