[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

@ -1628,6 +1628,12 @@ FatalExit(IN int ExitCode)
CHAR Action[2];
DbgPrint("FatalExit...\n\n");
/* Check for reactos specific flag (set by rosautotest) */
if (RtlGetNtGlobalFlags() & FLG_DISABLE_DEBUG_PROMPTS)
{
RtlRaiseStatus(STATUS_FATAL_APP_EXIT);
}
while (TRUE)
{
DbgPrompt("A (Abort), B (Break), I (Ignore)? ", Action, sizeof(Action));

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;

View file

@ -83,7 +83,8 @@ extern POBJECT_TYPE NTSYSAPI PsJobType;
#define FLG_ENABLE_HANDLE_TYPE_TAGGING 0x01000000
#define FLG_HEAP_PAGE_ALLOCS 0x02000000
#define FLG_DEBUG_INITIAL_COMMAND_EX 0x04000000
#define FLG_VALID_BITS 0x07FFFFFF
#define FLG_DISABLE_DEBUG_PROMPTS 0x08000000 // ReactOS-specific
#define FLG_VALID_BITS 0x0FFFFFFF
//
// Flags for NtCreateProcessEx

View file

@ -42,6 +42,12 @@ RtlAssert(IN PVOID FailedAssertion,
(PSTR)FileName,
LineNumber);
/* Check for reactos specific flag (set by rosautotest) */
if (RtlGetNtGlobalFlags() & FLG_DISABLE_DEBUG_PROMPTS)
{
RtlRaiseStatus(STATUS_ASSERTION_FAILURE);
}
/* Prompt for action */
DbgPrompt("Break repeatedly, break Once, Ignore, "
"terminate Process or terminate Thread (boipt)? ",