ReactOS 0.4.16-dev-292-gbbdcc14
ole2.h File Reference
#include <winerror.h>
#include <objbase.h>
#include <oleauto.h>
#include <oleidl.h>
Include dependency graph for ole2.h:

Go to the source code of this file.

Classes

struct  _OLESTREAMVTBL
 
struct  _OLESTREAM
 

Macros

#define E_DRAW   VIEW_E_DRAW
 
#define DATA_E_FORMATETC   DV_E_FORMATETC
 
#define OLEIVERB_PRIMARY   (0L)
 
#define OLEIVERB_SHOW   (-1L)
 
#define OLEIVERB_OPEN   (-2L)
 
#define OLEIVERB_HIDE   (-3L)
 
#define OLEIVERB_UIACTIVATE   (-4L)
 
#define OLEIVERB_INPLACEACTIVATE   (-5L)
 
#define OLEIVERB_DISCARDUNDOSTATE   (-6L)
 
#define OLEIVERB_PROPERTIES   (-7L)
 
#define EMBDHLP_INPROC_HANDLER   0x00000000
 
#define EMBDHLP_INPROC_SERVER   0x00000001
 
#define EMBDHLP_CREATENOW   0x00000000
 
#define EMBDHLP_DELAYCREATE   0x00010000
 

Typedefs

typedef struct _OLESTREAMLPOLESTREAM
 
typedef struct _OLESTREAMVTBL OLESTREAMVTBL
 
typedef OLESTREAMVTBLLPOLESTREAMVTBL
 
typedef struct _OLESTREAM OLESTREAM
 

Functions

HRESULT WINAPI RegisterDragDrop (HWND, LPDROPTARGET)
 
HRESULT WINAPI RevokeDragDrop (HWND)
 
HRESULT WINAPI DoDragDrop (LPDATAOBJECT, LPDROPSOURCE, DWORD, DWORD *)
 
HRESULT WINAPI OleLoadFromStream (IStream *pStm, REFIID iidInterface, void **ppvObj)
 
HRESULT WINAPI OleSaveToStream (IPersistStream *pPStm, IStream *pStm)
 
