ReactOS  0.4.14-dev-77-gd9e7c48
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   (sizeof(CallQS) / sizeof(CallQS[0]))
 

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 Length, _Out_opt_ PULONG UnsafeResultLength)
 
NTSTATUS NTAPI NtSetSystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass, IN 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   (sizeof(CallQS) / sizeof(CallQS[0]))

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:1062
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:325
struct _KTHREAD * CurrentThread
Definition: ketypes.h:566
ULONG KernelTime
Definition: ketypes.h:733
ULONG UserTime
Definition: ketypes.h:734

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:1062
ULONG KernelTime
Definition: ketypes.h:733
if(!(yy_init))
Definition: macro.lex.yy.c:714
uint64_t ULONGLONG
Definition: typedefs.h:65
ULONG UserTime
Definition: ketypes.h:734
struct _KTHREAD * IdleThread
Definition: ketypes.h:568
unsigned int ULONG
Definition: retypes.h:1

Referenced by NdisGetCurrentProcessorCpuUsage().

◆ ExGetPreviousMode()

KPROCESSOR_MODE NTAPI ExGetPreviousMode ( VOID  )

Definition at line 3066 of file sysinfo.c.

3067 {
3068  /* Just use Ke */
3069  return KeGetPreviousMode();
3070 }
#define KeGetPreviousMode()
Definition: ketypes.h:1107

Referenced by _Function_class_(), _IRQL_requires_max_(), ApphelpCacheAccessCheck(), CreateClientPort(), DbgkMapViewOfSection(), DbgkUnMapViewOfSection(), IKsPin_PinMasterClock(), IopCreateFile(), IopDeviceFsIoControl(), IopGetSetSecurityObject(), IopQueryAttributesFile(), IopUnloadDriver(), KernelModeTest(), KsFastMethodHandler(), KsFastPropertyHandler(), KsInstallBusEnumInterface(), KsReadFile(), KsRemoveBusEnumInterface(), KsStreamIo(), KsWriteFile(), MiQueryMemoryBasicInformation(), MiQueryMemorySectionName(), MmCreateArm3Section(), MmCreateCacheSection(), MmCreateDataFileSection(), MmCreateImageSection(), MmCreatePageFileSection(), MmCreateSection(), NtAccessCheck(), NtAddAtom(), 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(), NtFindAtom(), NtFlushInstructionCache(), NtFlushKey(), NtFlushVirtualMemory(), NtGetContextThread(), NtGetWriteWatch(), 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 PROCESSOR_FEATURE_MAX
#define SharedUserData

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

◆ 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 */
236  *MappedSystemVa = MmGetSystemAddressForMdlSafe(Mdl, NormalPagePriority);
237  if (*MappedSystemVa == NULL)
238  {
239  ExUnlockUserBuffer(Mdl);
241  }
242 
243  /* Return the MDL */
244  *OutMdl = Mdl;
245  return STATUS_SUCCESS;
246 }
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
#define MmGetSystemAddressForMdlSafe(_Mdl, _Priority)
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
_In_ PEPROCESS _In_ KPROCESSOR_MODE AccessMode
Definition: mmfuncs.h:396
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
#define TAG_MDL
Definition: tag.h:86
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
PMDL NTAPI IoAllocateMdl(IN PVOID VirtualAddress, IN ULONG Length, IN BOOLEAN SecondaryBuffer, IN BOOLEAN ChargeQuota, IN PIRP Irp)
Definition: iomdl.c:22
_SEH2_END
Definition: create.c:4424
VOID NTAPI MmProbeAndLockPages(IN PMDL Mdl, IN KPROCESSOR_MODE AccessMode, IN LOCK_OPERATION Operation)
Definition: mdlsup.c:935
_In_ FLT_SET_CONTEXT_OPERATION Operation
Definition: fltkernel.h:1468
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2966

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,
54  ModuleInfo->FullPathName,
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 */
82  ModuleInfo->FullPathName[0] = ANSI_NULL;
83  ModuleInfo->OffsetToFileName = 0;
84  }
85 
86  return Status;
87 }
signed char * PCHAR
Definition: retypes.h:7
ACPI_SIZE Length
Definition: actypes.h:1042
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:1264
#define ANSI_NULL
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI RtlUnicodeStringToAnsiString(PANSI_STRING DestinationString, PUNICODE_STRING SourceString, BOOLEAN AllocateDestinationString)
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
Status
Definition: gdiplustypes.h:24
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:61
unsigned short USHORT
Definition: pedump.c:61
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 2083 of file sysinfo.c.

2089 {
2092  PLIST_ENTRY ListEntry;
2093  ULONG Remaining;
2094 
2095  /* Get info pointer and remaining count of free array element */
2096  Info = *InfoPointer;
2097  Remaining = *RemainingPointer;
2098 
2099  /* Loop as long as we have lookaside lists and free array elements */
2100  for (ListEntry = ListHead->Flink;
2101  (ListEntry != ListHead) && (Remaining > 0);
2102  ListEntry = ListEntry->Flink, Remaining--)
2103  {
2104  LookasideList = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
2105 
2106  /* Fill the next array element */
2107  Info->CurrentDepth = LookasideList->Depth;
2108  Info->MaximumDepth = LookasideList->MaximumDepth;
2109  Info->TotalAllocates = LookasideList->TotalAllocates;
2110  Info->TotalFrees = LookasideList->TotalFrees;
2111  Info->Type = LookasideList->Type;
2112  Info->Tag = LookasideList->Tag;
2113  Info->Size = LookasideList->Size;
2114 
2115  /* Check how the lists track misses/hits */
2116  if (ListUsesMisses)
2117  {
2118  /* Copy misses */
2119  Info->AllocateMisses = LookasideList->AllocateMisses;
2120  Info->FreeMisses = LookasideList->FreeMisses;
2121  }
2122  else
2123  {
2124  /* Calculate misses */
2125  Info->AllocateMisses = LookasideList->TotalAllocates
2126  - LookasideList->AllocateHits;
2127  Info->FreeMisses = LookasideList->TotalFrees
2128  - LookasideList->FreeHits;
2129  }
2130  }
2131 
2132  /* Return the updated pointer and remaining count */
2133  *InfoPointer = Info;
2134  *RemainingPointer = Remaining;
2135 }
struct TraceInfo Info
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
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:119
Definition: typedefs.h:117
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:2551

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:263
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
NTSTATUS NTAPI IoWMIQueryAllData(IN PVOID DataBlockObject, IN OUT ULONG *InOutBufferSize, OUT PVOID OutBuffer)
Definition: wmi.c:155
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
const GUID MSSmBios_RawSMBiosTables_GUID
Definition: hwhacks.c:20
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define BufferSize
Definition: classpnp.h:419
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
Status
Definition: gdiplustypes.h:24
NTSTATUS NTAPI IoWMIOpenBlock(_In_ LPCGUID DataBlockGuid, _In_ ULONG DesiredAccess, _Out_ PVOID *DataBlockObject)
Definition: wmi.c:126
ULONG FixedInstanceSize
Definition: wmistr.h:118
#define WMIGUID_QUERY
Definition: wmistr.h:159
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966

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
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LONG NTSTATUS
Definition: precomp.h:26
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:119
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:1780
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
_In_ ULONG _Out_opt_ PULONG RequiredLength
Definition: wmifuncs.h:29
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 1722 of file expool.c.

1730 {
1731  ULONG i;
1732  PPOOL_DESCRIPTOR PoolDesc;
1733 
1734  //
1735  // Assume all failures
1736  //
1737  *PagedPoolPages = 0;
1738  *PagedPoolAllocs = 0;
1739  *PagedPoolFrees = 0;
1740 
1741  //
1742  // Tally up the totals for all the apged pool
1743  //
1744  for (i = 0; i < ExpNumberOfPagedPools + 1; i++)
1745  {
1746  PoolDesc = ExpPagedPoolDescriptor[i];
1747  *PagedPoolPages += PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1748  *PagedPoolAllocs += PoolDesc->RunningAllocs;
1749  *PagedPoolFrees += PoolDesc->RunningDeAllocs;
1750  }
1751 
1752  //
1753  // The first non-paged pool has a hardcoded well-known descriptor name
1754  //
1755  PoolDesc = &NonPagedPoolDescriptor;
1756  *NonPagedPoolPages = PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1757  *NonPagedPoolAllocs = PoolDesc->RunningAllocs;
1758  *NonPagedPoolFrees = PoolDesc->RunningDeAllocs;
1759 
1760  //
1761  // If the system has more than one non-paged pool, copy the other descriptor
1762  // totals as well
1763  //
1764 #if 0
1765  if (ExpNumberOfNonPagedPools > 1)
1766  {
1767  for (i = 0; i < ExpNumberOfNonPagedPools; i++)
1768  {
1769  PoolDesc = ExpNonPagedPoolDescriptor[i];
1770  *NonPagedPoolPages += PoolDesc->TotalPages + PoolDesc->TotalBigPages;
1771  *NonPagedPoolAllocs += PoolDesc->RunningAllocs;
1772  *NonPagedPoolFrees += PoolDesc->RunningDeAllocs;
1773  }
1774  }
1775 #endif
1776 
1777  //
1778  // Get the amount of hits in the system lookaside lists
1779  //
1781  {
1782  PLIST_ENTRY ListEntry;
1783 
1784  for (ListEntry = ExPoolLookasideListHead.Flink;
1785  ListEntry != &ExPoolLookasideListHead;
1786  ListEntry = ListEntry->Flink)
1787  {
1789 
1790  Lookaside = CONTAINING_RECORD(ListEntry, GENERAL_LOOKASIDE, ListEntry);
1791 
1792  if (Lookaside->Type == NonPagedPool)
1793  {
1794  *NonPagedPoolLookasideHits += Lookaside->AllocateHits;
1795  }
1796  else
1797  {
1798  *PagedPoolLookasideHits += Lookaside->AllocateHits;
1799  }
1800  }
1801  }
1802 }
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:26
ULONG RunningDeAllocs
Definition: miarm.h:328
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE GENERAL_LOOKASIDE
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
struct LOOKASIDE_ALIGN _GENERAL_LOOKASIDE * PGENERAL_LOOKASIDE
ULONG ExpNumberOfPagedPools
Definition: expool.c:33
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:119
_Inout_ PVOID Lookaside
Definition: fltkernel.h:2532
ULONG RunningAllocs
Definition: miarm.h:327
PPOOL_DESCRIPTOR ExpPagedPoolDescriptor[16+1]
Definition: expool.c:35
POOL_DESCRIPTOR NonPagedPoolDescriptor
Definition: expool.c:34
ULONG TotalPages
Definition: miarm.h:329
Definition: typedefs.h:117
ULONG TotalBigPages
Definition: miarm.h:330
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 {
196  MmUnlockPages(Mdl);
198 }
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1439
#define TAG_MDL
Definition: tag.h:86
#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

