ReactOS  0.4.11-dev-195-gef016bf
ole2.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "objbase.h"
#include "shlguid.h"
#include "wine/test.h"
#include "initguid.h"
Include dependency graph for ole2.c:

Go to the source code of this file.

Classes

struct  expected_method
 
struct  PresentationDataHeader
 
struct  stream_def
 
struct  storage_def
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define WIN32_LEAN_AND_MEAN
 
#define ok_ole_success(hr, func)   ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
 
#define DEFINE_EXPECT(func)   static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
 
#define SET_EXPECT(func)   expect_ ## func = TRUE
 
#define CHECK_EXPECT2(func)
 
#define CHECK_EXPECT(func)
 
#define CHECK_CALLED(func)
 
#define TEST_OPTIONAL   0x1
 
#define TEST_TODO   0x2
 
#define CHECK_EXPECTED_METHOD(method_name)   check_expected_method_fmt(method_name, NULL)
 
#define CHECK_EXPECTED_METHOD_FMT(method_name, fmt)   check_expected_method_fmt(method_name, fmt)
 
#define CHECK_NO_EXTRA_METHODS()
 
#define MAX_STREAM   16
 
#define MAX_FMTS   5
 

Typedefs

typedef struct
PresentationDataHeader 
PresentationDataHeader
 

Functions

 DEFINE_GUID (CLSID_Picture_Metafile, 0x315, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46)
 
 DEFINE_GUID (CLSID_Picture_Dib, 0x316, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46)
 
 DEFINE_GUID (CLSID_Picture_EnhMetafile, 0x319, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46)
 
 DEFINE_EXPECT (Storage_Stat)
 
 DEFINE_EXPECT (Storage_OpenStream_CompObj)
 
 DEFINE_EXPECT (Storage_OpenStream_OlePres)
 
 DEFINE_EXPECT (Storage_SetClass)
 
 DEFINE_EXPECT (Storage_CreateStream_CompObj)
 
 DEFINE_EXPECT (Storage_CreateStream_OlePres)
 
 DEFINE_EXPECT (Storage_OpenStream_Ole)
 
 DEFINE_EXPECT (Storage_DestroyElement)
 
static void check_expected_method_fmt (const char *method_name, const FORMATETC *fmt)
 
static void create_dib (STGMEDIUM *med)
 
static void create_bitmap (STGMEDIUM *med)
 
static void create_emf (STGMEDIUM *med)
 
static void create_mfpict (STGMEDIUM *med)
 
