[FREELDR] Show a notice message when booting in debug mode (#7967)

Make FreeLoader print a notice message before it passes the control
to the kernel, if kernel-mode debugging is enabled via boot options.

This can be helpful for people who may forget that they're booting
in debug mode (the default boot option also for the bootcd) and they
need to attach a debugger for the boot process to continue.
This commit is contained in:
Mohammad Amin Mollazadeh
2025-05-14 23:45:11 +03:30
committed by GitHub
parent 947c03e948
commit 0fa49018cd

View File

@@ -1251,6 +1251,33 @@ LoadAndBootWindowsCommon(
/* "Stop all motors", change videomode */
MachPrepareForReactOS();
/* Show the "debug mode" notice if needed */
/* Match KdInitSystem() conditions */
if (!NtLdrGetOption(BootOptions, "CRASHDEBUG") &&
!NtLdrGetOption(BootOptions, "NODEBUG") &&
!!NtLdrGetOption(BootOptions, "DEBUG"))
{
/* Check whether there is a DEBUGPORT option */
PCSTR DebugPort;
ULONG DebugPortLength = 0;
DebugPort = NtLdrGetOptionEx(BootOptions, "DEBUGPORT=", &DebugPortLength);
if (DebugPort != NULL && DebugPortLength > 10)
{
/* Move to the debug port name */
DebugPort += 10; DebugPortLength -= 10;
}
else
{
/* Default to COM */
DebugPort = "COM"; DebugPortLength = 3;
}
/* It is booting in debug mode, show the banner */
TuiPrintf("You need to connect a debugger on port %.*s\n"
"For more information, visit https://reactos.org/wiki/Debugging.\n",
DebugPortLength, DebugPort);
}
/* Debugging... */
//DumpMemoryAllocMap();