COM initialization replaced by auto-initializer

This commit is contained in:
Simon Rozman 2017-04-25 00:52:33 +02:00
parent 8fa496acc5
commit f15b0e2745
2 changed files with 3 additions and 2 deletions

View File

@ -87,7 +87,7 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
//::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK); //::MessageBox(NULL, _T(__FUNCTION__), _T("MSICA"), MB_OK);
UINT uiResult; UINT uiResult;
BOOL bIsCoInitialized = SUCCEEDED(::CoInitialize(NULL)); winstd::com_initializer com_init(NULL);
MSICA::COpList MSICA::COpList
olInstallCertificates, olRemoveCertificates, olInstallCertificates, olRemoveCertificates,
olInstallWLANProfiles, olRemoveWLANProfiles, olInstallWLANProfiles, olRemoveWLANProfiles,
@ -584,7 +584,6 @@ UINT MSICA_API MSICAInitialize(MSIHANDLE hInstall)
::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg); ::MsiProcessMessage(hInstall, INSTALLMESSAGE_ERROR, hRecordProg);
} }
if (bIsCoInitialized) ::CoUninitialize();
return uiResult; return uiResult;
} }

View File

@ -23,6 +23,8 @@
#define MSICA_DLL // This library is compiled as a DLL #define MSICA_DLL // This library is compiled as a DLL
#endif #endif
#include <WinStd\COM.h>
#include <Windows.h> #include <Windows.h>
#include <corerror.h> #include <corerror.h>