- Fix size check in SystemBasicInformation and SystemTimeOfDayInformation.

- Add SEH protection to SystemProcessInformation.
- Implement SystemKernelDebuggerInformation.
- Fix returning of ResultLength in NtQuerySystemInformation.

svn path=/trunk/; revision=17148
This commit is contained in:
Filip Navara 2005-08-07 09:12:10 +00:00
parent 6e9638b203
commit 26d1cb6272

View file

@ -360,7 +360,7 @@ QSI_DEF(SystemBasicInformation)
/* /*
* Check user buffer's size * Check user buffer's size
*/ */
if (Size < sizeof (SYSTEM_BASIC_INFORMATION)) if (Size != sizeof (SYSTEM_BASIC_INFORMATION))
{ {
return (STATUS_INFO_LENGTH_MISMATCH); return (STATUS_INFO_LENGTH_MISMATCH);
} }
@ -539,7 +539,7 @@ QSI_DEF(SystemTimeOfDayInformation)
*ReqSize = sizeof (SYSTEM_TIMEOFDAY_INFORMATION); *ReqSize = sizeof (SYSTEM_TIMEOFDAY_INFORMATION);
/* Check user buffer's size */ /* Check user buffer's size */
if (Size < sizeof (SYSTEM_TIMEOFDAY_INFORMATION)) if (Size != sizeof (SYSTEM_TIMEOFDAY_INFORMATION))
{ {
return STATUS_INFO_LENGTH_MISMATCH; return STATUS_INFO_LENGTH_MISMATCH;
} }
@ -570,7 +570,10 @@ QSI_DEF(SystemProcessInformation)
ULONG ovlSize=0, nThreads; ULONG ovlSize=0, nThreads;
PEPROCESS pr, syspr; PEPROCESS pr, syspr;
unsigned char *pCur; unsigned char *pCur;
NTSTATUS Status;
_SEH_TRY
{
/* scan the process list */ /* scan the process list */
PSYSTEM_PROCESS_INFORMATION Spi PSYSTEM_PROCESS_INFORMATION Spi
@ -646,8 +649,8 @@ QSI_DEF(SystemProcessInformation)
SpiCur->PeakVirtualSize = pr->PeakVirtualSize; SpiCur->PeakVirtualSize = pr->PeakVirtualSize;
SpiCur->VirtualSize = pr->VirtualSize; SpiCur->VirtualSize = pr->VirtualSize;
SpiCur->PageFaultCount = pr->Vm.PageFaultCount; SpiCur->PageFaultCount = pr->Vm.PageFaultCount;
SpiCur->PeakWorkingSetSize = pr->Vm.PeakWorkingSetSize; // Is this right using ->Vm. here ? SpiCur->PeakWorkingSetSize = pr->Vm.PeakWorkingSetSize;
SpiCur->WorkingSetSize = pr->Vm.WorkingSetSize; // Is this right using ->Vm. here ? SpiCur->WorkingSetSize = pr->Vm.WorkingSetSize;
SpiCur->QuotaPeakPagedPoolUsage = pr->QuotaPeak[0]; SpiCur->QuotaPeakPagedPoolUsage = pr->QuotaPeak[0];
SpiCur->QuotaPagedPoolUsage = pr->QuotaUsage[0]; SpiCur->QuotaPagedPoolUsage = pr->QuotaUsage[0];
SpiCur->QuotaPeakNonPagedPoolUsage = pr->QuotaPeak[1]; SpiCur->QuotaPeakNonPagedPoolUsage = pr->QuotaPeak[1];
@ -689,12 +692,19 @@ QSI_DEF(SystemProcessInformation)
} while ((pr != syspr) && (pr != NULL)); } while ((pr != syspr) && (pr != NULL));
if(pr != NULL) if(pr != NULL)
{
ObDereferenceObject(pr); ObDereferenceObject(pr);
Status = STATUS_SUCCESS;
} }
_SEH_HANDLE
{
if(pr != NULL)
ObDereferenceObject(pr);
Status = _SEH_GetExceptionCode();
}
_SEH_END
*ReqSize = ovlSize; *ReqSize = ovlSize;
return (STATUS_SUCCESS); return Status;
} }
/* Class 6 - Call Count Information */ /* Class 6 - Call Count Information */
@ -1213,9 +1223,18 @@ QSI_DEF(SystemCrashDumpStateInformation)
/* Class 35 - Kernel Debugger Information */ /* Class 35 - Kernel Debugger Information */
QSI_DEF(SystemKernelDebuggerInformation) QSI_DEF(SystemKernelDebuggerInformation)
{ {
/* FIXME */ PSYSTEM_KERNEL_DEBUGGER_INFORMATION skdi = (PSYSTEM_KERNEL_DEBUGGER_INFORMATION) Buffer;
DPRINT1("NtQuerySystemInformation - SystemKernelDebuggerInformation not implemented\n");
return (STATUS_NOT_IMPLEMENTED); *ReqSize = sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION);
if (Size < sizeof(SYSTEM_KERNEL_DEBUGGER_INFORMATION))
{
return STATUS_INFO_LENGTH_MISMATCH;
}
skdi->KernelDebuggerEnabled = KD_DEBUGGER_ENABLED;
skdi->KernelDebuggerNotPresent = KD_DEBUGGER_NOT_PRESENT;
return STATUS_SUCCESS;
} }
/* Class 36 - Context Switch Information */ /* Class 36 - Context Switch Information */
@ -1551,11 +1570,10 @@ NtQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS SystemInformationClass,
FStatus = CallQS [SystemInformationClass].Query(SystemInformation, FStatus = CallQS [SystemInformationClass].Query(SystemInformation,
Length, Length,
&ResultLength); &ResultLength);
if (NT_SUCCESS(FStatus) && UnsafeResultLength != NULL) if (UnsafeResultLength != NULL)
{ {
if (PreviousMode != KernelMode) if (PreviousMode != KernelMode)
{ {
FStatus = STATUS_SUCCESS;
_SEH_TRY _SEH_TRY
{ {
*UnsafeResultLength = ResultLength; *UnsafeResultLength = ResultLength;