Rob Shearman : ole32: Check for COM not being initialised and an invalid window handle being input to RegisterDragDrop .
Module: wine Branch: master Commit: 2d8ae2cf8320df853070c31b6737db3789a4a411 URL: http://source.winehq.org/git/wine.git/?a=commit;h=2d8ae2cf8320df853070c31b67... Author: Rob Shearman <rob(a)codeweavers.com> Date: Thu Apr 5 11:32:32 2007 +0100 ole32: Check for COM not being initialised and an invalid window handle being input to RegisterDragDrop. --- dlls/ole32/ole2.c | 11 ++++++++++- dlls/ole32/tests/dragdrop.c | 7 ------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index 8b61ac6..c300f68 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -289,9 +289,18 @@ HRESULT WINAPI RegisterDragDrop( TRACE("(%p,%p)\n", hwnd, pDropTarget); + if (!COM_CurrentApt()) + { + ERR("COM not initialized\n"); + return CO_E_NOTINITIALIZED; + } + if (!pDropTarget) return E_INVALIDARG; - + + if (!IsWindow(hwnd)) + return DRAGDROP_E_INVALIDHWND; + /* * First, check if the window is already registered. */ diff --git a/dlls/ole32/tests/dragdrop.c b/dlls/ole32/tests/dragdrop.c index 2193f0f..05d80d0 100644 --- a/dlls/ole32/tests/dragdrop.c +++ b/dlls/ole32/tests/dragdrop.c @@ -113,7 +113,6 @@ START_TEST(dragdrop) HRESULT hr; hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); - todo_wine ok(hr == CO_E_NOTINITIALIZED, "RegisterDragDrop without OLE initialized should have returned CO_E_NOTINITIALIZED instead of 0x%08x\n", hr); OleInitialize(NULL); @@ -122,19 +121,14 @@ START_TEST(dragdrop) ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08x\n", hr); hr = RegisterDragDrop(NULL, &DropTarget); - todo_wine ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr); hr = RegisterDragDrop((HWND)0xdeadbeef, &DropTarget); - todo_wine ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr); - todo_wine ok(droptarget_addref_called == 0, "DropTarget_AddRef shouldn't have been called\n"); hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); - todo_wine ok_ole_success(hr, "RegisterDragDrop"); - todo_wine ok(droptarget_addref_called == 1, "DropTarget_AddRef should have been called once, not %d times\n", droptarget_addref_called); hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); @@ -148,7 +142,6 @@ START_TEST(dragdrop) hr = RevokeDragDrop(GetDesktopWindow()); todo_wine ok_ole_success(hr, "RevokeDragDrop"); - todo_wine ok(droptarget_release_called == 1, "DropTarget_Release should have been called once, not %d times\n", droptarget_release_called); hr = RevokeDragDrop(NULL);
participants (1)
-
Alexandre Julliard