Skip to content

Commit

Permalink
[SETUP:REACTOS][SYSSETUP] Fix Shift-F10 cmd.exe invocation.
Browse files Browse the repository at this point in the history
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-processthreadsapi-createprocessw#parameters
  • Loading branch information
HBelusca committed Dec 24, 2024
1 parent d7f1a78 commit 3b80016
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions base/setup/reactos/reactos.c
Original file line number Diff line number Diff line change
Expand Up @@ -2762,19 +2762,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 (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,
Expand Down
8 changes: 4 additions & 4 deletions dll/win32/syssetup/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3b80016

Please sign in to comment.