Referenced by DisplayBootBitmap(), InitializeMachineInformation(), and InitializeTransferPackets().

◆ MmSessionCreate()

NTSTATUS NTAPI MmSessionCreate ( OUT PULONG  SessionId)

Definition at line 822 of file session.c.

823 {
825  ULONG SessionLeaderExists;
827 
828  /* Fail if the process is already in a session */
829  if (Process->Flags & PSF_PROCESS_IN_SESSION_BIT)
830  {
831  DPRINT1("Process already in session\n");
833  }
834 
835  /* Check if the process is already the session leader */
836  if (!Process->Vm.Flags.SessionLeader)
837  {
838  /* Atomically set it as the leader */
839  SessionLeaderExists = InterlockedCompareExchange(&MiSessionLeaderExists, 1, 0);
840  if (SessionLeaderExists)
841  {
842  DPRINT1("Session leader race\n");
844  }
845 
846  /* Do the work required to upgrade him */
848  }
849 
850  /* Create the session */
853  if (!NT_SUCCESS(Status))
854  {
856  return Status;
857  }
858 
859  /* Set up the session working set */
861  if (!NT_SUCCESS(Status))
862  {
863  /* Fail */
864  //MiDereferenceSession();
865  ASSERT(FALSE);
867  return Status;
868  }
869 
870  /* All done */
872 
873  /* Set and assert the flags, and return */
877  return Status;
878 }
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
union _MM_SESSION_SPACE::@1757 u
#define PSF_PROCESS_IN_SESSION_BIT
Definition: pstypes.h:272
#define STATUS_ALREADY_COMMITTED
Definition: ntstatus.h:256
VOID NTAPI MiSessionLeader(IN PEPROCESS Process)
Definition: session.c:168
volatile LONG MiSessionLeaderExists
Definition: session.c:27
NTSTATUS NTAPI MiSessionInitializeWorkingSetList(VOID)
Definition: session.c:465
#define PsGetCurrentProcess
Definition: psfuncs.h:17
NTSTATUS NTAPI MiSessionCreateInternal(OUT PULONG SessionId)
Definition: session.c:603
MM_SESSION_SPACE_FLAGS Flags
Definition: miarm.h:489
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
Status
Definition: gdiplustypes.h:24
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
#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:251

Referenced by SSI_DEF().

◆ MmSessionDelete()

NTSTATUS NTAPI MmSessionDelete ( IN ULONG  SessionId)

Definition at line 882 of file session.c.

883 {
885 
886  /* Process must be in a session */
887  if (!(Process->Flags & PSF_PROCESS_IN_SESSION_BIT))
888  {
889  DPRINT1("Not in a session!\n");
891  }
892 
893  /* It must be the session leader */
894  if (!Process->Vm.Flags.SessionLeader)
895  {
896  DPRINT1("Not a session leader!\n");
898  }
899 
900  /* Remove one reference count */
902  /* FIXME: Do it */
904 
905  /* All done */
906  return STATUS_SUCCESS;
907 }
#define PSF_PROCESS_IN_SESSION_BIT
Definition: pstypes.h:272
#define PsGetCurrentProcess
Definition: psfuncs.h:17
#define STATUS_UNABLE_TO_FREE_VM
Definition: ntstatus.h:249
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
#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
return STATUS_SUCCESS
Definition: btrfs.c:2966

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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ NtGetCurrentProcessorNumber()

ULONG NTAPI NtGetCurrentProcessorNumber ( VOID  )

Definition at line 3057 of file sysinfo.c.

3058 {
3059  /* Just use Ke */
3060  return KeGetCurrentProcessorNumber();
3061 }
FORCEINLINE ULONG KeGetCurrentProcessorNumber(VOID)
Definition: ke.h:325

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
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:43
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:39
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
Definition: arc.h:32
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:524
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
ULONG ARC_STATUS
Definition: arc.h:4
ARC_STATUS NTAPI HalGetEnvironmentVariable(IN PCH Name, IN USHORT ValueLength, IN PCH Value)
Definition: rtc.c:70
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define PAGED_CODE()
Definition: video.h:57
#define MAX_ENVVAL_SIZE
Definition: sysinfo.c:20
_SEH2_TRY
Definition: create.c:4250
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
CHAR * PCH
Definition: ntbasedef.h:398
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
_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)
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:228
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
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
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
unsigned short USHORT
Definition: pedump.c:61
NTSYSAPI NTSTATUS NTAPI RtlAnsiStringToUnicodeString(PUNICODE_STRING DestinationString, PANSI_STRING SourceString, BOOLEAN AllocateDestinationString)
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12

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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ NtQuerySystemInformation()

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

Definition at line 2929 of file sysinfo.c.

2934 {
2936  ULONG ResultLength = 0;
2938  NTSTATUS FStatus = STATUS_NOT_IMPLEMENTED;
2939 
2940  PAGED_CODE();
2941 
2943 
2944  _SEH2_TRY
2945  {
2946 #if (NTDDI_VERSION >= NTDDI_VISTA)
2947  /*
2948  * Check if 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, Length, Alignment);
2964  if (UnsafeResultLength != NULL)
2965  ProbeForWriteUlong(UnsafeResultLength);
2966  }
2967 
2968  if (UnsafeResultLength)
2969  *UnsafeResultLength = 0;
2970 
2971 #if (NTDDI_VERSION < NTDDI_VISTA)
2972  /*
2973  * Check if 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 (NULL != CallQS [SystemInformationClass].Query)
2983  {
2984  /*
2985  * Hand the request to a subhandler.
2986  */
2987  FStatus = CallQS [SystemInformationClass].Query(SystemInformation,
2988  Length,
2989  &ResultLength);
2990 
2991  /* Save the result length to the caller */
2992  if (UnsafeResultLength)
2993  *UnsafeResultLength = ResultLength;
2994  }
2995  }
2997  {
2998  FStatus = _SEH2_GetExceptionCode();
2999  }
3000  _SEH2_END;
3001 
3002  return FStatus;
3003 }
#define ProbeForWriteUlong(Ptr)
Definition: probe.h:36
IN CINT OUT PVOID IN ULONG OUT PULONG ResultLength
Definition: conport.c:47
#define TYPE_ALIGNMENT(t)
Definition: ntbasedef.h:117
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define PAGED_CODE()
Definition: video.h:57
_SEH2_TRY
Definition: create.c:4250
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2838
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
#define _SEH2_YIELD(STMT_)
Definition: pseh2_64.h:8
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
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:226
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2920
_SEH2_END
Definition: create.c:4424
LONG NTAPI ExSystemExceptionFilter(VOID)
Definition: harderr.c:351
NTSTATUS(* Query)(PVOID, ULONG, PULONG)
Definition: sysinfo.c:2822
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2921

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
_In_opt_ ULONG _Out_ PULONG Value
Definition: rtlfuncs.h:2343
const LUID SeSystemEnvironmentPrivilege
Definition: priv.c:43
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI SeSinglePrivilegeCheck(IN LUID PrivilegeValue, IN KPROCESSOR_MODE PreviousMode)
Definition: priv.c:524
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
ULONG ARC_STATUS
Definition: arc.h:4
#define PAGED_CODE()
Definition: video.h:57
_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)
static __inline VOID ReleaseCapturedUnicodeString(IN PUNICODE_STRING CapturedString, IN KPROCESSOR_MODE CurrentMode)
Definition: probe.h:228
_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
Status
Definition: gdiplustypes.h:24
ARC_STATUS NTAPI HalSetEnvironmentVariable(IN PCH Name, IN PCH Value)
Definition: rtc.c:57
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define UNIMPLEMENTED
Definition: debug.h:114

◆ NtSetSystemInformation()

NTSTATUS NTAPI NtSetSystemInformation ( IN SYSTEM_INFORMATION_CLASS  SystemInformationClass,
IN PVOID  SystemInformation,
IN ULONG  SystemInformationLength 
)

Definition at line 3008 of file sysinfo.c.

3011 {
3014 
3015  PAGED_CODE();
3016 
3018 
3019  _SEH2_TRY
3020  {
3021  /*
3022  * If called from user mode, check
3023  * possible unsafe arguments.
3024  */
3025  if (PreviousMode != KernelMode)
3026  {
3027  ProbeForRead(SystemInformation, SystemInformationLength, sizeof(ULONG));
3028  }
3029 
3030  /*
3031  * Check the request is valid.
3032  */
3033  if ((SystemInformationClass >= MIN_SYSTEM_INFO_CLASS) &&
3034  (SystemInformationClass < MAX_SYSTEM_INFO_CLASS))
3035  {
3036  if (NULL != CallQS [SystemInformationClass].Set)
3037  {
3038  /*
3039  * Hand the request to a subhandler.
3040  */
3041  Status = CallQS [SystemInformationClass].Set(SystemInformation,
3042  SystemInformationLength);
3043  }
3044  }
3045  }
3047  {
3049  }
3050  _SEH2_END;
3051 
3052  return Status;
3053 }
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
#define PAGED_CODE()
Definition: video.h:57
static BOOL Set
Definition: pageheap.c:10
_SEH2_TRY
Definition: create.c:4250
static QSSI_CALLS CallQS[]
Definition: sysinfo.c:2838
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
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:226
#define MIN_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2920
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
unsigned int ULONG
Definition: retypes.h:1
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define MAX_SYSTEM_INFO_CLASS
Definition: sysinfo.c:2921