HOLEMENU WINAPI OleCreateMenuDescriptor (HMENU hmenuCombined, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 
HRESULT WINAPI OleDestroyMenuDescriptor (HOLEMENU hmenuDescriptor)
 
HRESULT WINAPI OleSetMenuDescriptor (HOLEMENU hmenuDescriptor, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
 
HRESULT WINAPI WriteClassStg (IStorage *pstg, REFCLSID rclsid)
 
HRESULT WINAPI ReadClassStg (IStorage *pstg, CLSID *pclsid)
 
HRESULT WINAPI WriteClassStm (IStream *pStm, REFCLSID rclsid)
 
HRESULT WINAPI ReadClassStm (IStream *pStm, CLSID *pclsid)
 
HRESULT WINAPI OleSave (LPPERSISTSTORAGE pPS, LPSTORAGE pStg, BOOL fSameAsLoad)
 
HRESULT WINAPI OleRegGetUserType (REFCLSID clsid, DWORD dwFormOfType, LPOLESTR *pszUserType)
 
HRESULT WINAPI OleRegGetMiscStatus (REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
 
HRESULT WINAPI OleRegEnumFormatEtc (REFCLSID clsid, DWORD dwDirection, LPENUMFORMATETC *ppenumFormatetc)
 
HRESULT WINAPI CreateStreamOnHGlobal (HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
 
HRESULT WINAPI GetHGlobalFromStream (LPSTREAM pstm, HGLOBAL *phglobal)
 
HRESULT WINAPI OleRegEnumVerbs (REFCLSID clsid, LPENUMOLEVERB *ppenum)
 
BOOL WINAPI OleIsRunning (LPOLEOBJECT pObject)
 
HRESULT WINAPI OleCreateLinkFromData (LPDATAOBJECT pSrcDataObj, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleSetContainedObject (LPUNKNOWN pUnknown, BOOL fContained)
 
HRESULT WINAPI OleNoteObjectVisible (LPUNKNOWN pUnknown, BOOL fVisible)
 
HRESULT WINAPI OleQueryLinkFromData (IDataObject *pSrcDataObject)
 
HRESULT WINAPI OleQueryCreateFromData (LPDATAOBJECT pSrcDataObject)
 
HRESULT WINAPI OleRun (LPUNKNOWN pUnknown)
 
HRESULT WINAPI OleDraw (LPUNKNOWN pUnknown, DWORD dwAspect, HDC hdcDraw, LPCRECT lprcBounds)
 
VOID WINAPI ReleaseStgMedium (LPSTGMEDIUM)
 
HRESULT WINAPI OleGetClipboard (IDataObject **ppDataObj)
 
HRESULT WINAPI OleIsCurrentClipboard (LPDATAOBJECT)
 
HRESULT WINAPI OleSetClipboard (LPDATAOBJECT)
 
HRESULT WINAPI OleCreateStaticFromData (LPDATAOBJECT pSrcDataObj, REFIID iid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI ReadFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
 
HRESULT WINAPI OleLoad (LPSTORAGE pStg, REFIID riid, LPOLECLIENTSITE pClientSite, LPVOID *ppvObj)
 
HRESULT WINAPI GetHGlobalFromILockBytes (LPLOCKBYTES plkbyt, HGLOBAL *phglobal)
 
HRESULT WINAPI CreateILockBytesOnHGlobal (HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPLOCKBYTES *pplkbyt)
 
HRESULT WINAPI CreateDataAdviseHolder (LPDATAADVISEHOLDER *ppDAHolder)
 
HGLOBAL WINAPI OleGetIconOfClass (REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel)
 
HGLOBAL WINAPI OleGetIconOfFile (LPOLESTR lpszPath, BOOL fUseFileAsLabel)
 
HGLOBAL WINAPI OleMetafilePictFromIconAndLabel (HICON hIcon, LPOLESTR lpszLabel, LPOLESTR lpszSourceFile, UINT iIconIndex)
 
HRESULT WINAPI OleLockRunning (LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
 
HRESULT WINAPI OleCreateFromFile (REFCLSID rclsid, LPCOLESTR lpszFileName, REFIID riid, DWORD renderopt, LPFORMATETC lpFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleCreateLink (LPMONIKER pmkLinkSrc, REFIID riid, DWORD renderopt, LPFORMATETC lpFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleCreate (REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleFlushClipboard (void)
 
HRESULT WINAPI GetConvertStg (LPSTORAGE pStg)
 
HRESULT WINAPI SetConvertStg (LPSTORAGE pStg, BOOL fConvert)
 
BOOL WINAPI IsAccelerator (HACCEL hAccel, int cAccelEntries, struct tagMSG *lpMsg, WORD *lpwCmd)
 
HRESULT WINAPI OleCreateLinkToFile (LPCOLESTR lpszFileName, REFIID riid, DWORD renderopt, LPFORMATETC lpFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HANDLE WINAPI OleDuplicateData (HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
 
HRESULT WINAPI WriteFmtUserTypeStg (LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
 
HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo, struct tagMSG *lpmsg)
 
HRESULT WINAPI OleCreateFromData (LPDATAOBJECT pSrcDataObj, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleCreateFromDataEx (LPDATAOBJECT pSrcDataObj, REFIID riid, DWORD dwFlags, DWORD renderopt, ULONG num_formats, DWORD *adv_flags, LPFORMATETC fmts, IAdviseSink *sink, DWORD *conns, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleCreateDefaultHandler (REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
 
HRESULT WINAPI OleCreateEmbeddingHelper (REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF, REFIID riid, LPVOID *ppvObj)
 
HRESULT WINAPI CreateOleAdviseHolder (LPOLEADVISEHOLDER *ppOAHolder)
 
HRESULT WINAPI OleInitialize (LPVOID pvReserved)
 
void WINAPI OleUninitialize (void)
 
BOOL WINAPI IsValidInterface (LPUNKNOWN punk)
 
DWORD WINAPI OleBuildVersion (VOID)
 
HRESULT WINAPI OleConvertOLESTREAMToIStorage (LPOLESTREAM lpolestream, LPSTORAGE pstg, const DVTARGETDEVICE *ptd)
 
HRESULT WINAPI OleConvertIStorageToOLESTREAM (LPSTORAGE pstg, LPOLESTREAM lpolestream)
 
HRESULT WINAPI OleDoAutoConvert (LPSTORAGE pStg, LPCLSID pClsidNew)
 
HRESULT WINAPI OleGetAutoConvert (REFCLSID clsidOld, LPCLSID pClsidNew)
 
HRESULT WINAPI OleSetAutoConvert (REFCLSID clsidOld, REFCLSID clsidNew)
 

Macro Definition Documentation

◆ DATA_E_FORMATETC

#define DATA_E_FORMATETC   DV_E_FORMATETC

Definition at line 36 of file ole2.h.

◆ E_DRAW

#define E_DRAW   VIEW_E_DRAW

Definition at line 35 of file ole2.h.

◆ EMBDHLP_CREATENOW

#define EMBDHLP_CREATENOW   0x00000000

Definition at line 49 of file ole2.h.

◆ EMBDHLP_DELAYCREATE

#define EMBDHLP_DELAYCREATE   0x00010000

Definition at line 50 of file ole2.h.

◆ EMBDHLP_INPROC_HANDLER

#define EMBDHLP_INPROC_HANDLER   0x00000000

Definition at line 47 of file ole2.h.

◆ EMBDHLP_INPROC_SERVER

#define EMBDHLP_INPROC_SERVER   0x00000001

Definition at line 48 of file ole2.h.

◆ OLEIVERB_DISCARDUNDOSTATE

#define OLEIVERB_DISCARDUNDOSTATE   (-6L)

Definition at line 44 of file ole2.h.

◆ OLEIVERB_HIDE

#define OLEIVERB_HIDE   (-3L)

Definition at line 41 of file ole2.h.

◆ OLEIVERB_INPLACEACTIVATE

#define OLEIVERB_INPLACEACTIVATE   (-5L)

Definition at line 43 of file ole2.h.

◆ OLEIVERB_OPEN

#define OLEIVERB_OPEN   (-2L)

Definition at line 40 of file ole2.h.

◆ OLEIVERB_PRIMARY

#define OLEIVERB_PRIMARY   (0L)

Definition at line 38 of file ole2.h.

◆ OLEIVERB_PROPERTIES

#define OLEIVERB_PROPERTIES   (-7L)

Definition at line 45 of file ole2.h.

◆ OLEIVERB_SHOW

#define OLEIVERB_SHOW   (-1L)

Definition at line 39 of file ole2.h.

◆ OLEIVERB_UIACTIVATE

#define OLEIVERB_UIACTIVATE   (-4L)

Definition at line 42 of file ole2.h.

Typedef Documentation

◆ LPOLESTREAM

Definition at line 149 of file ole2.h.

◆ LPOLESTREAMVTBL

Definition at line 154 of file ole2.h.

◆ OLESTREAM

◆ OLESTREAMVTBL

Function Documentation

◆ CreateDataAdviseHolder()

HRESULT WINAPI CreateDataAdviseHolder ( LPDATAADVISEHOLDER ppDAHolder)

◆ CreateILockBytesOnHGlobal()

HRESULT WINAPI CreateILockBytesOnHGlobal ( HGLOBAL  hGlobal,
BOOL  fDeleteOnRelease,
LPLOCKBYTES pplkbyt 
)

◆ CreateOleAdviseHolder()

HRESULT WINAPI CreateOleAdviseHolder ( LPOLEADVISEHOLDER *  ppOAHolder)

◆ CreateStreamOnHGlobal()

HRESULT WINAPI CreateStreamOnHGlobal ( HGLOBAL  hGlobal,
BOOL  fDeleteOnRelease,
LPSTREAM ppstm 
)

Definition at line 623 of file hglobalstream.c.

627{
629
630 if (!ppstm)
631 return E_INVALIDARG;
632
634 if (!This) return E_OUTOFMEMORY;
635
636 /* allocate a handle if one is not supplied */
637 if (!hGlobal)
639
640 This->handle = handle_create(hGlobal, fDeleteOnRelease);
641
642 /* start at the beginning */
643 This->currentPosition.u.HighPart = 0;
644 This->currentPosition.u.LowPart = 0;
645
646 *ppstm = &This->IStream_iface;
647
648 return S_OK;
649}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
static HGLOBALStreamImpl * HGLOBALStreamImpl_Create(void)
static struct handle_wrapper * handle_create(HGLOBAL hglobal, BOOL delete_on_release)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define S_OK
Definition: intsafe.h:52
#define GMEM_NODISCARD
Definition: winbase.h:328
#define GMEM_MOVEABLE
Definition: winbase.h:320
#define GMEM_SHARE
Definition: winbase.h:331

Referenced by apartment_hostobject_in_hostapt(), BindStatusCallback_OnStartBinding(), bsc_OnStartBinding(), CoMarshalInterThreadInterfaceInStream(), crash_couninitialize_proc(), create_decoder(), create_doc_with_string(), create_stream(), create_stream_from_map(), create_stream_from_string(), create_stream_on_data(), create_stream_on_file(), create_stream_on_mip_ro(), create_test_stream(), D3DXSaveSurfaceToFileInMemory(), DataObjectImpl_CreateComplex(), decode_base64(), decode_qp(), doc_load_string(), get_current_dataobject(), get_data_from_stream(), get_local_server_stream(), get_stgmed_for_stream(), get_travellog_stream(), HlinkClone(), init_memstream(), CTravelEntry::Invoke(), load_image(), load_string(), LresultFromObject(), marshal_stgmed(), marshal_WdtpInterfacePointer(), METAFILE_CreateCompressedImageStream(), MimeOleCreateVirtualStream(), BrowserNavigator::navigated(), ObjectFromLresult(), OLEClipbrd_Initialize(), RECORD_StreamFromFile(), RegisterDragDrop(), RPC_GetLocalClassObject(), RunningObjectTableImpl_Register(), StdGlobalInterfaceTable_RegisterInterfaceInGlobal(), test_apm(), test_bad_marshal_stream(), test_bom(), test_bsc_marshaling(), test_bufferrawformat(), test_call_from_message(), test_channel_hook(), test_client_security(), test_CoGetStandardMarshal(), test_CoMarshalInterface(), test_componentinfo(), test_copyto(), test_CoRegisterPSClsid(), test_CoUnmarshalInterface(), test_CoWaitForMultipleHandles_thread(), test_createfromstream(), test_data_cache_save(), test_decode_1bpp(), test_decode_24bpp(), test_decode_4bpp(), test_decode_adobe_cmyk(), test_decode_rle4(), test_decode_rle8(), test_DfMarshal_custom_marshaling(), test_disconnect_stub(), test_empty_image(), test_empty_image_2(), test_enhmetafile(), test_external_connection(), test_file_moniker(), test_freed_hglobal(), test_freethreadedmarshaler(), test_GdipLoadImageFromStream(), test_getdatahere(), test_GetDataHere_Proxy(), test_handler_marshaling(), test_hresult_marshaling(), test_implicit_mta(), test_InternetSecurityMarshalling(), test_interthread_marshal_and_unmarshal(), test_Invoke(), test_IPersistStream(), test_IStream_Clone(), test_load_save_bmp(), test_load_save_emf(), test_load_save_empty_picture(), test_load_save_icon(), test_loadwmf(), test_lock_object_external(), test_marshal(), test_marshal_and_unmarshal_invalid(), test_marshal_channel_buffer(), test_marshal_dispinterface(), test_marshal_proxy_apartment_shutdown(), test_marshal_proxy_mta_apartment_shutdown(), test_marshal_stub_apartment_shutdown(), test_message_filter(), test_metafile(), test_moniker(), test_multi_encoder(), test_multiframegif(), test_mxwriter_encoding(), test_mxwriter_flush(), test_mxwriter_stream(), test_no_couninitialize_client(), test_no_couninitialize_server(), test_no_marshaler(), test_normal_marshal_and_release(), test_normal_marshal_and_unmarshal(), test_normal_marshal_and_unmarshal_twice(), test_OleDoAutoConvert(), test_persist_save_data(), test_persiststreaminit(), test_pic(), test_pointer_moniker(), test_proxy_interfaces(), test_proxy_marshal_and_unmarshal(), test_proxy_marshal_and_unmarshal2(), test_proxy_marshal_and_unmarshal_strong(), test_proxy_marshal_and_unmarshal_weak(), test_proxy_used_in_wrong_thread(), test_ReadClassStm(), test_readerinput(), test_same_apartment_unmarshal_failure(), test_save(), test_save_history(), test_save_load_filemoniker(), test_StdMarshal_custom_marshaling(), test_streamonhglobal(), test_StreamOnIStream(), test_StreamOnStreamRange(), test_supported_encoders(), test_tablestrong_marshal_and_unmarshal_twice(), test_tableweak_and_normal_marshal_and_releasedata(), test_tableweak_and_normal_marshal_and_unmarshal(), test_tableweak_marshal_and_unmarshal_twice(), test_tableweak_marshal_releasedata1(), test_tableweak_marshal_releasedata2(), test_two_tableweak_marshal_and_releasedata(), test_typelibmarshal(), test_writeroutput(), test_writestartdocument(), test_xsltemplate(), union_tests(), unmarshal_stgmed(), CTravelEntry::Update(), WdtpInterfacePointer_UserMarshal(), WdtpInterfacePointer_UserUnmarshal(), window_proc(), writer_set_output(), and xslprocessor_transform().

◆ DoDragDrop()

HRESULT WINAPI DoDragDrop ( LPDATAOBJECT  ,
LPDROPSOURCE  ,
DWORD  ,
DWORD  
)

◆ GetConvertStg()

HRESULT WINAPI GetConvertStg ( LPSTORAGE  pStg)

◆ GetHGlobalFromILockBytes()

HRESULT WINAPI GetHGlobalFromILockBytes ( LPLOCKBYTES  plkbyt,
HGLOBAL phglobal 
)

◆ GetHGlobalFromStream()

HRESULT WINAPI GetHGlobalFromStream ( LPSTREAM  pstm,
HGLOBAL phglobal 
)

◆ IsAccelerator()

BOOL WINAPI IsAccelerator ( HACCEL  hAccel,
int  cAccelEntries,
struct tagMSG lpMsg,
WORD lpwCmd 
)

◆ IsValidInterface()

BOOL WINAPI IsValidInterface ( LPUNKNOWN  punk)

Definition at line 555 of file ifs.c.

556{
557 return !(
558 IsBadReadPtr(punk,4) ||
559 IsBadReadPtr(punk->lpVtbl,4) ||
560 IsBadReadPtr(punk->lpVtbl->QueryInterface,9) ||
561 IsBadCodePtr((FARPROC)punk->lpVtbl->QueryInterface)
562 );
563}
int(* FARPROC)()
Definition: compat.h:36
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:805
BOOL NTAPI IsBadCodePtr(FARPROC lpfn)
Definition: except.c:872

Referenced by MkParseDisplayName().

◆ OleBuildVersion()

DWORD WINAPI OleBuildVersion ( VOID  )

Definition at line 160 of file ole2.c.

161{
162 TRACE("Returning version %d, build %d.\n", rmm, rup);
163 return (rmm<<16)+rup;
164}
#define rup
Definition: ole2ver.h:42
#define rmm
Definition: ole2ver.h:41
#define TRACE(s)
Definition: solgame.cpp:4

◆ OleConvertIStorageToOLESTREAM()

HRESULT WINAPI OleConvertIStorageToOLESTREAM ( LPSTORAGE  pstg,
LPOLESTREAM  lpolestream 
)

Definition at line 10551 of file storage32.c.

10554{
10555 int i;
10556 HRESULT hRes = S_OK;
10557 IStream *pStream;
10558 OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
10559 static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
10560
10561 TRACE("%p %p\n", pstg, pOleStream);
10562
10563 memset(pOleStreamData, 0, sizeof(pOleStreamData));
10564
10565 if(pstg == NULL || pOleStream == NULL)
10566 {
10567 hRes = E_INVALIDARG;
10568 }
10569 if(hRes == S_OK)
10570 {
10571 /* Get the ProgID */
10572 pOleStreamData[0].dwOleTypeNameLength = OLESTREAM_MAX_STR_LEN;
10573 hRes = OLECONVERT_GetOLE10ProgID(pstg, pOleStreamData[0].strOleTypeName, &(pOleStreamData[0].dwOleTypeNameLength));
10574 }
10575 if(hRes == S_OK)
10576 {
10577 /* Was it originally Ole10 */
10578 hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
10579 if(hRes == S_OK)
10580 {
10581 IStream_Release(pStream);
10582 /* Get Presentation Data for Ole10Native */
10583 OLECONVERT_GetOle10PresData(pstg, pOleStreamData);
10584 }
10585 else
10586 {
10587 /* Get Presentation Data (OLE20) */
10588 OLECONVERT_GetOle20PresData(pstg, pOleStreamData);
10589 }
10590
10591 /* Save OLESTREAM */
10592 hRes = OLECONVERT_SaveOLE10(&(pOleStreamData[0]), pOleStream);
10593 if(hRes == S_OK)
10594 {
10595 hRes = OLECONVERT_SaveOLE10(&(pOleStreamData[1]), pOleStream);
10596 }
10597
10598 }
10599
10600 /* Free allocated memory */
10601 for(i=0; i < 2; i++)
10602 {
10603 HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
10604 }
10605
10606 return hRes;
10607}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
static void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
Definition: storage32.c:10324
static HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream)
Definition: storage32.c:9808
static void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
Definition: storage32.c:10377
static HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize)
Definition: storage32.c:10253
#define OLESTREAM_MAX_STR_LEN
Definition: storage32.c:9578
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
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:923
#define STGM_READ
Definition: objbase.h:917
#define memset(x, y, z)
Definition: compat.h:39
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1830
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ OleConvertOLESTREAMToIStorage()

HRESULT WINAPI OleConvertOLESTREAMToIStorage ( LPOLESTREAM  lpolestream,
LPSTORAGE  pstg,
const DVTARGETDEVICE *  ptd 
)

Definition at line 10460 of file storage32.c.

10464{
10465 int i;
10466 HRESULT hRes=S_OK;
10467 OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
10468
10469 TRACE("%p %p %p\n", pOleStream, pstg, ptd);
10470
10471 memset(pOleStreamData, 0, sizeof(pOleStreamData));
10472
10473 if(ptd != NULL)
10474 {
10475 FIXME("DVTARGETDEVICE is not NULL, unhandled parameter\n");
10476 }
10477
10478 if(pstg == NULL || pOleStream == NULL)
10479 {
10480 hRes = E_INVALIDARG;
10481 }
10482
10483 if(hRes == S_OK)
10484 {
10485 /* Load the OLESTREAM to Memory */
10486 hRes = OLECONVERT_LoadOLE10(pOleStream, &pOleStreamData[0], TRUE);
10487 }
10488
10489 if(hRes == S_OK)
10490 {
10491 /* Load the OLESTREAM to Memory (part 2)*/
10492 hRes = OLECONVERT_LoadOLE10(pOleStream, &pOleStreamData[1], FALSE);
10493 }
10494
10495 if(hRes == S_OK)
10496 {
10497
10498 if(pOleStreamData[0].dwDataLength > sizeof(STORAGE_magic))
10499 {
10500 /* Do we have the IStorage Data in the OLESTREAM */
10501 if(memcmp(pOleStreamData[0].pData, STORAGE_magic, sizeof(STORAGE_magic)) ==0)
10502 {
10503 OLECONVERT_GetOLE20FromOLE10(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10504 OLECONVERT_CreateOlePresStream(pstg, pOleStreamData[1].dwMetaFileWidth, pOleStreamData[1].dwMetaFileHeight, pOleStreamData[1].pData, pOleStreamData[1].dwDataLength);
10505 }
10506 else
10507 {
10508 /* It must be an original OLE 1.0 source */
10509 OLECONVERT_CreateOle10NativeStream(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10510 }
10511 }
10512 else
10513 {
10514 /* It must be an original OLE 1.0 source */
10515 OLECONVERT_CreateOle10NativeStream(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10516 }
10517
10518 /* Create CompObj Stream if necessary */
10519 hRes = OLECONVERT_CreateCompObjStream(pstg, pOleStreamData[0].strOleTypeName);
10520 if(hRes == S_OK)
10521 {
10522 /*Create the Ole Stream if necessary */
10523 STORAGE_CreateOleStream(pstg, 0);
10524 }
10525 }
10526
10527
10528 /* Free allocated memory */
10529 for(i=0; i < 2; i++)
10530 {
10531 HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
10532 HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
10533 pOleStreamData[i].pstrOleObjFileName = NULL;
10534 }
10535 return hRes;
10536}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, const BYTE *pData, DWORD dwDataLength)
Definition: storage32.c:10214
HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName)
Definition: storage32.c:10028
static HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA *pData, BOOL bStrem1)
Definition: storage32.c:9640
static const BYTE STORAGE_magic[8]
Definition: storage32.c:61
static void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, const BYTE *pBuffer, DWORD nBufferLength)
Definition: storage32.c:9919
HRESULT STORAGE_CreateOleStream(IStorage *storage, DWORD flags)
Definition: storage32.c:9207
static void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY, BYTE *pData, DWORD dwDataLength)
Definition: storage32.c:10130

◆ OleCreate()

HRESULT WINAPI OleCreate ( REFCLSID  rclsid,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  pFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

Definition at line 2609 of file ole2.c.

2617{
2618 HRESULT hres;
2619 IUnknown * pUnk = NULL;
2620 IOleObject *pOleObject = NULL;
2621
2622 TRACE("(%s, %s, %d, %p, %p, %p, %p)\n", debugstr_guid(rclsid),
2623 debugstr_guid(riid), renderopt, pFormatEtc, pClientSite, pStg, ppvObj);
2624
2625 hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, riid, (LPVOID*)&pUnk);
2626
2627 if (SUCCEEDED(hres))
2628 hres = IStorage_SetClass(pStg, rclsid);
2629
2630 if (pClientSite && SUCCEEDED(hres))
2631 {
2632 hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (LPVOID*)&pOleObject);
2633 if (SUCCEEDED(hres))
2634 {
2636 IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
2637 }
2638 }
2639
2640 if (SUCCEEDED(hres))
2641 {
2642 IPersistStorage * pPS;
2643 if (SUCCEEDED((hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
2644 {
2645 TRACE("trying to set stg %p\n", pStg);
2646 hres = IPersistStorage_InitNew(pPS, pStg);
2647 TRACE("-- result 0x%08x\n", hres);
2648 IPersistStorage_Release(pPS);
2649 }
2650 }
2651
2652 if (pClientSite && SUCCEEDED(hres))
2653 {
2654 TRACE("trying to set clientsite %p\n", pClientSite);
2655 hres = IOleObject_SetClientSite(pOleObject, pClientSite);
2656 TRACE("-- result 0x%08x\n", hres);
2657 }
2658
2659 if (pOleObject)
2660 IOleObject_Release(pOleObject);
2661
2662 if (((renderopt == OLERENDER_DRAW) || (renderopt == OLERENDER_FORMAT)) &&
2663 SUCCEEDED(hres))
2664 {
2665 hres = OleRun(pUnk);
2666 if (SUCCEEDED(hres))
2667 {
2668 IOleCache *pOleCache;
2669
2670 if (SUCCEEDED(IUnknown_QueryInterface(pUnk, &IID_IOleCache, (void **)&pOleCache)))
2671 {
2672 DWORD dwConnection;
2673 if (renderopt == OLERENDER_DRAW && !pFormatEtc) {
2674 FORMATETC pfe;
2675 pfe.cfFormat = 0;
2676 pfe.ptd = NULL;
2677 pfe.dwAspect = DVASPECT_CONTENT;
2678 pfe.lindex = -1;
2679 pfe.tymed = TYMED_NULL;
2680 hres = IOleCache_Cache(pOleCache, &pfe, ADVF_PRIMEFIRST, &dwConnection);
2681 }
2682 else
2683 hres = IOleCache_Cache(pOleCache, pFormatEtc, ADVF_PRIMEFIRST, &dwConnection);
2684 IOleCache_Release(pOleCache);
2685 }
2686 }
2687 }
2688
2689 if (FAILED(hres) && pUnk)
2690 {
2691 IUnknown_Release(pUnk);
2692 pUnk = NULL;
2693 }
2694
2695 *ppvObj = pUnk;
2696
2697 TRACE("-- %p\n", pUnk);
2698 return hres;
2699}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
HRESULT WINAPI DECLSPEC_HOTPATCH OleRun(LPUNKNOWN pUnknown)
Definition: ole2.c:1205
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hres
Definition: protocol.c:465
const GUID IID_IOleCache
const GUID IID_IPersistStorage
const GUID IID_IOleObject
DWORD dwStatus
Definition: mediaobj.idl:95

Referenced by InitWebBrowser(), test_OleCreate(), and UIINSERTOBJECTDLG_OnOpen().

◆ OleCreateDefaultHandler()

HRESULT WINAPI OleCreateDefaultHandler ( REFCLSID  clsid,
LPUNKNOWN  pUnkOuter,
REFIID  riid,
LPVOID ppvObj 
)

Definition at line 2287 of file defaulthandler.c.

2289{
2290 TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter,debugstr_guid(riid), ppvObj);
2292 NULL, riid, ppvObj);
2293}
HRESULT WINAPI OleCreateEmbeddingHelper(REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF, REFIID riid, LPVOID *ppvObj)
REFCLSID clsid
Definition: msctf.c:82
#define EMBDHLP_INPROC_HANDLER
Definition: ole2.h:47
#define EMBDHLP_CREATENOW
Definition: ole2.h:49

Referenced by add_icon_to_control(), HandlerCF_CreateInstance(), insert_static_object(), OleCreateStaticFromData(), OleLoad(), test_default_handler(), test_default_handler_run(), and test_olestream().

◆ OleCreateEmbeddingHelper()

HRESULT WINAPI OleCreateEmbeddingHelper ( REFCLSID  clsid,
LPUNKNOWN  pUnkOuter,
DWORD  flags,
IClassFactory pCF,
REFIID  riid,
LPVOID ppvObj 
)

Definition at line 2234 of file defaulthandler.c.

2241{
2242 DefaultHandler* newHandler = NULL;
2243 HRESULT hr = S_OK;
2244
2245 TRACE("(%s, %p, %08x, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter, flags, pCF, debugstr_guid(riid), ppvObj);
2246
2247 if (!ppvObj)
2248 return E_POINTER;
2249
2250 *ppvObj = NULL;
2251
2252 /*
2253 * If This handler is constructed for aggregation, make sure
2254 * the caller is requesting the IUnknown interface.
2255 * This is necessary because it's the only time the non-delegating
2256 * IUnknown pointer can be returned to the outside.
2257 */
2258 if (pUnkOuter && !IsEqualIID(&IID_IUnknown, riid))
2259 return CLASS_E_NOAGGREGATION;
2260
2261 /*
2262 * Try to construct a new instance of the class.
2263 */
2264 newHandler = DefaultHandler_Construct(clsid, pUnkOuter, flags, pCF);
2265
2266 if (!newHandler)
2267 return E_OUTOFMEMORY;
2268
2269 /*
2270 * Make sure it supports the interface required by the caller.
2271 */
2272 hr = IUnknown_QueryInterface(&newHandler->IUnknown_iface, riid, ppvObj);
2273
2274 /*
2275 * Release the reference obtained in the constructor. If
2276 * the QueryInterface was unsuccessful, it will free the class.
2277 */
2278 IUnknown_Release(&newHandler->IUnknown_iface);
2279
2280 return hr;
2281}
const GUID IID_IUnknown
static DefaultHandler * DefaultHandler_Construct(REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF)
GLbitfield flags
Definition: glext.h:7161
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT hr
Definition: shlfolder.c:183
IUnknown IUnknown_iface
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define E_POINTER
Definition: winerror.h:2365

Referenced by OleCreateDefaultHandler(), and test_default_handler().

◆ OleCreateFromData()

HRESULT WINAPI OleCreateFromData ( LPDATAOBJECT  pSrcDataObj,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  pFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

Definition at line 203 of file ole2impl.c.

207{
208 DWORD advf = ADVF_PRIMEFIRST;
209
210 return OleCreateFromDataEx(data, iid, 0, renderopt, fmt ? 1 : 0, fmt ? &advf : NULL,
211 fmt, NULL, NULL, client_site, stg, obj);
212}
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static IOleClientSite * client_site
Definition: activex.c:198
HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags, DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts, IAdviseSink *sink, DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2impl.c:177
Definition: dsound.c:943

Referenced by OleCreateLinkFromData(), OleCreateStaticFromData(), and test_OleCreateStaticFromData().

◆ OleCreateFromDataEx()

HRESULT WINAPI OleCreateFromDataEx ( LPDATAOBJECT  pSrcDataObj,
REFIID  riid,
DWORD  dwFlags,
DWORD  renderopt,
ULONG  num_formats,
DWORD adv_flags,
LPFORMATETC  fmts,
IAdviseSink sink,
DWORD conns,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

◆ OleCreateFromFile()

HRESULT WINAPI OleCreateFromFile ( REFCLSID  rclsid,
LPCOLESTR  lpszFileName,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  lpFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

◆ OleCreateLink()

HRESULT WINAPI OleCreateLink ( LPMONIKER  pmkLinkSrc,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  lpFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

Definition at line 47 of file ole2stubs.c.

49{
50 FIXME("(not shown), stub!\n");
51 return E_NOTIMPL;
52}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleCreateLinkFromData()

HRESULT WINAPI OleCreateLinkFromData ( LPDATAOBJECT  pSrcDataObj,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  pFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

◆ OleCreateLinkToFile()

HRESULT WINAPI OleCreateLinkToFile ( LPCOLESTR  lpszFileName,
REFIID  riid,
DWORD  renderopt,
LPFORMATETC  lpFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

Definition at line 36 of file ole2stubs.c.

39{
40 FIXME("(%p,%p,%i,%p,%p,%p,%p), stub!\n",lpszFileName, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj);
41 return E_NOTIMPL;
42}

◆ OleCreateMenuDescriptor()

HOLEMENU WINAPI OleCreateMenuDescriptor ( HMENU  hmenuCombined,
LPOLEMENUGROUPWIDTHS  lpMenuWidths 
)

Definition at line 1812 of file ole2.c.

1815{
1816 HOLEMENU hOleMenu;
1817 OleMenuDescriptor *pOleMenuDescriptor;
1818 int i;
1819
1820 if ( !hmenuCombined || !lpMenuWidths )
1821 return 0;
1822
1823 /* Create an OLE menu descriptor */
1824 if ( !(hOleMenu = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
1825 sizeof(OleMenuDescriptor) ) ) )
1826 return 0;
1827
1828 pOleMenuDescriptor = GlobalLock( hOleMenu );
1829 if ( !pOleMenuDescriptor )
1830 return 0;
1831
1832 /* Initialize menu group widths and hmenu */
1833 for ( i = 0; i < 6; i++ )
1834 pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
1835
1836 pOleMenuDescriptor->hmenuCombined = hmenuCombined;
1837 pOleMenuDescriptor->bIsServerItem = FALSE;
1838 GlobalUnlock( hOleMenu );
1839
1840 return hOleMenu;
1841}
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL bIsServerItem
Definition: ole2.c:83
HMENU hmenuCombined
Definition: ole2.c:82
OLEMENUGROUPWIDTHS mgw
Definition: ole2.c:81
#define GMEM_ZEROINIT
Definition: winbase.h:332

◆ OleCreateStaticFromData()

HRESULT WINAPI OleCreateStaticFromData ( LPDATAOBJECT  pSrcDataObj,
REFIID  iid,
DWORD  renderopt,
LPFORMATETC  pFormatEtc,
LPOLECLIENTSITE  pClientSite,
LPSTORAGE  pStg,
LPVOID ppvObj 
)

◆ OleDestroyMenuDescriptor()

HRESULT WINAPI OleDestroyMenuDescriptor ( HOLEMENU  hmenuDescriptor)

Definition at line 1847 of file ole2.c.

1849{
1850 if ( hmenuDescriptor )
1851 GlobalFree( hmenuDescriptor );
1852 return S_OK;
1853}
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611

◆ OleDoAutoConvert()

HRESULT WINAPI OleDoAutoConvert ( LPSTORAGE  pStg,
LPCLSID  pClsidNew 
)

Definition at line 2758 of file ole2.c.

2759{
2760 WCHAR *user_type_old, *user_type_new;
2761 CLIPFORMAT cf;
2762 STATSTG stat;
2763 CLSID clsid;
2764 HRESULT hr;
2765
2766 TRACE("(%p, %p)\n", pStg, pClsidNew);
2767
2769 if(!pStg)
2770 return E_INVALIDARG;
2771 hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME);
2772 if(FAILED(hr))
2773 return hr;
2774
2775 *pClsidNew = stat.clsid;
2776 hr = OleGetAutoConvert(&stat.clsid, &clsid);
2777 if(FAILED(hr))
2778 return hr;
2779
2780 hr = IStorage_SetClass(pStg, &clsid);
2781 if(FAILED(hr))
2782 return hr;
2783
2784 hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old);
2785 if(FAILED(hr)) {
2786 cf = 0;
2787 user_type_new = NULL;
2788 }
2789
2790 hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new);
2791 if(FAILED(hr))
2792 user_type_new = NULL;
2793
2794 hr = WriteFmtUserTypeStg(pStg, cf, user_type_new);
2795 CoTaskMemFree(user_type_new);
2796 if(FAILED(hr))
2797 {
2798 CoTaskMemFree(user_type_old);
2799 IStorage_SetClass(pStg, &stat.clsid);
2800 return hr;
2801 }
2802
2803 hr = SetConvertStg(pStg, TRUE);
2804 if(FAILED(hr))
2805 {
2806 WriteFmtUserTypeStg(pStg, cf, user_type_old);
2807 IStorage_SetClass(pStg, &stat.clsid);
2808 }
2809 else
2810 *pClsidNew = clsid;
2811 CoTaskMemFree(user_type_old);
2812 return hr;
2813}
#define stat
Definition: acwin.h:99
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:678
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
Definition: ole2.c:2704
HRESULT WINAPI ReadFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
Definition: storage32.c:9399
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
Definition: storage32.c:9356
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
Definition: storage32.c:10648
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
static LPCLSID pClsidNew
Definition: compobj.c:76
#define CLSID_NULL
Definition: guiddef.h:99
Definition: stat.h:55

Referenced by test_OleDoAutoConvert().

◆ OleDraw()

HRESULT WINAPI OleDraw ( LPUNKNOWN  pUnknown,
DWORD  dwAspect,
HDC  hdcDraw,
LPCRECT  lprcBounds 
)

◆ OleDuplicateData()

HANDLE WINAPI OleDuplicateData ( HANDLE  hSrc,
CLIPFORMAT  cfFormat,
UINT  uiFlags 
)

Definition at line 425 of file ole2impl.c.

427{
428 HANDLE hDst = NULL;
429
430 TRACE("(%p,%x,%x)\n", hSrc, cfFormat, uiFlags);
431
432 if (!uiFlags) uiFlags = GMEM_MOVEABLE;
433
434 switch (cfFormat)
435 {
436 case CF_ENHMETAFILE:
437 hDst = CopyEnhMetaFileW(hSrc, NULL);
438 break;
439 case CF_METAFILEPICT:
440 hDst = CopyMetaFileW(hSrc, NULL);
441 break;
442 case CF_PALETTE:
443 {
445 UINT nEntries = GetPaletteEntries(hSrc, 0, 0, NULL);
446 if (!nEntries) return NULL;
448 FIELD_OFFSET(LOGPALETTE, palPalEntry[nEntries]));
449 if (!logpalette) return NULL;
450 if (!GetPaletteEntries(hSrc, 0, nEntries, logpalette->palPalEntry))
451 {
453 return NULL;
454 }
455 logpalette->palVersion = 0x300;
456 logpalette->palNumEntries = (WORD)nEntries;
457
459
461 break;
462 }
463 case CF_BITMAP:
464 {
465 LONG size;
466 BITMAP bm;
467 if (!GetObjectW(hSrc, sizeof(bm), &bm))
468 return NULL;
469 size = GetBitmapBits(hSrc, 0, NULL);
470 if (!size) return NULL;
471 bm.bmBits = HeapAlloc(GetProcessHeap(), 0, size);
472 if (!bm.bmBits) return NULL;
473 if (GetBitmapBits(hSrc, size, bm.bmBits))
474 hDst = CreateBitmapIndirect(&bm);
475 HeapFree(GetProcessHeap(), 0, bm.bmBits);
476 break;
477 }
478 default:
479 {
480 SIZE_T size = GlobalSize(hSrc);
481 LPVOID pvSrc = NULL;
482 LPVOID pvDst = NULL;
483
484 /* allocate space for object */
485 if (!size) return NULL;
486 hDst = GlobalAlloc(uiFlags, size);
487 if (!hDst) return NULL;
488
489 /* lock pointers */
490 pvSrc = GlobalLock(hSrc);
491 if (!pvSrc)
492 {
493 GlobalFree(hDst);
494 return NULL;
495 }
496 pvDst = GlobalLock(hDst);
497 if (!pvDst)
498 {
499 GlobalUnlock(hSrc);
500 GlobalFree(hDst);
501 return NULL;
502 }
503 /* copy data */
504 memcpy(pvDst, pvSrc, size);
505
506 /* cleanup */
507 GlobalUnlock(hDst);
508 GlobalUnlock(hSrc);
509 }
510 }
511
512 TRACE("returning %p\n", hDst);
513 return hDst;
514}
#define CF_METAFILEPICT
Definition: constants.h:398
#define CF_BITMAP
Definition: constants.h:397
#define CF_PALETTE
Definition: constants.h:404
#define CF_ENHMETAFILE
Definition: constants.h:409
#define HeapAlloc
Definition: compat.h:733
unsigned short WORD
Definition: ntddk_ex.h:93
GLsizeiptr size
Definition: glext.h:5919
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const LOGPALETTE logpalette
Definition: clipboard.c:1346
unsigned int UINT
Definition: ndis.h:50
long LONG
Definition: pedump.c:60
Definition: bl.h:1331
WORD palNumEntries
Definition: wingdi.h:1834
WORD palVersion
Definition: wingdi.h:1833
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
HBITMAP WINAPI CreateBitmapIndirect(_In_ const BITMAP *pbm)
HENHMETAFILE WINAPI CopyEnhMetaFileW(_In_ HENHMETAFILE hemfSrc, _In_opt_ LPCWSTR pszFile)
HMETAFILE WINAPI CopyMetaFileW(_In_ HMETAFILE hmfSrc, _In_opt_ LPCWSTR pszFile)
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)

Referenced by copy_stg_medium(), and IDataObjectImpl::CopyMedium().

◆ OleFlushClipboard()

HRESULT WINAPI OleFlushClipboard ( void  )

Definition at line 2293 of file clipboard.c.

2294{
2295 HRESULT hr;
2296 ole_clipbrd *clipbrd;
2297 HWND wnd;
2298
2299 TRACE("()\n");
2300
2301 if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;
2302
2303 if(FAILED(hr = get_clipbrd_window(clipbrd, &wnd))) return hr;
2304
2305 /*
2306 * Already flushed or no source DataObject? Nothing to do.
2307 */
2308 if (!clipbrd->src_data) return S_OK;
2309
2310 if (!OpenClipboard(wnd)) return CLIPBRD_E_CANT_OPEN;
2311
2313
2315
2317 set_src_dataobject(clipbrd, NULL);
2318
2320
2321 return hr;
2322}
static HRESULT set_src_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1989
static HRESULT expose_marshalled_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1957
static HRESULT set_dataobject_format(HWND hwnd)
Definition: clipboard.c:2161
static HRESULT get_clipbrd_window(ole_clipbrd *clipbrd, HWND *wnd)
Definition: clipboard.c:1918
static HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd)
Definition: clipboard.c:186
IDataObject * src_data
Definition: clipboard.c:154
#define CLIPBRD_E_CANT_CLOSE
Definition: winerror.h:2770
#define CLIPBRD_E_CANT_OPEN
Definition: winerror.h:2766
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
BOOL WINAPI OpenClipboard(_In_opt_ HWND)
#define WM_RENDERALLFORMATS
Definition: winuser.h:1870
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by fnTextSrv_TxSetText(), CShellBrowser::OnDestroy(), SHFlushClipboard(), START_TEST(), test_consumer_refs(), test_flushed_getdata(), test_set_clipboard(), test_set_clipboard_DRAWCLIPBOARD(), and test_WM_PASTE().

◆ OleGetAutoConvert()

HRESULT WINAPI OleGetAutoConvert ( REFCLSID  clsidOld,
LPCLSID  pClsidNew 
)

Definition at line 2704 of file ole2.c.

2705{
2706 static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2707 HKEY hkey = NULL;
2709 LONG len;
2710 HRESULT res = S_OK;
2711
2712 res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey);
2713 if (FAILED(res))
2714 goto done;
2715
2716 len = sizeof(buf);
2717 if (RegQueryValueW(hkey, NULL, buf, &len))
2718 {
2720 goto done;
2721 }
2723done:
2724 if (hkey) RegCloseKey(hkey);
2725 return res;
2726}
#define RegCloseKey(hKey)
Definition: registry.h:49
#define CHARS_IN_GUID
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2448
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2338
GLuint res
Definition: glext.h:9613
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLsizei len
Definition: glext.h:6722
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694

Referenced by OleDoAutoConvert(), and test_OleDoAutoConvert().

◆ OleGetClipboard()

HRESULT WINAPI OleGetClipboard ( IDataObject **  ppDataObj)

Definition at line 2249 of file clipboard.c.

2250{
2251 HRESULT hr;
2252 ole_clipbrd *clipbrd;
2253 DWORD seq_no;
2254
2255 TRACE("(%p)\n", obj);
2256
2257 if(!obj) return E_INVALIDARG;
2258 *obj = NULL;
2259
2260 if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;
2261
2262 seq_no = GetClipboardSequenceNumber();
2264 if(clipbrd->latest_snapshot && clipbrd->latest_snapshot->seq_no != seq_no)
2265 clipbrd->latest_snapshot = NULL;
2266
2267 if(!clipbrd->latest_snapshot)
2268 {
2269 clipbrd->latest_snapshot = snapshot_construct(seq_no);
2270 if(!clipbrd->latest_snapshot)
2271 {
2273 return E_OUTOFMEMORY;
2274 }
2275 }
2276
2278 IDataObject_AddRef(*obj);
2280
2281 return S_OK;
2282}
static snapshot * snapshot_construct(DWORD seq_no)
Definition: clipboard.c:1726
static CRITICAL_SECTION latest_snapshot_cs
Definition: clipboard.c:177
EXTINLINE DWORD WINAPI GetClipboardSequenceNumber(VOID)
Definition: ntwrapper.h:202
snapshot * latest_snapshot
Definition: clipboard.c:151
IDataObject IDataObject_iface
Definition: clipboard.c:138
DWORD seq_no
Definition: clipboard.c:141
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

Referenced by CDefViewBckgrndMenu::_bCanPaste(), CDefaultContextMenu::DoPaste(), HasClipboardData(), OleUIPasteSpecialW(), paste_special(), test_complex_get_clipboard(), test_consumer_refs(), test_enum_fmtetc(), test_flushed_getdata(), test_get_clipboard(), test_get_clipboard_locked(), test_get_clipboard_uninitialized(), test_getdatahere(), test_multithreaded_clipboard(), and test_nonole_clipboard().

◆ OleGetIconOfClass()

HGLOBAL WINAPI OleGetIconOfClass ( REFCLSID  rclsid,
LPOLESTR  lpszLabel,
BOOL  fUseTypeAsLabel 
)

Definition at line 57 of file ole2stubs.c.

58{
59 FIXME("(%p,%p,%x), stub!\n", rclsid, lpszLabel, fUseTypeAsLabel);
60 return NULL;
61}

◆ OleGetIconOfFile()

HGLOBAL WINAPI OleGetIconOfFile ( LPOLESTR  lpszPath,
BOOL  fUseFileAsLabel 
)

Definition at line 66 of file ole2stubs.c.

67{
68 FIXME("(%s, %d), stub!\n", debugstr_w(path), use_file_as_label);
69 return NULL;
70}
#define debugstr_w
Definition: kernel32.h:32

◆ OleInitialize()

HRESULT WINAPI OleInitialize ( LPVOID  pvReserved)

Definition at line 169 of file ole2.c.

170{
171 HRESULT hr;
172
173 TRACE("(%p)\n", reserved);
174
175 /*
176 * The first duty of the OleInitialize is to initialize the COM libraries.
177 */
179
180 /*
181 * If the CoInitializeEx call failed, the OLE libraries can't be
182 * initialized.
183 */
184 if (FAILED(hr))
185 return hr;
186
187 if (!COM_CurrentInfo()->ole_inits)
188 hr = S_OK;
189 else
190 hr = S_FALSE;
191
192 /*
193 * Then, it has to initialize the OLE specific modules.
194 * This includes:
195 * Clipboard
196 * Drag and Drop
197 * Object linking and Embedding
198 * In-place activation
199 */
200 if (!COM_CurrentInfo()->ole_inits++ &&
202 {
203 /*
204 * Initialize the libraries.
205 */
206 TRACE("() - Initializing the OLE libraries\n");
207
208 /*
209 * OLE Clipboard
210 */
212
213 /*
214 * Drag and Drop
215 */
217
218 /*
219 * OLE shared menu
220 */
222 }
223
224 return hr;
225}
#define InterlockedIncrement
Definition: armddk.h:53
static struct oletls * COM_CurrentInfo(void)
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
static LONG OLE_moduleLockCount
Definition: ole2.c:101
void OLEClipbrd_Initialize(void)
Definition: clipboard.c:1781
static void OLEMenu_Initialize(void)
Definition: ole2.c:1411
static void OLEDD_Initialize(void)
Definition: ole2.c:2123
r reserved
Definition: btrfs.c:3006
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:278
#define S_FALSE
Definition: winerror.h:2357

Referenced by _tWinMain(), adv_install(), AtlAxWinInit(), AVIFileInit(), BrowserThreadProc(), CreateHelpViewer(), CDesktopThread::DesktopThreadProc(), display_cpl_sheets(), do_enum(), FileOpenDlgProc95(), hook_proc(), init_explorerbrowser(), ME_MakeEditor(), OleInit::OleInit(), SHRegisterDragDrop(), START_TEST(), StartWithDesktop(), test_CoCreateInstance(), test_CoInitializeEx(), test_consumer_refs(), test_DoDragDrop(), test_flushed_getdata(), test_get_clipboard_locked(), test_getdatahere(), test_multithreaded_clipboard(), test_nonole_clipboard(), test_ole_init_wndproc(), test_ole_initialization(), test_OleCreateFontIndirect(), test_OleInitialize_InitCounting(), test_Register_Revoke(), test_set_clipboard(), test_set_clipboard_DRAWCLIPBOARD(), test_TreatAsClass(), CHardErrorThread::ThreadProc(), and wWinMain().

◆ OleIsCurrentClipboard()

HRESULT WINAPI OleIsCurrentClipboard ( LPDATAOBJECT  )

◆ OleIsRunning()

BOOL WINAPI OleIsRunning ( LPOLEOBJECT  pObject)

Definition at line 2818 of file ole2.c.

2819{
2820 IRunnableObject *pRunnable;
2821 HRESULT hr;
2822 BOOL running;
2823
2824 TRACE("(%p)\n", object);
2825
2826 if (!object) return FALSE;
2827
2828 hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
2829 if (FAILED(hr))
2830 return TRUE;
2831 running = IRunnableObject_IsRunning(pRunnable);
2832 IRunnableObject_Release(pRunnable);
2833 return running;
2834}
unsigned int BOOL
Definition: ntddk_ex.h:94
const GUID IID_IRunnableObject

Referenced by test_runnable().

◆ OleLoad()

HRESULT WINAPI OleLoad ( LPSTORAGE  pStg,
REFIID  riid,
LPOLECLIENTSITE  pClientSite,
LPVOID ppvObj 
)

Definition at line 1224 of file ole2.c.

1229{
1230 IPersistStorage* persistStorage = NULL;
1231 IUnknown* pUnk;
1232 IOleObject* pOleObject = NULL;
1233 STATSTG storageInfo;
1234 HRESULT hres;
1235
1236 TRACE("(%p, %s, %p, %p)\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
1237
1238 *ppvObj = NULL;
1239
1240 /*
1241 * TODO, Conversion ... OleDoAutoConvert
1242 */
1243
1244 /*
1245 * Get the class ID for the object.
1246 */
1247 hres = IStorage_Stat(pStg, &storageInfo, STATFLAG_NONAME);
1248 if (FAILED(hres))
1249 return hres;
1250
1251 /*
1252 * Now, try and create the handler for the object
1253 */
1254 hres = CoCreateInstance(&storageInfo.clsid,
1255 NULL,
1256 CLSCTX_INPROC_HANDLER|CLSCTX_INPROC_SERVER,
1257 riid,
1258 (void**)&pUnk);
1259
1260 /*
1261 * If that fails, as it will most times, load the default
1262 * OLE handler.
1263 */
1264 if (FAILED(hres))
1265 {
1266 hres = OleCreateDefaultHandler(&storageInfo.clsid,
1267 NULL,
1268 riid,
1269 (void**)&pUnk);
1270 }
1271
1272 /*
1273 * If we couldn't find a handler... this is bad. Abort the whole thing.
1274 */
1275 if (FAILED(hres))
1276 return hres;
1277
1278 if (pClientSite)
1279 {
1280 hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (void **)&pOleObject);
1281 if (SUCCEEDED(hres))
1282 {
1284 hres = IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
1285 }
1286 }
1287
1288 /*
1289 * Initialize the object with its IPersistStorage interface.
1290 */
1291 hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (void**)&persistStorage);
1292 if (SUCCEEDED(hres))
1293 {
1294 hres = IPersistStorage_Load(persistStorage, pStg);
1295
1296 IPersistStorage_Release(persistStorage);
1297 persistStorage = NULL;
1298 }
1299
1300 if (SUCCEEDED(hres) && pClientSite)
1301 /*
1302 * Inform the new object of its client site.
1303 */
1304 hres = IOleObject_SetClientSite(pOleObject, pClientSite);
1305
1306 /*
1307 * Cleanup interfaces used internally
1308 */
1309 if (pOleObject)
1310 IOleObject_Release(pOleObject);
1311
1312 if (SUCCEEDED(hres))
1313 {
1314 IOleLink *pOleLink;
1315 HRESULT hres1;
1316 hres1 = IUnknown_QueryInterface(pUnk, &IID_IOleLink, (void **)&pOleLink);
1317 if (SUCCEEDED(hres1))
1318 {
1319 FIXME("handle OLE link\n");
1320 IOleLink_Release(pOleLink);
1321 }
1322 }
1323
1324 if (FAILED(hres))
1325 {
1326 IUnknown_Release(pUnk);
1327 pUnk = NULL;
1328 }
1329
1330 *ppvObj = pUnk;
1331
1332 return hres;
1333}
HRESULT WINAPI OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
const GUID IID_IOleLink

Referenced by OleCreateFromDataEx(), OleCreateFromFileEx(), and test_OleLoad().

◆ OleLoadFromStream()

HRESULT WINAPI OleLoadFromStream ( IStream pStm,
REFIID  iidInterface,
void **  ppvObj 
)

Definition at line 9129 of file storage32.c.

9130{
9131 CLSID clsid;
9132 HRESULT res;
9133 LPPERSISTSTREAM xstm;
9134
9135 TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(iidInterface),ppvObj);
9136
9137 res=ReadClassStm(pStm,&clsid);
9138 if (FAILED(res))
9139 return res;
9140 res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
9141 if (FAILED(res))
9142 return res;
9143 res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)&xstm);
9144 if (FAILED(res)) {
9145 IUnknown_Release((IUnknown*)*ppvObj);
9146 return res;
9147 }
9148 res=IPersistStream_Load(xstm,pStm);
9149 IPersistStream_Release(xstm);
9150 /* FIXME: all refcounts ok at this point? I think they should be:
9151 * pStm : unchanged
9152 * ppvObj : 1
9153 * xstm : 0 (released)
9154 */
9155 return res;
9156}
HRESULT WINAPI ReadClassStm(IStream *pStm, CLSID *pclsid)
Definition: storage32.c:9548
interface IPersistStream * LPPERSISTSTREAM
Definition: objfwd.h:16
const GUID IID_IPersistStream
Definition: proxy.cpp:13

Referenced by CompositeMonikerImpl_Load(), HlinkClone(), IPersistStream_fnLoad(), and CTrayBandSite::OnLoad().

◆ OleLockRunning()

HRESULT WINAPI OleLockRunning ( LPUNKNOWN  pUnknown,
BOOL  fLock,
BOOL  fLastUnlockCloses 
)

Definition at line 1377 of file ole2.c.

1378{
1380 HRESULT hres;
1381
1382 TRACE("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses);
1383
1384 hres = IUnknown_QueryInterface(pUnknown,
1386 (void**)&runnable);
1387
1388 if (SUCCEEDED(hres))
1389 {
1390 hres = IRunnableObject_LockRunning(runnable, fLock, fLastUnlockCloses);
1391
1392 IRunnableObject_Release(runnable);
1393
1394 return hres;
1395 }
1396
1397 return S_OK;
1398}
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
static IRunnableObject * runnable
Definition: ole2.c:76

Referenced by test_OleLockRunning().

◆ OleMetafilePictFromIconAndLabel()

HGLOBAL WINAPI OleMetafilePictFromIconAndLabel ( HICON  hIcon,
LPOLESTR  lpszLabel,
LPOLESTR  lpszSourceFile,
UINT  iIconIndex 
)

Definition at line 40 of file ole32_main.c.

42{
43 METAFILEPICT mfp;
44 HDC hdc;
45 HGLOBAL hmem = NULL;
46 LPVOID mfdata;
47 static const char szIconOnly[] = "IconOnly";
48 SIZE text_size = { 0, 0 };
49 INT width;
50 INT icon_width;
51 INT icon_height;
52 INT label_offset;
53 HDC hdcScreen;
54 LOGFONTW lf;
55 HFONT font;
56
57 TRACE("%p %p %s %d\n", hIcon, lpszLabel, debugstr_w(lpszSourceFile), iIconIndex);
58
59 if( !hIcon )
60 return NULL;
61
62 if (!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
63 return NULL;
64
66 if (!font)
67 return NULL;
68
70 if( !hdc )
71 {
73 return NULL;
74 }
75
77
78 ExtEscape(hdc, MFCOMMENT, sizeof(szIconOnly), szIconOnly, 0, NULL);
79
80 icon_width = GetSystemMetrics(SM_CXICON);
81 icon_height = GetSystemMetrics(SM_CYICON);
82 /* FIXME: should we give the label a bit of padding here? */
83 label_offset = icon_height;
84 if (lpszLabel)
85 {
86 HFONT screen_old_font;
87 /* metafile DCs don't support GetTextExtentPoint32, so size the font
88 * using the desktop window DC */
89 hdcScreen = GetDC(NULL);
90 screen_old_font = SelectObject(hdcScreen, font);
91 GetTextExtentPoint32W(hdcScreen, lpszLabel, lstrlenW(lpszLabel), &text_size);
92 SelectObject(hdcScreen, screen_old_font);
93 ReleaseDC(NULL, hdcScreen);
94
95 width = 3 * icon_width;
96 }
97 else
98 width = icon_width;
99
101 SetWindowOrgEx(hdc, 0, 0, NULL);
102 SetWindowExtEx(hdc, width, label_offset + text_size.cy, NULL);
103
104 /* draw the icon centered */
105 DrawIcon(hdc, (width-icon_width) / 2, 0, hIcon);
106 if(lpszLabel)
107 /* draw the label centered too, if provided */
108 TextOutW(hdc, (width-text_size.cx) / 2, label_offset, lpszLabel, lstrlenW(lpszLabel));
109
110 if (lpszSourceFile)
111 {
112 char szIconIndex[10];
113 int path_length = WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,NULL,0,NULL,NULL);
114 if (path_length > 1)
115 {
116 char * szPath = CoTaskMemAlloc(path_length * sizeof(CHAR));
117 if (szPath)
118 {
122 }
123 }
124 snprintf(szIconIndex, 10, "%u", iIconIndex);
125 ExtEscape(hdc, MFCOMMENT, strlen(szIconIndex)+1, szIconIndex, 0, NULL);
126 }
127
128 mfp.mm = MM_ANISOTROPIC;
129 hdcScreen = GetDC(NULL);
131 mfp.yExt = MulDiv(label_offset + text_size.cy, HIMETRIC_INCHES, GetDeviceCaps(hdcScreen, LOGPIXELSY));
132 ReleaseDC(NULL, hdcScreen);
133 mfp.hMF = CloseMetaFile(hdc);
135 if( !mfp.hMF )
136 return NULL;
137
138 hmem = GlobalAlloc( GMEM_MOVEABLE, sizeof(mfp) );
139 if( !hmem )
140 {
141 DeleteMetaFile(mfp.hMF);
142 return NULL;
143 }
144
145 mfdata = GlobalLock( hmem );
146 if( !mfdata )
147 {
148 GlobalFree( hmem );
149 DeleteMetaFile(mfp.hMF);
150 return NULL;
151 }
152
153 memcpy(mfdata,&mfp,sizeof(mfp));
154 GlobalUnlock( hmem );
155
156 TRACE("returning %p\n",hmem);
157
158 return hmem;
159}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static long path_length
Definition: maze.c:116
#define CP_ACP
Definition: compat.h:109
#define WideCharToMultiByte
Definition: compat.h:111
#define lstrlenW
Definition: compat.h:750
pKey DeleteObject()
GLint GLint GLsizei width
Definition: gl.h:1546
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
LPCWSTR szPath
Definition: env.c:37
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
HICON hIcon
Definition: msconfig.c:44
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
Definition: mk_font.cpp:20
#define HIMETRIC_INCHES
Definition: ole32_main.c:35
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
HMETAFILE hMF
Definition: wingdi.h:2608
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:532
#define LOGPIXELSY
Definition: wingdi.h:719
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
#define MM_ANISOTROPIC
Definition: wingdi.h:867
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)
#define LOGPIXELSX
Definition: wingdi.h:718
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
int WINAPI ExtEscape(_In_ HDC hdc, _In_ int iEscape, _In_ int cjInput, _In_reads_bytes_opt_(cjInput) LPCSTR lpInData, _In_ int cjOutput, _Out_writes_bytes_opt_(cjOutput) LPSTR lpOutData)
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
#define MFCOMMENT
Definition: wingdi.h:1008
#define snprintf
Definition: wintirpc.h:48
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:2070
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1383
#define SM_CYICON
Definition: winuser.h:976
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)
#define SM_CXICON
Definition: winuser.h:975
int WINAPI GetSystemMetrics(_In_ int)
char CHAR
Definition: xmlstorage.h:175

Referenced by test_data_cache().

◆ OleNoteObjectVisible()

HRESULT WINAPI OleNoteObjectVisible ( LPUNKNOWN  pUnknown,
BOOL  fVisible 
)

Definition at line 2839 of file ole2.c.

2840{
2841 TRACE("(%p, %s)\n", pUnknown, bVisible ? "TRUE" : "FALSE");
2842 return CoLockObjectExternal(pUnknown, bVisible, TRUE);
2843}
HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
Definition: compobj.c:3743

◆ OleQueryCreateFromData()

HRESULT WINAPI OleQueryCreateFromData ( LPDATAOBJECT  pSrcDataObject)

◆ OleQueryLinkFromData()

HRESULT WINAPI OleQueryLinkFromData ( IDataObject pSrcDataObject)

Definition at line 854 of file ole2.c.

856{
857 FIXME("(%p),stub!\n", pSrcDataObject);
858 return S_FALSE;
859}

◆ OleRegEnumFormatEtc()

HRESULT WINAPI OleRegEnumFormatEtc ( REFCLSID  clsid,
DWORD  dwDirection,
LPENUMFORMATETC ppenumFormatetc 
)

Definition at line 75 of file ole2stubs.c.

79{
80 FIXME("(%p, %d, %p), stub!\n", clsid, dwDirection, ppenumFormatetc);
81
82 return E_NOTIMPL;
83}

Referenced by DefaultHandler_EnumFormatEtc().

◆ OleRegEnumVerbs()

HRESULT WINAPI OleRegEnumVerbs ( REFCLSID  clsid,
LPENUMOLEVERB *  ppenum 
)

Definition at line 1125 of file ole2.c.

1126{
1127 LONG res;
1128 HKEY hkeyVerb;
1129 DWORD dwSubKeys;
1130 static const WCHAR wszVerb[] = {'V','e','r','b',0};
1131
1132 TRACE("(%s, %p)\n", debugstr_guid(clsid), ppenum);
1133
1134 res = COM_OpenKeyForCLSID(clsid, wszVerb, KEY_READ, &hkeyVerb);
1135 if (FAILED(res))
1136 {
1137 if (res == REGDB_E_CLASSNOTREG)
1138 ERR("CLSID %s not registered\n", debugstr_guid(clsid));
1139 else if (res == REGDB_E_KEYMISSING)
1140 ERR("no Verbs key for class %s\n", debugstr_guid(clsid));
1141 else
1142 ERR("failed to open Verbs key for CLSID %s with error %d\n",
1144 return res;
1145 }
1146
1147 res = RegQueryInfoKeyW(hkeyVerb, NULL, NULL, NULL, &dwSubKeys, NULL,
1148 NULL, NULL, NULL, NULL, NULL, NULL);
1149 if (res != ERROR_SUCCESS)
1150 {
1151 ERR("failed to get subkey count with error %d\n", GetLastError());
1152 return REGDB_E_READREGDB;
1153 }
1154
1155 if (!dwSubKeys)
1156 {
1157 WARN("class %s has no verbs\n", debugstr_guid(clsid));
1158 RegCloseKey(hkeyVerb);
1159 return OLEOBJ_E_NOVERBS;
1160 }
1161
1162 return EnumOLEVERB_Construct(hkeyVerb, 0, ppenum);
1163}
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3662
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1093
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define REGDB_E_READREGDB
Definition: winerror.h:2692
#define OLEOBJ_E_NOVERBS
Definition: winerror.h:2722

Referenced by DefaultHandler_EnumVerbs(), and SEALED_::IOleObject::EnumVerbs().

◆ OleRegGetMiscStatus()

HRESULT WINAPI OleRegGetMiscStatus ( REFCLSID  clsid,
DWORD  dwAspect,
DWORD pdwStatus 
)

Definition at line 864 of file ole2.c.

868{
869 static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
870 static const WCHAR dfmtW[] = {'%','d',0};
871 WCHAR keyName[16];
872 HKEY miscStatusKey;
873 HKEY aspectKey;
874 LONG result;
875 HRESULT hr;
876
877 TRACE("(%s, %d, %p)\n", debugstr_guid(clsid), dwAspect, pdwStatus);
878
879 if (!pdwStatus) return E_INVALIDARG;
880
881 *pdwStatus = 0;
882
883 if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
884
885 hr = COM_OpenKeyForCLSID(clsid, miscstatusW, KEY_READ, &miscStatusKey);
886 if (FAILED(hr))
887 /* missing key is not a failure */
888 return hr == REGDB_E_KEYMISSING ? S_OK : hr;
889
890 OLEUTL_ReadRegistryDWORDValue(miscStatusKey, pdwStatus);
891
892 /*
893 * Open the key specific to the requested aspect.
894 */
895 swprintf(keyName, dfmtW, dwAspect);
896
897 result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
898 if (result == ERROR_SUCCESS)
899 {
900 OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
901 RegCloseKey(aspectKey);
902 }
903
904 RegCloseKey(miscStatusKey);
905 return S_OK;
906}
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
Definition: compobj.c:254
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:420
static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD *pdwValue)
Definition: ole2.c:2526
#define swprintf
Definition: precomp.h:40
GLuint64EXT * result
Definition: glext.h:11304
static const WCHAR miscstatusW[]
Definition: actctx.c:670

Referenced by DefaultHandler_GetMiscStatus(), SEALED_::IOleObject::GetMiscStatus(), and test_OleRegGetMiscStatus().

◆ OleRegGetUserType()

HRESULT WINAPI OleRegGetUserType ( REFCLSID  clsid,
DWORD  dwFormOfType,
LPOLESTR pszUserType 
)

Definition at line 678 of file ole2.c.

679{
680 static const WCHAR auxusertypeW[] = {'A','u','x','U','s','e','r','T','y','p','e','\\','%','d',0};
681 DWORD valuetype, valuelen;
682 WCHAR auxkeynameW[16];
683 HKEY usertypekey;
685 LONG ret;
686
687 TRACE("(%s, %u, %p)\n", debugstr_guid(clsid), form, usertype);
688
689 if (!usertype)
690 return E_INVALIDARG;
691
692 *usertype = NULL;
693
694 /* Return immediately if it's not registered. */
695 hres = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &usertypekey);
696 if (FAILED(hres))
697 return hres;
698
699 valuelen = 0;
700
701 /* Try additional types if requested. If they don't exist fall back to USERCLASSTYPE_FULL. */
702 if (form != USERCLASSTYPE_FULL)
703 {
704 HKEY auxkey;
705
706 swprintf(auxkeynameW, auxusertypeW, form);
707 if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK)
708 {
709 if (!RegQueryValueExW(auxkey, emptyW, NULL, &valuetype, NULL, &valuelen) && valuelen)
710 {
711 RegCloseKey(usertypekey);
712 usertypekey = auxkey;
713 }
714 else
715 RegCloseKey(auxkey);
716 }
717 }
718
719 valuelen = 0;
720 if (RegQueryValueExW(usertypekey, emptyW, NULL, &valuetype, NULL, &valuelen))
721 {
722 RegCloseKey(usertypekey);
723 return REGDB_E_READREGDB;
724 }
725
726 *usertype = CoTaskMemAlloc(valuelen);
727 if (!*usertype)
728 {
729 RegCloseKey(usertypekey);
730 return E_OUTOFMEMORY;
731 }
732
733 ret = RegQueryValueExW(usertypekey,
734 emptyW,
735 NULL,
736 &valuetype,
737 (LPBYTE)*usertype,
738 &valuelen);
739 RegCloseKey(usertypekey);
740 if (ret != ERROR_SUCCESS)
741 {
742 CoTaskMemFree(*usertype);
743 *usertype = NULL;
744 return REGDB_E_READREGDB;
745 }
746
747 return S_OK;
748}
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
static const WCHAR emptyW[]
Definition: ole2.c:123
int form
Definition: main.c:89
unsigned char * LPBYTE
Definition: typedefs.h:53
int ret

Referenced by DefaultHandler_GetUserType(), get_descriptors(), SEALED_::IOleObject::GetUserType(), OleDoAutoConvert(), OleObject_GetUserType(), and test_OleRegGetUserType().

◆ OleRun()

HRESULT WINAPI OleRun ( LPUNKNOWN  pUnknown)

Definition at line 1205 of file ole2.c.

1206{
1207 IRunnableObject *runable;
1208 HRESULT hres;
1209
1210 TRACE("(%p)\n", pUnknown);
1211
1212 hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, (void**)&runable);
1213 if (FAILED(hres))
1214 return S_OK; /* Appears to return no error. */
1215
1216 hres = IRunnableObject_Run(runable, NULL);
1217 IRunnableObject_Release(runable);
1218 return hres;
1219}

Referenced by OleCreate(), START_TEST(), and test_OleRun().

◆ OleSave()

HRESULT WINAPI OleSave ( LPPERSISTSTORAGE  pPS,
LPSTORAGE  pStg,
BOOL  fSameAsLoad 
)

Definition at line 1338 of file ole2.c.

1342{
1343 HRESULT hres;
1344 CLSID objectClass;
1345
1346 TRACE("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad);
1347
1348 /*
1349 * First, we transfer the class ID (if available)
1350 */
1351 hres = IPersistStorage_GetClassID(pPS, &objectClass);
1352
1353 if (SUCCEEDED(hres))
1354 {
1355 WriteClassStg(pStg, &objectClass);
1356 }
1357
1358 /*
1359 * Then, we ask the object to save itself to the
1360 * storage. If it is successful, we commit the storage.
1361 */
1362 hres = IPersistStorage_Save(pPS, pStg, fSameAsLoad);
1363
1364 if (SUCCEEDED(hres))
1365 {
1366 IStorage_Commit(pStg,
1367 STGC_DEFAULT);
1368 }
1369
1370 return hres;
1371}
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
Definition: storage32.c:9078

◆ OleSaveToStream()

HRESULT WINAPI OleSaveToStream ( IPersistStream pPStm,
IStream pStm 
)

Definition at line 9164 of file storage32.c.

9165{
9166
9167 CLSID clsid;
9168 HRESULT res;
9169
9170 TRACE("(%p,%p)\n",pPStm,pStm);
9171
9172 res=IPersistStream_GetClassID(pPStm,&clsid);
9173
9174 if (SUCCEEDED(res)){
9175
9176 res=WriteClassStm(pStm,&clsid);
9177
9178 if (SUCCEEDED(res))
9179
9180 res=IPersistStream_Save(pPStm,pStm,TRUE);
9181 }
9182
9183 TRACE("Finished Save\n");
9184 return res;
9185}
HRESULT WINAPI WriteClassStm(IStream *pStm, REFCLSID rclsid)
Definition: storage32.c:9525

Referenced by CompositeMonikerImpl_Save(), HlinkClone(), and IPersistStream_fnSave().

◆ OleSetAutoConvert()

HRESULT WINAPI OleSetAutoConvert ( REFCLSID  clsidOld,
REFCLSID  clsidNew 
)

Definition at line 2731 of file ole2.c.

2732{
2733 static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2734 HKEY hkey = NULL;
2735 WCHAR szClsidNew[CHARS_IN_GUID];
2736 HRESULT res = S_OK;
2737
2738 TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
2739
2740 res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
2741 if (FAILED(res))
2742 goto done;
2743 StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
2744 if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR)))
2745 {
2747 goto done;
2748 }
2749
2750done:
2751 if (hkey) RegCloseKey(hkey);
2752 return res;
2753}
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5000
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#define REG_SZ
Definition: layer.c:22
#define KEY_WRITE
Definition: nt_native.h:1031
#define REGDB_E_WRITEREGDB
Definition: winerror.h:2693

Referenced by test_OleDoAutoConvert().

◆ OleSetClipboard()

HRESULT WINAPI OleSetClipboard ( LPDATAOBJECT  )

◆ OleSetContainedObject()

HRESULT WINAPI OleSetContainedObject ( LPUNKNOWN  pUnknown,
BOOL  fContained 
)

Definition at line 1168 of file ole2.c.

1171{
1173 HRESULT hres;
1174
1175 TRACE("(%p,%x)\n", pUnknown, fContained);
1176
1177 hres = IUnknown_QueryInterface(pUnknown,
1179 (void**)&runnable);
1180
1181 if (SUCCEEDED(hres))
1182 {
1183 hres = IRunnableObject_SetContainedObject(runnable, fContained);
1184
1185 IRunnableObject_Release(runnable);
1186
1187 return hres;
1188 }
1189
1190 return S_OK;
1191}

Referenced by InitWebBrowser().

◆ OleSetMenuDescriptor()

HRESULT WINAPI OleSetMenuDescriptor ( HOLEMENU  hmenuDescriptor,
HWND  hwndFrame,
HWND  hwndActiveObject,
LPOLEINPLACEFRAME  lpFrame,
LPOLEINPLACEACTIVEOBJECT  lpActiveObject 
)

Definition at line 1875 of file ole2.c.

1881{
1882 OleMenuDescriptor *pOleMenuDescriptor = NULL;
1883
1884 /* Check args */
1885 if ( !hwndFrame || (hOleMenu && !hwndActiveObject) )
1886 return E_INVALIDARG;
1887
1888 if ( lpFrame || lpActiveObject )
1889 {
1890 FIXME("(%p, %p, %p, %p, %p), Context sensitive help filtering not implemented!\n",
1891 hOleMenu,
1892 hwndFrame,
1893 hwndActiveObject,
1894 lpFrame,
1895 lpActiveObject);
1896 }
1897
1898 /* Set up a message hook to intercept the containers frame window messages.
1899 * The message filter is responsible for dispatching menu messages from the
1900 * shared menu which are intended for the object.
1901 */
1902
1903 if ( hOleMenu ) /* Want to install dispatching code */
1904 {
1905 /* If OLEMenu hooks are already installed for this thread, fail
1906 * Note: This effectively means that OleSetMenuDescriptor cannot
1907 * be called twice in succession on the same frame window
1908 * without first calling it with a null hOleMenu to uninstall
1909 */
1911 return E_FAIL;
1912
1913 /* Get the menu descriptor */
1914 pOleMenuDescriptor = GlobalLock( hOleMenu );
1915 if ( !pOleMenuDescriptor )
1916 return E_UNEXPECTED;
1917
1918 /* Update the menu descriptor */
1919 pOleMenuDescriptor->hwndFrame = hwndFrame;
1920 pOleMenuDescriptor->hwndActiveObject = hwndActiveObject;
1921
1922 GlobalUnlock( hOleMenu );
1923 pOleMenuDescriptor = NULL;
1924
1925 /* Add a menu descriptor windows property to the frame window */
1926 SetPropW( hwndFrame, prop_olemenuW, hOleMenu );
1927
1928 /* Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC */
1930 return E_FAIL;
1931 }
1932 else /* Want to uninstall dispatching code */
1933 {
1934 /* Uninstall the hooks */
1936 return E_FAIL;
1937
1938 /* Remove the menu descriptor property from the frame window */
1939 RemovePropW( hwndFrame, prop_olemenuW );
1940 }
1941
1942 return S_OK;
1943}
#define E_FAIL
Definition: ddrawi.h:102
static BOOL OLEMenu_InstallHooks(DWORD tid)
Definition: ole2.c:1431
static OleMenuHookItem * OLEMenu_IsHookInstalled(DWORD tid)
Definition: ole2.c:1523
static const WCHAR prop_olemenuW[]
Definition: ole2.c:112
static BOOL OLEMenu_UnInstallHooks(DWORD tid)
Definition: ole2.c:1481
HWND hwndActiveObject
Definition: ole2.c:80
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
#define E_UNEXPECTED
Definition: winerror.h:2456
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)

