From c0af7a38e8335ff7d1e819bd4cf6b3a65aae5e27 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Miko=C5=82aj_Zalewski?= Date: Tue, 4 Mar 2008 20:26:34 +0100 Subject: [PATCH] shell32: improve SHRegisterDragDrop and SHRevokeDragDrop --- dlls/shell32/shellord.c | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-) diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index ed326ea..9137e81 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -446,9 +446,13 @@ int WINAPIV ShellMessageBoxA( /************************************************************************* * SHRegisterDragDrop [SHELL32.86] * - * Probably equivalent to RegisterDragDrop but under Windows 9x it could use the + * Probably equivalent to RegisterDragDrop but under Windows 95 it could use the * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details + * for details. Under Windows 98 this function initializes the true OLE when called + * the first time time, on XP always returns E_OUTOFMEMORY and it got removed from + * Vista. + * + * We follow Windows 98 behaviour. * * NOTES * exported by ordinal @@ -460,16 +464,30 @@ HRESULT WINAPI SHRegisterDragDrop( HWND hWnd, LPDROPTARGET pDropTarget) { - FIXME("(%p,%p):stub.\n", hWnd, pDropTarget); + static BOOL ole_initialized = FALSE; + HRESULT hr; + + TRACE("(%p,%p)\n", hWnd, pDropTarget); + + if (!ole_initialized) + { + hr = OleInitialize(NULL); + if (FAILED(hr)) + return hr; + ole_initialized = TRUE; + } return RegisterDragDrop(hWnd, pDropTarget); } /************************************************************************* * SHRevokeDragDrop [SHELL32.87] * - * Probably equivalent to RevokeDragDrop but under Windows 9x it could use the + * Probably equivalent to RevokeDragDrop but under Windows 95 it could use the * shell32 built-in "mini-COM" without the need to load ole32.dll - see SHLoadOLE - * for details + * for details. Function removed from Windows Vista. + * + * We call ole32 RevokeDragDrop which seems to work even if OleInitialize was + * not called. * * NOTES * exported by ordinal @@ -479,7 +497,7 @@ HRESULT WINAPI SHRegisterDragDrop( */ HRESULT WINAPI SHRevokeDragDrop(HWND hWnd) { - FIXME("(%p):stub.\n",hWnd); + TRACE("(%p)\n", hWnd); return RevokeDragDrop(hWnd); } -- 1.4.4.2