shell32: Simplify drag drop helper object creation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
794efcceee
commit
8e7a041154
|
@ -52,42 +52,11 @@ typedef struct {
|
||||||
LONG ref;
|
LONG ref;
|
||||||
} IDropTargetHelperImpl;
|
} IDropTargetHelperImpl;
|
||||||
|
|
||||||
static const IDropTargetHelperVtbl vt_IDropTargetHelper;
|
|
||||||
|
|
||||||
static inline IDropTargetHelperImpl *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
|
static inline IDropTargetHelperImpl *impl_from_IDropTargetHelper(IDropTargetHelper *iface)
|
||||||
{
|
{
|
||||||
return CONTAINING_RECORD(iface, IDropTargetHelperImpl, 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
|
* IDropTargetHelper_fnQueryInterface
|
||||||
*/
|
*/
|
||||||
|
@ -188,3 +157,30 @@ static const IDropTargetHelperVtbl vt_IDropTargetHelper =
|
||||||
IDropTargetHelper_fnDrop,
|
IDropTargetHelper_fnDrop,
|
||||||
IDropTargetHelper_fnShow
|
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);
|
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)
|
START_TEST(shellole)
|
||||||
{
|
{
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
|
hr = CoInitialize(NULL);
|
||||||
|
ok(hr == S_OK, "CoInitialize failed (0x%08x)\n", hr);
|
||||||
|
if (hr != S_OK)
|
||||||
|
return;
|
||||||
|
|
||||||
test_SHPropStg_functions();
|
test_SHPropStg_functions();
|
||||||
test_SHCreateQueryCancelAutoPlayMoniker();
|
test_SHCreateQueryCancelAutoPlayMoniker();
|
||||||
test_DragQueryFile();
|
test_DragQueryFile();
|
||||||
test_SHCreateSessionKey();
|
test_SHCreateSessionKey();
|
||||||
|
test_dragdrophelper();
|
||||||
|
|
||||||
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue