[PATCH 3/5] ole32: Check the input hwnd is valid in RevokeDragDrop.

Robert Shearman rob at codeweavers.com
Thu Apr 5 05:33:16 CDT 2007


---
  dlls/ole32/ole2.c           |    9 +++++++++
  dlls/ole32/tests/dragdrop.c |    1 -
  2 files changed, 9 insertions(+), 1 deletions(-)
-------------- next part --------------
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index c300f68..1f2c301 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -299,7 +299,10 @@ HRESULT WINAPI RegisterDragDrop(
     return E_INVALIDARG;
 
   if (!IsWindow(hwnd))
+  {
+    ERR("invalid hwnd %p\n", hwnd);
     return DRAGDROP_E_INVALIDHWND;
+  }
 
   /*
    * First, check if the window is already registered.
@@ -341,6 +344,12 @@ HRESULT WINAPI RevokeDragDrop(
 
   TRACE("(%p)\n", hwnd);
 
+  if (!IsWindow(hwnd))
+  {
+    ERR("invalid hwnd %p\n", 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 e7acfb5..f8b52f6 100644
--- a/dlls/ole32/tests/dragdrop.c
+++ b/dlls/ole32/tests/dragdrop.c
@@ -145,6 +145,5 @@ START_TEST(dragdrop)
     ok(droptarget_release_called == 1, "DropTarget_Release should have been called once, not %d times\n", droptarget_release_called);
 
     hr = RevokeDragDrop(NULL);
-    todo_wine
     ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
 }
\ No newline at end of file


More information about the wine-patches mailing list