Skip to content

Commit a167291

Browse files
committed
SetupHelper: Try to terminate ClassicShell Start Menu (to make upgrade a bit easier)
During upgrade from ClassicShell we'll try to terminate ClassicStartMenu.exe as well. So that installer won't complain about files being in use.
1 parent 45ab50e commit a167291

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

Src/Setup/SetupHelper/SetupHelper.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
#include <atlstr.h>
99
#include "ResourceHelper.h"
1010

11-
HINSTANCE g_hInstance;
12-
1311
///////////////////////////////////////////////////////////////////////////////
1412

15-
int ExitStartMenu( void )
13+
int ExitStartMenu(const wchar_t* regPath, const wchar_t* exeName, const wchar_t* updaterClass)
1614
{
1715
HKEY hKey=NULL;
18-
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,L"SOFTWARE\\OpenShell\\OpenShell",0,NULL,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_QUERY_VALUE|KEY_WOW64_64KEY,NULL,&hKey,NULL)==ERROR_SUCCESS)
16+
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,regPath,0,NULL,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_QUERY_VALUE|KEY_WOW64_64KEY,NULL,&hKey,NULL)==ERROR_SUCCESS)
1917
{
2018
DWORD type=0;
2119
wchar_t path[_MAX_PATH];
@@ -25,7 +23,7 @@ int ExitStartMenu( void )
2523
STARTUPINFO startupInfo={sizeof(startupInfo)};
2624
PROCESS_INFORMATION processInfo;
2725
memset(&processInfo,0,sizeof(processInfo));
28-
wcscat_s(path,L"StartMenu.exe");
26+
wcscat_s(path,exeName);
2927
HANDLE h=CreateFile(path,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
3028
if (h!=INVALID_HANDLE_VALUE)
3129
{
@@ -41,12 +39,23 @@ int ExitStartMenu( void )
4139
}
4240
RegCloseKey(hKey);
4341
}
44-
HWND updateOwner=FindWindow(L"OpenShellUpdate.COwnerWindow",NULL);
42+
HWND updateOwner=FindWindow(updaterClass,NULL);
4543
if (updateOwner)
4644
PostMessage(updateOwner,WM_CLEAR,0,0);
4745
return 0;
4846
}
4947

48+
int ExitStartMenu()
49+
{
50+
// terminate Open-Shell Start Menu in clean way
51+
ExitStartMenu(L"SOFTWARE\\OpenShell\\OpenShell", L"StartMenu.exe", L"OpenShellUpdate.COwnerWindow");
52+
53+
// try to terminate also ClassicShell Start Menu (to make upgrade a bit easier)
54+
ExitStartMenu(L"SOFTWARE\\IvoSoft\\ClassicShell", L"ClassicStartMenu.exe", L"ClassicShellUpdate.COwnerWindow");
55+
56+
return 0;
57+
}
58+
5059
int FixVersion( void )
5160
{
5261
HKEY hKey=NULL;
@@ -74,8 +83,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrC
7483
wchar_t *const *params=CommandLineToArgvW(lpstrCmdLine,&count);
7584
if (!params) return 1;
7685

77-
g_hInstance=hInstance;
78-
7986
for (;count>0;count--,params++)
8087
{
8188
if (_wcsicmp(params[0],L"exitSM")==0)

0 commit comments

Comments
 (0)