Referenced by test_ole_menu().

◆ OleTranslateAccelerator()

HRESULT WINAPI OleTranslateAccelerator ( LPOLEINPLACEFRAME  lpFrame,
LPOLEINPLACEFRAMEINFO  lpFrameInfo,
struct tagMSG lpmsg 
)

◆ OleUninitialize()

void WINAPI OleUninitialize ( void  )

Definition at line 230 of file ole2.c.

231{
232 TRACE("()\n");
233
234 if (COM_CurrentInfo()->ole_inits == 0)
235 {
236 WARN("ole_inits is already 0\n");
237 return ;
238 }
239 /*
240 * If we hit the bottom of the lock stack, free the libraries.
241 */
243 {
244 /*
245 * Actually free the libraries.
246 */
247 TRACE("() - Freeing the last reference count\n");
248
249 /*
250 * OLE Clipboard
251 */
253
254 /*
255 * OLE shared menu
256 */
258 }
259
260 /*
261 * Then, uninitialize the COM libraries.
262 */
264}
#define InterlockedDecrement
Definition: armddk.h:52
return
Definition: dirsup.c:529
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void OLEMenu_UnInitialize(void)
Definition: ole2.c:1420
void OLEClipbrd_UnInitialize(void)
Definition: clipboard.c:2027

