https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b15963abb821c4557fc84…
commit b15963abb821c4557fc840fa9b1a1b25b4123ade
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Nov 28 03:13:31 2022 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 14 22:51:54 2024 +0200
[NTOS:KDBG] Reintroduce the capability of KdbpCliInit() to interpret the KDBinit file (#4917)
Addendum to commit baa47fa5e.
Similarly to what was originally done, have KdbpCliInterpretInitFile()
parse the KDBinit file by breaking back into the debugger.
But contrary to before, replace the deprecated call to KdbEnter() by
a standard DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C) . This allows
KdbEnterDebuggerException() to do the KdbpCliInterpretInitFile() call.
Additional fixes and improvements:
- Run KdbpCliInterpretInitFile() in full KDBG environment (interrupts
disabled, modified IRQL, own stack), like the usual interactive loop.
- The KDBinit data buffer must be in non-paged pool.
- Demote the "Could not open KDBinit" error to a DPRINT, so that it
doesn't pollute the debug log when the KDBG init function is called
early (before the storage stack is initialized), or if the file
doesn't exist -- since this is an optional feature.
---
ntoskrnl/kdbg/kdb.c | 37 ++++++++++++++++++--------
ntoskrnl/kdbg/kdb.h | 2 +-
ntoskrnl/kdbg/kdb_cli.c | 70 +++++++++++++++++++++++++------------------------
3 files changed, 63 insertions(+), 46 deletions(-)
diff --git a/ntoskrnl/kdbg/kdb.c b/ntoskrnl/kdbg/kdb.c
index bb5b3afe0af..05b8bc0765f 100644
--- a/ntoskrnl/kdbg/kdb.c
+++ b/ntoskrnl/kdbg/kdb.c
@@ -1141,20 +1141,29 @@ KdbpAttachToProcess(
return KdbpAttachToThread(Thread->Cid.UniqueThread);
}
-/*!\brief Calls the main loop ...
- */
+/**
+ * @brief Calls the main interactive debugger loop.
+ **/
static VOID
KdbpCallMainLoop(VOID)
{
KdbpCliMainLoop(KdbEnteredOnSingleStep);
}
-/*!\brief Internal function to enter KDB.
+/**
+ * @brief
+ * Internal function to enter KDBG and run the specified procedure.
*
* Disables interrupts, releases display ownership, ...
- */
+ *
+ * @param[in] Procedure
+ * The procedure to execute under the KDBG environment.
+ * Either execute the main interactive debugger loop (KdbpCallMainLoop)
+ * or run the KDBinit file (KdbpCliInterpretInitFile).
+ **/
static VOID
-KdbpInternalEnter(VOID)
+KdbpInternalEnter(
+ _In_ VOID (*Procedure)(VOID))
{
PETHREAD Thread;
PVOID SavedInitialStack, SavedStackBase, SavedKernelStack;
@@ -1166,7 +1175,7 @@ KdbpInternalEnter(VOID)
if (KdpDebugMode.Screen)
KdpScreenAcquire();
- /* Call the interface's main loop on a different stack */
+ /* Call the specified debugger procedure on a different stack */
Thread = PsGetCurrentThread();
SavedInitialStack = Thread->Tcb.InitialStack;
SavedStackBase = Thread->Tcb.StackBase;
@@ -1179,7 +1188,7 @@ KdbpInternalEnter(VOID)
// KdbPrintf("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n",
// Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);
- KdbpStackSwitchAndCall(KdbStack + KDB_STACK_SIZE - KDB_STACK_RESERVE, KdbpCallMainLoop);
+ KdbpStackSwitchAndCall(KdbStack + KDB_STACK_SIZE - KDB_STACK_RESERVE, Procedure);
Thread->Tcb.InitialStack = SavedInitialStack;
Thread->Tcb.StackBase = SavedStackBase;
@@ -1276,6 +1285,7 @@ KdbEnterDebuggerException(
ULONG OldEflags;
KIRQL OldIrql;
NTSTATUS ExceptionCode;
+ VOID (*EntryPoint)(VOID) = KdbpCallMainLoop;
ExceptionCode = (ExceptionRecord ? ExceptionRecord->ExceptionCode : STATUS_BREAKPOINT);
@@ -1481,11 +1491,15 @@ KdbEnterDebuggerException(
}
else if (ExceptionCode == STATUS_BREAKPOINT)
{
+ /* Do the condition check and banner display only if we enter
+ * from a true code breakpoint. We skip those when running the
+ * KDBinit file, because it is done via an artificial breakpoint. */
if (KdbInitFileBuffer)
{
- KdbpCliInterpretInitFile();
- EnterConditionMet = FALSE;
+ EntryPoint = KdbpCliInterpretInitFile;
+ goto EnterKdbg;
}
+
if (!EnterConditionMet)
{
return kdHandleException;
@@ -1493,6 +1507,7 @@ KdbEnterDebuggerException(
KdbPrintf("\nEntered debugger on embedded INT3 at 0x%04x:0x%p.\n",
Context->SegCs & 0xffff, KeGetContextPc(Context));
+EnterKdbg:;
}
else
{
@@ -1543,8 +1558,8 @@ KdbEnterDebuggerException(
return kdHandleException;
}
- /* Call the main loop */
- KdbpInternalEnter();
+ /* Enter KDBG proper and run either the main loop or the KDBinit file */
+ KdbpInternalEnter(EntryPoint);
/* Check if we should single step */
if (KdbNumSingleSteps > 0)
diff --git a/ntoskrnl/kdbg/kdb.h b/ntoskrnl/kdbg/kdb.h
index df2945a7d9c..b76c4706bc5 100644
--- a/ntoskrnl/kdbg/kdb.h
+++ b/ntoskrnl/kdbg/kdb.h
@@ -61,7 +61,7 @@ typedef enum _KD_CONTINUE_TYPE
/* GLOBALS *******************************************************************/
-extern PCHAR KdbInitFileBuffer;
+extern volatile PCHAR KdbInitFileBuffer;
extern PEPROCESS KdbCurrentProcess;
extern PETHREAD KdbCurrentThread;
diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c
index 08c33d8afb8..852326cff22 100644
--- a/ntoskrnl/kdbg/kdb_cli.c
+++ b/ntoskrnl/kdbg/kdb_cli.c
@@ -134,7 +134,7 @@ static ULONG KdbNumberOfColsPrinted = 0;
static BOOLEAN KdbOutputAborted = FALSE;
static BOOLEAN KdbRepeatLastCommand = FALSE;
-PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */
+volatile PCHAR KdbInitFileBuffer = NULL; /* Buffer where KDBinit file is loaded into during initialization */
BOOLEAN KdbpBugCheckRequested = FALSE;
/* Variables for Dmesg */
@@ -3330,20 +3330,28 @@ KdbpCliMainLoop(
}
}
-/*!\brief This function is called by KdbEnterDebuggerException...
+/**
+ * @brief
+ * Interprets the KDBinit file from the \SystemRoot\System32\drivers\etc
+ * directory, that has been loaded by KdbpCliInit().
*
- * Used to interpret the init file in a context with a trapframe setup
- * (KdbpCliInit call KdbEnter which will call KdbEnterDebuggerException which will
- * call this function if KdbInitFileBuffer is not NULL.
- */
+ * This function is used to interpret the init file in the debugger context
+ * with a trap frame set up. KdbpCliInit() enters the debugger by calling
+ * DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C). In turn, this will call
+ * KdbEnterDebuggerException() which will finally call this function if
+ * KdbInitFileBuffer is not NULL.
+ **/
VOID
KdbpCliInterpretInitFile(VOID)
{
PCHAR p1, p2;
+ p1 = InterlockedExchangePointer((PVOID*)&KdbInitFileBuffer, NULL);
+ if (!p1)
+ return;
+
/* Execute the commands in the init file */
- DPRINT("KDB: Executing KDBinit file...\n");
- p1 = KdbInitFileBuffer;
+ KdbPuts("KDB: Executing KDBinit file...\n");
while (p1[0] != '\0')
{
size_t i = strcspn(p1, "\r\n");
@@ -3360,11 +3368,12 @@ KdbpCliInterpretInitFile(VOID)
if (strncmp(p2, "break", sizeof("break")-1) == 0 &&
(p2[sizeof("break")-1] == '\0' || isspace(p2[sizeof("break")-1])))
{
- /* break into the debugger */
+ /* Run the interactive debugger loop */
KdbpCliMainLoop(FALSE);
}
else if (p2[0] != '#' && p2[0] != '\0') /* Ignore empty lines and comments */
{
+ /* Invoke the command */
KdbpDoCommand(p1);
}
@@ -3375,14 +3384,14 @@ KdbpCliInterpretInitFile(VOID)
while (p1[0] == '\r' || p1[0] == '\n')
p1++;
}
- DPRINT("KDB: KDBinit executed\n");
+ KdbPuts("KDB: KDBinit executed\n");
}
/**
* @brief Called when KDB is initialized.
*
- * Reads the KDBinit file from the SystemRoot\System32\drivers\etc directory
- * and executes it.
+ * Loads the KDBinit file from the \SystemRoot\System32\drivers\etc
+ * directory and interprets it, by calling back into the debugger.
**/
NTSTATUS
KdbpCliInit(VOID)
@@ -3393,9 +3402,8 @@ KdbpCliInit(VOID)
IO_STATUS_BLOCK Iosb;
FILE_STANDARD_INFORMATION FileStdInfo;
HANDLE hFile = NULL;
- INT FileSize;
+ ULONG FileSize;
PCHAR FileBuffer;
- ULONG OldEflags;
/* Don't load the KDBinit file if its buffer is already lying around */
if (KdbInitFileBuffer)
@@ -3416,7 +3424,7 @@ KdbpCliInit(VOID)
FILE_NO_INTERMEDIATE_BUFFERING);
if (!NT_SUCCESS(Status))
{
- DPRINT1("Could not open \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%lx)\n", Status);
+ DPRINT("Could not open %wZ (Status 0x%lx)\n", &FileName, Status);
return Status;
}
@@ -3427,22 +3435,23 @@ KdbpCliInit(VOID)
if (!NT_SUCCESS(Status))
{
ZwClose(hFile);
- DPRINT1("Could not query size of \\SystemRoot\\System32\\drivers\\etc\\KDBinit (Status 0x%lx)\n", Status);
+ DPRINT1("Could not query size of %wZ (Status 0x%lx)\n", &FileName, Status);
return Status;
}
FileSize = FileStdInfo.EndOfFile.u.LowPart;
- /* Allocate memory for the file */
- FileBuffer = ExAllocatePool(PagedPool, FileSize + 1); /* add 1 byte for terminating '\0' */
+ /* Allocate memory for the file (add 1 byte for terminating NUL) */
+ FileBuffer = ExAllocatePool(NonPagedPool, FileSize + 1);
if (!FileBuffer)
{
ZwClose(hFile);
- DPRINT1("Could not allocate %d bytes for KDBinit file\n", FileSize);
+ DPRINT1("Could not allocate %lu bytes for KDBinit file\n", FileSize);
return Status;
}
/* Load file into memory */
- Status = ZwReadFile(hFile, NULL, NULL, NULL, &Iosb, FileBuffer, FileSize, NULL, NULL);
+ Status = ZwReadFile(hFile, NULL, NULL, NULL, &Iosb,
+ FileBuffer, FileSize, NULL, NULL);
ZwClose(hFile);
if (!NT_SUCCESS(Status) && (Status != STATUS_END_OF_FILE))
@@ -3452,20 +3461,13 @@ KdbpCliInit(VOID)
return Status;
}
- FileSize = min(FileSize, (INT)Iosb.Information);
- FileBuffer[FileSize] = '\0';
-
- /* Enter critical section */
- OldEflags = __readeflags();
- _disable();
-
- /* Interpret the init file... */
- KdbInitFileBuffer = FileBuffer;
- //KdbEnter(); // FIXME, see commit baa47fa5e
- KdbInitFileBuffer = NULL;
+ FileSize = min(FileSize, (ULONG)Iosb.Information);
+ FileBuffer[FileSize] = ANSI_NULL;
- /* Leave critical section */
- __writeeflags(OldEflags);
+ /* Interpret the KDBinit file by calling back into the debugger */
+ InterlockedExchangePointer((PVOID*)&KdbInitFileBuffer, FileBuffer);
+ DbgBreakPointWithStatus(DBG_STATUS_CONTROL_C);
+ InterlockedExchangePointer((PVOID*)&KdbInitFileBuffer, NULL);
ExFreePool(FileBuffer);
@@ -3607,7 +3609,7 @@ KdbInitialize(
if (BootPhase >= 2)
{
- /* I/O is now set up for disk access: Read KDB Data */
+ /* I/O is now set up for disk access: load the KDBinit file */
NTSTATUS Status = KdbpCliInit();
/* Schedule an I/O reinitialization if needed */
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b86c4bd522bb82de5bea0…
commit b86c4bd522bb82de5bea068086653186f019d4b5
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Oct 14 20:29:46 2024 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 14 22:51:52 2024 +0200
[NTOS:KDBG] Small improvements for KdbpCliMainLoop() and KdbpDoCommand() (#4917)
- Move the printing pager state reset code (setting the number of
printed rows and columns to zero, and the output aborted flag)
to KdbpDoCommand(). This allows to keep the original behaviour,
while also inheriting it whenever KdbpDoCommand() is invoked
elsewhere (for example, from KdbpCliInterpretInitFile()).
- Use KdbPuts/Printf() instead of KdbpPrint() for the entry banners,
so that they aren't subject to the current printing pager state.
Do the same for the "command unknown" error in KdbpDoCommand().
- Add a "Type 'help' for a list of commands" banner, for the users.
- Replace the do-while-loop with a simple while-loop.
---
ntoskrnl/kdbg/kdb_cli.c | 59 ++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c
index e6a23fc5321..08c33d8afb8 100644
--- a/ntoskrnl/kdbg/kdb_cli.c
+++ b/ntoskrnl/kdbg/kdb_cli.c
@@ -2910,7 +2910,7 @@ KdbpPagerInternal(
KdpInitTerminal();
}
- /* Refresh terminal size each time when number of rows printed is 0 */
+ /* Refresh terminal size each time when number of printed rows is 0 */
if (KdbNumberOfRowsPrinted == 0)
{
KdpUpdateTerminalSize(&KdTermSize);
@@ -3030,7 +3030,7 @@ KdbpPagerInternal(
p[i + 1] = c;
/* Set p to the start of the next line and
- * remember the number of rows/cols printed */
+ * remember the number of printed rows/cols */
p += i;
if (p[0] == '\n')
{
@@ -3205,6 +3205,7 @@ static BOOLEAN
KdbpDoCommand(
IN PCHAR Command)
{
+ BOOLEAN Continue = TRUE;
SIZE_T i;
PCHAR p;
ULONG Argc;
@@ -3238,6 +3239,10 @@ KdbpDoCommand(
if (Argc < 1)
return TRUE;
+ /* Reset the pager state: number of printed rows/cols and aborted output flag */
+ KdbNumberOfRowsPrinted = KdbNumberOfColsPrinted = 0;
+ KdbOutputAborted = FALSE;
+
for (i = 0; i < RTL_NUMBER_OF(KdbDebuggerCommands); i++)
{
if (!KdbDebuggerCommands[i].Name)
@@ -3245,18 +3250,20 @@ KdbpDoCommand(
if (strcmp(KdbDebuggerCommands[i].Name, Argv[0]) == 0)
{
- return KdbDebuggerCommands[i].Fn(Argc, Argv);
+ Continue = KdbDebuggerCommands[i].Fn(Argc, Argv);
+ goto Done;
}
}
/* Now invoke the registered callbacks */
if (KdbpInvokeCliCallbacks(Command, Argc, Argv))
- {
- return TRUE;
- }
+ goto Done;
- KdbpPrint("Command '%s' is unknown.\n", OrigCommand);
- return TRUE;
+ KdbPrintf("Command '%s' is unknown.\n", OrigCommand);
+
+Done:
+ KdbOutputAborted = FALSE;
+ return Continue;
}
/*!\brief KDB Main Loop.
@@ -3267,39 +3274,37 @@ VOID
KdbpCliMainLoop(
IN BOOLEAN EnteredOnSingleStep)
{
- BOOLEAN Continue;
- SIZE_T CmdLen;
+ BOOLEAN Continue = TRUE;
static CHAR Command[1024];
static CHAR LastCommand[1024] = "";
if (EnteredOnSingleStep)
{
if (!KdbSymPrintAddress((PVOID)KeGetContextPc(KdbCurrentTrapFrame), KdbCurrentTrapFrame))
- {
- KdbpPrint("<%p>", KeGetContextPc(KdbCurrentTrapFrame));
- }
+ KdbPrintf("<%p>", KeGetContextPc(KdbCurrentTrapFrame));
- KdbpPrint(": ");
+ KdbPuts(": ");
if (KdbpDisassemble(KeGetContextPc(KdbCurrentTrapFrame), KdbUseIntelSyntax) < 0)
- {
- KdbpPrint("<INVALID>");
- }
- KdbpPrint("\n");
+ KdbPuts("<INVALID>");
+ KdbPuts("\n");
+ }
+ else
+ {
+ /* Preceding this message is one of the "Entered debugger..." banners */
+ // KdbPuts("\nEntered debugger\n");
+ KdbPuts("\nType \"help\" for a list of commands.\n");
}
/* Main loop */
- do
+ while (Continue)
{
- /* Reset the number of rows/cols printed */
- KdbNumberOfRowsPrinted = KdbNumberOfColsPrinted = 0;
-
/*
* Print the prompt and read a command.
* Repeat the last one if the user pressed Enter.
* This reduces the risk of RSI when single-stepping!
*/
// TEMP HACK! Issue an empty string instead of duplicating "kdb:>"
- CmdLen = KdbPrompt(/*KdbPromptStr.Buffer*/"", Command, sizeof(Command));
+ SIZE_T CmdLen = KdbPrompt(/*KdbPromptStr.Buffer*/"", Command, sizeof(Command));
if (CmdLen == 0)
{
/* Nothing received but the user didn't press Enter, retry */
@@ -3320,15 +3325,9 @@ KdbpCliMainLoop(
RtlStringCbCopyA(Command, sizeof(Command), LastCommand);
}
- /* Reset the number of rows/cols printed and output aborted state */
- KdbNumberOfRowsPrinted = KdbNumberOfColsPrinted = 0;
- KdbOutputAborted = FALSE;
-
- /* Call the command */
+ /* Invoke the command */
Continue = KdbpDoCommand(Command);
- KdbOutputAborted = FALSE;
}
- while (Continue);
}
/*!\brief This function is called by KdbEnterDebuggerException...
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=842e40d7cdc508b76b514…
commit 842e40d7cdc508b76b514bd790f6249cf2faaee7
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Mon Oct 14 20:27:38 2024 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Mon Oct 14 22:51:51 2024 +0200
[NTOS:KDBG] Minor code style for the following commits
---
ntoskrnl/kd64/kdtrap.c | 2 +-
ntoskrnl/kdbg/kdb.c | 5 ++---
ntoskrnl/kdbg/kdb_cli.c | 7 ++-----
3 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/ntoskrnl/kd64/kdtrap.c b/ntoskrnl/kd64/kdtrap.c
index dc78b11891e..4cfac2b04b0 100644
--- a/ntoskrnl/kd64/kdtrap.c
+++ b/ntoskrnl/kd64/kdtrap.c
@@ -147,7 +147,7 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame,
/*
* Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or
- * Load/Unload symbols. Make sure it isn't a software breakpoints as those
+ * Load/Unload symbols. Make sure it isn't a software breakpoint as those
* are handled by KdpReport.
*/
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
diff --git a/ntoskrnl/kdbg/kdb.c b/ntoskrnl/kdbg/kdb.c
index 15175d5ca93..bb5b3afe0af 100644
--- a/ntoskrnl/kdbg/kdb.c
+++ b/ntoskrnl/kdbg/kdb.c
@@ -1176,7 +1176,8 @@ KdbpInternalEnter(VOID)
Thread->Tcb.StackLimit = (ULONG_PTR)KdbStack;
Thread->Tcb.KernelStack = (char*)KdbStack + KDB_STACK_SIZE;
- // KdbPrintf("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n", Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);
+ // KdbPrintf("Switching to KDB stack 0x%08x-0x%08x (Current Stack is 0x%08x)\n",
+ // Thread->Tcb.StackLimit, Thread->Tcb.StackBase, Esp);
KdbpStackSwitchAndCall(KdbStack + KDB_STACK_SIZE - KDB_STACK_RESERVE, KdbpCallMainLoop);
@@ -1333,7 +1334,6 @@ KdbEnterDebuggerException(
{
Resume = TRUE; /* Set the resume flag when continuing execution */
}
-
/*
* When a temporary breakpoint is hit we have to make sure that we are
* in the same context in which it was set, otherwise it could happen
@@ -1360,7 +1360,6 @@ KdbEnterDebuggerException(
KdbEnteredOnSingleStep = TRUE;
}
-
/*
* If we hit a breakpoint set by the debugger we set the single step flag,
* ignore the next single step and reenable the breakpoint.
diff --git a/ntoskrnl/kdbg/kdb_cli.c b/ntoskrnl/kdbg/kdb_cli.c
index a8ce312f918..e6a23fc5321 100644
--- a/ntoskrnl/kdbg/kdb_cli.c
+++ b/ntoskrnl/kdbg/kdb_cli.c
@@ -3341,23 +3341,20 @@ VOID
KdbpCliInterpretInitFile(VOID)
{
PCHAR p1, p2;
- INT_PTR i;
- CHAR c;
/* Execute the commands in the init file */
DPRINT("KDB: Executing KDBinit file...\n");
p1 = KdbInitFileBuffer;
while (p1[0] != '\0')
{
- i = strcspn(p1, "\r\n");
+ size_t i = strcspn(p1, "\r\n");
if (i > 0)
{
- c = p1[i];
+ CHAR c = p1[i];
p1[i] = '\0';
/* Look for "break" command and comments */
p2 = p1;
-
while (isspace(p2[0]))
p2++;
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=798ea907848cc8adf4eb2…
commit 798ea907848cc8adf4eb284f192ce2b58c4faba2
Author: Joachim Henze <joachim.henze(a)reactos.org>
AuthorDate: Sun Oct 13 19:23:38 2024 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Sun Oct 13 19:23:38 2024 +0200
[FREELDR] Less outdated version-hardcodes (#7384)
Those haven't been groomed anymore for more than 10 years. We had many thousands of
different freeldr builds with different behavior and bugs each, but nobody ever
did have the slightest motivation to update those hardcoded
FREELOADER_MAJOR_VERSION, FREELOADER_MINOR_VERSION, FREELOADER_PATCH_VERSION
from ver.h. And that is logical, because touching other modules will change the behavior
of freeldr as well, so it is absolutely impossible to groom anything like that correctly.
Instead we should simply do what we started to do in PR7383, which will at least give
some information (the actual sources it was built from) instead of some misleading voodoo-version.
This might slightly shrink the size of freeldr as well, but I was too lazy to measure by how much.
---
boot/freeldr/freeldr/freeldr.c | 10 ----------
boot/freeldr/freeldr/include/ver.h | 17 +++--------------
boot/freeldr/freeldr/ui/tui.c | 2 +-
3 files changed, 4 insertions(+), 25 deletions(-)
diff --git a/boot/freeldr/freeldr/freeldr.c b/boot/freeldr/freeldr/freeldr.c
index c7bac46d93f..bbed7a4139a 100644
--- a/boot/freeldr/freeldr/freeldr.c
+++ b/boot/freeldr/freeldr/freeldr.c
@@ -26,16 +26,6 @@ DBG_DEFAULT_CHANNEL(WARNING);
/* GLOBALS ********************************************************************/
-#define TOSTRING_(X) #X
-#define TOSTRING(X) TOSTRING_(X)
-
-const PCSTR FrLdrVersionString =
-#if (FREELOADER_PATCH_VERSION == 0)
- "FreeLoader v" TOSTRING(FREELOADER_MAJOR_VERSION) "." TOSTRING(FREELOADER_MINOR_VERSION);
-#else
- "FreeLoader v" TOSTRING(FREELOADER_MAJOR_VERSION) "." TOSTRING(FREELOADER_MINOR_VERSION) "." TOSTRING(FREELOADER_PATCH_VERSION);
-#endif
-
CCHAR FrLdrBootPath[MAX_PATH] = "";
/* FUNCTIONS ******************************************************************/
diff --git a/boot/freeldr/freeldr/include/ver.h b/boot/freeldr/freeldr/include/ver.h
index 26cbb1195d9..dcffdc1aec4 100644
--- a/boot/freeldr/freeldr/include/ver.h
+++ b/boot/freeldr/freeldr/include/ver.h
@@ -19,21 +19,10 @@
#pragma once
-/* Just some stuff */
+// FreeLoader version defines
+// If you add features then you increment the minor version
+// If you add major functionality then you increment the major version and zero the minor version
#define VERSION "FreeLoader v3.2"
#define COPYRIGHT "Copyright (C) 1996-" COPYRIGHT_YEAR " ReactOS Project"
#define AUTHOR_EMAIL "<www.reactos.org>"
#define BY_AUTHOR "by ReactOS Project"
-
-// FreeLoader version defines
-//
-// NOTE:
-// If you fix bugs then you increment the patch version
-// If you add features then you increment the minor version and zero the patch version
-// If you add major functionality then you increment the major version and zero the minor & patch versions
-//
-#define FREELOADER_MAJOR_VERSION 3
-#define FREELOADER_MINOR_VERSION 2
-#define FREELOADER_PATCH_VERSION 0
-
-extern const PCSTR FrLdrVersionString;
diff --git a/boot/freeldr/freeldr/ui/tui.c b/boot/freeldr/freeldr/ui/tui.c
index b712820b60a..5960dcd5d44 100644
--- a/boot/freeldr/freeldr/ui/tui.c
+++ b/boot/freeldr/freeldr/ui/tui.c
@@ -293,7 +293,7 @@ VOID TuiDrawBackdrop(VOID)
/* Draw version text */
TuiDrawText(2,
1,
- FrLdrVersionString,
+ VERSION,
ATTR(UiTitleBoxFgColor, UiTitleBoxBgColor));
/* Draw copyright */