static HRESULT WINAPI OleObject_QueryInterface (IOleObject *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleObject_AddRef (IOleObject *iface)
 
static ULONG WINAPI OleObject_Release (IOleObject *iface)
 
static HRESULT WINAPI OleObject_SetClientSite (IOleObject *iface, IOleClientSite *pClientSite)
 
static HRESULT WINAPI OleObject_GetClientSite (IOleObject *iface, IOleClientSite **ppClientSite)
 
static HRESULT WINAPI OleObject_SetHostNames (IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
 
static HRESULT WINAPI OleObject_Close (IOleObject *iface, DWORD dwSaveOption)
 
static HRESULT WINAPI OleObject_SetMoniker (IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
 
static HRESULT WINAPI OleObject_GetMoniker (IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
 
static HRESULT WINAPI OleObject_InitFromData (IOleObject *iface, IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved)
 
static HRESULT WINAPI OleObject_GetClipboardData (IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
 
static HRESULT WINAPI OleObject_DoVerb (IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
 
static HRESULT WINAPI OleObject_EnumVerbs (IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
 
static HRESULT WINAPI OleObject_Update (IOleObject *iface)
 
static HRESULT WINAPI OleObject_IsUpToDate (IOleObject *iface)
 
static HRESULT WINAPI OleObject_GetUserClassID (IOleObject *iface, CLSID *pClsid)
 
static HRESULT WINAPI OleObject_GetUserType (IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
 
static HRESULT WINAPI OleObject_SetExtent (IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 
static HRESULT WINAPI OleObject_GetExtent (IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
 
static HRESULT WINAPI OleObject_Advise (IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
 
static HRESULT WINAPI OleObject_Unadvise (IOleObject *iface, DWORD dwConnection)
 
static HRESULT WINAPI OleObject_EnumAdvise (IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
 
static HRESULT WINAPI OleObject_GetMiscStatus (IOleObject *iface, DWORD aspect, DWORD *pdwStatus)
 
static HRESULT WINAPI OleObject_SetColorScheme (IOleObject *iface, LOGPALETTE *pLogpal)
 
static HRESULT WINAPI OleObjectPersistStg_QueryInterface (IPersistStorage *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleObjectPersistStg_AddRef (IPersistStorage *iface)
 
static ULONG WINAPI OleObjectPersistStg_Release (IPersistStorage *iface)
 
static HRESULT WINAPI OleObjectPersistStg_GetClassId (IPersistStorage *iface, CLSID *clsid)
 
static HRESULT WINAPI OleObjectPersistStg_IsDirty (IPersistStorage *iface)
 
static HRESULT WINAPI OleObjectPersistStg_InitNew (IPersistStorage *iface, IStorage *pStg)
 
static HRESULT WINAPI OleObjectPersistStg_Load (IPersistStorage *iface, IStorage *pStg)
 
static HRESULT WINAPI OleObjectPersistStg_Save (IPersistStorage *iface, IStorage *pStgSave, BOOL fSameAsLoad)
 
static HRESULT WINAPI OleObjectPersistStg_SaveCompleted (IPersistStorage *iface, IStorage *pStgNew)
 
static HRESULT WINAPI OleObjectPersistStg_HandsOffStorage (IPersistStorage *iface)
 
static HRESULT WINAPI OleObjectCache_QueryInterface (IOleCache *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleObjectCache_AddRef (IOleCache *iface)
 
static ULONG WINAPI OleObjectCache_Release (IOleCache *iface)
 
static HRESULT WINAPI OleObjectCache_Cache (IOleCache *iface, FORMATETC *pformatetc, DWORD advf, DWORD *pdwConnection)
 
static HRESULT WINAPI OleObjectCache_Uncache (IOleCache *iface, DWORD dwConnection)
 
static HRESULT WINAPI OleObjectCache_EnumCache (IOleCache *iface, IEnumSTATDATA **ppenumSTATDATA)
 
static HRESULT WINAPI OleObjectCache_InitCache (IOleCache *iface, IDataObject *pDataObject)
 
static HRESULT WINAPI OleObjectCache_SetData (IOleCache *iface, FORMATETC *pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
 
static HRESULT WINAPI OleObjectCF_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleObjectCF_AddRef (IClassFactory *iface)
 
static ULONG WINAPI OleObjectCF_Release (IClassFactory *iface)
 
static HRESULT WINAPI OleObjectCF_CreateInstance (IClassFactory *iface, IUnknown *punkOuter, REFIID riid, void **ppv)
 
static HRESULT WINAPI OleObjectCF_LockServer (IClassFactory *iface, BOOL lock)
 
static HRESULT WINAPI OleObjectRunnable_QueryInterface (IRunnableObject *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleObjectRunnable_AddRef (IRunnableObject *iface)
 
static ULONG WINAPI OleObjectRunnable_Release (IRunnableObject *iface)
 
static HRESULT WINAPI OleObjectRunnable_GetRunningClass (IRunnableObject *iface, LPCLSID lpClsid)
 
static HRESULT WINAPI OleObjectRunnable_Run (IRunnableObject *iface, LPBINDCTX pbc)
 
static BOOL WINAPI OleObjectRunnable_IsRunning (IRunnableObject *iface)
 
static HRESULT WINAPI OleObjectRunnable_LockRunning (IRunnableObject *iface, BOOL fLock, BOOL fLastUnlockCloses)
 
static HRESULT WINAPI OleObjectRunnable_SetContainedObject (IRunnableObject *iface, BOOL fContained)
 
static HRESULT WINAPI viewobject_QueryInterface (IViewObject *iface, REFIID riid, void **obj)
 
static ULONG WINAPI viewobject_AddRef (IViewObject *iface)
 
static ULONG WINAPI viewobject_Release (IViewObject *iface)
 
static HRESULT WINAPI viewobject_Draw (IViewObject *iface, DWORD aspect, LONG index, void *paspect, DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL bounds, LPCRECTL wbounds, BOOL(STDMETHODCALLTYPE *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
 
static HRESULT WINAPI viewobject_GetColorSet (IViewObject *iface, DWORD draw_aspect, LONG index, void *aspect, DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **colorset)
 
static HRESULT WINAPI viewobject_Freeze (IViewObject *iface, DWORD draw_aspect, LONG index, void *aspect, DWORD *freeze)
 
static HRESULT WINAPI viewobject_Unfreeze (IViewObject *iface, DWORD freeze)
 
static HRESULT WINAPI viewobject_SetAdvise (IViewObject *iface, DWORD aspects, DWORD advf, IAdviseSink *sink)
 
static HRESULT WINAPI viewobject_GetAdvise (IViewObject *iface, DWORD *aspects, DWORD *advf, IAdviseSink **sink)
 
static void test_OleCreate (IStorage *pStorage)
 
static void test_OleLoad (IStorage *pStorage)
 
static BOOL STDMETHODCALLTYPE draw_continue (ULONG_PTR param)
 
static BOOL STDMETHODCALLTYPE draw_continue_false (ULONG_PTR param)
 
static HRESULT WINAPI AdviseSink_QueryInterface (IAdviseSink *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI AdviseSink_AddRef (IAdviseSink *iface)
 
static ULONG WINAPI AdviseSink_Release (IAdviseSink *iface)
 
static void WINAPI AdviseSink_OnDataChange (IAdviseSink *iface, FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
 
static void WINAPI AdviseSink_OnViewChange (IAdviseSink *iface, DWORD dwAspect, LONG lindex)
 
static void WINAPI AdviseSink_OnRename (IAdviseSink *iface, IMoniker *pmk)
 
static void WINAPI AdviseSink_OnSave (IAdviseSink *iface)
 
static void WINAPI AdviseSink_OnClose (IAdviseSink *iface)
 
static HRESULT WINAPI DataObject_QueryInterface (IDataObject *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI DataObject_AddRef (IDataObject *iface)
 
static ULONG WINAPI DataObject_Release (IDataObject *iface)
 
static BOOL fmtetc_equal (const FORMATETC *a, const FORMATETC *b)
 
static HRESULT WINAPI DataObject_GetData (IDataObject *iface, FORMATETC *fmt_in, STGMEDIUM *med)
 
static HRESULT WINAPI DataObject_GetDataHere (IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium)
 
static HRESULT WINAPI DataObject_QueryGetData (IDataObject *iface, FORMATETC *fmt_in)
 
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc (IDataObject *iface, LPFORMATETC pformatectIn, LPFORMATETC pformatetcOut)
 
static HRESULT WINAPI DataObject_SetData (IDataObject *iface, LPFORMATETC 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 HRESULT WINAPI Unknown_QueryInterface (IUnknown *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI Unknown_AddRef (IUnknown *iface)
 
static ULONG WINAPI Unknown_Release (IUnknown *iface)
 
static void check_enum_cache (IOleCache2 *cache, const STATDATA *expect, int num)
 
static void test_data_cache (void)
 
static IStoragecreate_storage (int num)
 
static void test_data_cache_dib_contents_stream (int num)
 
static void check_bitmap_size (HBITMAP h, int cx, int cy)
 
static void check_dib_size (HGLOBAL h, int cx, int cy)
 
static void test_data_cache_cache (void)
 
static void test_data_cache_init (void)
 
static void test_data_cache_initnew (void)
 
static void test_data_cache_updatecache (void)
 
static void test_default_handler (void)
 
static void test_runnable (void)
 
static HRESULT WINAPI OleRun_QueryInterface (IRunnableObject *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI OleRun_AddRef (IRunnableObject *iface)
 
static ULONG WINAPI OleRun_Release (IRunnableObject *iface)
 
static HRESULT WINAPI OleRun_GetRunningClass (IRunnableObject *iface, CLSID *clsid)
 
static HRESULT WINAPI OleRun_Run (IRunnableObject *iface, LPBINDCTX ctx)
 
static BOOL WINAPI OleRun_IsRunning (IRunnableObject *iface)
 
static HRESULT WINAPI OleRun_LockRunning (IRunnableObject *iface, BOOL lock, BOOL last_unlock_closes)
 
static HRESULT WINAPI OleRun_SetContainedObject (IRunnableObject *iface, BOOL contained)
 
static void test_OleRun (void)
 
static void test_OleLockRunning (void)
 
static void test_OleDraw (void)
 
static HRESULT WINAPI Storage_QueryInterface (IStorage *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI Storage_AddRef (IStorage *iface)
 
static ULONG WINAPI Storage_Release (IStorage *iface)
 
static HRESULT WINAPI Storage_CreateStream (IStorage *iface, LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream **ppstm)
 
static HRESULT WINAPI Storage_OpenStream (IStorage *iface, LPCOLESTR pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream **ppstm)
 
static HRESULT WINAPI Storage_CreateStorage (IStorage *iface, LPCOLESTR pwcsName, DWORD grfMode, DWORD dwStgFmt, DWORD reserved2, IStorage **ppstg)
 
static HRESULT WINAPI Storage_OpenStorage (IStorage *iface, LPCOLESTR pwcsName, IStorage *pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstg)
 
static HRESULT WINAPI Storage_CopyTo (IStorage *iface, DWORD ciidExclude, const IID *rgiidExclude, SNB snbExclude, IStorage *pstgDest)
 
static HRESULT WINAPI Storage_MoveElementTo (IStorage *iface, LPCOLESTR pwcsName, IStorage *pstgDest, LPCOLESTR pwcsNewName, DWORD grfFlags)
 
static HRESULT WINAPI Storage_Commit (IStorage *iface, DWORD grfCommitFlags)
 
static HRESULT WINAPI Storage_Revert (IStorage *iface)
 
static HRESULT WINAPI Storage_EnumElements (IStorage *iface, DWORD reserved1, void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum)
 
static HRESULT WINAPI Storage_DestroyElement (IStorage *iface, LPCOLESTR pwcsName)
 
static HRESULT WINAPI Storage_RenameElement (IStorage *iface, LPCOLESTR pwcsOldName, LPCOLESTR pwcsNewName)
 
static HRESULT WINAPI Storage_SetElementTimes (IStorage *iface, LPCOLESTR pwcsName, const FILETIME *pctime, const FILETIME *patime, const FILETIME *pmtime)
 
static HRESULT WINAPI Storage_SetClass (IStorage *iface, REFCLSID clsid)
 
static HRESULT WINAPI Storage_SetStateBits (IStorage *iface, DWORD grfStateBits, DWORD grfMask)
 
static HRESULT WINAPI Storage_Stat (IStorage *iface, STATSTG *pstatstg, DWORD grfStatFlag)
 
static void test_OleDoAutoConvert (void)
 
static void test_data_cache_save (void)
 
static int read_clipformat (IStream *stream)
 
static void check_storage_contents (IStorage *stg, const struct storage_def *stg_def, int *enumerated_streams, int *matched_streams)
 
static HRESULT stgmedium_cmp (const STGMEDIUM *med1, STGMEDIUM *med2)
 
static IStoragecreate_storage_from_def (const struct storage_def *stg_def)
 
static void get_stgdef (struct storage_def *stg_def, CLIPFORMAT cf, STGMEDIUM *stg_med, int stm_idx)
 
static void get_stgmedium (CLIPFORMAT cfFormat, STGMEDIUM *stgmedium)
 
static void test_data_cache_save_data (void)
 
static void test_data_cache_contents (void)
 
 START_TEST (ole2)
 

Variables

static const CLSIDStorage_SetClass_CLSID
 
static int Storage_DestroyElement_limit
 
static IPersistStorage OleObjectPersistStg = { &OleObjectPersistStgVtbl }
 
static IOleCachecache
 
static IRunnableObjectrunnable
 
static const CLSID CLSID_WineTestOld
 
static const CLSID CLSID_WineTest
 
static const IID IID_WineTest
 
static const struct
expected_method
expected_method_list
 
static FORMATETC * g_expected_fetc = NULL
 
static BOOL g_showRunnable = TRUE
 
static BOOL g_isRunning = TRUE
 
static HRESULT g_GetMiscStatusFailsWith = S_OK
 
static HRESULT g_QIFailsWith
 
static UINT cf_test_1
 
static UINT cf_test_2
 
static UINT cf_test_3
 
static FORMATETC * g_dataobject_fmts
 
static const BYTE dib []
 
static const IOleObjectVtbl OleObjectVtbl
 
static IOleObject OleObject = { &OleObjectVtbl }
 
static const IPersistStorageVtbl OleObjectPersistStgVtbl
 
static const IOleCacheVtbl OleObjectCacheVtbl
 
static IOleCache OleObjectCache = { &OleObjectCacheVtbl }
 
static const IClassFactoryVtbl OleObjectCFVtbl
 
static IClassFactory OleObjectCF = { &OleObjectCFVtbl }
 
static const IRunnableObjectVtbl OleObjectRunnableVtbl
 
static IRunnableObject OleObjectRunnable = { &OleObjectRunnableVtbl }
 
static const CLSID CLSID_Equation3 = {0x0002CE02, 0x0000, 0x0000, {0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46} }
 
static const struct IViewObjectVtbl viewobjectvtbl
 
static IViewObject viewobject = { &viewobjectvtbl }
 
static const IAdviseSinkVtbl AdviseSinkVtbl
 
static IAdviseSink AdviseSink = { &AdviseSinkVtbl }
 
static IDataObjectVtbl DataObjectVtbl
 
static IDataObject DataObject = { &DataObjectVtbl }
 
static const IUnknownVtbl UnknownVtbl
 
static IUnknown unknown = { &UnknownVtbl }
 
static const WCHAR CONTENTS [] = {'C','O','N','T','E','N','T','S',0}
 
static BYTE file_dib []
 
static const IRunnableObjectVtbl oleruntestvtbl
 
static IRunnableObject testrunnable = { &oleruntestvtbl }
 
static const WCHAR olepres0W [] = {2,'O','l','e','P','r','e','s','0','0','0',0}
 
static const WCHAR comp_objW [] = {1,'C','o','m','p','O','b','j',0}
 
static IStreamcomp_obj_stream
 
static IStreamole_stream
 
static IStreamolepres_stream
 
static IStreamcontents_stream
 
static IStorageVtbl StorageVtbl
 
static IStorage Storage = { &StorageVtbl }
 
static const unsigned char bmpimage []
 
static const unsigned char mf_blank_bits []
 
static const struct storage_def stg_def_0
 
static const struct storage_def stg_def_0_saved
 
static const struct storage_def stg_def_1
 
static const struct storage_def stg_def_1_saved
 
static const struct storage_def stg_def_2
 
static const struct storage_def stg_def_2_saved
 
static const struct storage_def stg_def_3
 
static const struct storage_def stg_def_3_saved
 
static const struct storage_def stg_def_4
 
static const struct storage_def stg_def_4_saved
 
static const struct storage_def stg_def_5
 
static const struct storage_def stg_def_5_saved
 
static const struct storage_def stg_def_6
 
static const struct storage_def stg_def_6_saved
 
static const struct storage_def stg_def_7
 
static const struct storage_def stg_def_7_saved
 
static const struct storage_def stg_def_8
 
static const struct storage_def stg_def_8_saved
 
static const struct storage_def stg_def_9
 
static const struct storage_def stg_def_9_saved
 
static const BYTE dib_inf []
 
static const BYTE mf_rec []
 

Macro Definition Documentation

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
#define expect_(expected, got, precision)
Definition: font.c:29
#define FALSE
Definition: types.h:117
#define ok(value,...)
Definition: CComObject.cpp:34

Definition at line 62 of file ole2.c.

Referenced by test_data_cache_save(), and test_OleDoAutoConvert().

#define CHECK_EXPECT (   func)
Value:
do { \
}while(0)
#define expect_(expected, got, precision)
Definition: font.c:29
#define FALSE
Definition: types.h:117
#define CHECK_EXPECT2(func)
Definition: ole2.c:50

Definition at line 56 of file ole2.c.

Referenced by Storage_CreateStream(), Storage_OpenStream(), and Storage_SetClass().

#define CHECK_EXPECT2 (   func)
Value:
do { \
ok(expect_ ##func, "unexpected call " #func "\n"); \
called_ ## func = TRUE; \
}while(0)
#define TRUE
Definition: types.h:120
#define expect_(expected, got, precision)
Definition: font.c:29
#define ok(value,...)
Definition: CComObject.cpp:34

Definition at line 50 of file ole2.c.

Referenced by Storage_DestroyElement(), Storage_OpenStream(), and Storage_Stat().

#define CHECK_EXPECTED_METHOD (   method_name)    check_expected_method_fmt(method_name, NULL)

Definition at line 196 of file ole2.c.

Referenced by AdviseSink_OnClose(), AdviseSink_OnDataChange(), AdviseSink_OnRename(), AdviseSink_OnSave(), AdviseSink_OnViewChange(), DataObject_AddRef(), DataObject_DAdvise(), DataObject_DUnadvise(), DataObject_EnumDAdvise(), DataObject_EnumFormatEtc(), DataObject_GetCanonicalFormatEtc(), DataObject_GetDataHere(), DataObject_QueryInterface(), DataObject_Release(), DataObject_SetData(), draw_continue(), draw_continue_false(), OleObject_AddRef(), OleObject_Advise(), OleObject_Close(), OleObject_DoVerb(), OleObject_EnumAdvise(), OleObject_EnumVerbs(), OleObject_GetClientSite(), OleObject_GetClipboardData(), OleObject_GetExtent(), OleObject_GetMiscStatus(), OleObject_GetMoniker(), OleObject_GetUserClassID(), OleObject_GetUserType(), OleObject_InitFromData(), OleObject_IsUpToDate(), OleObject_QueryInterface(), OleObject_Release(), OleObject_SetClientSite(), OleObject_SetColorScheme(), OleObject_SetExtent(), OleObject_SetHostNames(), OleObject_SetMoniker(), OleObject_Unadvise(), OleObject_Update(), OleObjectCache_AddRef(), OleObjectCache_Cache(), OleObjectCache_EnumCache(), OleObjectCache_InitCache(), OleObjectCache_Release(), OleObjectCache_SetData(), OleObjectCache_Uncache(), OleObjectPersistStg_AddRef(), OleObjectPersistStg_GetClassId(), OleObjectPersistStg_HandsOffStorage(), OleObjectPersistStg_InitNew(), OleObjectPersistStg_IsDirty(), OleObjectPersistStg_Load(), OleObjectPersistStg_Release(), OleObjectPersistStg_Save(), OleObjectPersistStg_SaveCompleted(), OleObjectRunnable_AddRef(), OleObjectRunnable_GetRunningClass(), OleObjectRunnable_IsRunning(), OleObjectRunnable_LockRunning(), OleObjectRunnable_Release(), OleObjectRunnable_Run(), and OleObjectRunnable_SetContainedObject().

#define CHECK_EXPECTED_METHOD_FMT (   method_name,
  fmt 
)    check_expected_method_fmt(method_name, fmt)

Definition at line 197 of file ole2.c.

Referenced by DataObject_GetData(), and DataObject_QueryGetData().

#define CHECK_NO_EXTRA_METHODS ( )
Value:
do { \
ok(!expected_method_list->method, "Method sequence starting from %s not called\n", expected_method_list->method); \
} while (0)
while(1)
Definition: macro.lex.yy.c:743
#define ok(value,...)
Definition: CComObject.cpp:34
#define TEST_OPTIONAL
Definition: ole2.c:108
static const struct expected_method * expected_method_list
Definition: ole2.c:118

Definition at line 199 of file ole2.c.

Referenced by test_data_cache(), test_data_cache_updatecache(), test_default_handler(), test_OleCreate(), test_OleLoad(), and test_runnable().

#define COBJMACROS

Definition at line 22 of file ole2.c.

#define CONST_VTABLE

Definition at line 23 of file ole2.c.

#define DEFINE_EXPECT (   func)    static BOOL expect_ ## func = FALSE, called_ ## func = FALSE

Definition at line 44 of file ole2.c.

#define MAX_FMTS   5

Definition at line 4325 of file ole2.c.

Referenced by test_data_cache_save_data().

#define MAX_STREAM   16

Definition at line 3820 of file ole2.c.

Referenced by check_storage_contents().

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

Definition at line 47 of file ole2.c.

Referenced by test_data_cache_save(), and test_OleDoAutoConvert().

#define TEST_OPTIONAL   0x1

Definition at line 108 of file ole2.c.

Referenced by check_expected_method_fmt(), test_default_handler(), and test_OleCreate().

#define TEST_TODO   0x2

Definition at line 109 of file ole2.c.

Referenced by check_expected_method_fmt(), and test_default_handler().

#define WIN32_LEAN_AND_MEAN

Definition at line 24 of file ole2.c.

Typedef Documentation

Function Documentation

static ULONG WINAPI AdviseSink_AddRef ( IAdviseSink iface)
static

Definition at line 1382 of file ole2.c.

1383 {
1384  return 2;
1385 }
static void WINAPI AdviseSink_OnClose ( IAdviseSink iface)
static

Definition at line 1421 of file ole2.c.

1422 {
1423  CHECK_EXPECTED_METHOD("AdviseSink_OnClose");
1424 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static void WINAPI AdviseSink_OnDataChange ( IAdviseSink iface,
FORMATETC *  pFormatetc,
STGMEDIUM *  pStgmed 
)
static

Definition at line 1393 of file ole2.c.

1397 {
1398  CHECK_EXPECTED_METHOD("AdviseSink_OnDataChange");
1399 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static void WINAPI AdviseSink_OnRename ( IAdviseSink iface,
IMoniker pmk 
)
static

Definition at line 1409 of file ole2.c.

1412 {
1413  CHECK_EXPECTED_METHOD("AdviseSink_OnRename");
1414 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static void WINAPI AdviseSink_OnSave ( IAdviseSink iface)
static

Definition at line 1416 of file ole2.c.

1417 {
1418  CHECK_EXPECTED_METHOD("AdviseSink_OnSave");
1419 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static void WINAPI AdviseSink_OnViewChange ( IAdviseSink iface,
DWORD  dwAspect,
LONG  lindex 
)
static

Definition at line 1401 of file ole2.c.

1405 {
1406  CHECK_EXPECTED_METHOD("AdviseSink_OnViewChange");
1407 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI AdviseSink_QueryInterface ( IAdviseSink iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1370 of file ole2.c.

1371 {
1373  {
1374  *ppv = iface;
1375  IAdviseSink_AddRef(iface);
1376  return S_OK;
1377  }
1378  *ppv = NULL;
1379  return E_NOINTERFACE;
1380 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IAdviseSink
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI AdviseSink_Release ( IAdviseSink iface)
static

Definition at line 1387 of file ole2.c.

1388 {
1389  return 1;
1390 }
static void check_bitmap_size ( HBITMAP  h,
int  cx,
int  cy 
)
static

Definition at line 2198 of file ole2.c.

Referenced by test_data_cache_cache().

2199 {
2200  BITMAP bm;
2201 
2202  GetObjectW( h, sizeof(bm), &bm );
2203  ok( bm.bmWidth == cx, "got %d expect %d\n", bm.bmWidth, cx );
2204  ok( bm.bmHeight == cy, "got %d expect %d\n", bm.bmHeight, cy );
2205 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define ok(value,...)
Definition: CComObject.cpp:34
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
_Out_opt_ int * cx
Definition: commctrl.h:570
static void check_dib_size ( HGLOBAL  h,
int  cx,
int  cy 
)
static

Definition at line 2207 of file ole2.c.

Referenced by test_data_cache_cache().

2208 {
2209  BITMAPINFO *info;
2210 
2211  info = GlobalLock( h );
2212  ok( info->bmiHeader.biWidth == cx, "got %d expect %d\n", info->bmiHeader.biWidth, cx );
2213  ok( info->bmiHeader.biHeight == cy, "got %d expect %d\n", info->bmiHeader.biHeight, cy );
2214  GlobalUnlock( h );
2215 }
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1453
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
#define ok(value,...)
Definition: CComObject.cpp:34
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
const XML_Char XML_Encoding * info
Definition: expat.h:530
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
_Out_opt_ int * cx
Definition: commctrl.h:570
static void check_enum_cache ( IOleCache2 cache,
const STATDATA *  expect,
int  num 
)
static

Definition at line 1644 of file ole2.c.

Referenced by test_data_cache_cache(), test_data_cache_dib_contents_stream(), test_data_cache_init(), test_data_cache_initnew(), and test_data_cache_updatecache().

1645 {
1646  IEnumSTATDATA *enum_stat;
1647  STATDATA stat;
1648  HRESULT hr;
1649 
1650  hr = IOleCache2_EnumCache( cache, &enum_stat );
1651  ok( hr == S_OK, "got %08x\n", hr );
1652 
1653  while (IEnumSTATDATA_Next(enum_stat, 1, &stat, NULL) == S_OK)
1654  {
1655  ok( stat.formatetc.cfFormat == expect->formatetc.cfFormat, "got %d expect %d\n",
1656  stat.formatetc.cfFormat, expect->formatetc.cfFormat );
1657  ok( !stat.formatetc.ptd == !expect->formatetc.ptd, "got %p expect %p\n",
1658  stat.formatetc.ptd, expect->formatetc.ptd );
1659  ok( stat.formatetc.dwAspect == expect->formatetc.dwAspect, "got %d expect %d\n",
1660  stat.formatetc.dwAspect, expect->formatetc.dwAspect );
1661  ok( stat.formatetc.lindex == expect->formatetc.lindex, "got %d expect %d\n",
1662  stat.formatetc.lindex, expect->formatetc.lindex );
1663  ok( stat.formatetc.tymed == expect->formatetc.tymed, "got %d expect %d\n",
1664  stat.formatetc.tymed, expect->formatetc.tymed );
1665  ok( stat.advf == expect->advf, "got %d expect %d\n", stat.advf, expect->advf );
1666  ok( stat.pAdvSink == 0, "got %p\n", stat.pAdvSink );
1667  ok( stat.dwConnection == expect->dwConnection, "got %d expect %d\n", stat.dwConnection, expect->dwConnection );
1668  num--;
1669  expect++;
1670  }
1671 
1672  ok( num == 0, "incorrect number. num %d\n", num );
1673 
1674  IEnumSTATDATA_Release( enum_stat );
1675 }
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint num
Definition: glext.h:9618
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define expect(expected, got)
Definition: combo.c:36
static void check_expected_method_fmt ( const char method_name,
const FORMATETC *  fmt 
)
inlinestatic

Definition at line 160 of file ole2.c.

162 {
163  trace("%s\n", method_name);
164  ok(expected_method_list->method != NULL, "Extra method %s called\n", method_name);
165  if (!strcmp(expected_method_list->method, "WINE_EXTRA"))
166  {
167  todo_wine ok(0, "Too many method calls.\n");
168  return;
169  }
170  if (expected_method_list->method)
171  {
172  while (expected_method_list->flags & TEST_OPTIONAL &&
173  strcmp(expected_method_list->method, method_name) != 0)
176  {
177  ok(!strcmp(expected_method_list->method, method_name),
178  "Expected %s to be called instead of %s\n",
179  expected_method_list->method, method_name);
180  if (fmt)
181  {
182  ok(fmt->cfFormat == expected_method_list->fmt.cfFormat, "got cf %04x vs %04x\n",
183  fmt->cfFormat, expected_method_list->fmt.cfFormat );
184  ok(fmt->dwAspect == expected_method_list->fmt.dwAspect, "got aspect %d vs %d\n",
185  fmt->dwAspect, expected_method_list->fmt.dwAspect );
186  ok(fmt->lindex == expected_method_list->fmt.lindex, "got lindex %d vs %d\n",
187  fmt->lindex, expected_method_list->fmt.lindex );
188  ok(fmt->tymed == expected_method_list->fmt.tymed, "got tymed %d vs %d\n",
189  fmt->tymed, expected_method_list->fmt.tymed );
190  }
191  }
193  }
194 }
#define trace(...)
Definition: kmt_test.h:217
#define TEST_TODO
Definition: ole2.c:109
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define todo_wine_if(is_todo)
Definition: test.h:155
#define todo_wine
Definition: test.h:154
#define TEST_OPTIONAL
Definition: ole2.c:108
static const struct expected_method * expected_method_list
Definition: ole2.c:118
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: dsound.c:943
static void check_storage_contents ( IStorage stg,
const struct storage_def stg_def,
int enumerated_streams,
int matched_streams 
)
static

Definition at line 3979 of file ole2.c.

Referenced by test_data_cache_contents(), and test_data_cache_save_data().

3981 {
3982  HRESULT hr;
3983  IEnumSTATSTG *enumstg;
3984  IStream *stream;
3985  STATSTG stat;
3986  int i, seen_stream[MAX_STREAM] = { 0 };
3987 
3988  if (winetest_debug > 1)
3989  trace("check_storage_contents:\n=============================================\n");
3990 
3991  *enumerated_streams = 0;
3992  *matched_streams = 0;
3993 
3994  hr = IStorage_Stat(stg, &stat, STATFLAG_NONAME);
3995  ok(hr == S_OK, "unexpected %#x\n", hr);
3996  ok(IsEqualCLSID(stg_def->clsid, &stat.clsid), "expected %s, got %s\n",
3997  wine_dbgstr_guid(stg_def->clsid), wine_dbgstr_guid(&stat.clsid));
3998 
3999  hr = IStorage_EnumElements(stg, 0, NULL, 0, &enumstg);
4000  ok(hr == S_OK, "unexpected %#x\n", hr);
4001 
4002  for (;;)
4003  {
4004  ULONG bytes;
4005  int clipformat = -1;
4007  char name[32];
4008  BYTE data[1024];
4009 
4010  memset(&header, 0, sizeof(header));
4011 
4012  hr = IEnumSTATSTG_Next(enumstg, 1, &stat, NULL);
4013  if(hr == S_FALSE) break;
4014  ok(hr == S_OK, "unexpected %#x\n", hr);
4015 
4016  if (winetest_debug > 1)
4017  trace("name %s, type %u, size %d, clsid %s\n",
4018  wine_dbgstr_w(stat.pwcsName), stat.type, stat.cbSize.u.LowPart, wine_dbgstr_guid(&stat.clsid));
4019 
4020  ok(stat.type == STGTY_STREAM, "unexpected %#x\n", stat.type);
4021 
4022  WideCharToMultiByte(CP_ACP, 0, stat.pwcsName, -1, name, sizeof(name), NULL, NULL);
4023 
4024  hr = IStorage_OpenStream(stg, stat.pwcsName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
4025  ok(hr == S_OK, "unexpected %#x\n", hr);
4026 
4027  if (!memcmp(name, "\2OlePres", 8))
4028  {
4029  ULONG header_size = sizeof(header);
4030 
4031  clipformat = read_clipformat(stream);
4032 
4033  if (clipformat == 0) /* view cache */
4034  header_size = FIELD_OFFSET(PresentationDataHeader, unknown7);
4035 
4036  hr = IStream_Read(stream, &header, header_size, &bytes);
4037  ok(hr == S_OK, "unexpected %#x\n", hr);
4038  ok(bytes == header_size, "read %u bytes, expected %u\n", bytes, header_size);
4039 
4040  if (winetest_debug > 1)
4041  trace("header: tdSize %#x, dvAspect %#x, lindex %#x, advf %#x, unknown7 %#x, dwObjectExtentX %#x, dwObjectExtentY %#x, dwSize %#x\n",
4042  header.tdSize, header.dvAspect, header.lindex, header.advf, header.unknown7,
4043  header.dwObjectExtentX, header.dwObjectExtentY, header.dwSize);
4044  }
4045 
4046  memset(data, 0, sizeof(data));
4047  hr = IStream_Read(stream, data, sizeof(data), &bytes);
4048  ok(hr == S_OK, "unexpected %#x\n", hr);
4049  if (winetest_debug > 1)
4050  trace("stream data (%u bytes): %02x %02x %02x %02x\n", bytes, data[0], data[1], data[2], data[3]);
4051 
4052  for (i = 0; i < stg_def->stream_count; i++)
4053  {
4054  if (seen_stream[i]) continue;
4055 
4056  if (winetest_debug > 1)
4057  trace("%s/%s, %d/%d, %d/%d, %d/%d\n",
4058  stg_def->stream[i].name, name,
4059  stg_def->stream[i].cf, clipformat,
4060  stg_def->stream[i].dvAspect, header.dvAspect,
4061  stg_def->stream[i].advf, header.advf);
4062 
4063  if (!strcmp(stg_def->stream[i].name, name) &&
4064  stg_def->stream[i].cf == clipformat &&
4065  stg_def->stream[i].dvAspect == header.dvAspect &&
4066  stg_def->stream[i].advf == header.advf &&
4067  stg_def->stream[i].data_size <= bytes &&
4068  (!stg_def->stream[i].data_size ||
4069  (!memcmp(stg_def->stream[i].data, data, min(stg_def->stream[i].data_size, bytes)))))
4070  {
4071  if (winetest_debug > 1)
4072  trace("stream %d matches def stream %d\n", *enumerated_streams, i);
4073  seen_stream[i] = 1;
4074  *matched_streams += 1;
4075  }
4076  }
4077 
4078  CoTaskMemFree(stat.pwcsName);
4079  IStream_Release(stream);
4080 
4081  *enumerated_streams += 1;
4082  }
4083 }
#define trace(...)
Definition: kmt_test.h:217
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define WideCharToMultiByte
Definition: compat.h:101
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
const CLSID * clsid
Definition: ole2.c:3834
#define CP_ACP
Definition: compat.h:99
int stream_count
Definition: ole2.c:3835
const char * wine_dbgstr_guid(const GUID *guid)
#define MAX_STREAM
Definition: ole2.c:3820
int winetest_debug
GLenum GLclampf GLint i
Definition: glfuncs.h:14
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define STGM_READ
Definition: objbase.h:916
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint stream
Definition: glext.h:7522
unsigned char BYTE
Definition: ntddk_ex.h:96
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static int read_clipformat(IStream *stream)
Definition: ole2.c:3956
#define min(a, b)
Definition: monoChain.cc:55
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3836
Definition: name.c:36
unsigned int ULONG
Definition: retypes.h:1
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define memset(x, y, z)
Definition: compat.h:39
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
struct CFHEADER header
Definition: fdi.c:109
static void create_bitmap ( STGMEDIUM *  med)
static

Definition at line 229 of file ole2.c.

Referenced by DataObject_GetData(), and test_data_cache_cache().

230 {
231  med->tymed = TYMED_GDI;
232  U(med)->hBitmap = CreateBitmap( 1, 1, 1, 1, NULL );
233  med->pUnkForRelease = NULL;
234 }
#define U(x)
Definition: wordpad.c:44
smooth NULL
Definition: ftsmooth.c:416
HBITMAP WINAPI CreateBitmap(_In_ INT cx, _In_ INT cy, _In_ UINT cPlanes, _In_ UINT cBitsPerPel, _In_opt_ const VOID *pvBits)
static void create_dib ( STGMEDIUM *  med)
static

Definition at line 217 of file ole2.c.

Referenced by DataObject_GetData(), get_stgmedium(), test_data_cache_cache(), and wined3d_texture_update_desc().

218 {
219  void *ptr;
220 
221  med->tymed = TYMED_HGLOBAL;
222  U(med)->hGlobal = GlobalAlloc( GMEM_MOVEABLE, sizeof(dib) );
223  ptr = GlobalLock( U(med)->hGlobal );
224  memcpy( ptr, dib, sizeof(dib) );
225  GlobalUnlock( U(med)->hGlobal );
226  med->pUnkForRelease = NULL;
227 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define U(x)
Definition: wordpad.c:44
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static const BYTE dib[]
Definition: ole2.c:207
#define GMEM_MOVEABLE
Definition: winbase.h:291
static void create_emf ( STGMEDIUM *  med)
static

Definition at line 236 of file ole2.c.

Referenced by get_stgmedium().

237 {
239 
240  Rectangle(hdc, 0, 0, 150, 300);
241  med->tymed = TYMED_ENHMF;
242  U(med)->hEnhMetaFile = CloseEnhMetaFile(hdc);
243  med->pUnkForRelease = NULL;
244 }
#define HDC
Definition: msvc.h:22
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define U(x)
Definition: wordpad.c:44
HDC WINAPI CreateEnhMetaFileW(_In_opt_ HDC, _In_opt_ LPCWSTR, _In_opt_ LPCRECT, _In_opt_ LPCWSTR)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
static void create_mfpict ( STGMEDIUM *  med)
static

Definition at line 246 of file ole2.c.

Referenced by get_stgmedium().

247 {
248  METAFILEPICT *mf;
250 
251  Rectangle(hdc, 0, 0, 100, 200);
252 
253  med->tymed = TYMED_MFPICT;
254  U(med)->hMetaFilePict = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
255  mf = GlobalLock(U(med)->hMetaFilePict);
256  mf->mm = MM_ANISOTROPIC;
257  mf->xExt = 100;
258  mf->yExt = 200;
259  mf->hMF = CloseMetaFile(hdc);
260  GlobalUnlock(U(med)->hMetaFilePict);
261  med->pUnkForRelease = NULL;
262 }
#define HDC
Definition: msvc.h:22
HMETAFILE hMF
Definition: wingdi.h:2585
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define U(x)
Definition: wordpad.c:44
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define MM_ANISOTROPIC
Definition: wingdi.h:865
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_MOVEABLE
Definition: winbase.h:291
static IStorage* create_storage ( int  num)
static

Definition at line 2084 of file ole2.c.

Referenced by test_data_cache_dib_contents_stream().

2085 {
2086  IStorage *stg;
2087  IStream *stm;
2088  HRESULT hr;
2089  ULONG written;
2090 
2092  ok( hr == S_OK, "got %08x\n", hr);
2093  hr = IStorage_SetClass( stg, &CLSID_Picture_Dib );
2094  ok( hr == S_OK, "got %08x\n", hr);
2095  hr = IStorage_CreateStream( stg, CONTENTS, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stm );
2096  ok( hr == S_OK, "got %08x\n", hr);
2097  if (num == 1) /* Set biXPelsPerMeter = 0 */
2098  {
2099  file_dib[0x26] = 0;
2100  file_dib[0x27] = 0;
2101  }
2102  hr = IStream_Write( stm, file_dib, sizeof(file_dib), &written );
2103  ok( hr == S_OK, "got %08x\n", hr);
2104  IStream_Release( stm );
2105  return stg;
2106 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
#define STGM_CREATE
Definition: objbase.h:925
const CLSID CLSID_Picture_Dib
smooth NULL
Definition: ftsmooth.c:416
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
static const WCHAR CONTENTS[]
Definition: ole2.c:2069
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint num
Definition: glext.h:9618
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8637
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
static BYTE file_dib[]
Definition: ole2.c:2072
unsigned int ULONG
Definition: retypes.h:1
static IStorage* create_storage_from_def ( const struct storage_def stg_def)
static

Definition at line 4162 of file ole2.c.

Referenced by test_data_cache_contents().

4163 {
4164  HRESULT hr;
4165  IStorage *stg;
4166  IStream *stm;
4167  int i;
4168 
4170  ok(hr == S_OK, "unexpected %#x\n", hr);
4171 
4172  hr = IStorage_SetClass(stg, stg_def->clsid);
4173  ok(hr == S_OK, "unexpected %#x\n", hr);
4174 
4175  for (i = 0; i < stg_def->stream_count; i++)
4176  {
4177  WCHAR name[32];
4178 
4179  MultiByteToWideChar(CP_ACP, 0, stg_def->stream[i].name, -1, name, 32);
4180  hr = IStorage_CreateStream(stg, name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4181  ok(hr == S_OK, "unexpected %#x\n", hr);
4182 
4183  if (stg_def->stream[i].cf != -1)
4184  {
4185  int clipformat[2];
4187 
4188  if (stg_def->stream[i].cf)
4189  {
4190  clipformat[0] = -1;
4191  clipformat[1] = stg_def->stream[i].cf;
4192  hr = IStream_Write(stm, clipformat, sizeof(clipformat), NULL);
4193  }
4194  else
4195  {
4196  clipformat[0] = 0;
4197  hr = IStream_Write(stm, &clipformat[0], sizeof(clipformat[0]), NULL);
4198  }
4199  ok(hr == S_OK, "unexpected %#x\n", hr);
4200 
4201  hdr.tdSize = sizeof(hdr.tdSize);
4202  hdr.dvAspect = stg_def->stream[i].dvAspect;
4203  hdr.lindex = -1;
4204  hdr.advf = stg_def->stream[i].advf;
4205  hdr.unknown7 = 0;
4206  hdr.dwObjectExtentX = 0;
4207  hdr.dwObjectExtentY = 0;
4208  hdr.dwSize = stg_def->stream[i].data_size;
4209  hr = IStream_Write(stm, &hdr, sizeof(hdr), NULL);
4210  ok(hr == S_OK, "unexpected %#x\n", hr);
4211  }
4212 
4213  if (stg_def->stream[i].data_size)
4214  {
4215  hr = IStream_Write(stm, stg_def->stream[i].data, stg_def->stream[i].data_size, NULL);
4216  ok(hr == S_OK, "unexpected %#x\n", hr);
4217  }
4218 
4219  IStream_Release(stm);
4220  }
4221 
4222  return stg;
4223 }
char hdr[14]
Definition: iptest.cpp:33
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
__wchar_t WCHAR
Definition: xmlstorage.h:180
const CLSID * clsid
Definition: ole2.c:3834
#define CP_ACP
Definition: compat.h:99
#define STGM_CREATE
Definition: objbase.h:925
int stream_count
Definition: ole2.c:3835
GLenum GLclampf GLint i
Definition: glfuncs.h:14
smooth NULL
Definition: ftsmooth.c:416
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8637
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3836
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36
static ULONG WINAPI DataObject_AddRef ( IDataObject iface)
static

Definition at line 1456 of file ole2.c.

1458 {
1459  CHECK_EXPECTED_METHOD("DataObject_AddRef");
1460  return 2;
1461 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI DataObject_DAdvise ( IDataObject iface,
FORMATETC *  pformatetc,
DWORD  advf,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 1555 of file ole2.c.

1561 {
1562  STGMEDIUM stgmedium;
1563 
1564  CHECK_EXPECTED_METHOD("DataObject_DAdvise");
1565  *pdwConnection = 1;
1566 
1567  if(advf & ADVF_PRIMEFIRST)
1568  {
1569  ok(pformatetc->cfFormat == cf_test_2, "got %04x\n", pformatetc->cfFormat);
1570  stgmedium.tymed = TYMED_HGLOBAL;
1571  U(stgmedium).hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 4);
1572  stgmedium.pUnkForRelease = NULL;
1573  IAdviseSink_OnDataChange(pAdvSink, pformatetc, &stgmedium);
1574  }
1575 
1576  return S_OK;
1577 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define U(x)
Definition: wordpad.c:44
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define S_OK
Definition: intsafe.h:59
static UINT cf_test_2
Definition: ole2.c:126
#define GMEM_MOVEABLE
Definition: winbase.h:291
#define GMEM_ZEROINIT
Definition: winbase.h:303
static HRESULT WINAPI DataObject_DUnadvise ( IDataObject iface,
DWORD  dwConnection 
)
static

Definition at line 1579 of file ole2.c.

1582 {
1583  CHECK_EXPECTED_METHOD("DataObject_DUnadvise");
1584  return S_OK;
1585 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI DataObject_EnumDAdvise ( IDataObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 1587 of file ole2.c.

1590 {
1591  CHECK_EXPECTED_METHOD("DataObject_EnumDAdvise");
1592  return OLE_E_ADVISENOTSUPPORTED;
1593 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617
static HRESULT WINAPI DataObject_EnumFormatEtc ( IDataObject iface,
DWORD  dwDirection,
IEnumFORMATETC **  ppenumFormatEtc 
)
static

Definition at line 1546 of file ole2.c.

1550 {
1551  CHECK_EXPECTED_METHOD("DataObject_EnumFormatEtc");
1552  return E_NOTIMPL;
1553 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI DataObject_GetCanonicalFormatEtc ( IDataObject iface,
LPFORMATETC  pformatectIn,
LPFORMATETC  pformatetcOut 
)
static

Definition at line 1527 of file ole2.c.

1531 {
1532  CHECK_EXPECTED_METHOD("DataObject_GetCanonicalFormatEtc");
1533  return E_NOTIMPL;
1534 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI DataObject_GetData ( IDataObject iface,
FORMATETC *  fmt_in,
STGMEDIUM *  med 
)
static

Definition at line 1478 of file ole2.c.

1480 {
1481  FORMATETC *fmt;
1482 
1483  CHECK_EXPECTED_METHOD_FMT("DataObject_GetData", fmt_in);
1484 
1485  for (fmt = g_dataobject_fmts; fmt && fmt->cfFormat != 0; fmt++)
1486  {
1487  if (fmtetc_equal( fmt_in, fmt ))
1488  {
1489  switch (fmt->cfFormat)
1490  {
1491  case CF_DIB:
1492  create_dib( med );
1493  return S_OK;
1494  case CF_BITMAP:
1495  create_bitmap( med );
1496  return S_OK;
1497  default:
1498  trace( "unhandled fmt %d\n", fmt->cfFormat );
1499  }
1500  }
1501  }
1502 
1503  return S_FALSE;
1504 }
#define trace(...)
Definition: kmt_test.h:217
#define CHECK_EXPECTED_METHOD_FMT(method_name, fmt)
Definition: ole2.c:197
static void create_bitmap(STGMEDIUM *med)
Definition: ole2.c:229
const char * fmt
Definition: wsprintf.c:30
static BOOL fmtetc_equal(const FORMATETC *a, const FORMATETC *b)
Definition: ole2.c:1470
static void create_dib(STGMEDIUM *med)
Definition: ole2.c:217
#define S_FALSE
Definition: winerror.h:2357
#define CF_BITMAP
Definition: constants.h:397
static FORMATETC * g_dataobject_fmts
Definition: ole2.c:128
#define S_OK
Definition: intsafe.h:59
#define CF_DIB
Definition: constants.h:403
static HRESULT WINAPI DataObject_GetDataHere ( IDataObject iface,
LPFORMATETC  pformatetc,
STGMEDIUM *  pmedium 
)
static

Definition at line 1506 of file ole2.c.

1510 {
1511  CHECK_EXPECTED_METHOD("DataObject_GetDataHere");
1512  return E_NOTIMPL;
1513 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI DataObject_QueryGetData ( IDataObject iface,
FORMATETC *  fmt_in 
)
static

Definition at line 1515 of file ole2.c.

1516 {
1517  FORMATETC *fmt;
1518 
1519  CHECK_EXPECTED_METHOD_FMT("DataObject_QueryGetData", fmt_in);
1520 
1521  for (fmt = g_dataobject_fmts; fmt && fmt->cfFormat != 0; fmt++)
1522  if (fmtetc_equal( fmt_in, fmt )) return S_OK;
1523 
1524  return S_FALSE;
1525 }
#define CHECK_EXPECTED_METHOD_FMT(method_name, fmt)
Definition: ole2.c:197
const char * fmt
Definition: wsprintf.c:30
static BOOL fmtetc_equal(const FORMATETC *a, const FORMATETC *b)
Definition: ole2.c:1470
#define S_FALSE
Definition: winerror.h:2357
static FORMATETC * g_dataobject_fmts
Definition: ole2.c:128
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI DataObject_QueryInterface ( IDataObject iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 1440 of file ole2.c.

1444 {
1445  CHECK_EXPECTED_METHOD("DataObject_QueryInterface");
1446 
1448  {
1449  *ppvObject = iface;
1450  return S_OK;
1451  }
1452  *ppvObject = NULL;
1453  return S_OK;
1454 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IDataObject
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI DataObject_Release ( IDataObject iface)
static

Definition at line 1463 of file ole2.c.

1465 {
1466  CHECK_EXPECTED_METHOD("DataObject_Release");
1467  return 1;
1468 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI DataObject_SetData ( IDataObject iface,
LPFORMATETC  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 1536 of file ole2.c.

1541 {
1542  CHECK_EXPECTED_METHOD("DataObject_SetData");
1543  return E_NOTIMPL;
1544 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
DEFINE_EXPECT ( Storage_Stat  )
DEFINE_EXPECT ( Storage_OpenStream_CompObj  )
DEFINE_EXPECT ( Storage_OpenStream_OlePres  )
DEFINE_EXPECT ( Storage_SetClass  )
DEFINE_EXPECT ( Storage_CreateStream_CompObj  )
DEFINE_EXPECT ( Storage_CreateStream_OlePres  )
DEFINE_EXPECT ( Storage_OpenStream_Ole  )
DEFINE_EXPECT ( Storage_DestroyElement  )
DEFINE_GUID ( CLSID_Picture_Metafile  ,
0x315  ,
,
,
0xc0  ,
,
,
,
,
,
,
0x46   
)
DEFINE_GUID ( CLSID_Picture_Dib  ,
0x316  ,
,
,
0xc0  ,
,
,
,
,
,
,
0x46   
)
DEFINE_GUID ( CLSID_Picture_EnhMetafile  ,
0x319  ,
,
,
0xc0  ,
,
,
,
,
,
,
0x46   
)
static BOOL STDMETHODCALLTYPE draw_continue ( ULONG_PTR  param)
static

Definition at line 1358 of file ole2.c.

Referenced by test_data_cache().

1359 {
1360  CHECK_EXPECTED_METHOD("draw_continue");
1361  return TRUE;
1362 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define TRUE
Definition: types.h:120
static BOOL STDMETHODCALLTYPE draw_continue_false ( ULONG_PTR  param)
static

Definition at line 1364 of file ole2.c.

Referenced by test_data_cache().

1365 {
1366  CHECK_EXPECTED_METHOD("draw_continue_false");
1367  return FALSE;
1368 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define FALSE
Definition: types.h:117
static BOOL fmtetc_equal ( const FORMATETC *  a,
const FORMATETC *  b 
)
inlinestatic

Definition at line 1470 of file ole2.c.

Referenced by DataObject_GetData(), and DataObject_QueryGetData().

1471 {
1472  /* FIXME ptd */
1473  return a->cfFormat == b->cfFormat && a->dwAspect == b->dwAspect &&
1474  a->lindex == b->lindex && a->tymed == b->tymed;
1475 
1476 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
static void get_stgdef ( struct storage_def stg_def,
CLIPFORMAT  cf,
STGMEDIUM *  stg_med,
int  stm_idx 
)
static

Definition at line 4238 of file ole2.c.

Referenced by test_data_cache_save_data().

4239 {
4240  BYTE *data;
4241  int data_size;
4242  METAFILEPICT *mfpict;
4243  HDC hdc;
4244 
4245  switch (cf)
4246  {
4247  case CF_DIB:
4248  data_size = sizeof(dib);
4249  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4250  {
4251  data_size += sizeof(dib_inf);
4252  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4253  memcpy(data, dib_inf, sizeof(dib_inf));
4254  memcpy(data + sizeof(dib_inf), dib, sizeof(dib));
4255  }
4256  else
4257  {
4258  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4259  memcpy(data, dib, sizeof(dib));
4260  }
4261  stg_def->stream[stm_idx].data = data;
4262  stg_def->stream[stm_idx].data_size = data_size;
4263  break;
4264  case CF_METAFILEPICT:
4265  mfpict = GlobalLock(U(stg_med)->hMetaFilePict);
4266  data_size = GetMetaFileBitsEx(mfpict->hMF, 0, NULL);
4267  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4268  {
4269  data = HeapAlloc(GetProcessHeap(), 0, data_size + sizeof(mf_rec));
4270  memcpy(data, mf_rec, sizeof(mf_rec));
4271  GetMetaFileBitsEx(mfpict->hMF, data_size, data + sizeof(mf_rec));
4272  data_size += sizeof(mf_rec);
4273  }
4274  else
4275  {
4276  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4277  GetMetaFileBitsEx(mfpict->hMF, data_size, data);
4278  }
4279  GlobalUnlock(U(stg_med)->hMetaFilePict);
4280  stg_def->stream[stm_idx].data_size = data_size;
4281  stg_def->stream[stm_idx].data = data;
4282  break;
4283  case CF_ENHMETAFILE:
4284  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4285  {
4286  data_size = GetEnhMetaFileBits(U(stg_med)->hEnhMetaFile, 0, NULL);
4287  data = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) + sizeof(ENHMETAHEADER) + data_size);
4288  *((DWORD *)data) = sizeof(ENHMETAHEADER);
4289  GetEnhMetaFileBits(U(stg_med)->hEnhMetaFile, data_size, data + sizeof(DWORD) + sizeof(ENHMETAHEADER));
4290  memcpy(data + sizeof(DWORD), data + sizeof(DWORD) + sizeof(ENHMETAHEADER), sizeof(ENHMETAHEADER));
4291  data_size += sizeof(DWORD) + sizeof(ENHMETAHEADER);
4292  }
4293  else
4294  {
4295  hdc = GetDC(NULL);
4296  data_size = GetWinMetaFileBits(U(stg_med)->hEnhMetaFile, 0, NULL, MM_ANISOTROPIC, hdc);
4297  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4298  GetWinMetaFileBits(U(stg_med)->hEnhMetaFile, data_size, data, MM_ANISOTROPIC, hdc);
4299  ReleaseDC(NULL, hdc);
4300  }
4301  stg_def->stream[stm_idx].data_size = data_size;
4302  stg_def->stream[stm_idx].data = data;
4303  break;
4304  }
4305 }
static const BYTE mf_rec[]
Definition: ole2.c:4231
#define HDC
Definition: msvc.h:22
HMETAFILE hMF
Definition: wingdi.h:2585
struct tagENHMETAHEADER ENHMETAHEADER
#define CF_ENHMETAFILE
Definition: constants.h:409
HDC WINAPI GetDC(_In_opt_ HWND)
static const BYTE dib_inf[]
Definition: ole2.c:4225
#define U(x)
Definition: wordpad.c:44
#define CF_METAFILEPICT
Definition: constants.h:398
#define DWORD
Definition: msvc.h:34
DWORD DWORD
Definition: winlogon.h:84
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define MM_ANISOTROPIC
Definition: wingdi.h:865
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: ntddk_ex.h:96
UINT WINAPI GetWinMetaFileBits(_In_ HENHMETAFILE hemf, _In_ UINT cbData16, _Out_writes_bytes_opt_(cbData16) LPBYTE pData16, _In_ INT iMapMode, _In_ HDC hdcRef)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
static const BYTE dib[]
Definition: ole2.c:207
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3836
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
UINT WINAPI GetMetaFileBitsEx(_In_ HMETAFILE hMF, _In_ UINT cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpData)
#define CF_DIB
Definition: constants.h:403
static void get_stgmedium ( CLIPFORMAT  cfFormat,
STGMEDIUM *  stgmedium 
)
static

Definition at line 4307 of file ole2.c.

Referenced by test_data_cache_save_data().

4308 {
4309  switch (cfFormat)
4310  {
4311  case CF_DIB:
4312  create_dib(stgmedium);
4313  break;
4314  case CF_METAFILEPICT:
4315  create_mfpict(stgmedium);
4316  break;
4317  case CF_ENHMETAFILE:
4318  create_emf(stgmedium);
4319  break;
4320  default:
4321  ok(0, "cf %x not implemented\n", cfFormat);
4322  }
4323 }
#define CF_ENHMETAFILE
Definition: constants.h:409
static void create_emf(STGMEDIUM *med)
Definition: ole2.c:236
#define CF_METAFILEPICT
Definition: constants.h:398
static void create_dib(STGMEDIUM *med)
Definition: ole2.c:217
#define ok(value,...)
Definition: CComObject.cpp:34
static void create_mfpict(STGMEDIUM *med)
Definition: ole2.c:246
#define CF_DIB
Definition: constants.h:403
static ULONG WINAPI OleObject_AddRef ( IOleObject iface)
static

Definition at line 290 of file ole2.c.

291 {
292  CHECK_EXPECTED_METHOD("OleObject_AddRef");
293  return 2;
294 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObject_Advise ( IOleObject iface,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 476 of file ole2.c.

481 {
482  CHECK_EXPECTED_METHOD("OleObject_Advise");
483  return S_OK;
484 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_Close ( IOleObject iface,
DWORD  dwSaveOption 
)
static

Definition at line 334 of file ole2.c.

338 {
339  CHECK_EXPECTED_METHOD("OleObject_Close");
340  return S_OK;
341 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_DoVerb ( IOleObject iface,
LONG  iVerb,
LPMSG  lpmsg,
IOleClientSite pActiveSite,
LONG  lindex,
HWND  hwndParent,
LPCRECT  lprcPosRect 
)
static

Definition at line 390 of file ole2.c.

399 {
400  CHECK_EXPECTED_METHOD("OleObject_DoVerb");
401  return S_OK;
402 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_EnumAdvise ( IOleObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 497 of file ole2.c.

501 {
502  CHECK_EXPECTED_METHOD("OleObject_EnumAdvise");
503  return E_NOTIMPL;
504 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_EnumVerbs ( IOleObject iface,
IEnumOLEVERB **  ppEnumOleVerb 
)
static

Definition at line 405 of file ole2.c.

409 {
410  CHECK_EXPECTED_METHOD("OleObject_EnumVerbs");
411  return E_NOTIMPL;
412 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_GetClientSite ( IOleObject iface,
IOleClientSite **  ppClientSite 
)
static

Definition at line 313 of file ole2.c.

317 {
318  CHECK_EXPECTED_METHOD("OleObject_GetClientSite");
319  return E_NOTIMPL;
320 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_GetClipboardData ( IOleObject iface,
DWORD  dwReserved,
IDataObject **  ppDataObject 
)
static

Definition at line 379 of file ole2.c.

384 {
385  CHECK_EXPECTED_METHOD("OleObject_GetClipboardData");
386  return E_NOTIMPL;
387 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_GetExtent ( IOleObject iface,
DWORD  dwDrawAspect,
SIZEL psizel 
)
static

Definition at line 465 of file ole2.c.

470 {
471  CHECK_EXPECTED_METHOD("OleObject_GetExtent");
472  return E_NOTIMPL;
473 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_GetMiscStatus ( IOleObject iface,
DWORD  aspect,
DWORD pdwStatus 
)
static

Definition at line 507 of file ole2.c.

512 {
513  CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus");
514 
515  ok(aspect == DVASPECT_CONTENT, "got aspect %d\n", aspect);
516 
518  {
519  *pdwStatus = OLEMISC_RECOMPOSEONRESIZE;
520  return S_OK;
521  }
522  else
523  {
524  *pdwStatus = 0x1234;
526  }
527 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT g_GetMiscStatusFailsWith
Definition: ole2.c:123
#define ok(value,...)
Definition: CComObject.cpp:34
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_GetMoniker ( IOleObject iface,
DWORD  dwAssign,
DWORD  dwWhichMoniker,
IMoniker **  ppmk 
)
static

Definition at line 355 of file ole2.c.

361 {
362  CHECK_EXPECTED_METHOD("OleObject_GetMoniker");
363  return S_OK;
364 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_GetUserClassID ( IOleObject iface,
CLSID pClsid 
)
static

Definition at line 433 of file ole2.c.

437 {
438  CHECK_EXPECTED_METHOD("OleObject_GetUserClassID");
439  return E_NOTIMPL;
440 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_GetUserType ( IOleObject iface,
DWORD  dwFormOfType,
LPOLESTR pszUserType 
)
static

Definition at line 443 of file ole2.c.

448 {
449  CHECK_EXPECTED_METHOD("OleObject_GetUserType");
450  return E_NOTIMPL;
451 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_InitFromData ( IOleObject iface,
IDataObject pDataObject,
BOOL  fCreation,
DWORD  dwReserved 
)
static

Definition at line 367 of file ole2.c.

373 {
374  CHECK_EXPECTED_METHOD("OleObject_InitFromData");
375  return S_OK;
376 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_IsUpToDate ( IOleObject iface)
static

Definition at line 424 of file ole2.c.

427 {
428  CHECK_EXPECTED_METHOD("OleObject_IsUpToDate");
429  return S_OK;
430 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_QueryInterface ( IOleObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 264 of file ole2.c.

265 {
266  CHECK_EXPECTED_METHOD("OleObject_QueryInterface");
267 
268  *ppv = NULL;
269 
271  *ppv = iface;
272  else if (IsEqualIID(riid, &IID_IPersistStorage))
273  *ppv = &OleObjectPersistStg;
274  else if (IsEqualIID(riid, &IID_IOleCache))
275  *ppv = cache;
277  *ppv = runnable;
278  else if (IsEqualIID(riid, &IID_WineTest))
279  return g_QIFailsWith;
280 
281  if(*ppv) {
282  IUnknown_AddRef((IUnknown*)*ppv);
283  return S_OK;
284  }
285 
286  trace("OleObject_QueryInterface: returning E_NOINTERFACE\n");
287  return E_NOINTERFACE;
288 }
#define trace(...)
Definition: kmt_test.h:217
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IPersistStorage
static IRunnableObject * runnable
Definition: ole2.c:82
static const IID IID_WineTest
Definition: ole2.c:100
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IOleObject
static BOOL g_showRunnable
Definition: ole2.c:121
static IOleCache * cache
Definition: ole2.c:81
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
static IPersistStorage OleObjectPersistStg
Definition: ole2.c:80
static HRESULT g_QIFailsWith
Definition: ole2.c:124
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
const GUID IID_IOleCache
static ULONG WINAPI OleObject_Release ( IOleObject iface)
static

Definition at line 296 of file ole2.c.

297 {
298  CHECK_EXPECTED_METHOD("OleObject_Release");
299  return 1;
300 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObject_SetClientSite ( IOleObject iface,
IOleClientSite pClientSite 
)
static

Definition at line 303 of file ole2.c.

307 {
308  CHECK_EXPECTED_METHOD("OleObject_SetClientSite");
309  return S_OK;
310 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_SetColorScheme ( IOleObject iface,
LOGPALETTE pLogpal 
)
static

Definition at line 530 of file ole2.c.

534 {
535  CHECK_EXPECTED_METHOD("OleObject_SetColorScheme");
536  return E_NOTIMPL;
537 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObject_SetExtent ( IOleObject iface,
DWORD  dwDrawAspect,
SIZEL psizel 
)
static

Definition at line 454 of file ole2.c.

459 {
460  CHECK_EXPECTED_METHOD("OleObject_SetExtent");
461  return S_OK;
462 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_SetHostNames ( IOleObject iface,
LPCOLESTR  szContainerApp,
LPCOLESTR  szContainerObj 
)
static

Definition at line 323 of file ole2.c.

328 {
329  CHECK_EXPECTED_METHOD("OleObject_SetHostNames");
330  return S_OK;
331 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_SetMoniker ( IOleObject iface,
DWORD  dwWhichMoniker,
IMoniker pmk 
)
static

Definition at line 344 of file ole2.c.

349 {
350  CHECK_EXPECTED_METHOD("OleObject_SetMoniker");
351  return S_OK;
352 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_Unadvise ( IOleObject iface,
DWORD  dwConnection 
)
static

Definition at line 487 of file ole2.c.

491 {
492  CHECK_EXPECTED_METHOD("OleObject_Unadvise");
493  return S_OK;
494 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObject_Update ( IOleObject iface)
static

Definition at line 415 of file ole2.c.

418 {
419  CHECK_EXPECTED_METHOD("OleObject_Update");
420  return S_OK;
421 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI OleObjectCache_AddRef ( IOleCache iface)
static

Definition at line 673 of file ole2.c.

674 {
675  CHECK_EXPECTED_METHOD("OleObjectCache_AddRef");
676  return 2;
677 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectCache_Cache ( IOleCache iface,
FORMATETC *  pformatetc,
DWORD  advf,
DWORD pdwConnection 
)
static

Definition at line 686 of file ole2.c.

692 {
693  CHECK_EXPECTED_METHOD("OleObjectCache_Cache");
694  if (g_expected_fetc) {
695  ok(pformatetc != NULL, "pformatetc should not be NULL\n");
696  if (pformatetc) {
697  ok(pformatetc->cfFormat == g_expected_fetc->cfFormat,
698  "cfFormat: %x\n", pformatetc->cfFormat);
699  ok((pformatetc->ptd != NULL) == (g_expected_fetc->ptd != NULL),
700  "ptd: %p\n", pformatetc->ptd);
701  ok(pformatetc->dwAspect == g_expected_fetc->dwAspect,
702  "dwAspect: %x\n", pformatetc->dwAspect);
703  ok(pformatetc->lindex == g_expected_fetc->lindex,
704  "lindex: %x\n", pformatetc->lindex);
705  ok(pformatetc->tymed == g_expected_fetc->tymed,
706  "tymed: %x\n", pformatetc->tymed);
707  }
708  } else
709  ok(pformatetc == NULL, "pformatetc should be NULL\n");
710  return S_OK;
711 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
smooth NULL
Definition: ftsmooth.c:416
static FORMATETC * g_expected_fetc
Definition: ole2.c:119
#define ok(value,...)
Definition: CComObject.cpp:34
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectCache_EnumCache ( IOleCache iface,
IEnumSTATDATA **  ppenumSTATDATA 
)
static

Definition at line 724 of file ole2.c.

728 {
729  CHECK_EXPECTED_METHOD("OleObjectCache_EnumCache");
730  return S_OK;
731 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectCache_InitCache ( IOleCache iface,
IDataObject pDataObject 
)
static

Definition at line 735 of file ole2.c.

739 {
740  CHECK_EXPECTED_METHOD("OleObjectCache_InitCache");
741  return S_OK;
742 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectCache_QueryInterface ( IOleCache iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 668 of file ole2.c.

669 {
670  return IOleObject_QueryInterface(&OleObject, riid, ppv);
671 }
REFIID riid
Definition: precomp.h:44
static IOleObject OleObject
Definition: ole2.c:567
static ULONG WINAPI OleObjectCache_Release ( IOleCache iface)
static

Definition at line 679 of file ole2.c.

680 {
681  CHECK_EXPECTED_METHOD("OleObjectCache_Release");
682  return 1;
683 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectCache_SetData ( IOleCache iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 746 of file ole2.c.

752 {
753  CHECK_EXPECTED_METHOD("OleObjectCache_SetData");
754  return S_OK;
755 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectCache_Uncache ( IOleCache iface,
DWORD  dwConnection 
)
static

Definition at line 714 of file ole2.c.

718 {
719  CHECK_EXPECTED_METHOD("OleObjectCache_Uncache");
720  return S_OK;
721 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI OleObjectCF_AddRef ( IClassFactory iface)
static

Definition at line 784 of file ole2.c.

785 {
786  return 2;
787 }
static HRESULT WINAPI OleObjectCF_CreateInstance ( IClassFactory iface,
IUnknown punkOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 794 of file ole2.c.

795 {
796  return IOleObject_QueryInterface(&OleObject, riid, ppv);
797 }
REFIID riid
Definition: precomp.h:44
static IOleObject OleObject
Definition: ole2.c:567
static HRESULT WINAPI OleObjectCF_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 799 of file ole2.c.

800 {
801  return S_OK;
802 }
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectCF_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 772 of file ole2.c.

773 {
775  {
776  *ppv = iface;
777  IClassFactory_AddRef(iface);
778  return S_OK;
779  }
780  *ppv = NULL;
781  return E_NOINTERFACE;
782 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
const GUID IID_IClassFactory
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI OleObjectCF_Release ( IClassFactory iface)
static

Definition at line 789 of file ole2.c.

790 {
791  return 1;
792 }
static ULONG WINAPI OleObjectPersistStg_AddRef ( IPersistStorage iface)
static

Definition at line 575 of file ole2.c.

576 {
577  CHECK_EXPECTED_METHOD("OleObjectPersistStg_AddRef");
578  return 2;
579 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectPersistStg_GetClassId ( IPersistStorage iface,
CLSID clsid 
)
static

Definition at line 587 of file ole2.c.

588 {
589  CHECK_EXPECTED_METHOD("OleObjectPersistStg_GetClassId");
590  return E_NOTIMPL;
591 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleObjectPersistStg_HandsOffStorage ( IPersistStorage iface)
static

Definition at line 644 of file ole2.c.

647 {
648  CHECK_EXPECTED_METHOD("OleObjectPersistStg_HandsOffStorage");
649  return S_OK;
650 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectPersistStg_InitNew ( IPersistStorage iface,
IStorage pStg 
)
static

Definition at line 603 of file ole2.c.

607 {
608  CHECK_EXPECTED_METHOD("OleObjectPersistStg_InitNew");
609  return S_OK;
610 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectPersistStg_IsDirty ( IPersistStorage iface)
static

Definition at line 594 of file ole2.c.

597 {
598  CHECK_EXPECTED_METHOD("OleObjectPersistStg_IsDirty");
599  return S_OK;
600 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectPersistStg_Load ( IPersistStorage iface,
IStorage pStg 
)
static

Definition at line 613 of file ole2.c.

617 {
618  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Load");
619  return S_OK;
620 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectPersistStg_QueryInterface ( IPersistStorage iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 569 of file ole2.c.

570 {
571  trace("OleObjectPersistStg_QueryInterface\n");
572  return IOleObject_QueryInterface(&OleObject, riid, ppv);
573 }
#define trace(...)
Definition: kmt_test.h:217
REFIID riid
Definition: precomp.h:44
static IOleObject OleObject
Definition: ole2.c:567
static ULONG WINAPI OleObjectPersistStg_Release ( IPersistStorage iface)
static

Definition at line 581 of file ole2.c.

582 {
583  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Release");
584  return 1;
585 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectPersistStg_Save ( IPersistStorage iface,
IStorage pStgSave,
BOOL  fSameAsLoad 
)
static

Definition at line 623 of file ole2.c.

628 {
629  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Save");
630  return S_OK;
631 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectPersistStg_SaveCompleted ( IPersistStorage iface,
IStorage pStgNew 
)
static

Definition at line 634 of file ole2.c.

638 {
639  CHECK_EXPECTED_METHOD("OleObjectPersistStg_SaveCompleted");
640  return S_OK;
641 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI OleObjectRunnable_AddRef ( IRunnableObject iface)
static

Definition at line 820 of file ole2.c.

821 {
822  CHECK_EXPECTED_METHOD("OleObjectRunnable_AddRef");
823  return 2;
824 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectRunnable_GetRunningClass ( IRunnableObject iface,
LPCLSID  lpClsid 
)
static

Definition at line 832 of file ole2.c.

835 {
836  CHECK_EXPECTED_METHOD("OleObjectRunnable_GetRunningClass");
837  return E_NOTIMPL;
838 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define E_NOTIMPL
Definition: ddrawi.h:99
static BOOL WINAPI OleObjectRunnable_IsRunning ( IRunnableObject iface)
static

Definition at line 848 of file ole2.c.

849 {
850  CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning");
851  return g_isRunning;
852 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static BOOL g_isRunning
Definition: ole2.c:122
static HRESULT WINAPI OleObjectRunnable_LockRunning ( IRunnableObject iface,
BOOL  fLock,
BOOL  fLastUnlockCloses 
)
static

Definition at line 854 of file ole2.c.

858 {
859  CHECK_EXPECTED_METHOD("OleObjectRunnable_LockRunning");
860  return S_OK;
861 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectRunnable_QueryInterface ( IRunnableObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 815 of file ole2.c.

816 {
817  return IOleObject_QueryInterface(&OleObject, riid, ppv);
818 }
REFIID riid
Definition: precomp.h:44
static IOleObject OleObject
Definition: ole2.c:567
static ULONG WINAPI OleObjectRunnable_Release ( IRunnableObject iface)
static

Definition at line 826 of file ole2.c.

827 {
828  CHECK_EXPECTED_METHOD("OleObjectRunnable_Release");
829  return 1;
830 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
static HRESULT WINAPI OleObjectRunnable_Run ( IRunnableObject iface,
LPBINDCTX  pbc 
)
static

Definition at line 840 of file ole2.c.

843 {
844  CHECK_EXPECTED_METHOD("OleObjectRunnable_Run");
845  return S_OK;
846 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static HRESULT WINAPI OleObjectRunnable_SetContainedObject ( IRunnableObject iface,
BOOL  fContained 
)
static

Definition at line 863 of file ole2.c.

866 {
867  CHECK_EXPECTED_METHOD("OleObjectRunnable_SetContainedObject");
868  return S_OK;
869 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:196
#define S_OK
Definition: intsafe.h:59
static ULONG WINAPI OleRun_AddRef ( IRunnableObject iface)
static

Definition at line 3200 of file ole2.c.

3201 {
3202  return 2;
3203 }
static HRESULT WINAPI OleRun_GetRunningClass ( IRunnableObject iface,
CLSID clsid 
)
static

Definition at line 3210 of file ole2.c.

3211 {
3212  ok(0, "unexpected\n");
3213  return E_NOTIMPL;
3214 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static BOOL WINAPI OleRun_IsRunning ( IRunnableObject iface)
static

Definition at line 3222 of file ole2.c.

3223 {
3224  ok(0, "unexpected\n");
3225  return FALSE;
3226 }
#define FALSE
Definition: types.h:117
#define ok(value,...)
Definition: CComObject.cpp:34
static HRESULT WINAPI OleRun_LockRunning ( IRunnableObject iface,
BOOL  lock,
BOOL  last_unlock_closes 
)
static

Definition at line 3228 of file ole2.c.

3230 {
3231  ok(0, "unexpected\n");
3232  return E_NOTIMPL;
3233 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI OleRun_QueryInterface ( IRunnableObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 3182 of file ole2.c.

3183 {
3184  *ppv = NULL;
3185 
3186  if (IsEqualIID(riid, &IID_IUnknown) ||
3188  *ppv = iface;
3189  }
3190 
3191  if (*ppv)
3192  {
3193  IUnknown_AddRef((IUnknown *)*ppv);
3194  return S_OK;
3195  }
3196 
3197  return E_NOINTERFACE;
3198 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IUnknown
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static ULONG WINAPI OleRun_Release ( IRunnableObject iface)
static

Definition at line 3205 of file ole2.c.

3206 {
3207  return 1;
3208 }
static HRESULT WINAPI OleRun_Run ( IRunnableObject iface,
LPBINDCTX  ctx 
)
static

Definition at line 3216 of file ole2.c.

3217 {
3218  ok(ctx == NULL, "got %p\n", ctx);
3219  return 0xdeadc0de;
3220 }
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
static HRESULT WINAPI OleRun_SetContainedObject ( IRunnableObject iface,
BOOL  contained 
)
static

Definition at line 3235 of file ole2.c.

3236 {
3237  ok(0, "unexpected\n");
3238  return E_NOTIMPL;
3239 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static int read_clipformat ( IStream stream)
static

Definition at line 3956 of file ole2.c.

Referenced by check_storage_contents().

3957 {
3958  HRESULT hr;
3959  ULONG bytes;
3960  int length, clipformat = -2;
3961 
3962  hr = IStream_Read(stream, &length, sizeof(length), &bytes);
3963  if (hr != S_OK || bytes != sizeof(length))
3964  return -2;
3965  if (length == 0)
3966  return 0;
3967  if (length == -1)
3968  {
3969  hr = IStream_Read(stream, &clipformat, sizeof(clipformat), &bytes);
3970  if (hr != S_OK || bytes != sizeof(clipformat))
3971  return -2;
3972  }
3973  else
3974  ok(0, "unhandled clipformat length %d\n", length);
3975 
3976  return clipformat;
3977 }
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define ok(value,...)
Definition: CComObject.cpp:34
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1
START_TEST ( ole2  )

Definition at line 4600 of file ole2.c.

4601 {
4602  DWORD dwRegister;
4603  IStorage *pStorage;
4604  STATSTG statstg;
4605  HRESULT hr;
4606 
4607  cf_test_1 = RegisterClipboardFormatA("cf_winetest_1");
4608  cf_test_2 = RegisterClipboardFormatA("cf_winetest_2");
4609  cf_test_3 = RegisterClipboardFormatA("cf_winetest_3");
4610 
4611  CoInitialize(NULL);
4612 
4613  hr = CoRegisterClassObject(&CLSID_Equation3, (IUnknown *)&OleObjectCF, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);
4614  ok_ole_success(hr, "CoRegisterClassObject");
4615 
4617  ok_ole_success(hr, "StgCreateDocfile");
4618 
4619  test_OleCreate(pStorage);
4620 
4621  hr = IStorage_Stat(pStorage, &statstg, STATFLAG_NONAME);
4622  ok_ole_success(hr, "IStorage_Stat");
4623  ok(IsEqualCLSID(&CLSID_Equation3, &statstg.clsid), "Wrong CLSID in storage\n");
4624 
4625  test_OleLoad(pStorage);
4626 
4627  IStorage_Release(pStorage);
4628 
4629  hr = CoRevokeClassObject(dwRegister);
4630  ok_ole_success(hr, "CoRevokeClassObject");
4631 
4633 
4634  test_data_cache();
4642  test_runnable();
4643  test_OleRun();
4645  test_OleDraw();
4650 
4651  CoUninitialize();
4652 }
static const CLSID CLSID_Equation3
Definition: ole2.c:885
#define ok_ole_success(hr, func)
Definition: ole2.c:42
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
static void test_data_cache_updatecache(void)
Definition: ole2.c:2629
#define STGM_CREATE
Definition: objbase.h:925
static void test_data_cache_save(void)
Definition: ole2.c:3725
static void test_data_cache_save_data(void)
Definition: ole2.c:4326
static void test_data_cache_cache(void)
Definition: ole2.c:2217
DWORD DWORD
Definition: winlogon.h:84
static const CLSID * Storage_SetClass_CLSID
Definition: ole2.c:77
static void test_default_handler(void)
Definition: ole2.c:2930
static void test_OleLoad(IStorage *pStorage)
Definition: ole2.c:1197
static void test_OleDraw(void)
Definition: ole2.c:3275
smooth NULL
Definition: ftsmooth.c:416
static void test_data_cache(void)
Definition: ole2.c:1677
static void test_runnable(void)
Definition: ole2.c:3136
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
static void test_data_cache_dib_contents_stream(int num)
Definition: ole2.c:2108
static UINT cf_test_3
Definition: ole2.c:126
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
#define ok(value,...)
Definition: CComObject.cpp:34
static const CLSID CLSID_WineTest
Definition: ole2.c:92
LONG HRESULT
Definition: typedefs.h:77
static IClassFactory OleObjectCF
Definition: ole2.c:813
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8637
static void test_data_cache_contents(void)
Definition: ole2.c:4523
#define STGM_READWRITE
Definition: objbase.h:918
UINT WINAPI RegisterClipboardFormatA(_In_ LPCSTR)
HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid, LPUNKNOWN pUnk, DWORD dwClsContext, DWORD flags, LPDWORD lpdwRegister)
Definition: compobj.c:2809
static void test_data_cache_initnew(void)
Definition: ole2.c:2515
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994
static void test_OleRun(void)
Definition: ole2.c:3255
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1900
static void test_OleCreate(IStorage *pStorage)
Definition: ole2.c:965
static UINT cf_test_1
Definition: ole2.c:126
static UINT cf_test_2
Definition: ole2.c:126
static void test_data_cache_init(void)
Definition: ole2.c:2470
static void test_OleLockRunning(void)
Definition: ole2.c:3267
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
static void test_OleDoAutoConvert(void)
Definition: ole2.c:3535
static HRESULT stgmedium_cmp ( const STGMEDIUM *  med1,
STGMEDIUM *  med2 
)
static

Definition at line 4085 of file ole2.c.

Referenced by test_data_cache_save_data().

4086 {
4087  BYTE *data1, *data2;
4088  ULONG datasize1, datasize2;
4089 
4090  if (med1->tymed != med2->tymed)
4091  return E_FAIL;
4092 
4093  if (med1->tymed == TYMED_MFPICT)
4094  {
4095  METAFILEPICT *mfpict1 = GlobalLock(U(med1)->hMetaFilePict);
4096  METAFILEPICT *mfpict2 = GlobalLock(U(med2)->hMetaFilePict);
4097 
4098  datasize1 = GetMetaFileBitsEx(mfpict1->hMF, 0, NULL);
4099  datasize2 = GetMetaFileBitsEx(mfpict2->hMF, 0, NULL);
4100  if (datasize1 == datasize2)
4101  {
4102  data1 = HeapAlloc(GetProcessHeap(), 0, datasize1);
4103  data2 = HeapAlloc(GetProcessHeap(), 0, datasize2);
4104  GetMetaFileBitsEx(mfpict1->hMF, datasize1, data1);
4105  GetMetaFileBitsEx(mfpict2->hMF, datasize2, data2);
4106  }
4107  else return E_FAIL;
4108  }
4109  else if (med1->tymed == TYMED_ENHMF)
4110  {
4111  datasize1 = GetEnhMetaFileBits(med1->hEnhMetaFile, 0, NULL);
4112  datasize2 = GetEnhMetaFileBits(med2->hEnhMetaFile, 0, NULL);
4113  if (datasize1 == datasize2)
4114  {
4115  data1 = HeapAlloc(GetProcessHeap(), 0, datasize1);
4116  data2 = HeapAlloc(GetProcessHeap(), 0, datasize2);
4117  GetEnhMetaFileBits(med1->hEnhMetaFile, datasize1, data1);
4118  GetEnhMetaFileBits(med2->hEnhMetaFile, datasize2, data2);
4119  }
4120  else return E_FAIL;
4121  }
4122  else if (med1->tymed == TYMED_HGLOBAL)
4123  {
4124  datasize1 = GlobalSize(med1->hGlobal);
4125  datasize2 = GlobalSize(med2->hGlobal);
4126 
4127  if (datasize1 == datasize2)
4128  {
4129  data1 = GlobalLock(med1->hGlobal);
4130  data2 = GlobalLock(med2->hGlobal);
4131  }
4132  else
4133  return E_FAIL;
4134  }
4135  else
4136  return E_NOTIMPL;
4137 
4138  if (memcmp(data1, data2, datasize1) != 0)
4139  return E_FAIL;
4140 
4141  if (med1->tymed == TYMED_HGLOBAL)
4142  {
4143  GlobalUnlock(U(med1)->hGlobal);
4144  GlobalUnlock(U(med2)->hGlobal);
4145  }
4146  else if (med1->tymed == TYMED_MFPICT)
4147  {
4148  HeapFree(GetProcessHeap(), 0, data1);
4149  HeapFree(GetProcessHeap(), 0, data2);
4150  GlobalUnlock(U(med1)->hMetaFilePict);
4151  GlobalUnlock(U(med2)->hMetaFilePict);
4152  }
4153  else
4154  {
4155  HeapFree(GetProcessHeap(), 0, data1);
4156  HeapFree(GetProcessHeap(), 0, data2);
4157  }
4158 
4159  return S_OK;
4160 }
HMETAFILE hMF
Definition: wingdi.h:2585
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define U(x)
Definition: wordpad.c:44
#define E_FAIL
Definition: ddrawi.h:102
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
unsigned char BYTE
Definition: ntddk_ex.h:96
#define S_OK
Definition: intsafe.h:59
static const WCHAR data1[]
Definition: db.c:2967
static const WCHAR data2[]
Definition: db.c:2971
#define E_NOTIMPL
Definition: ddrawi.h:99
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
unsigned int ULONG
Definition: retypes.h:1
UINT WINAPI GetMetaFileBitsEx(_In_ HMETAFILE hMF, _In_ UINT cbBuffer, _Out_writes_bytes_opt_(cbBuffer) LPVOID lpData)
#define HeapFree(x, y, z)
Definition: compat.h:394
static ULONG WINAPI Storage_AddRef ( IStorage iface)
static

Definition at line 3303 of file ole2.c.

3304 {
3305  ok(0, "unexpected call to AddRef\n");
3306  return 2;
3307 }
#define ok(value,...)
Definition: CComObject.cpp:34
static HRESULT WINAPI Storage_Commit ( IStorage iface,
DWORD  grfCommitFlags 
)
static

Definition at line 3437 of file ole2.c.

3438 {
3439  ok(0, "unexpected call to Commit\n");
3440  return E_NOTIMPL;
3441 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_CopyTo ( IStorage iface,
DWORD  ciidExclude,
const IID rgiidExclude,
SNB  snbExclude,
IStorage pstgDest 
)
static

Definition at line 3425 of file ole2.c.

3426 {
3427  ok(0, "unexpected call to CopyTo\n");
3428  return E_NOTIMPL;
3429 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_CreateStorage ( IStorage iface,
LPCOLESTR  pwcsName,
DWORD  grfMode,
DWORD  dwStgFmt,
DWORD  reserved2,
IStorage **  ppstg 
)
static

Definition at line 3413 of file ole2.c.

3414 {
3415  ok(0, "unexpected call to CreateStorage\n");
3416  return E_NOTIMPL;
3417 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_CreateStream ( IStorage iface,
LPCOLESTR  pwcsName,
DWORD  grfMode,
DWORD  reserved1,
DWORD  reserved2,
IStream **  ppstm 
)
static

Definition at line 3315 of file ole2.c.

3316 {
3317  ULARGE_INTEGER size = {{0}};
3318  LARGE_INTEGER pos = {{0}};
3319  HRESULT hr;
3320 
3321  if (!lstrcmpW(pwcsName, comp_objW))
3322  {
3323  CHECK_EXPECT(Storage_CreateStream_CompObj);
3324  *ppstm = comp_obj_stream;
3325 
3326  todo_wine ok(grfMode == (STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3327  }
3328  else if (!lstrcmpW(pwcsName, olepres0W))
3329  {
3330  CHECK_EXPECT(Storage_CreateStream_OlePres);
3331  *ppstm = olepres_stream;
3332 
3333  todo_wine ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3334  }
3335  else
3336  {
3337 todo_wine
3338  ok(0, "unexpected stream name %s\n", wine_dbgstr_w(pwcsName));
3339 #if 0 /* FIXME: return NULL once Wine is fixed */
3340  *ppstm = NULL;
3341  return E_NOTIMPL;
3342 #else
3343  *ppstm = contents_stream;
3344 #endif
3345  }
3346 
3347  ok(!reserved1, "reserved1 = %x\n", reserved1);
3348  ok(!reserved2, "reserved2 = %x\n", reserved2);
3349  ok(!!ppstm, "ppstm = NULL\n");
3350 
3351  IStream_AddRef(*ppstm);
3352  hr = IStream_Seek(*ppstm, pos, STREAM_SEEK_SET, NULL);
3353  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3354  hr = IStream_SetSize(*ppstm, size);
3355  ok(hr == S_OK, "IStream_SetSize returned %x\n", hr);
3356  return S_OK;
3357 }
static IStream * comp_obj_stream
Definition: ole2.c:3292
static IStream * contents_stream
Definition: ole2.c:3295
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define STGM_CREATE
Definition: objbase.h:925
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
GLsizeiptr size
Definition: glext.h:5919
uint8_t reserved2[12]
Definition: fsck.fat.h:58
static IStream * olepres_stream
Definition: ole2.c:3294
LONG HRESULT
Definition: typedefs.h:77
#define todo_wine
Definition: test.h:154
static const WCHAR olepres0W[]
Definition: ole2.c:3290
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:56
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR comp_objW[]
Definition: ole2.c:3291
static HRESULT WINAPI Storage_DestroyElement ( IStorage iface,
LPCOLESTR  pwcsName 
)
static

Definition at line 3455 of file ole2.c.

Referenced by test_data_cache_save().

3456 {
3457  char name[32];
3458  int stream_n, cmp;
3459 
3461  cmp = CompareStringW(LOCALE_NEUTRAL, 0, pwcsName, 8, olepres0W, 8);
3462  ok(cmp == CSTR_EQUAL,
3463  "unexpected call to DestroyElement(%s)\n", wine_dbgstr_w(pwcsName));
3464 
3465  WideCharToMultiByte(CP_ACP, 0, pwcsName, -1, name, sizeof(name), NULL, NULL);
3466  stream_n = atol(name + 8);
3467  if (stream_n <= Storage_DestroyElement_limit)
3468  return S_OK;
3469 
3470  return STG_E_FILENOTFOUND;
3471 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define cmp(status, error)
Definition: error.c:114
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:1899
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
#define STG_E_FILENOTFOUND
Definition: winerror.h:2565
#define CSTR_EQUAL
Definition: winnls.h:444
static const WCHAR olepres0W[]
Definition: ole2.c:3290
#define S_OK
Definition: intsafe.h:59
static int Storage_DestroyElement_limit
Definition: ole2.c:78
static HRESULT WINAPI Storage_DestroyElement(IStorage *iface, LPCOLESTR pwcsName)
Definition: ole2.c:3455
Definition: name.c:36
#define LOCALE_NEUTRAL
#define CHECK_EXPECT2(func)
Definition: ole2.c:50
static HRESULT WINAPI Storage_EnumElements ( IStorage iface,
DWORD  reserved1,
void reserved2,
DWORD  reserved3,
IEnumSTATSTG **  ppenum 
)
static

Definition at line 3449 of file ole2.c.

3450 {
3451  ok(0, "unexpected call to EnumElements\n");
3452  return E_NOTIMPL;
3453 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_MoveElementTo ( IStorage iface,
LPCOLESTR  pwcsName,
IStorage pstgDest,
LPCOLESTR  pwcsNewName,
DWORD  grfFlags 
)
static

Definition at line 3431 of file ole2.c.

3432 {
3433  ok(0, "unexpected call to MoveElementTo\n");
3434  return E_NOTIMPL;
3435 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_OpenStorage ( IStorage iface,
LPCOLESTR  pwcsName,
IStorage pstgPriority,
DWORD  grfMode,
SNB  snbExclude,
DWORD  reserved,
IStorage **  ppstg 
)
static

Definition at line 3419 of file ole2.c.

3420 {
3421  ok(0, "unexpected call to OpenStorage\n");
3422  return E_NOTIMPL;
3423 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_OpenStream ( IStorage iface,
LPCOLESTR  pwcsName,
void reserved1,
DWORD  grfMode,
DWORD  reserved2,
IStream **  ppstm 
)
static

Definition at line 3359 of file ole2.c.

3360 {
3361  static const WCHAR ole1W[] = {1,'O','l','e',0};
3362 
3363  LARGE_INTEGER pos = {{0}};
3364  HRESULT hr;
3365 
3366  ok(!reserved1, "reserved1 = %p\n", reserved1);
3367  ok(!reserved2, "reserved2 = %x\n", reserved2);
3368  ok(!!ppstm, "ppstm = NULL\n");
3369 
3370  if(!lstrcmpW(pwcsName, comp_objW)) {
3371  CHECK_EXPECT2(Storage_OpenStream_CompObj);
3372  ok(grfMode == STGM_SHARE_EXCLUSIVE, "grfMode = %x\n", grfMode);
3373 
3374  *ppstm = comp_obj_stream;
3375  IStream_AddRef(comp_obj_stream);
3376  hr = IStream_Seek(comp_obj_stream, pos, STREAM_SEEK_SET, NULL);
3377  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3378  return S_OK;
3379  }else if(!lstrcmpW(pwcsName, ole1W)) {
3380  CHECK_EXPECT(Storage_OpenStream_Ole);
3381 
3382  if (!ole_stream)
3383  {
3384  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READ), "grfMode = %x\n", grfMode);
3385 
3386  *ppstm = NULL;
3387  return STG_E_FILENOTFOUND;
3388  }
3389 
3390  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3391 
3392  *ppstm = ole_stream;
3393  IStream_AddRef(ole_stream);
3394  hr = IStream_Seek(ole_stream, pos, STREAM_SEEK_SET, NULL);
3395  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3396  return S_OK;
3397 
3398  }else if(!lstrcmpW(pwcsName, olepres0W)) {
3399  CHECK_EXPECT(Storage_OpenStream_OlePres);
3400  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3401 
3402  *ppstm = olepres_stream;
3403  IStream_AddRef(olepres_stream);
3404  hr = IStream_Seek(olepres_stream, pos, STREAM_SEEK_SET, NULL);
3405  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3406  return S_OK;
3407  }
3408 
3409  ok(0, "unexpected call to OpenStream: %s\n", wine_dbgstr_w(pwcsName));
3410  return E_NOTIMPL;
3411 }
static IStream * comp_obj_stream
Definition: ole2.c:3292
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: CString.cpp:62
smooth NULL
Definition: ftsmooth.c:416
static IStream * ole_stream
Definition: ole2.c:3293
#define ok(value,...)
Definition: CComObject.cpp:34
#define STGM_READ
Definition: objbase.h:916
uint8_t reserved2[12]
Definition: fsck.fat.h:58
static IStream * olepres_stream
Definition: ole2.c:3294
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_FILENOTFOUND
Definition: winerror.h:2565
static const WCHAR olepres0W[]
Definition: ole2.c:3290
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:56
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR comp_objW[]
Definition: ole2.c:3291
#define CHECK_EXPECT2(func)
Definition: ole2.c:50
static HRESULT WINAPI Storage_QueryInterface ( IStorage iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 3297 of file ole2.c.

3298 {
3299  ok(0, "unexpected call to QueryInterface\n");
3300  return E_NOTIMPL;
3301 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static ULONG WINAPI Storage_Release ( IStorage iface)
static

Definition at line 3309 of file ole2.c.

3310 {
3311  ok(0, "unexpected call to Release\n");
3312  return 1;
3313 }
#define ok(value,...)
Definition: CComObject.cpp:34
static HRESULT WINAPI Storage_RenameElement ( IStorage iface,
LPCOLESTR  pwcsOldName,
LPCOLESTR  pwcsNewName 
)
static

Definition at line 3473 of file ole2.c.

3474 {
3475  ok(0, "unexpected call to RenameElement\n");
3476  return E_NOTIMPL;
3477 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_Revert ( IStorage iface)
static

Definition at line 3443 of file ole2.c.

3444 {
3445  ok(0, "unexpected call to Revert\n");
3446  return E_NOTIMPL;
3447 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_SetClass ( IStorage iface,
REFCLSID  clsid 
)
static

Definition at line 3485 of file ole2.c.

Referenced by test_OleDoAutoConvert().

3486 {
3488  ok(IsEqualIID(clsid, Storage_SetClass_CLSID), "expected %s, got %s\n",
3490  return S_OK;
3491 }
static HRESULT WINAPI Storage_SetClass(IStorage *iface, REFCLSID clsid)
Definition: ole2.c:3485
const char * wine_dbgstr_guid(const GUID *guid)
static const CLSID * Storage_SetClass_CLSID
Definition: ole2.c:77
#define ok(value,...)
Definition: CComObject.cpp:34
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:56
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
static HRESULT WINAPI Storage_SetElementTimes ( IStorage iface,
LPCOLESTR  pwcsName,
const FILETIME pctime,
const FILETIME patime,
const FILETIME pmtime 
)
static

Definition at line 3479 of file ole2.c.

3480 {
3481  ok(0, "unexpected call to SetElementTimes\n");
3482  return E_NOTIMPL;
3483 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_SetStateBits ( IStorage iface,
DWORD  grfStateBits,
DWORD  grfMask 
)
static

Definition at line 3493 of file ole2.c.

3494 {
3495  ok(0, "unexpected call to SetStateBits\n");
3496  return E_NOTIMPL;
3497 }
#define ok(value,...)
Definition: CComObject.cpp:34
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT WINAPI Storage_Stat ( IStorage iface,
STATSTG *  pstatstg,
DWORD  grfStatFlag 
)
static

Definition at line 3499 of file ole2.c.

Referenced by test_OleDoAutoConvert().

3500 {
3502  ok(pstatstg != NULL, "pstatstg = NULL\n");
3503  ok(grfStatFlag == STATFLAG_NONAME, "grfStatFlag = %x\n", grfStatFlag);
3504 
3505  memset(pstatstg, 0, sizeof(STATSTG));
3506  pstatstg->type = STGTY_STORAGE;
3507  pstatstg->clsid = CLSID_WineTestOld;
3508  return S_OK;
3509 }
static HRESULT WINAPI Storage_Stat(IStorage *iface, STATSTG *pstatstg, DWORD grfStatFlag)
Definition: ole2.c:3499
static const CLSID CLSID_WineTestOld
Definition: ole2.c:84
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: CComObject.cpp:34
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT2(func)
Definition: ole2.c:50
#define memset(x, y, z)
Definition: compat.h:39
static void test_data_cache ( void  )
static

Definition at line 1677 of file ole2.c.

Referenced by START_TEST().

1678 {
1679  HRESULT hr;
1680  IOleCache2 *pOleCache;
1681  IOleCache *olecache;
1682  IStorage *pStorage;
1683  IUnknown *unk, *unk2;
1684  IPersistStorage *pPS;
1685  IViewObject *pViewObject;
1686  IOleCacheControl *pOleCacheControl;
1687  IDataObject *pCacheDataObject;
1688  FORMATETC fmtetc;
1689  STGMEDIUM stgmedium;
1690  DWORD dwConnection;
1691  DWORD dwFreeze;
1692  RECTL rcBounds;
1693  HDC hdcMem;
1694  CLSID clsid;
1695  char szSystemDir[MAX_PATH];
1696  WCHAR wszPath[MAX_PATH];
1697  static const WCHAR wszShell32[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0};
1698 
1699  static const struct expected_method methods_cacheinitnew[] =
1700  {
1701  { "AdviseSink_OnViewChange", 0 },
1702  { "AdviseSink_OnViewChange", 0 },
1703  { "draw_continue", 1 },
1704  { "draw_continue_false", 1 },
1705  { "DataObject_DAdvise", 0 },
1706  { "DataObject_DAdvise", 0 },
1707  { "DataObject_DUnadvise", 0 },
1708  { "DataObject_DUnadvise", 0 },
1709  { NULL, 0 }
1710  };
1711  static const struct expected_method methods_cacheload[] =
1712  {
1713  { "AdviseSink_OnViewChange", 0 },
1714  { "draw_continue", 1 },
1715  { "draw_continue", 1 },
1716  { "draw_continue", 1 },
1717  { "DataObject_GetData", 0, { CF_DIB, NULL, DVASPECT_THUMBNAIL, -1, TYMED_HGLOBAL} },
1718  { "DataObject_GetData", 0, { CF_BITMAP, NULL, DVASPECT_THUMBNAIL, -1, TYMED_GDI} },
1719  { "DataObject_GetData", 0, { CF_METAFILEPICT, NULL, DVASPECT_ICON, -1, TYMED_MFPICT} },
1720  { NULL, 0 }
1721  };
1722  static const struct expected_method methods_cachethenrun[] =
1723  {
1724  { "DataObject_DAdvise", 0 },
1725  { "DataObject_DAdvise", 0 },
1726  { "DataObject_DAdvise", 0 },
1727  { "DataObject_DAdvise", 0 },
1728  { "DataObject_DUnadvise", 0 },
1729  { "DataObject_DUnadvise", 0 },
1730  { "DataObject_DUnadvise", 0 },
1731  { "DataObject_DUnadvise", 0 },
1732  { NULL, 0 }
1733  };
1734 
1735  GetSystemDirectoryA(szSystemDir, sizeof(szSystemDir)/sizeof(szSystemDir[0]));
1736 
1737  expected_method_list = methods_cacheinitnew;
1738 
1739  fmtetc.cfFormat = CF_METAFILEPICT;
1740  fmtetc.dwAspect = DVASPECT_ICON;
1741  fmtetc.lindex = -1;
1742  fmtetc.ptd = NULL;
1743  fmtetc.tymed = TYMED_MFPICT;
1744 
1746  ok_ole_success(hr, "StgCreateDocfile");
1747 
1748  /* aggregation */
1749 
1750  /* requested is not IUnknown */
1751  hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IOleCache2, (void**)&pOleCache);
1752  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1753 
1754  hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
1755  ok(hr == S_OK, "got 0x%08x\n", hr);
1756 
1757  hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
1758  ok(hr == S_OK, "got 0x%08x\n", hr);
1759  hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
1760  ok(hr == S_OK, "got 0x%08x\n", hr);
1761  ok(unk != (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
1762  ok(unk != (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
1763  IOleCache2_Release(pOleCache);
1764  IOleCache_Release(olecache);
1765  IUnknown_Release(unk);
1766 
1767  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
1768  ok(hr == S_OK, "got 0x%08x\n", hr);
1769  hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
1770  ok(hr == S_OK, "got 0x%08x\n", hr);
1771  hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
1772  ok(hr == S_OK, "got 0x%08x\n", hr);
1773  hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void**)&unk2);
1774  ok(hr == S_OK, "got 0x%08x\n", hr);
1775  ok(unk == (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
1776  ok(unk == (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
1777  ok(unk == unk2, "got %p, expected %p\n", unk2, unk);
1778  IUnknown_Release(unk2);
1779  IOleCache2_Release(pOleCache);
1780  IOleCache_Release(olecache);
1781  IUnknown_Release(unk);
1782 
1783  /* Test with new data */
1784 
1785  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1786  ok_ole_success(hr, "CreateDataCache");
1787 
1788  hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1789  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1790  hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1791  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1792  hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
1793  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
1794 
1795  hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1796  ok_ole_success(hr, "IViewObject_SetAdvise");
1797 
1798  hr = IPersistStorage_InitNew(pPS, pStorage);
1799  ok_ole_success(hr, "IPersistStorage_InitNew");
1800 
1801  hr = IPersistStorage_IsDirty(pPS);
1802  ok_ole_success(hr, "IPersistStorage_IsDirty");
1803 
1804  hr = IPersistStorage_GetClassID(pPS, &clsid);
1805  ok_ole_success(hr, "IPersistStorage_GetClassID");
1806  ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
1807 
1808  hr = IOleCache2_Uncache(pOleCache, 0xdeadbeef);
1809  ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
1810 
1811  /* Both tests crash on NT4 and below. StgCreatePropSetStg is only available on w2k and above. */
1812  if (GetProcAddress(GetModuleHandleA("ole32.dll"), "StgCreatePropSetStg"))
1813  {
1814  hr = IOleCache2_Cache(pOleCache, NULL, 0, &dwConnection);
1815  ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1816 
1817  hr = IOleCache2_Cache(pOleCache, NULL, 0, NULL);
1818  ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1819  }
1820  else
1821  {
1822  skip("tests with NULL parameters will crash on NT4 and below\n");
1823  }
1824 
1825  for (fmtetc.cfFormat = CF_TEXT; fmtetc.cfFormat < CF_MAX; fmtetc.cfFormat++)
1826  {
1827  int i;
1828  fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1829  for (i = 0; i < 7; i++)
1830  {
1831  fmtetc.tymed = 1 << i;
1832  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1833  if ((fmtetc.cfFormat == CF_METAFILEPICT && fmtetc.tymed == TYMED_MFPICT) ||
1834  (fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
1835  (fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
1836  (fmtetc.cfFormat == CF_ENHMETAFILE && fmtetc.tymed == TYMED_ENHMF))
1837  ok(hr == S_OK, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned S_OK instead of 0x%08x\n",
1838  fmtetc.cfFormat, fmtetc.tymed, hr);
1839  else if (fmtetc.tymed == TYMED_HGLOBAL)
1841  broken(hr == S_OK && fmtetc.cfFormat == CF_BITMAP) /* Win9x & NT4 */,
1842  "IOleCache_Cache cfFormat = %d, tymed = %d should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08x\n",
1843  fmtetc.cfFormat, fmtetc.tymed, hr);
1844  else
1845  ok(hr == DV_E_TYMED, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned DV_E_TYMED instead of 0x%08x\n",
1846  fmtetc.cfFormat, fmtetc.tymed, hr);
1847  if (SUCCEEDED(hr))
1848  {
1849  hr = IOleCache2_Uncache(pOleCache, dwConnection);
1850  ok_ole_success(hr, "IOleCache_Uncache");
1851  }
1852  }
1853  }
1854 
1855  fmtetc.cfFormat = CF_BITMAP;
1856  fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1857  fmtetc.tymed = TYMED_GDI;
1858  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1859  ok_ole_success(hr, "IOleCache_Cache");
1860 
1861  fmtetc.cfFormat = 0;
1862  fmtetc.dwAspect = DVASPECT_ICON;
1863  fmtetc.tymed = TYMED_MFPICT;
1864  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1865  ok_ole_success(hr, "IOleCache_Cache");
1866 
1867  MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, sizeof(wszPath)/sizeof(wszPath[0]));
1868  memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32));
1869 
1870  fmtetc.cfFormat = CF_METAFILEPICT;
1871  stgmedium.tymed = TYMED_MFPICT;
1872  U(stgmedium).hMetaFilePict = OleMetafilePictFromIconAndLabel(
1873  LoadIconA(NULL, (LPSTR)IDI_APPLICATION), wszPath, wszPath, 0);
1874  stgmedium.pUnkForRelease = NULL;
1875 
1876  fmtetc.dwAspect = DVASPECT_CONTENT;
1877  hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1878  ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
1879 
1880  fmtetc.dwAspect = DVASPECT_ICON;
1881  hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1882  ok_ole_success(hr, "IOleCache_SetData");
1883  ReleaseStgMedium(&stgmedium);
1884 
1885  hr = IViewObject_Freeze(pViewObject, DVASPECT_ICON, -1, NULL, &dwFreeze);
1886  todo_wine {
1887  ok_ole_success(hr, "IViewObject_Freeze");
1888  hr = IViewObject_Freeze(pViewObject, DVASPECT_CONTENT, -1, NULL, &dwFreeze);
1889  ok(hr == OLE_E_BLANK, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1890  }
1891 
1892  rcBounds.left = 0;
1893  rcBounds.top = 0;
1894  rcBounds.right = 100;
1895  rcBounds.bottom = 100;
1896  hdcMem = CreateCompatibleDC(NULL);
1897 
1898  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1899  ok_ole_success(hr, "IViewObject_Draw");
1900 
1901  hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1902  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1903 
1904  /* a NULL draw_continue fn ptr */
1905  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef);
1906  ok_ole_success(hr, "IViewObject_Draw");
1907 
1908  /* draw_continue that returns FALSE to abort drawing */
1909  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef);
1910  ok(hr == E_ABORT ||
1911  broken(hr == S_OK), /* win9x may skip the callbacks */
1912  "IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr);
1913 
1914  DeleteDC(hdcMem);
1915 
1916  hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);
1917  ok_ole_success(hr, "IOleCacheControl_OnRun");
1918 
1919  hr = IPersistStorage_Save(pPS, pStorage, TRUE);
1920  ok_ole_success(hr, "IPersistStorage_Save");
1921 
1922  hr = IPersistStorage_SaveCompleted(pPS, NULL);
1923  ok_ole_success(hr, "IPersistStorage_SaveCompleted");
1924 
1925  hr = IPersistStorage_IsDirty(pPS);
1926  ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1927 
1928  IPersistStorage_Release(pPS);
1929  IViewObject_Release(pViewObject);
1930  IOleCache2_Release(pOleCache);
1931  IOleCacheControl_Release(pOleCacheControl);
1932 
1934 
1935  /* Test with loaded data */
1936  trace("Testing loaded data with CreateDataCache:\n");
1937  expected_method_list = methods_cacheload;
1938 
1939  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1940  ok_ole_success(hr, "CreateDataCache");
1941 
1942  hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1943  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1944  hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1945  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1946 
1947  hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1948  ok_ole_success(hr, "IViewObject_SetAdvise");
1949 
1950  hr = IPersistStorage_Load(pPS, pStorage);
1951  ok_ole_success(hr, "IPersistStorage_Load");
1952 
1953  hr = IPersistStorage_IsDirty(pPS);
1954  ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1955 
1956  fmtetc.cfFormat = 0;
1957  fmtetc.dwAspect = DVASPECT_ICON;
1958  fmtetc.lindex = -1;
1959  fmtetc.ptd = NULL;
1960  fmtetc.tymed = TYMED_MFPICT;
1961  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1962  ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
1963 
1964  rcBounds.left = 0;
1965  rcBounds.top = 0;
1966  rcBounds.right = 100;
1967  rcBounds.bottom = 100;
1968  hdcMem = CreateCompatibleDC(NULL);
1969 
1970  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1971  ok_ole_success(hr, "IViewObject_Draw");
1972 
1973  hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1974  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1975 
1976  /* unload the cached storage object, causing it to be reloaded */
1977  hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
1978  ok_ole_success(hr, "IOleCache2_DiscardCache");
1979  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1980  ok_ole_success(hr, "IViewObject_Draw");
1981 
1982  /* unload the cached storage object, but don't allow it to be reloaded */
1983  hr = IPersistStorage_HandsOffStorage(pPS);
1984  ok_ole_success(hr, "IPersistStorage_HandsOffStorage");
1985  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1986  ok_ole_success(hr, "IViewObject_Draw");
1987  hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
1988  ok_ole_success(hr, "IOleCache2_DiscardCache");
1989  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1990  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1991 
1992  DeleteDC(hdcMem);
1993 
1994  hr = IOleCache2_InitCache(pOleCache, &DataObject);
1995  ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
1996 
1997  IPersistStorage_Release(pPS);
1998  IViewObject_Release(pViewObject);
1999  IOleCache2_Release(pOleCache);
2000 
2002 
2003  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
2004  ok_ole_success(hr, "CreateDataCache");
2005 
2006  expected_method_list = methods_cachethenrun;
2007 
2008  hr = IOleCache2_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
2009  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IDataObject)");
2010  hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
2011  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
2012 
2013  fmtetc.cfFormat = CF_METAFILEPICT;
2014  fmtetc.dwAspect = DVASPECT_CONTENT;
2015  fmtetc.tymed = TYMED_MFPICT;
2016 
2017  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
2018  ok_ole_success(hr, "IOleCache_Cache");
2019 
2020  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2021  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2022 
2023  fmtetc.cfFormat = cf_test_1;
2024  fmtetc.dwAspect = DVASPECT_CONTENT;
2025  fmtetc.tymed = TYMED_HGLOBAL;
2026 
2027  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
2028  ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
2029 
2030  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2031  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2032 
2033  fmtetc.cfFormat = cf_test_2;
2034  hr = IOleCache2_Cache(pOleCache, &fmtetc, ADVF_PRIMEFIRST, &dwConnection);
2035  ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
2036 
2037  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2038  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2039 
2040  hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);
2041  ok_ole_success(hr, "IOleCacheControl_OnRun");
2042 
2043  fmtetc.cfFormat = cf_test_3;
2044  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
2045  ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
2046 
2047  fmtetc.cfFormat = cf_test_1;
2048  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2049  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2050 
2051  fmtetc.cfFormat = cf_test_2;
2052  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2053  ok(hr == S_OK, "got %08x\n", hr);
2054  ReleaseStgMedium(&stgmedium);
2055 
2056  fmtetc.cfFormat = cf_test_3;
2057  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2058  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2059 
2060  IOleCacheControl_Release(pOleCacheControl);
2061  IDataObject_Release(pCacheDataObject);
2062  IOleCache2_Release(pOleCache);
2063 
2065 
2066  IStorage_Release(pStorage);
2067 }
#define HDC
Definition: msvc.h:22
#define ok_ole_success(hr, func)
Definition: ole2.c:42
#define trace(...)
Definition: kmt_test.h:217
#define TRUE
Definition: types.h:120
const GUID IID_IViewObject
const GUID IID_IUnknown
#define CF_ENHMETAFILE
Definition: constants.h:409
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2024
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CP_ACP
Definition: compat.h:99
static BOOL STDMETHODCALLTYPE draw_continue(ULONG_PTR param)
Definition: ole2.c:1358
const GUID IID_IOleCacheControl
#define U(x)
Definition: wordpad.c:44
#define STGM_CREATE
Definition: objbase.h:925
static IDataObject DataObject
Definition: ole2.c:1611
UINT WINAPI GetSystemDirectoryA(OUT LPSTR lpBuffer, IN UINT uSize)
Definition: path.c:2282
long bottom
Definition: polytest.cpp:53
static IAdviseSink AdviseSink
Definition: ole2.c:1438
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
const GUID IID_IDataObject
#define IDI_APPLICATION
Definition: winuser.h:699
const GUID IID_IPersistStorage
#define CF_METAFILEPICT
Definition: constants.h:398
char * LPSTR
Definition: xmlstorage.h:182
#define CF_MAX
Definition: constants.h:412
#define lstrlenW
Definition: compat.h:407
DWORD DWORD
Definition: winlogon.h:84
HICON WINAPI LoadIconA(_In_opt_ HINSTANCE, _In_ LPCSTR)
Definition: cursoricon.c:2029
long right
Definition: polytest.cpp:53
#define OLE_E_NOCONNECTION
Definition: winerror.h:2618
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FALSE
Definition: types.h:117
long top
Definition: polytest.cpp:53
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
static UINT cf_test_3
Definition: ole2.c:126
long left
Definition: polytest.cpp:53
#define CF_TEXT
Definition: constants.h:396
#define ok(value,...)
Definition: CComObject.cpp:34
#define CLSID_NULL
Definition: guiddef.h:94
static BOOL STDMETHODCALLTYPE draw_continue_false(ULONG_PTR param)
Definition: ole2.c:1364
LONG HRESULT
Definition: typedefs.h:77
#define MAX_PATH
Definition: compat.h:26
#define DV_E_TYMED
Definition: winerror.h:2638
REFCLSID clsid
Definition: msctf.c:84
#define IID_NULL
Definition: guiddef.h:93
#define todo_wine
Definition: test.h:154
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HRESULT WINAPI StgCreateDocfile(LPCOLESTR pwcsName, DWORD grfMode, DWORD reserved, IStorage **ppstgOpen)
Definition: storage32.c:8637
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:819
#define E_ABORT
Definition: winerror.h:2366
#define STGM_READWRITE
Definition: objbase.h:918
#define broken(x)
Definition: _sntprintf.h:21
HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
Definition: datacache.c:3036
static const struct expected_method * expected_method_list
Definition: ole2.c:118
const GUID IID_IOleCache2
#define S_OK
Definition: intsafe.h:59
#define CACHE_S_SAMECACHE
Definition: winerror.h:2707
#define CACHE_E_NOCACHE_UPDATED
Definition: winerror.h:2712
BOOL WINAPI DeleteDC(_In_ HDC)
#define CACHE_S_FORMATETC_NOTSUPPORTED
Definition: winerror.h:2706
#define OLE_E_BLANK
Definition: winerror.h:2621
#define skip(...)
Definition: CString.cpp:57
#define MultiByteToWideChar
Definition: compat.h:100
static IUnknown unknown
Definition: ole2.c:1642
static UINT cf_test_1
Definition: ole2.c:126
#define GetProcAddress(x, y)
Definition: compat.h:410
static UINT cf_test_2
Definition: ole2.c:126
HGLOBAL WINAPI OleMetafilePictFromIconAndLabel(HICON hIcon, LPOLESTR lpszLabel, LPOLESTR lpszSourceFile, UINT iIconIndex)
Definition: ole32_main.c:43
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
HDC hdcMem
Definition: welcome.c:104
const GUID IID_IOleCache
#define SUCCEEDED(hr)
Definition: intsafe.h:57
#define CHECK_NO_EXTRA_METHODS()
Definition: ole2.c:199
#define CF_DIB
Definition: constants.h:403
static void test_data_cache_cache ( void  )
static

Definition at line 2217 of file ole2.c.

Referenced by START_TEST().

2218 {
2219  HRESULT hr;
2220  IOleCache2 *cache;
2221  IDataObject *data;
2222  FORMATETC fmt;
2223  DWORD conn;
2224  STGMEDIUM med;
2225  STATDATA expect[] =
2226  {
2227  {{ CF_DIB, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }, 0, NULL, 0 },
2228  {{ CF_BITMAP, 0, DVASPECT_CONTENT, -1, TYMED_GDI }, 0, NULL, 0 },
2229  {{ CF_METAFILEPICT, 0, DVASPECT_CONTENT, -1, TYMED_MFPICT }, 0, NULL, 0 },
2230  {{ CF_ENHMETAFILE, 0, DVASPECT_CONTENT, -1, TYMED_ENHMF }, 0, NULL, 0 }
2231  };
2232  STATDATA view_caching[] =
2233  {
2234  {{ 0, 0, DVASPECT_CONTENT, -1, TYMED_ENHMF }, 0, NULL, 0 },
2235  {{ 0, 0, DVASPECT_THUMBNAIL, -1, TYMED_HGLOBAL }, 0, NULL, 0 },
2236  {{ 0, 0, DVASPECT_DOCPRINT, -1, TYMED_HGLOBAL }, 0, NULL, 0 },
2237  {{ CF_METAFILEPICT, 0, DVASPECT_ICON, -1, TYMED_MFPICT }, 0, NULL, 0 }
2238  };
2239 
2240  hr = CreateDataCache( NULL, &CLSID_NULL, &IID_IOleCache2, (void **)&cache );
2241  ok( hr == S_OK, "got %08x\n", hr );
2242 
2243  /* create a dib entry which will also create a bitmap entry too */
2244  fmt.cfFormat = CF_DIB;
2245  fmt.ptd = NULL;
2246  fmt.dwAspect = DVASPECT_CONTENT;
2247  fmt.lindex = -1;
2248  fmt.tymed = TYMED_HGLOBAL;
2249 
2250  hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
2251  ok( hr == S_OK, "got %08x\n", hr );
2252  ok( conn == 2, "got %d\n", conn );
2253  expect[0].dwConnection = conn;
2254  expect[1].dwConnection = conn;
2255 
2256  check_enum_cache( cache, expect, 2 );
2257 
2258  /* now try to add a bitmap */
2259  fmt.cfFormat = CF_BITMAP;
2260  fmt.tymed = TYMED_GDI;
2261 
2262  hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
2263  ok( hr == CACHE_S_SAMECACHE, "got %08x\n", hr );
2264 
2265  /* metafile */
2266  fmt.cfFormat = CF_METAFILEPICT;
2267  fmt.tymed = TYMED_MFPICT;
2268 
2269  hr = IOleCache2_Cache( cache, &fmt, 0, &conn );
2270  ok( hr == S_OK,