https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3b800165b0da7895756a8b...
commit 3b800165b0da7895756a8b88b726a9473f101b87 Author: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org AuthorDate: Wed Oct 30 12:46:17 2024 +0100 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Tue Dec 24 12:22:42 2024 +0100
[SETUP:REACTOS][SYSSETUP] Fix Shift-F10 cmd.exe invocation.
Pressing Shift-F10 to open cmd.exe when the setup program runs from a different current directory than System32, now works correctly.
Use the 2nd CreateProcessW() `lpCommandLine` parameter, instead of the 1st parameter `lpApplicationName`, so as to use default path search. The command-line buffer given to the 2nd-parameter can be temporarily modified by CreateProcessW(), thus use an on-stack buffer.
https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-pro... --- base/setup/reactos/reactos.c | 6 +++--- dll/win32/syssetup/install.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/base/setup/reactos/reactos.c b/base/setup/reactos/reactos.c index fe169bd3ee9..8bdb3df629c 100644 --- a/base/setup/reactos/reactos.c +++ b/base/setup/reactos/reactos.c @@ -2762,7 +2762,6 @@ HotkeyThread(LPVOID Parameter) DPRINT("HotkeyThread start\n");
hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey"); - if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10)) DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
@@ -2770,11 +2769,12 @@ HotkeyThread(LPVOID Parameter) { if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey) { + WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer. STARTUPINFOW si = { sizeof(si) }; PROCESS_INFORMATION pi;
- if (CreateProcessW(L"cmd.exe", - NULL, + if (CreateProcessW(NULL, + CmdLine, NULL, NULL, FALSE, diff --git a/dll/win32/syssetup/install.c b/dll/win32/syssetup/install.c index e7ba620479a..0f6a150da4e 100644 --- a/dll/win32/syssetup/install.c +++ b/dll/win32/syssetup/install.c @@ -1049,19 +1049,19 @@ HotkeyThread(LPVOID Parameter) DPRINT("HotkeyThread start\n");
hotkey = GlobalAddAtomW(L"Setup Shift+F10 Hotkey"); - if (!RegisterHotKey(NULL, hotkey, MOD_SHIFT, VK_F10)) DPRINT1("RegisterHotKey failed with %lu\n", GetLastError());
- while (GetMessage(&msg, NULL, 0, 0)) + while (GetMessageW(&msg, NULL, 0, 0)) { if (msg.hwnd == NULL && msg.message == WM_HOTKEY && msg.wParam == hotkey) { + WCHAR CmdLine[] = L"cmd.exe"; // CreateProcess can modify this buffer. STARTUPINFOW si = { sizeof(si) }; PROCESS_INFORMATION pi;
- if (CreateProcessW(L"cmd.exe", - NULL, + if (CreateProcessW(NULL, + CmdLine, NULL, NULL, FALSE,