Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 0 additions & 92 deletions Src/Setup/Setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
// It unpacks the right installer into the temp directory and executes it.

typedef BOOL (WINAPI *FIsWow64Process)( HANDLE hProcess, PBOOL Wow64Process );
typedef BOOL (WINAPI *FQueryFullProcessImageName)( HANDLE hProcess, DWORD dwFlags, LPTSTR lpExeName, PDWORD lpdwSize );



Expand Down Expand Up @@ -199,32 +198,8 @@ static int ExtractMsi( HINSTANCE hInstance, const wchar_t *msiName, bool b64, bo
return 0;
}

INT_PTR CALLBACK DialogProc( HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
if (uMsg==WM_COMMAND && wParam==IDOK)
{
wchar_t text[256];
GetDlgItemText(hwndDlg,IDC_EDITPWD,text,_countof(text));
CharUpper(text);
if (CalcFNVHash(text)==0xdd7faf06)
EndDialog(hwndDlg,IDOK);
else
MessageBox(hwndDlg,L"Wrong password.",L"Error",MB_OK|MB_ICONERROR);
return TRUE;
}
if (uMsg==WM_COMMAND && wParam==IDCANCEL)
{
EndDialog(hwndDlg,IDCANCEL);
return TRUE;
}
return FALSE;
}

int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow )
{
INITCOMMONCONTROLSEX init={sizeof(init),ICC_STANDARD_CLASSES};
InitCommonControlsEx(&init);

// get installer version
VS_FIXEDFILEINFO *pVer=NULL;
{
Expand All @@ -239,9 +214,6 @@ int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCm
pVer=(VS_FIXEDFILEINFO*)((char*)pRes+40);
}

if (pVer && pVer->dwProductVersionMS==0x20008 && pVer->dwProductVersionLS==0 && DialogBox(hInstance,MAKEINTRESOURCE(IDD_DIALOGPWD),NULL,DialogProc)!=IDOK)
return 0;

int count;
wchar_t *const *params=CommandLineToArgvW(lpCmdLine,&count);
if (!params) count=0;
Expand Down Expand Up @@ -326,70 +298,6 @@ int APIENTRY wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCm
BOOL b64=FALSE;
isWow64Process(GetCurrentProcess(),&b64);

// look for an old version of the classic start menu (2.0.0 or older) and show a warning if it is still running. the uninstaller for such old versions doesn't close the start menu
HWND hwnd=FindWindow(L"ClassicStartMenu.CStartHookWindow",L"StartHookWindow");
if (hwnd)
{
bool bStartMenu=false;

DWORD id;
GetWindowThreadProcessId(hwnd,&id);
HANDLE process=OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,FALSE,id);
if (process)
{
bStartMenu=true;
wchar_t path[_MAX_PATH];
DWORD size=_countof(path);

FQueryFullProcessImageName queryFullProcessImageName=(FQueryFullProcessImageName)GetProcAddress(hKernel32,"QueryFullProcessImageNameW");
if (queryFullProcessImageName && queryFullProcessImageName(process,0,path,&size))
{
DWORD q;
DWORD size=GetFileVersionInfoSize(path,&q);
if (size)
{
std::vector<char> buf(size);
if (GetFileVersionInfo(path,0,size,&buf[0]))
{
VS_FIXEDFILEINFO *pVer;
UINT len;
if (VerQueryValue(&buf[0],L"\\",(void**)&pVer,&len) && pVer->dwProductVersionMS>0x20000)
bStartMenu=false;
}
}
}
CloseHandle(process);
}
if (bStartMenu)
{
wchar_t strTitle[256];
if (!LoadString(hInstance,IDS_APP_TITLE,strTitle,_countof(strTitle))) strTitle[0]=0;
wchar_t strText[1024];
if (!LoadString(hInstance,IDS_OLDSTARTMENU,strText,_countof(strText))) strText[0]=0;
MessageBox(NULL,strText,strTitle,MB_OK|MB_ICONWARNING);
}
}
/*
// warning about being beta
if (!bQuiet)
{
if (MessageBox(NULL,L"Warning!\nThis is a beta version of Open-Shell. It contains features that are not fully tested. Please report any problems in the Open-Shell forums. If you prefer a stable build over the latest features, you can download one of the \"general release\" versions like 3.6.8.\nDo you want to continue with the installation?",L"Open-Shell Setup",MB_YESNO|MB_ICONWARNING)==IDNO)
return 99;
}
*/

DWORD version;
{
HKEY hKey;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,L"SOFTWARE\\OpenShell\\OpenShell",0,KEY_READ|(b64?KEY_WOW64_64KEY:0),&hKey)==ERROR_SUCCESS)
{
DWORD size=sizeof(version);
if (RegQueryValueEx(hKey,L"Version",0,NULL,(BYTE*)&version,&size)!=ERROR_SUCCESS)
version=0;
RegCloseKey(hKey);
}
}

