=?UTF-8?Q?Michael=20M=C3=BCller=20?=: shell32: Add IDragSourceHelper stub.

Alexandre Julliard julliard at winehq.org
Thu Dec 1 15:37:44 CST 2016


Module: wine
Branch: master
Commit: 117c0dc5ba81fb44be2fb4a79106533d67135751
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=117c0dc5ba81fb44be2fb4a79106533d67135751

Author: Michael Müller <michael at fds-team.de>
Date:   Thu Dec  1 07:33:19 2016 +0300

shell32: Add IDragSourceHelper stub.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/shell32/dragdrophelper.c | 96 +++++++++++++++++++++++++++++++++++--------
 dlls/shell32/tests/shellole.c |  5 +++
 2 files changed, 83 insertions(+), 18 deletions(-)

diff --git a/dlls/shell32/dragdrophelper.c b/dlls/shell32/dragdrophelper.c
index 0b91449..425ee71 100644
--- a/dlls/shell32/dragdrophelper.c
+++ b/dlls/shell32/dragdrophelper.c
@@ -47,14 +47,21 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell);
 *   IDropTargetHelper implementation
 */
 
-typedef struct {
+typedef struct
+{
     IDropTargetHelper IDropTargetHelper_iface;
+    IDragSourceHelper IDragSourceHelper_iface;
     LONG ref;
-} IDropTargetHelperImpl;
+} dragdrophelper;
+
+static inline dragdrophelper *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
+{
+    return CONTAINING_RECORD(iface, dragdrophelper, IDropTargetHelper_iface);
+}
 
-static inline IDropTargetHelperImpl *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
+static inline dragdrophelper *impl_from_IDragSourceHelper(IDragSourceHelper *iface)
 {
-    return CONTAINING_RECORD(iface, IDropTargetHelperImpl, IDropTargetHelper_iface);
+    return CONTAINING_RECORD(iface, dragdrophelper, IDragSourceHelper_iface);
 }
 
 /**************************************************************************
@@ -62,14 +69,19 @@ static inline IDropTargetHelperImpl *impl_from_IDropTargetHelper(IDropTargetHelp
  */
 static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * iface, REFIID riid, LPVOID * ppvObj)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
 
     TRACE ("(%p)->(%s,%p)\n", This, shdebugstr_guid (riid), ppvObj);
 
     *ppvObj = NULL;
 
-    if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper)) {
-	*ppvObj = &This->IDropTargetHelper_iface;
+    if (IsEqualIID (riid, &IID_IUnknown) || IsEqualIID (riid, &IID_IDropTargetHelper))
+    {
+        *ppvObj = &This->IDropTargetHelper_iface;
+    }
+    else if (IsEqualIID (riid, &IID_IDragSourceHelper))
+    {
+        *ppvObj = &This->IDragSourceHelper_iface;
     }
 
     if (*ppvObj) {
@@ -83,7 +95,7 @@ static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * if
 
 static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     ULONG refCount = InterlockedIncrement(&This->ref);
 
     TRACE ("(%p)->(count=%u)\n", This, refCount - 1);
@@ -93,7 +105,7 @@ static ULONG WINAPI IDropTargetHelper_fnAddRef (IDropTargetHelper * iface)
 
 static ULONG WINAPI IDropTargetHelper_fnRelease (IDropTargetHelper * iface)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     ULONG refCount = InterlockedDecrement(&This->ref);
 
     TRACE ("(%p)->(count=%u)\n", This, refCount + 1);
@@ -113,40 +125,40 @@ static HRESULT WINAPI IDropTargetHelper_fnDragEnter (
 	POINT* ppt,
 	DWORD dwEffect)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     FIXME ("(%p)->(%p %p %p 0x%08x)\n", This,hwndTarget, pDataObject, ppt, dwEffect);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI IDropTargetHelper_fnDragLeave (IDropTargetHelper * iface)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     FIXME ("(%p)->()\n", This);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI IDropTargetHelper_fnDragOver (IDropTargetHelper * iface, POINT* ppt, DWORD dwEffect)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     FIXME ("(%p)->(%p 0x%08x)\n", This, ppt, dwEffect);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI IDropTargetHelper_fnDrop (IDropTargetHelper * iface, IDataObject* pDataObject, POINT* ppt, DWORD dwEffect)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     FIXME ("(%p)->(%p %p 0x%08x)\n", This, pDataObject, ppt, dwEffect);
     return E_NOTIMPL;
 }
 
 static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL fShow)
 {
-    IDropTargetHelperImpl *This = impl_from_IDropTargetHelper(iface);
+    dragdrophelper *This = impl_from_IDropTargetHelper(iface);
     FIXME ("(%p)->(%u)\n", This, fShow);
     return E_NOTIMPL;
 }
 
