Skip to content

Commit

Permalink
First steps on Burn for x64 and ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
barnson authored and rseanhall committed Jan 19, 2021
1 parent a5b86b9 commit a563fb9
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 12 deletions.
2 changes: 2 additions & 0 deletions appveyor.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ nuget restore || exit /b
msbuild -t:Test -p:Configuration=Release src\test\BurnUnitTest || exit /b

msbuild -p:Configuration=Release;Platform=x86 || exit /b
msbuild -p:Configuration=Release;Platform=x64 || exit /b
msbuild -p:Configuration=Release;Platform=arm64 || exit /b

msbuild -p:Configuration=Release -t:Pack src\stub\stub.vcxproj || exit /b
msbuild -p:Configuration=Release -t:Pack src\WixToolset.BootstrapperCore.Native\WixToolset.BootstrapperCore.Native.proj || exit /b
Expand Down
16 changes: 14 additions & 2 deletions burn.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26730.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.30711.63
MinimumVisualStudioVersion = 15.0.26124.0
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "engine", "src\engine\engine.vcxproj", "{8119537D-E1D9-6591-D51A-49768A2F9C37}"
EndProject
Expand All @@ -11,31 +11,43 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BurnUnitTest", "src\test\Bu
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|ARM64.ActiveCfg = Debug|ARM64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|ARM64.Build.0 = Debug|ARM64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|x64.ActiveCfg = Debug|x64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|x64.Build.0 = Debug|x64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|x86.ActiveCfg = Debug|Win32
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Debug|x86.Build.0 = Debug|Win32
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|ARM64.ActiveCfg = Release|ARM64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|ARM64.Build.0 = Release|ARM64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|x64.ActiveCfg = Release|x64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|x64.Build.0 = Release|x64
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|x86.ActiveCfg = Release|Win32
{8119537D-E1D9-6591-D51A-49768A2F9C37}.Release|x86.Build.0 = Release|Win32
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|ARM64.Build.0 = Debug|ARM64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|x64.ActiveCfg = Debug|x64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|x64.Build.0 = Debug|x64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|x86.ActiveCfg = Debug|Win32
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Debug|x86.Build.0 = Debug|Win32
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|ARM64.ActiveCfg = Release|ARM64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|ARM64.Build.0 = Release|ARM64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x64.ActiveCfg = Release|x64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x64.Build.0 = Release|x64
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.ActiveCfg = Release|Win32
{C38373AA-882F-4F55-B03F-2AAB4BFBE3F1}.Release|x86.Build.0 = Release|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|ARM64.ActiveCfg = Debug|ARM64
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x64.ActiveCfg = Debug|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.ActiveCfg = Debug|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Debug|x86.Build.0 = Debug|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|ARM64.ActiveCfg = Release|ARM64
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|x64.ActiveCfg = Release|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|x86.ActiveCfg = Release|Win32
{9D1F1BA3-9393-4833-87A3-D5F1FC08EF67}.Release|x86.Build.0 = Release|Win32
Expand Down
29 changes: 28 additions & 1 deletion src/engine/engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ extern "C" HRESULT EngineRun(
BOOL fRegInitialized = FALSE;
BOOL fWiuInitialized = FALSE;
BOOL fXmlInitialized = FALSE;
SYSTEM_INFO si = { };
OSVERSIONINFOEXW ovix = { };
LPWSTR sczExePath = NULL;
BOOL fRunNormal = FALSE;
Expand Down Expand Up @@ -155,8 +156,34 @@ extern "C" HRESULT EngineRun(
ExitWithLastError(hr, "Failed to get OS info.");
}

#if defined(_M_ARM64)
LPCSTR szBurnPlatform = "ARM64";
#elif defined(_M_AMD64)
LPCSTR szBurnPlatform = "x64";
#else
LPCSTR szBurnPlatform = "x86";
#endif

LPCSTR szMachinePlatform = "unknown architecture";
::GetNativeSystemInfo(&si);
switch (si.wProcessorArchitecture)
{
case PROCESSOR_ARCHITECTURE_AMD64:
szMachinePlatform = "x64";
break;
case PROCESSOR_ARCHITECTURE_ARM:
szMachinePlatform = "ARM";
break;
case PROCESSOR_ARCHITECTURE_ARM64:
szMachinePlatform = "ARM64";
break;
case PROCESSOR_ARCHITECTURE_INTEL:
szMachinePlatform = "x86";
break;
}

PathForCurrentProcess(&sczExePath, NULL); // Ignore failure.
LogId(REPORT_STANDARD, MSG_BURN_INFO, szVerMajorMinorBuild, ovix.dwMajorVersion, ovix.dwMinorVersion, ovix.dwBuildNumber, ovix.wServicePackMajor, sczExePath);
LogId(REPORT_STANDARD, MSG_BURN_INFO, szVerMajorMinorBuild, ovix.dwMajorVersion, ovix.dwMinorVersion, ovix.dwBuildNumber, ovix.wServicePackMajor, sczExePath, szBurnPlatform, szMachinePlatform);
ReleaseNullStr(sczExePath);

// initialize core
Expand Down
2 changes: 1 addition & 1 deletion src/engine/engine.mc
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MessageId=1
Severity=Success
SymbolicName=MSG_BURN_INFO
Language=English
Burn v%1!hs!, Windows v%2!d!.%3!d! (Build %4!d!: Service Pack %5!d!), path: %6!ls!
Burn %7!hs! v%1!hs!, Windows v%2!d!.%3!d! %8!hs! (Build %4!d!: Service Pack %5!d!), path: %6!ls!
.
MessageId=2
Expand Down
8 changes: 8 additions & 0 deletions src/engine/engine.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>

<PropertyGroup Label="Globals">
Expand Down
23 changes: 15 additions & 8 deletions src/engine/variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,6 @@ static HRESULT InitializeVariableNumeric(
__in DWORD_PTR dwpData,
__inout BURN_VARIANT* pValue
);
static HRESULT InitializeVariableRegistryFolder(
__in DWORD_PTR dwpData,
__inout BURN_VARIANT* pValue
);
static HRESULT InitializeVariable6432Folder(
__in DWORD_PTR dwpData,
__inout BURN_VARIANT* pValue
Expand Down Expand Up @@ -190,6 +186,13 @@ static HRESULT Get64bitFolderFromRegistry(
__deref_out_z LPWSTR* psczPath
);

#if !defined(_WIN64)
static HRESULT InitializeVariableRegistryFolder(
__in DWORD_PTR dwpData,
__inout BURN_VARIANT* pValue
);
#endif


// function definitions

Expand Down Expand Up @@ -1101,13 +1104,17 @@ static HRESULT FormatString(
LPWSTR* rgVariables = NULL;
DWORD cVariables = 0;
DWORD cch = 0;
size_t cchIn = 0;
BOOL fHidden = FALSE;
MSIHANDLE hRecord = NULL;

::EnterCriticalSection(&pVariables->csAccess);

// allocate buffer for format string
hr = StrAlloc(&sczFormat, lstrlenW(wzIn) + 1);
hr = ::StringCchLengthW(wzIn, STRSAFE_MAX_CCH - 1, &cchIn);
ExitOnFailure(hr, "Failed to length of format string.");

hr = StrAlloc(&sczFormat, cchIn + 1);
ExitOnFailure(hr, "Failed to allocate buffer for format string.");

// read out variables from the unformatted string and build a format string
Expand All @@ -1133,7 +1140,7 @@ static HRESULT FormatString(
ExitOnFailure(hr, "Failed to append string.");
break;
}
cch = wzClose - wzOpen - 1;
cch = (DWORD)(wzClose - wzOpen - 1);

if (0 == cch)
{
Expand Down Expand Up @@ -2170,6 +2177,7 @@ static HRESULT InitializeVariableNumeric(
return hr;
}

#if !defined(_WIN64)
static HRESULT InitializeVariableRegistryFolder(
__in DWORD_PTR dwpData,
__inout BURN_VARIANT* pValue
Expand All @@ -2179,15 +2187,13 @@ static HRESULT InitializeVariableRegistryFolder(
int nFolder = (int)dwpData;
LPWSTR sczPath = NULL;

#if !defined(_WIN64)
BOOL fIsWow64 = FALSE;

ProcWow64(::GetCurrentProcess(), &fIsWow64);
if (!fIsWow64) // on 32-bit machines, variables aren't set
{
ExitFunction();
}
#endif

hr = Get64bitFolderFromRegistry(nFolder, &sczPath);
ExitOnFailure(hr, "Failed to get 64-bit folder.");
Expand All @@ -2201,6 +2207,7 @@ static HRESULT InitializeVariableRegistryFolder(

return hr;
}
#endif

static HRESULT InitializeVariable6432Folder(
__in DWORD_PTR dwpData,
Expand Down
4 changes: 4 additions & 0 deletions src/stub/WixToolset.Burn.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,9 @@
<file src="$projectFolder$$id$.props" target="buildTransitive" />
<file src="Win32\burn.exe" target="tools\x86" />
<file src="Win32\burn.pdb" target="tools\x86" />
<file src="x64\burn.exe" target="tools\x64" />
<file src="x64\burn.pdb" target="tools\x64" />
<file src="arm64\burn.exe" target="tools\arm64" />
<file src="arm64\burn.pdb" target="tools\arm64" />
</files>
</package>
8 changes: 8 additions & 0 deletions src/stub/stub.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
</ItemGroup>

<PropertyGroup Label="Globals">
Expand Down
8 changes: 8 additions & 0 deletions src/test/BurnUnitTest/BurnUnitTest.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@
<Import Project="..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props" Condition="Exists('..\..\..\packages\WixBuildTools.TestSupport.Native.4.0.47\build\WixBuildTools.TestSupport.Native.props')" />
<Import Project="..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.59\build\WixToolset.DUtil.props')" />
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
Expand Down

0 comments on commit a563fb9

Please sign in to comment.