mirror of
https://github.com/reactos/reactos.git
synced 2024-12-26 17:14:41 +00:00
[NTOS:PS] Enable alignment probing for thread/process information classes
In addition to that, here are some stuff done in this commit whilst testing: - ICIF_QUERY_SIZE_VARIABLE and friends were badly misused, they should be used only when an information class whose information length size is dyanmic and not fixed. By removing such flags from erroneous classes, this fixes the STATUS_INFO_LENGTH_MISMATCH testcases. - Use CHAR instead of UCHAR for classes that do not need alignment probing, as every other class in the table do, for the sake of consistency. - ProcessEnableAlignmentFaultFixup uses BOOLEAN as type size, not CHAR. This fixes a testcase failure on ROS. - Check for information length size before proceeding further on querying the process' cookie information. - ProcessHandleTracing wants an alignment of a ULONG, not CHAR. - Move PROCESS_LDT_INFORMATION and PROCESS_LDT_SIZE outside of NTOS_MODE_USER macro case. This fixes a compilation issue when enabling the alignment probing. My mistake of having them inside NTOS_MODE_USER case, sorry. - On functions like NtQueryInformationThread and the Process equivalent, complete probing is not done at the beginning of the function, complete probing including if the buffer is writable alongside with datatype misalignment check that is. Instead such check is done on each information class case basis. With that said, we have to explicitly tell DefaultQueryInfoBufferCheck if we want a complete probing or not initially.
This commit is contained in:
parent
d30a1673d4
commit
a330b56787
11 changed files with 141 additions and 123 deletions
|
@ -333,7 +333,8 @@ NtQueryEvent(IN HANDLE EventHandle,
|
|||
EventInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Invalid buffers */
|
||||
|
|
|
@ -243,7 +243,8 @@ NtQueryMutant(IN HANDLE MutantHandle,
|
|||
MutantInformationLength,
|
||||
ResultLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if(!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtQueryMutant() failed, Status: 0x%x\n", Status);
|
||||
|
|
|
@ -239,7 +239,8 @@ NtQuerySemaphore(IN HANDLE SemaphoreHandle,
|
|||
SemaphoreInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Invalid buffers */
|
||||
|
|
|
@ -536,7 +536,8 @@ NtQueryTimer(IN HANDLE TimerHandle,
|
|||
TimerInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Get the Timer Object */
|
||||
|
|
|
@ -63,7 +63,8 @@ DefaultQueryInfoBufferCheck(ULONG Class,
|
|||
ULONG BufferLength,
|
||||
PULONG ReturnLength,
|
||||
PULONG_PTR ReturnLengthPtr,
|
||||
KPROCESSOR_MODE PreviousMode)
|
||||
KPROCESSOR_MODE PreviousMode,
|
||||
BOOLEAN CompleteProbing)
|
||||
{
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
|
@ -90,9 +91,18 @@ DefaultQueryInfoBufferCheck(ULONG Class,
|
|||
{
|
||||
if (Buffer != NULL)
|
||||
{
|
||||
ProbeForWrite(Buffer,
|
||||
BufferLength,
|
||||
ClassList[Class].AlignmentQUERY);
|
||||
if (!CompleteProbing)
|
||||
{
|
||||
ProbeForRead(Buffer,
|
||||
BufferLength,
|
||||
ClassList[Class].AlignmentQUERY);
|
||||
}
|
||||
else
|
||||
{
|
||||
ProbeForWrite(Buffer,
|
||||
BufferLength,
|
||||
ClassList[Class].AlignmentQUERY);
|
||||
}
|
||||
}
|
||||
|
||||
if (ReturnLength != NULL)
|
||||
|
|
|
@ -19,7 +19,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_BASIC_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessQuotaLimits */
|
||||
|
@ -27,7 +27,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
QUOTA_LIMITS,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessIoCounters */
|
||||
|
@ -35,7 +35,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
IO_COUNTERS,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessVmCounters */
|
||||
|
@ -51,7 +51,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
KERNEL_USER_TIMES,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessBasePriority */
|
||||
|
@ -59,7 +59,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
KPRIORITY,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessRaisePriority */
|
||||
|
@ -67,7 +67,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessDebugPort */
|
||||
|
@ -75,7 +75,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
HANDLE,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessExceptionPort */
|
||||
|
@ -83,7 +83,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
HANDLE,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessAccessToken */
|
||||
|
@ -91,7 +91,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_ACCESS_TOKEN,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessLdtInformation */
|
||||
|
@ -99,7 +99,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_LDT_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessLdtSize */
|
||||
|
@ -107,7 +107,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_LDT_SIZE,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessDefaultHardErrorMode */
|
||||
|
@ -115,7 +115,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessIoPortHandlers */
|
||||
|
@ -123,7 +123,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
UCHAR,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessPooledUsageAndLimits */
|
||||
|
@ -131,7 +131,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
POOLED_USAGE_AND_LIMITS,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessWorkingSetWatch */
|
||||
|
@ -139,7 +139,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_WS_WATCH_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
),
|
||||
|
||||
/* ProcessUserModeIOPL */
|
||||
|
@ -147,17 +147,17 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
UCHAR,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessEnableAlignmentFaultFixup */
|
||||
IQS
|
||||
(
|
||||
CHAR,
|
||||
BOOLEAN,
|
||||
CHAR,
|
||||
BOOLEAN,
|
||||
UCHAR,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
CHAR,
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessPriorityClass */
|
||||
|
@ -167,7 +167,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
ULONG,
|
||||
PROCESS_PRIORITY_CLASS,
|
||||
CHAR,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessWx86Information */
|
||||
|
@ -175,7 +175,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessHandleCount */
|
||||
|
@ -183,7 +183,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessAffinityMask */
|
||||
|
@ -191,7 +191,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
KAFFINITY,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessPriorityBoost */
|
||||
|
@ -199,7 +199,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessDeviceMap */
|
||||
|
@ -209,7 +209,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
ULONG,
|
||||
RTL_FIELD_TYPE(PROCESS_DEVICEMAP_INFORMATION, Set),
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessSessionInformation */
|
||||
|
@ -217,7 +217,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
PROCESS_SESSION_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessForegroundInformation */
|
||||
|
@ -226,8 +226,8 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
CHAR,
|
||||
CHAR,
|
||||
BOOLEAN,
|
||||
UCHAR,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
CHAR,
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessWow64Information */
|
||||
|
@ -235,7 +235,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessImageFileName */
|
||||
|
@ -251,7 +251,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessBreakOnTermination */
|
||||
|
@ -259,7 +259,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessDebugObjectHandle */
|
||||
|
@ -267,7 +267,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
HANDLE,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessDebugFlags */
|
||||
|
@ -275,17 +275,17 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessHandleTracing */
|
||||
IQS
|
||||
(
|
||||
PROCESS_HANDLE_TRACING_QUERY,
|
||||
CHAR,
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessIoPriority */
|
||||
|
@ -301,7 +301,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ProcessTlsInformation */
|
||||
|
@ -317,7 +317,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessImageInformation */
|
||||
|
@ -325,7 +325,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
|
|||
(
|
||||
SECTION_IMAGE_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ProcessCycleTime */
|
||||
|
@ -411,7 +411,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
THREAD_BASIC_INFORMATION,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadTimes */
|
||||
|
@ -419,7 +419,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
KERNEL_USER_TIMES,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadPriority */
|
||||
|
@ -427,7 +427,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
KPRIORITY,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadBasePriority */
|
||||
|
@ -435,7 +435,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
LONG,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadAffinityMask */
|
||||
|
@ -443,7 +443,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
KAFFINITY,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadImpersonationToken */
|
||||
|
@ -451,7 +451,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
HANDLE,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadDescriptorTableEntry is only implemented in x86 as well as the descriptor entry */
|
||||
|
@ -461,7 +461,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
DESCRIPTOR_TABLE_ENTRY,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
#else
|
||||
IQS_NONE,
|
||||
|
@ -474,7 +474,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
CHAR,
|
||||
BOOLEAN,
|
||||
UCHAR,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadEventPair_Reusable */
|
||||
|
@ -492,7 +492,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
ULONG,
|
||||
ULONG_PTR,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadZeroTlsCell */
|
||||
|
@ -500,7 +500,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG_PTR,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadPerformanceCount */
|
||||
|
@ -508,7 +508,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
LARGE_INTEGER,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadAmILastThread */
|
||||
|
@ -516,7 +516,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadIdealProcessor */
|
||||
|
@ -524,7 +524,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG_PTR,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadPriorityBoost */
|
||||
|
@ -534,7 +534,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
ULONG,
|
||||
ULONG_PTR,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadSetTlsArrayAddress */
|
||||
|
@ -550,7 +550,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadHideFromDebugger */
|
||||
|
@ -566,7 +566,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_SET | ICIF_SIZE_VARIABLE
|
||||
ICIF_QUERY | ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadSwitchLegacyState */
|
||||
|
@ -574,7 +574,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_SET | ICIF_SET_SIZE_VARIABLE
|
||||
ICIF_SET
|
||||
),
|
||||
|
||||
/* ThreadIsTerminated */
|
||||
|
@ -582,7 +582,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
|
|||
(
|
||||
ULONG,
|
||||
ULONG,
|
||||
ICIF_QUERY | ICIF_QUERY_SIZE_VARIABLE
|
||||
ICIF_QUERY
|
||||
),
|
||||
|
||||
/* ThreadLastSystemCall */
|
||||
|
|
|
@ -124,6 +124,9 @@ C_ASSERT(MAX_WIN32_PATH == MAX_PATH);
|
|||
#include "internal/probe.h"
|
||||
#include "resource.h"
|
||||
|
||||
/* Internal Ps alignment probing header */
|
||||
#include "internal/ps_i.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma section("INITDATA", read,write,discard)
|
||||
#endif
|
||||
|
|
|
@ -399,7 +399,8 @@ NtQueryIoCompletion(IN HANDLE IoCompletionHandle,
|
|||
IoCompletionInformationLength,
|
||||
ResultLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
|
||||
/* Get the Object */
|
||||
|
|
|
@ -86,26 +86,20 @@ NtQueryInformationProcess(
|
|||
ULONG Flags;
|
||||
PAGED_CODE();
|
||||
|
||||
/* Check for user-mode caller */
|
||||
if (PreviousMode != KernelMode)
|
||||
/* Verify Information Class validity */
|
||||
Status = DefaultQueryInfoBufferCheck(ProcessInformationClass,
|
||||
PsProcessInfoClass,
|
||||
RTL_NUMBER_OF(PsProcessInfoClass),
|
||||
ProcessInformation,
|
||||
ProcessInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Prepare to probe parameters */
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* Probe the buffer */
|
||||
ProbeForRead(ProcessInformation,
|
||||
ProcessInformationLength,
|
||||
sizeof(ULONG));
|
||||
|
||||
/* Probe the return length if required */
|
||||
if (ReturnLength) ProbeForWriteUlong(ReturnLength);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
DPRINT1("NtQueryInformationProcess(): Information verification class failed! (Status -> 0x%lx, ProcessInformationClass -> %lx)\n", Status, ProcessInformationClass);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (((ProcessInformationClass == ProcessCookie) ||
|
||||
|
@ -794,6 +788,13 @@ NtQueryInformationProcess(
|
|||
/* Per-process security cookie */
|
||||
case ProcessCookie:
|
||||
|
||||
if (ProcessInformationLength != sizeof(ULONG))
|
||||
{
|
||||
/* Length size wrong, bail out */
|
||||
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get the current process and cookie */
|
||||
Process = PsGetCurrentProcess();
|
||||
Cookie = Process->Cookie;
|
||||
|
@ -1131,15 +1132,17 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
PAGED_CODE();
|
||||
|
||||
/* Verify Information Class validity */
|
||||
#if 0
|
||||
Status = DefaultSetInfoBufferCheck(ProcessInformationClass,
|
||||
PsProcessInfoClass,
|
||||
RTL_NUMBER_OF(PsProcessInfoClass),
|
||||
ProcessInformation,
|
||||
ProcessInformationLength,
|
||||
PreviousMode);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
#endif
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtSetInformationProcess(): Information verification class failed! (Status -> 0x%lx, ProcessInformationClass -> %lx)\n", Status, ProcessInformationClass);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check what class this is */
|
||||
Access = PROCESS_SET_INFORMATION;
|
||||
|
@ -1846,7 +1849,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
|
|||
case ProcessEnableAlignmentFaultFixup:
|
||||
|
||||
/* Check buffer length */
|
||||
if (ProcessInformationLength != sizeof(ULONG))
|
||||
if (ProcessInformationLength != sizeof(BOOLEAN))
|
||||
{
|
||||
Status = STATUS_INFO_LENGTH_MISMATCH;
|
||||
break;
|
||||
|
@ -2036,15 +2039,17 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
|
|||
PAGED_CODE();
|
||||
|
||||
/* Verify Information Class validity */
|
||||
#if 0
|
||||
Status = DefaultSetInfoBufferCheck(ThreadInformationClass,
|
||||
PsThreadInfoClass,
|
||||
RTL_NUMBER_OF(PsThreadInfoClass),
|
||||
ThreadInformation,
|
||||
ThreadInformationLength,
|
||||
PreviousMode);
|
||||
if (!NT_SUCCESS(Status)) return Status;
|
||||
#endif
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("NtSetInformationThread(): Information verification class failed! (Status -> 0x%lx, ThreadInformationClass -> %lx)\n", Status, ThreadInformationClass);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check what kind of information class this is */
|
||||
switch (ThreadInformationClass)
|
||||
|
@ -2634,26 +2639,20 @@ NtQueryInformationThread(IN HANDLE ThreadHandle,
|
|||
ULONG ThreadTerminated;
|
||||
PAGED_CODE();
|
||||
|
||||
/* Check if we were called from user mode */
|
||||
if (PreviousMode != KernelMode)
|
||||
/* Verify Information Class validity */
|
||||
Status = DefaultQueryInfoBufferCheck(ThreadInformationClass,
|
||||
PsThreadInfoClass,
|
||||
RTL_NUMBER_OF(PsThreadInfoClass),
|
||||
ThreadInformation,
|
||||
ThreadInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode,
|
||||
FALSE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
/* Enter SEH */
|
||||
_SEH2_TRY
|
||||
{
|
||||
/* Probe the buffer */
|
||||
ProbeForWrite(ThreadInformation,
|
||||
ThreadInformationLength,
|
||||
sizeof(ULONG));
|
||||
|
||||
/* Probe the return length if required */
|
||||
if (ReturnLength) ProbeForWriteUlong(ReturnLength);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Return the exception code */
|
||||
_SEH2_YIELD(return _SEH2_GetExceptionCode());
|
||||
}
|
||||
_SEH2_END;
|
||||
DPRINT1("NtQueryInformationThread(): Information verification class failed! (Status -> 0x%lx , ThreadInformationClass -> %lx)\n", Status, ThreadInformationClass);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/* Check what class this is */
|
||||
|
|
|
@ -2400,7 +2400,8 @@ NtQueryInformationToken(
|
|||
TokenInformationLength,
|
||||
ReturnLength,
|
||||
NULL,
|
||||
PreviousMode);
|
||||
PreviousMode,
|
||||
TRUE);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtQueryInformationToken() failed, Status: 0x%x\n", Status);
|
||||
|
|
|
@ -911,18 +911,6 @@ typedef struct _POOLED_USAGE_AND_LIMITS
|
|||
SIZE_T PagefileLimit;
|
||||
} POOLED_USAGE_AND_LIMITS, *PPOOLED_USAGE_AND_LIMITS;
|
||||
|
||||
typedef struct _PROCESS_LDT_INFORMATION
|
||||
{
|
||||
ULONG Start;
|
||||
ULONG Length;
|
||||
LDT_ENTRY LdtEntries[ANYSIZE_ARRAY];
|
||||
} PROCESS_LDT_INFORMATION, *PPROCESS_LDT_INFORMATION;
|
||||
|
||||
typedef struct _PROCESS_LDT_SIZE
|
||||
{
|
||||
ULONG Length;
|
||||
} PROCESS_LDT_SIZE, *PPROCESS_LDT_SIZE;
|
||||
|
||||
typedef struct _PROCESS_WS_WATCH_INFORMATION
|
||||
{
|
||||
PVOID FaultingPc;
|
||||
|
@ -951,6 +939,18 @@ typedef struct _PROCESS_HANDLE_TRACING_QUERY
|
|||
|
||||
#endif
|
||||
|
||||
typedef struct _PROCESS_LDT_INFORMATION
|
||||
{
|
||||
ULONG Start;
|
||||
ULONG Length;
|
||||
LDT_ENTRY LdtEntries[ANYSIZE_ARRAY];
|
||||
} PROCESS_LDT_INFORMATION, *PPROCESS_LDT_INFORMATION;
|
||||
|
||||
typedef struct _PROCESS_LDT_SIZE
|
||||
{
|
||||
ULONG Length;
|
||||
} PROCESS_LDT_SIZE, *PPROCESS_LDT_SIZE;
|
||||
|
||||
typedef struct _PROCESS_PRIORITY_CLASS
|
||||
{
|
||||
BOOLEAN Foreground;
|
||||
|
|
Loading…
Reference in a new issue