Referenced by _tWinMain(), adv_install(), BrowserThreadProc(), CDesktopThread::DesktopThreadProc(), display_cpl_sheets(), do_enum(), GetFileName95(), hook_proc(), ME_DestroyEditor(), ReleaseHelpViewer(), CHardErrorThread::s_HardErrorThreadProc(), START_TEST(), StartWithDesktop(), test_CoCreateInstance(), test_CoInitializeEx(), test_consumer_refs(), test_DoDragDrop(), test_flushed_getdata(), test_get_clipboard_locked(), test_getdatahere(), test_multithreaded_clipboard(), test_nonole_clipboard(), test_ole_init_wndproc(), test_ole_initialization(), test_OleCreateFontIndirect(), test_OleInitialize_InitCounting(), test_Register_Revoke(), test_set_clipboard(), test_set_clipboard_DRAWCLIPBOARD(), test_TreatAsClass(), and OleInit::~OleInit().

◆ ReadClassStg()

HRESULT WINAPI ReadClassStg ( IStorage pstg,
CLSID pclsid 
)

Definition at line 9103 of file storage32.c.

9103 {
9104
9105 STATSTG pstatstg;
9106 HRESULT hRes;
9107
9108 TRACE("(%p, %p)\n", pstg, pclsid);
9109
9110 if(!pstg || !pclsid)
9111 return E_INVALIDARG;
9112
9113 /*
9114 * read a STATSTG structure (contains the clsid) from the storage
9115 */
9116 hRes=IStorage_Stat(pstg,&pstatstg,STATFLAG_NONAME);
9117
9118 if(SUCCEEDED(hRes))
9119 *pclsid=pstatstg.clsid;
9120
9121 return hRes;
9122}

