Fix code analysis warnings.
Bob Arnson committed
Dec 26, 2020 at 22:15 UTC
a5b86b987bb5a6fbcdb191bbe8b51a621140b4e6
5 files changed
+14
-7
src/engine/apply.cpp
+9
-2
@@ -291,10 +291,12 @@ extern "C" void ApplyReset(
291
292
extern "C" HRESULT ApplyLock(
293
__in BOOL /*fPerMachine*/,
294
- __out HANDLE* /*phLock*/
294
+ __out HANDLE* phLock
295
)
296
{
297
HRESULT hr = S_OK;
298
+ *phLock = NULL;
299
+
300
#if 0 // eventually figure out the correct way to support this. In its current form, embedded bundles (including related bundles) are hosed.
301
DWORD er = ERROR_SUCCESS;
302
HANDLE hLock = NULL;
@@ -459,6 +461,8 @@ extern "C" HRESULT ApplyCache(
461
DWORD iPackageStartAction = BURN_PLAN_INVALID_ACTION_INDEX;
462
DWORD iPackageCompleteAction = BURN_PLAN_INVALID_ACTION_INDEX;
463
464
+ *pfRollback = FALSE;
465
+
466
hr = UserExperienceOnCacheBegin(pUX);
467
ExitOnRootFailure(hr, "BA aborted cache.");
468
@@ -732,7 +736,7 @@ extern "C" HRESULT ApplyExecute(
736
__in BURN_ENGINE_STATE* pEngineState,
737
__in_opt HANDLE hCacheThread,
738
__inout DWORD* pcOverallProgressTicks,
735
- __out BOOL* pfKeepRegistration,
739
+ __inout BOOL* pfKeepRegistration,
740
__out BOOL* pfRollback,
741
__out BOOL* pfSuspend,
742
__out BOOTSTRAPPER_APPLY_RESTART* pRestart
@@ -749,6 +753,9 @@ extern "C" HRESULT ApplyExecute(
753
context.cExecutePackagesTotal = pEngineState->plan.cExecutePackagesTotal;
754
context.pcOverallProgressTicks = pcOverallProgressTicks;
755
756
+ *pfRollback = FALSE;
757
+ *pfSuspend = FALSE;
758
+
759
// Send execute begin to BA.
760
hr = UserExperienceOnExecuteBegin(&pEngineState->userExperience, pEngineState->plan.cExecutePackagesTotal);
761
ExitOnRootFailure(hr, "BA aborted execute begin.");
src/engine/apply.h
+1
-1
@@ -89,7 +89,7 @@ HRESULT ApplyExecute(
89
__in BURN_ENGINE_STATE* pEngineState,
90
__in_opt HANDLE hCacheThread,
91
__inout DWORD* pcOverallProgressTicks,
92
- __out BOOL* pfKeepRegistration,
92
+ __inout BOOL* pfKeepRegistration,
93
__out BOOL* pfRollback,
94
__out BOOL* pfSuspend,
95
__out BOOTSTRAPPER_APPLY_RESTART* pRestart
src/engine/cabextract.cpp
+1
-1
@@ -543,7 +543,7 @@ static INT_PTR CopyFileCallback(
543
544
// copy stream name
545
hr = StrAllocStringAnsi(pContext->Cabinet.psczStreamName, pFDINotify->psz1, 0, CP_UTF8);
546
- ExitOnFailure(hr, "Failed to copy stream name: %ls", pFDINotify->psz1);
546
+ ExitOnFailure(hr, "Failed to copy stream name: %hs", pFDINotify->psz1);
547
548
// set operation complete event
549
if (!::SetEvent(pContext->Cabinet.hOperationCompleteEvent))
src/engine/core.cpp
+1
-1
@@ -36,7 +36,7 @@ static HRESULT ParseCommandLine(
36
__out_z LPWSTR* psczSanitizedCommandLine
37
);
38
static HRESULT ParsePipeConnection(
39
- __in LPWSTR* rgArgs,
39
+ __in_ecount(3) LPWSTR* rgArgs,
40
__in BURN_PIPE_CONNECTION* pConnection
41
);
42
static HRESULT DetectPackage(
src/engine/elevation.cpp
+2
-2
@@ -107,7 +107,7 @@ static HRESULT ProcessApplyInitializeMessages(
107
);
108
static HRESULT ProcessGenericExecuteMessages(
109
__in BURN_PIPE_MESSAGE* pMsg,
110
- __in_opt LPVOID pvContext,
110
+ __in LPVOID pvContext,
111
__out DWORD* pdwResult
112
);
113
static HRESULT ProcessMsiPackageMessages(
@@ -1425,7 +1425,7 @@ LExit:
1425
1426
static HRESULT ProcessGenericExecuteMessages(
1427
__in BURN_PIPE_MESSAGE* pMsg,
1428
- __in_opt LPVOID pvContext,
1428
+ __in LPVOID pvContext,
1429
__out DWORD* pdwResult
1430
)
1431
{