Author: amunger Date: Sun Aug 26 11:51:51 2007 New Revision: 28570
URL: http://svn.reactos.org/svn/reactos?rev=28570&view=rev Log: NtQueryInformationProcess: Return STATUS_INFO_LENGTH_MISMATCH where appropriate, and return the needed length in any case. "ntdll_winetest info" now has 5 failures.
Modified: trunk/reactos/ntoskrnl/ps/query.c
Modified: trunk/reactos/ntoskrnl/ps/query.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ps/query.c?rev=285... ============================================================================== --- trunk/reactos/ntoskrnl/ps/query.c (original) +++ trunk/reactos/ntoskrnl/ps/query.c Sun Aug 26 11:51:51 2007 @@ -117,6 +117,14 @@ /* Basic process information */ case ProcessBasicInformation:
+ /* Set return length */ + Length = sizeof(PROCESS_BASIC_INFORMATION); + + if ( ProcessInformationLength != Length ) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } /* Protect writes with SEH */ _SEH_TRY { @@ -130,8 +138,6 @@ (ULONG)Process->InheritedFromUniqueProcessId; ProcessBasicInfo->BasePriority = Process->Pcb.BasePriority;
- /* Set return length */ - Length = sizeof(PROCESS_BASIC_INFORMATION); } _SEH_HANDLE { @@ -144,11 +150,28 @@ /* Quote limits and I/O Counters: not implemented */ case ProcessQuotaLimits: case ProcessIoCounters: + + Length = sizeof(IO_COUNTERS); + if ( ProcessInformationLength != Length ) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + Status = STATUS_NOT_IMPLEMENTED; break;
/* Timing */ case ProcessTimes: + + /* Set the return length */ + Length = sizeof(KERNEL_USER_TIMES); + + if ( ProcessInformationLength != Length ) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + }
/* Protect writes with SEH */ _SEH_TRY @@ -160,9 +183,6 @@ ProcessTime->KernelTime.QuadPart = Process->Pcb.KernelTime * 100000LL; ProcessTime->ExitTime = Process->ExitTime; - - /* Set the return length */ - Length = sizeof(KERNEL_USER_TIMES); } _SEH_HANDLE { @@ -202,6 +222,15 @@
case ProcessHandleCount:
+ /* Set the return length*/ + Length = sizeof(ULONG); + + if ( ProcessInformationLength != Length ) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + } + /* Count the number of handles this process has */ HandleCount = ObpGetHandleCountByHandleTable(Process->ObjectTable);
@@ -210,9 +239,6 @@ { /* Return the count of handles */ *(PULONG)ProcessInformation = HandleCount; - - /* Set the return length*/ - Length = sizeof(ULONG); } _SEH_HANDLE { @@ -249,6 +275,15 @@
/* Virtual Memory Statistics */ case ProcessVmCounters: + + /* Set the return length */ + Length = sizeof(VM_COUNTERS); + + if ( ProcessInformationLength != Length ) + { + Status = STATUS_INFO_LENGTH_MISMATCH; + break; + }
/* Enter SEH for write safety */ _SEH_TRY @@ -266,8 +301,6 @@ VmCounters->PagefileUsage = Process->QuotaUsage[2]; VmCounters->PeakPagefileUsage = Process->QuotaPeak[2];
- /* Set the return length */ - Length = sizeof(VM_COUNTERS); } _SEH_HANDLE {