ReactOS  0.4.14-dev-614-gbfd8a84
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 }
GLenum func
Definition: glext.h:6028
return
Definition: dirsup.c:529
HRESULT hr
Definition: shlfolder.c:183
GLdouble n
Definition: glext.h:7729
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
while(1)
Definition: macro.lex.yy.c:740
Definition: parser.c:48
#define todo_wine_if(is_todo)
Definition: test.h:164
if(!(yy_init))
Definition: macro.lex.yy.c:714
LONG HRESULT
Definition: typedefs.h:77
const struct method_call * call_ptr
Definition: dragdrop.c:78
GLfloat param
Definition: glext.h:5796
static const char * method_names[]
Definition: dragdrop.c:60
method
Definition: dragdrop.c:53
_CRTIMP void __cdecl unexpected(void)
GLdouble s
Definition: gl.h:2039
BOOL expected
Definition: store.c:2063
#define ok_(x1, x2)
Definition: atltest.h:61
Definition: fci.c:126

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100
static IEnumFORMATETC EnumFORMATETC
Definition: dragdrop.c:440

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ DataObject_QueryInterface()

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

Definition at line 442 of file dragdrop.c.

446 {
447  if (IsEqualIID(riid, &IID_IUnknown) ||
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 E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const char * wine_dbgstr_guid(const GUID *guid)
const GUID IID_IDataObject
#define trace
Definition: atltest.h:70
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ DropSource_QueryInterface()

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

Definition at line 335 of file dragdrop.c.

336 {
337  if (IsEqualIID(riid, &IID_IUnknown) ||
338  IsEqualIID(riid, &IID_IDropSource))
339  {
340  *ppObj = iface;
341  IDropSource_AddRef(iface);
342  return S_OK;
343  }
344  return E_NOINTERFACE;
345 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ 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 {
284  droptarget_refs++;
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 }
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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");
271  if (IsEqualIID(riid, &IID_IUnknown) ||
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 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ DropTarget_Release()

static ULONG WINAPI DropTarget_Release ( IDropTarget iface)
static

Definition at line 288 of file dragdrop.c.

289 {
290  droptarget_refs--;
291  return droptarget_refs;
292 }
static int droptarget_refs
Definition: dragdrop.c:262

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
HRESULT hr
Definition: shlfolder.c:183
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
smooth NULL
Definition: ftsmooth.c:416
#define CF_TEXT
Definition: constants.h:396
LONG HRESULT
Definition: typedefs.h:77
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100
#define ok(value,...)
Definition: atltest.h:57

◆ 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 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100

◆ 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 }
char * LPSTR
Definition: xmlstorage.h:182
smooth NULL
Definition: ftsmooth.c:416
#define COLOR_BTNFACE
Definition: winuser.h:918
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:821
LRESULT WINAPI DefWindowProcA(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HCURSOR WINAPI LoadCursorA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2059
#define IDC_ARROW
Definition: winuser.h:682
ATOM WINAPI RegisterClassA(_In_ CONST WNDCLASSA *)

Referenced by START_TEST().

◆ START_TEST()

START_TEST ( dragdrop  )

Definition at line 722 of file dragdrop.c.

723 {
725 
727 #ifdef __REACTOS__
728  if (!winetest_interactive &&
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
735  test_DoDragDrop();
736 }
int winetest_interactive
static void test_Register_Revoke(void)
Definition: dragdrop.c:586
const char * winetest_platform
static ATOM register_dummy_class(void)
Definition: dragdrop.c:567
static void test_DoDragDrop(void)
Definition: dragdrop.c:659
#define skip(...)
Definition: atltest.h:64
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ 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 
672  hr = OleInitialize(NULL);
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 
682  hr = DoDragDrop(NULL, &DropSource, 0, NULL);
683  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
684 
685  hr = DoDragDrop(&DataObject, NULL, 0, NULL);
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 
717  OleUninitialize();
718 
720 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT hr
Definition: shlfolder.c:183
BOOL WINAPI IsWindow(_In_opt_ HWND)
static IDataObject DataObject
Definition: dragdrop.c:565
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI DestroyWindow(_In_ HWND)
& rect
Definition: startmenu.cpp:1413
#define CW_USEDEFAULT
Definition: winuser.h:225
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define SW_SHOW
Definition: winuser.h:769
#define trace
Definition: atltest.h:70
LONG HRESULT
Definition: typedefs.h:77
static IDropTarget DropTarget
Definition: dragdrop.c:333
const struct method_call * call_ptr
Definition: dragdrop.c:78
BOOL WINAPI SetCursorPos(_In_ int, _In_ int)
Definition: cursoricon.c:2627
#define check_expect(func, expect_param, set_param)
Definition: dragdrop.c:100
unsigned long DWORD
Definition: ntddk_ex.h:95
static IDropSource DropSource
Definition: dragdrop.c:380
#define WS_EX_TOPMOST
Definition: pedump.c:647
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
#define ok(value,...)
Definition: atltest.h:57
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:753
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 GetWindowRect(_In_ HWND, _Out_ LPRECT)
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230
struct method_call call_lists[][30]
Definition: dragdrop.c:104

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");
624  OleUninitialize();
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 
656  OleUninitialize();
657 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:557
BOOL WINAPI DestroyWindow(_In_ HWND)
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:639
#define CO_E_NOTINITIALIZED
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4290
#define CW_USEDEFAULT
Definition: winuser.h:225
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:2654
LONG HRESULT
Definition: typedefs.h:77
static IDropTarget DropTarget
Definition: dragdrop.c:333
static int droptarget_refs
Definition: dragdrop.c:262
#define ok_ole_success(hr, func)
Definition: dragdrop.c:265
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:2653
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:169
#define S_OK
Definition: intsafe.h:59
HANDLE WINAPI GetPropA(_In_ HWND, _In_ LPCSTR)
#define ok(value,...)
Definition: atltest.h:57
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:230

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_GetData(IDataObject *iface, FORMATETC *pformatetcIn, STGMEDIUM *pmedium)
Definition: dragdrop.c:469
static HRESULT WINAPI DataObject_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
Definition: dragdrop.c:542
static HRESULT WINAPI DataObject_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
Definition: dragdrop.c:523
static HRESULT WINAPI DataObject_QueryGetData(IDataObject *iface, FORMATETC *pformatetc)
Definition: dragdrop.c:487
static ULONG WINAPI DataObject_AddRef(IDataObject *iface)
Definition: dragdrop.c:459
static HRESULT WINAPI DataObject_GetDataHere(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium)
Definition: dragdrop.c:478
static HRESULT WINAPI DataObject_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
Definition: dragdrop.c:513
static HRESULT WINAPI DataObject_DUnadvise(IDataObject *iface, DWORD dwConnection)
Definition: dragdrop.c:534
static HRESULT WINAPI DataObject_QueryInterface(IDataObject *iface, REFIID riid, void **pObj)
Definition: dragdrop.c:442
static ULONG WINAPI DataObject_Release(IDataObject *iface)
Definition: dragdrop.c:464
static HRESULT WINAPI DataObject_SetData(IDataObject *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
Definition: dragdrop.c:503
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc(IDataObject *iface, FORMATETC *pformatectIn, FORMATETC *pformatetcOut)
Definition: dragdrop.c:494

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 ULONG WINAPI DropSource_Release(IDropSource *iface)
Definition: dragdrop.c:352
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_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_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:315
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
static HRESULT WINAPI DropTarget_DragLeave(IDropTarget *iface)
Definition: dragdrop.c:310
static HRESULT WINAPI DropTarget_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:294
static HRESULT WINAPI DropTarget_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: dragdrop.c:302
static ULONG WINAPI DropTarget_AddRef(IDropTarget *iface)
Definition: dragdrop.c:282

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_Clone(IEnumFORMATETC *iface, IEnumFORMATETC **ppenum)
Definition: dragdrop.c:423
static ULONG WINAPI EnumFORMATETC_AddRef(IEnumFORMATETC *iface)
Definition: dragdrop.c:389
static HRESULT WINAPI EnumFORMATETC_Skip(IEnumFORMATETC *iface, ULONG celt)
Definition: dragdrop.c:413
static HRESULT WINAPI EnumFORMATETC_Reset(IEnumFORMATETC *iface)
Definition: dragdrop.c:418
static HRESULT WINAPI EnumFORMATETC_QueryInterface(IEnumFORMATETC *iface, REFIID riid, void **ppvObj)
Definition: dragdrop.c:382
static HRESULT WINAPI EnumFORMATETC_Next(IEnumFORMATETC *iface, ULONG celt, FORMATETC *rgelt, ULONG *pceltFetched)
Definition: dragdrop.c:399

Definition at line 430 of file dragdrop.c.

◆ method_names

const char* method_names[]
static
Initial value:
=
{
}
#define METHOD_LIST
Definition: dragdrop.c:35

Definition at line 60 of file dragdrop.c.

Referenced by check_expect_().