Referenced by DataCache_InitNew(), DataCache_Load(), GetClassFile(), render_embed_source_hack(), and test_writeclassstg().

◆ ReadClassStm()

HRESULT WINAPI ReadClassStm ( IStream pStm,
CLSID pclsid 
)

Definition at line 9548 of file storage32.c.

9549{
9550 ULONG nbByte;
9551 HRESULT res;
9552
9553 TRACE("(%p,%p)\n",pStm,pclsid);
9554
9555 if (!pStm || !pclsid)
9556 return E_INVALIDARG;
9557
9558 /* clear the output args */
9559 *pclsid = CLSID_NULL;
9560
9561 res = IStream_Read(pStm, pclsid, sizeof(CLSID), &nbByte);
9562
9563 if (FAILED(res))
9564 return res;
9565
9566 if (nbByte != sizeof(CLSID))
9567 return STG_E_READFAULT;
9568 else
9569 return S_OK;
9570}
uint32_t ULONG
Definition: typedefs.h:59
#define STG_E_READFAULT
Definition: winerror.h:2576

Referenced by OleLoadFromStream(), ReadFmtUserTypeStg(), and test_ReadClassStm().

◆ ReadFmtUserTypeStg()

HRESULT WINAPI ReadFmtUserTypeStg ( LPSTORAGE  pstg,
CLIPFORMAT *  pcf,
LPOLESTR lplpszUserType 
)

