ReactOS 0.4.16-dev-2332-g4cba65d
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 %#08lx\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 int test_reentrance
 
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 %#08lx\n", hr)

Definition at line 266 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 %08lx expected %08lx\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
void CDECL unexpected(void)
Definition: cpp.c:711
method
Definition: dragdrop.c:54
const struct method_call * call_ptr
Definition: dragdrop.c:78
static const char * method_names[]
Definition: dragdrop.c:60
GLdouble s
Definition: gl.h:2039
GLenum func
Definition: glext.h:6028
GLdouble n
Definition: glext.h:7729
GLfloat param
Definition: glext.h:5796
if(dx< 0)
Definition: linetemp.h:194
#define todo_wine_if(is_todo)
Definition: minitest.h:81
BOOL expected
Definition: store.c:2000
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 487 of file dragdrop.c.

488{
489 return 2;
490}

◆ DataObject_DAdvise()

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

Definition at line 551 of file dragdrop.c.

557{
558 ok(0, "unexpected call\n");
559 return E_NOTIMPL;
560}
#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 562 of file dragdrop.c.

565{
566 ok(0, "unexpected call\n");
567 return E_NOTIMPL;
568}

◆ DataObject_EnumDAdvise()

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

Definition at line 570 of file dragdrop.c.

573{
574 ok(0, "unexpected call\n");
575 return E_NOTIMPL;
576}

◆ DataObject_EnumFormatEtc()

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

Definition at line 541 of file dragdrop.c.

545{
546 HRESULT hr = check_expect(DO_EnumFormatEtc, 0, NULL);
547 *ppenumFormatEtc = &EnumFORMATETC;
548 return hr;
549}
#define NULL
Definition: types.h:112
static IEnumFORMATETC EnumFORMATETC
Definition: dragdrop.c:468
#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 522 of file dragdrop.c.

526{
527 ok(0, "unexpected call\n");
528 return E_NOTIMPL;
529}

◆ DataObject_GetData()

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

Definition at line 497 of file dragdrop.c.

501{
502 ok(0, "unexpected call\n");
503 return E_NOTIMPL;
504}

◆ DataObject_GetDataHere()

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

Definition at line 506 of file dragdrop.c.

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

◆ DataObject_QueryGetData()

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

Definition at line 515 of file dragdrop.c.

518{
519 return check_expect(DO_QueryGetData, 0, NULL);
520}

◆ DataObject_QueryInterface()

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

Definition at line 470 of file dragdrop.c.

474{
477 {
478 *pObj = iface;
479 IDataObject_AddRef(iface);
480 return S_OK;
481 }
482
483 trace("DataObject_QueryInterface: %s\n", wine_dbgstr_guid(riid));
484 return E_NOINTERFACE;
485}
#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:206
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ DataObject_Release()

static ULONG WINAPI DataObject_Release ( IDataObject iface)
static

Definition at line 492 of file dragdrop.c.

493{
494 return 1;
495}

◆ DataObject_SetData()

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

Definition at line 531 of file dragdrop.c.

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

◆ DropSource_AddRef()

static ULONG WINAPI DropSource_AddRef ( IDropSource iface)
static

Definition at line 348 of file dragdrop.c.

349{
350 return 2;
351}

◆ DropSource_GiveFeedback()

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

Definition at line 393 of file dragdrop.c.

396{
397 return check_expect(DS_GiveFeedback, dwEffect, NULL);
398}

◆ DropSource_QueryContinueDrag()

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

Definition at line 358 of file dragdrop.c.