wchar_t msiName[_MAX_PATH];
Sprintf(msiName,_countof(msiName),L"%%ALLUSERSPROFILE%%\\OpenShellSetup%d_%d_%d_%d.msi",b64?64:32,HIWORD(pVer->dwProductVersionMS),LOWORD(pVer->dwProductVersionMS),HIWORD(pVer->dwProductVersionLS));
DoEnvironmentSubst(msiName,_countof(msiName));
Expand Down
36 changes: 0 additions & 36 deletions Src/Setup/Setup.rc
Original file line number Diff line number Diff line change
Expand Up @@ -104,41 +104,6 @@ IDR_MSI_FILE32 MSI_FILE "Temp\\Setup32.msi_"
IDR_MSI_FILE64 MSI_FILE "Temp\\Setup64.msi_"
IDR_MSI_CHECKSUM MSI_FILE "msichecksum.bin"

/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOGPWD DIALOGEX 0, 0, 154, 75
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Open-Shell 2.8.0 (closed beta)"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "This beta version is password-protected. Please enter the password:",IDC_STATIC,7,7,140,17
EDITTEXT IDC_EDITPWD,7,32,140,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,43,54,50,14
PUSHBUTTON "Cancel",IDCANCEL,97,54,50,14
END


/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//

#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO
BEGIN
IDD_DIALOGPWD, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 147
TOPMARGIN, 7
BOTTOMMARGIN, 68
END
END
#endif // APSTUDIO_INVOKED


/////////////////////////////////////////////////////////////////////////////
//
Expand All @@ -148,7 +113,6 @@ END
STRINGTABLE
BEGIN
IDS_APP_TITLE "Open-Shell Setup"
IDS_OLDSTARTMENU "Warning!\nAn old version of the classic start menu is still running. Please close it before installing the new version to avoid crashing Explorer. Right click on the start button and select ""Exit""."
IDS_ERR_CORRUPTED "Failed to extract setup file '%s'. The MSI resource is corrupted."
END

Expand Down
1 change: 0 additions & 1 deletion Src/Setup/Setup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
<None Include="BuildInstaller.bat" />
<None Include="Setup.wxs" />
<None Include="msichecksum.bin" />
<None Include="SetEnvironment.bat" />
<None Include="Temp\Setup32.msi_" />
<None Include="Temp\Setup64.msi_" />
<None Include="__MakeFinal.bat" />
Expand Down
5 changes: 1 addition & 4 deletions Src/Setup/Setup.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@
<None Include="..\Localization\English\OpenShellText-en-US.wxl">
<Filter>Setup Files</Filter>
</None>
<None Include="SetEnvironment.bat">
<Filter>Setup Files</Filter>
</None>
<None Include="Temp\Setup32.msi_" />
<None Include="Temp\Setup64.msi_" />
<None Include="msichecksum.bin" />
</ItemGroup>
</Project>
</Project>
23 changes: 15 additions & 8 deletions Src/Setup/SetupHelper/SetupHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
#include <atlstr.h>
#include "ResourceHelper.h"

HINSTANCE g_hInstance;

///////////////////////////////////////////////////////////////////////////////

int ExitStartMenu( void )
int ExitStartMenu(const wchar_t* regPath, const wchar_t* exeName, const wchar_t* updaterClass)
{
HKEY hKey=NULL;
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)
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)
{
DWORD type=0;
wchar_t path[_MAX_PATH];
Expand All @@ -25,7 +23,7 @@ int ExitStartMenu( void )
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
wcscat_s(path,L"StartMenu.exe");
wcscat_s(path,exeName);
HANDLE h=CreateFile(path,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (h!=INVALID_HANDLE_VALUE)
{
Expand All @@ -41,12 +39,23 @@ int ExitStartMenu( void )
}
RegCloseKey(hKey);
}
HWND updateOwner=FindWindow(L"OpenShellUpdate.COwnerWindow",NULL);
HWND updateOwner=FindWindow(updaterClass,NULL);
if (updateOwner)
PostMessage(updateOwner,WM_CLEAR,0,0);
return 0;
}

int ExitStartMenu()
{
// terminate Open-Shell Start Menu in clean way
ExitStartMenu(L"SOFTWARE\\OpenShell\\OpenShell", L"StartMenu.exe", L"OpenShellUpdate.COwnerWindow");

// try to terminate also ClassicShell Start Menu (to make upgrade a bit easier)
ExitStartMenu(L"SOFTWARE\\IvoSoft\\ClassicShell", L"ClassicStartMenu.exe", L"ClassicShellUpdate.COwnerWindow");

return 0;
}

int FixVersion( void )
{
HKEY hKey=NULL;
Expand Down Expand Up @@ -74,8 +83,6 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrC
wchar_t *const *params=CommandLineToArgvW(lpstrCmdLine,&count);
if (!params) return 1;

g_hInstance=hInstance;

for (;count>0;count--,params++)
{
if (_wcsicmp(params[0],L"exitSM")==0)
Expand Down
2 changes: 0 additions & 2 deletions Src/Setup/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
#define IDS_APP_NAME 100
#define IDS_APP_TITLE 100
#define IDI_APPICON 101
#define IDS_OLDSTARTMENU 101
#define IDS_ERR_CORRUPTED 102
#define IDR_MSI_FILE32 132
#define IDR_MSI_FILE64 164
#define IDS_ERR_INTERNAL 166
#define IDD_DIALOGPWD 166
#define IDS_ERR_EXTRACT 167
#define IDR_MSI_CHECKSUM 167
#define IDS_ERR_WIN7 169
Expand Down