From: Akihiro Sagawa <sagawa.aki@gmail.com> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=59084 --- dlls/ole32/compobj_private.h | 5 ----- dlls/ole32/ole2.c | 13 +++++++++++-- dlls/ole32/tests/dragdrop.c | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h index 0708a3d7782..f21c0ea099d 100644 --- a/dlls/ole32/compobj_private.h +++ b/dlls/ole32/compobj_private.h @@ -89,11 +89,6 @@ static inline struct oletls *COM_CurrentInfo(void) return NtCurrentTeb()->ReservedForOle; } -static inline struct apartment * COM_CurrentApt(void) -{ - return COM_CurrentInfo()->apt; -} - #define CHARS_IN_GUID 39 /* including NULL */ /* from dlldata.c */ diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index b37b5b0e387..36838628c65 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -50,6 +50,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); WINE_DECLARE_DEBUG_CHANNEL(accel); +/* Combase exports */ +BOOL WINAPI InternalIsProcessInitialized(void); + /****************************************************************************** * These are static/global variables and internal data structures that the * OLE module uses to maintain its state. @@ -544,9 +547,9 @@ HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget) TRACE("(%p,%p)\n", hwnd, pDropTarget); - if (!COM_CurrentApt()) + if (!COM_CurrentInfo()->ole_inits) { - ERR("COM not initialized\n"); + ERR("OleInitialize not called\n"); return E_OUTOFMEMORY; } @@ -559,6 +562,12 @@ HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget) return DRAGDROP_E_INVALIDHWND; } + if (!InternalIsProcessInitialized()) + { + ERR("COM not initialized\n"); + return CO_E_NOTINITIALIZED; + } + /* block register for other processes windows */ GetWindowThreadProcessId(hwnd, &pid); if (pid != GetCurrentProcessId()) diff --git a/dlls/ole32/tests/dragdrop.c b/dlls/ole32/tests/dragdrop.c index a71884b771b..441b11a9595 100644 --- a/dlls/ole32/tests/dragdrop.c +++ b/dlls/ole32/tests/dragdrop.c @@ -788,7 +788,7 @@ static void test_mismatched_cleanup(void) ok(IsWindow(hwnd), "failed to create window\n"); hr = RegisterDragDrop(hwnd, &DropTarget); - todo_wine ok(hr == CO_E_NOTINITIALIZED, "expected CO_E_NOTINITIALIZED, got %#lx\n", hr); + ok(hr == CO_E_NOTINITIALIZED, "expected CO_E_NOTINITIALIZED, got %#lx\n", hr); DestroyWindow(hwnd); @@ -802,7 +802,7 @@ static void test_mismatched_cleanup(void) ok(IsWindow(hwnd), "failed to create window\n"); hr = RegisterDragDrop(hwnd, &DropTarget); - todo_wine ok(hr == S_OK, "expected S_OK, got %#lx\n", hr); + ok(hr == S_OK, "expected S_OK, got %#lx\n", hr); DestroyWindow(hwnd); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10245