00950 :
00951
00952 This function queries information about
the system.
00953
00954 Arguments:
00955
00956 SystemInformationClass - The system information
class about which
00957 to retrieve information.
00958
00959 SystemInformation -
A pointer to a buffer which receives
the specified
00960 information. The
format and content of
the buffer depend on
the
00961 specified system information class.
00962
00963 SystemInformation Format by Information Class:
00964
00965 SystemBasicInformation - Data
type is SYSTEM_BASIC_INFORMATION
00966
00967 SYSTEM_BASIC_INFORMATION Structure
00968
00969 ULONG Reserved - Always zero.
00970
00971 ULONG TimerResolutionInMicroSeconds - The resolution of
00972
the hardware time. All time values in NT are
00973 specified as 64-bit LARGE_INTEGER values in units of
00974 100 nanoseconds. This field allows an application to
00975 understand how many of
the low order bits of a system
00976 time value are insignificant.
00977
00978 ULONG PageSize - The physical page size for
virtual memory
00979 objects.
Physical memory
is committed in PageSize
00980 chunks.
00981
00982 ULONG AllocationGranularity - The logical page size for
00983
virtual memory objects. Allocating 1 byte of
virtual
00984 memory will actually allocate AllocationGranularity
00985 bytes of
virtual memory. Storing into that byte will
00986 commit
the first physical page of
the virtual memory.
00987
00988 ULONG MinimumUserModeAddress - The smallest valid user mode
00989 address. The first AllocationGranularity bytes of
00990
the virtual address space are reserved. This forces
00991 access violations for code
the dereferences a zero
00992 pointer.
00993
00994 ULONG MaximumUserModeAddress - The largest valid user mode
00995 address. The next AllocationGranularity bytes of
00996
the virtual address space are reserved. This allows
00997 system service
routines to validate user mode pointer
00998 parameters quickly.
00999
01000 KAFFINITY ActiveProcessorsAffinityMask - The affinity mask
01001 for
the current hardware configuration.
01002
01003 CCHAR NumberOfProcessors - The number of processors
01004 in
the current hardware configuration.
01005
01006 SystemProcessorInformation - Data
type is SYSTEM_PROCESSOR_INFORMATION
01007
01008 SYSTEM_PROCESSOR_INFORMATION Structure
01009
01010
USHORT ProcessorArchitecture - The processor architecture:
01011 PROCESSOR_ARCHITECTURE_INTEL
01012 PROCESSOR_ARCHITECTURE_MIPS
01013 PROCESSOR_ARCHITECTURE_ALPHA
01014 PROCESSOR_ARCHITECTURE_PPC
01015
01016
USHORT ProcessorLevel - architecture dependent processor level.
01017 This
is the least common denominator for an MP system:
01018
01019 For PROCESSOR_ARCHITECTURE_INTEL:
01020 3 - 386
01021 4 - 486
01022 5 - 586 or Pentium
01023
01024 For PROCESSOR_ARCHITECTURE_MIPS:
01025 00xx - where xx
is 8-bit implementation number (bits 8-15 of
01026 PRId register.
01027 0004 - R4000
01028
01029 For PROCESSOR_ARCHITECTURE_ALPHA:
01030 xxxx - where xxxx is 16-bit processor version number (low
01031 order 16 bits of processor version number from firmware)
01032
01033 21064 - 21064
01034 21066 - 21066
01035 21164 - 21164
01036
01037 For PROCESSOR_ARCHITECTURE_PPC:
01038 xxxx - where xxxx is 16-bit processor version number (high
01039 order 16 bits of Processor Version Register).
01040 1 - 601
01041 3 - 603
01042 4 - 604
01043 6 - 603+
01044 9 - 604+
01045 20 - 620
01046
01047 USHORT ProcessorRevision - architecture dependent processor revision.
01048 This is the least common denominator for an MP system:
01049
01050 For PROCESSOR_ARCHITECTURE_INTEL:
01051 For Old Intel 386 or 486:
01052 FFxx - where xx is displayed as a hexadecimal CPU stepping
01053 (e.g. FFD0 is D0 stepping)
01054
01055 For Intel Pentium or Cyrix/NexGen 486
01056 xxyy - where xx is model number and yy is stepping, so
01057 0201 is Model 2, Stepping 1
01058
01059 For PROCESSOR_ARCHITECTURE_MIPS:
01060 00xx is 8-bit revision number of processor (low order 8 bits
01061 of PRId Register
01062
01063 For PROCESSOR_ARCHITECTURE_ALPHA:
01064 xxyy - where xxyy is 16-bit processor revision number (low
01065 order 16 bits of processor revision number from firmware).
01066 Displayed as Model 'A'+xx, Pass yy
01067
01068 For PROCESSOR_ARCHITECTURE_PPC:
01069 xxyy - where xxyy is 16-bit processor revision number (low
01070 order 16 bits of Processor Version Register). Displayed
01071 as a fixed point number xx.yy
01072
01073 USHORT Reserved - Always zero.
01074
01075 ULONG ProcessorFeatureBits - architecture dependent processor feature bits.
01076 This is the least common denominator for an MP system.
01077
01078 SystemPerformanceInformation - Data type is SYSTEM_PERFORMANCE_INFORMATION
01079
01080 SYSTEM_PERFORMANCE_INFORMATION Structure
01081
01082 LARGE_INTEGER IdleProcessTime - Returns the kernel time of the idle
01083 process.
01084 BUGBUG complete comment.
01085 LARGE_INTEGER IoReadTransferCount;
01086 LARGE_INTEGER IoWriteTransferCount;
01087 LARGE_INTEGER IoOtherTransferCount;
01088 LARGE_INTEGER KernelTime;
01089 LARGE_INTEGER UserTime;
01090 ULONG IoReadOperationCount;
01091 ULONG IoWriteOperationCount;
01092 ULONG IoOtherOperationCount;
01093 ULONG AvailablePages;
01094 ULONG CommittedPages;
01095 ULONG PageFaultCount;
01096 ULONG CopyOnWriteCount;
01097 ULONG TransitionCount;
01098 ULONG CacheTransitionCount;
01099 ULONG DemandZeroCount;
01100 ULONG PageReadCount;
01101 ULONG PageReadIoCount;
01102 ULONG CacheReadCount;
01103 ULONG CacheIoCount;
01104 ULONG DirtyPagesWriteCount;
01105 ULONG DirtyWriteIoCount;
01106 ULONG MappedPagesWriteCount;
01107 ULONG MappedWriteIoCount;
01108 ULONG PagedPoolPages;
01109 ULONG NonPagedPoolPages;
01110 ULONG PagedPoolAllocs;
01111 ULONG PagedPoolFrees;
01112 ULONG NonPagedPoolAllocs;
01113 ULONG NonPagedPoolFrees;
01114 ULONG LpcThreadsWaitingInReceive;
01115 ULONG LpcThreadsWaitingForReply;
01116
01117 SystemProcessInformation - Data type is SYSTEM_PROCESS_INFORMATION
01118
01119 SYSTEM_PROCESSOR_INFORMATION Structure
01120 BUGBUG - add here when done.
01121
01122 SystemDockInformation - Data type is SYSTEM_DOCK_INFORMATION
01123
01124 SYSTEM_DOCK_INFORMATION Structure
01125
01126 SYSTEM_DOCKED_STATE DockState - Ordinal specifying the current docking state. Possible values:
01127 SystemDockStateUnknown - The docking state of the system could not be determined.
01128 SystemUndocked - The system is undocked.
01129 SystemDocked - The system is docked.
01130
01131 ULONG DockIdLength - Specifies the length in characters of the Dock ID string
01132 (not including terminating NULL).
01133
01134 ULONG SerialNumberOffset - Specifies the character offset of the Serial Number within
01135 the DockId buffer.
01136
01137 ULONG SerialNumberLength - Specifies the length in characters of the Serial Number
01138 string (not including terminating NULL).
01139
01140 WCHAR DockId - Character buffer containing two null-terminated strings. The first
01141 string is a character representation of the dock ID number, starting
01142 at the beginning of the buffer. The second string is a character
01143 representation of the machine's serial number, starting at character
01144 offset SerialNumberOffset in the buffer.
01145
01146
01147 SystemPowerSettings - Data type is SYSTEM_POWER_SETTINGS
01148 SYSTEM_POWER_INFORMATION Structure
01149 BOOLEAN SystemSuspendSupported - Supplies a BOOLEAN as to
01150 whether the system suspend is enabled or not.
01151 BOOLEAN SystemHibernateSupported - Supplies a BOOLEAN as to
01152 whether the system hibernate is enabled or not.
01153 BOOLEAN ResumeTimerSupportsSuspend - Supplies a BOOLEAN as to
01154 whether the resuming from an external programmed timer
01155 from within a system suspend is enabled or not.
01156 BOOLEAN ResumeTimerSupportsHibernate - Supplies a BOOLEAN as to
01157 whether or resuming from an external programmed timer
01158 from within a system hibernate is enabled or not.
01159 BOOLEAN LidSupported - Supplies a BOOLEAN as to whether or not
01160 the suspending and resuming by Lid are enabled or not.
01161 BOOLEAN TurboSettingSupported - Supplies a BOOLEAN as to whether
01162 or not the system supports a turbo mode setting.
01163 BOOLEAN TurboMode - Supplies a BOOLEAN as to whether or not
01164 the system is in turbo mode.
01165 BOOLEAN SystemAcOrDc - Supplies a BOOLEAN as to whether or not
01166 the system is in AC mode.
01167 BOOLEAN DisablePowerDown - If TRUE, signifies that all requests to
01168 PoRequestPowerChange for a SET_POWER-PowerDown irp are to
01169 be ignored.
01170 LARGE_INTEGER SpindownDrives - If non-zero, signifies to the
01171 cache manager (or the IO subsystem) to optimize drive
01172 accesses based upon power saves, are that drives are to
01173 be spun down as appropriate. The value represents to user's
01174 requested disk spin down timeout.
01175
01176 SystemProcessorSpeedInformation - Data type is SYSTEM_PROCESSOR_SPEED_INFORMATION
01177 SYSTEM_PROCESSOR_SPEED_INFORMATION Structure (same as HalProcessorSpeedInformation)
01178 ULONG MaximumProcessorSpeed - The maximum hertz the processor is
01179 capable of. This information is used by the UI to draw the
01180 appropriate scale. This field is read-only and cannot be
01181 set.
01182 ULONG CurrentAvailableSpeed - The hertz for which the processor
01183 runs at when not idle. This field is read-only and cannot
01184 be set.
01185 ULONG ConfiguredSpeedLimit - The hertz for which the processor
01186 is limited to due to the current configuration.
01187 UCHAR PowerState
01188 0 - Normal
01189 1 - The processor speed is being limited due to available
01190 power restrictions. This field id read-only by the system.
01191 UCHAR ThermalState
01192 0 - Normal
01193 1 - The processors speed is being limited due to thermal
01194 restrictions. This field is read-only by the system.
01195 UCHAR TurboState
01196 0 - Normal
01197 1 - The processors speed is being limited by the fact that
01198 the system turbo mode is currently disabled which is
01199 requested to obtain more processor speed.
01200
01201 SystemInformationLength - Specifies the length in bytes of the system
01202 information buffer.
01203
01204 ReturnLength - An optional pointer which, if specified, receives the
01205 number of bytes placed in the system information buffer.
01206
01207 Return Value:
01208
01209 Returns one of the following status codes:
01210
01211 STATUS_SUCCESS - normal, successful completion.
01212
01213 STATUS_INVALID_INFO_CLASS - The SystemInformationClass parameter
01214 did not specify a valid value.
01215
01216 STATUS_INFO_LENGTH_MISMATCH - The value of the SystemInformationLength
01217 parameter did not match the length required for the information
01218 class requested by the SystemInformationClass parameter.
01219
01220 STATUS_ACCESS_VIOLATION - Either the SystemInformation buffer pointer
01221 or the ReturnLength pointer value specified an invalid address.
01222
01223 STATUS_WORKING_SET_QUOTA - The process does not have sufficient
01224 working set to lock the specified output structure in memory.
01225
01226 STATUS_INSUFFICIENT_RESOURCES - Insufficient system resources exist
01227 for this request to complete.
01228
01229 --*/
01230
01231 {
01232
01233 KPROCESSOR_MODE PreviousMode;
01234 PSYSTEM_BASIC_INFORMATION BasicInfo;
01235 PSYSTEM_PROCESSOR_INFORMATION ProcessorInfo;
01236 SYSTEM_TIMEOFDAY_INFORMATION LocalTimeOfDayInfo;
01237 SYSTEM_PERFORMANCE_INFORMATION LocalPerformanceInfo;
01238 PSYSTEM_PERFORMANCE_INFORMATION PerformanceInfo;
01239 PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION ProcessorPerformanceInfo;
01240 PSYSTEM_CALL_COUNT_INFORMATION CallCountInformation;
01241 PSYSTEM_DEVICE_INFORMATION DeviceInformation;
01242 PCONFIGURATION_INFORMATION ConfigInfo;
01243 PSYSTEM_EXCEPTION_INFORMATION ExceptionInformation;
01244 PSYSTEM_FILECACHE_INFORMATION FileCache;
01245 PSYSTEM_QUERY_TIME_ADJUST_INFORMATION TimeAdjustmentInformation;
01246 PSYSTEM_KERNEL_DEBUGGER_INFORMATION KernelDebuggerInformation;
01247 PSYSTEM_CONTEXT_SWITCH_INFORMATION ContextSwitchInformation;
01248 PSYSTEM_INTERRUPT_INFORMATION InterruptInformation;
01249 PSYSTEM_SESSION_PROCESS_INFORMATION SessionProcessInformation;
01250 PVOID ProcessInformation;
01251 ULONG ProcessInformationLength;
01252
01253 NTSTATUS Status;
01254 BOOLEAN ReleaseModuleResoure = FALSE;
01255 PKPRCB Prcb;
01256 ULONG Length = 0;
01257 ULONG i;
01258 ULONG ContextSwitches;
01259 PULONG TableLimit, TableCounts;
01260 PKSERVICE_TABLE_DESCRIPTOR Table;
01261 ULONG SessionId;
01262
01263 PAGED_CODE();
01264
01265
01266
01267
01268
01269 Status = STATUS_SUCCESS;
01270 try {
01271
01272
01273
01274
01275
01276 PreviousMode = KeGetPreviousMode();
01277 if (PreviousMode != KernelMode) {
01278 ProbeForWrite(SystemInformation,
01279 SystemInformationLength,
01280 SystemInformationClass == SystemKernelDebuggerInformation ? sizeof(BOOLEAN)
01281 : sizeof(ULONG));
01282
01283 if (ARGUMENT_PRESENT(ReturnLength)) {
01284 ProbeForWriteUlong(ReturnLength);
01285 }
01286 }
01287
01288 if (ARGUMENT_PRESENT(ReturnLength)) {
01289 *ReturnLength = 0;
01290 }
01291
01292 switch (SystemInformationClass) {
01293
01294 case SystemBasicInformation:
01295
01296 if (SystemInformationLength != sizeof( SYSTEM_BASIC_INFORMATION )) {
01297 return STATUS_INFO_LENGTH_MISMATCH;
01298 }
01299
01300 BasicInfo = (PSYSTEM_BASIC_INFORMATION)SystemInformation;
01301 BasicInfo->NumberOfProcessors = KeNumberProcessors;
01302 BasicInfo->ActiveProcessorsAffinityMask = (ULONG_PTR)
KeActiveProcessors;
01303 BasicInfo->Reserved = 0;
01304 BasicInfo->TimerResolution =
KeMaximumIncrement;
01305 BasicInfo->NumberOfPhysicalPages =
MmNumberOfPhysicalPages;
01306 BasicInfo->LowestPhysicalPageNumber =
MmLowestPhysicalPage;
01307 BasicInfo->HighestPhysicalPageNumber =
MmHighestPhysicalPage;
01308 BasicInfo->PageSize =
PAGE_SIZE;
01309 BasicInfo->AllocationGranularity =
MM_ALLOCATION_GRANULARITY;
01310 BasicInfo->MinimumUserModeAddress = (ULONG_PTR)MM_LOWEST_USER_ADDRESS;
01311 BasicInfo->MaximumUserModeAddress = (ULONG_PTR)MM_HIGHEST_USER_ADDRESS;
01312
01313 if (ARGUMENT_PRESENT( ReturnLength )) {
01314 *ReturnLength =
sizeof( SYSTEM_BASIC_INFORMATION );
01315 }
01316
break;
01317
01318
case SystemProcessorInformation:
01319
if (SystemInformationLength <
sizeof( SYSTEM_PROCESSOR_INFORMATION )) {
01320
return STATUS_INFO_LENGTH_MISMATCH;
01321 }
01322
01323 ProcessorInfo = (PSYSTEM_PROCESSOR_INFORMATION)SystemInformation;
01324
01325 ProcessorInfo->ProcessorArchitecture =
KeProcessorArchitecture;
01326 ProcessorInfo->ProcessorLevel =
KeProcessorLevel;
01327 ProcessorInfo->ProcessorRevision =
KeProcessorRevision;
01328 ProcessorInfo->Reserved = 0;
01329 ProcessorInfo->ProcessorFeatureBits =
KeFeatureBits;
01330
01331
if (ARGUMENT_PRESENT( ReturnLength )) {
01332 *ReturnLength =
sizeof( SYSTEM_PROCESSOR_INFORMATION );
01333 }
01334
01335
break;
01336
01337
case SystemPerformanceInformation:
01338
if (SystemInformationLength <
sizeof( SYSTEM_PERFORMANCE_INFORMATION )) {
01339
return STATUS_INFO_LENGTH_MISMATCH;
01340 }
01341
01342 PerformanceInfo = (PSYSTEM_PERFORMANCE_INFORMATION)SystemInformation;
01343
01344
01345
01346
01347
01348 LocalPerformanceInfo.IoReadTransferCount =
IoReadTransferCount;
01349 LocalPerformanceInfo.IoWriteTransferCount =
IoWriteTransferCount;
01350 LocalPerformanceInfo.IoOtherTransferCount =
IoOtherTransferCount;
01351 LocalPerformanceInfo.IoReadOperationCount =
IoReadOperationCount;
01352 LocalPerformanceInfo.IoWriteOperationCount =
IoWriteOperationCount;
01353 LocalPerformanceInfo.IoOtherOperationCount =
IoOtherOperationCount;
01354
01355
01356
01357
01358
01359
01360
01361
01362 {
01363 ULONG FirstLevelTbFills = 0;
01364 ULONG SecondLevelTbFills = 0;
01365 ULONG SystemCalls = 0;
01366
01367
01368 ContextSwitches = 0;
01369
for (i = 0; i < (ULONG)
KeNumberProcessors; i += 1) {
01370 Prcb =
KiProcessorBlock[i];
01371
if (Prcb !=
NULL) {
01372 ContextSwitches += Prcb->KeContextSwitches;
01373 FirstLevelTbFills += Prcb->KeFirstLevelTbFills;
01374
01375 SecondLevelTbFills += Prcb->KeSecondLevelTbFills;
01376 SystemCalls += Prcb->KeSystemCalls;
01377 }
01378 }
01379
01380 LocalPerformanceInfo.ContextSwitches = ContextSwitches;
01381 LocalPerformanceInfo.FirstLevelTbFills = FirstLevelTbFills;
01382
01383 LocalPerformanceInfo.SecondLevelTbFills = SecondLevelTbFills;
01384 LocalPerformanceInfo.SystemCalls = SystemCalls;
01385 }
01386
01387
01388
01389
01390
01391 LocalPerformanceInfo.AvailablePages =
MmAvailablePages;
01392 LocalPerformanceInfo.CommittedPages =
MmTotalCommittedPages;
01393 LocalPerformanceInfo.CommitLimit =
MmTotalCommitLimit;
01394 LocalPerformanceInfo.PeakCommitment =
MmPeakCommitment;
01395 LocalPerformanceInfo.PageFaultCount =
MmInfoCounters.
PageFaultCount;
01396 LocalPerformanceInfo.CopyOnWriteCount =
MmInfoCounters.
CopyOnWriteCount;
01397 LocalPerformanceInfo.TransitionCount =
MmInfoCounters.
TransitionCount;
01398 LocalPerformanceInfo.CacheTransitionCount =
MmInfoCounters.
CacheTransitionCount;
01399 LocalPerformanceInfo.DemandZeroCount =
MmInfoCounters.
DemandZeroCount;
01400 LocalPerformanceInfo.PageReadCount =
MmInfoCounters.
PageReadCount;
01401 LocalPerformanceInfo.PageReadIoCount =
MmInfoCounters.
PageReadIoCount;
01402 LocalPerformanceInfo.CacheReadCount =
MmInfoCounters.
CacheReadCount;
01403 LocalPerformanceInfo.CacheIoCount =
MmInfoCounters.
CacheIoCount;
01404 LocalPerformanceInfo.DirtyPagesWriteCount =
MmInfoCounters.
DirtyPagesWriteCount;
01405 LocalPerformanceInfo.DirtyWriteIoCount =
MmInfoCounters.
DirtyWriteIoCount;
01406 LocalPerformanceInfo.MappedPagesWriteCount =
MmInfoCounters.
MappedPagesWriteCount;
01407 LocalPerformanceInfo.MappedWriteIoCount =
MmInfoCounters.
MappedWriteIoCount;
01408 LocalPerformanceInfo.FreeSystemPtes =
MmTotalFreeSystemPtes[0];
01409
01410 LocalPerformanceInfo.ResidentSystemCodePage =
MmSystemCodePage;
01411 LocalPerformanceInfo.ResidentSystemCachePage =
MmSystemCachePage;
01412 LocalPerformanceInfo.ResidentPagedPoolPage =
MmPagedPoolPage;
01413 LocalPerformanceInfo.ResidentSystemDriverPage =
MmSystemDriverPage;
01414 LocalPerformanceInfo.TotalSystemCodePages =
MmTotalSystemCodePages;
01415 LocalPerformanceInfo.TotalSystemDriverPages =
MmTotalSystemDriverPages;
01416
01417
01418
01419
01420
01421 LocalPerformanceInfo.IdleProcessTime.QuadPart =
01422 UInt32x32To64(
PsIdleProcess->
Pcb.
KernelTime,
01423 KeMaximumIncrement);
01424
01425
01426
01427
01428
01429 LocalPerformanceInfo.PagedPoolPages = 0;
01430 LocalPerformanceInfo.NonPagedPoolPages = 0;
01431 LocalPerformanceInfo.PagedPoolAllocs = 0;
01432 LocalPerformanceInfo.PagedPoolFrees = 0;
01433 LocalPerformanceInfo.PagedPoolLookasideHits = 0;
01434 LocalPerformanceInfo.NonPagedPoolAllocs = 0;
01435 LocalPerformanceInfo.NonPagedPoolFrees = 0;
01436 LocalPerformanceInfo.NonPagedPoolLookasideHits = 0;
01437
ExQueryPoolUsage( &LocalPerformanceInfo.PagedPoolPages,
01438 &LocalPerformanceInfo.NonPagedPoolPages,
01439 &LocalPerformanceInfo.PagedPoolAllocs,
01440 &LocalPerformanceInfo.PagedPoolFrees,
01441 &LocalPerformanceInfo.PagedPoolLookasideHits,
01442 &LocalPerformanceInfo.NonPagedPoolAllocs,
01443 &LocalPerformanceInfo.NonPagedPoolFrees,
01444 &LocalPerformanceInfo.NonPagedPoolLookasideHits
01445 );
01446
01447
01448
01449
01450
01451 LocalPerformanceInfo.CcFastReadNoWait =
CcFastReadNoWait;
01452 LocalPerformanceInfo.CcFastReadWait =
CcFastReadWait;
01453 LocalPerformanceInfo.CcFastReadResourceMiss =
CcFastReadResourceMiss;
01454 LocalPerformanceInfo.CcFastReadNotPossible =
CcFastReadNotPossible;
01455 LocalPerformanceInfo.CcFastMdlReadNoWait =
CcFastMdlReadNoWait;
01456 LocalPerformanceInfo.CcFastMdlReadWait =
CcFastMdlReadWait;
01457 LocalPerformanceInfo.CcFastMdlReadResourceMiss =
CcFastMdlReadResourceMiss;
01458 LocalPerformanceInfo.CcFastMdlReadNotPossible =
CcFastMdlReadNotPossible;
01459 LocalPerformanceInfo.CcMapDataNoWait =
CcMapDataNoWait;
01460 LocalPerformanceInfo.CcMapDataWait =
CcMapDataWait;
01461 LocalPerformanceInfo.CcMapDataNoWaitMiss =
CcMapDataNoWaitMiss;
01462 LocalPerformanceInfo.CcMapDataWaitMiss =
CcMapDataWaitMiss;
01463 LocalPerformanceInfo.CcPinMappedDataCount =
CcPinMappedDataCount;
01464 LocalPerformanceInfo.CcPinReadNoWait =
CcPinReadNoWait;
01465 LocalPerformanceInfo.CcPinReadWait =
CcPinReadWait;
01466 LocalPerformanceInfo.CcPinReadNoWaitMiss =
CcPinReadNoWaitMiss;
01467 LocalPerformanceInfo.CcPinReadWaitMiss =
CcPinReadWaitMiss;
01468 LocalPerformanceInfo.CcCopyReadNoWait =
CcCopyReadNoWait;
01469 LocalPerformanceInfo.CcCopyReadWait =
CcCopyReadWait;
01470 LocalPerformanceInfo.CcCopyReadNoWaitMiss =
CcCopyReadNoWaitMiss;
01471 LocalPerformanceInfo.CcCopyReadWaitMiss =
CcCopyReadWaitMiss;
01472 LocalPerformanceInfo.CcMdlReadNoWait =
CcMdlReadNoWait;
01473 LocalPerformanceInfo.CcMdlReadWait =
CcMdlReadWait;
01474 LocalPerformanceInfo.CcMdlReadNoWaitMiss =
CcMdlReadNoWaitMiss;
01475 LocalPerformanceInfo.CcMdlReadWaitMiss =
CcMdlReadWaitMiss;
01476 LocalPerformanceInfo.CcReadAheadIos =
CcReadAheadIos;
01477 LocalPerformanceInfo.CcLazyWriteIos =
CcLazyWriteIos;
01478 LocalPerformanceInfo.CcLazyWritePages =
CcLazyWritePages;
01479 LocalPerformanceInfo.CcDataFlushes =
CcDataFlushes;
01480 LocalPerformanceInfo.CcDataPages =
CcDataPages;
01481
01482
#if !defined(NT_UP)
01483
01484
01485
01486
01487
01488
for (i = 0; i < (ULONG)
KeNumberProcessors; i++) {
01489 Prcb =
KiProcessorBlock[i];
01490
01491 LocalPerformanceInfo.CcFastReadNoWait += Prcb->CcFastReadNoWait;
01492 LocalPerformanceInfo.CcFastReadWait += Prcb->CcFastReadWait;
01493 LocalPerformanceInfo.CcFastReadNotPossible += Prcb->CcFastReadNotPossible;
01494 LocalPerformanceInfo.CcCopyReadNoWait += Prcb->CcCopyReadNoWait;
01495 LocalPerformanceInfo.CcCopyReadWait += Prcb->CcCopyReadWait;
01496 LocalPerformanceInfo.CcCopyReadNoWaitMiss += Prcb->CcCopyReadNoWaitMiss;
01497 }
01498
#endif
01499
*PerformanceInfo = LocalPerformanceInfo;
01500
if (ARGUMENT_PRESENT( ReturnLength )) {
01501 *ReturnLength =
sizeof(LocalPerformanceInfo);
01502 }
01503
01504
break;
01505
01506
case SystemProcessorPerformanceInformation:
01507
if (SystemInformationLength <
01508
sizeof( SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION )) {
01509
return STATUS_INFO_LENGTH_MISMATCH;
01510 }
01511
01512 ProcessorPerformanceInfo =
01513 (PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) SystemInformation;
01514
01515 Length = 0;
01516
for (i = 0; i < (ULONG)
KeNumberProcessors; i++) {
01517 Prcb =
KiProcessorBlock[i];
01518
if (Prcb !=
NULL) {
01519
if (SystemInformationLength < Length +
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION))
01520
break;
01521
01522 Length +=
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
01523
01524 ProcessorPerformanceInfo->UserTime.QuadPart =
01525 UInt32x32To64(Prcb->UserTime,
01526 KeMaximumIncrement);
01527
01528 ProcessorPerformanceInfo->KernelTime.QuadPart =
01529 UInt32x32To64(Prcb->KernelTime,
01530 KeMaximumIncrement);
01531
01532 ProcessorPerformanceInfo->DpcTime.QuadPart =
01533 UInt32x32To64(Prcb->DpcTime,
01534 KeMaximumIncrement);
01535
01536 ProcessorPerformanceInfo->InterruptTime.QuadPart =
01537 UInt32x32To64(Prcb->InterruptTime,
01538 KeMaximumIncrement);
01539
01540 ProcessorPerformanceInfo->IdleTime.QuadPart =
01541 UInt32x32To64(Prcb->IdleThread->KernelTime,
01542 KeMaximumIncrement);
01543
01544 ProcessorPerformanceInfo->InterruptCount = Prcb->InterruptCount;
01545
01546 ProcessorPerformanceInfo++;
01547 }
01548 }
01549
01550
if (ARGUMENT_PRESENT( ReturnLength )) {
01551 *ReturnLength = Length;
01552 }
01553
01554
break;
01555
01556
case SystemTimeOfDayInformation:
01557
if (SystemInformationLength >
sizeof (SYSTEM_TIMEOFDAY_INFORMATION)) {
01558
return STATUS_INFO_LENGTH_MISMATCH;
01559 }
01560
01561 RtlZeroMemory (&LocalTimeOfDayInfo,
sizeof(LocalTimeOfDayInfo));
01562
KeQuerySystemTime(&LocalTimeOfDayInfo.CurrentTime);
01563 LocalTimeOfDayInfo.BootTime =
KeBootTime;
01564 LocalTimeOfDayInfo.TimeZoneBias =
ExpTimeZoneBias;
01565 LocalTimeOfDayInfo.TimeZoneId =
ExpCurrentTimeZoneId;
01566 LocalTimeOfDayInfo.BootTimeBias =
KeBootTimeBias;
01567 LocalTimeOfDayInfo.SleepTimeBias =
KeInterruptTimeBias;
01568
01569
try {
01570 RtlCopyMemory (
01571 SystemInformation,
01572 &LocalTimeOfDayInfo,
01573 SystemInformationLength
01574 );
01575
01576
if (ARGUMENT_PRESENT(ReturnLength) ) {
01577 *ReturnLength = SystemInformationLength;
01578 }
01579 } except(EXCEPTION_EXECUTE_HANDLER) {
01580
return STATUS_SUCCESS;
01581 }
01582
01583
break;
01584
01585
01586
01587
01588
01589
case SystemTimeAdjustmentInformation:
01590
if (SystemInformationLength !=
sizeof( SYSTEM_QUERY_TIME_ADJUST_INFORMATION )) {
01591
return STATUS_INFO_LENGTH_MISMATCH;
01592 }
01593
01594 TimeAdjustmentInformation =
01595 (PSYSTEM_QUERY_TIME_ADJUST_INFORMATION)SystemInformation;
01596
01597 TimeAdjustmentInformation->TimeAdjustment =
KeTimeAdjustment;
01598 TimeAdjustmentInformation->TimeIncrement =
KeMaximumIncrement;
01599 TimeAdjustmentInformation->Enable =
KeTimeSynchronization;
01600
break;
01601
01602
case SystemSummaryMemoryInformation:
01603
case SystemFullMemoryInformation:
01604
01605
if (SystemInformationLength <
sizeof( SYSTEM_MEMORY_INFORMATION )) {
01606
return STATUS_INFO_LENGTH_MISMATCH;
01607 }
01608
01609
Status =
MmMemoryUsage (SystemInformation,
01610 SystemInformationLength,
01611 (SystemInformationClass == SystemFullMemoryInformation) ? 0 : 1,
01612 &Length);
01613
01614
if (
NT_SUCCESS(Status) && ARGUMENT_PRESENT( ReturnLength )) {
01615 *ReturnLength = Length;
01616 }
01617
break;
01618
01619
case SystemPathInformation:
01620
DbgPrint(
"EX: SystemPathInformation now available via SharedUserData\n" );
01621 DbgBreakPoint();
01622
return STATUS_NOT_IMPLEMENTED;
01623
break;
01624
01625
case SystemProcessInformation:
01626
if (SystemInformationLength <
sizeof( SYSTEM_PROCESS_INFORMATION)) {
01627
return STATUS_INFO_LENGTH_MISMATCH;
01628 }
01629
01630
Status =
ExpGetProcessInformation (SystemInformation,
01631 SystemInformationLength,
01632 &Length,
01633 NULL);
01634
01635
if (
NT_SUCCESS(Status) && ARGUMENT_PRESENT( ReturnLength )) {
01636 *ReturnLength = Length;
01637 }
01638
01639
break;
01640
01641
case SystemSessionProcessInformation:
01642
01643
if (SystemInformationLength <
sizeof( SYSTEM_SESSION_PROCESS_INFORMATION)) {
01644
return STATUS_INFO_LENGTH_MISMATCH;
01645 }
01646
01647 SessionProcessInformation =
01648 (PSYSTEM_SESSION_PROCESS_INFORMATION)SystemInformation;
01649
01650
01651
01652
01653
01654 SessionId = SessionProcessInformation->SessionId;
01655 ProcessInformation = SessionProcessInformation->Buffer;
01656 ProcessInformationLength = SessionProcessInformation->SizeOfBuf;
01657
01658
if (ProcessInformationLength <
sizeof(SYSTEM_PROCESS_INFORMATION)) {
01659
return STATUS_INFO_LENGTH_MISMATCH;
01660 }
01661
01662
if (!POINTER_IS_ALIGNED (ProcessInformation,
sizeof (ULONG))) {
01663
return STATUS_DATATYPE_MISALIGNMENT;
01664 }
01665
01666
Status =
ExpGetProcessInformation (ProcessInformation,
01667 ProcessInformationLength,
01668 &Length,
01669 &SessionId);
01670
01671
if (
NT_SUCCESS(Status) && ARGUMENT_PRESENT( ReturnLength )) {
01672 *ReturnLength = Length;
01673 }
01674
01675
break;
01676
01677
case SystemCallCountInformation:
01678
01679 Length =
sizeof(SYSTEM_CALL_COUNT_INFORMATION) +
01680 (
NUMBER_SERVICE_TABLES *
sizeof(ULONG));
01681
for ( i = 0, Table =
KeServiceDescriptorTableShadow;
01682 i <
NUMBER_SERVICE_TABLES;
01683 i++, Table++ ) {
01684
if ( (Table->Limit != 0) && (Table->Count !=
NULL) ) {
01685 Length += Table->Limit *
sizeof(ULONG);
01686 }
01687 }
01688
01689
if (ARGUMENT_PRESENT( ReturnLength )) {
01690 *ReturnLength = Length;
01691 }
01692
01693
if (SystemInformationLength < Length) {
01694
return STATUS_INFO_LENGTH_MISMATCH;
01695 }
01696
01697 CallCountInformation = (PSYSTEM_CALL_COUNT_INFORMATION)SystemInformation;
01698 CallCountInformation->Length = Length;
01699 CallCountInformation->NumberOfTables =
NUMBER_SERVICE_TABLES;
01700
01701 TableLimit = (PULONG)(CallCountInformation + 1);
01702 TableCounts = TableLimit +
NUMBER_SERVICE_TABLES;
01703
for ( i = 0, Table =
KeServiceDescriptorTableShadow;
01704 i <
NUMBER_SERVICE_TABLES;
01705 i++, Table++ ) {
01706
if ((Table->Limit == 0) || (Table->Count ==
NULL)) {
01707 *TableLimit++ = 0;
01708 }
else {
01709 *TableLimit++ = Table->Limit;
01710 RtlMoveMemory((PVOID)TableCounts,
01711 (PVOID)Table->Count,
01712 Table->Limit *
sizeof(ULONG));
01713 TableCounts += Table->Limit;
01714 }
01715 }
01716
01717
break;
01718
01719
case SystemDeviceInformation:
01720
if (SystemInformationLength !=
sizeof( SYSTEM_DEVICE_INFORMATION )) {
01721
return STATUS_INFO_LENGTH_MISMATCH;
01722 }
01723
01724 ConfigInfo =
IoGetConfigurationInformation();
01725 DeviceInformation = (PSYSTEM_DEVICE_INFORMATION)SystemInformation;
01726 DeviceInformation->NumberOfDisks = ConfigInfo->DiskCount;
01727 DeviceInformation->NumberOfFloppies = ConfigInfo->FloppyCount;
01728 DeviceInformation->NumberOfCdRoms = ConfigInfo->CdRomCount;
01729 DeviceInformation->NumberOfTapes = ConfigInfo->TapeCount;
01730 DeviceInformation->NumberOfSerialPorts = ConfigInfo->SerialCount;
01731 DeviceInformation->NumberOfParallelPorts = ConfigInfo->ParallelCount;
01732
01733
if (ARGUMENT_PRESENT( ReturnLength )) {
01734 *ReturnLength =
sizeof( SYSTEM_DEVICE_INFORMATION );
01735 }
01736
break;
01737
01738
case SystemFlagsInformation:
01739
if (SystemInformationLength !=
sizeof( SYSTEM_FLAGS_INFORMATION )) {
01740
return STATUS_INFO_LENGTH_MISMATCH;
01741 }
01742
01743 ((PSYSTEM_FLAGS_INFORMATION)SystemInformation)->Flags =
NtGlobalFlag;
01744
01745
if (ARGUMENT_PRESENT( ReturnLength )) {
01746 *ReturnLength =
sizeof( SYSTEM_FLAGS_INFORMATION );
01747 }
01748
break;
01749
01750
case SystemCallTimeInformation:
01751
return STATUS_NOT_IMPLEMENTED;
01752
01753
case SystemModuleInformation:
01754
KeEnterCriticalRegion();
01755
ExAcquireResourceExclusive( &PsLoadedModuleResource, TRUE );
01756 ReleaseModuleResoure =
TRUE;
01757
Status =
ExpQueryModuleInformation( &PsLoadedModuleList,
01758 &MmLoadedUserImageList,
01759 (PRTL_PROCESS_MODULES)SystemInformation,
01760 SystemInformationLength,
01761 ReturnLength
01762 );
01763
ExReleaseResource (&PsLoadedModuleResource);
01764 ReleaseModuleResoure =
FALSE;
01765
KeLeaveCriticalRegion();
01766
break;
01767
01768
case SystemLocksInformation:
01769
if (SystemInformationLength <
sizeof( RTL_PROCESS_LOCKS )) {
01770
return STATUS_INFO_LENGTH_MISMATCH;
01771 }
01772
01773
Status =
ExpGetLockInformation (SystemInformation,
01774 SystemInformationLength,
01775 &Length);
01776
01777
if (ARGUMENT_PRESENT( ReturnLength )) {
01778 *ReturnLength = Length;
01779 }
01780
01781
break;
01782
01783
case SystemStackTraceInformation:
01784
if (SystemInformationLength <
sizeof( RTL_PROCESS_BACKTRACES )) {
01785
return STATUS_INFO_LENGTH_MISMATCH;
01786 }
01787
01788
#if i386 && !FPO
01789
Status = ExpGetStackTraceInformation (SystemInformation,
01790 SystemInformationLength,
01791 &Length);
01792
#else
01793
Status = STATUS_NOT_IMPLEMENTED;
01794
#endif // i386 && !FPO
01795
01796
if (ARGUMENT_PRESENT( ReturnLength )) {
01797 *ReturnLength = Length;
01798 }
01799
01800
break;
01801
01802
case SystemPagedPoolInformation:
01803
if (SystemInformationLength <
sizeof( SYSTEM_POOL_INFORMATION )) {
01804
return STATUS_INFO_LENGTH_MISMATCH;
01805 }
01806
01807
Status =
ExpGetPoolInformation( PagedPool,
01808 SystemInformation,
01809 SystemInformationLength,
01810 &Length
01811 );
01812
01813
if (ARGUMENT_PRESENT( ReturnLength )) {
01814 *ReturnLength = Length;
01815 }
01816
break;
01817
01818
case SystemNonPagedPoolInformation:
01819
if (SystemInformationLength <
sizeof( SYSTEM_POOL_INFORMATION )) {
01820
return STATUS_INFO_LENGTH_MISMATCH;
01821 }
01822
01823
Status =
ExpGetPoolInformation( NonPagedPool,
01824 SystemInformation,
01825 SystemInformationLength,
01826 &Length
01827 );
01828
01829
if (ARGUMENT_PRESENT( ReturnLength )) {
01830 *ReturnLength = Length;
01831 }
01832
break;
01833
01834
case SystemHandleInformation:
01835
if (SystemInformationLength <
sizeof( SYSTEM_HANDLE_INFORMATION )) {
01836
return STATUS_INFO_LENGTH_MISMATCH;
01837 }
01838
01839
Status =
ExpGetHandleInformation( SystemInformation,
01840 SystemInformationLength,
01841 &Length
01842 );
01843
01844
if (ARGUMENT_PRESENT( ReturnLength )) {
01845 *ReturnLength = Length;
01846 }
01847
break;
01848
01849
case SystemObjectInformation:
01850
if (SystemInformationLength <
sizeof( SYSTEM_OBJECTTYPE_INFORMATION )) {
01851
return STATUS_INFO_LENGTH_MISMATCH;
01852 }
01853
01854
Status =
ExpGetObjectInformation( SystemInformation,
01855 SystemInformationLength,
01856 &Length
01857 );
01858
01859
if (ARGUMENT_PRESENT( ReturnLength )) {
01860 *ReturnLength = Length;
01861 }
01862
break;
01863
01864
case SystemPageFileInformation:
01865
01866
if (SystemInformationLength <
sizeof( SYSTEM_PAGEFILE_INFORMATION )) {
01867
return STATUS_INFO_LENGTH_MISMATCH;
01868 }
01869
01870
Status =
MmGetPageFileInformation( SystemInformation,
01871 SystemInformationLength,
01872 &Length
01873 );
01874
01875
if (ARGUMENT_PRESENT( ReturnLength )) {
01876 *ReturnLength = Length;
01877 }
01878
break;
01879
01880
01881
case SystemFileCacheInformation:
01882
01883
01884
01885
01886
01887
01888
if (SystemInformationLength < 12) {
01889
return STATUS_INFO_LENGTH_MISMATCH;
01890 }
01891
01892 FileCache = (PSYSTEM_FILECACHE_INFORMATION)SystemInformation;
01893 FileCache->CurrentSize =
MmSystemCacheWs.
WorkingSetSize <<
PAGE_SHIFT;
01894 FileCache->PeakSize =
MmSystemCacheWs.
PeakWorkingSetSize <<
PAGE_SHIFT;
01895 FileCache->CurrentSizeIncludingTransitionInPages =
MmSystemCacheWs.
WorkingSetSize +
MmTransitionSharedPages;
01896 FileCache->PeakSizeIncludingTransitionInPages =
MmTransitionSharedPagesPeak;
01897 FileCache->PageFaultCount =
MmSystemCacheWs.
PageFaultCount;
01898
01899 i = 12;
01900
if (SystemInformationLength >=
sizeof( SYSTEM_FILECACHE_INFORMATION )) {
01901 i =
sizeof (SYSTEM_FILECACHE_INFORMATION);
01902 FileCache->MinimumWorkingSet =
01903
MmSystemCacheWs.
MinimumWorkingSetSize;
01904 FileCache->MaximumWorkingSet =
01905
MmSystemCacheWs.
MaximumWorkingSetSize;
01906 }
01907
01908
if (ARGUMENT_PRESENT( ReturnLength )) {
01909 *ReturnLength = i;
01910 }
01911
break;
01912
01913
case SystemPoolTagInformation:
01914
01915
#ifdef POOL_TAGGING
01916
if (SystemInformationLength <
sizeof( SYSTEM_POOLTAG_INFORMATION )) {
01917
return STATUS_INFO_LENGTH_MISMATCH;
01918 }
01919
01920
Status =
ExpGetPoolTagInfo (SystemInformation,
01921 SystemInformationLength,
01922 ReturnLength);
01923
#else
01924
return STATUS_NOT_IMPLEMENTED;
01925
#endif //POOL_TAGGING
01926
01927
break;
01928
01929
case SystemVdmInstemulInformation:
01930
#ifdef i386
01931
if (SystemInformationLength <
sizeof( SYSTEM_VDM_INSTEMUL_INFO )) {
01932
return STATUS_INFO_LENGTH_MISMATCH;
01933 }
01934
01935
Status =
ExpGetInstemulInformation(
01936 (PSYSTEM_VDM_INSTEMUL_INFO)SystemInformation
01937 );
01938
01939
if (ARGUMENT_PRESENT( ReturnLength )) {
01940 *ReturnLength =
sizeof(SYSTEM_VDM_INSTEMUL_INFO);
01941 }
01942
#else
01943
Status = STATUS_NOT_IMPLEMENTED;
01944
#endif
01945
break;
01946
01947
case SystemCrashDumpInformation:
01948
01949
if (SystemInformationLength <
sizeof( SYSTEM_CRASH_DUMP_INFORMATION)) {
01950
return STATUS_INFO_LENGTH_MISMATCH;
01951 }
01952
01953
01954
01955
01956
01957
if (!
SeSinglePrivilegeCheck(SeCreatePagefilePrivilege,PreviousMode)) {
01958
return STATUS_ACCESS_DENIED;
01959 }
01960
01961
Status =
MmGetCrashDumpInformation (
01962 (PSYSTEM_CRASH_DUMP_INFORMATION)SystemInformation);
01963
01964
01965
if (
NT_SUCCESS( Status ) ) {
01966
Status =
IoGetCrashDumpInformation (
01967 (PSYSTEM_CRASH_DUMP_INFORMATION)SystemInformation);
01968 }
01969
01970
if (ARGUMENT_PRESENT( ReturnLength )) {
01971 *ReturnLength =
sizeof(SYSTEM_CRASH_DUMP_INFORMATION);
01972 }
01973
01974
break;
01975
01976
01977
01978
01979
01980
01981
01982
01983
case SystemExceptionInformation:
01984
if (SystemInformationLength <
sizeof( SYSTEM_EXCEPTION_INFORMATION)) {
01985
return STATUS_INFO_LENGTH_MISMATCH;
01986 }
01987
01988
if (ARGUMENT_PRESENT( ReturnLength )) {
01989 *ReturnLength =
sizeof(SYSTEM_EXCEPTION_INFORMATION);
01990 }
01991
01992 ExceptionInformation = (PSYSTEM_EXCEPTION_INFORMATION)SystemInformation;
01993
01994
01995
01996
01997
01998
01999
02000
02001 {
02002 ULONG AlignmentFixupCount = 0;
02003 ULONG ExceptionDispatchCount = 0;
02004 ULONG FloatingEmulationCount = 0;
02005 ULONG ByteWordEmulationCount = 0;
02006
02007
for (i = 0; i < (ULONG)
KeNumberProcessors; i += 1) {
02008 Prcb =
KiProcessorBlock[i];
02009
if (Prcb !=
NULL) {
02010 AlignmentFixupCount += Prcb->KeAlignmentFixupCount;
02011 ExceptionDispatchCount += Prcb->KeExceptionDispatchCount;
02012 FloatingEmulationCount += Prcb->KeFloatingEmulationCount;
02013
#if defined(_ALPHA_)
02014
AlignmentFixupCount +=
02015 (ULONG)Prcb->Pcr->PalAlignmentFixupCount;
02016
02017 ByteWordEmulationCount += Prcb->KeByteWordEmulationCount;
02018
#endif // defined(_ALPHA_)
02019
}
02020 }
02021
02022 ExceptionInformation->AlignmentFixupCount = AlignmentFixupCount;
02023 ExceptionInformation->ExceptionDispatchCount = ExceptionDispatchCount;
02024 ExceptionInformation->FloatingEmulationCount = FloatingEmulationCount;
02025 ExceptionInformation->ByteWordEmulationCount = ByteWordEmulationCount;
02026 }
02027
02028
break;
02029
02030
case SystemCrashDumpStateInformation:
02031
02032
if (SystemInformationLength <
sizeof( SYSTEM_CRASH_STATE_INFORMATION)) {
02033
return STATUS_INFO_LENGTH_MISMATCH;
02034 }
02035
02036
Status =
MmGetCrashDumpStateInformation (
02037 (PSYSTEM_CRASH_STATE_INFORMATION)SystemInformation);
02038
02039
if (
NT_SUCCESS( Status ) ) {
02040
if (SystemInformationLength >=
sizeof (SYSTEM_CRASH_STATE_INFORMATION) ) {
02041
Status =
IoGetCrashDumpStateInformation (
02042 (PSYSTEM_CRASH_STATE_INFORMATION)SystemInformation);
02043 }
02044 }
02045
02046
if (ARGUMENT_PRESENT( ReturnLength )) {
02047 *ReturnLength =
sizeof(SYSTEM_CRASH_STATE_INFORMATION);
02048 }
02049
02050
break;
02051
02052
case SystemKernelDebuggerInformation:
02053
02054
if (SystemInformationLength <
sizeof( SYSTEM_KERNEL_DEBUGGER_INFORMATION)) {
02055
return STATUS_INFO_LENGTH_MISMATCH;
02056 }
02057
02058 KernelDebuggerInformation =
02059 (PSYSTEM_KERNEL_DEBUGGER_INFORMATION)SystemInformation;
02060 KernelDebuggerInformation->KernelDebuggerEnabled =
KdDebuggerEnabled;
02061 KernelDebuggerInformation->KernelDebuggerNotPresent =
KdDebuggerNotPresent;
02062
02063
if (ARGUMENT_PRESENT( ReturnLength )) {
02064 *ReturnLength =
sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
02065 }
02066
02067
break;
02068
02069
case SystemContextSwitchInformation:
02070
02071
if (SystemInformationLength <
sizeof( SYSTEM_CONTEXT_SWITCH_INFORMATION)) {
02072
return STATUS_INFO_LENGTH_MISMATCH;
02073 }
02074
02075 ContextSwitchInformation =
02076 (PSYSTEM_CONTEXT_SWITCH_INFORMATION)SystemInformation;
02077
02078
02079
02080
02081
02082
02083 ContextSwitches = 0;
02084
for (i = 0; i < (ULONG)
KeNumberProcessors; i += 1) {
02085 Prcb =
KiProcessorBlock[i];
02086
if (Prcb !=
NULL) {
02087 ContextSwitches += Prcb->KeContextSwitches;
02088 }
02089
02090 }
02091
02092 ContextSwitchInformation->ContextSwitches = ContextSwitches;
02093 ContextSwitchInformation->FindAny =
KeThreadSwitchCounters.
FindAny;
02094 ContextSwitchInformation->FindLast =
KeThreadSwitchCounters.
FindLast;
02095 ContextSwitchInformation->FindIdeal =
KeThreadSwitchCounters.
FindIdeal;
02096 ContextSwitchInformation->IdleAny =
KeThreadSwitchCounters.
IdleAny;
02097 ContextSwitchInformation->IdleCurrent =
KeThreadSwitchCounters.
IdleCurrent;
02098 ContextSwitchInformation->IdleLast =
KeThreadSwitchCounters.
IdleLast;
02099 ContextSwitchInformation->IdleIdeal =
KeThreadSwitchCounters.
IdleIdeal;
02100 ContextSwitchInformation->PreemptAny =
KeThreadSwitchCounters.
PreemptAny;
02101 ContextSwitchInformation->PreemptCurrent =
KeThreadSwitchCounters.
PreemptCurrent;
02102 ContextSwitchInformation->PreemptLast =
KeThreadSwitchCounters.
PreemptLast;
02103 ContextSwitchInformation->SwitchToIdle =
KeThreadSwitchCounters.
SwitchToIdle;
02104
02105
if (ARGUMENT_PRESENT( ReturnLength )) {
02106 *ReturnLength =
sizeof(SYSTEM_CONTEXT_SWITCH_INFORMATION);
02107 }
02108
02109
break;
02110
02111
case SystemRegistryQuotaInformation:
02112
02113
if (SystemInformationLength <
sizeof( SYSTEM_REGISTRY_QUOTA_INFORMATION)) {
02114
return(STATUS_INFO_LENGTH_MISMATCH);
02115 }
02116
CmQueryRegistryQuotaInformation((PSYSTEM_REGISTRY_QUOTA_INFORMATION)SystemInformation);
02117
02118
if (ARGUMENT_PRESENT( ReturnLength )) {
02119 *ReturnLength =
sizeof(SYSTEM_REGISTRY_QUOTA_INFORMATION);
02120 }
02121
break;
02122
02123
case SystemDpcBehaviorInformation:
02124 {
02125 PSYSTEM_DPC_BEHAVIOR_INFORMATION DpcInfo;
02126
02127
02128
02129
02130
if (SystemInformationLength !=
sizeof(SYSTEM_DPC_BEHAVIOR_INFORMATION)) {
02131
return STATUS_INFO_LENGTH_MISMATCH;
02132 }
02133
02134 DpcInfo = (PSYSTEM_DPC_BEHAVIOR_INFORMATION)SystemInformation;
02135
02136
02137
02138
02139
02140
02141
02142
02143 DpcInfo->DpcQueueDepth =
KiMaximumDpcQueueDepth;
02144 DpcInfo->MinimumDpcRate =
KiMinimumDpcRate;
02145 DpcInfo->AdjustDpcThreshold =
KiAdjustDpcThreshold;
02146 DpcInfo->IdealDpcRate =
KiIdealDpcRate;
02147 }
02148
break;
02149
02150
case SystemInterruptInformation:
02151
02152
if (SystemInformationLength < (
sizeof(SYSTEM_INTERRUPT_INFORMATION) *
KeNumberProcessors)) {
02153
return(STATUS_INFO_LENGTH_MISMATCH);
02154 }
02155
02156 InterruptInformation = (PSYSTEM_INTERRUPT_INFORMATION)SystemInformation;
02157
for (i=0; i < (ULONG)
KeNumberProcessors; i++) {
02158 Prcb =
KiProcessorBlock[i];
02159 InterruptInformation->ContextSwitches = Prcb->KeContextSwitches;
02160 InterruptInformation->DpcCount = Prcb->DpcCount;
02161 InterruptInformation->DpcRate = Prcb->DpcRequestRate;
02162 InterruptInformation->TimeIncrement =
KeTimeIncrement;
02163 InterruptInformation->DpcBypassCount = Prcb->DpcBypassCount;
02164 InterruptInformation->ApcBypassCount = Prcb->ApcBypassCount;
02165
02166 ++InterruptInformation;
02167 }
02168
02169
break;
02170
02171
case SystemCurrentTimeZoneInformation:
02172
if (SystemInformationLength <
sizeof( RTL_TIME_ZONE_INFORMATION )) {
02173
return STATUS_INFO_LENGTH_MISMATCH;
02174 }
02175
02176 RtlCopyMemory(SystemInformation,&ExpTimeZoneInformation,
sizeof(ExpTimeZoneInformation));
02177
if (ARGUMENT_PRESENT( ReturnLength )) {
02178 *ReturnLength =
sizeof( RTL_TIME_ZONE_INFORMATION );
02179 }
02180
02181
Status = STATUS_SUCCESS;
02182
break;
02183
02184
02185
02186
02187
02188
02189
case SystemLookasideInformation:
02190
Status =
ExpGetLookasideInformation(SystemInformation,
02191 SystemInformationLength,
02192 &Length);
02193
02194
if (ARGUMENT_PRESENT(ReturnLength)) {
02195 *ReturnLength = Length;
02196 }
02197
02198
break;
02199
02200
case SystemRangeStartInformation:
02201
02202
if ( SystemInformationLength !=
sizeof(ULONG_PTR) ) {
02203
return STATUS_INFO_LENGTH_MISMATCH;
02204 }
02205
02206 *(PULONG_PTR)SystemInformation = (ULONG_PTR)
MmSystemRangeStart;
02207
02208
if (ARGUMENT_PRESENT(ReturnLength) ) {
02209 *ReturnLength =
sizeof(ULONG_PTR);
02210 }
02211
02212
break;
02213
02214
case SystemVerifierInformation:
02215
02216
if (SystemInformationLength <
sizeof( SYSTEM_VERIFIER_INFORMATION )) {
02217
return STATUS_INFO_LENGTH_MISMATCH;
02218 }
02219
02220
Status =
MmGetVerifierInformation( SystemInformation,
02221 SystemInformationLength,
02222 &Length
02223 );
02224
02225
if (ARGUMENT_PRESENT( ReturnLength )) {
02226 *ReturnLength = Length;
02227 }
02228
break;
02229
02230
case SystemLegacyDriverInformation:
02231
if (SystemInformationLength <
sizeof(SYSTEM_LEGACY_DRIVER_INFORMATION)) {
02232
return(STATUS_INFO_LENGTH_MISMATCH);
02233 }
02234 Length = SystemInformationLength;
02235
Status =
ExpQueryLegacyDriverInformation((PSYSTEM_LEGACY_DRIVER_INFORMATION)SystemInformation, &Length);
02236
if (ARGUMENT_PRESENT(ReturnLength)) {
02237 *ReturnLength = Length;
02238 }
02239
break;
02240
02241
default:
02242
02243
02244
02245
02246
02247
return STATUS_INVALID_INFO_CLASS;
02248 }
02249
02250 } except (EXCEPTION_EXECUTE_HANDLER) {
02251
if (ReleaseModuleResoure) {
02252
ExReleaseResource (&PsLoadedModuleResource);
02253
KeLeaveCriticalRegion();
02254 }
02255
02256
Status = GetExceptionCode();
02257 }
02258
02259
return Status;
02260 }