summaryrefslogtreecommitdiff
path: root/src/burn/engine/logging.cpp
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2021-08-03 15:41:53 -0500
committerSean Hall <r.sean.hall@gmail.com>2021-08-04 10:03:57 -0500
commit9ae1c04d5fa02ac020885cdad7c592f7bb43d83e (patch)
tree2832850289c8b703fa39e5d1c97666331e2310b1 /src/burn/engine/logging.cpp
parentce8acddf52bde840571535c3dfd56a2371d80684 (diff)
downloadwix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.tar.gz
wix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.tar.bz2
wix-9ae1c04d5fa02ac020885cdad7c592f7bb43d83e.zip
Parse most of Burn command line parameters into BURN_ENGINE_COMMAND.
Diffstat (limited to 'src/burn/engine/logging.cpp')
-rw-r--r--src/burn/engine/logging.cpp39
1 files changed, 33 insertions, 6 deletions
diff --git a/src/burn/engine/logging.cpp b/src/burn/engine/logging.cpp
index 2db7defd..6b19cc8a 100644
--- a/src/burn/engine/logging.cpp
+++ b/src/burn/engine/logging.cpp
@@ -15,7 +15,11 @@ static CONST LPWSTR LOG_FAILED_EVENT_LOG_MESSAGE = L"Burn Engine Fatal Error: fa
15// internal function declarations 15// internal function declarations
16 16
17static void CheckLoggingPolicy( 17static void CheckLoggingPolicy(
18 __out DWORD *pdwAttributes 18 __inout DWORD* pdwAttributes
19 );
20static HRESULT InitializeLogging(
21 __in BURN_LOGGING* pLog,
22 __in BURN_ENGINE_COMMAND* pInternalCommand
19 ); 23 );
20static HRESULT GetNonSessionSpecificTempFolder( 24static HRESULT GetNonSessionSpecificTempFolder(
21 __deref_out_z LPWSTR* psczNonSessionTempFolder 25 __deref_out_z LPWSTR* psczNonSessionTempFolder
@@ -26,8 +30,9 @@ static HRESULT GetNonSessionSpecificTempFolder(
26 30
27extern "C" HRESULT LoggingOpen( 31extern "C" HRESULT LoggingOpen(
28 __in BURN_LOGGING* pLog, 32 __in BURN_LOGGING* pLog,
33 __in BURN_ENGINE_COMMAND* pInternalCommand,
34 __in BOOTSTRAPPER_COMMAND* pCommand,
29 __in BURN_VARIABLES* pVariables, 35 __in BURN_VARIABLES* pVariables,
30 __in BOOTSTRAPPER_DISPLAY display,
31 __in_z LPCWSTR wzBundleName 36 __in_z LPCWSTR wzBundleName
32 ) 37 )
33{ 38{
@@ -35,8 +40,8 @@ extern "C" HRESULT LoggingOpen(
35 LPWSTR sczLoggingBaseFolder = NULL; 40 LPWSTR sczLoggingBaseFolder = NULL;
36 LPWSTR sczPrefixFormatted = NULL; 41 LPWSTR sczPrefixFormatted = NULL;
37 42
38 // Check if the logging policy is set and configure the logging appropriately. 43 hr = InitializeLogging(pLog, pInternalCommand);
39 CheckLoggingPolicy(&pLog->dwAttributes); 44 ExitOnFailure(hr, "Failed to initialize logging.");
40 45
41 if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_VERBOSE || pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG) 46 if (pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_VERBOSE || pLog->dwAttributes & BURN_LOGGING_ATTRIBUTE_EXTRADEBUG)
42 { 47 {
@@ -94,7 +99,7 @@ extern "C" HRESULT LoggingOpen(
94 HRESULT hrOriginal = hr; 99 HRESULT hrOriginal = hr;
95 100
96 hr = HRESULT_FROM_WIN32(ERROR_INSTALL_LOG_FAILURE); 101 hr = HRESULT_FROM_WIN32(ERROR_INSTALL_LOG_FAILURE);
97 SplashScreenDisplayError(display, wzBundleName, hr); 102 SplashScreenDisplayError(pCommand->display, wzBundleName, hr);
98 103
99 ExitOnFailure(hrOriginal, "Failed to open log: %ls", pLog->sczPath); 104 ExitOnFailure(hrOriginal, "Failed to open log: %ls", pLog->sczPath);
100 } 105 }
@@ -709,7 +714,7 @@ extern "C" LPWSTR LoggingStringOrUnknownIfNull(
709// internal function declarations 714// internal function declarations
710 715
711static void CheckLoggingPolicy( 716static void CheckLoggingPolicy(
712 __out DWORD *pdwAttributes 717 __inout DWORD *pdwAttributes
713 ) 718 )
714{ 719{
715 HRESULT hr = S_OK; 720 HRESULT hr = S_OK;
@@ -743,6 +748,28 @@ static void CheckLoggingPolicy(
743 ReleaseRegKey(hk); 748 ReleaseRegKey(hk);
744} 749}
745 750
751static HRESULT InitializeLogging(
752 __in BURN_LOGGING* pLog,
753 __in BURN_ENGINE_COMMAND* pInternalCommand
754 )
755{
756 HRESULT hr = S_OK;
757
758 // Check if the logging policy is set and configure the logging appropriately.
759 CheckLoggingPolicy(&pLog->dwAttributes);
760
761 pLog->dwAttributes |= pInternalCommand->dwLoggingAttributes;
762
763 if (pInternalCommand->sczLogFile)
764 {
765 hr = StrAllocString(&pLog->sczPath, pInternalCommand->sczLogFile, 0);
766 ExitOnFailure(hr, "Failed to copy log file path from command line.");
767 }
768
769LExit:
770 return hr;
771}
772
746static HRESULT GetNonSessionSpecificTempFolder( 773static HRESULT GetNonSessionSpecificTempFolder(
747 __deref_out_z LPWSTR* psczNonSessionTempFolder 774 __deref_out_z LPWSTR* psczNonSessionTempFolder
748 ) 775 )