362{
363 HRESULT hr = check_expect(DS_QueryContinueDrag, 0, NULL);
364 if (test_reentrance)
365 {
366 MSG msg;
367 BOOL r;
368 int num = 0;
369
370 HWND hwnd = GetCapture();
371 ok(hwnd != 0, "Expected capture window\n");
372
373 /* send some fake events that should be ignored */
376 r &= PostMessageA(hwnd, WM_LBUTTONUP, 0, 0);
378 ok(r, "Unable to post messages\n");
379
380 /* run the message loop for this thread */
381 while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE))
382 {
385 num++;
386 }
387
388 ok(num >= 4, "Expected at least 4 messages but %d were processed\n", num);
389 }
390 return hr;
391}
#define msg(x)
Definition: auth_time.c:54
static int test_reentrance
Definition: dragdrop.c:263
unsigned int BOOL
Definition: ntddk_ex.h:94
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint GLuint num
Definition: glext.h:9618
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LRESULT WINAPI DispatchMessageA(_In_ const MSG *)
BOOL WINAPI TranslateMessage(_In_ const MSG *)
#define WM_MOUSEMOVE
Definition: winuser.h:1803
HWND WINAPI GetCapture(void)
Definition: message.c:2881
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define PM_REMOVE
Definition: winuser.h:1207
#define WM_LBUTTONUP
Definition: winuser.h:1805
BOOL WINAPI PeekMessageA(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
#define WM_KEYDOWN
Definition: winuser.h:1743
#define VK_ESCAPE
Definition: winuser.h:2250
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ DropSource_QueryInterface()

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

Definition at line 336 of file dragdrop.c.

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

◆ DropSource_Release()

static ULONG WINAPI DropSource_Release ( IDropSource iface)
static

Definition at line 353 of file dragdrop.c.

354{
355 return 1;
356}

◆ DropTarget_AddRef()

static ULONG WINAPI DropTarget_AddRef ( IDropTarget iface)
static

Definition at line 283 of file dragdrop.c.

284{
286 return droptarget_refs;
287}
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 295 of file dragdrop.c.

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

◆ DropTarget_DragLeave()

static HRESULT WINAPI DropTarget_DragLeave ( IDropTarget iface)
static

Definition at line 311 of file dragdrop.c.

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

◆ DropTarget_DragOver()

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

Definition at line 303 of file dragdrop.c.

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

◆ DropTarget_Drop()

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

Definition at line 316 of file dragdrop.c.

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

◆ DropTarget_QueryInterface()

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

Definition at line 268 of file dragdrop.c.

270{
271 ok(0, "DropTarget_QueryInterface() shouldn't be called\n");
273 IsEqualIID(riid, &IID_IDropTarget))
274 {
275 IDropTarget_AddRef(iface);
276 *ppvObject = iface;
277 return S_OK;
278 }
279 *ppvObject = NULL;
280 return E_NOINTERFACE;
281}

◆ DropTarget_Release()

static ULONG WINAPI DropTarget_Release ( IDropTarget iface)
static

Definition at line 289 of file dragdrop.c.

290{
292 return droptarget_refs;
293}

◆ EnumFORMATETC_AddRef()

static ULONG WINAPI EnumFORMATETC_AddRef ( IEnumFORMATETC iface)
static

Definition at line 417 of file dragdrop.c.

418{
419 return 2;
420}

◆ EnumFORMATETC_Clone()

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

Definition at line 451 of file dragdrop.c.

453{
454 ok(0, "unexpected call\n");
455 return E_NOTIMPL;
456}

◆ EnumFORMATETC_Next()

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

Definition at line 427 of file dragdrop.c.

429{
430 static FORMATETC format = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
431 HRESULT hr = check_expect(EnumFMT_Next, 0, NULL);
432
433 ok(celt == 1, "celt = %ld\n", celt);
434 ok(rgelt != NULL, "rgelt == NULL\n");
435 ok(pceltFetched == NULL, "pceltFetched != NULL\n");
436
437 *rgelt = format;
438 return hr;
439}
#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 410 of file dragdrop.c.

412{
413 ok(0, "unexpected call\n");
414 return E_NOTIMPL;
415}

◆ EnumFORMATETC_Release()

static ULONG WINAPI EnumFORMATETC_Release ( IEnumFORMATETC iface)
static

Definition at line 422 of file dragdrop.c.

423{
424 return 1;
425}

◆ EnumFORMATETC_Reset()

static HRESULT WINAPI EnumFORMATETC_Reset ( IEnumFORMATETC iface)
static

Definition at line 446 of file dragdrop.c.

447{
448 return check_expect(EnumFMT_Reset, 0, NULL);
449}

◆ EnumFORMATETC_Skip()

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

Definition at line 441 of file dragdrop.c.

442{
443 return check_expect(EnumFMT_Skip, 0, NULL);
444}

◆ register_dummy_class()

static ATOM register_dummy_class ( void  )
static

Definition at line 595 of file dragdrop.c.

