mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
1. implemented the ProcessDebugPort class for NtQueryInformationProcess()
2. Probe user mode pointers in NtQueryInformationProcess() and NtSetInformationProcess() svn path=/trunk/; revision=13144
This commit is contained in:
parent
3638fef3ce
commit
f006a0d6f9
1 changed files with 79 additions and 1 deletions
|
@ -1135,6 +1135,36 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
KPROCESSOR_MODE PreviousMode;
|
||||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
/* check for valid buffers */
|
||||
if(PreviousMode == UserMode)
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
/* probe with 32bit alignment */
|
||||
ProbeForWrite(ProcessInformation,
|
||||
ProcessInformationLength,
|
||||
sizeof(ULONG));
|
||||
if(ReturnLength)
|
||||
{
|
||||
ProbeForWrite(ReturnLength,
|
||||
sizeof(ULONG),
|
||||
1);
|
||||
}
|
||||
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TODO: Here we should probably check that ProcessInformationLength
|
||||
|
@ -1223,6 +1253,31 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
break;
|
||||
|
||||
case ProcessDebugPort:
|
||||
{
|
||||
if (ProcessInformationLength != sizeof(ULONG))
|
||||
{
|
||||
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
}
|
||||
else
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
|
||||
*(PHANDLE)ProcessInformation = (Process->DebugPort != NULL ? (HANDLE)-1 : NULL);
|
||||
if (ReturnLength)
|
||||
{
|
||||
*ReturnLength = sizeof(HANDLE);
|
||||
}
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ProcessLdtInformation:
|
||||
case ProcessWorkingSetWatch:
|
||||
case ProcessWx86Information:
|
||||
|
@ -1458,7 +1513,7 @@ NtQueryInformationProcess(IN HANDLE ProcessHandle,
|
|||
_SEH_TRY
|
||||
{
|
||||
DstPath->Length = ProcParams->ImagePathName.Length;
|
||||
DstPath->MaximumLength = DstPath->Length + sizeof(WCHAR);
|
||||
DstPath->MaximumLength = ProcParams->ImagePathName.Length + sizeof(WCHAR);
|
||||
DstPath->Buffer = (PWSTR)(DstPath + 1);
|
||||
|
||||
RtlCopyMemory(DstPath->Buffer, ProcParams->ImagePathName.Buffer, ProcParams->ImagePathName.Length);
|
||||
|
@ -1551,6 +1606,29 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
|
||||
PreviousMode = ExGetPreviousMode();
|
||||
|
||||
/* check for valid buffers */
|
||||
if(PreviousMode == UserMode)
|
||||
{
|
||||
_SEH_TRY
|
||||
{
|
||||
/* probe with 32bit alignment */
|
||||
ProbeForRead(ProcessInformation,
|
||||
ProcessInformationLength,
|
||||
sizeof(ULONG));
|
||||
Status = STATUS_SUCCESS;
|
||||
}
|
||||
_SEH_HANDLE
|
||||
{
|
||||
Status = _SEH_GetExceptionCode();
|
||||
}
|
||||
_SEH_END;
|
||||
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
Status = ObReferenceObjectByHandle(ProcessHandle,
|
||||
PROCESS_SET_INFORMATION,
|
||||
PsProcessType,
|
||||
|
|
Loading…
Reference in a new issue