diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-13 10:14:45 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-13 13:13:48 -0500 |
commit | 4c3640ad5ef05b5be44df2aee2a23baa40471422 (patch) | |
tree | b9aab6744e812298db3f4a98bc389ec5f212e80d /src/burn | |
parent | 3704a5547766581b15690b6535d03568afcfc2a0 (diff) | |
download | wix-4c3640ad5ef05b5be44df2aee2a23baa40471422.tar.gz wix-4c3640ad5ef05b5be44df2aee2a23baa40471422.tar.bz2 wix-4c3640ad5ef05b5be44df2aee2a23baa40471422.zip |
Write EngineVersion, ProtocolVersion, and Win64 to the Burn manifest.
Diffstat (limited to 'src/burn')
-rw-r--r-- | src/burn/Directory.Build.props | 4 | ||||
-rw-r--r-- | src/burn/engine/engine.vcxproj | 32 | ||||
-rw-r--r-- | src/burn/engine/manifest.cpp | 50 | ||||
-rw-r--r-- | src/burn/engine/precomp.h | 1 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/BurnTestFixture.h | 2 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj | 4 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/ManifestTest.cpp | 10 | ||||
-rw-r--r-- | src/burn/test/BurnUnitTest/precomp.h | 2 |
8 files changed, 91 insertions, 14 deletions
diff --git a/src/burn/Directory.Build.props b/src/burn/Directory.Build.props index f929fa2b..6050781d 100644 --- a/src/burn/Directory.Build.props +++ b/src/burn/Directory.Build.props | |||
@@ -7,4 +7,8 @@ | |||
7 | </PropertyGroup> | 7 | </PropertyGroup> |
8 | 8 | ||
9 | <Import Project="..\Directory.Build.props" /> | 9 | <Import Project="..\Directory.Build.props" /> |
10 | |||
11 | <PropertyGroup> | ||
12 | <BurnGeneratedHeaderDirectory>$(BaseIntermediateOutputPath)..\</BurnGeneratedHeaderDirectory> | ||
13 | </PropertyGroup> | ||
10 | </Project> | 14 | </Project> |
diff --git a/src/burn/engine/engine.vcxproj b/src/burn/engine/engine.vcxproj index 5c4860f1..b5cfcb45 100644 --- a/src/burn/engine/engine.vcxproj +++ b/src/burn/engine/engine.vcxproj | |||
@@ -35,13 +35,14 @@ | |||
35 | <TargetName>engine</TargetName> | 35 | <TargetName>engine</TargetName> |
36 | <CharacterSet>Unicode</CharacterSet> | 36 | <CharacterSet>Unicode</CharacterSet> |
37 | <Description>Native component of WixToolset.Burn</Description> | 37 | <Description>Native component of WixToolset.Burn</Description> |
38 | <CustomBuildBeforeTargets>ClCompile</CustomBuildBeforeTargets> | ||
38 | </PropertyGroup> | 39 | </PropertyGroup> |
39 | 40 | ||
40 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | 41 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
41 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
42 | 43 | ||
43 | <PropertyGroup> | 44 | <PropertyGroup> |
44 | <ProjectAdditionalIncludeDirectories>..\..\api\burn\WixToolset.BootstrapperCore.Native\inc;$(ProjectAdditionalIncludeDirectories)</ProjectAdditionalIncludeDirectories> | 45 | <ProjectAdditionalIncludeDirectories>..\..\api\burn\WixToolset.BootstrapperCore.Native\inc;$(BurnGeneratedHeaderDirectory);$(ProjectAdditionalIncludeDirectories)</ProjectAdditionalIncludeDirectories> |
45 | </PropertyGroup> | 46 | </PropertyGroup> |
46 | 47 | ||
47 | <ImportGroup Label="ExtensionSettings"> | 48 | <ImportGroup Label="ExtensionSettings"> |
@@ -144,14 +145,15 @@ | |||
144 | <ClInclude Include="variant.h" /> | 145 | <ClInclude Include="variant.h" /> |
145 | </ItemGroup> | 146 | </ItemGroup> |
146 | 147 | ||
147 | <ItemGroup> | 148 | <ItemDefinitionGroup> |
148 | <CustomBuild Include="engine.mc"> | 149 | <CustomBuildStep> |
149 | <Message>Compiling message file...</Message> | 150 | <Message>Compiling message file...</Message> |
150 | <Command>mc.exe -h "$(IntDir)." -r "$(IntDir)." -A -c -z engine.messages "$(InputDir)engine.mc" | 151 | <Command>mc.exe -h "$(IntDir)." -r "$(IntDir)." -A -c -z engine.messages "$(InputDir)engine.mc" |
151 | rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | 152 | rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> |
153 | <Inputs>$(InputDir)engine.mc</Inputs> | ||
152 | <Outputs>$(IntDir)engine.messages.h;$(IntDir)engine.messages.rc</Outputs> | 154 | <Outputs>$(IntDir)engine.messages.h;$(IntDir)engine.messages.rc</Outputs> |
153 | </CustomBuild> | 155 | </CustomBuildStep> |
154 | </ItemGroup> | 156 | </ItemDefinitionGroup> |
155 | 157 | ||
156 | <Target Name="SetWixVersion" DependsOnTargets="__SetPropertiesFromGit" BeforeTargets="ClCompile"> | 158 | <Target Name="SetWixVersion" DependsOnTargets="__SetPropertiesFromGit" BeforeTargets="ClCompile"> |
157 | <PropertyGroup> | 159 | <PropertyGroup> |
@@ -160,14 +162,26 @@ rc.exe -fo "$(OutDir)engine.res" "$(IntDir)engine.messages.rc"</Command> | |||
160 | <rup>$(GitBaseVersionPatch)</rup> | 162 | <rup>$(GitBaseVersionPatch)</rup> |
161 | <rpr>$(GitCommits)</rpr> | 163 | <rpr>$(GitCommits)</rpr> |
162 | <szVerMajorMinorBuild>$(rmj).$(rmm).$(rup).$(rpr)</szVerMajorMinorBuild> | 164 | <szVerMajorMinorBuild>$(rmj).$(rmm).$(rup).$(rpr)</szVerMajorMinorBuild> |
163 | <wixver>rmj=$(rmj);rmm=$(rmm);rup=$(rup);rpr=$(rpr);szVerMajorMinorBuild="$(szVerMajorMinorBuild)"</wixver> | ||
164 | </PropertyGroup> | 165 | </PropertyGroup> |
165 | 166 | ||
166 | <ItemGroup> | 167 | <ItemGroup> |
167 | <ClCompile> | 168 | <BurnVersionLines Include=" |
168 | <PreprocessorDefinitions>$(wixver);%(PreprocessorDefinitions)</PreprocessorDefinitions> | 169 | // <auto-generated/> |
169 | </ClCompile> | 170 | #ifndef _VERSION_FILE_H_ |
171 | #define _VERSION_FILE_H_ | ||
172 | |||
173 | #define szVerMajorMinorBuild "$(szVerMajorMinorBuild)" | ||
174 | #define wzVerMajorMinorBuild L"$(szVerMajorMinorBuild)" | ||
175 | #define rmj $(rmj) | ||
176 | #define rmm $(rmm) | ||
177 | #define rup $(rup) | ||
178 | #define rpr $(rpr) | ||
179 | |||
180 | #endif | ||
181 | "/> | ||
170 | </ItemGroup> | 182 | </ItemGroup> |
183 | |||
184 | <WriteLinesToFile Overwrite="true" File="$(BurnGeneratedHeaderDirectory)engine.version.h" Lines="@(BurnVersionLines)" /> | ||
171 | </Target> | 185 | </Target> |
172 | 186 | ||
173 | <ItemGroup> | 187 | <ItemGroup> |
diff --git a/src/burn/engine/manifest.cpp b/src/burn/engine/manifest.cpp index 7e16de13..0cd10dbb 100644 --- a/src/burn/engine/manifest.cpp +++ b/src/burn/engine/manifest.cpp | |||
@@ -7,6 +7,11 @@ static HRESULT ParseFromXml( | |||
7 | __in IXMLDOMDocument* pixdDocument, | 7 | __in IXMLDOMDocument* pixdDocument, |
8 | __in BURN_ENGINE_STATE* pEngineState | 8 | __in BURN_ENGINE_STATE* pEngineState |
9 | ); | 9 | ); |
10 | #if DEBUG | ||
11 | static void ValidateHarvestingAttributes( | ||
12 | __in IXMLDOMDocument* pixdDocument | ||
13 | ); | ||
14 | #endif | ||
10 | 15 | ||
11 | // function definitions | 16 | // function definitions |
12 | 17 | ||
@@ -43,6 +48,10 @@ extern "C" HRESULT ManifestLoadXmlFromBuffer( | |||
43 | hr = XmlLoadDocumentFromBuffer(pbBuffer, cbBuffer, &pixdDocument); | 48 | hr = XmlLoadDocumentFromBuffer(pbBuffer, cbBuffer, &pixdDocument); |
44 | ExitOnFailure(hr, "Failed to load manifest as XML document."); | 49 | ExitOnFailure(hr, "Failed to load manifest as XML document."); |
45 | 50 | ||
51 | #if DEBUG | ||
52 | ValidateHarvestingAttributes(pixdDocument); | ||
53 | #endif | ||
54 | |||
46 | hr = ParseFromXml(pixdDocument, pEngineState); | 55 | hr = ParseFromXml(pixdDocument, pEngineState); |
47 | 56 | ||
48 | LExit: | 57 | LExit: |
@@ -162,3 +171,44 @@ LExit: | |||
162 | ReleaseObject(pixeBundle); | 171 | ReleaseObject(pixeBundle); |
163 | return hr; | 172 | return hr; |
164 | } | 173 | } |
174 | |||
175 | #if DEBUG | ||
176 | static void ValidateHarvestingAttributes( | ||
177 | __in IXMLDOMDocument* pixdDocument | ||
178 | ) | ||
179 | { | ||
180 | HRESULT hr = S_OK; | ||
181 | IXMLDOMElement* pixeBundle = NULL; | ||
182 | LPWSTR sczEngineVersion = NULL; | ||
183 | DWORD dwProtocolVersion = 0; | ||
184 | BOOL fWin64 = FALSE; | ||
185 | |||
186 | hr = pixdDocument->get_documentElement(&pixeBundle); | ||
187 | ExitOnFailure(hr, "Failed to get document element."); | ||
188 | |||
189 | hr = XmlGetAttributeEx(pixeBundle, L"EngineVersion", &sczEngineVersion); | ||
190 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get BurnManifest/@EngineVersion attribute."); | ||
191 | |||
192 | hr = XmlGetAttributeUInt32(pixeBundle, L"ProtocolVersion", &dwProtocolVersion); | ||
193 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get BurnManifest/@ProtocolVersion attribute."); | ||
194 | |||
195 | hr = XmlGetYesNoAttribute(pixeBundle, L"Win64", &fWin64); | ||
196 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get BurnManifest/@Win64 attribute."); | ||
197 | |||
198 | Assert(CSTR_EQUAL == ::CompareStringW(LOCALE_INVARIANT, 0, sczEngineVersion, -1, wzVerMajorMinorBuild, -1)); | ||
199 | |||
200 | Assert(BURN_PROTOCOL_VERSION == dwProtocolVersion); | ||
201 | |||
202 | #if !defined(_WIN64) | ||
203 | Assert(!fWin64); | ||
204 | #else | ||
205 | Assert(fWin64); | ||
206 | #endif | ||
207 | |||
208 | LExit: | ||
209 | AssertSz(SUCCEEDED(hr), "Failed to get harvesting attributes."); | ||
210 | |||
211 | ReleaseStr(sczEngineVersion); | ||
212 | ReleaseObject(pixeBundle); | ||
213 | } | ||
214 | #endif | ||
diff --git a/src/burn/engine/precomp.h b/src/burn/engine/precomp.h index c83c1e74..19a6d48b 100644 --- a/src/burn/engine/precomp.h +++ b/src/burn/engine/precomp.h | |||
@@ -103,4 +103,5 @@ | |||
103 | #include "EngineForApplication.h" | 103 | #include "EngineForApplication.h" |
104 | #include "EngineForExtension.h" | 104 | #include "EngineForExtension.h" |
105 | #include "engine.messages.h" | 105 | #include "engine.messages.h" |
106 | #include "engine.version.h" | ||
106 | #include "engine.h" | 107 | #include "engine.h" |
diff --git a/src/burn/test/BurnUnitTest/BurnTestFixture.h b/src/burn/test/BurnUnitTest/BurnTestFixture.h index 103972ef..470c81c1 100644 --- a/src/burn/test/BurnUnitTest/BurnTestFixture.h +++ b/src/burn/test/BurnUnitTest/BurnTestFixture.h | |||
@@ -33,7 +33,7 @@ namespace Bootstrapper | |||
33 | 33 | ||
34 | this->testDirectory = WixBuildTools::TestSupport::TestData::Get(); | 34 | this->testDirectory = WixBuildTools::TestSupport::TestData::Get(); |
35 | 35 | ||
36 | LogInitialize(::GetModuleHandleW(NULL)); | 36 | LogInitialize(::GetModuleHandleW(L"BurnUnitTest.dll")); |
37 | 37 | ||
38 | LogSetLevel(REPORT_DEBUG, FALSE); | 38 | LogSetLevel(REPORT_DEBUG, FALSE); |
39 | 39 | ||
diff --git a/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj b/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj index b0159840..b05666b2 100644 --- a/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj +++ b/src/burn/test/BurnUnitTest/BurnUnitTest.vcxproj | |||
@@ -39,8 +39,8 @@ | |||
39 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 39 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
40 | 40 | ||
41 | <PropertyGroup> | 41 | <PropertyGroup> |
42 | <ProjectAdditionalIncludeDirectories>$(ProjectAdditionalIncludeDirectories);..\..\engine;..\..\..\api\burn\WixToolset.BootstrapperCore.Native\inc;..\..\..\libs\dutil\WixToolset.Dutil\inc</ProjectAdditionalIncludeDirectories> | 42 | <ProjectAdditionalIncludeDirectories>$(ProjectAdditionalIncludeDirectories);$(BurnGeneratedHeaderDirectory);..\..\engine;..\..\..\api\burn\WixToolset.BootstrapperCore.Native\inc;..\..\..\libs\dutil\WixToolset.Dutil\inc</ProjectAdditionalIncludeDirectories> |
43 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;$(RootBuildFolder)libs\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\dutil.lib</ProjectAdditionalLinkLibraries> | 43 | <ProjectAdditionalLinkLibraries>cabinet.lib;crypt32.lib;msi.lib;rpcrt4.lib;shlwapi.lib;wininet.lib;wintrust.lib;$(RootBuildFolder)libs\$(Configuration)\$(WixNativeSdkLibraryToolset)\$(PlatformTarget)\dutil.lib;engine.res</ProjectAdditionalLinkLibraries> |
44 | </PropertyGroup> | 44 | </PropertyGroup> |
45 | 45 | ||
46 | <ItemGroup> | 46 | <ItemGroup> |
diff --git a/src/burn/test/BurnUnitTest/ManifestTest.cpp b/src/burn/test/BurnUnitTest/ManifestTest.cpp index 6973c772..d899e3f9 100644 --- a/src/burn/test/BurnUnitTest/ManifestTest.cpp +++ b/src/burn/test/BurnUnitTest/ManifestTest.cpp | |||
@@ -30,7 +30,13 @@ namespace Bootstrapper | |||
30 | try | 30 | try |
31 | { | 31 | { |
32 | LPCSTR szDocument = | 32 | LPCSTR szDocument = |
33 | "<Bundle>" | 33 | "<BurnManifest EngineVersion='" szVerMajorMinorBuild "' ProtocolVersion='1' Win64='" |
34 | #if !defined(_WIN64) | ||
35 | "no" | ||
36 | #else | ||
37 | "yes" | ||
38 | #endif | ||
39 | "'>" | ||
34 | " <UX UxDllPayloadId='ux.dll'>" | 40 | " <UX UxDllPayloadId='ux.dll'>" |
35 | " <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" | 41 | " <Payload Id='ux.dll' FilePath='ux.dll' Packaging='embedded' SourcePath='ux.dll' Hash='000000000000' />" |
36 | " </UX>" | 42 | " </UX>" |
@@ -38,7 +44,7 @@ namespace Bootstrapper | |||
38 | " <Variable Id='Variable1' Type='numeric' Value='1' Hidden='no' Persisted='no' />" | 44 | " <Variable Id='Variable1' Type='numeric' Value='1' Hidden='no' Persisted='no' />" |
39 | " <RegistrySearch Id='Search1' Type='exists' Root='HKLM' Key='SOFTWARE\\Microsoft' Variable='Variable1' Condition='0' />" | 45 | " <RegistrySearch Id='Search1' Type='exists' Root='HKLM' Key='SOFTWARE\\Microsoft' Variable='Variable1' Condition='0' />" |
40 | " <CommandLine Variables='upperCase' />" | 46 | " <CommandLine Variables='upperCase' />" |
41 | "</Bundle>"; | 47 | "</BurnManifest>"; |
42 | 48 | ||
43 | hr = CacheInitialize(&engineState.cache, &engineState.internalCommand); | 49 | hr = CacheInitialize(&engineState.cache, &engineState.internalCommand); |
44 | TestThrowOnFailure(hr, L"Failed initialize cache."); | 50 | TestThrowOnFailure(hr, L"Failed initialize cache."); |
diff --git a/src/burn/test/BurnUnitTest/precomp.h b/src/burn/test/BurnUnitTest/precomp.h index ded9fc2d..11e54284 100644 --- a/src/burn/test/BurnUnitTest/precomp.h +++ b/src/burn/test/BurnUnitTest/precomp.h | |||
@@ -71,6 +71,8 @@ | |||
71 | #include "splashscreen.h" | 71 | #include "splashscreen.h" |
72 | #include "detect.h" | 72 | #include "detect.h" |
73 | 73 | ||
74 | #include "engine.version.h" | ||
75 | |||
74 | #pragma managed | 76 | #pragma managed |
75 | #include <vcclr.h> | 77 | #include <vcclr.h> |
76 | 78 | ||