596{
597 WNDCLASSA wc =
598 {
599 0,
601 0,
602 0,
604 NULL,
606 (HBRUSH)(COLOR_BTNFACE+1),
607 NULL,
608 "WineOleTestClass",
609 };
610
611 return RegisterClassA(&wc);
612}
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:695
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2459
#define COLOR_BTNFACE
Definition: winuser.h:939
char * LPSTR
Definition: xmlstorage.h:182

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dragdrop  )

Definition at line 753 of file dragdrop.c.

754{
756
758#ifdef __REACTOS__
760 !strcmp(winetest_platform, "windows"))
761 {
762 skip("ROSTESTS-182: Skipping ole32_winetest:dragdrop test_DoDragDrop because it hangs on WHS-Testbot. Set winetest_interactive to run it anyway.\n");
763 return;
764 }
765#endif
767}
#define skip(...)
Definition: atltest.h:64
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static ATOM register_dummy_class(void)
Definition: dragdrop.c:595
static void test_Register_Revoke(void)
Definition: dragdrop.c:614
static void test_DoDragDrop(void)
Definition: dragdrop.c:687
const char * winetest_platform
int winetest_interactive

◆ test_DoDragDrop()

static void test_DoDragDrop ( void  )
static

Definition at line 687 of file dragdrop.c.

688{
689 DWORD effect;
690 HRESULT hr;
691 HWND hwnd;
692 RECT rect;
693 int seq;
694
695 hwnd = CreateWindowExA(WS_EX_TOPMOST, "WineOleTestClass", "Test", 0,
696 CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL,
697 NULL, NULL, NULL);
698 ok(IsWindow(hwnd), "failed to create window\n");
699
701 ok(hr == S_OK, "got 0x%08lx\n", hr);
702
704 ok(hr == S_OK, "got 0x%08lx\n", hr);
705
706 /* incomplete arguments set */
707 hr = DoDragDrop(NULL, NULL, 0, NULL);
708 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
709
711 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
712
714 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
715
716 hr = DoDragDrop(NULL, NULL, 0, &effect);
717 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
718
720 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
721
722 hr = DoDragDrop(NULL, &DropSource, 0, &effect);
723 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
724
725 hr = DoDragDrop(&DataObject, NULL, 0, &effect);
726 ok(hr == E_INVALIDARG, "got 0x%08lx\n", hr);
727
730 ok(SetCursorPos(rect.left+50, rect.top+50), "SetCursorPos failed\n");
731
733 {
734 for (seq = 0; seq < ARRAY_SIZE(call_lists); seq++)
735 {
736 DWORD effect_in;
737 trace("%d\n", seq);
738 call_ptr = call_lists[seq];
739 effect_in = call_ptr->set_param;
740 call_ptr++;
741
742 hr = DoDragDrop(&DataObject, &DropSource, effect_in, &effect);
743 check_expect(DoDragDrop_ret, hr, NULL);
744 check_expect(DoDragDrop_effect_out, effect, NULL);
745 }
746 }
747
749
751}
#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:162
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:547
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:737
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
struct method_call call_lists[][30]
Definition: dragdrop.c:104
static IDataObject DataObject
Definition: dragdrop.c:593
static IDropTarget DropTarget
Definition: dragdrop.c:334
static IDropSource DropSource
Definition: dragdrop.c:408
unsigned long DWORD
Definition: ntddk_ex.h:95
#define WS_EX_TOPMOST
Definition: pedump.c:647
& rect
Definition: startmenu.cpp:1413
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:3056
#define CW_USEDEFAULT
Definition: winuser.h:225
#define SW_SHOW
Definition: winuser.h:786
BOOL WINAPI DestroyWindow(_In_ HWND)

Referenced by START_TEST().

◆ test_Register_Revoke()

static void test_Register_Revoke ( void  )
static

Definition at line 614 of file dragdrop.c.

