mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
d0d86ab588
NtQueryInformationToken is by far the only system call in NT where ReturnLength simply cannot be optional. On Windows this parameter is always probed and an argument to NULL directly leads to an access violation exception. This is due to the fact of how tokens work, as its information contents (token user, owner, primary group, et al) are dynamic and can vary throughout over time in memory. What happens on current ReactOS master however is that ReturnLength is only probed if the parameter is not NULL. On a NULL case scenario the probing checks succeed and NtQueryInformationToken fails later. For this, just get rid of CompleteProbing parameter and opt in for a bit mask flag based approach, with ICIF_FORCE_RETURN_LENGTH_PROBE being set on DefaultQueryInfoBufferCheck which NtQueryInformationToken calls it to do sanity checks. In addition to that... - Document the ICIF probe helpers - Annotate the ICIF prope helpers with SAL - With the riddance of CompleteProbing and adoption of flags based approach, add ICIF_PROBE_READ_WRITE and ICIF_PROBE_READ flags alongside with ICIF_FORCE_RETURN_LENGTH_PROBE
47 lines
1.5 KiB
C
47 lines
1.5 KiB
C
/*
|
|
* PROJECT: ReactOS Kernel
|
|
* LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
|
|
* PURPOSE: Internal header for information classes info interface
|
|
* COPYRIGHT: Copyright 2020-2022 George Bișoc <george.bisoc@reactos.org>
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
/*
|
|
* Implement generic information class probing code in a
|
|
* separate header within the NT kernel header internals.
|
|
* This makes it accessible to other sources by including
|
|
* the header.
|
|
*/
|
|
|
|
#define ICIF_NONE 0x0
|
|
#define ICIF_QUERY 0x1
|
|
#define ICIF_SET 0x2
|
|
#define ICIF_QUERY_SIZE_VARIABLE 0x4
|
|
#define ICIF_SET_SIZE_VARIABLE 0x8
|
|
#define ICIF_SIZE_VARIABLE (ICIF_QUERY_SIZE_VARIABLE | ICIF_SET_SIZE_VARIABLE)
|
|
|
|
#define ICIF_PROBE_READ_WRITE 0x0
|
|
#define ICIF_PROBE_READ 0x1
|
|
#define ICIF_FORCE_RETURN_LENGTH_PROBE 0x2
|
|
|
|
typedef struct _INFORMATION_CLASS_INFO
|
|
{
|
|
USHORT RequiredSizeQUERY;
|
|
UCHAR AlignmentQUERY;
|
|
USHORT RequiredSizeSET;
|
|
UCHAR AlignmentSET;
|
|
USHORT Flags;
|
|
} INFORMATION_CLASS_INFO, *PINFORMATION_CLASS_INFO;
|
|
|
|
#define IQS_SAME(Type, Alignment, Flags) \
|
|
{ sizeof(Type), sizeof(Alignment), sizeof(Type), sizeof(Alignment), Flags }
|
|
|
|
#define IQS(TypeQuery, AlignmentQuery, TypeSet, 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 \
|
|
{ 0, sizeof(CHAR), 0, sizeof(CHAR), ICIF_NONE }
|