-static const IDropTargetHelperVtbl vt_IDropTargetHelper =
+static const IDropTargetHelperVtbl DropTargetHelperVtbl =
 {
     IDropTargetHelper_fnQueryInterface,
     IDropTargetHelper_fnAddRef,
@@ -158,12 +170,59 @@ static const IDropTargetHelperVtbl vt_IDropTargetHelper =
     IDropTargetHelper_fnShow
 };
 
+static HRESULT WINAPI DragSourceHelper_QueryInterface (IDragSourceHelper * iface, REFIID riid, LPVOID * ppv)
+{
+    dragdrophelper *This = impl_from_IDragSourceHelper(iface);
+    return IDropTargetHelper_fnQueryInterface(&This->IDropTargetHelper_iface, riid, ppv);
+}
+
+static ULONG WINAPI DragSourceHelper_AddRef (IDragSourceHelper * iface)
+{
+    dragdrophelper *This = impl_from_IDragSourceHelper(iface);
+    return IDropTargetHelper_fnAddRef(&This->IDropTargetHelper_iface);
+}
+
+static ULONG WINAPI DragSourceHelper_Release (IDragSourceHelper * iface)
+{
+    dragdrophelper *This = impl_from_IDragSourceHelper(iface);
+    return IDropTargetHelper_fnRelease(&This->IDropTargetHelper_iface);
+}
+
+static HRESULT WINAPI DragSourceHelper_InitializeFromBitmap(IDragSourceHelper *iface,
+    SHDRAGIMAGE *dragimage, IDataObject *object)
+{
+    dragdrophelper *This = impl_from_IDragSourceHelper(iface);
+
+    FIXME("(%p)->(%p, %p): stub\n", This, dragimage, object);
+
+    return E_NOTIMPL;
+}
+
+static HRESULT WINAPI DragSourceHelper_InitializeFromWindow(IDragSourceHelper *iface, HWND hwnd,
+    POINT *pt, IDataObject *object)
+{
+    dragdrophelper *This = impl_from_IDragSourceHelper(iface);
+
+    FIXME("(%p)->(%p, %s, %p): stub\n", This, hwnd, wine_dbgstr_point(pt), object);
+
+    return E_NOTIMPL;
+}
+
+static const IDragSourceHelperVtbl DragSourceHelperVtbl =
+{
+    DragSourceHelper_QueryInterface,
+    DragSourceHelper_AddRef,
+    DragSourceHelper_Release,
+    DragSourceHelper_InitializeFromBitmap,
+    DragSourceHelper_InitializeFromWindow
+};
+
 /**************************************************************************
 *	IDropTargetHelper_Constructor
 */
 HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
 {
-    IDropTargetHelperImpl *dth;
+    dragdrophelper *dth;
     HRESULT hr;
 
     TRACE ("outer=%p %s %p\n", pUnkOuter, shdebugstr_guid (riid), ppv);
@@ -173,10 +232,11 @@ HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid,
     if (pUnkOuter)
 	return CLASS_E_NOAGGREGATION;
 
-    dth = LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
+    dth = LocalAlloc (LMEM_ZEROINIT, sizeof (dragdrophelper));
     if (!dth) return E_OUTOFMEMORY;
 
-    dth->IDropTargetHelper_iface.lpVtbl = &vt_IDropTargetHelper;
+    dth->IDropTargetHelper_iface.lpVtbl = &DropTargetHelperVtbl;
+    dth->IDragSourceHelper_iface.lpVtbl = &DragSourceHelperVtbl;
     dth->ref = 1;
 
     hr = IDropTargetHelper_QueryInterface (&dth->IDropTargetHelper_iface, riid, ppv);
diff --git a/dlls/shell32/tests/shellole.c b/dlls/shell32/tests/shellole.c
index 5d56431..f611faf 100644
--- a/dlls/shell32/tests/shellole.c
+++ b/dlls/shell32/tests/shellole.c
@@ -892,12 +892,17 @@ static void test_SHCreateSessionKey(void)
 
 static void test_dragdrophelper(void)
 {
+    IDragSourceHelper *dragsource;
     IDropTargetHelper *target;
     HRESULT hr;
 
     hr = CoCreateInstance(&CLSID_DragDropHelper, NULL, CLSCTX_INPROC_SERVER, &IID_IDropTargetHelper, (void **)&target);
     ok(hr == S_OK, "Failed to create IDropTargetHelper, %#x\n", hr);
 
+    hr = IDropTargetHelper_QueryInterface(target, &IID_IDragSourceHelper, (void **)&dragsource);
+    ok(hr == S_OK, "QI failed, %#x\n", hr);
+    IDragSourceHelper_Release(dragsource);
+
     IDropTargetHelper_Release(target);
 }
 




More information about the wine-cvs mailing list