mirror of
https://github.com/reactos/reactos.git
synced 2025-05-23 19:14:48 +00:00
- Implement ProcessIoCounters case in NtQueryInformationProcess. Patch by Dmitry Chapyshev.
- Turn on I/O operations counter. svn path=/trunk/; revision=40962
This commit is contained in:
parent
dad773b3ca
commit
0d1d176048
2 changed files with 45 additions and 3 deletions
|
@ -31,7 +31,7 @@ POBJECT_TYPE IoDeviceObjectType = NULL;
|
||||||
POBJECT_TYPE IoFileObjectType = NULL;
|
POBJECT_TYPE IoFileObjectType = NULL;
|
||||||
extern POBJECT_TYPE IoControllerObjectType;
|
extern POBJECT_TYPE IoControllerObjectType;
|
||||||
extern UNICODE_STRING NtSystemRoot;
|
extern UNICODE_STRING NtSystemRoot;
|
||||||
BOOLEAN IoCountOperations = FALSE;
|
BOOLEAN IoCountOperations = TRUE;
|
||||||
ULONG IoReadOperationCount = 0;
|
ULONG IoReadOperationCount = 0;
|
||||||
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
|
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
|
||||||
ULONG IoWriteOperationCount = 0;
|
ULONG IoWriteOperationCount = 0;
|
||||||
|
|
|
@ -72,6 +72,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
PPROCESS_SESSION_INFORMATION SessionInfo =
|
PPROCESS_SESSION_INFORMATION SessionInfo =
|
||||||
(PPROCESS_SESSION_INFORMATION)ProcessInformation;
|
(PPROCESS_SESSION_INFORMATION)ProcessInformation;
|
||||||
PVM_COUNTERS VmCounters = (PVM_COUNTERS)ProcessInformation;
|
PVM_COUNTERS VmCounters = (PVM_COUNTERS)ProcessInformation;
|
||||||
|
PIO_COUNTERS IoCounters = (PIO_COUNTERS)ProcessInformation;
|
||||||
PROCESS_DEVICEMAP_INFORMATION DeviceMap;
|
PROCESS_DEVICEMAP_INFORMATION DeviceMap;
|
||||||
PUNICODE_STRING ImageName;
|
PUNICODE_STRING ImageName;
|
||||||
ULONG Cookie;
|
ULONG Cookie;
|
||||||
|
@ -149,8 +150,32 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Quote limits and I/O Counters: not implemented */
|
/* Quote limits: not implemented */
|
||||||
case ProcessQuotaLimits:
|
case ProcessQuotaLimits:
|
||||||
|
|
||||||
|
Length = sizeof(QUOTA_LIMITS);
|
||||||
|
if (ProcessInformationLength != Length)
|
||||||
|
{
|
||||||
|
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reference the process */
|
||||||
|
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||||
|
PROCESS_QUERY_INFORMATION,
|
||||||
|
PsProcessType,
|
||||||
|
PreviousMode,
|
||||||
|
(PVOID*)&Process,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status)) break;
|
||||||
|
|
||||||
|
/* TODO: Implement this case */
|
||||||
|
Status = STATUS_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
|
/* Dereference the process */
|
||||||
|
ObDereferenceObject(Process);
|
||||||
|
break;
|
||||||
|
|
||||||
case ProcessIoCounters:
|
case ProcessIoCounters:
|
||||||
|
|
||||||
Length = sizeof(IO_COUNTERS);
|
Length = sizeof(IO_COUNTERS);
|
||||||
|
@ -169,7 +194,24 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status)) break;
|
if (!NT_SUCCESS(Status)) break;
|
||||||
|
|
||||||
Status = STATUS_NOT_IMPLEMENTED;
|
_SEH2_TRY
|
||||||
|
{
|
||||||
|
IoCounters->ReadOperationCount = Process->ReadOperationCount.QuadPart;
|
||||||
|
IoCounters->ReadTransferCount = Process->ReadTransferCount.QuadPart;
|
||||||
|
IoCounters->WriteOperationCount = Process->WriteOperationCount.QuadPart;
|
||||||
|
IoCounters->WriteTransferCount = Process->WriteTransferCount.QuadPart;
|
||||||
|
IoCounters->OtherOperationCount = Process->OtherOperationCount.QuadPart;
|
||||||
|
IoCounters->OtherTransferCount = Process->OtherTransferCount.QuadPart;
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
/* Ignore exception */
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
|
/* Set status to success in any case */
|
||||||
|
Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
/* Dereference the process */
|
/* Dereference the process */
|
||||||
ObDereferenceObject(Process);
|
ObDereferenceObject(Process);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue