diff --git a/ZRColaInstall/ZRColaInstall.props b/ZRColaInstall/ZRColaInstall.props new file mode 100644 index 0000000..984f794 --- /dev/null +++ b/ZRColaInstall/ZRColaInstall.props @@ -0,0 +1,21 @@ + + + + + + ..\output\$(Platform).$(Configuration)\ + false + + + + false + false + Default + false + + + true + + + + \ No newline at end of file diff --git a/ZRColaInstall/ZRColaInstall.rc b/ZRColaInstall/ZRColaInstall.rc new file mode 100644 index 0000000..807a993 Binary files /dev/null and b/ZRColaInstall/ZRColaInstall.rc differ diff --git a/ZRColaInstall/ZRColaInstallSl.vcxproj b/ZRColaInstall/ZRColaInstallSl.vcxproj new file mode 100644 index 0000000..aa60eca --- /dev/null +++ b/ZRColaInstall/ZRColaInstallSl.vcxproj @@ -0,0 +1,74 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A} + Win32Proj + ZRColaInstall + + + + Application + true + Unicode + + + Application + false + true + Unicode + + + + + + + + + + + + + + + + + + + + ZRCOLA_INSTALL_LANG="Sl";%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + ZRCOLA_INSTALL_LANG="Sl";%(PreprocessorDefinitions) + MultiThreaded + + + + + + Create + Create + + + + + + + + + + + + \ No newline at end of file diff --git a/ZRColaInstall/ZRColaInstallSl.vcxproj.filters b/ZRColaInstall/ZRColaInstallSl.vcxproj.filters new file mode 100644 index 0000000..cd37c3b --- /dev/null +++ b/ZRColaInstall/ZRColaInstallSl.vcxproj.filters @@ -0,0 +1,35 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/ZRColaInstall/main.cpp b/ZRColaInstall/main.cpp new file mode 100644 index 0000000..b109cc3 --- /dev/null +++ b/ZRColaInstall/main.cpp @@ -0,0 +1,97 @@ +/* + Copyright 2015-2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#include "stdafx.h" + + +/// +/// Main function +/// +extern "C" void WinMainCRTStartup() +{ + // Load "KERNEL32.DLL". + HMODULE hKernel32 = LoadLibrary(TEXT("KERNEL32.DLL")); + if (!hKernel32) + ExitProcess(1); + + // Get IsWow64Process() address. + BOOL (WINAPI *_IsWow64Process)(__in HANDLE hProcess, __out PBOOL Wow64Process) = (BOOL(WINAPI*)(__in HANDLE, __out PBOOL))::GetProcAddress(hKernel32, "IsWow64Process"); + + BOOL bIs64Bit; +#ifndef _WIN64 + // Determine if this is a 32-bit process under Windows-over-Windows64. + if (_IsWow64Process) { + // See what IsWow64Process() says. + if (!_IsWow64Process(::GetCurrentProcess(), &bIs64Bit)) { + // IsWow64Process() returned an error. Assume not 64-bit Windows. + bIs64Bit = FALSE; + } + } else { + // This platform does not have IsWow64Process(). Therefore, this is definitely not 64-bit Windows. + bIs64Bit = FALSE; + } +#else + // This is a running 64-bit process. The Windows must be 64 bit then. + bIs64Bit = TRUE; +#endif + + FreeLibrary(hKernel32); + + // Get temporary folder path. + static const LPTSTR pszTempFolderDefault = TEXT(""); + LPTSTR pszTempFolder; + DWORD dwLength; + if ((dwLength = GetEnvironmentVariable(TEXT("TEMP"), NULL, 0)) != 0 && + (pszTempFolder = (LPTSTR)LocalAlloc(LMEM_FIXED, (dwLength + 1)*sizeof(TCHAR))) != NULL) // +1 is for trailing backslash when missing! + { + dwLength = ::GetEnvironmentVariable(TEXT("TEMP"), pszTempFolder, dwLength); + + if (pszTempFolder[dwLength - 1] != TEXT('\\')) { + // Append trailing backslash. + pszTempFolder[dwLength ] = TEXT('\\'); + pszTempFolder[dwLength + 1] = 0; + } + } else + pszTempFolder = pszTempFolderDefault; + + // Format msiexec's command line. + LPTSTR pszParams; + DWORD_PTR aArgs[] = { + (DWORD_PTR)TEXT(ZRCOLA_INSTALL_LANG), + (DWORD_PTR)(bIs64Bit ? TEXT("64") : TEXT("32")), + (DWORD_PTR)pszTempFolder, + }; + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_FROM_STRING, + TEXT("/i \"http://www.amebis.si/prenos/ZRCola/_latest/ZRCola%1%2.msi\" /l* \"%3ZRCola%1%2.log\""), + 0, + 0, + (LPTSTR)&pszParams, + 1, + (va_list*)aArgs); + + // Launch installation. + int iResult = (int)ShellExecute(NULL, NULL, TEXT("msiexec.exe"), pszParams, NULL, SW_SHOWNORMAL) > 32; + + // Clean up. + LocalFree(pszParams); + if (pszTempFolder != pszTempFolderDefault) LocalFree(pszTempFolder); + + ExitProcess(iResult ? 0 : 2); +} diff --git a/ZRColaInstall/stdafx.cpp b/ZRColaInstall/stdafx.cpp new file mode 100644 index 0000000..ac111f1 --- /dev/null +++ b/ZRColaInstall/stdafx.cpp @@ -0,0 +1,20 @@ +/* + Copyright 2015-2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#include "stdafx.h" diff --git a/ZRColaInstall/stdafx.h b/ZRColaInstall/stdafx.h new file mode 100644 index 0000000..ce204b1 --- /dev/null +++ b/ZRColaInstall/stdafx.h @@ -0,0 +1,22 @@ +/* + Copyright 2015-2016 Amebis + + This file is part of ZRCola. + + ZRCola is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + ZRCola is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with ZRCola. If not, see . +*/ + +#pragma once + +#include diff --git a/ZRColaUtils.sln b/ZRColaUtils.sln index ae4f509..58c26a9 100644 --- a/ZRColaUtils.sln +++ b/ZRColaUtils.sln @@ -18,6 +18,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stdex", "lib\stdex\build\st EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libZRColaUI", "lib\libZRColaUI\build\libZRColaUI.vcxproj", "{C0A84BD2-3870-4CD6-B281-0AB322E3C579}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ZRColaInstall", "ZRColaInstall", "{7F5D45A3-B3D2-4B1D-B258-9B83395786E6}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZRColaInstallSl", "ZRColaInstall\ZRColaInstallSl.vcxproj", "{0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -64,6 +68,12 @@ Global {C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|Win32.Build.0 = Release|Win32 {C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x64.ActiveCfg = Release|x64 {C0A84BD2-3870-4CD6-B281-0AB322E3C579}.Release|x64.Build.0 = Release|x64 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Debug|Win32.ActiveCfg = Debug|Win32 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Debug|Win32.Build.0 = Debug|Win32 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Debug|x64.ActiveCfg = Debug|Win32 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Release|Win32.ActiveCfg = Release|Win32 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Release|Win32.Build.0 = Release|Win32 + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -73,5 +83,6 @@ Global {A3A36689-AC35-4026-93DA-A3BA0C0E767C} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F} {518777CC-0A59-4415-A12A-82751ED75343} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F} {C0A84BD2-3870-4CD6-B281-0AB322E3C579} = {A7D28E0C-BB96-444D-AAB0-F22A6483FE5F} + {0C2C89C2-C96B-41B6-AA99-7E7741E20F3A} = {7F5D45A3-B3D2-4B1D-B258-9B83395786E6} EndGlobalSection EndGlobal