Definition at line 9399 of file storage32.c.

9400{
9401 HRESULT r;
9402 IStream *stm = 0;
9403 static const WCHAR szCompObj[] = { 1, 'C','o','m','p','O','b','j', 0 };
9404 unsigned char unknown1[12];
9405 unsigned char unknown2[16];
9406 DWORD count;
9407 LPWSTR szProgIDName = NULL, szCLSIDName = NULL, szOleTypeName = NULL;
9408 CLSID clsid;
9409
9410 TRACE("(%p,%p,%p)\n", pstg, pcf, lplpszUserType);
9411
9412 r = IStorage_OpenStream( pstg, szCompObj, NULL,
9413 STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm );
9414 if( FAILED ( r ) )
9415 {
9416 WARN("Failed to open stream r = %08x\n", r);
9417 return r;
9418 }
9419
9420 /* read the various parts of the structure */
9421 r = IStream_Read( stm, unknown1, sizeof(unknown1), &count );
9422 if( FAILED( r ) || ( count != sizeof(unknown1) ) )
9423 goto end;
9424 r = ReadClassStm( stm, &clsid );
9425 if( FAILED( r ) )
9426 goto end;
9427
9428 r = STREAM_ReadString( stm, &szCLSIDName );
9429 if( FAILED( r ) )
9430 goto end;
9431
9432 r = STREAM_ReadString( stm, &szOleTypeName );
9433 if( FAILED( r ) )
9434 goto end;
9435
9436 r = STREAM_ReadString( stm, &szProgIDName );
9437 if( FAILED( r ) )
9438 goto end;
9439
9440 r = IStream_Read( stm, unknown2, sizeof(unknown2), &count );
9441 if( FAILED( r ) || ( count != sizeof(unknown2) ) )
9442 goto end;
9443
9444 /* ok, success... now we just need to store what we found */
9445 if( pcf )
9446 *pcf = RegisterClipboardFormatW( szOleTypeName );
9447
9448 if( lplpszUserType )
9449 {
9450 *lplpszUserType = szCLSIDName;
9451 szCLSIDName = NULL;
9452 }
9453
9454end:
9455 CoTaskMemFree( szCLSIDName );
9456 CoTaskMemFree( szOleTypeName );
9457 CoTaskMemFree( szProgIDName );
9458 IStream_Release( stm );
9459
9460 return r;
9461}
static HRESULT STREAM_ReadString(IStream *stm, LPWSTR *string)
Definition: storage32.c:9261
GLuint GLuint end
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
UINT WINAPI RegisterClipboardFormatW(_In_ LPCWSTR)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by OleDoAutoConvert().

