[NTOS:PS] Fix several issues within info classes in AMD64 build

ProcessUserModeIOPL, ProcessWow64Information and ThreadZeroTlsCell classes fail on AMD64 build because of wrong IQS values assigned to them. Also explicitly tell the compiler that ProcessUserModeIOPL is strictly for x86 as user mode I/O privilege level is 32-bit stuff.
In addition to that, implement IQS_NO_TYPE_LENGTH macro which it'll be used for classes such as ProcessUserModeIOPL where type length is not required and that it should be 0. With that said, we indirectly fix a size length mismatch issue with ProcessUserModeIOPL on 32-bit of ReactOS as well.
This commit is contained in:
George Bișoc 2021-06-20 15:46:58 +02:00
parent 59cddd15e2
commit 2791ecd303
No known key found for this signature in database
GPG key ID: 688C4FBE25D7DEF6
3 changed files with 14 additions and 8 deletions

View file

@ -37,5 +37,8 @@ typedef struct _INFORMATION_CLASS_INFO
#define IQS(TypeQuery, AlignmentQuery, TypeSet, AlignmentSet, Flags) \ #define IQS(TypeQuery, AlignmentQuery, TypeSet, AlignmentSet, Flags) \
{ sizeof(TypeQuery), sizeof(AlignmentQuery), sizeof(TypeSet), sizeof(AlignmentSet), Flags } { sizeof(TypeQuery), sizeof(AlignmentQuery), sizeof(TypeSet), sizeof(AlignmentSet), Flags }
#define IQS_NO_TYPE_LENGTH(Alignment, Flags) \
{ 0, sizeof(Alignment), 0, sizeof(Alignment), Flags }
#define IQS_NONE \ #define IQS_NONE \
{ 0, sizeof(CHAR), 0, sizeof(CHAR), ICIF_NONE } { 0, sizeof(CHAR), 0, sizeof(CHAR), ICIF_NONE }

View file

@ -142,13 +142,16 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
ICIF_QUERY | ICIF_SET | ICIF_SET_SIZE_VARIABLE ICIF_QUERY | ICIF_SET | ICIF_SET_SIZE_VARIABLE
), ),
/* ProcessUserModeIOPL */ /* ProcessUserModeIOPL is only implemented in x86 */
IQS_SAME #if defined (_X86_)
IQS_NO_TYPE_LENGTH
( (
UCHAR,
ULONG, ULONG,
ICIF_SET ICIF_SET
), ),
#else
IQS_NONE,
#endif
/* ProcessEnableAlignmentFaultFixup */ /* ProcessEnableAlignmentFaultFixup */
IQS IQS
@ -233,7 +236,7 @@ static const INFORMATION_CLASS_INFO PsProcessInfoClass[] =
/* ProcessWow64Information */ /* ProcessWow64Information */
IQS_SAME IQS_SAME
( (
ULONG, ULONG_PTR,
ULONG, ULONG,
ICIF_QUERY ICIF_QUERY
), ),
@ -443,7 +446,7 @@ static const INFORMATION_CLASS_INFO PsThreadInfoClass[] =
/* ThreadZeroTlsCell */ /* ThreadZeroTlsCell */
IQS_SAME IQS_SAME
( (
ULONG_PTR, ULONG,
ULONG, ULONG,
ICIF_SET ICIF_SET
), ),

View file

@ -1172,7 +1172,7 @@ NtSetInformationProcess(IN HANDLE ProcessHandle,
case ProcessWx86Information: case ProcessWx86Information:
/* Check buffer length */ /* Check buffer length */
if (ProcessInformationLength != sizeof(HANDLE)) if (ProcessInformationLength != sizeof(ULONG))
{ {
Status = STATUS_INFO_LENGTH_MISMATCH; Status = STATUS_INFO_LENGTH_MISMATCH;
break; break;
@ -2439,7 +2439,7 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
case ThreadZeroTlsCell: case ThreadZeroTlsCell:
/* Check buffer length */ /* Check buffer length */
if (ThreadInformationLength != sizeof(ULONG_PTR)) if (ThreadInformationLength != sizeof(ULONG))
{ {
Status = STATUS_INFO_LENGTH_MISMATCH; Status = STATUS_INFO_LENGTH_MISMATCH;
break; break;
@ -2449,7 +2449,7 @@ NtSetInformationThread(IN HANDLE ThreadHandle,
_SEH2_TRY _SEH2_TRY
{ {
/* Get the priority */ /* Get the priority */
TlsIndex = *(PULONG_PTR)ThreadInformation; TlsIndex = *(PULONG)ThreadInformation;
} }
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{ {