summaryrefslogtreecommitdiff
path: root/src/burn/engine/manifest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/manifest.cpp')
-rw-r--r--src/burn/engine/manifest.cpp50
1 files changed, 50 insertions, 0 deletions
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
11static 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
48LExit: 57LExit:
@@ -162,3 +171,44 @@ LExit:
162 ReleaseObject(pixeBundle); 171 ReleaseObject(pixeBundle);
163 return hr; 172 return hr;
164} 173}
174
175#if DEBUG
176static 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
208LExit:
209 AssertSz(SUCCEEDED(hr), "Failed to get harvesting attributes.");
210
211 ReleaseStr(sczEngineVersion);
212 ReleaseObject(pixeBundle);
213}
214#endif