Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSI setup #209

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 31 additions & 0 deletions NanaZip.sln
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mile.Library.Windows", "Mil
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NanaZip.Shared.Mitigations", "NanaZip.Shared\NanaZip.Shared.Mitigations.vcxproj", "{3B6BA400-CFE5-44E1-A8E3-2DF0CCC5492B}"
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NanaZipSetup", "NanaZipSetup\NanaZipSetup.wixproj", "{CB53F1CA-3FD2-4394-A635-15161C26668A}"
ProjectSection(ProjectDependencies) = postProject
{9A119A76-97CB-4490-B8C2-651576CB9302} = {9A119A76-97CB-4490-B8C2-651576CB9302}
EndProjectSection
EndProject
Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "NanaZipBundle", "NanaZipBundle\NanaZipBundle.wixproj", "{5D871FD0-EBC2-43F6-8BD8-BB7722624500}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Expand Down Expand Up @@ -391,6 +398,30 @@ Global
{3B6BA400-CFE5-44E1-A8E3-2DF0CCC5492B}.Release|x64.Build.0 = Release|x64
{3B6BA400-CFE5-44E1-A8E3-2DF0CCC5492B}.Release|x86.ActiveCfg = Release|Win32
{3B6BA400-CFE5-44E1-A8E3-2DF0CCC5492B}.Release|x86.Build.0 = Release|Win32
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|ARM64.ActiveCfg = Debug|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|ARM64.Build.0 = Debug|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|x64.ActiveCfg = Debug|x64
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|x64.Build.0 = Debug|x64
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|x86.ActiveCfg = Debug|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Debug|x86.Build.0 = Debug|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|ARM64.ActiveCfg = Release|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|ARM64.Build.0 = Release|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|x64.ActiveCfg = Release|x64
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|x64.Build.0 = Release|x64
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|x86.ActiveCfg = Release|x86
{CB53F1CA-3FD2-4394-A635-15161C26668A}.Release|x86.Build.0 = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|ARM64.ActiveCfg = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|ARM64.Build.0 = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|x64.ActiveCfg = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|x64.Build.0 = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|x86.ActiveCfg = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Debug|x86.Build.0 = Debug|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|ARM64.ActiveCfg = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|ARM64.Build.0 = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|x64.ActiveCfg = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|x64.Build.0 = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|x86.ActiveCfg = Release|x86
{5D871FD0-EBC2-43F6-8BD8-BB7722624500}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
21 changes: 21 additions & 0 deletions NanaZipBundle/Bundle.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle
Name="NanaZip"
Version="2.0.313.0"
Manufacturer="Kenji Mouri"
UpgradeCode="6c83627d-24a4-4cf4-81fd-3caac89b69d1">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.HyperlinkLicense">
<bal:WixStandardBootstrapperApplication
LicenseUrl="https://github.com/M2Team/NanaZip/blob/main/License.md"
ShowVersion="yes"
SuppressOptionsUI="yes"
LogoFile="$(var.SolutionDir)\Assets\NanaZip.png" />
</BootstrapperApplicationRef>

<Chain>
<MsiPackage Id="NanaZip_x86" InstallCondition="NOT VersionNT64" SourceFile="$(var.SolutionDir)\Output\Binaries\Setup\$(var.Configuration)\x86\NanaZipSetup.msi" />
<MsiPackage Id="NanaZip_x64" InstallCondition="VersionNT64" SourceFile="$(var.SolutionDir)\Output\Binaries\Setup\$(var.Configuration)\x64\NanaZipSetup.msi" />
</Chain>
</Bundle>
</Wix>
43 changes: 43 additions & 0 deletions NanaZipBundle/NanaZipBundle.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>5d871fd0-ebc2-43f6-8bd8-bb7722624500</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>NanaZipSetup</OutputName>
<OutputType>Bundle</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<WixExtension Include="WixBalExtension">
<HintPath>$(WixExtDir)\WixBalExtension.dll</HintPath>
<Name>WixBalExtension</Name>
</WixExtension>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
46 changes: 46 additions & 0 deletions NanaZipSetup/NanaZipSetup.wixproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" InitialTargets="EnsureWixToolsetInstalled" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.10</ProductVersion>
<ProjectGuid>cb53f1ca-3fd2-4394-a635-15161c26668a</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>NanaZipSetup</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>Debug</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<DefineConstants>Debug</DefineConstants>
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<OutputPath>$(SolutionDir)\Output\Binaries\Setup\$(Configuration)\$(Platform)\</OutputPath>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="Product.wxs" />
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
117 changes: 117 additions & 0 deletions NanaZipSetup/Product.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?if $(var.Platform) = x86 ?>
<?define upgradeCode = "C23EAF1E-2EC1-491A-AA65-57149E095AFD" ?>
<?define isWin64 = "no" ?>
<?define installDir = "ProgramFilesFolder" ?>

<?elseif $(var.Platform) = x64 ?>
<?define upgradeCode = "92A1E85A-6147-4474-83A0-9DD09B9B8692" ?>
<?define isWin64 = "yes" ?>
<?define installDir = "ProgramFiles64Folder" ?>

<?else ?>
<?error Unsupported platform ?>
<?endif ?>

<?define sourcePath = "$(var.SolutionDir)\Output\Binaries\$(var.Configuration)\NanaZipPackage\$(var.Platform)" ?>

<Product
Id="*"
Name="NanaZip"
Language="1033"
Version="2.0.313.0"
Manufacturer="Kenji Mouri"
UpgradeCode="$(var.upgradeCode)">

<Package InstallerVersion="500" Compressed="yes" InstallScope="perMachine" />

<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />

