diff options
Diffstat (limited to 'src/engine/manifest.cpp')
| -rw-r--r-- | src/engine/manifest.cpp | 49 |
1 files changed, 44 insertions, 5 deletions
diff --git a/src/engine/manifest.cpp b/src/engine/manifest.cpp index 8783b15e..270b6b74 100644 --- a/src/engine/manifest.cpp +++ b/src/engine/manifest.cpp | |||
| @@ -3,8 +3,33 @@ | |||
| 3 | #include "precomp.h" | 3 | #include "precomp.h" |
| 4 | 4 | ||
| 5 | 5 | ||
| 6 | static HRESULT ParseFromXml( | ||
| 7 | __in IXMLDOMDocument* pixdDocument, | ||
| 8 | __in BURN_ENGINE_STATE* pEngineState | ||
| 9 | ); | ||
| 10 | |||
| 6 | // function definitions | 11 | // function definitions |
| 7 | 12 | ||
| 13 | extern "C" HRESULT ManifestLoadXml( | ||
| 14 | __in LPCWSTR wzDocument, | ||
| 15 | __in BURN_ENGINE_STATE* pEngineState | ||
| 16 | ) | ||
| 17 | { | ||
| 18 | HRESULT hr = S_OK; | ||
| 19 | IXMLDOMDocument* pixdDocument = NULL; | ||
| 20 | |||
| 21 | // load xml document | ||
| 22 | hr = XmlLoadDocument(wzDocument, &pixdDocument); | ||
| 23 | ExitOnFailure(hr, "Failed to load manifest as XML document."); | ||
| 24 | |||
| 25 | hr = ParseFromXml(pixdDocument, pEngineState); | ||
| 26 | |||
| 27 | LExit: | ||
| 28 | ReleaseObject(pixdDocument); | ||
| 29 | |||
| 30 | return hr; | ||
| 31 | } | ||
| 32 | |||
| 8 | extern "C" HRESULT ManifestLoadXmlFromBuffer( | 33 | extern "C" HRESULT ManifestLoadXmlFromBuffer( |
| 9 | __in_bcount(cbBuffer) BYTE* pbBuffer, | 34 | __in_bcount(cbBuffer) BYTE* pbBuffer, |
| 10 | __in SIZE_T cbBuffer, | 35 | __in SIZE_T cbBuffer, |
| @@ -13,14 +38,29 @@ extern "C" HRESULT ManifestLoadXmlFromBuffer( | |||
| 13 | { | 38 | { |
| 14 | HRESULT hr = S_OK; | 39 | HRESULT hr = S_OK; |
| 15 | IXMLDOMDocument* pixdDocument = NULL; | 40 | IXMLDOMDocument* pixdDocument = NULL; |
| 16 | IXMLDOMElement* pixeBundle = NULL; | ||
| 17 | IXMLDOMNode* pixnLog = NULL; | ||
| 18 | IXMLDOMNode* pixnChain = NULL; | ||
| 19 | 41 | ||
| 20 | // load xml document | 42 | // load xml document |
| 21 | hr = XmlLoadDocumentFromBuffer(pbBuffer, cbBuffer, &pixdDocument); | 43 | hr = XmlLoadDocumentFromBuffer(pbBuffer, cbBuffer, &pixdDocument); |
| 22 | ExitOnFailure(hr, "Failed to load manifest as XML document."); | 44 | ExitOnFailure(hr, "Failed to load manifest as XML document."); |
| 23 | 45 | ||
| 46 | hr = ParseFromXml(pixdDocument, pEngineState); | ||
| 47 | |||
| 48 | LExit: | ||
| 49 | ReleaseObject(pixdDocument); | ||
| 50 | |||
| 51 | return hr; | ||
| 52 | } | ||
| 53 | |||
| 54 | static HRESULT ParseFromXml( | ||
| 55 | __in IXMLDOMDocument* pixdDocument, | ||
| 56 | __in BURN_ENGINE_STATE* pEngineState | ||
| 57 | ) | ||
| 58 | { | ||
| 59 | HRESULT hr = S_OK; | ||
| 60 | IXMLDOMElement* pixeBundle = NULL; | ||
| 61 | IXMLDOMNode* pixnLog = NULL; | ||
| 62 | IXMLDOMNode* pixnChain = NULL; | ||
| 63 | |||
| 24 | // get bundle element | 64 | // get bundle element |
| 25 | hr = pixdDocument->get_documentElement(&pixeBundle); | 65 | hr = pixdDocument->get_documentElement(&pixeBundle); |
| 26 | ExitOnFailure(hr, "Failed to get bundle element."); | 66 | ExitOnFailure(hr, "Failed to get bundle element."); |
| @@ -105,7 +145,7 @@ extern "C" HRESULT ManifestLoadXmlFromBuffer( | |||
| 105 | ExitOnFailure(hr, "Failed to parse update."); | 145 | ExitOnFailure(hr, "Failed to parse update."); |
| 106 | 146 | ||
| 107 | // parse containers | 147 | // parse containers |
| 108 | hr = ContainersParseFromXml(&pEngineState->section, &pEngineState->containers, pixeBundle); | 148 | hr = ContainersParseFromXml(&pEngineState->containers, pixeBundle); |
| 109 | ExitOnFailure(hr, "Failed to parse containers."); | 149 | ExitOnFailure(hr, "Failed to parse containers."); |
| 110 | 150 | ||
| 111 | // parse payloads | 151 | // parse payloads |
| @@ -124,6 +164,5 @@ LExit: | |||
| 124 | ReleaseObject(pixnChain); | 164 | ReleaseObject(pixnChain); |
| 125 | ReleaseObject(pixnLog); | 165 | ReleaseObject(pixnLog); |
| 126 | ReleaseObject(pixeBundle); | 166 | ReleaseObject(pixeBundle); |
| 127 | ReleaseObject(pixdDocument); | ||
| 128 | return hr; | 167 | return hr; |
| 129 | } | 168 | } |
