Author: fireball
Date: Sun May 17 21:04:53 2009
New Revision: 40962
URL:
http://svn.reactos.org/svn/reactos?rev=40962&view=rev
Log:
- Implement ProcessIoCounters case in NtQueryInformationProcess. Patch by Dmitry
Chapyshev.
- Turn on I/O operations counter.
Modified:
trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/io/iomgr/iomgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/io/iomgr/iomgr.c?…
==============================================================================
--- trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/io/iomgr/iomgr.c [iso-8859-1] Sun May 17 21:04:53 2009
@@ -31,7 +31,7 @@
POBJECT_TYPE IoFileObjectType = NULL;
extern POBJECT_TYPE IoControllerObjectType;
extern UNICODE_STRING NtSystemRoot;
-BOOLEAN IoCountOperations = FALSE;
+BOOLEAN IoCountOperations = TRUE;
ULONG IoReadOperationCount = 0;
LARGE_INTEGER IoReadTransferCount = {{0, 0}};
ULONG IoWriteOperationCount = 0;
Modified: trunk/reactos/ntoskrnl/ps/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=40…
==============================================================================
--- trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ps/query.c [iso-8859-1] Sun May 17 21:04:53 2009
@@ -72,6 +72,7 @@
PPROCESS_SESSION_INFORMATION SessionInfo =
(PPROCESS_SESSION_INFORMATION)ProcessInformation;
PVM_COUNTERS VmCounters = (PVM_COUNTERS)ProcessInformation;
+ PIO_COUNTERS IoCounters = (PIO_COUNTERS)ProcessInformation;
PROCESS_DEVICEMAP_INFORMATION DeviceMap;
PUNICODE_STRING ImageName;
ULONG Cookie;
@@ -149,11 +150,10 @@
ObDereferenceObject(Process);
break;
- /* Quote limits and I/O Counters: not implemented */
+ /* Quote limits: not implemented */
case ProcessQuotaLimits:
- case ProcessIoCounters:
-
- Length = sizeof(IO_COUNTERS);
+
+ Length = sizeof(QUOTA_LIMITS);
if (ProcessInformationLength != Length)
{
Status = STATUS_INFO_LENGTH_MISMATCH;
@@ -169,7 +169,49 @@
NULL);
if (!NT_SUCCESS(Status)) break;
+ /* TODO: Implement this case */
Status = STATUS_NOT_IMPLEMENTED;
+
+ /* Dereference the process */
+ ObDereferenceObject(Process);
+ break;
+
+ case ProcessIoCounters:
+
+ Length = sizeof(IO_COUNTERS);
+ 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;
+
+ _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 */
ObDereferenceObject(Process);
break;