615{
616 HANDLE prop;
617 HRESULT hr;
618 HWND hwnd;
619
620 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
622 NULL, NULL, NULL);
623
625 ok(hr == E_OUTOFMEMORY ||
626 broken(hr == CO_E_NOTINITIALIZED), /* NT4 */
627 "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08lx\n", hr);
628
630
632 ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08lx\n", hr);
633
635 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
636
637 hr = RegisterDragDrop((HWND)0xdeadbeef, &DropTarget);
638 ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
639
640 ok(droptarget_refs == 0, "DropTarget refs should be zero not %d\n", droptarget_refs);
642 ok_ole_success(hr, "RegisterDragDrop");
643 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
644
645 prop = GetPropA(hwnd, "OleDropTargetInterface");
646 ok(prop == &DropTarget, "expected IDropTarget pointer %p, got %p\n", &DropTarget, prop);
647
649 ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08lx\n", hr);
650
651 ok(droptarget_refs >= 1, "DropTarget refs should be at least one\n");
653
654 /* Win 8 releases the ref in OleUninitialize() */
655 if (droptarget_refs >= 1)
656 {
658 ok_ole_success(hr, "RevokeDragDrop");
659 ok(droptarget_refs == 0 ||
660 broken(droptarget_refs == 1), /* NT4 */
661 "DropTarget refs should be zero not %d\n", droptarget_refs);
662 }
663
665 ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08lx\n", hr);
666
668
669 /* try to revoke with already destroyed window */
671
672 hwnd = CreateWindowA("WineOleTestClass", "Test", 0,
674 NULL, NULL, NULL);
675
677 ok(hr == S_OK, "got 0x%08lx\n", hr);
678
680
682 ok(hr == DRAGDROP_E_INVALIDHWND, "got 0x%08lx\n", hr);
683
685}
#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:629
#define ok_ole_success(hr, func)
Definition: dragdrop.c:266
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:3762
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:3764
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4417

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 593 of file dragdrop.c.

Referenced by 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:522
static HRESULT WINAPI DataObject_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: dragdrop.c:506
static HRESULT WINAPI DataObject_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: dragdrop.c:551
static ULONG WINAPI DataObject_AddRef(IDataObject *iface)
Definition: dragdrop.c:487
static ULONG WINAPI DataObject_Release(IDataObject *iface)
Definition: dragdrop.c:492
static HRESULT WINAPI DataObject_QueryInterface(IDataObject *iface, REFIID riid, void **pObj)
Definition: dragdrop.c:470
static HRESULT WINAPI DataObject_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: dragdrop.c:562
static HRESULT WINAPI DataObject_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: dragdrop.c:515
static HRESULT WINAPI DataObject_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: dragdrop.c:570
static HRESULT WINAPI DataObject_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: dragdrop.c:531
static HRESULT WINAPI DataObject_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: dragdrop.c:541
static HRESULT WINAPI DataObject_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: dragdrop.c:497

Definition at line 578 of file dragdrop.c.

◆ DropSource

IDropSource DropSource = { &dropsource_vtbl }
static

Definition at line 408 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:336
static HRESULT WINAPI DropSource_GiveFeedback(IDropSource *iface, DWORD dwEffect)
Definition: dragdrop.c:393
static HRESULT WINAPI DropSource_QueryContinueDrag(IDropSource *iface, BOOL fEscapePressed, DWORD grfKeyState)
Definition: dragdrop.c:358
static ULONG WINAPI DropSource_Release(IDropSource *iface)
Definition: dragdrop.c:353
static ULONG WINAPI DropSource_AddRef(IDropSource *iface)
Definition: dragdrop.c:348

Definition at line 400 of file dragdrop.c.

◆ DropTarget

IDropTarget DropTarget = { &DropTarget_VTbl }
static

Definition at line 334 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:311
static HRESULT WINAPI DropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:303
static HRESULT WINAPI DropTarget_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:316
static HRESULT WINAPI DropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:295
static ULONG WINAPI DropTarget_AddRef(IDropTarget *iface)
Definition: dragdrop.c:283
static ULONG WINAPI DropTarget_Release(IDropTarget *iface)
Definition: dragdrop.c:289
static HRESULT WINAPI DropTarget_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObject)
Definition: dragdrop.c:268

Definition at line 323 of file dragdrop.c.

◆ EnumFORMATETC

Definition at line 468 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:422
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: dragdrop.c:427
static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, REFIID riid, void **ppvObj)
Definition: dragdrop.c:410
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: dragdrop.c:441
static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface)
Definition: dragdrop.c:417
static HRESULT WINAPI EnumFORMATETC_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: dragdrop.c:451
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
Definition: dragdrop.c:446

Definition at line 458 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_().

◆ test_reentrance

int test_reentrance
static

Definition at line 263 of file dragdrop.c.

Referenced by DropSource_QueryContinueDrag(), and test_DoDragDrop().