https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a822eadce6b4f20066fdc…
commit a822eadce6b4f20066fdc3b1a36f311d325b0c86
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Sep 28 20:13:28 2020 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Mon Sep 28 20:13:28 2020 +0900
[SHELL32] CoUninitialize only if CoInitialize* is successful
Technically CoUninitialize should be called only if CoInitializeEx succeeded
(including S_FALSE).
CORE-1419
---
dll/win32/shell32/dialogs/dialogs.cpp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dll/win32/shell32/dialogs/dialogs.cpp
b/dll/win32/shell32/dialogs/dialogs.cpp
index 6996a416076..1e5635cb1d1 100644
--- a/dll/win32/shell32/dialogs/dialogs.cpp
+++ b/dll/win32/shell32/dialogs/dialogs.cpp
@@ -29,6 +29,7 @@ typedef struct
LPCWSTR lpstrTitle;
LPCWSTR lpstrDescription;
UINT uFlags;
+ BOOL bCoInited;
} RUNFILEDLGPARAMS;
typedef BOOL (WINAPI * LPFNOFN) (OPENFILENAMEW *);
@@ -549,14 +550,17 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM
wParam, LPARA
hwndEdit = ComboInfo.hwndItem;
ASSERT(::IsWindow(hwndEdit));
- CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); // SHAutoComplete needs co
init
+ // SHAutoComplete needs co init
+ prfdp->bCoInited = SUCCEEDED(CoInitializeEx(NULL,
COINIT_APARTMENTTHREADED));
+
SHAutoComplete(hwndEdit, SHACF_FILESYSTEM | SHACF_FILESYS_ONLY |
SHACF_URLALL);
SetFocus(hwndCombo);
return TRUE;
case WM_DESTROY:
- CoUninitialize();
+ if (prfdp->bCoInited)
+ CoUninitialize();
break;
case WM_COMMAND: