2 * Object Linking and Embedding Tests
4 * Copyright 2005 Robert Shearman
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
31 #include "wine/test.h"
33 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
35 static IPersistStorage OleObjectPersistStg
;
36 static IOleCache
*cache
;
37 static IRunnableObject
*runnable
;
39 static const CLSID CLSID_WineTest
=
40 { /* 9474ba1a-258b-490b-bc13-516e9239ace0 */
44 {0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe0}
47 static char const * const *expected_method_list
;
49 #define CHECK_EXPECTED_METHOD(method_name) \
51 trace("%s\n", method_name); \
52 ok(*expected_method_list != NULL, "Extra method %s called\n", method_name); \
53 if (*expected_method_list) \
55 ok(!strcmp(*expected_method_list, method_name), "Expected %s to be called instead of %s\n", \
56 *expected_method_list, method_name); \
57 expected_method_list++; \
61 static HRESULT WINAPI
OleObject_QueryInterface(IOleObject
*iface
, REFIID riid
, void **ppv
)
63 CHECK_EXPECTED_METHOD("OleObject_QueryInterface");
67 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IOleObject
))
69 else if (IsEqualIID(riid
, &IID_IPersistStorage
))
70 *ppv
= &OleObjectPersistStg
;
71 else if (IsEqualIID(riid
, &IID_IOleCache
))
73 else if (IsEqualIID(riid
, &IID_IRunnableObject
))
77 IUnknown_AddRef((IUnknown
*)*ppv
);
81 trace("OleObject_QueryInterface: returning E_NOINTERFACE\n");
85 static ULONG WINAPI
OleObject_AddRef(IOleObject
*iface
)
87 CHECK_EXPECTED_METHOD("OleObject_AddRef");
91 static ULONG WINAPI
OleObject_Release(IOleObject
*iface
)
93 CHECK_EXPECTED_METHOD("OleObject_Release");
97 static HRESULT WINAPI OleObject_SetClientSite
100 IOleClientSite
*pClientSite
103 CHECK_EXPECTED_METHOD("OleObject_SetClientSite");
107 static HRESULT WINAPI OleObject_GetClientSite
110 IOleClientSite
**ppClientSite
113 CHECK_EXPECTED_METHOD("OleObject_GetClientSite");
117 static HRESULT WINAPI OleObject_SetHostNames
120 LPCOLESTR szContainerApp
,
121 LPCOLESTR szContainerObj
124 CHECK_EXPECTED_METHOD("OleObject_SetHostNames");
128 static HRESULT WINAPI OleObject_Close
134 CHECK_EXPECTED_METHOD("OleObject_Close");
138 static HRESULT WINAPI OleObject_SetMoniker
141 DWORD dwWhichMoniker
,
145 CHECK_EXPECTED_METHOD("OleObject_SetMoniker");
149 static HRESULT WINAPI OleObject_GetMoniker
153 DWORD dwWhichMoniker
,
157 CHECK_EXPECTED_METHOD("OleObject_GetMoniker");
161 static HRESULT WINAPI OleObject_InitFromData
164 IDataObject
*pDataObject
,
169 CHECK_EXPECTED_METHOD("OleObject_InitFromData");
173 static HRESULT WINAPI OleObject_GetClipboardData
177 IDataObject
**ppDataObject
180 CHECK_EXPECTED_METHOD("OleObject_GetClipboardData");
184 static HRESULT WINAPI OleObject_DoVerb
189 IOleClientSite
*pActiveSite
,
195 CHECK_EXPECTED_METHOD("OleObject_DoVerb");
199 static HRESULT WINAPI OleObject_EnumVerbs
202 IEnumOLEVERB
**ppEnumOleVerb
205 CHECK_EXPECTED_METHOD("OleObject_EnumVerbs");
209 static HRESULT WINAPI OleObject_Update
214 CHECK_EXPECTED_METHOD("OleObject_Update");
218 static HRESULT WINAPI OleObject_IsUpToDate
223 CHECK_EXPECTED_METHOD("OleObject_IsUpToDate");
227 static HRESULT WINAPI OleObject_GetUserClassID
233 CHECK_EXPECTED_METHOD("OleObject_GetUserClassID");
237 static HRESULT WINAPI OleObject_GetUserType
241 LPOLESTR
*pszUserType
244 CHECK_EXPECTED_METHOD("OleObject_GetUserType");
248 static HRESULT WINAPI OleObject_SetExtent
255 CHECK_EXPECTED_METHOD("OleObject_SetExtent");
259 static HRESULT WINAPI OleObject_GetExtent
266 CHECK_EXPECTED_METHOD("OleObject_GetExtent");
270 static HRESULT WINAPI OleObject_Advise
273 IAdviseSink
*pAdvSink
,
277 CHECK_EXPECTED_METHOD("OleObject_Advise");
281 static HRESULT WINAPI OleObject_Unadvise
287 CHECK_EXPECTED_METHOD("OleObject_Unadvise");
291 static HRESULT WINAPI OleObject_EnumAdvise
294 IEnumSTATDATA
**ppenumAdvise
297 CHECK_EXPECTED_METHOD("OleObject_EnumAdvise");
301 static HRESULT WINAPI OleObject_GetMiscStatus
308 CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus");
309 *pdwStatus
= DVASPECT_CONTENT
;
313 static HRESULT WINAPI OleObject_SetColorScheme
319 CHECK_EXPECTED_METHOD("OleObject_SetColorScheme");
323 static const IOleObjectVtbl OleObjectVtbl
=
325 OleObject_QueryInterface
,
328 OleObject_SetClientSite
,
329 OleObject_GetClientSite
,
330 OleObject_SetHostNames
,
332 OleObject_SetMoniker
,
333 OleObject_GetMoniker
,
334 OleObject_InitFromData
,
335 OleObject_GetClipboardData
,
339 OleObject_IsUpToDate
,
340 OleObject_GetUserClassID
,
341 OleObject_GetUserType
,
346 OleObject_EnumAdvise
,
347 OleObject_GetMiscStatus
,
348 OleObject_SetColorScheme
351 static IOleObject OleObject
= { &OleObjectVtbl
};
353 static HRESULT WINAPI
OleObjectPersistStg_QueryInterface(IPersistStorage
*iface
, REFIID riid
, void **ppv
)
355 trace("OleObjectPersistStg_QueryInterface\n");
356 return IUnknown_QueryInterface((IUnknown
*)&OleObject
, riid
, ppv
);
359 static ULONG WINAPI
OleObjectPersistStg_AddRef(IPersistStorage
*iface
)
361 CHECK_EXPECTED_METHOD("OleObjectPersistStg_AddRef");
365 static ULONG WINAPI
OleObjectPersistStg_Release(IPersistStorage
*iface
)
367 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Release");
371 static HRESULT WINAPI
OleObjectPersistStg_GetClassId(IPersistStorage
*iface
, CLSID
*clsid
)
373 CHECK_EXPECTED_METHOD("OleObjectPersistStg_GetClassId");
377 static HRESULT WINAPI OleObjectPersistStg_IsDirty
379 IPersistStorage
*iface
382 CHECK_EXPECTED_METHOD("OleObjectPersistStg_IsDirty");
386 static HRESULT WINAPI OleObjectPersistStg_InitNew
388 IPersistStorage
*iface
,
392 CHECK_EXPECTED_METHOD("OleObjectPersistStg_InitNew");
396 static HRESULT WINAPI OleObjectPersistStg_Load
398 IPersistStorage
*iface
,
402 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Load");
406 static HRESULT WINAPI OleObjectPersistStg_Save
408 IPersistStorage
*iface
,
413 CHECK_EXPECTED_METHOD("OleObjectPersistStg_Save");
417 static HRESULT WINAPI OleObjectPersistStg_SaveCompleted
419 IPersistStorage
*iface
,
423 CHECK_EXPECTED_METHOD("OleObjectPersistStg_SaveCompleted");
427 static HRESULT WINAPI OleObjectPersistStg_HandsOffStorage
429 IPersistStorage
*iface
432 CHECK_EXPECTED_METHOD("OleObjectPersistStg_HandsOffStorage");
436 static const IPersistStorageVtbl OleObjectPersistStgVtbl
=
438 OleObjectPersistStg_QueryInterface
,
439 OleObjectPersistStg_AddRef
,
440 OleObjectPersistStg_Release
,
441 OleObjectPersistStg_GetClassId
,
442 OleObjectPersistStg_IsDirty
,
443 OleObjectPersistStg_InitNew
,
444 OleObjectPersistStg_Load
,
445 OleObjectPersistStg_Save
,
446 OleObjectPersistStg_SaveCompleted
,
447 OleObjectPersistStg_HandsOffStorage
450 static IPersistStorage OleObjectPersistStg
= { &OleObjectPersistStgVtbl
};
452 static HRESULT WINAPI
OleObjectCache_QueryInterface(IOleCache
*iface
, REFIID riid
, void **ppv
)
454 return IUnknown_QueryInterface((IUnknown
*)&OleObject
, riid
, ppv
);
457 static ULONG WINAPI
OleObjectCache_AddRef(IOleCache
*iface
)
459 CHECK_EXPECTED_METHOD("OleObjectCache_AddRef");
463 static ULONG WINAPI
OleObjectCache_Release(IOleCache
*iface
)
465 CHECK_EXPECTED_METHOD("OleObjectCache_Release");
469 static HRESULT WINAPI OleObjectCache_Cache
472 FORMATETC
*pformatetc
,
477 CHECK_EXPECTED_METHOD("OleObjectCache_Cache");
481 static HRESULT WINAPI OleObjectCache_Uncache
487 CHECK_EXPECTED_METHOD("OleObjectCache_Uncache");
491 static HRESULT WINAPI OleObjectCache_EnumCache
494 IEnumSTATDATA
**ppenumSTATDATA
497 CHECK_EXPECTED_METHOD("OleObjectCache_EnumCache");
502 static HRESULT WINAPI OleObjectCache_InitCache
505 IDataObject
*pDataObject
508 CHECK_EXPECTED_METHOD("OleObjectCache_InitCache");
513 static HRESULT WINAPI OleObjectCache_SetData
516 FORMATETC
*pformatetc
,
521 CHECK_EXPECTED_METHOD("OleObjectCache_SetData");
526 static const IOleCacheVtbl OleObjectCacheVtbl
=
528 OleObjectCache_QueryInterface
,
529 OleObjectCache_AddRef
,
530 OleObjectCache_Release
,
531 OleObjectCache_Cache
,
532 OleObjectCache_Uncache
,
533 OleObjectCache_EnumCache
,
534 OleObjectCache_InitCache
,
535 OleObjectCache_SetData
538 static IOleCache OleObjectCache
= { &OleObjectCacheVtbl
};
540 static HRESULT WINAPI
OleObjectCF_QueryInterface(IClassFactory
*iface
, REFIID riid
, void **ppv
)
542 if (IsEqualIID(riid
, &IID_IUnknown
) || IsEqualIID(riid
, &IID_IClassFactory
))
545 IUnknown_AddRef(iface
);
549 return E_NOINTERFACE
;
552 static ULONG WINAPI
OleObjectCF_AddRef(IClassFactory
*iface
)
557 static ULONG WINAPI
OleObjectCF_Release(IClassFactory
*iface
)
562 static HRESULT WINAPI
OleObjectCF_CreateInstance(IClassFactory
*iface
, IUnknown
*punkOuter
, REFIID riid
, void **ppv
)
564 return IUnknown_QueryInterface((IUnknown
*)&OleObject
, riid
, ppv
);
567 static HRESULT WINAPI
OleObjectCF_LockServer(IClassFactory
*iface
, BOOL lock
)
572 static const IClassFactoryVtbl OleObjectCFVtbl
=
574 OleObjectCF_QueryInterface
,
577 OleObjectCF_CreateInstance
,
578 OleObjectCF_LockServer
581 static IClassFactory OleObjectCF
= { &OleObjectCFVtbl
};
583 static HRESULT WINAPI
OleObjectRunnable_QueryInterface(IRunnableObject
*iface
, REFIID riid
, void **ppv
)
585 return IUnknown_QueryInterface((IUnknown
*)&OleObject
, riid
, ppv
);
588 static ULONG WINAPI
OleObjectRunnable_AddRef(IRunnableObject
*iface
)
590 CHECK_EXPECTED_METHOD("OleObjectRunnable_AddRef");
594 static ULONG WINAPI
OleObjectRunnable_Release(IRunnableObject
*iface
)
596 CHECK_EXPECTED_METHOD("OleObjectRunnable_Release");
600 static HRESULT WINAPI
OleObjectRunnable_GetRunningClass(
601 IRunnableObject
*iface
,
604 CHECK_EXPECTED_METHOD("OleObjectRunnable_GetRunningClass");
608 static HRESULT WINAPI
OleObjectRunnable_Run(
609 IRunnableObject
*iface
,
612 CHECK_EXPECTED_METHOD("OleObjectRunnable_Run");
616 static BOOL WINAPI
OleObjectRunnable_IsRunning(IRunnableObject
*iface
)
618 CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning");
622 static HRESULT WINAPI
OleObjectRunnable_LockRunning(
623 IRunnableObject
*iface
,
625 BOOL fLastUnlockCloses
)
627 CHECK_EXPECTED_METHOD("OleObjectRunnable_LockRunning");
631 static HRESULT WINAPI
OleObjectRunnable_SetContainedObject(
632 IRunnableObject
*iface
,
635 CHECK_EXPECTED_METHOD("OleObjectRunnable_SetContainedObject");
639 static const IRunnableObjectVtbl OleObjectRunnableVtbl
=
641 OleObjectRunnable_QueryInterface
,
642 OleObjectRunnable_AddRef
,
643 OleObjectRunnable_Release
,
644 OleObjectRunnable_GetRunningClass
,
645 OleObjectRunnable_Run
,
646 OleObjectRunnable_IsRunning
,
647 OleObjectRunnable_LockRunning
,
648 OleObjectRunnable_SetContainedObject
651 static IRunnableObject OleObjectRunnable
= { &OleObjectRunnableVtbl
};
653 static const CLSID CLSID_Equation3
= {0x0002CE02, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} };
655 static void test_OleCreate(IStorage
*pStorage
)
660 static const char *methods_olerender_none
[] =
662 "OleObject_QueryInterface",
664 "OleObject_QueryInterface",
665 "OleObjectPersistStg_AddRef",
666 "OleObjectPersistStg_InitNew",
667 "OleObjectPersistStg_Release",
671 static const char *methods_olerender_draw
[] =
673 "OleObject_QueryInterface",
675 "OleObject_QueryInterface",
676 "OleObjectPersistStg_AddRef",
677 "OleObjectPersistStg_InitNew",
678 "OleObjectPersistStg_Release",
679 "OleObject_QueryInterface",
680 "OleObjectRunnable_AddRef",
681 "OleObjectRunnable_Run",
682 "OleObjectRunnable_Release",
683 "OleObject_QueryInterface",
684 "OleObjectCache_AddRef",
685 "OleObjectCache_Cache",
686 "OleObjectCache_Release",
690 static const char *methods_olerender_format
[] =
692 "OleObject_QueryInterface",
694 "OleObject_QueryInterface",
696 "OleObject_GetMiscStatus",
697 "OleObject_QueryInterface",
698 "OleObjectPersistStg_AddRef",
699 "OleObjectPersistStg_InitNew",
700 "OleObjectPersistStg_Release",
701 "OleObject_SetClientSite",
703 "OleObject_QueryInterface",
704 "OleObjectRunnable_AddRef",
705 "OleObjectRunnable_Run",
706 "OleObjectRunnable_Release",
707 "OleObject_QueryInterface",
708 "OleObjectCache_AddRef",
709 "OleObjectCache_Cache",
710 "OleObjectCache_Release",
714 static const char *methods_olerender_asis
[] =
716 "OleObject_QueryInterface",
718 "OleObject_QueryInterface",
719 "OleObjectPersistStg_AddRef",
720 "OleObjectPersistStg_InitNew",
721 "OleObjectPersistStg_Release",
725 static const char *methods_olerender_draw_no_runnable
[] =
727 "OleObject_QueryInterface",
729 "OleObject_QueryInterface",
730 "OleObjectPersistStg_AddRef",
731 "OleObjectPersistStg_InitNew",
732 "OleObjectPersistStg_Release",
733 "OleObject_QueryInterface",
734 "OleObject_QueryInterface",
735 "OleObjectCache_AddRef",
736 "OleObjectCache_Cache",
737 "OleObjectCache_Release",
741 static const char *methods_olerender_draw_no_cache
[] =
743 "OleObject_QueryInterface",
745 "OleObject_QueryInterface",
746 "OleObjectPersistStg_AddRef",
747 "OleObjectPersistStg_InitNew",
748 "OleObjectPersistStg_Release",
749 "OleObject_QueryInterface",
750 "OleObjectRunnable_AddRef",
751 "OleObjectRunnable_Run",
752 "OleObjectRunnable_Release",
753 "OleObject_QueryInterface",
758 runnable
= &OleObjectRunnable
;
759 cache
= &OleObjectCache
;
760 expected_method_list
= methods_olerender_none
;
761 trace("OleCreate with OLERENDER_NONE:\n");
762 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_NONE
, NULL
, NULL
, pStorage
, (void **)&pObject
);
763 ok_ole_success(hr
, "OleCreate");
764 IOleObject_Release(pObject
);
765 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
767 expected_method_list
= methods_olerender_draw
;
768 trace("OleCreate with OLERENDER_DRAW:\n");
769 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_DRAW
, NULL
, NULL
, pStorage
, (void **)&pObject
);
770 ok_ole_success(hr
, "OleCreate");
771 IOleObject_Release(pObject
);
772 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
774 formatetc
.cfFormat
= CF_TEXT
;
775 formatetc
.ptd
= NULL
;
776 formatetc
.dwAspect
= DVASPECT_CONTENT
;
777 formatetc
.lindex
= -1;
778 formatetc
.tymed
= TYMED_HGLOBAL
;
779 expected_method_list
= methods_olerender_format
;
780 trace("OleCreate with OLERENDER_FORMAT:\n");
781 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_FORMAT
, &formatetc
, (IOleClientSite
*)0xdeadbeef, pStorage
, (void **)&pObject
);
782 ok_ole_success(hr
, "OleCreate");
783 IOleObject_Release(pObject
);
784 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
786 expected_method_list
= methods_olerender_asis
;
787 trace("OleCreate with OLERENDER_ASIS:\n");
788 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_ASIS
, NULL
, NULL
, pStorage
, (void **)&pObject
);
789 ok_ole_success(hr
, "OleCreate");
790 IOleObject_Release(pObject
);
791 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
794 expected_method_list
= methods_olerender_draw_no_runnable
;
795 trace("OleCreate with OLERENDER_DRAW (no IOlObjectRunnable):\n");
796 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_DRAW
, NULL
, NULL
, pStorage
, (void **)&pObject
);
797 ok_ole_success(hr
, "OleCreate");
798 IOleObject_Release(pObject
);
799 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
801 runnable
= &OleObjectRunnable
;
803 expected_method_list
= methods_olerender_draw_no_cache
;
804 trace("OleCreate with OLERENDER_DRAW (no IOlObjectRunnable):\n");
805 hr
= OleCreate(&CLSID_Equation3
, &IID_IOleObject
, OLERENDER_DRAW
, NULL
, NULL
, pStorage
, (void **)&pObject
);
806 ok_ole_success(hr
, "OleCreate");
807 IOleObject_Release(pObject
);
808 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
812 static void test_OleLoad(IStorage
*pStorage
)
817 static const char *methods_oleload
[] =
819 "OleObject_QueryInterface",
821 "OleObject_QueryInterface",
823 "OleObject_GetMiscStatus",
824 "OleObject_QueryInterface",
825 "OleObjectPersistStg_AddRef",
826 "OleObjectPersistStg_Load",
827 "OleObjectPersistStg_Release",
828 "OleObject_SetClientSite",
830 "OleObject_QueryInterface",
835 expected_method_list
= methods_oleload
;
837 hr
= OleLoad(pStorage
, &IID_IOleObject
, (IOleClientSite
*)0xdeadbeef, (void **)&pObject
);
838 ok_ole_success(hr
, "OleLoad");
839 IOleObject_Release(pObject
);
840 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
843 static BOOL STDMETHODCALLTYPE
draw_continue(ULONG_PTR param
)
845 CHECK_EXPECTED_METHOD("draw_continue");
849 static HRESULT WINAPI
AdviseSink_QueryInterface(IAdviseSink
*iface
, REFIID riid
, void **ppv
)
851 if (IsEqualIID(riid
, &IID_IAdviseSink
) || IsEqualIID(riid
, &IID_IUnknown
))
854 IUnknown_AddRef(iface
);
858 return E_NOINTERFACE
;
861 static ULONG WINAPI
AdviseSink_AddRef(IAdviseSink
*iface
)
866 static ULONG WINAPI
AdviseSink_Release(IAdviseSink
*iface
)
872 static void WINAPI
AdviseSink_OnDataChange(
874 FORMATETC
*pFormatetc
,
877 CHECK_EXPECTED_METHOD("AdviseSink_OnDataChange");
880 static void WINAPI
AdviseSink_OnViewChange(
885 CHECK_EXPECTED_METHOD("AdviseSink_OnViewChange");
888 static void WINAPI
AdviseSink_OnRename(
892 CHECK_EXPECTED_METHOD("AdviseSink_OnRename");
895 static void WINAPI
AdviseSink_OnSave(IAdviseSink
*iface
)
897 CHECK_EXPECTED_METHOD("AdviseSink_OnSave");
900 static void WINAPI
AdviseSink_OnClose(IAdviseSink
*iface
)
902 CHECK_EXPECTED_METHOD("AdviseSink_OnClose");
905 static const IAdviseSinkVtbl AdviseSinkVtbl
=
907 AdviseSink_QueryInterface
,
910 AdviseSink_OnDataChange
,
911 AdviseSink_OnViewChange
,
917 static IAdviseSink AdviseSink
= { &AdviseSinkVtbl
};
919 static HRESULT WINAPI
DataObject_QueryInterface(
924 if (IsEqualIID(riid
, &IID_IDataObject
) || IsEqualIID(riid
, &IID_IUnknown
))
933 static ULONG WINAPI
DataObject_AddRef(
939 static ULONG WINAPI
DataObject_Release(
945 static HRESULT WINAPI
DataObject_GetData(
947 LPFORMATETC pformatetcIn
,
950 CHECK_EXPECTED_METHOD("DataObject_GetData");
954 static HRESULT WINAPI
DataObject_GetDataHere(
956 LPFORMATETC pformatetc
,
959 CHECK_EXPECTED_METHOD("DataObject_GetDataHere");
963 static HRESULT WINAPI
DataObject_QueryGetData(
965 LPFORMATETC pformatetc
)
967 CHECK_EXPECTED_METHOD("DataObject_QueryGetData");
971 static HRESULT WINAPI
DataObject_GetCanonicalFormatEtc(
973 LPFORMATETC pformatectIn
,
974 LPFORMATETC pformatetcOut
)
976 CHECK_EXPECTED_METHOD("DataObject_GetCanonicalFormatEtc");
980 static HRESULT WINAPI
DataObject_SetData(
982 LPFORMATETC pformatetc
,
986 CHECK_EXPECTED_METHOD("DataObject_SetData");
990 static HRESULT WINAPI
DataObject_EnumFormatEtc(
993 IEnumFORMATETC
** ppenumFormatEtc
)
995 CHECK_EXPECTED_METHOD("DataObject_EnumFormatEtc");
999 static HRESULT WINAPI
DataObject_DAdvise(
1001 FORMATETC
* pformatetc
,
1003 IAdviseSink
* pAdvSink
,
1004 DWORD
* pdwConnection
)
1006 CHECK_EXPECTED_METHOD("DataObject_DAdvise");
1011 static HRESULT WINAPI
DataObject_DUnadvise(
1015 CHECK_EXPECTED_METHOD("DataObject_DUnadvise");
1019 static HRESULT WINAPI
DataObject_EnumDAdvise(
1021 IEnumSTATDATA
** ppenumAdvise
)
1023 CHECK_EXPECTED_METHOD("DataObject_EnumDAdvise");
1024 return OLE_E_ADVISENOTSUPPORTED
;
1027 static IDataObjectVtbl DataObjectVtbl
=
1029 DataObject_QueryInterface
,
1033 DataObject_GetDataHere
,
1034 DataObject_QueryGetData
,
1035 DataObject_GetCanonicalFormatEtc
,
1037 DataObject_EnumFormatEtc
,
1039 DataObject_DUnadvise
,
1040 DataObject_EnumDAdvise
1043 static IDataObject DataObject
= { &DataObjectVtbl
};
1045 static void test_data_cache(void)
1048 IOleCache2
*pOleCache
;
1050 IPersistStorage
*pPS
;
1051 IViewObject
*pViewObject
;
1052 IOleCacheControl
*pOleCacheControl
;
1054 STGMEDIUM stgmedium
;
1060 char szSystemDir
[MAX_PATH
];
1061 WCHAR wszPath
[MAX_PATH
];
1062 static const WCHAR wszShell32
[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0};
1064 static const char *methods_cacheinitnew
[] =
1066 "AdviseSink_OnViewChange",
1067 "AdviseSink_OnViewChange",
1069 "DataObject_DAdvise",
1070 "DataObject_DAdvise",
1071 "DataObject_DUnadvise",
1072 "DataObject_DUnadvise",
1075 static const char *methods_cacheload
[] =
1077 "AdviseSink_OnViewChange",
1081 "DataObject_GetData",
1082 "DataObject_GetData",
1083 "DataObject_GetData",
1087 GetSystemDirectory(szSystemDir
, sizeof(szSystemDir
)/sizeof(szSystemDir
[0]));
1089 expected_method_list
= methods_cacheinitnew
;
1091 fmtetc
.cfFormat
= CF_METAFILEPICT
;
1092 fmtetc
.dwAspect
= DVASPECT_ICON
;
1095 fmtetc
.tymed
= TYMED_MFPICT
;
1097 hr
= StgCreateDocfile(NULL
, STGM_READWRITE
| STGM_CREATE
| STGM_SHARE_EXCLUSIVE
| STGM_DELETEONRELEASE
, 0, &pStorage
);
1098 ok_ole_success(hr
, "StgCreateDocfile");
1100 /* Test with new data */
1102 hr
= CreateDataCache(NULL
, &CLSID_NULL
, &IID_IOleCache2
, (LPVOID
*)&pOleCache
);
1103 ok_ole_success(hr
, "CreateDataCache");
1105 hr
= IOleCache_QueryInterface(pOleCache
, &IID_IPersistStorage
, (LPVOID
*)&pPS
);
1106 ok_ole_success(hr
, "IOleCache_QueryInterface(IID_IPersistStorage)");
1107 hr
= IOleCache_QueryInterface(pOleCache
, &IID_IViewObject
, (LPVOID
*)&pViewObject
);
1108 ok_ole_success(hr
, "IOleCache_QueryInterface(IID_IViewObject)");
1109 hr
= IOleCache_QueryInterface(pOleCache
, &IID_IOleCacheControl
, (LPVOID
*)&pOleCacheControl
);
1110 ok_ole_success(hr
, "IOleCache_QueryInterface(IID_IOleCacheControl)");
1112 hr
= IViewObject_SetAdvise(pViewObject
, DVASPECT_ICON
, ADVF_PRIMEFIRST
, &AdviseSink
);
1113 ok_ole_success(hr
, "IViewObject_SetAdvise");
1115 hr
= IPersistStorage_InitNew(pPS
, pStorage
);
1116 ok_ole_success(hr
, "IPersistStorage_InitNew");
1118 hr
= IPersistStorage_IsDirty(pPS
);
1119 ok_ole_success(hr
, "IPersistStorage_IsDirty");
1121 hr
= IPersistStorage_GetClassID(pPS
, &clsid
);
1122 ok_ole_success(hr
, "IPersistStorage_GetClassID");
1123 ok(IsEqualCLSID(&clsid
, &IID_NULL
), "clsid should be blank\n");
1125 hr
= IOleCache_Uncache(pOleCache
, 0xdeadbeef);
1126 ok(hr
== OLE_E_NOCONNECTION
, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr
);
1128 for (fmtetc
.cfFormat
= CF_TEXT
; fmtetc
.cfFormat
< CF_MAX
; fmtetc
.cfFormat
++)
1131 fmtetc
.dwAspect
= DVASPECT_THUMBNAIL
;
1132 for (i
= 0; i
< 7; i
++)
1134 fmtetc
.tymed
= 1 << i
;
1135 hr
= IOleCache_Cache(pOleCache
, &fmtetc
, 0, &dwConnection
);
1136 if ((fmtetc
.cfFormat
== CF_METAFILEPICT
&& fmtetc
.tymed
== TYMED_MFPICT
) ||
1137 (fmtetc
.cfFormat
== CF_BITMAP
&& fmtetc
.tymed
== TYMED_GDI
) ||
1138 (fmtetc
.cfFormat
== CF_DIB
&& fmtetc
.tymed
== TYMED_HGLOBAL
) ||
1139 (fmtetc
.cfFormat
== CF_ENHMETAFILE
&& fmtetc
.tymed
== TYMED_ENHMF
))
1140 ok(hr
== S_OK
, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned S_OK instead of 0x%08x\n",
1141 fmtetc
.cfFormat
, fmtetc
.tymed
, hr
);
1142 else if (fmtetc
.tymed
== TYMED_HGLOBAL
)
1143 ok(hr
== CACHE_S_FORMATETC_NOTSUPPORTED
,
1144 "IOleCache_Cache cfFormat = %d, tymed = %d should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08x\n",
1145 fmtetc
.cfFormat
, fmtetc
.tymed
, hr
);
1147 ok(hr
== DV_E_TYMED
, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned DV_E_TYMED instead of 0x%08x\n",
1148 fmtetc
.cfFormat
, fmtetc
.tymed
, hr
);
1151 hr
= IOleCache_Uncache(pOleCache
, dwConnection
);
1152 ok_ole_success(hr
, "IOleCache_Uncache");
1157 fmtetc
.cfFormat
= CF_BITMAP
;
1158 fmtetc
.dwAspect
= DVASPECT_THUMBNAIL
;
1159 fmtetc
.tymed
= TYMED_GDI
;
1160 hr
= IOleCache_Cache(pOleCache
, &fmtetc
, 0, &dwConnection
);
1161 ok_ole_success(hr
, "IOleCache_Cache");
1163 fmtetc
.cfFormat
= 0;
1164 fmtetc
.dwAspect
= DVASPECT_ICON
;
1165 fmtetc
.tymed
= TYMED_MFPICT
;
1166 hr
= IOleCache_Cache(pOleCache
, &fmtetc
, 0, &dwConnection
);
1167 ok_ole_success(hr
, "IOleCache_Cache");
1169 MultiByteToWideChar(CP_ACP
, 0, szSystemDir
, -1, wszPath
, sizeof(wszPath
)/sizeof(wszPath
[0]));
1170 memcpy(wszPath
+lstrlenW(wszPath
), wszShell32
, sizeof(wszShell32
));
1172 fmtetc
.cfFormat
= CF_METAFILEPICT
;
1173 stgmedium
.tymed
= TYMED_MFPICT
;
1174 U(stgmedium
).hMetaFilePict
= OleMetafilePictFromIconAndLabel(
1175 LoadIcon(NULL
, MAKEINTRESOURCE(IDI_APPLICATION
)), wszPath
, wszPath
, 0);
1176 stgmedium
.pUnkForRelease
= NULL
;
1178 fmtetc
.dwAspect
= DVASPECT_CONTENT
;
1179 hr
= IOleCache_SetData(pOleCache
, &fmtetc
, &stgmedium
, FALSE
);
1180 ok(hr
== OLE_E_BLANK
, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr
);
1182 fmtetc
.dwAspect
= DVASPECT_ICON
;
1183 hr
= IOleCache_SetData(pOleCache
, &fmtetc
, &stgmedium
, FALSE
);
1184 ok_ole_success(hr
, "IOleCache_SetData");
1186 hr
= IViewObject_Freeze(pViewObject
, DVASPECT_ICON
, -1, NULL
, &dwFreeze
);
1188 ok_ole_success(hr
, "IViewObject_Freeze");
1189 hr
= IViewObject_Freeze(pViewObject
, DVASPECT_CONTENT
, -1, NULL
, &dwFreeze
);
1190 ok(hr
== OLE_E_BLANK
, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr
);
1195 rcBounds
.right
= 100;
1196 rcBounds
.bottom
= 100;
1197 hdcMem
= CreateCompatibleDC(NULL
);
1199 hr
= IViewObject_Draw(pViewObject
, DVASPECT_ICON
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1200 ok_ole_success(hr
, "IViewObject_Draw");
1202 hr
= IViewObject_Draw(pViewObject
, DVASPECT_CONTENT
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1203 ok(hr
== OLE_E_BLANK
, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr
);
1207 hr
= IOleCacheControl_OnRun(pOleCacheControl
, &DataObject
);
1209 ok_ole_success(hr
, "IOleCacheControl_OnRun");
1212 hr
= IPersistStorage_Save(pPS
, pStorage
, TRUE
);
1213 ok_ole_success(hr
, "IPersistStorage_Save");
1215 hr
= IPersistStorage_SaveCompleted(pPS
, NULL
);
1216 ok_ole_success(hr
, "IPersistStorage_SaveCompleted");
1218 hr
= IPersistStorage_IsDirty(pPS
);
1219 ok(hr
== S_FALSE
, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr
);
1221 IPersistStorage_Release(pPS
);
1222 IViewObject_Release(pViewObject
);
1223 IOleCache_Release(pOleCache
);
1224 IOleCacheControl_Release(pOleCacheControl
);
1227 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
1230 /* Test with loaded data */
1231 trace("Testing loaded data with CreateDataCache:\n");
1232 expected_method_list
= methods_cacheload
;
1234 hr
= CreateDataCache(NULL
, &CLSID_NULL
, &IID_IOleCache2
, (LPVOID
*)&pOleCache
);
1235 ok_ole_success(hr
, "CreateDataCache");
1237 hr
= IOleCache_QueryInterface(pOleCache
, &IID_IPersistStorage
, (LPVOID
*)&pPS
);
1238 ok_ole_success(hr
, "IOleCache_QueryInterface(IID_IPersistStorage)");
1239 hr
= IOleCache_QueryInterface(pOleCache
, &IID_IViewObject
, (LPVOID
*)&pViewObject
);
1240 ok_ole_success(hr
, "IOleCache_QueryInterface(IID_IViewObject)");
1242 hr
= IViewObject_SetAdvise(pViewObject
, DVASPECT_ICON
, ADVF_PRIMEFIRST
, &AdviseSink
);
1243 ok_ole_success(hr
, "IViewObject_SetAdvise");
1245 hr
= IPersistStorage_Load(pPS
, pStorage
);
1246 ok_ole_success(hr
, "IPersistStorage_Load");
1248 hr
= IPersistStorage_IsDirty(pPS
);
1249 ok(hr
== S_FALSE
, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr
);
1251 fmtetc
.cfFormat
= 0;
1252 fmtetc
.dwAspect
= DVASPECT_ICON
;
1255 fmtetc
.tymed
= TYMED_MFPICT
;
1256 hr
= IOleCache_Cache(pOleCache
, &fmtetc
, 0, &dwConnection
);
1257 ok(hr
== CACHE_S_SAMECACHE
, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr
);
1261 rcBounds
.right
= 100;
1262 rcBounds
.bottom
= 100;
1263 hdcMem
= CreateCompatibleDC(NULL
);
1265 hr
= IViewObject_Draw(pViewObject
, DVASPECT_ICON
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1266 ok_ole_success(hr
, "IViewObject_Draw");
1268 hr
= IViewObject_Draw(pViewObject
, DVASPECT_CONTENT
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1269 ok(hr
== OLE_E_BLANK
, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr
);
1271 /* unload the cached storage object, causing it to be reloaded */
1272 hr
= IOleCache2_DiscardCache(pOleCache
, DISCARDCACHE_NOSAVE
);
1273 ok_ole_success(hr
, "IOleCache2_DiscardCache");
1274 hr
= IViewObject_Draw(pViewObject
, DVASPECT_ICON
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1275 ok_ole_success(hr
, "IViewObject_Draw");
1277 /* unload the cached storage object, but don't allow it to be reloaded */
1278 hr
= IPersistStorage_HandsOffStorage(pPS
);
1279 ok_ole_success(hr
, "IPersistStorage_HandsOffStorage");
1280 hr
= IViewObject_Draw(pViewObject
, DVASPECT_ICON
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1281 ok_ole_success(hr
, "IViewObject_Draw");
1282 hr
= IOleCache2_DiscardCache(pOleCache
, DISCARDCACHE_NOSAVE
);
1283 ok_ole_success(hr
, "IOleCache2_DiscardCache");
1284 hr
= IViewObject_Draw(pViewObject
, DVASPECT_ICON
, -1, NULL
, NULL
, NULL
, hdcMem
, &rcBounds
, NULL
, draw_continue
, 0xdeadbeef);
1285 ok(hr
== OLE_E_BLANK
, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr
);
1290 hr
= IOleCache_InitCache(pOleCache
, &DataObject
);
1291 ok(hr
== CACHE_E_NOCACHE_UPDATED
, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr
);
1294 IPersistStorage_Release(pPS
);
1295 IViewObject_Release(pViewObject
);
1296 IOleCache_Release(pOleCache
);
1299 ok(!*expected_method_list
, "Method sequence starting from %s not called\n", *expected_method_list
);
1302 IStorage_Release(pStorage
);
1303 ReleaseStgMedium(&stgmedium
);
1306 static void test_default_handler(void)
1309 IOleObject
*pObject
;
1310 IRunnableObject
*pRunnableObject
;
1311 IOleClientSite
*pClientSite
;
1312 IDataObject
*pDataObject
;
1316 LPOLESTR pszUserType
;
1321 IOleInPlaceObject
*pInPlaceObj
;
1322 IEnumOLEVERB
*pEnumVerbs
;
1323 static const WCHAR wszUnknown
[] = {'U','n','k','n','o','w','n',0};
1324 static const WCHAR wszHostName
[] = {'W','i','n','e',' ','T','e','s','t',' ','P','r','o','g','r','a','m',0};
1325 static const WCHAR wszDelim
[] = {'!',0};
1327 hr
= CoCreateInstance(&CLSID_WineTest
, NULL
, CLSCTX_INPROC_HANDLER
, &IID_IOleObject
, (void **)&pObject
);
1328 ok(hr
== REGDB_E_CLASSNOTREG
, "CoCreateInstance should have failed with REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr
);
1330 hr
= OleCreateDefaultHandler(&CLSID_WineTest
, NULL
, &IID_IOleObject
, (void **)&pObject
);
1331 ok_ole_success(hr
, "OleCreateDefaultHandler");
1333 hr
= IOleObject_QueryInterface(pObject
, &IID_IOleInPlaceObject
, (void **)&pInPlaceObj
);
1334 ok(hr
== E_NOINTERFACE
, "IOleObject_QueryInterface(&IID_IOleInPlaceObject) should return E_NOINTERFACE instead of 0x%08x\n", hr
);
1336 hr
= IOleObject_Advise(pObject
, &AdviseSink
, &dwAdvConn
);
1337 ok_ole_success(hr
, "IOleObject_Advise");
1339 hr
= IOleObject_Close(pObject
, OLECLOSE_NOSAVE
);
1340 ok_ole_success(hr
, "IOleObject_Close");
1342 /* FIXME: test IOleObject_EnumAdvise */
1344 hr
= IOleObject_EnumVerbs(pObject
, &pEnumVerbs
);
1345 ok(hr
== REGDB_E_CLASSNOTREG
, "IOleObject_EnumVerbs should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr
);
1347 hr
= IOleObject_GetClientSite(pObject
, &pClientSite
);
1348 ok_ole_success(hr
, "IOleObject_GetClientSite");
1350 hr
= IOleObject_GetClipboardData(pObject
, 0, &pDataObject
);
1351 ok(hr
== OLE_E_NOTRUNNING
,
1352 "IOleObject_GetClipboardData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n",
1355 hr
= IOleObject_GetExtent(pObject
, DVASPECT_CONTENT
, &sizel
);
1356 ok(hr
== OLE_E_BLANK
, "IOleObject_GetExtent should have returned OLE_E_BLANK instead of 0x%08x\n",
1359 hr
= IOleObject_GetMiscStatus(pObject
, DVASPECT_CONTENT
, &dwStatus
);
1361 ok(hr
== REGDB_E_CLASSNOTREG
, "IOleObject_GetMiscStatus should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr
);
1363 hr
= IOleObject_GetUserClassID(pObject
, &clsid
);
1364 ok_ole_success(hr
, "IOleObject_GetUserClassID");
1365 ok(IsEqualCLSID(&clsid
, &CLSID_WineTest
), "clsid != CLSID_WineTest\n");
1367 hr
= IOleObject_GetUserType(pObject
, USERCLASSTYPE_FULL
, &pszUserType
);
1369 ok_ole_success(hr
, "IOleObject_GetUserType");
1370 ok(!lstrcmpW(pszUserType
, wszUnknown
), "Retrieved user type was wrong\n");
1373 hr
= IOleObject_InitFromData(pObject
, NULL
, TRUE
, 0);
1374 ok(hr
== OLE_E_NOTRUNNING
, "IOleObject_InitFromData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr
);
1376 hr
= IOleObject_IsUpToDate(pObject
);
1377 ok(hr
== OLE_E_NOTRUNNING
, "IOleObject_IsUpToDate should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr
);
1379 palette
.palNumEntries
= 1;
1380 palette
.palVersion
= 2;
1381 memset(&palette
.palPalEntry
[0], 0, sizeof(palette
.palPalEntry
[0]));
1382 hr
= IOleObject_SetColorScheme(pObject
, &palette
);
1383 ok(hr
== OLE_E_NOTRUNNING
, "IOleObject_SetColorScheme should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr
);
1385 sizel
.cx
= sizel
.cy
= 0;
1386 hr
= IOleObject_SetExtent(pObject
, DVASPECT_CONTENT
, &sizel
);
1388 hr
= IOleObject_SetHostNames(pObject
, wszHostName
, NULL
);
1389 ok_ole_success(hr
, "IOleObject_SetHostNames");
1391 hr
= CreateItemMoniker(wszDelim
, wszHostName
, &pMoniker
);
1392 ok_ole_success(hr
, "CreateItemMoniker");
1393 hr
= IOleObject_SetMoniker(pObject
, OLEWHICHMK_CONTAINER
, pMoniker
);
1394 ok_ole_success(hr
, "IOleObject_SetMoniker");
1396 hr
= IOleObject_GetMoniker(pObject
, OLEGETMONIKER_ONLYIFTHERE
, OLEWHICHMK_CONTAINER
, &pMoniker
);
1397 ok(hr
== E_FAIL
, "IOleObject_GetMoniker should have returned E_FAIL instead of 0x%08x\n", hr
);
1399 hr
= IOleObject_Update(pObject
);
1401 ok(hr
== REGDB_E_CLASSNOTREG
, "IOleObject_Update should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr
);
1403 hr
= IOleObject_QueryInterface(pObject
, &IID_IDataObject
, (void **)&pDataObject
);
1404 ok_ole_success(hr
, "IOleObject_QueryInterface");
1406 fmtetc
.cfFormat
= CF_TEXT
;
1408 fmtetc
.dwAspect
= DVASPECT_CONTENT
;
1410 fmtetc
.tymed
= TYMED_NULL
;
1411 hr
= IDataObject_DAdvise(pDataObject
, &fmtetc
, 0, &AdviseSink
, &dwAdvConn
);
1412 ok_ole_success(hr
, "IDataObject_DAdvise");
1414 fmtetc
.cfFormat
= CF_ENHMETAFILE
;
1416 fmtetc
.dwAspect
= DVASPECT_CONTENT
;
1418 fmtetc
.tymed
= TYMED_ENHMF
;
1419 hr
= IDataObject_DAdvise(pDataObject
, &fmtetc
, 0, &AdviseSink
, &dwAdvConn
);
1420 ok_ole_success(hr
, "IDataObject_DAdvise");
1422 fmtetc
.cfFormat
= CF_ENHMETAFILE
;
1424 fmtetc
.dwAspect
= DVASPECT_CONTENT
;
1426 fmtetc
.tymed
= TYMED_ENHMF
;
1427 hr
= IDataObject_QueryGetData(pDataObject
, &fmtetc
);
1429 ok(hr
== OLE_E_NOTRUNNING
, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr
);
1431 fmtetc
.cfFormat
= CF_TEXT
;
1433 fmtetc
.dwAspect
= DVASPECT_CONTENT
;
1435 fmtetc
.tymed
= TYMED_NULL
;
1436 hr
= IDataObject_QueryGetData(pDataObject
, &fmtetc
);
1438 ok(hr
== OLE_E_NOTRUNNING
, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr
);
1440 hr
= IOleObject_QueryInterface(pObject
, &IID_IRunnableObject
, (void **)&pRunnableObject
);
1441 ok_ole_success(hr
, "IOleObject_QueryInterface");
1443 hr
= IRunnableObject_SetContainedObject(pRunnableObject
, TRUE
);
1444 ok_ole_success(hr
, "IRunnableObject_SetContainedObject");
1446 hr
= IRunnableObject_Run(pRunnableObject
, NULL
);
1447 ok(hr
== REGDB_E_CLASSNOTREG
, "IOleObject_Run should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr
);
1449 hr
= IOleObject_Close(pObject
, OLECLOSE_NOSAVE
);
1450 ok_ole_success(hr
, "IOleObject_Close");
1452 IRunnableObject_Release(pRunnableObject
);
1453 IOleObject_Release(pObject
);
1465 hr
= CoRegisterClassObject(&CLSID_Equation3
, (IUnknown
*)&OleObjectCF
, CLSCTX_INPROC_SERVER
, REGCLS_MULTIPLEUSE
, &dwRegister
);
1466 ok_ole_success(hr
, "CoRegisterClassObject");
1468 hr
= StgCreateDocfile(NULL
, STGM_READWRITE
| STGM_CREATE
| STGM_SHARE_EXCLUSIVE
| STGM_DELETEONRELEASE
, 0, &pStorage
);
1469 ok_ole_success(hr
, "StgCreateDocfile");
1471 test_OleCreate(pStorage
);
1473 hr
= IStorage_Stat(pStorage
, &statstg
, STATFLAG_NONAME
);
1474 ok_ole_success(hr
, "IStorage_Stat");
1475 ok(IsEqualCLSID(&CLSID_Equation3
, &statstg
.clsid
), "Wrong CLSID in storage\n");
1477 test_OleLoad(pStorage
);
1479 IStorage_Release(pStorage
);
1481 hr
= CoRevokeClassObject(dwRegister
);
1482 ok_ole_success(hr
, "CoRevokeClassObject");
1485 test_default_handler();