Commit 8e7a0411 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32: Simplify drag drop helper object creation.

parent 794efcce
......@@ -52,43 +52,12 @@ typedef struct {
LONG ref;
} IDropTargetHelperImpl;
static const IDropTargetHelperVtbl vt_IDropTargetHelper;
static inline IDropTargetHelperImpl *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
{
return CONTAINING_RECORD(iface, IDropTargetHelperImpl, IDropTargetHelper_iface);
}
/**************************************************************************
* IDropTargetHelper_Constructor
*/
HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
{
IDropTargetHelperImpl *dth;
TRACE ("unkOut=%p %s\n", pUnkOuter, shdebugstr_guid (riid));
if (!ppv)
return E_POINTER;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
dth = LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
if (!dth) return E_OUTOFMEMORY;
dth->ref = 0;
dth->IDropTargetHelper_iface.lpVtbl = &vt_IDropTargetHelper;
if (FAILED (IDropTargetHelper_QueryInterface (&dth->IDropTargetHelper_iface, riid, ppv))) {
LocalFree(dth);
return E_NOINTERFACE;
}
TRACE ("--(%p)\n", dth);
return S_OK;
}
/**************************************************************************
* IDropTargetHelper_fnQueryInterface
*/
static HRESULT WINAPI IDropTargetHelper_fnQueryInterface (IDropTargetHelper * iface, REFIID riid, LPVOID * ppvObj)
......@@ -179,12 +148,39 @@ static HRESULT WINAPI IDropTargetHelper_fnShow (IDropTargetHelper * iface, BOOL
static const IDropTargetHelperVtbl vt_IDropTargetHelper =
{
IDropTargetHelper_fnQueryInterface,
IDropTargetHelper_fnAddRef,
IDropTargetHelper_fnRelease,
IDropTargetHelper_fnDragEnter,
IDropTargetHelper_fnDragLeave,
IDropTargetHelper_fnDragOver,
IDropTargetHelper_fnDrop,
IDropTargetHelper_fnShow
IDropTargetHelper_fnQueryInterface,
IDropTargetHelper_fnAddRef,
IDropTargetHelper_fnRelease,
IDropTargetHelper_fnDragEnter,
IDropTargetHelper_fnDragLeave,
IDropTargetHelper_fnDragOver,
IDropTargetHelper_fnDrop,
IDropTargetHelper_fnShow
};
/**************************************************************************
* IDropTargetHelper_Constructor
*/
HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
{
IDropTargetHelperImpl *dth;
HRESULT hr;
TRACE ("outer=%p %s %p\n", pUnkOuter, shdebugstr_guid (riid), ppv);
if (!ppv)
return E_POINTER;
if (pUnkOuter)
return CLASS_E_NOAGGREGATION;
dth = LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
if (!dth) return E_OUTOFMEMORY;
dth->IDropTargetHelper_iface.lpVtbl = &vt_IDropTargetHelper;
dth->ref = 1;
hr = IDropTargetHelper_QueryInterface (&dth->IDropTargetHelper_iface, riid, ppv);
IDropTargetHelper_Release (&dth->IDropTargetHelper_iface);
return hr;
}
......@@ -890,12 +890,33 @@ static void test_SHCreateSessionKey(void)
RegCloseKey(hkey2);
}
static void test_dragdrophelper(void)
{
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);
IDropTargetHelper_Release(target);
}
START_TEST(shellole)
{
HRESULT hr;
init();
hr = CoInitialize(NULL);
ok(hr == S_OK, "CoInitialize failed (0x%08x)\n", hr);
if (hr != S_OK)
return;
test_SHPropStg_functions();
test_SHCreateQueryCancelAutoPlayMoniker();
test_DragQueryFile();
test_SHCreateSessionKey();
test_dragdrophelper();
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment