ReactOS  0.4.14-dev-49-gfb4591c
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 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_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 void create_text (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)
 
static void test_OleCreateStaticFromData (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_methodexpected_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

◆ CHECK_CALLED

#define CHECK_CALLED (   func)
Value:
do { \
ok(called_ ## func, "expected " #func "\n"); \
expect_ ## func = called_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 56 of file ole2.c.

◆ CHECK_EXPECT

#define CHECK_EXPECT (   func)
Value:
do { \
CHECK_EXPECT2(func); \
expect_ ## func = FALSE; \
}while(0)
GLenum func
Definition: glext.h:6028

Definition at line 50 of file ole2.c.

◆ CHECK_EXPECT2

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

Definition at line 44 of file ole2.c.

◆ CHECK_EXPECTED_METHOD

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

Definition at line 190 of file ole2.c.

◆ CHECK_EXPECTED_METHOD_FMT

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

Definition at line 191 of file ole2.c.

◆ CHECK_NO_EXTRA_METHODS

#define CHECK_NO_EXTRA_METHODS ( )
Value:
do { \
expected_method_list++; \
ok(!expected_method_list->method, "Method sequence starting from %s not called\n", expected_method_list->method); \
} while (0)
#define TEST_OPTIONAL
Definition: ole2.c:102
static const struct expected_method * expected_method_list
Definition: ole2.c:112

Definition at line 193 of file ole2.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file ole2.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 23 of file ole2.c.

◆ DEFINE_EXPECT

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

Definition at line 38 of file ole2.c.

◆ MAX_FMTS

#define MAX_FMTS   5

Definition at line 4342 of file ole2.c.

◆ MAX_STREAM

#define MAX_STREAM   16

Definition at line 3835 of file ole2.c.

◆ ok_ole_success

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

Definition at line 36 of file ole2.c.

◆ SET_EXPECT

#define SET_EXPECT (   func)    expect_ ## func = TRUE

Definition at line 41 of file ole2.c.

◆ TEST_OPTIONAL

#define TEST_OPTIONAL   0x1

Definition at line 102 of file ole2.c.

◆ TEST_TODO

#define TEST_TODO   0x2

Definition at line 103 of file ole2.c.

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

Definition at line 24 of file ole2.c.

Typedef Documentation

◆ PresentationDataHeader

Function Documentation

◆ AdviseSink_AddRef()

static ULONG WINAPI AdviseSink_AddRef ( IAdviseSink iface)
static

Definition at line 1391 of file ole2.c.

1392 {
1393  return 2;
1394 }

◆ AdviseSink_OnClose()

static void WINAPI AdviseSink_OnClose ( IAdviseSink iface)
static

Definition at line 1430 of file ole2.c.

1431 {
1432  CHECK_EXPECTED_METHOD("AdviseSink_OnClose");
1433 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ AdviseSink_OnDataChange()

static void WINAPI AdviseSink_OnDataChange ( IAdviseSink iface,
FORMATETC *  pFormatetc,
STGMEDIUM *  pStgmed 
)
static

Definition at line 1402 of file ole2.c.

1406 {
1407  CHECK_EXPECTED_METHOD("AdviseSink_OnDataChange");
1408 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ AdviseSink_OnRename()

static void WINAPI AdviseSink_OnRename ( IAdviseSink iface,
IMoniker pmk 
)
static

Definition at line 1418 of file ole2.c.

1421 {
1422  CHECK_EXPECTED_METHOD("AdviseSink_OnRename");
1423 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ AdviseSink_OnSave()

static void WINAPI AdviseSink_OnSave ( IAdviseSink iface)
static

Definition at line 1425 of file ole2.c.

1426 {
1427  CHECK_EXPECTED_METHOD("AdviseSink_OnSave");
1428 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ AdviseSink_OnViewChange()

static void WINAPI AdviseSink_OnViewChange ( IAdviseSink iface,
DWORD  dwAspect,
LONG  lindex 
)
static

Definition at line 1410 of file ole2.c.

1414 {
1415  CHECK_EXPECTED_METHOD("AdviseSink_OnViewChange");
1416 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ AdviseSink_QueryInterface()

static HRESULT WINAPI AdviseSink_QueryInterface ( IAdviseSink iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1379 of file ole2.c.

1380 {
1382  {
1383  *ppv = iface;
1384  IAdviseSink_AddRef(iface);
1385  return S_OK;
1386  }
1387  *ppv = NULL;
1388  return E_NOINTERFACE;
1389 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IAdviseSink
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ AdviseSink_Release()

static ULONG WINAPI AdviseSink_Release ( IAdviseSink iface)
static

Definition at line 1396 of file ole2.c.

1397 {
1398  return 1;
1399 }

◆ check_bitmap_size()

static void check_bitmap_size ( HBITMAP  h,
int  cx,
int  cy 
)
static

Definition at line 2213 of file ole2.c.

2214 {
2215  BITMAP bm;
2216 
2217  GetObjectW( h, sizeof(bm), &bm );
2218  ok( bm.bmWidth == cx, "got %d expect %d\n", bm.bmWidth, cx );
2219  ok( bm.bmHeight == cy, "got %d expect %d\n", bm.bmHeight, cy );
2220 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define ok(value,...)
Definition: atltest.h:57
Definition: bl.h:1331
_Out_opt_ int * cx
Definition: commctrl.h:570

Referenced by test_data_cache_cache().

◆ check_dib_size()

static void check_dib_size ( HGLOBAL  h,
int  cx,
int  cy 
)
static

Definition at line 2222 of file ole2.c.

2223 {
2224  BITMAPINFO *info;
2225 
2226  info = GlobalLock( h );
2227  ok( info->bmiHeader.biWidth == cx, "got %d expect %d\n", info->bmiHeader.biWidth, cx );
2228  ok( info->bmiHeader.biHeight == cy, "got %d expect %d\n", info->bmiHeader.biHeight, cy );
2229  GlobalUnlock( h );
2230 }
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
struct _test_info info[]
Definition: SetCursorPos.c:19
_Out_opt_ int _Out_opt_ int * cy
Definition: commctrl.h:570
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define ok(value,...)
Definition: atltest.h:57
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
_Out_opt_ int * cx
Definition: commctrl.h:570

Referenced by test_data_cache_cache().

◆ check_enum_cache()

static void check_enum_cache ( IOleCache2 cache,
const STATDATA *  expect,
int  num 
)
static

Definition at line 1659 of file ole2.c.

1660 {
1661  IEnumSTATDATA *enum_stat;
1662  STATDATA stat;
1663  HRESULT hr;
1664 
1665  hr = IOleCache2_EnumCache( cache, &enum_stat );
1666  ok( hr == S_OK, "got %08x\n", hr );
1667 
1668  while (IEnumSTATDATA_Next(enum_stat, 1, &stat, NULL) == S_OK)
1669  {
1670  ok( stat.formatetc.cfFormat == expect->formatetc.cfFormat, "got %d expect %d\n",
1671  stat.formatetc.cfFormat, expect->formatetc.cfFormat );
1672  ok( !stat.formatetc.ptd == !expect->formatetc.ptd, "got %p expect %p\n",
1673  stat.formatetc.ptd, expect->formatetc.ptd );
1674  ok( stat.formatetc.dwAspect == expect->formatetc.dwAspect, "got %d expect %d\n",
1675  stat.formatetc.dwAspect, expect->formatetc.dwAspect );
1676  ok( stat.formatetc.lindex == expect->formatetc.lindex, "got %d expect %d\n",
1677  stat.formatetc.lindex, expect->formatetc.lindex );
1678  ok( stat.formatetc.tymed == expect->formatetc.tymed, "got %d expect %d\n",
1679  stat.formatetc.tymed, expect->formatetc.tymed );
1680  ok( stat.advf == expect->advf, "got %d expect %d\n", stat.advf, expect->advf );
1681  ok( stat.pAdvSink == 0, "got %p\n", stat.pAdvSink );
1682  ok( stat.dwConnection == expect->dwConnection, "got %d expect %d\n", stat.dwConnection, expect->dwConnection );
1683  num--;
1684  expect++;
1685  }
1686 
1687  ok( num == 0, "incorrect number. num %d\n", num );
1688 
1689  IEnumSTATDATA_Release( enum_stat );
1690 }
Definition: cache.c:46
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
GLuint GLuint num
Definition: glext.h:9618
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define expect(expected, got)
Definition: combo.c:36

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().

◆ check_expected_method_fmt()

static void check_expected_method_fmt ( const char method_name,
const FORMATETC *  fmt 
)
inlinestatic

Definition at line 154 of file ole2.c.

156 {
157  trace("%s\n", method_name);
158  ok(expected_method_list->method != NULL, "Extra method %s called\n", method_name);
159  if (!strcmp(expected_method_list->method, "WINE_EXTRA"))
160  {
161  todo_wine ok(0, "Too many method calls.\n");
162  return;
163  }
164  if (expected_method_list->method)
165  {
166  while (expected_method_list->flags & TEST_OPTIONAL &&
167  strcmp(expected_method_list->method, method_name) != 0)
170  {
171  ok(!strcmp(expected_method_list->method, method_name),
172  "Expected %s to be called instead of %s\n",
173  expected_method_list->method, method_name);
174  if (fmt)
175  {
176  ok(fmt->cfFormat == expected_method_list->fmt.cfFormat, "got cf %04x vs %04x\n",
177  fmt->cfFormat, expected_method_list->fmt.cfFormat );
178  ok(fmt->dwAspect == expected_method_list->fmt.dwAspect, "got aspect %d vs %d\n",
179  fmt->dwAspect, expected_method_list->fmt.dwAspect );
180  ok(fmt->lindex == expected_method_list->fmt.lindex, "got lindex %d vs %d\n",
181  fmt->lindex, expected_method_list->fmt.lindex );
182  ok(fmt->tymed == expected_method_list->fmt.tymed, "got tymed %d vs %d\n",
183  fmt->tymed, expected_method_list->fmt.tymed );
184  }
185  }
187  }
188 }
#define TEST_TODO
Definition: ole2.c:103
smooth NULL
Definition: ftsmooth.c:416
#define todo_wine_if(is_todo)
Definition: test.h:155
#define trace
Definition: atltest.h:70
#define todo_wine
Definition: test.h:154
#define TEST_OPTIONAL
Definition: ole2.c:102
static const struct expected_method * expected_method_list
Definition: ole2.c:112
#define ok(value,...)
Definition: atltest.h:57
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: dsound.c:943

◆ check_storage_contents()

static void check_storage_contents ( IStorage stg,
const struct storage_def stg_def,
int enumerated_streams,
int matched_streams 
)
static

Definition at line 3994 of file ole2.c.

3996 {
3997  HRESULT hr;
3998  IEnumSTATSTG *enumstg;
3999  IStream *stream;
4000  STATSTG stat;
4001  int i, seen_stream[MAX_STREAM] = { 0 };
4002 
4003  if (winetest_debug > 1)
4004  trace("check_storage_contents:\n=============================================\n");
4005 
4006  *enumerated_streams = 0;
4007  *matched_streams = 0;
4008 
4009  hr = IStorage_Stat(stg, &stat, STATFLAG_NONAME);
4010  ok(hr == S_OK, "unexpected %#x\n", hr);
4011  ok(IsEqualCLSID(stg_def->clsid, &stat.clsid), "expected %s, got %s\n",
4012  wine_dbgstr_guid(stg_def->clsid), wine_dbgstr_guid(&stat.clsid));
4013 
4014  hr = IStorage_EnumElements(stg, 0, NULL, 0, &enumstg);
4015  ok(hr == S_OK, "unexpected %#x\n", hr);
4016 
4017  for (;;)
4018  {
4019  ULONG bytes;
4020  int clipformat = -1;
4022  char name[32];
4023  BYTE data[1024];
4024 
4025  memset(&header, 0, sizeof(header));
4026 
4027  hr = IEnumSTATSTG_Next(enumstg, 1, &stat, NULL);
4028  if(hr == S_FALSE) break;
4029  ok(hr == S_OK, "unexpected %#x\n", hr);
4030 
4031  if (winetest_debug > 1)
4032  trace("name %s, type %u, size %d, clsid %s\n",
4033  wine_dbgstr_w(stat.pwcsName), stat.type, stat.cbSize.u.LowPart, wine_dbgstr_guid(&stat.clsid));
4034 
4035  ok(stat.type == STGTY_STREAM, "unexpected %#x\n", stat.type);
4036 
4037  WideCharToMultiByte(CP_ACP, 0, stat.pwcsName, -1, name, sizeof(name), NULL, NULL);
4038 
4039  hr = IStorage_OpenStream(stg, stat.pwcsName, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
4040  ok(hr == S_OK, "unexpected %#x\n", hr);
4041 
4042  if (!memcmp(name, "\2OlePres", 8))
4043  {
4044  ULONG header_size = sizeof(header);
4045 
4046  clipformat = read_clipformat(stream);
4047 
4048  if (clipformat == 0) /* view cache */
4049  header_size = FIELD_OFFSET(PresentationDataHeader, unknown7);
4050 
4051  hr = IStream_Read(stream, &header, header_size, &bytes);
4052  ok(hr == S_OK, "unexpected %#x\n", hr);
4053  ok(bytes == header_size, "read %u bytes, expected %u\n", bytes, header_size);
4054 
4055  if (winetest_debug > 1)
4056  trace("header: tdSize %#x, dvAspect %#x, lindex %#x, advf %#x, unknown7 %#x, dwObjectExtentX %#x, dwObjectExtentY %#x, dwSize %#x\n",
4057  header.tdSize, header.dvAspect, header.lindex, header.advf, header.unknown7,
4058  header.dwObjectExtentX, header.dwObjectExtentY, header.dwSize);
4059  }
4060 
4061  memset(data, 0, sizeof(data));
4062  hr = IStream_Read(stream, data, sizeof(data), &bytes);
4063  ok(hr == S_OK, "unexpected %#x\n", hr);
4064  if (winetest_debug > 1)
4065  trace("stream data (%u bytes): %02x %02x %02x %02x\n", bytes, data[0], data[1], data[2], data[3]);
4066 
4067  for (i = 0; i < stg_def->stream_count; i++)
4068  {
4069  if (seen_stream[i]) continue;
4070 
4071  if (winetest_debug > 1)
4072  trace("%s/%s, %d/%d, %d/%d, %d/%d\n",
4073  stg_def->stream[i].name, name,
4074  stg_def->stream[i].cf, clipformat,
4075  stg_def->stream[i].dvAspect, header.dvAspect,
4076  stg_def->stream[i].advf, header.advf);
4077 
4078  if (!strcmp(stg_def->stream[i].name, name) &&
4079  stg_def->stream[i].cf == clipformat &&
4080  stg_def->stream[i].dvAspect == header.dvAspect &&
4081  stg_def->stream[i].advf == header.advf &&
4082  stg_def->stream[i].data_size <= bytes &&
4083  (!stg_def->stream[i].data_size ||
4084  (!memcmp(stg_def->stream[i].data, data, min(stg_def->stream[i].data_size, bytes)))))
4085  {
4086  if (winetest_debug > 1)
4087  trace("stream %d matches def stream %d\n", *enumerated_streams, i);
4088  seen_stream[i] = 1;
4089  *matched_streams += 1;
4090  }
4091  }
4092 
4093  CoTaskMemFree(stat.pwcsName);
4094  IStream_Release(stream);
4095 
4096  *enumerated_streams += 1;
4097  }
4098 
4099  IEnumSTATSTG_Release(enumstg);
4100 }
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
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
const CLSID * clsid
Definition: ole2.c:3849
#define CP_ACP
Definition: compat.h:99
int stream_count
Definition: ole2.c:3850
const char * wine_dbgstr_guid(const GUID *guid)
#define MAX_STREAM
Definition: ole2.c:3835
int winetest_debug
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define trace
Definition: atltest.h:70
LONG HRESULT
Definition: typedefs.h:77
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
Definition: stat.h:55
unsigned char BYTE
Definition: mem.h:68
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
static int read_clipformat(IStream *stream)
Definition: ole2.c:3971
#define min(a, b)
Definition: monoChain.cc:55
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3851
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:96
struct CFHEADER header
Definition: fdi.c:109

Referenced by test_data_cache_contents(), test_data_cache_save_data(), and test_OleCreateStaticFromData().

◆ create_bitmap()

static void create_bitmap ( STGMEDIUM *  med)
static

Definition at line 223 of file ole2.c.

224 {
225  med->tymed = TYMED_GDI;
226  U(med)->hBitmap = CreateBitmap( 1, 1, 1, 1, NULL );
227  med->pUnkForRelease = NULL;
228 }
#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)

Referenced by DataObject_GetData(), and test_data_cache_cache().

◆ create_dib()

static void create_dib ( STGMEDIUM *  med)
static

Definition at line 211 of file ole2.c.

212 {
213  void *ptr;
214 
215  med->tymed = TYMED_HGLOBAL;
216  U(med)->hGlobal = GlobalAlloc( GMEM_MOVEABLE, sizeof(dib) );
217  ptr = GlobalLock( U(med)->hGlobal );
218  memcpy( ptr, dib, sizeof(dib) );
219  GlobalUnlock( U(med)->hGlobal );
220  med->pUnkForRelease = NULL;
221 }
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:201
#define GMEM_MOVEABLE
Definition: winbase.h:291

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

◆ create_emf()

static void create_emf ( STGMEDIUM *  med)
static

Definition at line 230 of file ole2.c.

231 {
233 
234  Rectangle(hdc, 0, 0, 150, 300);
235  med->tymed = TYMED_ENHMF;
236  U(med)->hEnhMetaFile = CloseEnhMetaFile(hdc);
237  med->pUnkForRelease = NULL;
238 }
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
#define U(x)
Definition: wordpad.c:44
static HDC
Definition: imagelist.c:92
HDC WINAPI CreateEnhMetaFileW(_In_opt_ HDC, _In_opt_ LPCWSTR, _In_opt_ LPCRECT, _In_opt_ LPCWSTR)
smooth NULL
Definition: ftsmooth.c:416
HENHMETAFILE WINAPI CloseEnhMetaFile(_In_ HDC hdc)
HDC hdc
Definition: main.c:9

Referenced by DataObject_GetData(), and get_stgmedium().

◆ create_mfpict()

static void create_mfpict ( STGMEDIUM *  med)
static

Definition at line 240 of file ole2.c.

241 {
242  METAFILEPICT *mf;
244 
245  Rectangle(hdc, 0, 0, 100, 200);
246 
247  med->tymed = TYMED_MFPICT;
248  U(med)->hMetaFilePict = GlobalAlloc(GMEM_MOVEABLE, sizeof(METAFILEPICT));
249  mf = GlobalLock(U(med)->hMetaFilePict);
250  mf->mm = MM_ANISOTROPIC;
251  mf->xExt = 100;
252  mf->yExt = 200;
253  mf->hMF = CloseMetaFile(hdc);
254  GlobalUnlock(U(med)->hMetaFilePict);
255  med->pUnkForRelease = NULL;
256 }
HMETAFILE hMF
Definition: wingdi.h:2603
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)
static HDC
Definition: imagelist.c:92
smooth NULL
Definition: ftsmooth.c:416
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by get_stgmedium().

◆ create_storage()

static IStorage* create_storage ( int  num)
static

Definition at line 2099 of file ole2.c.

2100 {
2101  IStorage *stg;
2102  IStream *stm;
2103  HRESULT hr;
2104  ULONG written;
2105 
2107  ok( hr == S_OK, "got %08x\n", hr);
2108  hr = IStorage_SetClass( stg, &CLSID_Picture_Dib );
2109  ok( hr == S_OK, "got %08x\n", hr);
2110  hr = IStorage_CreateStream( stg, CONTENTS, STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE, 0, 0, &stm );
2111  ok( hr == S_OK, "got %08x\n", hr);
2112  if (num == 1) /* Set biXPelsPerMeter = 0 */
2113  {
2114  file_dib[0x26] = 0;
2115  file_dib[0x27] = 0;
2116  }
2117  hr = IStream_Write( stm, file_dib, sizeof(file_dib), &written );
2118  ok( hr == S_OK, "got %08x\n", hr);
2119  IStream_Release( stm );
2120  return stg;
2121 }
HRESULT hr
Definition: shlfolder.c:183
#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:2084
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:2087
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1

Referenced by test_data_cache_dib_contents_stream().

◆ create_storage_from_def()

static IStorage* create_storage_from_def ( const struct storage_def stg_def)
static

Definition at line 4179 of file ole2.c.

4180 {
4181  HRESULT hr;
4182  IStorage *stg;
4183  IStream *stm;
4184  int i;
4185 
4187  ok(hr == S_OK, "unexpected %#x\n", hr);
4188 
4189  hr = IStorage_SetClass(stg, stg_def->clsid);
4190  ok(hr == S_OK, "unexpected %#x\n", hr);
4191 
4192  for (i = 0; i < stg_def->stream_count; i++)
4193  {
4194  WCHAR name[32];
4195 
4196  MultiByteToWideChar(CP_ACP, 0, stg_def->stream[i].name, -1, name, 32);
4197  hr = IStorage_CreateStream(stg, name, STGM_READWRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
4198  ok(hr == S_OK, "unexpected %#x\n", hr);
4199 
4200  if (stg_def->stream[i].cf != -1)
4201  {
4202  int clipformat[2];
4204 
4205  if (stg_def->stream[i].cf)
4206  {
4207  clipformat[0] = -1;
4208  clipformat[1] = stg_def->stream[i].cf;
4209  hr = IStream_Write(stm, clipformat, sizeof(clipformat), NULL);
4210  }
4211  else
4212  {
4213  clipformat[0] = 0;
4214  hr = IStream_Write(stm, &clipformat[0], sizeof(clipformat[0]), NULL);
4215  }
4216  ok(hr == S_OK, "unexpected %#x\n", hr);
4217 
4218  hdr.tdSize = sizeof(hdr.tdSize);
4219  hdr.dvAspect = stg_def->stream[i].dvAspect;
4220  hdr.lindex = -1;
4221  hdr.advf = stg_def->stream[i].advf;
4222  hdr.unknown7 = 0;
4223  hdr.dwObjectExtentX = 0;
4224  hdr.dwObjectExtentY = 0;
4225  hdr.dwSize = stg_def->stream[i].data_size;
4226  hr = IStream_Write(stm, &hdr, sizeof(hdr), NULL);
4227  ok(hr == S_OK, "unexpected %#x\n", hr);
4228  }
4229 
4230  if (stg_def->stream[i].data_size)
4231  {
4232  hr = IStream_Write(stm, stg_def->stream[i].data, stg_def->stream[i].data_size, NULL);
4233  ok(hr == S_OK, "unexpected %#x\n", hr);
4234  }
4235 
4236  IStream_Release(stm);
4237  }
4238 
4239  return stg;
4240 }
char hdr[14]
Definition: iptest.cpp:33
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
const CLSID * clsid
Definition: ole2.c:3849
#define CP_ACP
Definition: compat.h:99
#define STGM_CREATE
Definition: objbase.h:925
int stream_count
Definition: ole2.c:3850
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
__wchar_t WCHAR
Definition: xmlstorage.h:180
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
#define ok(value,...)
Definition: atltest.h:57
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3851
#define MultiByteToWideChar
Definition: compat.h:100
Definition: name.c:36

Referenced by test_data_cache_contents().

◆ create_text()

static void create_text ( STGMEDIUM *  med)
static

Definition at line 258 of file ole2.c.

259 {
260  HGLOBAL handle;
261  char *p;
262 
264  p = GlobalLock(handle);
265  strcpy(p, "test");
267 
268  med->tymed = TYMED_HGLOBAL;
269  U(med)->hGlobal = handle;
270  med->pUnkForRelease = NULL;
271 }
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
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
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define GMEM_DDESHARE
Definition: winbase.h:295
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLfloat GLfloat p
Definition: glext.h:8902
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by DataObject_GetData().

◆ DataObject_AddRef()

static ULONG WINAPI DataObject_AddRef ( IDataObject iface)
static

Definition at line 1465 of file ole2.c.

1467 {
1468  CHECK_EXPECTED_METHOD("DataObject_AddRef");
1469  return 2;
1470 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ DataObject_DAdvise()

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

Definition at line 1570 of file ole2.c.

1576 {
1577  STGMEDIUM stgmedium;
1578 
1579  CHECK_EXPECTED_METHOD("DataObject_DAdvise");
1580  *pdwConnection = 1;
1581 
1582  if(advf & ADVF_PRIMEFIRST)
1583  {
1584  ok(pformatetc->cfFormat == cf_test_2, "got %04x\n", pformatetc->cfFormat);
1585  stgmedium.tymed = TYMED_HGLOBAL;
1586  U(stgmedium).hGlobal = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, 4);
1587  stgmedium.pUnkForRelease = NULL;
1588  IAdviseSink_OnDataChange(pAdvSink, pformatetc, &stgmedium);
1589  }
1590 
1591  return S_OK;
1592 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
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 S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
static UINT cf_test_2
Definition: ole2.c:120
#define GMEM_MOVEABLE
Definition: winbase.h:291
#define GMEM_ZEROINIT
Definition: winbase.h:303

◆ DataObject_DUnadvise()

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

Definition at line 1594 of file ole2.c.

1597 {
1598  CHECK_EXPECTED_METHOD("DataObject_DUnadvise");
1599  return S_OK;
1600 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ DataObject_EnumDAdvise()

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

Definition at line 1602 of file ole2.c.

1605 {
1606  CHECK_EXPECTED_METHOD("DataObject_EnumDAdvise");
1607  return OLE_E_ADVISENOTSUPPORTED;
1608 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define OLE_E_ADVISENOTSUPPORTED
Definition: winerror.h:2617

◆ DataObject_EnumFormatEtc()

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

Definition at line 1561 of file ole2.c.

1565 {
1566  CHECK_EXPECTED_METHOD("DataObject_EnumFormatEtc");
1567  return E_NOTIMPL;
1568 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DataObject_GetCanonicalFormatEtc()

static HRESULT WINAPI DataObject_GetCanonicalFormatEtc ( IDataObject iface,
LPFORMATETC  pformatectIn,
LPFORMATETC  pformatetcOut 
)
static

Definition at line 1542 of file ole2.c.

1546 {
1547  CHECK_EXPECTED_METHOD("DataObject_GetCanonicalFormatEtc");
1548  return E_NOTIMPL;
1549 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DataObject_GetData()

static HRESULT WINAPI DataObject_GetData ( IDataObject iface,
FORMATETC *  fmt_in,
STGMEDIUM *  med 
)
static

Definition at line 1487 of file ole2.c.

1489 {
1490  FORMATETC *fmt;
1491 
1492  CHECK_EXPECTED_METHOD_FMT("DataObject_GetData", fmt_in);
1493 
1494  for (fmt = g_dataobject_fmts; fmt && fmt->cfFormat != 0; fmt++)
1495  {
1496  if (fmtetc_equal( fmt_in, fmt ))
1497  {
1498  switch (fmt->cfFormat)
1499  {
1500  case CF_DIB:
1501  create_dib( med );
1502  return S_OK;
1503  case CF_BITMAP:
1504  create_bitmap( med );
1505  return S_OK;
1506  case CF_ENHMETAFILE:
1507  create_emf( med );
1508  return S_OK;
1509  case CF_TEXT:
1510  create_text( med );
1511  return S_OK;
1512  default:
1513  trace( "unhandled fmt %d\n", fmt->cfFormat );
1514  }
1515  }
1516  }
1517 
1518  return S_FALSE;
1519 }
#define CHECK_EXPECTED_METHOD_FMT(method_name, fmt)
Definition: ole2.c:191
#define CF_ENHMETAFILE
Definition: constants.h:409
static void create_emf(STGMEDIUM *med)
Definition: ole2.c:230
static void create_bitmap(STGMEDIUM *med)
Definition: ole2.c:223
const char * fmt
Definition: wsprintf.c:30
static BOOL fmtetc_equal(const FORMATETC *a, const FORMATETC *b)
Definition: ole2.c:1479
static void create_dib(STGMEDIUM *med)
Definition: ole2.c:211
#define S_FALSE
Definition: winerror.h:2357
#define CF_BITMAP
Definition: constants.h:397
#define CF_TEXT
Definition: constants.h:396
#define trace
Definition: atltest.h:70
static FORMATETC * g_dataobject_fmts
Definition: ole2.c:122
#define S_OK
Definition: intsafe.h:59
static void create_text(STGMEDIUM *med)
Definition: ole2.c:258
Definition: dsound.c:943
#define CF_DIB
Definition: constants.h:403

◆ DataObject_GetDataHere()

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

Definition at line 1521 of file ole2.c.

1525 {
1526  CHECK_EXPECTED_METHOD("DataObject_GetDataHere");
1527  return E_NOTIMPL;
1528 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DataObject_QueryGetData()

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

Definition at line 1530 of file ole2.c.

1531 {
1532  FORMATETC *fmt;
1533 
1534  CHECK_EXPECTED_METHOD_FMT("DataObject_QueryGetData", fmt_in);
1535 
1536  for (fmt = g_dataobject_fmts; fmt && fmt->cfFormat != 0; fmt++)
1537  if (fmtetc_equal( fmt_in, fmt )) return S_OK;
1538 
1539  return S_FALSE;
1540 }
#define CHECK_EXPECTED_METHOD_FMT(method_name, fmt)
Definition: ole2.c:191
const char * fmt
Definition: wsprintf.c:30
static BOOL fmtetc_equal(const FORMATETC *a, const FORMATETC *b)
Definition: ole2.c:1479
#define S_FALSE
Definition: winerror.h:2357
static FORMATETC * g_dataobject_fmts
Definition: ole2.c:122
#define S_OK
Definition: intsafe.h:59
Definition: dsound.c:943

◆ DataObject_QueryInterface()

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

Definition at line 1449 of file ole2.c.

1453 {
1454  CHECK_EXPECTED_METHOD("DataObject_QueryInterface");
1455 
1457  {
1458  *ppvObject = iface;
1459  return S_OK;
1460  }
1461  *ppvObject = NULL;
1462  return S_OK;
1463 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
REFIID riid
Definition: precomp.h:44
const GUID IID_IDataObject
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ DataObject_Release()

static ULONG WINAPI DataObject_Release ( IDataObject iface)
static

Definition at line 1472 of file ole2.c.

1474 {
1475  CHECK_EXPECTED_METHOD("DataObject_Release");
1476  return 1;
1477 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ DataObject_SetData()

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

Definition at line 1551 of file ole2.c.

1556 {
1557  CHECK_EXPECTED_METHOD("DataObject_SetData");
1558  return E_NOTIMPL;
1559 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ DEFINE_EXPECT() [1/8]

DEFINE_EXPECT ( Storage_Stat  )

◆ DEFINE_EXPECT() [2/8]

DEFINE_EXPECT ( Storage_OpenStream_CompObj  )

◆ DEFINE_EXPECT() [3/8]

DEFINE_EXPECT ( Storage_OpenStream_OlePres  )

◆ DEFINE_EXPECT() [4/8]

DEFINE_EXPECT ( Storage_SetClass  )

◆ DEFINE_EXPECT() [5/8]

DEFINE_EXPECT ( Storage_CreateStream_CompObj  )

◆ DEFINE_EXPECT() [6/8]

DEFINE_EXPECT ( Storage_CreateStream_OlePres  )

◆ DEFINE_EXPECT() [7/8]

DEFINE_EXPECT ( Storage_OpenStream_Ole  )

◆ DEFINE_EXPECT() [8/8]

DEFINE_EXPECT ( Storage_DestroyElement  )

◆ draw_continue()

static BOOL STDMETHODCALLTYPE draw_continue ( ULONG_PTR  param)
static

Definition at line 1367 of file ole2.c.

1368 {
1369  CHECK_EXPECTED_METHOD("draw_continue");
1370  return TRUE;
1371 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define TRUE
Definition: types.h:120

Referenced by test_data_cache().

◆ draw_continue_false()

static BOOL STDMETHODCALLTYPE draw_continue_false ( ULONG_PTR  param)
static

Definition at line 1373 of file ole2.c.

1374 {
1375  CHECK_EXPECTED_METHOD("draw_continue_false");
1376  return FALSE;
1377 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

Referenced by test_data_cache().

◆ fmtetc_equal()

static BOOL fmtetc_equal ( const FORMATETC *  a,
const FORMATETC *  b 
)
inlinestatic

Definition at line 1479 of file ole2.c.

1480 {
1481  /* FIXME ptd */
1482  return a->cfFormat == b->cfFormat && a->dwAspect == b->dwAspect &&
1483  a->lindex == b->lindex && a->tymed == b->tymed;
1484 
1485 }
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by DataObject_GetData(), and DataObject_QueryGetData().

◆ get_stgdef()

static void get_stgdef ( struct storage_def stg_def,
CLIPFORMAT  cf,
STGMEDIUM *  stg_med,
int  stm_idx 
)
static

Definition at line 4255 of file ole2.c.

4256 {
4257  BYTE *data;
4258  int data_size;
4259  METAFILEPICT *mfpict;
4260  HDC hdc;
4261 
4262  switch (cf)
4263  {
4264  case CF_DIB:
4265  data_size = sizeof(dib);
4266  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4267  {
4268  data_size += sizeof(dib_inf);
4269  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4270  memcpy(data, dib_inf, sizeof(dib_inf));
4271  memcpy(data + sizeof(dib_inf), dib, sizeof(dib));
4272  }
4273  else
4274  {
4275  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4276  memcpy(data, dib, sizeof(dib));
4277  }
4278  stg_def->stream[stm_idx].data = data;
4279  stg_def->stream[stm_idx].data_size = data_size;
4280  break;
4281  case CF_METAFILEPICT:
4282  mfpict = GlobalLock(U(stg_med)->hMetaFilePict);
4283  data_size = GetMetaFileBitsEx(mfpict->hMF, 0, NULL);
4284  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4285  {
4286  data = HeapAlloc(GetProcessHeap(), 0, data_size + sizeof(mf_rec));
4287  memcpy(data, mf_rec, sizeof(mf_rec));
4288  GetMetaFileBitsEx(mfpict->hMF, data_size, data + sizeof(mf_rec));
4289  data_size += sizeof(mf_rec);
4290  }
4291  else
4292  {
4293  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4294  GetMetaFileBitsEx(mfpict->hMF, data_size, data);
4295  }
4296  GlobalUnlock(U(stg_med)->hMetaFilePict);
4297  stg_def->stream[stm_idx].data_size = data_size;
4298  stg_def->stream[stm_idx].data = data;
4299  break;
4300  case CF_ENHMETAFILE:
4301  if (!strcmp(stg_def->stream[stm_idx].name, "CONTENTS"))
4302  {
4303  data_size = GetEnhMetaFileBits(U(stg_med)->hEnhMetaFile, 0, NULL);
4304  data = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) + sizeof(ENHMETAHEADER) + data_size);
4305  *((DWORD *)data) = sizeof(ENHMETAHEADER);
4306  GetEnhMetaFileBits(U(stg_med)->hEnhMetaFile, data_size, data + sizeof(DWORD) + sizeof(ENHMETAHEADER));
4307  memcpy(data + sizeof(DWORD), data + sizeof(DWORD) + sizeof(ENHMETAHEADER), sizeof(ENHMETAHEADER));
4308  data_size += sizeof(DWORD) + sizeof(ENHMETAHEADER);
4309  }
4310  else
4311  {
4312  hdc = GetDC(NULL);
4313  data_size = GetWinMetaFileBits(U(stg_med)->hEnhMetaFile, 0, NULL, MM_ANISOTROPIC, hdc);
4314  data = HeapAlloc(GetProcessHeap(), 0, data_size);
4315  GetWinMetaFileBits(U(stg_med)->hEnhMetaFile, data_size, data, MM_ANISOTROPIC, hdc);
4316  ReleaseDC(NULL, hdc);
4317  }
4318  stg_def->stream[stm_idx].data_size = data_size;
4319  stg_def->stream[stm_idx].data = data;
4320  break;
4321  }
4322 }
static const BYTE mf_rec[]
Definition: ole2.c:4248
HMETAFILE hMF
Definition: wingdi.h:2603
struct tagENHMETAHEADER ENHMETAHEADER
#define CF_ENHMETAFILE
Definition: constants.h:409
HDC WINAPI GetDC(_In_opt_ HWND)
static const BYTE dib_inf[]
Definition: ole2.c:4242
#define U(x)
Definition: wordpad.c:44
static HDC
Definition: imagelist.c:92
#define CF_METAFILEPICT
Definition: constants.h:398
#define DWORD
Definition: nt_native.h:44
UINT WINAPI GetEnhMetaFileBits(_In_ HENHMETAFILE hEMF, _In_ UINT nSize, _Out_writes_bytes_opt_(nSize) LPBYTE lpData)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
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:201
struct stream_def stream[MAX_STREAM]
Definition: ole2.c:3851
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

Referenced by test_data_cache_save_data(), and test_OleCreateStaticFromData().

◆ get_stgmedium()

static void get_stgmedium ( CLIPFORMAT  cfFormat,
STGMEDIUM *  stgmedium 
)
static

Definition at line 4324 of file ole2.c.

4325 {
4326  switch (cfFormat)
4327  {
4328  case CF_DIB:
4329  create_dib(stgmedium);
4330  break;
4331  case CF_METAFILEPICT:
4332  create_mfpict(stgmedium);
4333  break;
4334  case CF_ENHMETAFILE:
4335  create_emf(stgmedium);
4336  break;
4337  default:
4338  ok(0, "cf %x not implemented\n", cfFormat);
4339  }
4340 }
#define CF_ENHMETAFILE
Definition: constants.h:409
static void create_emf(STGMEDIUM *med)
Definition: ole2.c:230
#define CF_METAFILEPICT
Definition: constants.h:398
static void create_dib(STGMEDIUM *med)
Definition: ole2.c:211
static void create_mfpict(STGMEDIUM *med)
Definition: ole2.c:240
#define ok(value,...)
Definition: atltest.h:57
#define CF_DIB
Definition: constants.h:403

Referenced by test_data_cache_save_data(), and test_OleCreateStaticFromData().

◆ OleObject_AddRef()

static ULONG WINAPI OleObject_AddRef ( IOleObject iface)
static

Definition at line 299 of file ole2.c.

300 {
301  CHECK_EXPECTED_METHOD("OleObject_AddRef");
302  return 2;
303 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObject_Advise()

static HRESULT WINAPI OleObject_Advise ( IOleObject iface,
IAdviseSink pAdvSink,
DWORD pdwConnection 
)
static

Definition at line 485 of file ole2.c.

490 {
491  CHECK_EXPECTED_METHOD("OleObject_Advise");
492  return S_OK;
493 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_Close()

static HRESULT WINAPI OleObject_Close ( IOleObject iface,
DWORD  dwSaveOption 
)
static

Definition at line 343 of file ole2.c.

347 {
348  CHECK_EXPECTED_METHOD("OleObject_Close");
349  return S_OK;
350 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_DoVerb()

static HRESULT WINAPI OleObject_DoVerb ( IOleObject iface,
LONG  iVerb,
LPMSG  lpmsg,
IOleClientSite pActiveSite,
LONG  lindex,
HWND  hwndParent,
LPCRECT  lprcPosRect 
)
static

Definition at line 399 of file ole2.c.

408 {
409  CHECK_EXPECTED_METHOD("OleObject_DoVerb");
410  return S_OK;
411 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_EnumAdvise()

static HRESULT WINAPI OleObject_EnumAdvise ( IOleObject iface,
IEnumSTATDATA **  ppenumAdvise 
)
static

Definition at line 506 of file ole2.c.

510 {
511  CHECK_EXPECTED_METHOD("OleObject_EnumAdvise");
512  return E_NOTIMPL;
513 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_EnumVerbs()

static HRESULT WINAPI OleObject_EnumVerbs ( IOleObject iface,
IEnumOLEVERB **  ppEnumOleVerb 
)
static

Definition at line 414 of file ole2.c.

418 {
419  CHECK_EXPECTED_METHOD("OleObject_EnumVerbs");
420  return E_NOTIMPL;
421 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_GetClientSite()

static HRESULT WINAPI OleObject_GetClientSite ( IOleObject iface,
IOleClientSite **  ppClientSite 
)
static

Definition at line 322 of file ole2.c.

326 {
327  CHECK_EXPECTED_METHOD("OleObject_GetClientSite");
328  return E_NOTIMPL;
329 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_GetClipboardData()

static HRESULT WINAPI OleObject_GetClipboardData ( IOleObject iface,
DWORD  dwReserved,
IDataObject **  ppDataObject 
)
static

Definition at line 388 of file ole2.c.

393 {
394  CHECK_EXPECTED_METHOD("OleObject_GetClipboardData");
395  return E_NOTIMPL;
396 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_GetExtent()

static HRESULT WINAPI OleObject_GetExtent ( IOleObject iface,
DWORD  dwDrawAspect,
SIZEL psizel 
)
static

Definition at line 474 of file ole2.c.

479 {
480  CHECK_EXPECTED_METHOD("OleObject_GetExtent");
481  return E_NOTIMPL;
482 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_GetMiscStatus()

static HRESULT WINAPI OleObject_GetMiscStatus ( IOleObject iface,
DWORD  aspect,
DWORD pdwStatus 
)
static

Definition at line 516 of file ole2.c.

521 {
522  CHECK_EXPECTED_METHOD("OleObject_GetMiscStatus");
523 
524  ok(aspect == DVASPECT_CONTENT, "got aspect %d\n", aspect);
525 
527  {
528  *pdwStatus = OLEMISC_RECOMPOSEONRESIZE;
529  return S_OK;
530  }
531  else
532  {
533  *pdwStatus = 0x1234;
535  }
536 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
static HRESULT g_GetMiscStatusFailsWith
Definition: ole2.c:117
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

◆ OleObject_GetMoniker()

static HRESULT WINAPI OleObject_GetMoniker ( IOleObject iface,
DWORD  dwAssign,
DWORD  dwWhichMoniker,
IMoniker **  ppmk 
)
static

Definition at line 364 of file ole2.c.

370 {
371  CHECK_EXPECTED_METHOD("OleObject_GetMoniker");
372  return S_OK;
373 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_GetUserClassID()

static HRESULT WINAPI OleObject_GetUserClassID ( IOleObject iface,
CLSID pClsid 
)
static

Definition at line 442 of file ole2.c.

446 {
447  CHECK_EXPECTED_METHOD("OleObject_GetUserClassID");
448  return E_NOTIMPL;
449 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_GetUserType()

static HRESULT WINAPI OleObject_GetUserType ( IOleObject iface,
DWORD  dwFormOfType,
LPOLESTR pszUserType 
)
static

Definition at line 452 of file ole2.c.

457 {
458  CHECK_EXPECTED_METHOD("OleObject_GetUserType");
459  return E_NOTIMPL;
460 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_InitFromData()

static HRESULT WINAPI OleObject_InitFromData ( IOleObject iface,
IDataObject pDataObject,
BOOL  fCreation,
DWORD  dwReserved 
)
static

Definition at line 376 of file ole2.c.

382 {
383  CHECK_EXPECTED_METHOD("OleObject_InitFromData");
384  return S_OK;
385 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_IsUpToDate()

static HRESULT WINAPI OleObject_IsUpToDate ( IOleObject iface)
static

Definition at line 433 of file ole2.c.

436 {
437  CHECK_EXPECTED_METHOD("OleObject_IsUpToDate");
438  return S_OK;
439 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_QueryInterface()

static HRESULT WINAPI OleObject_QueryInterface ( IOleObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 273 of file ole2.c.

274 {
275  CHECK_EXPECTED_METHOD("OleObject_QueryInterface");
276 
277  *ppv = NULL;
278 
280  *ppv = iface;
281  else if (IsEqualIID(riid, &IID_IPersistStorage))
283  else if (IsEqualIID(riid, &IID_IOleCache))
284  *ppv = cache;
286  *ppv = runnable;
287  else if (IsEqualIID(riid, &IID_WineTest))
288  return g_QIFailsWith;
289 
290  if(*ppv) {
291  IUnknown_AddRef((IUnknown*)*ppv);
292  return S_OK;
293  }
294 
295  trace("OleObject_QueryInterface: returning E_NOINTERFACE\n");
296  return E_NOINTERFACE;
297 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
const GUID IID_IPersistStorage
static IRunnableObject * runnable
Definition: ole2.c:76
static const IID IID_WineTest
Definition: ole2.c:94
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IOleObject
#define trace
Definition: atltest.h:70
static BOOL g_showRunnable
Definition: ole2.c:115
const GUID IID_IUnknown
static IOleCache * cache
Definition: ole2.c:75
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
static IPersistStorage OleObjectPersistStg
Definition: ole2.c:74
static HRESULT g_QIFailsWith
Definition: ole2.c:118
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
const GUID IID_IOleCache

◆ OleObject_Release()

static ULONG WINAPI OleObject_Release ( IOleObject iface)
static

Definition at line 305 of file ole2.c.

306 {
307  CHECK_EXPECTED_METHOD("OleObject_Release");
308  return 1;
309 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObject_SetClientSite()

static HRESULT WINAPI OleObject_SetClientSite ( IOleObject iface,
IOleClientSite pClientSite 
)
static

Definition at line 312 of file ole2.c.

316 {
317  CHECK_EXPECTED_METHOD("OleObject_SetClientSite");
318  return S_OK;
319 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_SetColorScheme()

static HRESULT WINAPI OleObject_SetColorScheme ( IOleObject iface,
LOGPALETTE pLogpal 
)
static

Definition at line 539 of file ole2.c.

543 {
544  CHECK_EXPECTED_METHOD("OleObject_SetColorScheme");
545  return E_NOTIMPL;
546 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObject_SetExtent()

static HRESULT WINAPI OleObject_SetExtent ( IOleObject iface,
DWORD  dwDrawAspect,
SIZEL psizel 
)
static

Definition at line 463 of file ole2.c.

468 {
469  CHECK_EXPECTED_METHOD("OleObject_SetExtent");
470  return S_OK;
471 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_SetHostNames()

static HRESULT WINAPI OleObject_SetHostNames ( IOleObject iface,
LPCOLESTR  szContainerApp,
LPCOLESTR  szContainerObj 
)
static

Definition at line 332 of file ole2.c.

337 {
338  CHECK_EXPECTED_METHOD("OleObject_SetHostNames");
339  return S_OK;
340 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_SetMoniker()

static HRESULT WINAPI OleObject_SetMoniker ( IOleObject iface,
DWORD  dwWhichMoniker,
IMoniker pmk 
)
static

Definition at line 353 of file ole2.c.

358 {
359  CHECK_EXPECTED_METHOD("OleObject_SetMoniker");
360  return S_OK;
361 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_Unadvise()

static HRESULT WINAPI OleObject_Unadvise ( IOleObject iface,
DWORD  dwConnection 
)
static

Definition at line 496 of file ole2.c.

500 {
501  CHECK_EXPECTED_METHOD("OleObject_Unadvise");
502  return S_OK;
503 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObject_Update()

static HRESULT WINAPI OleObject_Update ( IOleObject iface)
static

Definition at line 424 of file ole2.c.

427 {
428  CHECK_EXPECTED_METHOD("OleObject_Update");
429  return S_OK;
430 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCache_AddRef()

static ULONG WINAPI OleObjectCache_AddRef ( IOleCache iface)
static

Definition at line 682 of file ole2.c.

683 {
684  CHECK_EXPECTED_METHOD("OleObjectCache_AddRef");
685  return 2;
686 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectCache_Cache()

static HRESULT WINAPI OleObjectCache_Cache ( IOleCache iface,
FORMATETC *  pformatetc,
DWORD  advf,
DWORD pdwConnection 
)
static

Definition at line 695 of file ole2.c.

701 {
702  CHECK_EXPECTED_METHOD("OleObjectCache_Cache");
703  if (g_expected_fetc) {
704  ok(pformatetc != NULL, "pformatetc should not be NULL\n");
705  if (pformatetc) {
706  ok(pformatetc->cfFormat == g_expected_fetc->cfFormat,
707  "cfFormat: %x\n", pformatetc->cfFormat);
708  ok((pformatetc->ptd != NULL) == (g_expected_fetc->ptd != NULL),
709  "ptd: %p\n", pformatetc->ptd);
710  ok(pformatetc->dwAspect == g_expected_fetc->dwAspect,
711  "dwAspect: %x\n", pformatetc->dwAspect);
712  ok(pformatetc->lindex == g_expected_fetc->lindex,
713  "lindex: %x\n", pformatetc->lindex);
714  ok(pformatetc->tymed == g_expected_fetc->tymed,
715  "tymed: %x\n", pformatetc->tymed);
716  }
717  } else
718  ok(pformatetc == NULL, "pformatetc should be NULL\n");
719  return S_OK;
720 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
smooth NULL
Definition: ftsmooth.c:416
static FORMATETC * g_expected_fetc
Definition: ole2.c:113
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57

◆ OleObjectCache_EnumCache()

static HRESULT WINAPI OleObjectCache_EnumCache ( IOleCache iface,
IEnumSTATDATA **  ppenumSTATDATA 
)
static

Definition at line 733 of file ole2.c.

737 {
738  CHECK_EXPECTED_METHOD("OleObjectCache_EnumCache");
739  return S_OK;
740 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCache_InitCache()

static HRESULT WINAPI OleObjectCache_InitCache ( IOleCache iface,
IDataObject pDataObject 
)
static

Definition at line 744 of file ole2.c.

748 {
749  CHECK_EXPECTED_METHOD("OleObjectCache_InitCache");
750  return S_OK;
751 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCache_QueryInterface()

static HRESULT WINAPI OleObjectCache_QueryInterface ( IOleCache iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 677 of file ole2.c.

678 {
679  return IOleObject_QueryInterface(&OleObject, riid, ppv);
680 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IOleObject OleObject
Definition: ole2.c:576

◆ OleObjectCache_Release()

static ULONG WINAPI OleObjectCache_Release ( IOleCache iface)
static

Definition at line 688 of file ole2.c.

689 {
690  CHECK_EXPECTED_METHOD("OleObjectCache_Release");
691  return 1;
692 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectCache_SetData()

static HRESULT WINAPI OleObjectCache_SetData ( IOleCache iface,
FORMATETC *  pformatetc,
STGMEDIUM *  pmedium,
BOOL  fRelease 
)
static

Definition at line 755 of file ole2.c.

761 {
762  CHECK_EXPECTED_METHOD("OleObjectCache_SetData");
763  return S_OK;
764 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCache_Uncache()

static HRESULT WINAPI OleObjectCache_Uncache ( IOleCache iface,
DWORD  dwConnection 
)
static

Definition at line 723 of file ole2.c.

727 {
728  CHECK_EXPECTED_METHOD("OleObjectCache_Uncache");
729  return S_OK;
730 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCF_AddRef()

static ULONG WINAPI OleObjectCF_AddRef ( IClassFactory iface)
static

Definition at line 793 of file ole2.c.

794 {
795  return 2;
796 }

◆ OleObjectCF_CreateInstance()

static HRESULT WINAPI OleObjectCF_CreateInstance ( IClassFactory iface,
IUnknown punkOuter,
REFIID  riid,
void **  ppv 
)
static

Definition at line 803 of file ole2.c.

804 {
805  return IOleObject_QueryInterface(&OleObject, riid, ppv);
806 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IOleObject OleObject
Definition: ole2.c:576

◆ OleObjectCF_LockServer()

static HRESULT WINAPI OleObjectCF_LockServer ( IClassFactory iface,
BOOL  lock 
)
static

Definition at line 808 of file ole2.c.

809 {
810  return S_OK;
811 }
#define S_OK
Definition: intsafe.h:59

◆ OleObjectCF_QueryInterface()

static HRESULT WINAPI OleObjectCF_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 781 of file ole2.c.

782 {
784  {
785  *ppv = iface;
786  IClassFactory_AddRef(iface);
787  return S_OK;
788  }
789  *ppv = NULL;
790  return E_NOINTERFACE;
791 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
const GUID IID_IClassFactory
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ OleObjectCF_Release()

static ULONG WINAPI OleObjectCF_Release ( IClassFactory iface)
static

Definition at line 798 of file ole2.c.

799 {
800  return 1;
801 }

◆ OleObjectPersistStg_AddRef()

static ULONG WINAPI OleObjectPersistStg_AddRef ( IPersistStorage iface)
static

Definition at line 584 of file ole2.c.

585 {
586  CHECK_EXPECTED_METHOD("OleObjectPersistStg_AddRef");
587  return 2;
588 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectPersistStg_GetClassId()

static HRESULT WINAPI OleObjectPersistStg_GetClassId ( IPersistStorage iface,
CLSID clsid 
)
static

Definition at line 596 of file ole2.c.

597 {
598  CHECK_EXPECTED_METHOD("OleObjectPersistStg_GetClassId");
599  return E_NOTIMPL;
600 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObjectPersistStg_HandsOffStorage()

static HRESULT WINAPI OleObjectPersistStg_HandsOffStorage ( IPersistStorage iface)
static

Definition at line 653 of file ole2.c.

656 {
657  CHECK_EXPECTED_METHOD("OleObjectPersistStg_HandsOffStorage");
658  return S_OK;
659 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectPersistStg_InitNew()

static HRESULT WINAPI OleObjectPersistStg_InitNew ( IPersistStorage iface,
IStorage pStg 
)
static

Definition at line 612 of file ole2.c.

616 {
617  CHECK_EXPECTED_METHOD("OleObjectPersistStg_InitNew");
618  return S_OK;
619 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectPersistStg_IsDirty()

static HRESULT WINAPI OleObjectPersistStg_IsDirty ( IPersistStorage iface)
static

Definition at line 603 of file ole2.c.

606 {
607  CHECK_EXPECTED_METHOD("OleObjectPersistStg_IsDirty");
608  return S_OK;
609 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectPersistStg_Load()

static HRESULT WINAPI OleObjectPersistStg_Load ( IPersistStorage iface,
IStorage pStg 
)
static

Definition at line 622 of file ole2.c.

626 {
627  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Load");
628  return S_OK;
629 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectPersistStg_QueryInterface()

static HRESULT WINAPI OleObjectPersistStg_QueryInterface ( IPersistStorage iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 578 of file ole2.c.

579 {
580  trace("OleObjectPersistStg_QueryInterface\n");
581  return IOleObject_QueryInterface(&OleObject, riid, ppv);
582 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define trace
Definition: atltest.h:70
static IOleObject OleObject
Definition: ole2.c:576

◆ OleObjectPersistStg_Release()

static ULONG WINAPI OleObjectPersistStg_Release ( IPersistStorage iface)
static

Definition at line 590 of file ole2.c.

591 {
592  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Release");
593  return 1;
594 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectPersistStg_Save()

static HRESULT WINAPI OleObjectPersistStg_Save ( IPersistStorage iface,
IStorage pStgSave,
BOOL  fSameAsLoad 
)
static

Definition at line 632 of file ole2.c.

637 {
638  CHECK_EXPECTED_METHOD("OleObjectPersistStg_Save");
639  return S_OK;
640 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectPersistStg_SaveCompleted()

static HRESULT WINAPI OleObjectPersistStg_SaveCompleted ( IPersistStorage iface,
IStorage pStgNew 
)
static

Definition at line 643 of file ole2.c.

647 {
648  CHECK_EXPECTED_METHOD("OleObjectPersistStg_SaveCompleted");
649  return S_OK;
650 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectRunnable_AddRef()

static ULONG WINAPI OleObjectRunnable_AddRef ( IRunnableObject iface)
static

Definition at line 829 of file ole2.c.

830 {
831  CHECK_EXPECTED_METHOD("OleObjectRunnable_AddRef");
832  return 2;
833 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectRunnable_GetRunningClass()

static HRESULT WINAPI OleObjectRunnable_GetRunningClass ( IRunnableObject iface,
LPCLSID  lpClsid 
)
static

Definition at line 841 of file ole2.c.

844 {
845  CHECK_EXPECTED_METHOD("OleObjectRunnable_GetRunningClass");
846  return E_NOTIMPL;
847 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleObjectRunnable_IsRunning()

static BOOL WINAPI OleObjectRunnable_IsRunning ( IRunnableObject iface)
static

Definition at line 857 of file ole2.c.

858 {
859  CHECK_EXPECTED_METHOD("OleObjectRunnable_IsRunning");
860  return g_isRunning;
861 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
static BOOL g_isRunning
Definition: ole2.c:116

◆ OleObjectRunnable_LockRunning()

static HRESULT WINAPI OleObjectRunnable_LockRunning ( IRunnableObject iface,
BOOL  fLock,
BOOL  fLastUnlockCloses 
)
static

Definition at line 863 of file ole2.c.

867 {
868  CHECK_EXPECTED_METHOD("OleObjectRunnable_LockRunning");
869  return S_OK;
870 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectRunnable_QueryInterface()

static HRESULT WINAPI OleObjectRunnable_QueryInterface ( IRunnableObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 824 of file ole2.c.

825 {
826  return IOleObject_QueryInterface(&OleObject, riid, ppv);
827 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static IOleObject OleObject
Definition: ole2.c:576

◆ OleObjectRunnable_Release()

static ULONG WINAPI OleObjectRunnable_Release ( IRunnableObject iface)
static

Definition at line 835 of file ole2.c.

836 {
837  CHECK_EXPECTED_METHOD("OleObjectRunnable_Release");
838  return 1;
839 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190

◆ OleObjectRunnable_Run()

static HRESULT WINAPI OleObjectRunnable_Run ( IRunnableObject iface,
LPBINDCTX  pbc 
)
static

Definition at line 849 of file ole2.c.

852 {
853  CHECK_EXPECTED_METHOD("OleObjectRunnable_Run");
854  return S_OK;
855 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleObjectRunnable_SetContainedObject()

static HRESULT WINAPI OleObjectRunnable_SetContainedObject ( IRunnableObject iface,
BOOL  fContained 
)
static

Definition at line 872 of file ole2.c.

875 {
876  CHECK_EXPECTED_METHOD("OleObjectRunnable_SetContainedObject");
877  return S_OK;
878 }
#define CHECK_EXPECTED_METHOD(method_name)
Definition: ole2.c:190
#define S_OK
Definition: intsafe.h:59

◆ OleRun_AddRef()

static ULONG WINAPI OleRun_AddRef ( IRunnableObject iface)
static

Definition at line 3215 of file ole2.c.

3216 {
3217  return 2;
3218 }

◆ OleRun_GetRunningClass()

static HRESULT WINAPI OleRun_GetRunningClass ( IRunnableObject iface,
CLSID clsid 
)
static

Definition at line 3225 of file ole2.c.

3226 {
3227  ok(0, "unexpected\n");
3228  return E_NOTIMPL;
3229 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleRun_IsRunning()

static BOOL WINAPI OleRun_IsRunning ( IRunnableObject iface)
static

Definition at line 3237 of file ole2.c.

3238 {
3239  ok(0, "unexpected\n");
3240  return FALSE;
3241 }
#define ok(value,...)
Definition: atltest.h:57

◆ OleRun_LockRunning()

static HRESULT WINAPI OleRun_LockRunning ( IRunnableObject iface,
BOOL  lock,
BOOL  last_unlock_closes 
)
static

Definition at line 3243 of file ole2.c.

3245 {
3246  ok(0, "unexpected\n");
3247  return E_NOTIMPL;
3248 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleRun_QueryInterface()

static HRESULT WINAPI OleRun_QueryInterface ( IRunnableObject iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 3197 of file ole2.c.

3198 {
3199  *ppv = NULL;
3200 
3201  if (IsEqualIID(riid, &IID_IUnknown) ||
3203  *ppv = iface;
3204  }
3205 
3206  if (*ppv)
3207  {
3208  IUnknown_AddRef((IUnknown *)*ppv);
3209  return S_OK;
3210  }
3211 
3212  return E_NOINTERFACE;
3213 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ OleRun_Release()

static ULONG WINAPI OleRun_Release ( IRunnableObject iface)
static

Definition at line 3220 of file ole2.c.

3221 {
3222  return 1;
3223 }

◆ OleRun_Run()

static HRESULT WINAPI OleRun_Run ( IRunnableObject iface,
LPBINDCTX  ctx 
)
static

Definition at line 3231 of file ole2.c.

3232 {
3233  ok(ctx == NULL, "got %p\n", ctx);
3234  return 0xdeadc0de;
3235 }
smooth NULL
Definition: ftsmooth.c:416
#define ok(value,...)
Definition: atltest.h:57

◆ OleRun_SetContainedObject()

static HRESULT WINAPI OleRun_SetContainedObject ( IRunnableObject iface,
BOOL  contained 
)
static

Definition at line 3250 of file ole2.c.

3251 {
3252  ok(0, "unexpected\n");
3253  return E_NOTIMPL;
3254 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ read_clipformat()

static int read_clipformat ( IStream stream)
static

Definition at line 3971 of file ole2.c.

3972 {
3973  HRESULT hr;
3974  ULONG bytes;
3975  int length, clipformat = -2;
3976 
3977  hr = IStream_Read(stream, &length, sizeof(length), &bytes);
3978  if (hr != S_OK || bytes != sizeof(length))
3979  return -2;
3980  if (length == 0)
3981  return 0;
3982  if (length == -1)
3983  {
3984  hr = IStream_Read(stream, &clipformat, sizeof(clipformat), &bytes);
3985  if (hr != S_OK || bytes != sizeof(clipformat))
3986  return -2;
3987  }
3988  else
3989  ok(0, "unhandled clipformat length %d\n", length);
3990 
3991  return clipformat;
3992 }
HRESULT hr
Definition: shlfolder.c:183
static unsigned char bytes[4]
Definition: adnsresfilter.c:74
LONG HRESULT
Definition: typedefs.h:77
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
unsigned int ULONG
Definition: retypes.h:1

Referenced by check_storage_contents().

◆ START_TEST()

START_TEST ( ole2  )

Definition at line 4786 of file ole2.c.

4787 {
4788  DWORD dwRegister;
4789  IStorage *pStorage;
4790  STATSTG statstg;
4791  HRESULT hr;
4792 
4793  cf_test_1 = RegisterClipboardFormatA("cf_winetest_1");
4794  cf_test_2 = RegisterClipboardFormatA("cf_winetest_2");
4795  cf_test_3 = RegisterClipboardFormatA("cf_winetest_3");
4796 
4797  CoInitialize(NULL);
4798 
4799  hr = CoRegisterClassObject(&CLSID_Equation3, (IUnknown *)&OleObjectCF, CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, &dwRegister);
4800  ok_ole_success(hr, "CoRegisterClassObject");
4801 
4803  ok_ole_success(hr, "StgCreateDocfile");
4804 
4805  test_OleCreate(pStorage);
4806 
4807  hr = IStorage_Stat(pStorage, &statstg, STATFLAG_NONAME);
4808  ok_ole_success(hr, "IStorage_Stat");
4809  ok(IsEqualCLSID(&CLSID_Equation3, &statstg.clsid), "Wrong CLSID in storage\n");
4810 
4811  test_OleLoad(pStorage);
4812 
4813  IStorage_Release(pStorage);
4814 
4815  hr = CoRevokeClassObject(dwRegister);
4816  ok_ole_success(hr, "CoRevokeClassObject");
4817 
4819 
4820  test_data_cache();
4828  test_runnable();
4829  test_OleRun();
4831  test_OleDraw();
4837 
4838  CoUninitialize();
4839 }
static const CLSID CLSID_Equation3
Definition: ole2.c:894
#define ok_ole_success(hr, func)
Definition: ole2.c:36
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
static void test_data_cache_updatecache(void)
Definition: ole2.c:2644
#define STGM_CREATE
Definition: objbase.h:925
static void test_data_cache_save(void)
Definition: ole2.c:3740
static void test_data_cache_save_data(void)
Definition: ole2.c:4343
static void test_data_cache_cache(void)
Definition: ole2.c:2232
static const CLSID * Storage_SetClass_CLSID
Definition: ole2.c:71
static void test_default_handler(void)
Definition: ole2.c:2945
static void test_OleLoad(IStorage *pStorage)
Definition: ole2.c:1206
static void test_OleDraw(void)
Definition: ole2.c:3290
smooth NULL
Definition: ftsmooth.c:416
static void test_data_cache(void)
Definition: ole2.c:1692
static void test_runnable(void)
Definition: ole2.c:3151
#define STGM_DELETEONRELEASE
Definition: objbase.h:924
static void test_data_cache_dib_contents_stream(int num)
Definition: ole2.c:2123
static UINT cf_test_3
Definition: ole2.c:120
HRESULT WINAPI DECLSPEC_HOTPATCH CoRevokeClassObject(DWORD dwRegister)
Definition: compobj.c:1089
static const CLSID CLSID_WineTest
Definition: ole2.c:86
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_OleCreateStaticFromData(void)
Definition: ole2.c:4617
static IClassFactory OleObjectCF
Definition: ole2.c:822
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:4540
#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:2806
static void test_data_cache_initnew(void)
Definition: ole2.c:2530
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991
#define ok(value,...)
Definition: atltest.h:57
static void test_OleRun(void)
Definition: ole2.c:3270
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1897
static void test_OleCreate(IStorage *pStorage)
Definition: ole2.c:974
static UINT cf_test_1
Definition: ole2.c:120
static UINT cf_test_2
Definition: ole2.c:120
static void test_data_cache_init(void)
Definition: ole2.c:2485
static void test_OleLockRunning(void)
Definition: ole2.c:3282
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
static void test_OleDoAutoConvert(void)
Definition: ole2.c:3550

◆ stgmedium_cmp()

static HRESULT stgmedium_cmp ( const STGMEDIUM *  med1,
STGMEDIUM *  med2 
)
static

Definition at line 4102 of file ole2.c.

4103 {
4104  BYTE *data1, *data2;
4105  ULONG datasize1, datasize2;
4106 
4107  if (med1->tymed != med2->tymed)
4108  return E_FAIL;
4109 
4110  if (med1->tymed == TYMED_MFPICT)
4111  {
4112  METAFILEPICT *mfpict1 = GlobalLock(U(med1)->hMetaFilePict);
4113  METAFILEPICT *mfpict2 = GlobalLock(U(med2)->hMetaFilePict);
4114 
4115  datasize1 = GetMetaFileBitsEx(mfpict1->hMF, 0, NULL);
4116  datasize2 = GetMetaFileBitsEx(mfpict2->hMF, 0, NULL);
4117  if (datasize1 == datasize2)
4118  {
4119  data1 = HeapAlloc(GetProcessHeap(), 0, datasize1);
4120  data2 = HeapAlloc(GetProcessHeap(), 0, datasize2);
4121  GetMetaFileBitsEx(mfpict1->hMF, datasize1, data1);
4122  GetMetaFileBitsEx(mfpict2->hMF, datasize2, data2);
4123  }
4124  else return E_FAIL;
4125  }
4126  else if (med1->tymed == TYMED_ENHMF)
4127  {
4128  datasize1 = GetEnhMetaFileBits(med1->hEnhMetaFile, 0, NULL);
4129  datasize2 = GetEnhMetaFileBits(med2->hEnhMetaFile, 0, NULL);
4130  if (datasize1 == datasize2)
4131  {
4132  data1 = HeapAlloc(GetProcessHeap(), 0, datasize1);
4133  data2 = HeapAlloc(GetProcessHeap(), 0, datasize2);
4134  GetEnhMetaFileBits(med1->hEnhMetaFile, datasize1, data1);
4135  GetEnhMetaFileBits(med2->hEnhMetaFile, datasize2, data2);
4136  }
4137  else return E_FAIL;
4138  }
4139  else if (med1->tymed == TYMED_HGLOBAL)
4140  {
4141  datasize1 = GlobalSize(med1->hGlobal);
4142  datasize2 = GlobalSize(med2->hGlobal);
4143 
4144  if (datasize1 == datasize2)
4145  {
4146  data1 = GlobalLock(med1->hGlobal);
4147  data2 = GlobalLock(med2->hGlobal);
4148  }
4149  else
4150  return E_FAIL;
4151  }
4152  else
4153  return E_NOTIMPL;
4154 
4155  if (memcmp(data1, data2, datasize1) != 0)
4156  return E_FAIL;
4157 
4158  if (med1->tymed == TYMED_HGLOBAL)
4159  {
4160  GlobalUnlock(U(med1)->hGlobal);
4161  GlobalUnlock(U(med2)->hGlobal);
4162  }
4163  else if (med1->tymed == TYMED_MFPICT)
4164  {
4165  HeapFree(GetProcessHeap(), 0, data1);
4166  HeapFree(GetProcessHeap(), 0, data2);
4167  GlobalUnlock(U(med1)->hMetaFilePict);
4168  GlobalUnlock(U(med2)->hMetaFilePict);
4169  }
4170  else
4171  {
4172  HeapFree(GetProcessHeap(), 0, data1);
4173  HeapFree(GetProcessHeap(), 0, data2);
4174  }
4175 
4176  return S_OK;
4177 }
HMETAFILE hMF
Definition: wingdi.h:2603
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define U(x)
Definition: wordpad.c:44
Definition: tftpd.h:125
#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: mem.h:68
#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
Definition: tftpd.h:137

Referenced by test_data_cache_save_data().

◆ Storage_AddRef()

static ULONG WINAPI Storage_AddRef ( IStorage iface)
static

Definition at line 3318 of file ole2.c.

3319 {
3320  ok(0, "unexpected call to AddRef\n");
3321  return 2;
3322 }
#define ok(value,...)
Definition: atltest.h:57

◆ Storage_Commit()

static HRESULT WINAPI Storage_Commit ( IStorage iface,
DWORD  grfCommitFlags 
)
static

Definition at line 3452 of file ole2.c.

3453 {
3454  ok(0, "unexpected call to Commit\n");
3455  return E_NOTIMPL;
3456 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_CopyTo()

static HRESULT WINAPI Storage_CopyTo ( IStorage iface,
DWORD  ciidExclude,
const IID rgiidExclude,
SNB  snbExclude,
IStorage pstgDest 
)
static

Definition at line 3440 of file ole2.c.

3441 {
3442  ok(0, "unexpected call to CopyTo\n");
3443  return E_NOTIMPL;
3444 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_CreateStorage()

static HRESULT WINAPI Storage_CreateStorage ( IStorage iface,
LPCOLESTR  pwcsName,
DWORD  grfMode,
DWORD  dwStgFmt,
DWORD  reserved2,
IStorage **  ppstg 
)
static

Definition at line 3428 of file ole2.c.

3429 {
3430  ok(0, "unexpected call to CreateStorage\n");
3431  return E_NOTIMPL;
3432 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_CreateStream()

static HRESULT WINAPI Storage_CreateStream ( IStorage iface,
LPCOLESTR  pwcsName,
DWORD  grfMode,
DWORD  reserved1,
DWORD  reserved2,
IStream **  ppstm 
)
static

Definition at line 3330 of file ole2.c.

3331 {
3332  ULARGE_INTEGER size = {{0}};
3333  LARGE_INTEGER pos = {{0}};
3334  HRESULT hr;
3335 
3336  if (!lstrcmpW(pwcsName, comp_objW))
3337  {
3338  CHECK_EXPECT(Storage_CreateStream_CompObj);
3339  *ppstm = comp_obj_stream;
3340 
3341  todo_wine ok(grfMode == (STGM_CREATE|STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3342  }
3343  else if (!lstrcmpW(pwcsName, olepres0W))
3344  {
3345  CHECK_EXPECT(Storage_CreateStream_OlePres);
3346  *ppstm = olepres_stream;
3347 
3348  todo_wine ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3349  }
3350  else
3351  {
3352 todo_wine
3353  ok(0, "unexpected stream name %s\n", wine_dbgstr_w(pwcsName));
3354 #if 0 /* FIXME: return NULL once Wine is fixed */
3355  *ppstm = NULL;
3356  return E_NOTIMPL;
3357 #else
3358  *ppstm = contents_stream;
3359 #endif
3360  }
3361 
3362  ok(!reserved1, "reserved1 = %x\n", reserved1);
3363  ok(!reserved2, "reserved2 = %x\n", reserved2);
3364  ok(!!ppstm, "ppstm = NULL\n");
3365 
3366  IStream_AddRef(*ppstm);
3367  hr = IStream_Seek(*ppstm, pos, STREAM_SEEK_SET, NULL);
3368  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3369  hr = IStream_SetSize(*ppstm, size);
3370  ok(hr == S_OK, "IStream_SetSize returned %x\n", hr);
3371  return S_OK;
3372 }
static IStream * comp_obj_stream
Definition: ole2.c:3307
HRESULT hr
Definition: shlfolder.c:183
static IStream * contents_stream
Definition: ole2.c:3310
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
#define STGM_CREATE
Definition: objbase.h:925
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
uint8_t reserved2[12]
Definition: fsck.fat.h:58
static IStream * olepres_stream
Definition: ole2.c:3309
LONG HRESULT
Definition: typedefs.h:77
#define todo_wine
Definition: test.h:154
static const WCHAR olepres0W[]
Definition: ole2.c:3305
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:50
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR comp_objW[]
Definition: ole2.c:3306

◆ Storage_DestroyElement()

static HRESULT WINAPI Storage_DestroyElement ( IStorage iface,
LPCOLESTR  pwcsName 
)
static

Definition at line 3470 of file ole2.c.

3471 {
3472  char name[32];
3473  int stream_n, cmp;
3474 
3476  cmp = CompareStringW(LOCALE_NEUTRAL, 0, pwcsName, 8, olepres0W, 8);
3477  ok(cmp == CSTR_EQUAL,
3478  "unexpected call to DestroyElement(%s)\n", wine_dbgstr_w(pwcsName));
3479 
3480  WideCharToMultiByte(CP_ACP, 0, pwcsName, -1, name, sizeof(name), NULL, NULL);
3481  stream_n = atol(name + 8);
3482  if (stream_n <= Storage_DestroyElement_limit)
3483  return S_OK;
3484 
3485  return STG_E_FILENOTFOUND;
3486 }
#define WideCharToMultiByte
Definition: compat.h:101
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
#define CP_ACP
Definition: compat.h:99
#define cmp(status, error)
Definition: error.c:114
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: lang.c:2275
_Check_return_ long __cdecl atol(_In_z_ const char *_Str)
#define STG_E_FILENOTFOUND
Definition: winerror.h:2565
#define CSTR_EQUAL
Definition: winnls.h:453
static const WCHAR olepres0W[]
Definition: ole2.c:3305
#define S_OK
Definition: intsafe.h:59
static int Storage_DestroyElement_limit
Definition: ole2.c:72
static HRESULT WINAPI Storage_DestroyElement(IStorage *iface, LPCOLESTR pwcsName)
Definition: ole2.c:3470
#define ok(value,...)
Definition: atltest.h:57
Definition: name.c:36
#define LOCALE_NEUTRAL
#define CHECK_EXPECT2(func)
Definition: ole2.c:44

Referenced by test_data_cache_save().

◆ Storage_EnumElements()

static HRESULT WINAPI Storage_EnumElements ( IStorage iface,
DWORD  reserved1,
void reserved2,
DWORD  reserved3,
IEnumSTATSTG **  ppenum 
)
static

Definition at line 3464 of file ole2.c.

3465 {
3466  ok(0, "unexpected call to EnumElements\n");
3467  return E_NOTIMPL;
3468 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_MoveElementTo()

static HRESULT WINAPI Storage_MoveElementTo ( IStorage iface,
LPCOLESTR  pwcsName,
IStorage pstgDest,
LPCOLESTR  pwcsNewName,
DWORD  grfFlags 
)
static

Definition at line 3446 of file ole2.c.

3447 {
3448  ok(0, "unexpected call to MoveElementTo\n");
3449  return E_NOTIMPL;
3450 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_OpenStorage()

static HRESULT WINAPI Storage_OpenStorage ( IStorage iface,
LPCOLESTR  pwcsName,
IStorage pstgPriority,
DWORD  grfMode,
SNB  snbExclude,
DWORD  reserved,
IStorage **  ppstg 
)
static

Definition at line 3434 of file ole2.c.

3435 {
3436  ok(0, "unexpected call to OpenStorage\n");
3437  return E_NOTIMPL;
3438 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_OpenStream()

static HRESULT WINAPI Storage_OpenStream ( IStorage iface,
LPCOLESTR  pwcsName,
void reserved1,
DWORD  grfMode,
DWORD  reserved2,
IStream **  ppstm 
)
static

Definition at line 3374 of file ole2.c.

3375 {
3376  static const WCHAR ole1W[] = {1,'O','l','e',0};
3377 
3378  LARGE_INTEGER pos = {{0}};
3379  HRESULT hr;
3380 
3381  ok(!reserved1, "reserved1 = %p\n", reserved1);
3382  ok(!reserved2, "reserved2 = %x\n", reserved2);
3383  ok(!!ppstm, "ppstm = NULL\n");
3384 
3385  if(!lstrcmpW(pwcsName, comp_objW)) {
3386  CHECK_EXPECT2(Storage_OpenStream_CompObj);
3387  ok(grfMode == STGM_SHARE_EXCLUSIVE, "grfMode = %x\n", grfMode);
3388 
3389  *ppstm = comp_obj_stream;
3390  IStream_AddRef(comp_obj_stream);
3391  hr = IStream_Seek(comp_obj_stream, pos, STREAM_SEEK_SET, NULL);
3392  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3393  return S_OK;
3394  }else if(!lstrcmpW(pwcsName, ole1W)) {
3395  CHECK_EXPECT(Storage_OpenStream_Ole);
3396 
3397  if (!ole_stream)
3398  {
3399  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READ), "grfMode = %x\n", grfMode);
3400 
3401  *ppstm = NULL;
3402  return STG_E_FILENOTFOUND;
3403  }
3404 
3405  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3406 
3407  *ppstm = ole_stream;
3408  IStream_AddRef(ole_stream);
3409  hr = IStream_Seek(ole_stream, pos, STREAM_SEEK_SET, NULL);
3410  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3411  return S_OK;
3412 
3413  }else if(!lstrcmpW(pwcsName, olepres0W)) {
3414  CHECK_EXPECT(Storage_OpenStream_OlePres);
3415  ok(grfMode == (STGM_SHARE_EXCLUSIVE|STGM_READWRITE), "grfMode = %x\n", grfMode);
3416 
3417  *ppstm = olepres_stream;
3418  IStream_AddRef(olepres_stream);
3419  hr = IStream_Seek(olepres_stream, pos, STREAM_SEEK_SET, NULL);
3420  ok(hr == S_OK, "IStream_Seek returned %x\n", hr);
3421  return S_OK;
3422  }
3423 
3424  ok(0, "unexpected call to OpenStream: %s\n", wine_dbgstr_w(pwcsName));
3425  return E_NOTIMPL;
3426 }
static IStream * comp_obj_stream
Definition: ole2.c:3307
HRESULT hr
Definition: shlfolder.c:183
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
smooth NULL
Definition: ftsmooth.c:416
static IStream * ole_stream
Definition: ole2.c:3308
#define STGM_READ
Definition: objbase.h:916
uint8_t reserved2[12]
Definition: fsck.fat.h:58
__wchar_t WCHAR
Definition: xmlstorage.h:180
static IStream * olepres_stream
Definition: ole2.c:3309
LONG HRESULT
Definition: typedefs.h:77
#define STG_E_FILENOTFOUND
Definition: winerror.h:2565
static const WCHAR olepres0W[]
Definition: ole2.c:3305
#define STGM_READWRITE
Definition: objbase.h:918
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:50
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR comp_objW[]
Definition: ole2.c:3306
#define CHECK_EXPECT2(func)
Definition: ole2.c:44

◆ Storage_QueryInterface()

static HRESULT WINAPI Storage_QueryInterface ( IStorage iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 3312 of file ole2.c.

3313 {
3314  ok(0, "unexpected call to QueryInterface\n");
3315  return E_NOTIMPL;
3316 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_Release()

static ULONG WINAPI Storage_Release ( IStorage iface)
static

Definition at line 3324 of file ole2.c.

3325 {
3326  ok(0, "unexpected call to Release\n");
3327  return 1;
3328 }
#define ok(value,...)
Definition: atltest.h:57

◆ Storage_RenameElement()

static HRESULT WINAPI Storage_RenameElement ( IStorage iface,
LPCOLESTR  pwcsOldName,
LPCOLESTR  pwcsNewName 
)
static

Definition at line 3488 of file ole2.c.

3489 {
3490  ok(0, "unexpected call to RenameElement\n");
3491  return E_NOTIMPL;
3492 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_Revert()

static HRESULT WINAPI Storage_Revert ( IStorage iface)
static

Definition at line 3458 of file ole2.c.

3459 {
3460  ok(0, "unexpected call to Revert\n");
3461  return E_NOTIMPL;
3462 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_SetClass()

static HRESULT WINAPI Storage_SetClass ( IStorage iface,
REFCLSID  clsid 
)
static

Definition at line 3500 of file ole2.c.

3501 {
3503  ok(IsEqualIID(clsid, Storage_SetClass_CLSID), "expected %s, got %s\n",
3505  return S_OK;
3506 }
static HRESULT WINAPI Storage_SetClass(IStorage *iface, REFCLSID clsid)
Definition: ole2.c:3500
const char * wine_dbgstr_guid(const GUID *guid)
static const CLSID * Storage_SetClass_CLSID
Definition: ole2.c:71
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
#define CHECK_EXPECT(func)
Definition: ole2.c:50
#define ok(value,...)
Definition: atltest.h:57
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by test_OleDoAutoConvert().

◆ Storage_SetElementTimes()

static HRESULT WINAPI Storage_SetElementTimes ( IStorage iface,
LPCOLESTR  pwcsName,
const FILETIME pctime,
const FILETIME patime,
const FILETIME pmtime 
)
static

Definition at line 3494 of file ole2.c.

3495 {
3496  ok(0, "unexpected call to SetElementTimes\n");
3497  return E_NOTIMPL;
3498 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_SetStateBits()

static HRESULT WINAPI Storage_SetStateBits ( IStorage iface,
DWORD  grfStateBits,
DWORD  grfMask 
)
static

Definition at line 3508 of file ole2.c.

3509 {
3510  ok(0, "unexpected call to SetStateBits\n");
3511  return E_NOTIMPL;
3512 }
#define ok(value,...)
Definition: atltest.h:57
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ Storage_Stat()

static HRESULT WINAPI Storage_Stat ( IStorage iface,
STATSTG *  pstatstg,
DWORD  grfStatFlag 
)
static

Definition at line 3514 of file ole2.c.

3515 {
3517  ok(pstatstg != NULL, "pstatstg = NULL\n");
3518  ok(grfStatFlag == STATFLAG_NONAME, "grfStatFlag = %x\n", grfStatFlag);
3519 
3520  memset(pstatstg, 0, sizeof(STATSTG));
3521  pstatstg->type = STGTY_STORAGE;
3522  pstatstg->clsid = CLSID_WineTestOld;
3523  return S_OK;
3524 }
static HRESULT WINAPI Storage_Stat(IStorage *iface, STATSTG *pstatstg, DWORD grfStatFlag)
Definition: ole2.c:3514
static const CLSID CLSID_WineTestOld
Definition: ole2.c:78
smooth NULL
Definition: ftsmooth.c:416
#define S_OK
Definition: intsafe.h:59
#define ok(value,...)
Definition: atltest.h:57
#define CHECK_EXPECT2(func)
Definition: ole2.c:44
#define memset(x, y, z)
Definition: compat.h:39

Referenced by test_OleDoAutoConvert().

◆ test_data_cache()

static void test_data_cache ( void  )
static

Definition at line 1692 of file ole2.c.

1693 {
1694  HRESULT hr;
1695  IOleCache2 *pOleCache;
1696  IOleCache *olecache;
1697  IStorage *pStorage;
1698  IUnknown *unk, *unk2;
1699  IPersistStorage *pPS;
1700  IViewObject *pViewObject;
1701  IOleCacheControl *pOleCacheControl;
1702  IDataObject *pCacheDataObject;
1703  FORMATETC fmtetc;
1704  STGMEDIUM stgmedium;
1705  DWORD dwConnection;
1706  DWORD dwFreeze;
1707  RECTL rcBounds;
1708  HDC hdcMem;
1709  CLSID clsid;
1710  char szSystemDir[MAX_PATH];
1711  WCHAR wszPath[MAX_PATH];
1712  static const WCHAR wszShell32[] = {'\\','s','h','e','l','l','3','2','.','d','l','l',0};
1713 
1714  static const struct expected_method methods_cacheinitnew[] =
1715  {
1716  { "AdviseSink_OnViewChange", 0 },
1717  { "AdviseSink_OnViewChange", 0 },
1718  { "draw_continue", 1 },
1719  { "draw_continue_false", 1 },
1720  { "DataObject_DAdvise", 0 },
1721  { "DataObject_DAdvise", 0 },
1722  { "DataObject_DUnadvise", 0 },
1723  { "DataObject_DUnadvise", 0 },
1724  { NULL, 0 }
1725  };
1726  static const struct expected_method methods_cacheload[] =
1727  {
1728  { "AdviseSink_OnViewChange", 0 },
1729  { "draw_continue", 1 },
1730  { "draw_continue", 1 },
1731  { "draw_continue", 1 },
1732  { "DataObject_GetData", 0, { CF_DIB, NULL, DVASPECT_THUMBNAIL, -1, TYMED_HGLOBAL} },
1733  { "DataObject_GetData", 0, { CF_BITMAP, NULL, DVASPECT_THUMBNAIL, -1, TYMED_GDI} },
1734  { "DataObject_GetData", 0, { CF_METAFILEPICT, NULL, DVASPECT_ICON, -1, TYMED_MFPICT} },
1735  { NULL, 0 }
1736  };
1737  static const struct expected_method methods_cachethenrun[] =
1738  {
1739  { "DataObject_DAdvise", 0 },
1740  { "DataObject_DAdvise", 0 },
1741  { "DataObject_DAdvise", 0 },
1742  { "DataObject_DAdvise", 0 },
1743  { "DataObject_DUnadvise", 0 },
1744  { "DataObject_DUnadvise", 0 },
1745  { "DataObject_DUnadvise", 0 },
1746  { "DataObject_DUnadvise", 0 },
1747  { NULL, 0 }
1748  };
1749 
1750  GetSystemDirectoryA(szSystemDir, ARRAY_SIZE(szSystemDir));
1751 
1752  expected_method_list = methods_cacheinitnew;
1753 
1754  fmtetc.cfFormat = CF_METAFILEPICT;
1755  fmtetc.dwAspect = DVASPECT_ICON;
1756  fmtetc.lindex = -1;
1757  fmtetc.ptd = NULL;
1758  fmtetc.tymed = TYMED_MFPICT;
1759 
1761  ok_ole_success(hr, "StgCreateDocfile");
1762 
1763  /* aggregation */
1764 
1765  /* requested is not IUnknown */
1766  hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IOleCache2, (void**)&pOleCache);
1767  ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
1768 
1769  hr = CreateDataCache(&unknown, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
1770  ok(hr == S_OK, "got 0x%08x\n", hr);
1771 
1772  hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
1773  ok(hr == S_OK, "got 0x%08x\n", hr);
1774  hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
1775  ok(hr == S_OK, "got 0x%08x\n", hr);
1776  ok(unk != (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
1777  ok(unk != (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
1778  IOleCache2_Release(pOleCache);
1779  IOleCache_Release(olecache);
1780  IUnknown_Release(unk);
1781 
1782  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IUnknown, (void**)&unk);
1783  ok(hr == S_OK, "got 0x%08x\n", hr);
1784  hr = IUnknown_QueryInterface(unk, &IID_IOleCache, (void**)&olecache);
1785  ok(hr == S_OK, "got 0x%08x\n", hr);
1786  hr = IUnknown_QueryInterface(unk, &IID_IOleCache2, (void**)&pOleCache);
1787  ok(hr == S_OK, "got 0x%08x\n", hr);
1788  hr = IUnknown_QueryInterface(unk, &IID_IUnknown, (void**)&unk2);
1789  ok(hr == S_OK, "got 0x%08x\n", hr);
1790  ok(unk == (IUnknown*)olecache, "got %p, expected %p\n", olecache, unk);
1791  ok(unk == (IUnknown*)pOleCache, "got %p, expected %p\n", pOleCache, unk);
1792  ok(unk == unk2, "got %p, expected %p\n", unk2, unk);
1793  IUnknown_Release(unk2);
1794  IOleCache2_Release(pOleCache);
1795  IOleCache_Release(olecache);
1796  IUnknown_Release(unk);
1797 
1798  /* Test with new data */
1799 
1800  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1801  ok_ole_success(hr, "CreateDataCache");
1802 
1803  hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1804  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1805  hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1806  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1807  hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
1808  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
1809 
1810  hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1811  ok_ole_success(hr, "IViewObject_SetAdvise");
1812 
1813  hr = IPersistStorage_InitNew(pPS, pStorage);
1814  ok_ole_success(hr, "IPersistStorage_InitNew");
1815 
1816  hr = IPersistStorage_IsDirty(pPS);
1817  ok_ole_success(hr, "IPersistStorage_IsDirty");
1818 
1819  hr = IPersistStorage_GetClassID(pPS, &clsid);
1820  ok_ole_success(hr, "IPersistStorage_GetClassID");
1821  ok(IsEqualCLSID(&clsid, &IID_NULL), "clsid should be blank\n");
1822 
1823  hr = IOleCache2_Uncache(pOleCache, 0xdeadbeef);
1824  ok(hr == OLE_E_NOCONNECTION, "IOleCache_Uncache with invalid value should return OLE_E_NOCONNECTION instead of 0x%x\n", hr);
1825 
1826  /* Both tests crash on NT4 and below. StgCreatePropSetStg is only available on w2k and above. */
1827  if (GetProcAddress(GetModuleHandleA("ole32.dll"), "StgCreatePropSetStg"))
1828  {
1829  hr = IOleCache2_Cache(pOleCache, NULL, 0, &dwConnection);
1830  ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL fmtetc should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1831 
1832  hr = IOleCache2_Cache(pOleCache, NULL, 0, NULL);
1833  ok(hr == E_INVALIDARG, "IOleCache_Cache with NULL pdwConnection should have returned E_INVALIDARG instead of 0x%08x\n", hr);
1834  }
1835  else
1836  {
1837  skip("tests with NULL parameters will crash on NT4 and below\n");
1838  }
1839 
1840  for (fmtetc.cfFormat = CF_TEXT; fmtetc.cfFormat < CF_MAX; fmtetc.cfFormat++)
1841  {
1842  int i;
1843  fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1844  for (i = 0; i < 7; i++)
1845  {
1846  fmtetc.tymed = 1 << i;
1847  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1848  if ((fmtetc.cfFormat == CF_METAFILEPICT && fmtetc.tymed == TYMED_MFPICT) ||
1849  (fmtetc.cfFormat == CF_BITMAP && fmtetc.tymed == TYMED_GDI) ||
1850  (fmtetc.cfFormat == CF_DIB && fmtetc.tymed == TYMED_HGLOBAL) ||
1851  (fmtetc.cfFormat == CF_ENHMETAFILE && fmtetc.tymed == TYMED_ENHMF))
1852  ok(hr == S_OK, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned S_OK instead of 0x%08x\n",
1853  fmtetc.cfFormat, fmtetc.tymed, hr);
1854  else if (fmtetc.tymed == TYMED_HGLOBAL)
1856  broken(hr == S_OK && fmtetc.cfFormat == CF_BITMAP) /* Win9x & NT4 */,
1857  "IOleCache_Cache cfFormat = %d, tymed = %d should have returned CACHE_S_FORMATETC_NOTSUPPORTED instead of 0x%08x\n",
1858  fmtetc.cfFormat, fmtetc.tymed, hr);
1859  else
1860  ok(hr == DV_E_TYMED, "IOleCache_Cache cfFormat = %d, tymed = %d should have returned DV_E_TYMED instead of 0x%08x\n",
1861  fmtetc.cfFormat, fmtetc.tymed, hr);
1862  if (SUCCEEDED(hr))
1863  {
1864  hr = IOleCache2_Uncache(pOleCache, dwConnection);
1865  ok_ole_success(hr, "IOleCache_Uncache");
1866  }
1867  }
1868  }
1869 
1870  fmtetc.cfFormat = CF_BITMAP;
1871  fmtetc.dwAspect = DVASPECT_THUMBNAIL;
1872  fmtetc.tymed = TYMED_GDI;
1873  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1874  ok_ole_success(hr, "IOleCache_Cache");
1875 
1876  fmtetc.cfFormat = 0;
1877  fmtetc.dwAspect = DVASPECT_ICON;
1878  fmtetc.tymed = TYMED_MFPICT;
1879  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1880  ok_ole_success(hr, "IOleCache_Cache");
1881 
1882  MultiByteToWideChar(CP_ACP, 0, szSystemDir, -1, wszPath, ARRAY_SIZE(wszPath));
1883  memcpy(wszPath+lstrlenW(wszPath), wszShell32, sizeof(wszShell32));
1884 
1885  fmtetc.cfFormat = CF_METAFILEPICT;
1886  stgmedium.tymed = TYMED_MFPICT;
1887  U(stgmedium).hMetaFilePict = OleMetafilePictFromIconAndLabel(
1888  LoadIconA(NULL, (LPSTR)IDI_APPLICATION), wszPath, wszPath, 0);
1889  stgmedium.pUnkForRelease = NULL;
1890 
1891  fmtetc.dwAspect = DVASPECT_CONTENT;
1892  hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1893  ok(hr == OLE_E_BLANK, "IOleCache_SetData for aspect not in cache should have return OLE_E_BLANK instead of 0x%08x\n", hr);
1894 
1895  fmtetc.dwAspect = DVASPECT_ICON;
1896  hr = IOleCache2_SetData(pOleCache, &fmtetc, &stgmedium, FALSE);
1897  ok_ole_success(hr, "IOleCache_SetData");
1898  ReleaseStgMedium(&stgmedium);
1899 
1900  hr = IViewObject_Freeze(pViewObject, DVASPECT_ICON, -1, NULL, &dwFreeze);
1901  todo_wine {
1902  ok_ole_success(hr, "IViewObject_Freeze");
1903  hr = IViewObject_Freeze(pViewObject, DVASPECT_CONTENT, -1, NULL, &dwFreeze);
1904  ok(hr == OLE_E_BLANK, "IViewObject_Freeze with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1905  }
1906 
1907  rcBounds.left = 0;
1908  rcBounds.top = 0;
1909  rcBounds.right = 100;
1910  rcBounds.bottom = 100;
1912 
1913  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1914  ok_ole_success(hr, "IViewObject_Draw");
1915 
1916  hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1917  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1918 
1919  /* a NULL draw_continue fn ptr */
1920  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef);
1921  ok_ole_success(hr, "IViewObject_Draw");
1922 
1923  /* draw_continue that returns FALSE to abort drawing */
1924  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef);
1925  ok(hr == E_ABORT ||
1926  broken(hr == S_OK), /* win9x may skip the callbacks */
1927  "IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr);
1928 
1929  DeleteDC(hdcMem);
1930 
1931  hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);
1932  ok_ole_success(hr, "IOleCacheControl_OnRun");
1933 
1934  hr = IPersistStorage_Save(pPS, pStorage, TRUE);
1935  ok_ole_success(hr, "IPersistStorage_Save");
1936 
1937  hr = IPersistStorage_SaveCompleted(pPS, NULL);
1938  ok_ole_success(hr, "IPersistStorage_SaveCompleted");
1939 
1940  hr = IPersistStorage_IsDirty(pPS);
1941  ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1942 
1943  IPersistStorage_Release(pPS);
1944  IViewObject_Release(pViewObject);
1945  IOleCache2_Release(pOleCache);
1946  IOleCacheControl_Release(pOleCacheControl);
1947 
1949 
1950  /* Test with loaded data */
1951  trace("Testing loaded data with CreateDataCache:\n");
1952  expected_method_list = methods_cacheload;
1953 
1954  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
1955  ok_ole_success(hr, "CreateDataCache");
1956 
1957  hr = IOleCache2_QueryInterface(pOleCache, &IID_IPersistStorage, (LPVOID *)&pPS);
1958  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IPersistStorage)");
1959  hr = IOleCache2_QueryInterface(pOleCache, &IID_IViewObject, (LPVOID *)&pViewObject);
1960  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IViewObject)");
1961 
1962  hr = IViewObject_SetAdvise(pViewObject, DVASPECT_ICON, ADVF_PRIMEFIRST, &AdviseSink);
1963  ok_ole_success(hr, "IViewObject_SetAdvise");
1964 
1965  hr = IPersistStorage_Load(pPS, pStorage);
1966  ok_ole_success(hr, "IPersistStorage_Load");
1967 
1968  hr = IPersistStorage_IsDirty(pPS);
1969  ok(hr == S_FALSE, "IPersistStorage_IsDirty should have returned S_FALSE instead of 0x%x\n", hr);
1970 
1971  fmtetc.cfFormat = 0;
1972  fmtetc.dwAspect = DVASPECT_ICON;
1973  fmtetc.lindex = -1;
1974  fmtetc.ptd = NULL;
1975  fmtetc.tymed = TYMED_MFPICT;
1976  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
1977  ok(hr == CACHE_S_SAMECACHE, "IOleCache_Cache with already loaded data format type should return CACHE_S_SAMECACHE instead of 0x%x\n", hr);
1978 
1979  rcBounds.left = 0;
1980  rcBounds.top = 0;
1981  rcBounds.right = 100;
1982  rcBounds.bottom = 100;
1984 
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 
1988  hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1989  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
1990 
1991  /* unload the cached storage object, causing it to be reloaded */
1992  hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
1993  ok_ole_success(hr, "IOleCache2_DiscardCache");
1994  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
1995  ok_ole_success(hr, "IViewObject_Draw");
1996 
1997  /* unload the cached storage object, but don't allow it to be reloaded */
1998  hr = IPersistStorage_HandsOffStorage(pPS);
1999  ok_ole_success(hr, "IPersistStorage_HandsOffStorage");
2000  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
2001  ok_ole_success(hr, "IViewObject_Draw");
2002  hr = IOleCache2_DiscardCache(pOleCache, DISCARDCACHE_NOSAVE);
2003  ok_ole_success(hr, "IOleCache2_DiscardCache");
2004  hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
2005  ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
2006 
2007  DeleteDC(hdcMem);
2008 
2009  hr = IOleCache2_InitCache(pOleCache, &DataObject);
2010  ok(hr == CACHE_E_NOCACHE_UPDATED, "IOleCache_InitCache should have returned CACHE_E_NOCACHE_UPDATED instead of 0x%08x\n", hr);
2011 
2012  IPersistStorage_Release(pPS);
2013  IViewObject_Release(pViewObject);
2014  IOleCache2_Release(pOleCache);
2015 
2017 
2018  hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&pOleCache);
2019  ok_ole_success(hr, "CreateDataCache");
2020 
2021  expected_method_list = methods_cachethenrun;
2022 
2023  hr = IOleCache2_QueryInterface(pOleCache, &IID_IDataObject, (LPVOID *)&pCacheDataObject);
2024  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IDataObject)");
2025  hr = IOleCache2_QueryInterface(pOleCache, &IID_IOleCacheControl, (LPVOID *)&pOleCacheControl);
2026  ok_ole_success(hr, "IOleCache_QueryInterface(IID_IOleCacheControl)");
2027 
2028  fmtetc.cfFormat = CF_METAFILEPICT;
2029  fmtetc.dwAspect = DVASPECT_CONTENT;
2030  fmtetc.tymed = TYMED_MFPICT;
2031 
2032  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
2033  ok_ole_success(hr, "IOleCache_Cache");
2034 
2035  hr = IDataObject_GetData(pCacheDataObject, &fmtetc, &stgmedium);
2036  ok(hr == OLE_E_BLANK, "got %08x\n", hr);
2037 
2038  fmtetc.cfFormat = cf_test_1;
2039  fmtetc.dwAspect = DVASPECT_CONTENT;
2040  fmtetc.tymed = TYMED_HGLOBAL;
2041 
2042  hr = IOleCache2_Cache(pOleCache, &fmtetc, 0, &dwConnection);
2043  ok(hr == CACHE_S_FORMATETC_NOTSUPPORTED, "got %08x\n", hr);
2044