[RTL][KERNEL32][ROSAUTOTEST] Disable debug prompts during autotest

This fixes timeouts + reboots for user mode assertion failures on the testbots. As a bonus it now shows a backtrace.
This commit is contained in:
Timo Kreuzer 2024-09-10 20:00:24 +03:00
parent 301675c112
commit fd3c571d36
4 changed files with 53 additions and 1 deletions

View file

@ -7,6 +7,8 @@
#include "precomp.h"
#include <cstdio>
#include <ndk/setypes.h>
#include <ndk/exfuncs.h>
CConfiguration Configuration;
@ -43,6 +45,41 @@ IntPrintUsage()
<< " The test to be run. Needs to be a test of the specified module." << endl;
}
static
VOID
SetNtGlobalFlags()
{
ULONG NtGlobalFlags = 0;
BOOLEAN PrivilegeEnabled;
NTSTATUS Status;
/* Enable SeDebugPrivilege */
Status = RtlAdjustPrivilege(SE_DEBUG_PRIVILEGE, TRUE, FALSE, &PrivilegeEnabled);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to enable SeDebugPrivilege: 0x%08lx\n", Status);
return;
}
/* Get current NtGlobalFlags */
Status = NtQuerySystemInformation(SystemFlagsInformation, &NtGlobalFlags, sizeof(NtGlobalFlags), NULL);
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to get NtGlobalFlags: 0x%08lx\n", Status);
return;
}
/* Disable debug prompts */
NtGlobalFlags |= FLG_DISABLE_DEBUG_PROMPTS;
/* Set new NtGlobalFlags */
Status = NtSetSystemInformation(SystemFlagsInformation, &NtGlobalFlags, sizeof(NtGlobalFlags));
if (!NT_SUCCESS(Status))
{
DbgPrint("Failed to set NtGlobalFlags: 0x%08lx\n", Status);
}
}
/**
* Main entry point
*/
@ -51,6 +88,8 @@ wmain(int argc, wchar_t* argv[])
{
int ReturnValue = 1;
SetNtGlobalFlags();
try
{
stringstream ss;