Address code analysis warnings

Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
Simon Rozman 2020-02-13 10:52:57 +01:00
parent f39c7b3caf
commit 6e26cd801a
3 changed files with 10 additions and 7 deletions

View File

@ -1328,7 +1328,10 @@ inline BOOL IsWow64Process()
{
#ifndef _WIN64
// Find IsWow64Process() address in KERNEL32.DLL.
BOOL (WINAPI *_IsWow64Process)(__in HANDLE hProcess, __out PBOOL Wow64Process) = (BOOL(WINAPI*)(__in HANDLE, __out PBOOL))::GetProcAddress(::GetModuleHandle(_T("KERNEL32.DLL")), "IsWow64Process");
HMODULE hKernel32 = ::GetModuleHandle(_T("KERNEL32.DLL"));
if (!hKernel32)
return FALSE;
BOOL (WINAPI *_IsWow64Process)(__in HANDLE hProcess, __out PBOOL Wow64Process) = (BOOL(WINAPI*)(__in HANDLE, __out PBOOL))::GetProcAddress(hKernel32, "IsWow64Process");
// See if our 32-bit process is running in 64-bit environment.
if (_IsWow64Process) {
@ -1343,7 +1346,7 @@ inline BOOL IsWow64Process()
return FALSE;
}
} else {
// This KERNEL32.DLL doesn't know IsWow64Process().Definitely not a WOW64 process.
// This KERNEL32.DLL doesn't know IsWow64Process(). Definitely not a WOW64 process.
return FALSE;
}
#else

View File

@ -203,10 +203,10 @@ UINT SaveSequence(MSIHANDLE hInstall, LPCTSTR szActionExecute, LPCTSTR szActionC
LPCTSTR pszExtension = ::PathFindExtension(sSequenceFilename.c_str());
winstd::tstring sSequenceFilename2;
sprintf(sSequenceFilename2, _T("%.*ls-rb%ls"), pszExtension - sSequenceFilename.c_str(), sSequenceFilename.c_str(), pszExtension);
sprintf(sSequenceFilename2, _T("%.*ls-rb%ls"), (unsigned int)(pszExtension - sSequenceFilename.c_str()), sSequenceFilename.c_str(), pszExtension);
uiResult = ::MsiSetProperty(hInstall, szActionRollback, sSequenceFilename2.c_str());
if (uiResult == NO_ERROR) {
sprintf(sSequenceFilename2, _T("%.*ls-cm%ls"), pszExtension - sSequenceFilename.c_str(), sSequenceFilename.c_str(), pszExtension);
sprintf(sSequenceFilename2, _T("%.*ls-cm%ls"), (unsigned int)(pszExtension - sSequenceFilename.c_str()), sSequenceFilename.c_str(), pszExtension);
uiResult = ::MsiSetProperty(hInstall, szActionCommit, sSequenceFilename2.c_str());
if (uiResult != NO_ERROR) {
::MsiRecordSetInteger(hRecordProg, 1, ERROR_INSTALL_PROPERTY_SET);
@ -270,8 +270,8 @@ UINT ExecuteSequence(MSIHANDLE hInstall)
LPCTSTR pszExtension = ::PathFindExtension(sSequenceFilename.c_str());
winstd::tstring sSequenceFilenameCM, sSequenceFilenameRB;
sprintf(sSequenceFilenameRB, _T("%.*ls-rb%ls"), pszExtension - sSequenceFilename.c_str(), sSequenceFilename.c_str(), pszExtension);
sprintf(sSequenceFilenameCM, _T("%.*ls-cm%ls"), pszExtension - sSequenceFilename.c_str(), sSequenceFilename.c_str(), pszExtension);
sprintf(sSequenceFilenameRB, _T("%.*ls-rb%ls"), (unsigned int)(pszExtension - sSequenceFilename.c_str()), sSequenceFilename.c_str(), pszExtension);
sprintf(sSequenceFilenameCM, _T("%.*ls-cm%ls"), (unsigned int)(pszExtension - sSequenceFilename.c_str()), sSequenceFilename.c_str(), pszExtension);
// After commit, delete rollback file. After rollback, delete commit file.
session.m_olCommit.push_back(new MSICA::COpFileDelete(

View File

@ -323,7 +323,7 @@ HRESULT COpRegKeyDelete::Execute(CSession *pSession)
for (;;) {
HKEY hKeyTest;
sprintf(sBackupName, L"%.*ls (orig %u)", iLength, m_sValue.c_str(), ++uiCount);
sprintf(sBackupName, L"%.*ls (orig %u)", (unsigned int)iLength, m_sValue.c_str(), ++uiCount);
lResult = ::RegOpenKeyExW(m_hKeyRoot, sBackupName.c_str(), 0, KEY_ENUMERATE_SUB_KEYS | samAdditional, &hKeyTest);
if (lResult != NO_ERROR) break;
::RegCloseKey(hKeyTest);