◆ RegisterDragDrop()

HRESULT WINAPI RegisterDragDrop ( HWND  hwnd,
LPDROPTARGET  pDropTarget 
)

Definition at line 557 of file ole2.c.

558{
559 DWORD pid = 0;
560 HRESULT hr;
562 HANDLE map;
563 IDropTarget *wrapper;
564
565 TRACE("(%p,%p)\n", hwnd, pDropTarget);
566
567 if (!COM_CurrentApt())
568 {
569 ERR("COM not initialized\n");
570 return E_OUTOFMEMORY;
571 }
572
573 if (!pDropTarget)
574 return E_INVALIDARG;
575
576 if (!IsWindow(hwnd))
577 {
578 ERR("invalid hwnd %p\n", hwnd);
580 }
581
582 /* block register for other processes windows */
584 if (pid != GetCurrentProcessId())
585 {
586 FIXME("register for another process windows is disabled\n");
588 }
589
590 /* check if the window is already registered */
591 if (is_droptarget(hwnd))
593
594 /*
595 * Marshal the drop target pointer into a shared memory map and
596 * store the map's handle in a Wine specific window prop. We also
597 * store the drop target pointer itself in the
598 * "OleDropTargetInterface" prop for compatibility with Windows.
599 */
600
602 if(FAILED(hr)) return hr;
603
604 /* IDropTarget::QueryInterface() shouldn't be called, some (broken) apps depend on this. */
605 wrapper = WrapDropTarget( hwnd );
606 if(!wrapper)
607 {
608 IStream_Release(stream);
609 return E_OUTOFMEMORY;
610 }
611 hr = CoMarshalInterface(stream, &IID_IDropTarget, (IUnknown*)wrapper, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
612 IDropTarget_Release(wrapper);
613
614 if(SUCCEEDED(hr))
615 {
617 if(SUCCEEDED(hr))
618 {
619 IDropTarget_AddRef(pDropTarget);
620 SetPropW(hwnd, prop_oledroptarget, pDropTarget);
622 }
623 else
624 {
626 zero.QuadPart = 0;
627 IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
629 }
630 }
631 IStream_Release(stream);
632
633 return hr;
634}
Definition: _map.h:48
static APARTMENT * COM_CurrentApt(void)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:2055
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1876
static IDropTarget * WrapDropTarget(HWND hwnd)
Definition: ole2.c:518
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:116
static HRESULT create_map_from_stream(IStream *stream, HANDLE *map)
Definition: ole2.c:337
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:120
static BOOL is_droptarget(HWND hwnd)
Definition: ole2.c:291
int zero
Definition: sehframes.cpp:29
Definition: parse.h:23
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1158
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:2653
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:2654
BOOL WINAPI IsWindow(_In_opt_ HWND)

Referenced by DesktopShellView::InitDragDrop(), ShellBrowser::InitDragDrop(), CDefView::OnCreate(), SHRegisterDragDrop(), test_DoDragDrop(), and test_Register_Revoke().

◆ ReleaseStgMedium()

VOID WINAPI ReleaseStgMedium ( LPSTGMEDIUM  )

◆ RevokeDragDrop()

HRESULT WINAPI RevokeDragDrop ( HWND  hwnd)

Definition at line 639 of file ole2.c.

640{
641 HANDLE map;
643 IDropTarget *drop_target;
644 HRESULT hr;
645
646 TRACE("(%p)\n", hwnd);
647
648 if (!IsWindow(hwnd))
649 {
650 ERR("invalid hwnd %p\n", hwnd);
652 }
653
654 /* no registration data */
657
658 drop_target = GetPropW(hwnd, prop_oledroptarget);
659 if(drop_target) IDropTarget_Release(drop_target);
660
663
665 if(SUCCEEDED(hr))
666 {
668 IStream_Release(stream);
669 }
671
672 return hr;
673}
#define CloseHandle
Definition: compat.h:739
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:281
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:363
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:2652
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)

