_SEH2_TRY
{
/* Probe the buffer */
- ProbeForWrite(ProcessInformation,
- ProcessInformationLength,
- sizeof(ULONG));
+ ProbeForRead(ProcessInformation,
+ ProcessInformationLength,
+ sizeof(ULONG));
/* Probe the return length if required */
if (ReturnLength) ProbeForWriteUlong(ReturnLength);
/* Basic process information */
case ProcessBasicInformation:
- /* Set return length */
- Length = sizeof(PROCESS_BASIC_INFORMATION);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(PROCESS_BASIC_INFORMATION))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set return length */
+ Length = sizeof(PROCESS_BASIC_INFORMATION);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Process quota limits */
case ProcessQuotaLimits:
- Length = sizeof(QUOTA_LIMITS);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(QUOTA_LIMITS))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ Length = sizeof(QUOTA_LIMITS);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessIoCounters:
- Length = sizeof(IO_COUNTERS);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(IO_COUNTERS))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ Length = sizeof(IO_COUNTERS);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessTimes:
/* Set the return length */
- Length = sizeof(KERNEL_USER_TIMES);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(KERNEL_USER_TIMES))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ Length = sizeof(KERNEL_USER_TIMES);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Process Debug Port */
case ProcessDebugPort:
- /* Set return length */
- Length = sizeof(HANDLE);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(HANDLE))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set return length */
+ Length = sizeof(HANDLE);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessHandleCount:
- /* Set the return length*/
- Length = sizeof(ULONG);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length*/
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Session ID for the process */
case ProcessSessionInformation:
- /* Set the return length*/
- Length = sizeof(PROCESS_SESSION_INFORMATION);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(PROCESS_SESSION_INFORMATION))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length*/
+ Length = sizeof(PROCESS_SESSION_INFORMATION);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Hard Error Processing Mode */
case ProcessDefaultHardErrorMode:
- /* Set the return length*/
- Length = sizeof(ULONG);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length*/
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Priority Boosting status */
case ProcessPriorityBoost:
- /* Set the return length */
- Length = sizeof(ULONG);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length */
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* DOS Device Map */
case ProcessDeviceMap:
- /* Set the return length */
- Length = sizeof(PROCESS_DEVICEMAP_INFORMATION);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(PROCESS_DEVICEMAP_INFORMATION))
{
if (ProcessInformationLength == sizeof(PROCESS_DEVICEMAP_INFORMATION_EX))
{
break;
}
+ /* Set the return length */
+ Length = sizeof(PROCESS_DEVICEMAP_INFORMATION);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
/* Priority class */
case ProcessPriorityClass:
- /* Set the return length*/
- Length = sizeof(PROCESS_PRIORITY_CLASS);
-
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(PROCESS_PRIORITY_CLASS))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length*/
+ Length = sizeof(PROCESS_PRIORITY_CLASS);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessDebugFlags:
- /* Set the return length*/
- Length = sizeof(ULONG);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length*/
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessBreakOnTermination:
- /* Set the return length*/
- Length = sizeof(ULONG);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length */
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessImageInformation:
- /* Set the length required and validate it */
- Length = sizeof(SECTION_IMAGE_INFORMATION);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(SECTION_IMAGE_INFORMATION))
{
/* Break out */
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the length required and validate it */
+ Length = sizeof(SECTION_IMAGE_INFORMATION);
+
/* Enter SEH to protect write */
_SEH2_TRY
{
case ProcessDebugObjectHandle:
- /* Set the return length */
- Length = sizeof(HANDLE);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(HANDLE))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length */
+ Length = sizeof(HANDLE);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessLUIDDeviceMapsEnabled:
- /* Set the return length */
- Length = sizeof(ULONG);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length */
+ Length = sizeof(ULONG);
+
/* Indicate success */
Status = STATUS_SUCCESS;
case ProcessWx86Information:
- /* Set the return length */
- Length = sizeof(ULONG);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set the return length */
+ Length = sizeof(ULONG);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessWow64Information:
- /* Set return length */
- Length = sizeof(ULONG_PTR);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG_PTR))
{
- Length = 0;
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set return length */
+ Length = sizeof(ULONG_PTR);
+
/* Reference the process */
Status = ObReferenceObjectByHandle(ProcessHandle,
PROCESS_QUERY_INFORMATION,
case ProcessExecuteFlags:
- /* Set return length */
- Length = sizeof(ULONG);
- if (ProcessInformationLength != Length)
+ if (ProcessInformationLength != sizeof(ULONG))
{
Status = STATUS_INFO_LENGTH_MISMATCH;
break;
}
+ /* Set return length */
+ Length = sizeof(ULONG);
+
if (ProcessHandle != NtCurrentProcess())
{
return STATUS_INVALID_PARAMETER;