[misc] improve CoInitialize calls

* Balance with CoUninitialize and add COINIT_DISABLE_OLE1DDE
* Also add /BREPRO linker flag for reproducible VS2019 release builds
This commit is contained in:
Pete Batard 2021-04-09 12:36:30 +01:00
parent 2a3e82fa96
commit 2e1833e91e
No known key found for this signature in database
GPG key ID: 38E0CF5E69EDD671
8 changed files with 31 additions and 17 deletions

View file

@ -1,7 +1,7 @@
/*
* Rufus: The Reliable USB Formatting Utility
* Standard Windows function calls
* Copyright © 2013-2019 Pete Batard <pete@akeo.ie>
* Copyright © 2013-2021 Pete Batard <pete@akeo.ie>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -721,7 +721,7 @@ DWORD WINAPI SetLGPThread(LPVOID param)
GUID snap_guid = { 0x3D271CFCL, 0x2BC6, 0x4AC2, {0xB6, 0x33, 0x3B, 0xDF, 0xF5, 0xBD, 0xAB, 0x2A} };
// Reinitialize COM since it's not shared between threads
IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED));
IGNORE_RETVAL(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE));
// We need an IGroupPolicyObject instance to set a Local Group Policy
hr = CoCreateInstance(&my_CLSID_GroupPolicyObject, NULL, CLSCTX_INPROC_SERVER, &my_IID_IGroupPolicyObject, (LPVOID*)&pLGPO);
@ -797,6 +797,7 @@ error:
RegCloseKey(path_key);
if (pLGPO != NULL)
pLGPO->lpVtbl->Release(pLGPO);
CoUninitialize();
return FALSE;
}