[APPWIZ] Don't forget to CoInitializeEx on COM thread (#5551)

- Do CoInitializeEx and CoUninitialize in download_proc.
CORE-19110, CORE-15786
This commit is contained in:
Katayama Hirofumi MZ 2023-08-14 21:06:40 +09:00 committed by GitHub
parent 485c03ad03
commit 9e6b3f4bbd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -358,7 +358,9 @@ static DWORD WINAPI download_proc(PVOID arg)
{
WCHAR message[256];
WCHAR tmp_dir[MAX_PATH], tmp_file[MAX_PATH];
HRESULT hres;
HRESULT hres, hrCoInit;
hrCoInit = CoInitializeEx(NULL, COINIT_MULTITHREADED);
GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir);
GetTempFileNameW(tmp_dir, NULL, 0, tmp_file);
@ -388,6 +390,10 @@ static DWORD WINAPI download_proc(PVOID arg)
DeleteFileW(tmp_file);
PostMessageW(install_dialog, WM_COMMAND, IDCANCEL, 0);
if (SUCCEEDED(hrCoInit))
CoUninitialize();
return 0;
}