Referenced by CDefView::OnDestroy(), SHRevokeDragDrop(), test_Register_Revoke(), and DesktopShellView::~DesktopShellView().

◆ SetConvertStg()

HRESULT WINAPI SetConvertStg ( LPSTORAGE  pStg,
BOOL  fConvert 
)

◆ WriteClassStg()

HRESULT WINAPI WriteClassStg ( IStorage pstg,
REFCLSID  rclsid 
)

Definition at line 9078 of file storage32.c.

9079{
9080 if(!pStg)
9081 return E_INVALIDARG;
9082
9083 if(!rclsid)
9084 return STG_E_INVALIDPOINTER;
9085
9086 return IStorage_SetClass(pStg, rclsid);
9087}
#define STG_E_INVALIDPOINTER
Definition: winerror.h:2571

Referenced by OleCreateStaticFromData(), OleSave(), test_hglobal_storage_stat(), test_overwrite(), test_storage_refcount(), test_streamenum(), test_transacted_shared(), and test_writeclassstg().

◆ WriteClassStm()

HRESULT WINAPI WriteClassStm ( IStream pStm,
REFCLSID  rclsid 
)

Definition at line 9525 of file storage32.c.

9526{
9527 TRACE("(%p,%p)\n",pStm,rclsid);
9528
9529 if (!pStm || !rclsid)
9530 return E_INVALIDARG;
9531
9532 return IStream_Write(pStm,rclsid,sizeof(CLSID),NULL);
9533}

Referenced by OLECONVERT_CreateCompObjStream(), OleSaveToStream(), STORAGE_WriteCompObj(), and test_ReadClassStm().

◆ WriteFmtUserTypeStg()

HRESULT WINAPI WriteFmtUserTypeStg ( LPSTORAGE  pstg,
CLIPFORMAT  cf,
LPOLESTR  lpszUserType 
)

Definition at line 9356 of file storage32.c.

9358{
9359 STATSTG stat;
9360 HRESULT r;
9361 WCHAR szwClipName[0x40];
9362 CLSID clsid;
9363 LPWSTR wstrProgID = NULL;
9364 DWORD n;
9365
9366 TRACE("(%p,%x,%s)\n",pstg,cf,debugstr_w(lpszUserType));
9367
9368 /* get the clipboard format name */
9369 if( cf )
9370 {
9371 n = GetClipboardFormatNameW(cf, szwClipName, ARRAY_SIZE(szwClipName));
9372 szwClipName[n]=0;
9373 }
9374
9375 TRACE("Clipboard name is %s\n", debugstr_w(szwClipName));
9376
9377 r = IStorage_Stat(pstg, &stat, STATFLAG_NONAME);
9378 if(SUCCEEDED(r))
9379 clsid = stat.clsid;
9380 else
9381 clsid = CLSID_NULL;
9382
9383 ProgIDFromCLSID(&clsid, &wstrProgID);
9384
9385 TRACE("progid is %s\n",debugstr_w(wstrProgID));
9386
9387 r = STORAGE_WriteCompObj( pstg, &clsid, lpszUserType,
9388 cf ? szwClipName : NULL, wstrProgID );
9389
9390 CoTaskMemFree(wstrProgID);
9391
9392 return r;
9393}
#define ARRAY_SIZE(A)
Definition: main.h:20
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
Definition: compobj.c:2530
static HRESULT STORAGE_WriteCompObj(LPSTORAGE pstg, CLSID *clsid, LPCWSTR lpszUserType, LPCWSTR szClipName, LPCWSTR szProgIDName)
Definition: storage32.c:9309
GLdouble n
Definition: glext.h:7729
int WINAPI GetClipboardFormatNameW(_In_ UINT format, _Out_writes_(cchMaxCount) LPWSTR lpszFormatName, _In_ int cchMaxCount)

Referenced by OleCreateStaticFromData(), OleDoAutoConvert(), test_fmtusertypestg(), and test_OleDoAutoConvert().