I think we're meant to call CoInitializeEx() on launcher startup

This commit is contained in:
Adam Demasi 2024-12-11 23:58:01 +10:30
parent 02b09374b6
commit c139ecd196
No known key found for this signature in database
GPG key ID: 5D3B26B3D58C7D91
2 changed files with 8 additions and 5 deletions

View file

@ -40,7 +40,7 @@ static const LPWSTR GetUpdateSiteURL() {
}
void LaunchUpdateSite(int argc, LPWSTR *argv, int nCmdShow) {
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
HRESULT hr = S_OK;
IWebBrowser2 *browser;
VARIANT url;
VARIANT flags;
@ -48,10 +48,6 @@ void LaunchUpdateSite(int argc, LPWSTR *argv, int nCmdShow) {
LPTSTR siteURL;
HMONITOR monitor;
if (!SUCCEEDED(hr)) {
goto end;
}
// If running on 2k/XP, make sure we're elevated. If not, show Run As prompt.
if (!AtLeastWinVista() && !IsUserAdmin()) {
LPWSTR args = (LPWSTR)LocalAlloc(LPTR, 512 * sizeof(WCHAR));

View file

@ -35,6 +35,12 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
g_hInstance = hInstance;
Startup();
HRESULT hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
if (!SUCCEEDED(hr)) {
ExitProcess(hr);
return hr;
}
int argc;
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
@ -116,6 +122,7 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine
}
}
CoUninitialize();
ExitProcess(msg.wParam);
return msg.wParam;
}