◆ 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:78
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
Definition: bufpool.h:45
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
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:261
#define ULONG_PTR
Definition: config.h:101
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ 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  Spi->Reserved = 0;
662 
663  DPRINT("Arch %u Level %u Rev 0x%x\n", Spi->ProcessorArchitecture,
664  Spi->ProcessorLevel, Spi->ProcessorRevision);
665 
666  return STATUS_SUCCESS;
667 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG KeFeatureBits
Definition: krnlinit.c:22
struct _SYSTEM_PROCESSOR_INFORMATION SYSTEM_PROCESSOR_INFORMATION
struct _SYSTEM_PROCESSOR_INFORMATION * PSYSTEM_PROCESSOR_INFORMATION
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
USHORT KeProcessorArchitecture
Definition: krnlinit.c:19
USHORT KeProcessorRevision
Definition: krnlinit.c:21
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
USHORT KeProcessorLevel
Definition: krnlinit.c:20
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [3/55]

Definition at line 670 of file sysinfo.c.

671 {
672  LONG i;
673  ULONG IdleUser, IdleKernel;
674  PKPRCB Prcb;
677 
679 
680  *ReqSize = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
681 
682  /* Check user buffer's size */
683  if (Size < sizeof(SYSTEM_PERFORMANCE_INFORMATION))
684  {
686  }
687 
689 
690  IdleKernel = KeQueryRuntimeProcess(&TheIdleProcess->Pcb, &IdleUser);
698  for (i = 0; i < KeNumberProcessors; i ++)
699  {
700  Prcb = KiProcessorBlock[i];
701  if (Prcb)
702  {
709  }
710  }
711 
713  /*
714  * Add up all the used "Committed" memory + pagefile.
715  * Not sure this is right. 8^\
716  */
721  /*
722  * Add up the full system total + pagefile.
723  * All this make Taskmgr happy but not sure it is the right numbers.
724  * This too, fixes some of GlobalMemoryStatusEx numbers.
725  */
727 
728  Spi->PeakCommitment = 0; /* FIXME */
729  Spi->PageFaultCount = 0; /* FIXME */
730  Spi->CopyOnWriteCount = 0; /* FIXME */
731  Spi->TransitionCount = 0; /* FIXME */
732  Spi->CacheTransitionCount = 0; /* FIXME */
733  Spi->DemandZeroCount = 0; /* FIXME */
734  Spi->PageReadCount = 0; /* FIXME */
735  Spi->PageReadIoCount = 0; /* FIXME */
736  Spi->CacheReadCount = 0; /* FIXME */
737  Spi->CacheIoCount = 0; /* FIXME */
738  Spi->DirtyPagesWriteCount = 0; /* FIXME */
739  Spi->DirtyWriteIoCount = 0; /* FIXME */
740  Spi->MappedPagesWriteCount = 0; /* FIXME */
741  Spi->MappedWriteIoCount = 0; /* FIXME */
742 
743  Spi->PagedPoolPages = 0;
744  Spi->NonPagedPoolPages = 0;
745  Spi->PagedPoolAllocs = 0;
746  Spi->PagedPoolFrees = 0;
747  Spi->PagedPoolLookasideHits = 0;
748  Spi->NonPagedPoolAllocs = 0;
749  Spi->NonPagedPoolFrees = 0;
750  Spi->NonPagedPoolLookasideHits = 0;
752  &Spi->NonPagedPoolPages,
753  &Spi->PagedPoolAllocs,
754  &Spi->PagedPoolFrees,
756  &Spi->NonPagedPoolAllocs,
757  &Spi->NonPagedPoolFrees,
759  Spi->FreeSystemPtes = 0; /* FIXME */
760 
761  Spi->ResidentSystemCodePage = 0; /* FIXME */
762 
763  Spi->TotalSystemDriverPages = 0; /* FIXME */
764  Spi->Spare3Count = 0; /* FIXME */
765 
767  Spi->ResidentPagedPoolPage = 0; /* FIXME */
768 
769  Spi->ResidentSystemDriverPage = 0; /* FIXME */
770  Spi->CcFastReadNoWait = 0; /* FIXME */
771  Spi->CcFastReadWait = 0; /* FIXME */
772  Spi->CcFastReadResourceMiss = 0; /* FIXME */
773  Spi->CcFastReadNotPossible = 0; /* FIXME */
774 
775  Spi->CcFastMdlReadNoWait = 0; /* FIXME */
776  Spi->CcFastMdlReadWait = 0; /* FIXME */
777  Spi->CcFastMdlReadResourceMiss = 0; /* FIXME */
778  Spi->CcFastMdlReadNotPossible = 0; /* FIXME */
779 
782  Spi->CcMapDataNoWaitMiss = 0; /* FIXME */
783  Spi->CcMapDataWaitMiss = 0; /* FIXME */
784 
788  Spi->CcPinReadNoWaitMiss = 0; /* FIXME */
789  Spi->CcPinReadWaitMiss = 0; /* FIXME */
790  Spi->CcCopyReadNoWait = 0; /* FIXME */
791  Spi->CcCopyReadWait = 0; /* FIXME */
792  Spi->CcCopyReadNoWaitMiss = 0; /* FIXME */
793  Spi->CcCopyReadWaitMiss = 0; /* FIXME */
794 
795  Spi->CcMdlReadNoWait = 0; /* FIXME */
796  Spi->CcMdlReadWait = 0; /* FIXME */
797  Spi->CcMdlReadNoWaitMiss = 0; /* FIXME */
798  Spi->CcMdlReadWaitMiss = 0; /* FIXME */
799  Spi->CcReadAheadIos = 0; /* FIXME */
803  Spi->CcDataPages = CcDataPages;
804 
805  Spi->ContextSwitches = 0;
806  Spi->FirstLevelTbFills = 0;
807  Spi->SecondLevelTbFills = 0;
808  Spi->SystemCalls = 0;
809  for (i = 0; i < KeNumberProcessors; i ++)
810  {
811  Prcb = KiProcessorBlock[i];
812  if (Prcb)
813  {
815  Spi->FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
816  Spi->SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
817  Spi->SystemCalls += Prcb->KeSystemCalls;
818  }
819  }
820 
821  return STATUS_SUCCESS;
822 }
ULONG CcLazyWriteIos
Definition: lazywrite.c:21
ULONG KeMaximumIncrement
Definition: clock.c:20
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
LARGE_INTEGER IoWriteTransferCount
Definition: iomgr.c:42
LONG IoWriteOperationCount
Definition: ketypes.h:661
LARGE_INTEGER IoReadTransferCount
Definition: iomgr.c:40
#define MC_USER
Definition: mm.h:94
ULONG CcDataFlushes
Definition: copy.c:51
LARGE_INTEGER IoWriteTransferCount
Definition: ketypes.h:664
ULONG CcLazyWritePages
Definition: lazywrite.c:20
#define MC_SYSTEM
Definition: mm.h:95
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
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
LARGE_INTEGER IdleProcessTime
Definition: memtest.h:11
LONG IoReadOperationCount
Definition: ketypes.h:660
ULONG CcMapDataWait
Definition: pin.c:28
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
Definition: bufpool.h:45
ULONG CcDataPages
Definition: copy.c:50
ULONG CcPinReadNoWait
Definition: pin.c:31
ULONG KeSystemCalls
Definition: ketypes.h:647
LARGE_INTEGER IoOtherTransferCount
Definition: ketypes.h:665
#define KeGetContextSwitches(Prcb)
Definition: ke.h:153
LARGE_INTEGER IoOtherTransferCount
Definition: iomgr.c:44
LONG IoOtherOperationCount
Definition: ketypes.h:662
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:1722
KPROCESS Pcb
Definition: pstypes.h:1193
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
ULONG CcPinMappedDataCount
Definition: pin.c:32
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
LARGE_INTEGER IoReadTransferCount
Definition: ketypes.h:663
LARGE_INTEGER IoReadTransferCount
Definition: memtest.h:12
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:56
ULONG NTAPI KeQueryRuntimeProcess(IN PKPROCESS Process, OUT PULONG UserTime)
Definition: procobj.c:857
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
#define MC_CACHE
Definition: mm.h:93
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:53
unsigned int ULONG
Definition: retypes.h:1
ULONG PagesUsed
Definition: mm.h:385
ULONG IoOtherOperationCount
Definition: iomgr.c:43
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
LONGLONG QuadPart
Definition: typedefs.h:112

◆ QSI_DEF() [4/55]

Definition at line 825 of file sysinfo.c.

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

◆ QSI_DEF() [5/55]

QSI_DEF ( SystemPathInformation  )

Definition at line 862 of file sysinfo.c.

863 {
864  /* FIXME: QSI returns STATUS_BREAKPOINT. Why? */
865  DPRINT1("NtQuerySystemInformation - SystemPathInformation not implemented\n");
866 
867  return STATUS_BREAKPOINT;
868 }
#define STATUS_BREAKPOINT
Definition: ntstatus.h:172
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [6/55]

QSI_DEF ( SystemProcessInformation  )

Definition at line 871 of file sysinfo.c.

