ReactOS 0.4.16-dev-250-g3ecd236
dragdrop.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wine/test.h"
Include dependency graph for dragdrop.c:

Go to the source code of this file.

Classes

struct  method_call
 

Macros

#define _WIN32_DCOM
 
#define COBJMACROS
 
#define CONST_VTABLE
 
#define METHOD_LIST
 
#define METHOD(x)   x
 
#define METHOD(x)   #x
 
#define check_expect(func, expect_param, set_param)    check_expect_((func), (expect_param), (set_param), __FILE__, __LINE__)
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 

Enumerations

enum  method { METHOD_LIST }
 

Functions

static HRESULT check_expect_ (enum method func, DWORD expect_param, DWORD *set_param, const char *file, int line)
 
static HRESULT WINAPI DropTarget_QueryInterface (IDropTarget *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI DropTarget_AddRef (IDropTarget *iface)
 
static ULONG WINAPI DropTarget_Release (IDropTarget *iface)
 
static HRESULT WINAPI DropTarget_DragEnter (IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static HRESULT WINAPI DropTarget_DragOver (IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static HRESULT WINAPI DropTarget_DragLeave (IDropTarget *iface)
 
static HRESULT WINAPI DropTarget_Drop (IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static HRESULT WINAPI DropSource_QueryInterface (IDropSource *iface, REFIID riid, void **ppObj)
 
static ULONG WINAPI DropSource_AddRef (IDropSource *iface)
 
static ULONG WINAPI DropSource_Release (IDropSource *iface)
 
static HRESULT WINAPI DropSource_QueryContinueDrag (IDropSource *iface, BOOL fEscapePressed, DWORD grfKeyState)
 
static HRESULT WINAPI DropSource_GiveFeedback (IDropSource *iface, DWORD dwEffect)
 
static HRESULT WINAPI EnumFORMATETC_QueryInterface (IEnumFORMATETC *iface, REFIID riid, void **ppvObj)
 
static ULONG WINAPI EnumFORMATETC_AddRef (IEnumFORMATETC *iface)
 
static ULONG WINAPI EnumFORMATETC_Release (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFORMATETC_Next (IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumFORMATETC_Skip (IEnumFORMATETC *iface, ULONG celt)
 
static HRESULT WINAPI EnumFORMATETC_Reset (IEnumFORMATETC *iface)
 
static HRESULT WINAPI EnumFORMATETC_Clone (IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
 
static HRESULT WINAPI DataObject_QueryInterface (IDataObject *iface, REFIID riid, void **pObj)
 
static ULONG WINAPI DataObject_AddRef (IDataObject *iface)
 
static ULONG WINAPI DataObject_Release (IDataObject *iface)
 
static HRESULT WINAPI DataObject_GetData (IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
 
static HRESULT WINAPI DataObject_GetDataHere (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
 
static HRESULT WINAPI DataObject_QueryGetData (IDataObject *iface, FORMATETC *pformatetc)
 
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc (IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
 
static HRESULT WINAPI DataObject_SetData (IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
 
static HRESULT WINAPI DataObject_EnumFormatEtc (IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
 
static HRESULT WINAPI DataObject_DAdvise (IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 
static HRESULT WINAPI DataObject_DUnadvise (IDataObject *iface, DWORD dwConnection)
 
static HRESULT WINAPI DataObject_EnumDAdvise (IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
 
static ATOM register_dummy_class (void)
 
static void test_Register_Revoke (void)
 
static void test_DoDragDrop (void)
 
 START_TEST (dragdrop)
 

Variables

static const charmethod_names []
 
const struct method_callcall_ptr
 
struct method_call call_lists [][30]
 
static int droptarget_refs
 
static const IDropTargetVtbl DropTarget_VTbl
 
static IDropTarget DropTarget = { &DropTarget_VTbl }
 
static const IDropSourceVtbl dropsource_vtbl
 
static IDropSource DropSource = { &dropsource_vtbl }
 
static const IEnumFORMATETCVtbl enumformatetc_vtbl
 
static IEnumFORMATETC EnumFORMATETC = { &enumformatetc_vtbl }
 
static const IDataObjectVtbl dataobject_vtbl
 
static IDataObject DataObject = { &dataobject_vtbl }
 

Macro Definition Documentation

◆ _WIN32_DCOM

#define _WIN32_DCOM

Definition at line 21 of file dragdrop.c.

◆ check_expect

#define check_expect (   func,
  expect_param,
  set_param 
)     check_expect_((func), (expect_param), (set_param), __FILE__, __LINE__)

Definition at line 100 of file dragdrop.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file dragdrop.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 23 of file dragdrop.c.

◆ METHOD [1/2]

#define METHOD (   x)    x

Definition at line 59 of file dragdrop.c.

◆ METHOD [2/2]

#define METHOD (   x)    #x

Definition at line 59 of file dragdrop.c.

◆ METHOD_LIST

#define METHOD_LIST
Value:
METHOD(DO_EnumFormatEtc), \
METHOD(DO_QueryGetData), \
METHOD(EnumFMT_Next), \
METHOD(EnumFMT_Reset), \
METHOD(EnumFMT_Skip), \
METHOD(DS_QueryContinueDrag), \
METHOD(DS_GiveFeedback), \
METHOD(DT_DragEnter), \
METHOD(DT_Drop), \
METHOD(DT_DragLeave), \
METHOD(DT_DragOver), \
METHOD(DoDragDrop_effect_in), \
METHOD(DoDragDrop_ret), \
METHOD(DoDragDrop_effect_out), \
METHOD(end_seq)
#define METHOD(x)
Definition: dragdrop.c:59

Definition at line 35 of file dragdrop.c.

◆ ok_ole_success

#define ok_ole_success (   hr,
  func 
)    ok(hr == S_OK, func " failed with error 0x%08x\n", hr)

Definition at line 265 of file dragdrop.c.

Enumeration Type Documentation

◆ method

Enumerator
METHOD_LIST 

Definition at line 53 of file dragdrop.c.

54{
56};
#define METHOD_LIST
Definition: dragdrop.c:35

Function Documentation

◆ check_expect_()

static HRESULT check_expect_ ( enum method  func,
DWORD  expect_param,
DWORD set_param,
const char file,
int  line 
)
static

Definition at line 80 of file dragdrop.c.

81{
82 HRESULT hr;
83
84 do
85 {
86 todo_wine_if(call_ptr->called_todo)
87 ok_( file, line )( func == call_ptr->method, "unexpected call %s instead of %s\n",
89 if (call_ptr->method == func) break;
90 } while ((++call_ptr)->method != end_seq);
91
92 ok_( file, line )( expect_param == call_ptr->expect_param, "%s: unexpected param %08x expected %08x\n",
93 method_names[func], expect_param, call_ptr->expect_param );
94 if (set_param) *set_param = call_ptr->set_param;
95 hr = call_ptr->set_ret;
96 if (call_ptr->method != end_seq) call_ptr++;
97 return hr;
98}
#define ok_(x1, x2)
Definition: atltest.h:61
while(CdLookupNextInitialFileDirent(IrpContext, Fcb, FileContext))
return
Definition: dirsup.c:529
method
Definition: dragdrop.c:54
const struct method_call * call_ptr
Definition: dragdrop.c:78
static const char * method_names[]
Definition: dragdrop.c:60
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble s
Definition: gl.h:2039
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
GLfloat param
Definition: glext.h:5796
_CRTIMP void __cdecl unexpected(void)
if(dx< 0)
Definition: linetemp.h:194
BOOL expected
Definition: store.c:2063
#define todo_wine_if(is_todo)
Definition: custom.c:86
HRESULT hr
Definition: shlfolder.c:183
Definition: fci.c:127
Definition: parser.c:49

◆ DataObject_AddRef()

static ULONG WINAPI DataObject_AddRef ( IDataObject iface)
static

Definition at line 459 of file dragdrop.c.

460{
461 return 2;
462}

◆ DataObject_DAdvise()

static HRESULT WINAPI DataObject_DAdvise ( IDataObject iface,
FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 523 of file dragdrop.c.

529{
530 ok(0, "unexpected call\n");
531 return E_NOTIMPL;
532}
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DataObject_DUnadvise()

static HRESULT WINAPI DataObject_DUnadvise ( IDataObject iface,
DWORD  dwConnection 
)
static

Definition at line 534 of file dragdrop.c.

537{
538 ok(0, "unexpected call\n");
539 return E_NOTIMPL;
540}

◆ DataObject_EnumDAdvise()

static HRESULT WINAPI DataObject_EnumDAdvise ( IDataObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 542 of file dragdrop.c.

545{
546 ok(0, "unexpected call\n");
547 return E_NOTIMPL;
548}

◆ DataObject_EnumFormatEtc()

static HRESULT WINAPI DataObject_EnumFormatEtc ( IDataObject iface,
DWORD  dwDirection,
IEnumFORMATETC **  ppenumFormatEtc 
)
static

Definition at line 513 of file dragdrop.c.

517{
518 HRESULT hr = check_expect(DO_EnumFormatEtc, 0, NULL);
519 *ppenumFormatEtc = &EnumFORMATETC;
520 return hr;
521}
#define NULL
Definition: types.h:112
static IEnumFORMATETC EnumFORMATETC
Definition: dragdrop.c:440
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ DataObject_GetCanonicalFormatEtc()

static HRESULT WINAPI DataObject_GetCanonicalFormatEtc ( IDataObject iface,
FORMATETC *  pformatectIn,
FORMATETC *  pformatetcOut 
)
static

Definition at line 494 of file dragdrop.c.

498{
499 ok(0, "unexpected call\n");
500 return E_NOTIMPL;
501}

◆ DataObject_GetData()

static HRESULT WINAPI DataObject_GetData ( IDataObject iface,
FORMATETC *  pformatetcIn,
STGMEDIUM *  pmedium 
)
static

Definition at line 469 of file dragdrop.c.

473{
474 ok(0, "unexpected call\n");
475 return E_NOTIMPL;
476}

◆ DataObject_GetDataHere()

static HRESULT WINAPI DataObject_GetDataHere ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium 
)
static

Definition at line 478 of file dragdrop.c.

482{
483 ok(0, "unexpected call\n");
484 return E_NOTIMPL;
485}

◆ DataObject_QueryGetData()

static HRESULT WINAPI DataObject_QueryGetData ( IDataObject iface,
FORMATETC *  pformatetc 
)
static

Definition at line 487 of file dragdrop.c.

490{
491 return check_expect(DO_QueryGetData, 0, NULL);
492}

◆ DataObject_QueryInterface()

static HRESULT WINAPI DataObject_QueryInterface ( IDataObject iface,
REFIID  riid,
void **  pObj 
)
static

Definition at line 442 of file dragdrop.c.

446{
449 {
450 *pObj = iface;
451 IDataObject_AddRef(iface);
452 return S_OK;
453 }
454
455 trace("DataObject_QueryInterface: %s\n", wine_dbgstr_guid(riid));
456 return E_NOINTERFACE;
457}
#define trace
Definition: atltest.h:70
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
const GUID IID_IDataObject
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DataObject_Release()

static ULONG WINAPI DataObject_Release ( IDataObject iface)
static

Definition at line 464 of file dragdrop.c.

465{
466 return 1;
467}

◆ DataObject_SetData()

static HRESULT WINAPI DataObject_SetData ( IDataObject iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 503 of file dragdrop.c.

508{
509 ok(0, "unexpected call\n");
510 return E_NOTIMPL;
511}

◆ DropSource_AddRef()

static ULONG WINAPI DropSource_AddRef ( IDropSource iface)
static

Definition at line 347 of file dragdrop.c.

348{
349 return 2;
350}

◆ DropSource_GiveFeedback()

static HRESULT WINAPI DropSource_GiveFeedback ( IDropSource iface,
DWORD  dwEffect 
)
static

Definition at line 365 of file dragdrop.c.

368{
369 return check_expect(DS_GiveFeedback, dwEffect, NULL);
370}

◆ DropSource_QueryContinueDrag()

static HRESULT WINAPI DropSource_QueryContinueDrag ( IDropSource iface,
BOOL  fEscapePressed,
DWORD  grfKeyState 
)
static

Definition at line 357 of file dragdrop.c.

361{
362 return check_expect(DS_QueryContinueDrag, 0, NULL);
363}

◆ DropSource_QueryInterface()

static HRESULT WINAPI DropSource_QueryInterface ( IDropSource iface,
REFIID  riid,
void **  ppObj 
)
static

Definition at line 335 of file dragdrop.c.

336{
338 IsEqualIID(riid, &IID_IDropSource))
339 {
340 *ppObj = iface;
341 IDropSource_AddRef(iface);
342 return S_OK;
343 }
344 return E_NOINTERFACE;
345}

◆ DropSource_Release()

static ULONG WINAPI DropSource_Release ( IDropSource iface)
static

Definition at line 352 of file dragdrop.c.

353{
354 return 1;
355}

◆ DropTarget_AddRef()

static ULONG WINAPI DropTarget_AddRef ( IDropTarget iface)
static

Definition at line 282 of file dragdrop.c.

283{
285 return droptarget_refs;
286}
static int droptarget_refs
Definition: dragdrop.c:262

◆ DropTarget_DragEnter()

static HRESULT WINAPI DropTarget_DragEnter ( IDropTarget iface,
IDataObject pDataObj,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 294 of file dragdrop.c.

298{
299 return check_expect(DT_DragEnter, *pdwEffect, pdwEffect);
300}

◆ DropTarget_DragLeave()

static HRESULT WINAPI DropTarget_DragLeave ( IDropTarget iface)
static

Definition at line 310 of file dragdrop.c.

311{
312 return check_expect(DT_DragLeave, 0, NULL);
313}

◆ DropTarget_DragOver()

static HRESULT WINAPI DropTarget_DragOver ( IDropTarget iface,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 302 of file dragdrop.c.

306{
307 return check_expect(DT_DragOver, *pdwEffect, pdwEffect);
308}

◆ DropTarget_Drop()

static HRESULT WINAPI DropTarget_Drop ( IDropTarget iface,
IDataObject pDataObj,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 315 of file dragdrop.c.

318{
319 return check_expect(DT_Drop, *pdwEffect, pdwEffect);
320}

◆ DropTarget_QueryInterface()

static HRESULT WINAPI DropTarget_QueryInterface ( IDropTarget iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 267 of file dragdrop.c.

269{
270 ok(0, "DropTarget_QueryInterface() shouldn't be called\n");
272 IsEqualIID(riid, &IID_IDropTarget))
273 {
274 IDropTarget_AddRef(iface);
275 *ppvObject = iface;
276 return S_OK;
277 }
278 *ppvObject = NULL;
279 return E_NOINTERFACE;
280}
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082

◆ DropTarget_Release()

static ULONG WINAPI DropTarget_Release ( IDropTarget iface)
static

Definition at line 288 of file dragdrop.c.

289{
291 return droptarget_refs;
292}

◆ EnumFORMATETC_AddRef()

static ULONG WINAPI EnumFORMATETC_AddRef ( IEnumFORMATETC iface)
static

Definition at line 389 of file dragdrop.c.

390{
391 return 2;
392}

◆ EnumFORMATETC_Clone()

static HRESULT WINAPI EnumFORMATETC_Clone ( IEnumFORMATETC iface,
IEnumFORMATETC **  ppenum 
)
static

Definition at line 423 of file dragdrop.c.

425{
426 ok(0, "unexpected call\n");
427 return E_NOTIMPL;
428}

◆ EnumFORMATETC_Next()

static HRESULT WINAPI EnumFORMATETC_Next ( IEnumFORMATETC iface,
ULONG  celt,
FORMATETC *  rgelt,
ULONG pceltFetched 
)
static

Definition at line 399 of file dragdrop.c.

401{
402 static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
403 HRESULT hr = check_expect(EnumFMT_Next, 0, NULL);
404
405 ok(celt == 1, "celt = %d\n", celt);
406 ok(rgelt != NULL, "rgelt == NULL\n");
407 ok(pceltFetched == NULL, "pceltFetched != NULL\n");
408
409 *rgelt = format;
410 return hr;
411}
#define CF_TEXT
Definition: constants.h:396
Definition: format.c:58

◆ EnumFORMATETC_QueryInterface()

static HRESULT WINAPI EnumFORMATETC_QueryInterface ( IEnumFORMATETC iface,
REFIID  riid,
void **  ppvObj 
)
static

Definition at line 382 of file dragdrop.c.

384{
385 ok(0, "unexpected call\n");
386 return E_NOTIMPL;
387}

◆ EnumFORMATETC_Release()

static ULONG WINAPI EnumFORMATETC_Release ( IEnumFORMATETC iface)
static

Definition at line 394 of file dragdrop.c.

395{
396 return 1;
397}

◆ EnumFORMATETC_Reset()

static HRESULT WINAPI EnumFORMATETC_Reset ( IEnumFORMATETC iface)
static

Definition at line 418 of file dragdrop.c.

419{
420 return check_expect(EnumFMT_Reset, 0, NULL);
421}

◆ EnumFORMATETC_Skip()

static HRESULT WINAPI EnumFORMATETC_Skip ( IEnumFORMATETC iface,
ULONG  celt 
)
static

Definition at line 413 of file dragdrop.c.

414{
415 return check_expect(EnumFMT_Skip, 0, NULL);
416}

◆ register_dummy_class()

static ATOM register_dummy_class ( void  )
static

Definition at line 567 of file dragdrop.c.

568{
569 WNDCLASSA wc =
570 {
571 0,
573 0,
574 0,
576 NULL,
578 (HBRUSH)(COLOR_BTNFACE+1),
579 NULL,
580 "WineOleTestClass",
581 };
582
583 return RegisterClassA(&wc);
584}
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_ARROW
Definition: winuser.h:687
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2142
#define COLOR_BTNFACE
Definition: winuser.h:931
char * LPSTR
Definition: xmlstorage.h:182

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dragdrop  )

Definition at line 722 of file dragdrop.c.

723{
725
727#ifdef __REACTOS__
729 !strcmp(winetest_platform, "windows"))
730 {
731 skip("ROSTESTS-182: Skipping ole32_winetest:dragdrop test_DoDragDrop because it hangs on WHS-Testbot. Set winetest_interactive to run it anyway.\n");
732 return;
733 }
734#endif
736}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define skip(...)
Definition: atltest.h:64
static ATOM register_dummy_class(void)
Definition: dragdrop.c:567
static void test_Register_Revoke(void)
Definition: dragdrop.c:586
static void test_DoDragDrop(void)
Definition: dragdrop.c:659
const char * winetest_platform
int winetest_interactive

◆ test_DoDragDrop()

static void test_DoDragDrop ( void  )
static

Definition at line 659 of file dragdrop.c.

660{
661 DWORD effect;
662 HRESULT hr;
663 HWND hwnd;
664 RECT rect;
665 int seq;
666
667 hwnd = CreateWindowExA(WS_EX_TOPMOST, "WineOleTestClass", "Test", 0,
668 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL,
669 NULL, NULL, NULL);
670 ok(IsWindow(hwnd), "failed to create window\n");
671
673 ok(hr == S_OK, "got 0x%08x\n", hr);
674
676 ok(hr == S_OK, "got 0x%08x\n", hr);
677
678 /* incomplete arguments set */
679 hr = DoDragDrop(NULL, NULL, 0, NULL);
680 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
681
683 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
684
686 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
687
688 hr = DoDragDrop(NULL, NULL, 0, &effect);
689 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
690
692 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
693
694 hr = DoDragDrop(NULL, &DropSource, 0, &effect);
695 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
696
697 hr = DoDragDrop(&DataObject, NULL, 0, &effect);
698 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
699
702 ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");
703
704 for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++)
705 {
706 DWORD effect_in;
707 trace("%d\n", seq);
708 call_ptr = call_lists[seq];
709 effect_in = call_ptr->set_param;
710 call_ptr++;
711
712 hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect);
713 check_expect(DoDragDrop_ret, hr, NULL);
714 check_expect(DoDragDrop_effect_out, effect, NULL);
715 }
716
718
720}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
struct method_call call_lists[][30]
Definition: dragdrop.c:104
static IDataObject DataObject
Definition: dragdrop.c:565
static IDropTarget DropTarget
Definition: dragdrop.c:333
static IDropSource DropSource
Definition: dragdrop.c:380
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_EX_TOPMOST
Definition: pedump.c:647
& rect
Definition: startmenu.cpp:1413
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2714
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:778
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_Register_Revoke()

static void test_Register_Revoke ( void  )
static

Definition at line 586 of file dragdrop.c.

587{
588 HANDLE prop;
589 HRESULT hr;
590 HWND hwnd;
591
592 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
594 NULL, NULL, NULL);
595
597 ok(hr == E_OUTOFMEMORY ||
598 broken(hr == CO_E_NOTINITIALIZED), /* NT4 */
599 "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr);
600
602
604 ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08x\n", hr);
605
607 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
608
609 hr = RegisterDragDrop((HWND)0xdeadbeef, &DropTarget);
610 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
611
612 ok(droptarget_refs == 0, "DropTarget refs should be zero not %d\n", droptarget_refs);
614 ok_ole_success(hr, "RegisterDragDrop");
615 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
616
617 prop = GetPropA(hwnd, "OleDropTargetInterface");
618 ok(prop == &DropTarget, "expected IDropTarget pointer %p, got %p\n", &DropTarget, prop);
619
621 ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08x\n", hr);
622
623 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
625
626 /* Win 8 releases the ref in OleUninitialize() */
627 if (droptarget_refs >= 1)
628 {
630 ok_ole_success(hr, "RevokeDragDrop");
631 ok(droptarget_refs == 0 ||
632 broken(droptarget_refs == 1), /* NT4 */
633 "DropTarget refs should be zero not %d\n", droptarget_refs);
634 }
635
637 ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr);
638
640
641 /* try to revoke with already destroyed window */
643
644 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
646 NULL, NULL, NULL);
647
649 ok(hr == S_OK, "got 0x%08x\n", hr);
650
652
654 ok(hr == DRAGDROP_E_INVALIDHWND, "got 0x%08x\n", hr);
655
657}
#define CO_E_NOTINITIALIZED
#define broken(x)
Definition: atltest.h:178
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
#define ok_ole_success(hr, func)
Definition: dragdrop.c:265
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:2653
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:2654
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4318

Referenced by START_TEST().

Variable Documentation

◆ call_lists

struct method_call call_lists[][30]

Definition at line 104 of file dragdrop.c.

Referenced by test_DoDragDrop().

◆ call_ptr

Definition at line 78 of file dragdrop.c.

Referenced by check_expect_(), and test_DoDragDrop().

◆ DataObject

IDataObject DataObject = { &dataobject_vtbl }
static

Definition at line 565 of file dragdrop.c.

Referenced by register_clipboard_formats(), and test_DoDragDrop().

◆ dataobject_vtbl

const IDataObjectVtbl dataobject_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: dragdrop.c:494
static HRESULT WINAPI DataObject_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: dragdrop.c:478
static HRESULT WINAPI DataObject_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: dragdrop.c:523
static ULONG WINAPI DataObject_AddRef(IDataObject *iface)
Definition: dragdrop.c:459
static ULONG WINAPI DataObject_Release(IDataObject *iface)
Definition: dragdrop.c:464
static HRESULT WINAPI DataObject_QueryInterface(IDataObject *iface, REFIID riid, void **pObj)
Definition: dragdrop.c:442
static HRESULT WINAPI DataObject_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: dragdrop.c:534
static HRESULT WINAPI DataObject_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: dragdrop.c:487
static HRESULT WINAPI DataObject_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: dragdrop.c:542
static HRESULT WINAPI DataObject_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: dragdrop.c:503
static HRESULT WINAPI DataObject_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: dragdrop.c:513
static HRESULT WINAPI DataObject_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: dragdrop.c:469

Definition at line 550 of file dragdrop.c.

◆ DropSource

IDropSource DropSource = { &dropsource_vtbl }
static

Definition at line 380 of file dragdrop.c.

Referenced by test_DoDragDrop().

◆ dropsource_vtbl

const IDropSourceVtbl dropsource_vtbl
static
Initial value:
= {
}
static HRESULT WINAPI DropSource_QueryInterface(IDropSource *iface, REFIID riid, void **ppObj)
Definition: dragdrop.c:335
static HRESULT WINAPI DropSource_GiveFeedback(IDropSource *iface, DWORD dwEffect)
Definition: dragdrop.c:365
static HRESULT WINAPI DropSource_QueryContinueDrag(IDropSource *iface, BOOL fEscapePressed, DWORD grfKeyState)
Definition: dragdrop.c:357
static ULONG WINAPI DropSource_Release(IDropSource *iface)
Definition: dragdrop.c:352
static ULONG WINAPI DropSource_AddRef(IDropSource *iface)
Definition: dragdrop.c:347

Definition at line 372 of file dragdrop.c.

◆ DropTarget

IDropTarget DropTarget = { &DropTarget_VTbl }
static

Definition at line 333 of file dragdrop.c.

Referenced by test_DoDragDrop(), and test_Register_Revoke().

◆ droptarget_refs

int droptarget_refs
static

Definition at line 262 of file dragdrop.c.

Referenced by DropTarget_AddRef(), DropTarget_Release(), and test_Register_Revoke().

◆ DropTarget_VTbl

const IDropTargetVtbl DropTarget_VTbl
static
Initial value:
=
{
}
static HRESULT WINAPI DropTarget_DragLeave(IDropTarget *iface)
Definition: dragdrop.c:310
static HRESULT WINAPI DropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:302
static HRESULT WINAPI DropTarget_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:315
static HRESULT WINAPI DropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:294
static ULONG WINAPI DropTarget_AddRef(IDropTarget *iface)
Definition: dragdrop.c:282
static ULONG WINAPI DropTarget_Release(IDropTarget *iface)
Definition: dragdrop.c:288
static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObject)
Definition: dragdrop.c:267

Definition at line 322 of file dragdrop.c.

◆ EnumFORMATETC

Definition at line 440 of file dragdrop.c.

Referenced by DataObject_EnumFormatEtc().

◆ enumformatetc_vtbl

const IEnumFORMATETCVtbl enumformatetc_vtbl
static
Initial value:
= {
}
static ULONG WINAPI EnumFORMATETC_Release(IEnumFORMATETC *iface)
Definition: dragdrop.c:394
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: dragdrop.c:399
static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, REFIID riid, void **ppvObj)
Definition: dragdrop.c:382
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: dragdrop.c:413
static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface)
Definition: dragdrop.c:389
static HRESULT WINAPI EnumFORMATETC_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: dragdrop.c:423
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
Definition: dragdrop.c:418

Definition at line 430 of file dragdrop.c.

◆ method_names

const char* method_names[]
static
Initial value:

Definition at line 60 of file dragdrop.c.

Referenced by check_expect_().