https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2f83e6a65d5878f2ca0f5…
commit 2f83e6a65d5878f2ca0f56bf610eed0da295d9da
Author: Whindmar Saksit <whindsaks(a)proton.me>
AuthorDate: Thu Sep 26 18:06:13 2024 +0200
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Sep 26 18:06:13 2024 +0200
[RAPPS] Use different mutex and title for AppWiz mode (#7350)
The two different modes needs separate mutex and window titles, otherwise you can end
up stuck in AppWiz mode.
---
base/applications/rapps/gui.cpp | 3 +--
base/applications/rapps/unattended.cpp | 8 +++++---
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/base/applications/rapps/gui.cpp b/base/applications/rapps/gui.cpp
index 3ce58a00553..562e383685c 100644
--- a/base/applications/rapps/gui.cpp
+++ b/base/applications/rapps/gui.cpp
@@ -749,8 +749,7 @@ CMainWindow::GetWndClassInfo()
HWND
CMainWindow::Create()
{
- CStringW szWindowName;
- szWindowName.LoadStringW(IDS_APPTITLE);
+ const CStringW szWindowName(MAKEINTRESOURCEW(m_bAppwizMode ? IDS_APPWIZ_TITLE :
IDS_APPTITLE));
RECT r = {
(SettingsInfo.bSaveWndPos ? SettingsInfo.Left : CW_USEDEFAULT),
diff --git a/base/applications/rapps/unattended.cpp
b/base/applications/rapps/unattended.cpp
index 89add7e853d..38c13caeffe 100644
--- a/base/applications/rapps/unattended.cpp
+++ b/base/applications/rapps/unattended.cpp
@@ -349,16 +349,17 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
if (argc == 1 || bAppwizMode) // RAPPS is launched without options or APPWIZ mode is
requested
{
// Check whether the RAPPS MainWindow is already launched in another process
- HANDLE hMutex;
+ CStringW szWindowText(MAKEINTRESOURCEW(bAppwizMode ? IDS_APPWIZ_TITLE :
IDS_APPTITLE));
+ LPCWSTR pszMutex = bAppwizMode ? L"RAPPWIZ" : szWindowClass;
- hMutex = CreateMutexW(NULL, FALSE, szWindowClass);
+ HANDLE hMutex = CreateMutexW(NULL, FALSE, pszMutex);
if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
{
/* If already started, find its window */
HWND hWindow;
for (int wait = 2500, inter = 250; wait > 0; wait -= inter)
{
- if ((hWindow = FindWindowW(szWindowClass, NULL)) != NULL)
+ if ((hWindow = FindWindowW(szWindowClass, szWindowText)) != NULL)
break;
Sleep(inter);
}
@@ -376,6 +377,7 @@ ParseCmdAndExecute(LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int
nCmdShow)
return FALSE;
}
}
+ szWindowText.Empty();
CMainWindow wnd(&db, bAppwizMode);
MainWindowLoop(&wnd, nCmdShow);