872 {
873  PSYSTEM_PROCESS_INFORMATION SpiCurrent;
875  PEPROCESS Process = NULL, SystemProcess;
876  PETHREAD CurrentThread;
878  ULONG CurrentSize;
879  USHORT ImageNameMaximumLength; // image name length in bytes
880  USHORT ImageNameLength;
881  PLIST_ENTRY CurrentEntry;
882  ULONG TotalSize = 0, ThreadsCount;
883  ULONG TotalUser, TotalKernel;
884  PUCHAR Current;
886  PUNICODE_STRING TempProcessImageName;
887  _SEH2_VOLATILE PUNICODE_STRING ProcessImageName = NULL;
888  PWCHAR szSrc;
889  BOOLEAN Overflow = FALSE;
890 
891  _SEH2_TRY
892  {
893  /* scan the process list */
894 
897 
898  *ReqSize = sizeof(SYSTEM_PROCESS_INFORMATION);
899 
900  /* Check for overflow */
901  if (Size < sizeof(SYSTEM_PROCESS_INFORMATION))
902  {
903  Overflow = TRUE;
904  }
905 
906  /* Zero user's buffer */
907  if (!Overflow) RtlZeroMemory(Spi, Size);
908 
909  SystemProcess = PsIdleProcess;
910  Process = SystemProcess;
911  Current = (PUCHAR) Spi;
912 
913  do
914  {
915  SpiCurrent = (PSYSTEM_PROCESS_INFORMATION) Current;
916 
917  /* Lock the Process */
919  ExAcquirePushLockShared(&Process->ProcessLock);
920 
921  if ((Process->ProcessExiting) &&
922  (Process->Pcb.Header.SignalState) &&
923  !(Process->ActiveThreads) &&
924  (IsListEmpty(&Process->Pcb.ThreadListHead)))
925  {
926  DPRINT1("Process %p (%s:%p) is a zombie\n",
927  Process, Process->ImageFileName, Process->UniqueProcessId);
928  CurrentSize = 0;
929  ImageNameMaximumLength = 0;
930 
931  /* Unlock the Process */
932  ExReleasePushLockShared(&Process->ProcessLock);
934  goto Skip;
935  }
936 
937  ThreadsCount = 0;
938  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
939  while (CurrentEntry != &Process->Pcb.ThreadListHead)
940  {
941  ThreadsCount++;
942  CurrentEntry = CurrentEntry->Flink;
943  }
944 
945  // size of the structure for every process
946  CurrentSize = sizeof(SYSTEM_PROCESS_INFORMATION) + sizeof(SYSTEM_THREAD_INFORMATION) * ThreadsCount;
947  ImageNameLength = 0;
948  Status = SeLocateProcessImageName(Process, &TempProcessImageName);
949  ProcessImageName = TempProcessImageName;
950  szSrc = NULL;
951  if (NT_SUCCESS(Status) && (ProcessImageName->Length > 0))
952  {
953  szSrc = (PWCHAR)((PCHAR)ProcessImageName->Buffer + ProcessImageName->Length);
954  /* Loop the file name*/
955  while (szSrc > ProcessImageName->Buffer)
956  {
957  /* Make sure this isn't a backslash */
958  if (*--szSrc == OBJ_NAME_PATH_SEPARATOR)
959  {
960  szSrc++;
961  break;
962  }
963  else
964  {
965  ImageNameLength += sizeof(WCHAR);
966  }
967  }
968  }
969  if (!ImageNameLength && Process != PsIdleProcess)
970  {
971  ImageNameLength = (USHORT)strlen(Process->ImageFileName) * sizeof(WCHAR);
972  }
973 
974  /* Round up the image name length as NT does */
975  if (ImageNameLength > 0)
976  ImageNameMaximumLength = ROUND_UP(ImageNameLength + sizeof(WCHAR), 8);
977  else
978  ImageNameMaximumLength = 0;
979 
980  TotalSize += CurrentSize + ImageNameMaximumLength;
981 
982  /* Check for overflow */
983  if (TotalSize > Size)
984  {
985  Overflow = TRUE;
986  }
987 
988  /* Fill system information */
989  if (!Overflow)
990  {
991  SpiCurrent->NextEntryOffset = CurrentSize + ImageNameMaximumLength; // relative offset to the beginning of the next structure
992  SpiCurrent->NumberOfThreads = ThreadsCount;
993  SpiCurrent->CreateTime = Process->CreateTime;
994  SpiCurrent->ImageName.Length = ImageNameLength;
995  SpiCurrent->ImageName.MaximumLength = ImageNameMaximumLength;
996  SpiCurrent->ImageName.Buffer = (void*)(Current + CurrentSize);
997 
998  /* Copy name to the end of the struct */
999  if(Process != PsIdleProcess)
1000  {
1001  if (szSrc)
1002  {
1003  RtlCopyMemory(SpiCurrent->ImageName.Buffer, szSrc, SpiCurrent->ImageName.Length);
1004  }
1005  else
1006  {
1007  RtlInitAnsiString(&ImageName, Process->ImageFileName);
1009  }
1010  }
1011  else
1012  {
1013  RtlInitUnicodeString(&SpiCurrent->ImageName, NULL);
1014  }
1015 
1016  SpiCurrent->BasePriority = Process->Pcb.BasePriority;
1017  SpiCurrent->UniqueProcessId = Process->UniqueProcessId;
1018  SpiCurrent->InheritedFromUniqueProcessId = Process->InheritedFromUniqueProcessId;
1020  SpiCurrent->PeakVirtualSize = Process->PeakVirtualSize;
1021  SpiCurrent->VirtualSize = Process->VirtualSize;
1022  SpiCurrent->PageFaultCount = Process->Vm.PageFaultCount;
1023  SpiCurrent->PeakWorkingSetSize = Process->Vm.PeakWorkingSetSize;
1024  SpiCurrent->WorkingSetSize = Process->Vm.WorkingSetSize;
1025  SpiCurrent->QuotaPeakPagedPoolUsage = Process->QuotaPeak[0];
1026  SpiCurrent->QuotaPagedPoolUsage = Process->QuotaUsage[0];
1027  SpiCurrent->QuotaPeakNonPagedPoolUsage = Process->QuotaPeak[1];
1028  SpiCurrent->QuotaNonPagedPoolUsage = Process->QuotaUsage[1];
1029  SpiCurrent->PagefileUsage = Process->QuotaUsage[2];
1030  SpiCurrent->PeakPagefileUsage = Process->QuotaPeak[2];
1031  SpiCurrent->PrivatePageCount = Process->CommitCharge;
1032  ThreadInfo = (PSYSTEM_THREAD_INFORMATION)(SpiCurrent + 1);
1033 
1034  CurrentEntry = Process->Pcb.ThreadListHead.Flink;
1035  while (CurrentEntry != &Process->Pcb.ThreadListHead)
1036  {
1037  CurrentThread = CONTAINING_RECORD(CurrentEntry, ETHREAD, Tcb.ThreadListEntry);
1038 
1039  ThreadInfo->KernelTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.KernelTime, KeMaximumIncrement);
1040  ThreadInfo->UserTime.QuadPart = UInt32x32To64(CurrentThread->Tcb.UserTime, KeMaximumIncrement);
1041  ThreadInfo->CreateTime.QuadPart = CurrentThread->CreateTime.QuadPart;
1042  ThreadInfo->WaitTime = CurrentThread->Tcb.WaitTime;
1043  ThreadInfo->StartAddress = (PVOID) CurrentThread->StartAddress;
1044  ThreadInfo->ClientId = CurrentThread->Cid;
1045  ThreadInfo->Priority = CurrentThread->Tcb.Priority;
1046  ThreadInfo->BasePriority = CurrentThread->Tcb.BasePriority;
1047  ThreadInfo->ContextSwitches = CurrentThread->Tcb.ContextSwitches;
1048  ThreadInfo->ThreadState = CurrentThread->Tcb.State;
1049  ThreadInfo->WaitReason = CurrentThread->Tcb.WaitReason;
1050 
1051  ThreadInfo++;
1052  CurrentEntry = CurrentEntry->Flink;
1053  }
1054 
1055  /* Query total user/kernel times of a process */
1056  TotalKernel = KeQueryRuntimeProcess(&Process->Pcb, &TotalUser);
1057  SpiCurrent->UserTime.QuadPart = UInt32x32To64(TotalUser, KeMaximumIncrement);
1058  SpiCurrent->KernelTime.QuadPart = UInt32x32To64(TotalKernel, KeMaximumIncrement);
1059  }
1060 
1061  if (ProcessImageName)
1062  {
1063  /* Release the memory allocated by SeLocateProcessImageName */
1064  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1065  ProcessImageName = NULL;
1066  }
1067 
1068  /* Unlock the Process */
1069  ExReleasePushLockShared(&Process->ProcessLock);
1071 
1072  /* Handle idle process entry */
1073 Skip:
1074  if (Process == PsIdleProcess) Process = NULL;
1075 
1077  ThreadsCount = 0;
1078  if ((Process == SystemProcess) || (Process == NULL))
1079  {
1080  if (!Overflow)
1081  SpiCurrent->NextEntryOffset = 0;
1082  break;
1083  }
1084  else
1085  Current += CurrentSize + ImageNameMaximumLength;
1086  } while ((Process != SystemProcess) && (Process != NULL));
1087 
1088  if(Process != NULL)
1091  }
1093  {
1094  if(Process != NULL)
1096  if (ProcessImageName)
1097  {
1098  /* Release the memory allocated by SeLocateProcessImageName */
1099  ExFreePoolWithTag(ProcessImageName, TAG_SEPA);
1100  }
1101 
1103  }
1104  _SEH2_END
1105 
1106  if (Overflow)
1108 
1109  *ReqSize = TotalSize;
1110  return Status;
1111 }
signed char * PCHAR
Definition: retypes.h:7
ULONG KeMaximumIncrement
Definition: clock.c:20
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
LIST_ENTRY ThreadListEntry
Definition: pstypes.h:1089
#define ROUND_UP(n, align)
Definition: eventvwr.h:31
#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
unsigned char * PUCHAR
Definition: retypes.h:3
LARGE_INTEGER CreateTime
Definition: pstypes.h:1035
NTSTATUS NTAPI SeLocateProcessImageName(IN PEPROCESS Process, OUT PUNICODE_STRING *ProcessImageName)
Definition: audit.c:122
LONG NTSTATUS
Definition: precomp.h:26
KTHREAD Tcb
Definition: pstypes.h:1034
SCHAR Priority
Definition: ketypes.h:1672
struct _ThreadInfo ThreadInfo
VOID NTAPI ObDereferenceObject(IN PVOID Object)
Definition: obref.c:375
uint16_t * PWCHAR
Definition: typedefs.h:54
LARGE_INTEGER CreateTime
Definition: extypes.h:887
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
_SEH2_TRY
Definition: create.c:4250
NTSYSAPI VOID NTAPI RtlInitAnsiString(PANSI_STRING DestinationString, PCSZ SourceString)
PKSTART_ROUTINE StartAddress
Definition: pstypes.h:1086
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
#define OBJ_NAME_PATH_SEPARATOR
Definition: arcname_tests.c:25
ULONG NTAPI ObGetProcessHandleCount(IN PEPROCESS Process)
Definition: obhandle.c:59
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
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:1854
CHAR BasePriority
Definition: ketypes.h:1807
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
ULONG KernelTime
Definition: ketypes.h:1877
struct _SYSTEM_THREAD_INFORMATION * PSYSTEM_THREAD_INFORMATION
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
CLIENT_ID Cid
Definition: pstypes.h:1059
struct _SYSTEM_PROCESS_INFORMATION SYSTEM_PROCESS_INFORMATION
UNICODE_STRING ImageName
Definition: extypes.h:890
static const char * ImageName
Definition: image.c:34
HANDLE InheritedFromUniqueProcessId
Definition: extypes.h:893
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
PEPROCESS NTAPI PsGetNextProcess(IN PEPROCESS OldProcess OPTIONAL)
Definition: process.c:128
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1091
_SEH2_END
Definition: create.c:4424
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
LARGE_INTEGER KernelTime
Definition: extypes.h:889
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:857
#define DPRINT1
Definition: precomp.h:8
ULONG UserTime
Definition: ketypes.h:1893
_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:1199
volatile UCHAR State
Definition: ketypes.h:1679
unsigned int ULONG
Definition: retypes.h:1
ULONG ContextSwitches
Definition: ketypes.h:1678
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LARGE_INTEGER UserTime
Definition: extypes.h:888
ULONG WaitTime
Definition: ketypes.h:1765
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define TAG_SEPA
Definition: tag.h:189
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
LONGLONG QuadPart
Definition: typedefs.h:112

