=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: comdlg32: Delay OleInitialize() until after file dialog window is created.
Alexandre Julliard
julliard at winehq.org
Thu Feb 2 15:49:27 CST 2017
Module: wine
Branch: master
Commit: 1707df3da2ae288897ca60e21d7ec778ef77a184
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1707df3da2ae288897ca60e21d7ec778ef77a184
Author: Józef Kucia <jkucia at codeweavers.com>
Date: Thu Feb 2 16:10:06 2017 +0100
comdlg32: Delay OleInitialize() until after file dialog window is created.
This fixes a problem exposed by commit
f65e04770dc5748521a0de73814cea0b085bf3f8.
Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/comdlg32/filedlg.c | 12 ++++++------
dlls/comdlg32/filedlgbrowser.h | 1 +
dlls/comdlg32/tests/filedlg.c | 1 -
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index d0d00b3..8a83163 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -252,7 +252,6 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
void *template;
HRSRC hRes;
HANDLE hDlgTmpl = 0;
- HRESULT hr;
/* test for missing functionality */
if (fodInfos->ofnInfos->Flags & UNIMPLEMENTED_FLAGS)
@@ -297,9 +296,6 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
fodInfos->HookMsg.sharevistring = RegisterWindowMessageW(SHAREVISTRINGW);
}
- /* Some shell namespace extensions depend on COM being initialized. */
- hr = OleInitialize(NULL);
-
if (fodInfos->unicode)
lRes = DialogBoxIndirectParamW(COMDLG32_hInstance,
template,
@@ -312,7 +308,7 @@ static BOOL GetFileName95(FileOpenDlgInfos *fodInfos)
fodInfos->ofnInfos->hwndOwner,
FileOpenDlgProc95,
(LPARAM) fodInfos);
- if (SUCCEEDED(hr))
+ if (fodInfos->ole_initialized)
OleUninitialize();
/* Unable to create the dialog */
@@ -1262,7 +1258,11 @@ INT_PTR CALLBACK FileOpenDlgProc95(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
int gripx = GetSystemMetrics( SM_CYHSCROLL);
int gripy = GetSystemMetrics( SM_CYVSCROLL);
- /* Adds the FileOpenDlgInfos in the property list of the dialog
+ /* Some shell namespace extensions depend on COM being initialized. */
+ if (SUCCEEDED(OleInitialize(NULL)))
+ fodInfos->ole_initialized = TRUE;
+
+ /* Adds the FileOpenDlgInfos in the property list of the dialog
so it will be easily accessible through a GetPropA(...) */
SetPropA(hwnd, FileOpenDlgInfosStr, fodInfos);
diff --git a/dlls/comdlg32/filedlgbrowser.h b/dlls/comdlg32/filedlgbrowser.h
index 60f0e7e..6d108a9 100644
--- a/dlls/comdlg32/filedlgbrowser.h
+++ b/dlls/comdlg32/filedlgbrowser.h
@@ -92,6 +92,7 @@ typedef struct
UINT sharevistring;
} HookMsg;
+ BOOL ole_initialized;
} FileOpenDlgInfos;
/***********************************************************************
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index 89aa8fa..ff973a7 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -1296,7 +1296,6 @@ static LRESULT CALLBACK hook_proc(int code, WPARAM wp, LPARAM lp)
* after GetOpenFileA() is a file dialog window. Mark Vista+
* behavior as broken. */
hr = OleInitialize(NULL);
- todo_wine_if(first_dlg)
ok((first_dlg ? hr == S_OK : hr == S_FALSE)
|| broken(first_dlg && hr == S_FALSE),
"OleInitialize() returned %#x (first dialog %#x)\n", hr, first_dlg);
More information about the wine-cvs
mailing list