Files
Open-Shell-Menu/ClassicStartSrc/ClassicStartSetup/SetupHelper/SetupHelper.cpp
Xenhat 0adcd693e4 Some branding and licensing work (#22)
* Fix stdafx include

* Fix basic handling of "Games" folder on Windows10 RS4 (#10)
This does the following:
- Sets the default state to hidden
- Skips the Games folder when searching

This does not:
- Hide the dead menu entry.

I do not currently know how to actively change the user preference setting to forcefully hide it.

* Add basic Visual Studio gitignore

* Add specific entries to gitignore

* Do not set default menu to Win7 on RS4 (#10)

* Rename "PC Settings" to "Settings" (#12)

* Create distinction between modern and legacy settings in search results

* Add more build artifacts to gitignore

* Add default paths for toolset and build all languages

* Fix several memsize, memtype and nullpointer issues

* create trunk branch containing all changes

* set fallback and next version to 4.3.2, set resource fallback value to allow loading in IDE

* add generated en-US.dll to gitignore

* Don't echo script contents, add disabled "git clean -dfx" to build fresh

* Initial re-branding work (#21)

* Create copy of __MakeFinal to build all languages (Use this file when releasing new versions)

* Move the registry key IvoSoft->Passionate-Coder (#21)

* Change company/mfg name IvoSoft->Passionate-Coder (#21)

* Update some leftover copyright dates (#21)

* Fix accidental copy-paste breaking MakeFinal scripts

* Fix invalid company name for Wix and change registry keys to match the new string (#21)

* Update more copyright and legal text (#21)

* Update RTF files format (Wordpad generated those) (#21)

* update license text in RTF files (#21)
We lost the blue link text in the installer page. Will have to manually re-color all the links later.
2018-06-25 01:42:52 -04:00

92 lines
2.8 KiB
C++

// Classic Shell (c) 2009-2017, Ivo Beltchev
// Classic Start (c) 2017-2018, The Passionate-Coder Team
// Confidential information of Ivo Beltchev. Not for disclosure or distribution without prior written consent from the author
#define STRICT_TYPED_ITEMIDS
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#include <windows.h>
#include <atlstr.h>
#include "ResourceHelper.h"
HINSTANCE g_hInstance;
///////////////////////////////////////////////////////////////////////////////
int ExitStartMenu( void )
{
HKEY hKey=NULL;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,L"SOFTWARE\\PassionateCoder\\ClassicStart",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];
DWORD size=sizeof(path);
if (RegQueryValueEx(hKey,L"Path",0,&type,(BYTE*)path,&size)==ERROR_SUCCESS && type==REG_SZ)
{
STARTUPINFO startupInfo={sizeof(startupInfo)};
PROCESS_INFORMATION processInfo;
memset(&processInfo,0,sizeof(processInfo));
wcscat_s(path,L"ClassicStartMenu.exe");
HANDLE h=CreateFile(path,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (h!=INVALID_HANDLE_VALUE)
{
CloseHandle(h);
wcscat_s(path,L" -exit");
if (CreateProcess(NULL,path,NULL,NULL,TRUE,0,NULL,NULL,&startupInfo,&processInfo))
{
CloseHandle(processInfo.hThread);
WaitForSingleObject(processInfo.hProcess,5000);
CloseHandle(processInfo.hProcess);
}
}
}
RegCloseKey(hKey);
}
HWND updateOwner=FindWindow(L"ClassicStartUpdate.COwnerWindow",NULL);
if (updateOwner)
PostMessage(updateOwner,WM_CLEAR,0,0);
return 0;
}
int FixVersion( void )
{
HKEY hKey=NULL;
if (RegCreateKeyEx(HKEY_LOCAL_MACHINE,L"SOFTWARE\\PassionateCoder\\ClassicStart",0,NULL,REG_OPTION_NON_VOLATILE,KEY_READ|KEY_WRITE|KEY_WOW64_64KEY,NULL,&hKey,NULL)==ERROR_SUCCESS)
{
DWORD winVer=GetVersionEx(GetModuleHandle(L"user32.dll"));
RegSetValueEx(hKey,L"WinVersion",NULL,REG_DWORD,(BYTE*)&winVer,sizeof(DWORD));
RegCloseKey(hKey);
}
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Setup Helper - performs custom actions during Classic Start install/uninstall
// Usage:
// exitSM // exits the start menu if it is running
// fixVersion // sets the correct OS version
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpstrCmdLine, int nCmdShow )
{
// MessageBox(NULL,lpstrCmdLine,L"Command Line",MB_OK|MB_SYSTEMMODAL);
int count;
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)
{
return ExitStartMenu();
}
if (_wcsicmp(params[0],L"fixVersion")==0)
{
return FixVersion();
}
}
return 1;
}