diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-08-01 17:07:25 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-08-02 09:15:14 -0500 |
commit | aacd6b677332f2e262d0df67603c246cd65d833e (patch) | |
tree | 05d4e5a127fc2b5feec6f74144bd195f337a8281 /src/burn/engine/logging.cpp | |
parent | 457ef57f96c1706a63e8f848be3e07a58e7de6a3 (diff) | |
download | wix-aacd6b677332f2e262d0df67603c246cd65d833e.tar.gz wix-aacd6b677332f2e262d0df67603c246cd65d833e.tar.bz2 wix-aacd6b677332f2e262d0df67603c246cd65d833e.zip |
Store list of persisted well-known variables in Burn.
This allows it to reject Variables declared in the manifest that start with the reserved prefix 'Wix'.
Diffstat (limited to 'src/burn/engine/logging.cpp')
-rw-r--r-- | src/burn/engine/logging.cpp | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp index 68f0c35b..ae056921 100644 --- a/src/burn/engine/logging.cpp +++ b/src/burn/engine/logging.cpp | |||
@@ -28,6 +28,37 @@ static HRESULT GetNonSessionSpecificTempFolder( | |||
28 | 28 | ||
29 | // function definitions | 29 | // function definitions |
30 | 30 | ||
31 | extern "C" HRESULT LoggingParseFromXml( | ||
32 | __in BURN_LOGGING* pLog, | ||
33 | __in IXMLDOMNode* pixnBundle | ||
34 | ) | ||
35 | { | ||
36 | HRESULT hr = S_OK; | ||
37 | IXMLDOMNode* pixnLog = NULL; | ||
38 | BOOL fXmlFound = FALSE; | ||
39 | |||
40 | // parse the log element, if present. | ||
41 | hr = XmlSelectSingleNode(pixnBundle, L"Log", &pixnLog); | ||
42 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get Log element."); | ||
43 | |||
44 | if (fXmlFound) | ||
45 | { | ||
46 | hr = XmlGetAttributeEx(pixnLog, L"PathVariable", &pLog->sczPathVariable); | ||
47 | ExitOnOptionalXmlQueryFailure(hr, fXmlFound, "Failed to get Log/@PathVariable."); | ||
48 | |||
49 | hr = XmlGetAttributeEx(pixnLog, L"Prefix", &pLog->sczPrefix); | ||
50 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get Log/@Prefix attribute."); | ||
51 | |||
52 | hr = XmlGetAttributeEx(pixnLog, L"Extension", &pLog->sczExtension); | ||
53 | ExitOnRequiredXmlQueryFailure(hr, "Failed to get Log/@Extension attribute."); | ||
54 | } | ||
55 | |||
56 | LExit: | ||
57 | ReleaseObject(pixnLog); | ||
58 | |||
59 | return hr; | ||
60 | } | ||
61 | |||
31 | extern "C" HRESULT LoggingOpen( | 62 | extern "C" HRESULT LoggingOpen( |
32 | __in BURN_LOGGING* pLog, | 63 | __in BURN_LOGGING* pLog, |
33 | __in BURN_ENGINE_COMMAND* pInternalCommand, | 64 | __in BURN_ENGINE_COMMAND* pInternalCommand, |
@@ -244,7 +275,6 @@ extern "C" HRESULT LoggingSetCompatiblePackageVariable( | |||
244 | ) | 275 | ) |
245 | { | 276 | { |
246 | HRESULT hr = S_OK; | 277 | HRESULT hr = S_OK; |
247 | LPWSTR sczLogPathVariable = NULL; | ||
248 | LPWSTR sczLogPath = NULL; | 278 | LPWSTR sczLogPath = NULL; |
249 | 279 | ||
250 | // Make sure that no package log files are created when logging has been disabled via Log element. | 280 | // Make sure that no package log files are created when logging has been disabled via Log element. |
@@ -253,16 +283,12 @@ extern "C" HRESULT LoggingSetCompatiblePackageVariable( | |||
253 | ExitFunction(); | 283 | ExitFunction(); |
254 | } | 284 | } |
255 | 285 | ||
256 | if (pPackage->sczLogPathVariable && *pPackage->sczLogPathVariable) | 286 | if (pPackage->sczCompatibleLogPathVariable && *pPackage->sczCompatibleLogPathVariable) |
257 | { | 287 | { |
258 | // Format a suitable log path variable from the original package. | ||
259 | hr = StrAllocFormatted(&sczLogPathVariable, L"%ls_Compatible", pPackage->sczLogPathVariable); | ||
260 | ExitOnFailure(hr, "Failed to format log path variable for compatible package."); | ||
261 | |||
262 | hr = StrAllocFormatted(&sczLogPath, L"%ls_%03u_%ls_%ls.%ls", pLog->sczPrefix, vdwPackageSequence, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pLog->sczExtension); | 288 | hr = StrAllocFormatted(&sczLogPath, L"%ls_%03u_%ls_%ls.%ls", pLog->sczPrefix, vdwPackageSequence, pPackage->sczId, pPackage->compatiblePackage.compatibleEntry.sczId, pLog->sczExtension); |
263 | ExitOnFailure(hr, "Failed to allocate path for package log."); | 289 | ExitOnFailure(hr, "Failed to allocate path for package log."); |
264 | 290 | ||
265 | hr = VariableSetString(pVariables, sczLogPathVariable, sczLogPath, FALSE, FALSE); | 291 | hr = VariableSetString(pVariables, pPackage->sczCompatibleLogPathVariable, sczLogPath, FALSE, FALSE); |
266 | ExitOnFailure(hr, "Failed to set log path into variable."); | 292 | ExitOnFailure(hr, "Failed to set log path into variable."); |
267 | 293 | ||
268 | if (psczLogPath) | 294 | if (psczLogPath) |
@@ -273,7 +299,6 @@ extern "C" HRESULT LoggingSetCompatiblePackageVariable( | |||
273 | } | 299 | } |
274 | 300 | ||
275 | LExit: | 301 | LExit: |
276 | ReleaseStr(sczLogPathVariable); | ||
277 | ReleaseStr(sczLogPath); | 302 | ReleaseStr(sczLogPath); |
278 | 303 | ||
279 | return hr; | 304 | return hr; |