◆ QSI_DEF() [7/55]

Definition at line 1114 of file sysinfo.c.

1115 {
1116  /* FIXME */
1117  DPRINT1("NtQuerySystemInformation - SystemCallCountInformation not implemented\n");
1118  return STATUS_NOT_IMPLEMENTED;
1119 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [8/55]

QSI_DEF ( SystemDeviceInformation  )

Definition at line 1122 of file sysinfo.c.

1123 {
1126  PCONFIGURATION_INFORMATION ConfigInfo;
1127 
1128  *ReqSize = sizeof(SYSTEM_DEVICE_INFORMATION);
1129 
1130  /* Check user buffer's size */
1131  if (Size < sizeof(SYSTEM_DEVICE_INFORMATION))
1132  {
1134  }
1135 
1136  ConfigInfo = IoGetConfigurationInformation();
1137 
1138  Sdi->NumberOfDisks = ConfigInfo->DiskCount;
1139  Sdi->NumberOfFloppies = ConfigInfo->FloppyCount;
1140  Sdi->NumberOfCdRoms = ConfigInfo->CdRomCount;
1141  Sdi->NumberOfTapes = ConfigInfo->TapeCount;
1142  Sdi->NumberOfSerialPorts = ConfigInfo->SerialCount;
1143  Sdi->NumberOfParallelPorts = ConfigInfo->ParallelCount;
1144 
1145  return STATUS_SUCCESS;
1146 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
PCONFIGURATION_INFORMATION NTAPI IoGetConfigurationInformation(VOID)
Definition: iorsrce.c:830
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct _SYSTEM_DEVICE_INFORMATION * PSYSTEM_DEVICE_INFORMATION
return STATUS_SUCCESS
Definition: btrfs.c:2966
struct _SYSTEM_DEVICE_INFORMATION SYSTEM_DEVICE_INFORMATION

◆ QSI_DEF() [9/55]

Definition at line 1149 of file sysinfo.c.

1150 {
1153 
1154  LONG i;
1155  ULONG TotalTime;
1156  PKPRCB Prcb;
1157 
1159 
1160  /* Check user buffer's size */
1161  if (Size < *ReqSize)
1162  {
1164  }
1165 
1166  for (i = 0; i < KeNumberProcessors; i++)
1167  {
1168  /* Get the PRCB on this processor */
1169  Prcb = KiProcessorBlock[i];
1170 
1171  /* Calculate total user and kernel times */
1172  TotalTime = Prcb->IdleThread->KernelTime + Prcb->IdleThread->UserTime;
1178  Spi->InterruptCount = Prcb->InterruptCount;
1179  Spi++;
1180  }
1181 
1182  return STATUS_SUCCESS;
1183 }
ULONG KeMaximumIncrement
Definition: clock.c:20
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG InterruptTime
Definition: ketypes.h:736
ULONG DpcTime
Definition: ketypes.h:735
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
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
long LONG
Definition: pedump.c:60
Definition: bufpool.h:45
ULONG KernelTime
Definition: ketypes.h:733
ULONG InterruptCount
Definition: ketypes.h:732
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION * PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
ULONG UserTime
Definition: ketypes.h:734
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
struct _KTHREAD * IdleThread
Definition: ketypes.h:568
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define UInt32x32To64(a, b)
Definition: intsafe.h:258
LONGLONG QuadPart
Definition: typedefs.h:112

◆ QSI_DEF() [10/55]

QSI_DEF ( SystemFlagsInformation  )

Definition at line 1186 of file sysinfo.c.

1187 {
1188 #if (NTDDI_VERSION >= NTDDI_VISTA)
1189  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1190 #endif
1191 
1192  if (sizeof(SYSTEM_FLAGS_INFORMATION) != Size)
1193  {
1195  }
1196 
1198 #if (NTDDI_VERSION < NTDDI_VISTA)
1199  *ReqSize = sizeof(SYSTEM_FLAGS_INFORMATION);
1200 #endif
1201 
1202  return STATUS_SUCCESS;
1203 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _SYSTEM_FLAGS_INFORMATION SYSTEM_FLAGS_INFORMATION
struct _SYSTEM_FLAGS_INFORMATION * PSYSTEM_FLAGS_INFORMATION
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
return STATUS_SUCCESS
Definition: btrfs.c:2966
ULONG NtGlobalFlag
Definition: init.c:51

◆ QSI_DEF() [11/55]

Definition at line 1222 of file sysinfo.c.

1223 {
1224  /* FIXME */
1225  DPRINT1("NtQuerySystemInformation - SystemCallTimeInformation not implemented\n");
1226  return STATUS_NOT_IMPLEMENTED;
1227 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [12/55]

QSI_DEF ( SystemModuleInformation  )

Definition at line 1230 of file sysinfo.c.

1231 {
1232  NTSTATUS Status;
1233 
1234  /* Acquire system module list lock */
1237 
1238  /* Call the generic handler with the system module list */
1242  Size,
1243  ReqSize);
1244 
1245  /* Release list lock and return status */
1248  return Status;
1249 }
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
ERESOURCE PsLoadedModuleResource
Definition: sysldr.c:37
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
Definition: bufpool.h:45
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
LIST_ENTRY MmLoadedUserImageList
Definition: sysldr.c:35
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114

◆ QSI_DEF() [13/55]

QSI_DEF ( SystemLocksInformation  )

Definition at line 1252 of file sysinfo.c.

1253 {
1254  /* FIXME */
1255  DPRINT1("NtQuerySystemInformation - SystemLocksInformation not implemented\n");
1256  return STATUS_NOT_IMPLEMENTED;
1257 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [14/55]

Definition at line 1260 of file sysinfo.c.

1261 {
1262  /* FIXME */
1263  DPRINT1("NtQuerySystemInformation - SystemStackTraceInformation not implemented\n");
1264  return STATUS_NOT_IMPLEMENTED;
1265 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [15/55]

Definition at line 1268 of file sysinfo.c.

1269 {
1270  /* FIXME */
1271  DPRINT1("NtQuerySystemInformation - SystemPagedPoolInformation not implemented\n");
1272  return STATUS_NOT_IMPLEMENTED;
1273 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [16/55]

Definition at line 1276 of file sysinfo.c.

1277 {
1278  /* FIXME */
1279  DPRINT1("NtQuerySystemInformation - SystemNonPagedPoolInformation not implemented\n");
1280  return STATUS_NOT_IMPLEMENTED;
1281 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [17/55]

QSI_DEF ( SystemHandleInformation  )

Definition at line 1285 of file sysinfo.c.

1286 {
1288  PLIST_ENTRY NextTableEntry;
1290  PHANDLE_TABLE_ENTRY HandleTableEntry;
1291  EXHANDLE Handle;
1292  ULONG Index = 0;
1293  NTSTATUS Status;
1294  PMDL Mdl;
1295  PAGED_CODE();
1296 
1297  DPRINT("NtQuerySystemInformation - SystemHandleInformation\n");
1298 
1299  /* Set initial required buffer size */
1300  *ReqSize = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handles);
1301 
1302  /* Check user's buffer size */
1303  if (Size < *ReqSize)
1304  {
1306  }
1307 
1308  /* We need to lock down the memory */
1310  Size,
1312  IoWriteAccess,
1314  &Mdl);
1315  if (!NT_SUCCESS(Status))
1316  {
1317  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
1318  return Status;
1319  }
1320 
1321  /* Reset of count of handles */
1322  HandleInformation->NumberOfHandles = 0;
1323 
1324  /* Enter a critical region */
1326 
1327  /* Acquire the handle table lock */
1329 
1330  /* Enumerate all system handles */
1331  for (NextTableEntry = HandleTableListHead.Flink;
1332  NextTableEntry != &HandleTableListHead;
1333  NextTableEntry = NextTableEntry->Flink)
1334  {
1335  /* Get current handle table */
1336  HandleTable = CONTAINING_RECORD(NextTableEntry, HANDLE_TABLE, HandleTableList);
1337 
1338  /* Set the initial value and loop the entries */
1339  Handle.Value = 0;
1340  while ((HandleTableEntry = ExpLookupHandleTableEntry(HandleTable, Handle)))
1341  {
1342  /* Validate the entry */
1343  if ((HandleTableEntry->Object) &&
1344  (HandleTableEntry->NextFreeTableEntry != -2))
1345  {
1346  /* Increase of count of handles */
1347  ++HandleInformation->NumberOfHandles;
1348 
1349  /* Lock the entry */
1350  if (ExpLockHandleTableEntry(HandleTable, HandleTableEntry))
1351  {
1352  /* Increase required buffer size */
1353  *ReqSize += sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO);
1354 
1355  /* Check user's buffer size */
1356  if (*ReqSize > Size)
1357  {
1359  }
1360  else
1361  {
1362  POBJECT_HEADER ObjectHeader = ObpGetHandleObject(HandleTableEntry);
1363 
1364  /* Filling handle information */
1365  HandleInformation->Handles[Index].UniqueProcessId =
1366  (USHORT)(ULONG_PTR) HandleTable->UniqueProcessId;
1367 
1368  HandleInformation->Handles[Index].CreatorBackTraceIndex = 0;
1369 
1370 #if 0 /* FIXME!!! Type field currupted */
1371  HandleInformation->Handles[Index].ObjectTypeIndex =
1372  (UCHAR) ObjectHeader->Type->Index;
1373 #else
1374  HandleInformation->Handles[Index].ObjectTypeIndex = 0;
1375 #endif
1376 
1377  HandleInformation->Handles[Index].HandleAttributes =
1378  HandleTableEntry->ObAttributes & OBJ_HANDLE_ATTRIBUTES;
1379 
1380  HandleInformation->Handles[Index].HandleValue =
1381  (USHORT)(ULONG_PTR) Handle.GenericHandleOverlay;
1382 
1383  HandleInformation->Handles[Index].Object = &ObjectHeader->Body;
1384 
1385  HandleInformation->Handles[Index].GrantedAccess =
1386  HandleTableEntry->GrantedAccess;
1387 
1388  ++Index;
1389  }
1390 
1391  /* Unlock it */
1392  ExUnlockHandleTableEntry(HandleTable, HandleTableEntry);
1393  }
1394  }
1395 
1396  /* Go to the next entry */
1397  Handle.Value += sizeof(HANDLE);
1398  }
1399  }
1400 
1401  /* Release the lock */
1403 
1404  /* Leave the critical region */
1406 
1407  /* Release the locked user buffer */
1408  ExUnlockUserBuffer(Mdl);
1409 
1410  return Status;
1411 }
PHANDLE_TABLE_ENTRY NTAPI ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN EXHANDLE Handle)
Definition: handle.c:37
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
static XMS_HANDLE HandleTable[XMS_MAX_HANDLES]
Definition: himem.c:83
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
VOID NTAPI ExUnlockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:887
#define PAGED_CODE()
Definition: video.h:57
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:63
Definition: extypes.h:595
#define ObpGetHandleObject(x)
Definition: ob.h:81
void DPRINT(...)
Definition: polytest.cpp:61
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
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
_In_ HANDLE Handle
Definition: extypes.h:390
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LIST_ENTRY HandleTableListHead
Definition: handle.c:18
ULONG GrantedAccess
Definition: extypes.h:606
BOOLEAN NTAPI ExpLockHandleTableEntry(IN PHANDLE_TABLE HandleTable, IN PHANDLE_TABLE_ENTRY HandleTableEntry)
Definition: handle.c:848
static const UCHAR Index[8]
Definition: usbohci.c:18
PVOID HANDLE
Definition: typedefs.h:71
_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:81
#define KeEnterCriticalRegion()
Definition: ke_x.h:83
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
FORCEINLINE VOID ExAcquirePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1091
#define KeLeaveCriticalRegion()
Definition: ke_x.h:114
unsigned short USHORT
Definition: pedump.c:61
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
LONG NextFreeTableEntry
Definition: extypes.h:612
#define DPRINT1
Definition: precomp.h:8
FORCEINLINE VOID ExReleasePushLockShared(PEX_PUSH_LOCK PushLock)
Definition: ex.h:1199
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
POBJECT_TYPE Type
Definition: obtypes.h:493
#define OBJ_HANDLE_ATTRIBUTES
Definition: ob.h:52
EX_PUSH_LOCK HandleTableListLock
Definition: handle.c:19

◆ QSI_DEF() [18/55]

QSI_DEF ( SystemObjectInformation  )

Definition at line 1414 of file sysinfo.c.

1415 {
1416  /* FIXME */
1417  DPRINT1("NtQuerySystemInformation - SystemObjectInformation not implemented\n");
1418  return STATUS_NOT_IMPLEMENTED;
1419 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [19/55]

Definition at line 1422 of file sysinfo.c.

1423 {
1424  UNICODE_STRING FileName; /* FIXME */
1426 
1427  if (Size < sizeof(SYSTEM_PAGEFILE_INFORMATION))
1428  {
1429  * ReqSize = sizeof(SYSTEM_PAGEFILE_INFORMATION);
1431  }
1432 
1433  RtlInitUnicodeString(&FileName, NULL); /* FIXME */
1434 
1435  /* FIXME */
1436  Spfi->NextEntryOffset = 0;
1437 
1439  Spfi->TotalInUse = MiUsedSwapPages;
1440  Spfi->PeakUsage = MiUsedSwapPages; /* FIXME */
1441  Spfi->PageFileName = FileName;
1442  return STATUS_SUCCESS;
1443 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
UNICODE_STRING PageFileName
Definition: extypes.h:1063
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
struct _SYSTEM_PAGEFILE_INFORMATION SYSTEM_PAGEFILE_INFORMATION
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
struct _FileName FileName
Definition: fatprocs.h:884
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:56
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:53
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [20/55]

Definition at line 1446 of file sysinfo.c.

1447 {
1448  /* FIXME */
1449  DPRINT1("NtQuerySystemInformation - SystemVdmInstemulInformation not implemented\n");
1450  return STATUS_NOT_IMPLEMENTED;
1451 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [21/55]

QSI_DEF ( SystemVdmBopInformation  )

Definition at line 1454 of file sysinfo.c.

1455 {
1456  /* FIXME */
1457  DPRINT1("NtQuerySystemInformation - SystemVdmBopInformation not implemented\n");
1458  return STATUS_NOT_IMPLEMENTED;
1459 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [22/55]

Definition at line 1462 of file sysinfo.c.

1463 {
1465 
1466  *ReqSize = sizeof(SYSTEM_FILECACHE_INFORMATION);
1467 
1468  if (Size < *ReqSize)
1469  {
1471  }
1472 
1474 
1475  /* Return the Byte size not the page size. */
1476  Sci->CurrentSize =
1478  Sci->PeakSize =
1480  /* Taskmgr multiplies this one by page size right away */
1482  MiMemoryConsumers[MC_CACHE].PagesUsed; /* FIXME: Should be */
1483  /* system working set and standby pages. */
1484  Sci->PageFaultCount = 0; /* FIXME */
1485  Sci->MinimumWorkingSet = 0; /* FIXME */
1486  Sci->MaximumWorkingSet = 0; /* FIXME */
1487 
1488  return STATUS_SUCCESS;
1489 }
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
SIZE_T CurrentSizeIncludingTransitionInPages
Definition: extypes.h:1115
Definition: bufpool.h:45
struct _SYSTEM_FILECACHE_INFORMATION SYSTEM_FILECACHE_INFORMATION
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define MC_CACHE
Definition: mm.h:93
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
ULONG PagesUsed
Definition: mm.h:385
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [23/55]

QSI_DEF ( SystemPoolTagInformation  )

Definition at line 1503 of file sysinfo.c.

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

◆ QSI_DEF() [24/55]

Definition at line 1510 of file sysinfo.c.

1511 {
1512  PKPRCB Prcb;
1513  LONG i;
1514  ULONG ti;
1516 
1518  {
1520  }
1521 
1522  ti = KeQueryTimeIncrement();
1523 
1524  for (i = 0; i < KeNumberProcessors; i++)
1525  {
1526  Prcb = KiProcessorBlock[i];
1528  sii->DpcCount = Prcb->DpcData[0].DpcCount;
1529  sii->DpcRate = Prcb->DpcRequestRate;
1530  sii->TimeIncrement = ti;
1531  sii->DpcBypassCount = 0;
1532  sii->ApcBypassCount = 0;
1533  sii++;
1534  }
1535 
1536  return STATUS_SUCCESS;
1537 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
KDPC_DATA DpcData[2]
Definition: ketypes.h:676
ULONG NTAPI KeQueryTimeIncrement(VOID)
Definition: clock.c:153
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
long LONG
Definition: pedump.c:60
Definition: bufpool.h:45
ULONG DpcCount
Definition: ketypes.h:748
#define KeGetContextSwitches(Prcb)
Definition: ke.h:153
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
struct _SYSTEM_INTERRUPT_INFORMATION * PSYSTEM_INTERRUPT_INFORMATION
unsigned int ULONG
Definition: retypes.h:1
ULONG DpcRequestRate
Definition: ketypes.h:684
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [25/55]

Definition at line 1540 of file sysinfo.c.

1541 {
1543 
1544  if (Size < sizeof(SYSTEM_DPC_BEHAVIOR_INFORMATION))
1545  {
1547  }
1548 
1552  sdbi->IdealDpcRate = KiIdealDpcRate;
1553 
1554  return STATUS_SUCCESS;
1555 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
ULONG KiAdjustDpcThreshold
Definition: dpc.c:21
ULONG KiIdealDpcRate
Definition: dpc.c:22
Definition: bufpool.h:45
ULONG KiMinimumDpcRate
Definition: dpc.c:20
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
ULONG KiMaximumDpcQueueDepth
Definition: dpc.c:19
return STATUS_SUCCESS
Definition: btrfs.c:2966
struct _SYSTEM_DPC_BEHAVIOR_INFORMATION * PSYSTEM_DPC_BEHAVIOR_INFORMATION

◆ QSI_DEF() [26/55]

Definition at line 1565 of file sysinfo.c.

1566 {
1567  PULONG Spi = (PULONG) Buffer;
1568 
1570 
1571  *ReqSize = sizeof(ULONG);
1572 
1573  if (sizeof(ULONG) != Size)
1574  {
1576  }
1577 
1578  DPRINT("SystemFullMemoryInformation\n");
1579 
1581 
1582  DPRINT("PID: %p, KernelTime: %u PFFree: %lu PFUsed: %lu\n",
1586  MiUsedSwapPages);
1587 
1589 
1590  return STATUS_SUCCESS;
1591 }
MM_MEMORY_CONSUMER MiMemoryConsumers[MC_MAXIMUM]
Definition: balance.c:36
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define MC_USER
Definition: mm.h:94
HANDLE UniqueProcessId
Definition: pstypes.h:1198
PEPROCESS PsIdleProcess
Definition: psmgr.c:51
PEPROCESS TheIdleProcess
Definition: kdpacket.c:30
void DPRINT(...)
Definition: polytest.cpp:61
Definition: bufpool.h:45
KPROCESS Pcb
Definition: pstypes.h:1193
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PFN_COUNT MiUsedSwapPages
Definition: pagefile.c:56
unsigned int * PULONG
Definition: retypes.h:1
ULONG KernelTime
Definition: ketypes.h:1992
PFN_COUNT MiFreeSwapPages
Definition: pagefile.c:53
unsigned int ULONG
Definition: retypes.h:1
ULONG PagesUsed
Definition: mm.h:385
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [27/55]

Definition at line 1668 of file sysinfo.c.

1669 {
1672 
1673  /* Check if enough storage was provided */
1675  {
1676  * ReqSize = sizeof(SYSTEM_QUERY_TIME_ADJUST_INFORMATION);
1678  }
1679 
1680  /* Give time values to our caller */
1681  TimeInfo->TimeIncrement = KeMaximumIncrement;
1682  TimeInfo->TimeAdjustment = KeTimeAdjustment;
1683  TimeInfo->Enable = !KiTimeAdjustmentEnabled;
1684 
1685  return STATUS_SUCCESS;
1686 }
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
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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [28/55]

Definition at line 1729 of file sysinfo.c.

1730 {
1731  /* FIXME */
1732  DPRINT1("NtQuerySystemInformation - SystemSummaryMemoryInformation not implemented\n");
1733  return STATUS_NOT_IMPLEMENTED;
1734 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [29/55]

Definition at line 1737 of file sysinfo.c.

1738 {
1739  /* FIXME */
1740  DPRINT1("NtQuerySystemInformation - SystemNextEventIdInformation not implemented\n");
1741  return STATUS_NOT_IMPLEMENTED;
1742 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [30/55]

Definition at line 1745 of file sysinfo.c.

1746 {
1747  /* FIXME */
1748  DPRINT1("NtQuerySystemInformation - SystemPerformanceTraceInformation not implemented\n");
1749  return STATUS_NOT_IMPLEMENTED;
1750 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [31/55]

Definition at line 1753 of file sysinfo.c.

1754 {
1755  /* FIXME */
1756  DPRINT1("NtQuerySystemInformation - SystemCrashDumpInformation not implemented\n");
1757  return STATUS_NOT_IMPLEMENTED;
1758 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [32/55]

Definition at line 1761 of file sysinfo.c.

1762 {
1763  PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation =
1765  PKPRCB Prcb;
1766  ULONG AlignmentFixupCount = 0, ExceptionDispatchCount = 0;
1767  ULONG FloatingEmulationCount = 0, ByteWordEmulationCount = 0;
1768  CHAR i;
1769 
1770  /* Check size of a buffer, it must match our expectations */
1771  if (sizeof(SYSTEM_EXCEPTION_INFORMATION) != Size)
1773 
1774  /* Sum up exception count information from all processors */
1775  for (i = 0; i < KeNumberProcessors; i++)
1776  {
1777  Prcb = KiProcessorBlock[i];
1778  if (Prcb)
1779  {
1780  AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
1781  ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
1782 #ifndef _M_ARM
1783  FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
1784 #endif // _M_ARM
1785  }
1786  }
1787 
1788  /* Save information in user's buffer */
1789  ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
1790  ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
1791  ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
1792  ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
1793 
1794  return STATUS_SUCCESS;
1795 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
char CHAR
Definition: xmlstorage.h:175
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 KeAlignmentFixupCount
Definition: ketypes.h:796
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
struct _SYSTEM_EXCEPTION_INFORMATION * PSYSTEM_EXCEPTION_INFORMATION
ULONG KeExceptionDispatchCount
Definition: ketypes.h:701
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [33/55]

Definition at line 1798 of file sysinfo.c.

1799 {
1800  /* FIXME */
1801  DPRINT1("NtQuerySystemInformation - SystemCrashDumpStateInformation not implemented\n");
1802  return STATUS_NOT_IMPLEMENTED;
1803 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [34/55]

Definition at line 1806 of file sysinfo.c.

1807 {
1809 
1810 #if (NTDDI_VERSION >= NTDDI_VISTA)
1811  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1812 #endif
1813 
1815  {
1817  }
1818 
1821 
1822 #if (NTDDI_VERSION < NTDDI_VISTA)
1823  *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
1824 #endif
1825 
1826  return STATUS_SUCCESS;
1827 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#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
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [35/55]

Definition at line 1830 of file sysinfo.c.

1831 {
1832  PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation =
1834  ULONG ContextSwitches;
1835  PKPRCB Prcb;
1836  CHAR i;
1837 
1838  /* Check size of a buffer, it must match our expectations */
1839  if (sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION) != Size)
1841 
1842  /* Calculate total value of context switches across all processors */
1843  ContextSwitches = 0;
1844  for (i = 0; i < KeNumberProcessors; i ++)
1845  {
1846  Prcb = KiProcessorBlock[i];
1847  if (Prcb)
1848  {
1849  ContextSwitches += KeGetContextSwitches(Prcb);
1850  }
1851  }
1852 
1853  ContextSwitchInformation->ContextSwitches = ContextSwitches;
1854 
1855  /* FIXME */
1856  ContextSwitchInformation->FindAny = 0;
1857  ContextSwitchInformation->FindLast = 0;
1858  ContextSwitchInformation->FindIdeal = 0;
1859  ContextSwitchInformation->IdleAny = 0;
1860  ContextSwitchInformation->IdleCurrent = 0;
1861  ContextSwitchInformation->IdleLast = 0;
1862  ContextSwitchInformation->IdleIdeal = 0;
1863  ContextSwitchInformation->PreemptAny = 0;
1864  ContextSwitchInformation->PreemptCurrent = 0;
1865  ContextSwitchInformation->PreemptLast = 0;
1866  ContextSwitchInformation->SwitchToIdle = 0;
1867 
1868  return STATUS_SUCCESS;
1869 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
char CHAR
Definition: xmlstorage.h:175
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
Definition: bufpool.h:45
struct _SYSTEM_CONTEXT_SWITCH_INFORMATION * PSYSTEM_CONTEXT_SWITCH_INFORMATION
#define KeGetContextSwitches(Prcb)
Definition: ke.h:153
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
PKPRCB KiProcessorBlock[]
Definition: krnlinit.c:32
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [36/55]

Definition at line 1872 of file sysinfo.c.

1873 {
1875 
1876  *ReqSize = sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
1878  {
1880  }
1881 
1882  DPRINT1("Faking max registry size of 32 MB\n");
1883  srqi->RegistryQuotaAllowed = 0x2000000;
1884  srqi->RegistryQuotaUsed = 0x200000;
1885  srqi->PagedPoolSize = 0x200000;
1886 
1887  return STATUS_SUCCESS;
1888 }
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION SYSTEM_REGISTRY_QUOTA_INFORMATION
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _SYSTEM_REGISTRY_QUOTA_INFORMATION * PSYSTEM_REGISTRY_QUOTA_INFORMATION
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define DPRINT1
Definition: precomp.h:8
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [37/55]

QSI_DEF ( SystemVerifierAddDriverInformation  )

Definition at line 2013 of file sysinfo.c.

2014 {
2015  /* FIXME */
2016  DPRINT1("NtQuerySystemInformation - SystemVerifierAddDriverInformation not implemented\n");
2017  return STATUS_NOT_IMPLEMENTED;
2018 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [38/55]

QSI_DEF ( SystemVerifierRemoveDriverInformation  )

Definition at line 2021 of file sysinfo.c.

2022 {
2023  /* FIXME */
2024  DPRINT1("NtQuerySystemInformation - SystemVerifierRemoveDriverInformation not implemented\n");
2025  return STATUS_NOT_IMPLEMENTED;
2026 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [39/55]

QSI_DEF ( SystemProcessorIdleInformation  )

Definition at line 2029 of file sysinfo.c.

2030 {
2031  *ReqSize = sizeof(PROCESSOR_POWER_INFORMATION) * KeNumberProcessors;
2032 
2034  {
2036  }
2037 
2038  /* FIXME */
2039  DPRINT1("NtQuerySystemInformation - SystemPowerInformation not implemented\n");
2040  return STATUS_NOT_IMPLEMENTED;
2041 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
CCHAR KeNumberProcessors
Definition: krnlinit.c:35
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [40/55]

QSI_DEF ( SystemLegacyDriverInformation  )

Definition at line 2044 of file sysinfo.c.

2045 {
2046  /* FIXME */
2047  DPRINT1("NtQuerySystemInformation - SystemLegacyDriverInformation not implemented\n");
2048  return STATUS_NOT_IMPLEMENTED;
2049 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [41/55]

Definition at line 2052 of file sysinfo.c.

2053 {
2054  *ReqSize = sizeof(RTL_TIME_ZONE_INFORMATION);
2055 
2056  if (sizeof(RTL_TIME_ZONE_INFORMATION) != Size)
2057  {
2059  }
2060 
2061  /* Copy the time zone information struct */
2062  memcpy(Buffer,
2063  &ExpTimeZoneInfo,
2064  sizeof(RTL_TIME_ZONE_INFORMATION));
2065 
2066  return STATUS_SUCCESS;
2067 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
struct _RTL_TIME_ZONE_INFORMATION RTL_TIME_ZONE_INFORMATION
Definition: bufpool.h:45
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
RTL_TIME_ZONE_INFORMATION ExpTimeZoneInfo
Definition: time.c:21
return STATUS_SUCCESS
Definition: btrfs.c:2966

◆ QSI_DEF() [42/55]

Definition at line 2138 of file sysinfo.c.

2139 {
2142  PMDL Mdl;
2143  ULONG MaxCount, Remaining;
2144  KIRQL OldIrql;
2145  NTSTATUS Status;
2146 
2147  /* First we need to lock down the memory, since we are going to access it
2148  at high IRQL */
2151  Size,
2152  PreviousMode,
2153  IoWriteAccess,
2154  (PVOID*)&Info,
2155  &Mdl);
2156  if (!NT_SUCCESS(Status))
2157  {
2158  DPRINT1("Failed to lock the user buffer: 0x%lx\n", Status);
2159  return Status;
2160  }
2161 
2162  /* Calculate how many items we can store */
2163  Remaining = MaxCount = Size / sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2164  if (Remaining == 0)
2165  {
2166  goto Leave;
2167  }
2168 
2169  /* Copy info from pool lookaside lists */
2171  &Remaining,
2173  FALSE);
2174  if (Remaining == 0)
2175  {
2176  goto Leave;
2177  }
2178 
2179  /* Copy info from system lookaside lists */
2181  &Remaining,
2183  TRUE);
2184  if (Remaining == 0)
2185  {
2186  goto Leave;
2187  }
2188 
2189  /* Acquire spinlock for ExpNonPagedLookasideListHead */
2191 
2192  /* Copy info from non-paged lookaside lists */
2194  &Remaining,
2196  TRUE);
2197 
2198  /* Release spinlock for ExpNonPagedLookasideListHead */
2200 
2201  if (Remaining == 0)
2202  {
2203  goto Leave;
2204  }
2205 
2206  /* Acquire spinlock for ExpPagedLookasideListHead */
2208 
2209  /* Copy info from paged lookaside lists */
2211  &Remaining,
2213  TRUE);
2214 
2215  /* Release spinlock for ExpPagedLookasideListHead */
2217 
2218 Leave:
2219 
2220  /* Release the locked user buffer */
2221  ExUnlockUserBuffer(Mdl);
2222 
2223  /* Return the size of the actually written data */
2224  *ReqSize = (MaxCount - Remaining) * sizeof(SYSTEM_LOOKASIDE_INFORMATION);
2225  return STATUS_SUCCESS;
2226 }
#define TRUE
Definition: types.h:120
LIST_ENTRY ExPoolLookasideListHead
Definition: lookas.c:26
static VOID ExpCopyLookasideInformation(PSYSTEM_LOOKASIDE_INFORMATION *InfoPointer, PULONG RemainingPointer, PLIST_ENTRY ListHead, BOOLEAN ListUsesMisses)
Definition: sysinfo.c:2083
LONG NTSTATUS
Definition: precomp.h:26
KPROCESSOR_MODE NTAPI ExGetPreviousMode(VOID)
Definition: sysinfo.c:3066
VOID NTAPI ExUnlockUserBuffer(PMDL Mdl)
Definition: sysinfo.c:194
struct TraceInfo Info
NTSTATUS NTAPI ExLockUserBuffer(PVOID BaseAddress, ULONG Length, KPROCESSOR_MODE AccessMode, LOCK_OPERATION Operation, PVOID *MappedSystemVa, PMDL *OutMdl)
Definition: sysinfo.c:202
UCHAR KIRQL
Definition: env_spec_w32.h:591
Definition: bufpool.h:45
_In_ KPROCESSOR_MODE PreviousMode
Definition: sefuncs.h:103
LIST_ENTRY ExpNonPagedLookasideListHead
Definition: lookas.c:21
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
CCHAR KPROCESSOR_MODE
Definition: ketypes.h:7
KSPIN_LOCK ExpPagedLookasideListLock
Definition: lookas.c:24
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:803
KSPIN_LOCK ExpNonPagedLookasideListLock
Definition: lookas.c:22
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
struct _SYSTEM_LOOKASIDE_INFORMATION SYSTEM_LOOKASIDE_INFORMATION
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
return STATUS_SUCCESS
Definition: btrfs.c:2966
LIST_ENTRY ExpPagedLookasideListHead
Definition: lookas.c:23
LIST_ENTRY ExSystemLookasideListHead
Definition: lookas.c:25

◆ QSI_DEF() [43/55]

QSI_DEF ( SystemSessionInformation  )

Definition at line 2294 of file sysinfo.c.

2295 {
2296  /* FIXME */
2297  DPRINT1("NtQuerySystemInformation - SystemSessionInformation not implemented\n");
2298  return STATUS_NOT_IMPLEMENTED;
2299 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [44/55]

Definition at line 2303 of file sysinfo.c.

2304 {
2305  /* Check user buffer's size */
2306  if (Size != sizeof(ULONG_PTR)) return STATUS_INFO_LENGTH_MISMATCH;
2307 
2309 
2310  if (ReqSize) *ReqSize = sizeof(ULONG_PTR);
2311 
2312  return STATUS_SUCCESS;
2313 }
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
uint32_t ULONG_PTR
Definition: typedefs.h:63
Definition: bufpool.h:45
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ULONG_PTR
Definition: config.h:101
uint32_t * PULONG_PTR
Definition: typedefs.h:63
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define MmSystemRangeStart
Definition: mm.h:32

◆ QSI_DEF() [45/55]

Definition at line 2316 of file sysinfo.c.

2317 {
2318  /* FIXME */
2319  DPRINT1("NtQuerySystemInformation - SystemVerifierInformation not implemented\n");
2320  return STATUS_NOT_IMPLEMENTED;
2321 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [46/55]

Definition at line 2342 of file sysinfo.c.

2343 {
2344  /* FIXME */
2345  DPRINT1("NtQuerySystemInformation - SystemSessionProcessInformation not implemented\n");
2346  return STATUS_NOT_IMPLEMENTED;
2347 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [47/55]

QSI_DEF ( SystemNumaProcessorMap  )

Definition at line 2360 of file sysinfo.c.

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

◆ QSI_DEF() [48/55]

Definition at line 2407 of file sysinfo.c.

2408 {
2409  /* FIXME */
2410  DPRINT1("NtQuerySystemInformation - SystemPrefetcherInformation not implemented\n");
2411  return STATUS_NOT_IMPLEMENTED;
2412 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [49/55]

Definition at line 2416 of file sysinfo.c.

2417 {
2418  /* FIXME */
2419  DPRINT1("NtQuerySystemInformation - SystemExtendedProcessInformation not implemented\n");
2420  return STATUS_NOT_IMPLEMENTED;
2421 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [50/55]

Definition at line 2425 of file sysinfo.c.

2426 {
2427  /* FIXME */
2428  DPRINT1("NtQuerySystemInformation - SystemRecommendedSharedDataAlignment not implemented\n");
2429  return STATUS_NOT_IMPLEMENTED;
2430 }
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
#define DPRINT1
Definition: precomp.h:8

◆ QSI_DEF() [51/55]

Definition at line 2434 of file sysinfo.c.

2435 {
2436  ULONG MaxEntries, Node;
2438 
2439  /* Validate input size */
2440  if (Size < sizeof(ULONG))
2441  {
2443  }
2444 
2445  /* Return highest node */
2446  NumaInformation->HighestNodeNumber = KeNumberNodes - 1;
2447 
2448  /* Compute how much entries we will be able to put in output structure */
2449  MaxEntries = (Size - FIELD_OFFSET(SYSTEM_NUMA_INFORMATION, AvailableMemory)) / sizeof(ULONGLONG);
2450  /* Make sure we don't overflow KeNodeBlock */
2451  if (MaxEntries > KeNumberNodes)
2452  {
2453  MaxEntries = KeNumberNodes;
2454  }
2455 
2456  /* If we have entries to write, and room for it */
2457  if (Size >=