Skip to content

Commit b854ab1

Browse files
committed
ScyllaTest: do not use SystemSessionProcessInformation
GetOtherOperationCount (and therefore its test, Check_OtherOperationCount) was always failing under WOW64 because the size check for this info class is not correctly implemented for WOW64. Simply remove this query, it was only being used to validate the previously obtained values anyway.
1 parent 417d8d9 commit b854ab1

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

ScyllaTest/main.cpp

+1-40
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ static NTSTATUS GetOtherOperationCount(PULONGLONG otherOperationCount)
4343
{
4444
*otherOperationCount = 0;
4545
ULONGLONG otherOperationCountSystemProcessInformation = 0,
46-
otherOperationCountSystemExtendedProcessInformation = 0,
47-
otherOperationCountSystemSessionProcessInformation = 0;
46+
otherOperationCountSystemExtendedProcessInformation = 0;
4847

4948
// NtQSI(SystemProcessInformation)
5049
ULONG size;
@@ -117,43 +116,6 @@ static NTSTATUS GetOtherOperationCount(PULONGLONG otherOperationCount)
117116
if (!NT_SUCCESS(status))
118117
return status;
119118

120-
// NtQSI(SystemSessionProcessInformation)
121-
SYSTEM_SESSION_PROCESS_INFORMATION sessionProcessInfo = { NtCurrentPeb()->SessionId, sizeof(SYSTEM_SESSION_PROCESS_INFORMATION), &sessionProcessInfo };
122-
status = NtQuerySystemInformation(SystemSessionProcessInformation, &sessionProcessInfo, sizeof(sessionProcessInfo), &sessionProcessInfo.SizeOfBuf);
123-
if (status != STATUS_INFO_LENGTH_MISMATCH)
124-
return status;
125-
sessionProcessInfo.SizeOfBuf *= 2;
126-
sessionProcessInfo.Buffer = RtlAllocateHeap(RtlProcessHeap(), HEAP_ZERO_MEMORY, sessionProcessInfo.SizeOfBuf);
127-
if (SystemProcessInfo == nullptr)
128-
return STATUS_INSUFFICIENT_RESOURCES;
129-
status = NtQuerySystemInformation(SystemSessionProcessInformation, &sessionProcessInfo, sizeof(sessionProcessInfo), nullptr);
130-
if (!NT_SUCCESS(status))
131-
{
132-
RtlFreeHeap(RtlProcessHeap(), 0, sessionProcessInfo.Buffer);
133-
return status;
134-
}
135-
136-
entry = (PSYSTEM_PROCESS_INFORMATION)sessionProcessInfo.Buffer;
137-
status = STATUS_NOT_FOUND;
138-
139-
while (true)
140-
{
141-
if (entry->UniqueProcessId == NtCurrentTeb()->ClientId.UniqueProcess)
142-
{
143-
otherOperationCountSystemSessionProcessInformation = entry->OtherOperationCount.QuadPart;
144-
status = STATUS_SUCCESS;
145-
break;
146-
}
147-
148-
if (entry->NextEntryOffset == 0)
149-
break;
150-
entry = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)entry + entry->NextEntryOffset);
151-
}
152-
153-
RtlFreeHeap(RtlProcessHeap(), 0, sessionProcessInfo.Buffer);
154-
if (!NT_SUCCESS(status))
155-
return status;
156-
157119
// NtQIP(IoCounters)
158120
IO_COUNTERS ioCounters;
159121
status = NtQueryInformationProcess(g_proc_handle, ProcessIoCounters, &ioCounters, sizeof(ioCounters), nullptr);
@@ -162,7 +124,6 @@ static NTSTATUS GetOtherOperationCount(PULONGLONG otherOperationCount)
162124

163125
// All four counts should be the same
164126
if (otherOperationCountSystemProcessInformation != otherOperationCountSystemExtendedProcessInformation ||
165-
otherOperationCountSystemProcessInformation != otherOperationCountSystemSessionProcessInformation ||
166127
otherOperationCountSystemProcessInformation != ioCounters.OtherOperationCount)
167128
return STATUS_DATA_NOT_ACCEPTED;
168129

0 commit comments

Comments
 (0)