<?if $(var.Platform) = x86 ?>
<Condition Message="32-bit setup can only run on a 32-bit OS.">Installed OR (NOT VersionNT64)</Condition>
<?endif ?>

<Feature Id="ProductFeature" Title="NanaZip" AllowAdvertise="no" Absent="disallow">
<ComponentGroupRef Id="ProductComponents" />
<ComponentGroupRef Id="SfxComponents" />
</Feature>

<Feature Id="ShellExtensionFeature" Title="NanaZip Shell Extension" AllowAdvertise="no">
<ComponentGroupRef Id="ShellExtensionComponents" />
</Feature>

<!--<UIRef Id="WixUI_FeatureTree" />-->

<PropertyRef Id="ARPPRODUCTICON" />
</Product>

<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.installDir)">
<Directory Id="INSTALLFOLDER" Name="NanaZip" />
</Directory>
</Directory>
</Fragment>

<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="ProgramMenuFolder" />
</DirectoryRef>
</Fragment>

<Fragment>
<Icon Id="NanaZip.ico" SourceFile="$(var.SolutionDir)\Assets\NanaZip.ico" />
<Property Id="ARPPRODUCTICON" Value="NanaZip.ico" />
</Fragment>

<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER" Source="$(var.sourcePath)">
<Component Win64="$(var.isWin64)">
<File Name="NanaZip.exe" />
<Shortcut Id="NanaZip" Directory="ProgramMenuFolder" Name="NanaZip" WorkingDirectory="INSTALLFOLDER" Advertise="yes" Icon="NanaZip.ico" />
</Component>
<Component Win64="$(var.isWin64)">
<File Name="NanaZipC.exe" />
</Component>
<Component Win64="$(var.isWin64)">
<File Name="NanaZipCore.dll" />
</Component>
<Component Win64="$(var.isWin64)">
<File Name="NanaZipG.exe" />
</Component>
<Component Win64="$(var.isWin64)">
<File Name="resources.pri" DefaultLanguage="!(bind.fileLanguage.NanaZip.exe)" DefaultVersion="!(bind.fileVersion.NanaZip.exe)" />
</Component>
</ComponentGroup>
</Fragment>

<Fragment>
<ComponentGroup Id="SfxComponents" Directory="INSTALLFOLDER" Source="$(var.sourcePath)">
<!-- We want our SFX files to stay along with EXE files so we have to specify a matching Win64 attribute -->
<Component Win64="$(var.isWin64)">
<File Name="NanaZipConsole.sfx" />
</Component>
<Component Win64="$(var.isWin64)">
<File Name="NanaZipWindows.sfx" />
</Component>
</ComponentGroup>
</Fragment>

<Fragment>
<ComponentGroup Id="ShellExtensionComponents" Directory="INSTALLFOLDER" Source="$(var.sourcePath)">
<Component Win64="$(var.isWin64)">
<File Name="NanaZipShellExtension.dll">
<Class Id="469D94E9-6AF4-4395-B396-99B1308F8CE5" Context="InprocServer32" ThreadingModel="apartment" />
</File>
</Component>
<Component Win64="$(var.isWin64)">
<RegistryValue Root="HKCR" Key="*\Shell\NanaZipShellExtension" Name="ExplorerCommandHandler" Type="string" Value="{469D94E9-6AF4-4395-B396-99B1308F8CE5}" />
</Component>
<Component Win64="$(var.isWin64)">
<RegistryValue Root="HKCR" Key="Directory\Shell\NanaZipShellExtension" Name="ExplorerCommandHandler" Type="string" Value="{469D94E9-6AF4-4395-B396-99B1308F8CE5}" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
4 changes: 2 additions & 2 deletions NanaZipShellExtension/NanaZipShellExtension.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\Mile.Project.Windows\Mile.Project.Platform.x86.props" />
<Import Project="..\Mile.Project.Windows\Mile.Project.Platform.x64.props" />
Expand All @@ -17,7 +17,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>%(AdditionalOptions) /Wv:18</AdditionalOptions>
<PreprocessorDefinitions>LANG;WIN_LONG_PATH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>LANG_NO_WINRT;LANG;WIN_LONG_PATH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<LargeAddressAware>true</LargeAddressAware>
Expand Down
12 changes: 8 additions & 4 deletions SevenZip/CPP/Common/Lang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

#include "../Windows/FileIO.h"

#ifdef _SFX
#define LANG_NO_WINRT
#endif

void CLang::Clear() throw()
{

Expand All @@ -26,7 +30,7 @@ bool CLang::Open(CFSTR fileName, const char *id)
return true;
}

#ifdef _SFX
#ifdef LANG_NO_WINRT
#include "../Windows/ResourceString.h"
#else
#include <winrt/windows.foundation.h>
Expand All @@ -36,7 +40,7 @@ bool CLang::Open(CFSTR fileName, const char *id)

#include <map>

#ifdef _SFX
#ifdef LANG_NO_WINRT
std::map<UInt32, UString> g_LanguageMap;
#else
std::map<UInt32, winrt::hstring> g_LanguageMap;
Expand All @@ -47,7 +51,7 @@ const wchar_t *CLang::Get(UInt32 id) const throw()
auto Iterator = g_LanguageMap.find(id);
if (Iterator == g_LanguageMap.end())
{
#ifdef _SFX
#ifdef LANG_NO_WINRT
UString Content = NWindows::MyLoadString(id);
if (Content.IsEmpty())
{
Expand Down Expand Up @@ -78,7 +82,7 @@ const wchar_t *CLang::Get(UInt32 id) const throw()
#endif
}

#ifdef _SFX
#ifdef LANG_NO_WINRT
return Iterator->second;
#else
return Iterator->second.data();
Expand Down