From c1d670fd752b96abac09b919d7ca1bff4ebafcbc Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Mon, 10 Feb 2020 00:21:15 +0100 Subject: Windows: Fix warnings reported by Coverity static code analyzer --- src/ExpandVolume/ExpandVolume.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/ExpandVolume/ExpandVolume.c') diff --git a/src/ExpandVolume/ExpandVolume.c b/src/ExpandVolume/ExpandVolume.c index 73878bbb..e340a8bb 100644 --- a/src/ExpandVolume/ExpandVolume.c +++ b/src/ExpandVolume/ExpandVolume.c @@ -515,6 +515,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas #ifdef _WIN64 CRYPTO_INFO tmpCI; PCRYPTO_INFO cryptoInfoBackup = NULL; + BOOL bIsRamEncryptionEnabled = IsRamEncryptionEnabled(); #endif if (pVolumePassword->Length == 0) return -1; @@ -684,7 +685,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas } #ifdef _WIN64 - if (IsRamEncryptionEnabled()) + if (bIsRamEncryptionEnabled) { VcProtectKeys (cryptoInfo, VcGetEncryptionID (cryptoInfo)); } @@ -856,7 +857,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas DebugAddProgressDlgStatus(hwndDlg, L"Writing re-encrypted primary header ...\r\n"); #ifdef _WIN64 - if (IsRamEncryptionEnabled ()) + if (bIsRamEncryptionEnabled) { VirtualLock (&tmpCI, sizeof (CRYPTO_INFO)); memcpy (&tmpCI, cryptoInfo, sizeof (CRYPTO_INFO)); @@ -886,7 +887,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas FALSE ); // use slow poll #ifdef _WIN64 - if (IsRamEncryptionEnabled ()) + if (bIsRamEncryptionEnabled) { cryptoInfo = cryptoInfoBackup; burn (&tmpCI, sizeof (CRYPTO_INFO)); @@ -926,7 +927,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas LARGE_INTEGER hiddenOffset; #ifdef _WIN64 - if (IsRamEncryptionEnabled ()) + if (bIsRamEncryptionEnabled) { VirtualLock (&tmpCI, sizeof (CRYPTO_INFO)); memcpy (&tmpCI, cryptoInfo, sizeof (CRYPTO_INFO)); @@ -938,7 +939,7 @@ static int ExpandVolume (HWND hwndDlg, wchar_t *lpszVolume, Password *pVolumePas nStatus = WriteRandomDataToReservedHeaderAreas (hwndDlg, dev, cryptoInfo, newDataAreaSize, !backupHeader, backupHeader); #ifdef _WIN64 - if (IsRamEncryptionEnabled ()) + if (bIsRamEncryptionEnabled) { cryptoInfo = cryptoInfoBackup; burn (&tmpCI, sizeof (CRYPTO_INFO)); -- cgit v1.2.3