NtQueryInformationProcess:

Return STATUS_INFO_LENGTH_MISMATCH where appropriate, and return the needed length in any case.
"ntdll_winetest info" now has 5 failures.

svn path=/trunk/; revision=28570
This commit is contained in:
Andrew Munger 2007-08-26 07:51:51 +00:00
parent 03f90f222d
commit 63872a8e79

View file

@ -117,6 +117,14 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
/* 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 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
(ULONG)Process->InheritedFromUniqueProcessId;
ProcessBasicInfo->BasePriority = Process->Pcb.BasePriority;
/* Set return length */
Length = sizeof(PROCESS_BASIC_INFORMATION);
}
_SEH_HANDLE
{
@ -144,12 +150,29 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
/* 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 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
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 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
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 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
{
/* Return the count of handles */
*(PULONG)ProcessInformation = HandleCount;
/* Set the return length*/
Length = sizeof(ULONG);
}
_SEH_HANDLE
{
@ -250,6 +276,15 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
/* 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 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
VmCounters->PagefileUsage = Process->QuotaUsage[2];
VmCounters->PeakPagefileUsage = Process->QuotaPeak[2];
/* Set the return length */
Length = sizeof(VM_COUNTERS);
}
_SEH_HANDLE
{