ReactOS  0.4.12-dev-375-g61fed54
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 625 of file hglobalstream.c.

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

Referenced by _marshal_interface(), _unmarshal_interface(), 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_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_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_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_streamonhglobal(), 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 535 of file ifs.c.

536 {
537  return !(
538  IsBadReadPtr(punk,4) ||
539  IsBadReadPtr(punk->lpVtbl,4) ||
540  IsBadReadPtr(punk->lpVtbl->QueryInterface,9) ||
541  IsBadCodePtr((FARPROC)punk->lpVtbl->QueryInterface)
542  );
543 }
BOOL NTAPI IsBadCodePtr(FARPROC lpfn)
Definition: except.c:874
BOOL WINAPI IsBadReadPtr(IN LPCVOID lp, IN UINT_PTR ucb)
Definition: except.c:807
int(* FARPROC)()
Definition: compat.h:28

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 rmm
Definition: ole2ver.h:41
#define rup
Definition: ole2ver.h:42
#define TRACE(s)
Definition: solgame.cpp:4

◆ OleConvertIStorageToOLESTREAM()

HRESULT WINAPI OleConvertIStorageToOLESTREAM ( LPSTORAGE  pstg,
LPOLESTREAM  lpolestream 
)

Definition at line 10553 of file storage32.c.

10556 {
10557  int i;
10558  HRESULT hRes = S_OK;
10559  IStream *pStream;
10560  OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
10561  static const WCHAR wstrStreamName[] = {1, 'O', 'l', 'e', '1', '0', 'N', 'a', 't', 'i', 'v', 'e', 0};
10562 
10563  TRACE("%p %p\n", pstg, pOleStream);
10564 
10565  memset(pOleStreamData, 0, sizeof(pOleStreamData));
10566 
10567  if(pstg == NULL || pOleStream == NULL)
10568  {
10569  hRes = E_INVALIDARG;
10570  }
10571  if(hRes == S_OK)
10572  {
10573  /* Get the ProgID */
10574  pOleStreamData[0].dwOleTypeNameLength = OLESTREAM_MAX_STR_LEN;
10575  hRes = OLECONVERT_GetOLE10ProgID(pstg, pOleStreamData[0].strOleTypeName, &(pOleStreamData[0].dwOleTypeNameLength));
10576  }
10577  if(hRes == S_OK)
10578  {
10579  /* Was it originally Ole10 */
10580  hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream);
10581  if(hRes == S_OK)
10582  {
10583  IStream_Release(pStream);
10584  /* Get Presentation Data for Ole10Native */
10585  OLECONVERT_GetOle10PresData(pstg, pOleStreamData);
10586  }
10587  else
10588  {
10589  /* Get Presentation Data (OLE20) */
10590  OLECONVERT_GetOle20PresData(pstg, pOleStreamData);
10591  }
10592 
10593  /* Save OLESTREAM */
10594  hRes = OLECONVERT_SaveOLE10(&(pOleStreamData[0]), pOleStream);
10595  if(hRes == S_OK)
10596  {
10597  hRes = OLECONVERT_SaveOLE10(&(pOleStreamData[1]), pOleStream);
10598  }
10599 
10600  }
10601 
10602  /* Free allocated memory */
10603  for(i=0; i < 2; i++)
10604  {
10605  HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
10606  }
10607 
10608  return hRes;
10609 }
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:922
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void OLECONVERT_GetOle10PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
Definition: storage32.c:10326
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define OLESTREAM_MAX_STR_LEN
Definition: storage32.c:9580
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define STGM_READ
Definition: objbase.h:916
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
LONG HRESULT
Definition: typedefs.h:77
static HRESULT OLECONVERT_GetOLE10ProgID(LPSTORAGE pStorage, char *strProgID, DWORD *dwSize)
Definition: storage32.c:10255
static void OLECONVERT_GetOle20PresData(LPSTORAGE pStorage, OLECONVERT_OLESTREAM_DATA *pOleStreamData)
Definition: storage32.c:10379
#define S_OK
Definition: intsafe.h:59
static HRESULT OLECONVERT_SaveOLE10(OLECONVERT_OLESTREAM_DATA *pData, LPOLESTREAM pOleStream)
Definition: storage32.c:9810
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ OleConvertOLESTREAMToIStorage()

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

Definition at line 10462 of file storage32.c.

10466 {
10467  int i;
10468  HRESULT hRes=S_OK;
10469  OLECONVERT_OLESTREAM_DATA pOleStreamData[2];
10470 
10471  TRACE("%p %p %p\n", pOleStream, pstg, ptd);
10472 
10473  memset(pOleStreamData, 0, sizeof(pOleStreamData));
10474 
10475  if(ptd != NULL)
10476  {
10477  FIXME("DVTARGETDEVICE is not NULL, unhandled parameter\n");
10478  }
10479 
10480  if(pstg == NULL || pOleStream == NULL)
10481  {
10482  hRes = E_INVALIDARG;
10483  }
10484 
10485  if(hRes == S_OK)
10486  {
10487  /* Load the OLESTREAM to Memory */
10488  hRes = OLECONVERT_LoadOLE10(pOleStream, &pOleStreamData[0], TRUE);
10489  }
10490 
10491  if(hRes == S_OK)
10492  {
10493  /* Load the OLESTREAM to Memory (part 2)*/
10494  hRes = OLECONVERT_LoadOLE10(pOleStream, &pOleStreamData[1], FALSE);
10495  }
10496 
10497  if(hRes == S_OK)
10498  {
10499 
10500  if(pOleStreamData[0].dwDataLength > sizeof(STORAGE_magic))
10501  {
10502  /* Do we have the IStorage Data in the OLESTREAM */
10503  if(memcmp(pOleStreamData[0].pData, STORAGE_magic, sizeof(STORAGE_magic)) ==0)
10504  {
10505  OLECONVERT_GetOLE20FromOLE10(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10506  OLECONVERT_CreateOlePresStream(pstg, pOleStreamData[1].dwMetaFileWidth, pOleStreamData[1].dwMetaFileHeight, pOleStreamData[1].pData, pOleStreamData[1].dwDataLength);
10507  }
10508  else
10509  {
10510  /* It must be an original OLE 1.0 source */
10511  OLECONVERT_CreateOle10NativeStream(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10512  }
10513  }
10514  else
10515  {
10516  /* It must be an original OLE 1.0 source */
10517  OLECONVERT_CreateOle10NativeStream(pstg, pOleStreamData[0].pData, pOleStreamData[0].dwDataLength);
10518  }
10519 
10520  /* Create CompObj Stream if necessary */
10521  hRes = OLECONVERT_CreateCompObjStream(pstg, pOleStreamData[0].strOleTypeName);
10522  if(hRes == S_OK)
10523  {
10524  /*Create the Ole Stream if necessary */
10525  STORAGE_CreateOleStream(pstg, 0);
10526  }
10527  }
10528 
10529 
10530  /* Free allocated memory */
10531  for(i=0; i < 2; i++)
10532  {
10533  HeapFree(GetProcessHeap(),0,pOleStreamData[i].pData);
10534  HeapFree(GetProcessHeap(),0,pOleStreamData[i].pstrOleObjFileName);
10535  pOleStreamData[i].pstrOleObjFileName = NULL;
10536  }
10537  return hRes;
10538 }
#define TRUE
Definition: types.h:120
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static const BYTE STORAGE_magic[8]
Definition: storage32.c:62
GLenum GLclampf GLint i
Definition: glfuncs.h:14
#define FIXME(fmt,...)
Definition: debug.h:110
HRESULT STORAGE_CreateOleStream(IStorage *storage, DWORD flags)
Definition: storage32.c:9208
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static void OLECONVERT_CreateOle10NativeStream(LPSTORAGE pStorage, const BYTE *pData, DWORD dwDataLength)
Definition: storage32.c:10216
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
static void OLECONVERT_GetOLE20FromOLE10(LPSTORAGE pDestStorage, const BYTE *pBuffer, DWORD nBufferLength)
Definition: storage32.c:9921
LONG HRESULT
Definition: typedefs.h:77
static HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM pOleStream, OLECONVERT_OLESTREAM_DATA *pData, BOOL bStrem1)
Definition: storage32.c:9642
HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName)
Definition: storage32.c:10030
DWORD LONG void DVTARGETDEVICE * ptd
Definition: msvc.h:93
#define S_OK
Definition: intsafe.h:59
TW_UINT32 TW_UINT16 TW_UINT16 TW_MEMREF pData
Definition: twain.h:1827
#define memset(x, y, z)
Definition: compat.h:39
#define HeapFree(x, y, z)
Definition: compat.h:394
static void OLECONVERT_CreateOlePresStream(LPSTORAGE pStorage, DWORD dwExtentX, DWORD dwExtentY, BYTE *pData, DWORD dwDataLength)
Definition: storage32.c:10132

◆ OleCreate()

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

Definition at line 2469 of file ole2.c.

2477 {
2478  HRESULT hres;
2479  IUnknown * pUnk = NULL;
2480  IOleObject *pOleObject = NULL;
2481 
2482  TRACE("(%s, %s, %d, %p, %p, %p, %p)\n", debugstr_guid(rclsid),
2483  debugstr_guid(riid), renderopt, pFormatEtc, pClientSite, pStg, ppvObj);
2484 
2485  hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, riid, (LPVOID*)&pUnk);
2486 
2487  if (SUCCEEDED(hres))
2488  hres = IStorage_SetClass(pStg, rclsid);
2489 
2490  if (pClientSite && SUCCEEDED(hres))
2491  {
2492  hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (LPVOID*)&pOleObject);
2493  if (SUCCEEDED(hres))
2494  {
2495  DWORD dwStatus;
2496  IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
2497  }
2498  }
2499 
2500  if (SUCCEEDED(hres))
2501  {
2502  IPersistStorage * pPS;
2503  if (SUCCEEDED((hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
2504  {
2505  TRACE("trying to set stg %p\n", pStg);
2506  hres = IPersistStorage_InitNew(pPS, pStg);
2507  TRACE("-- result 0x%08x\n", hres);
2508  IPersistStorage_Release(pPS);
2509  }
2510  }
2511 
2512  if (pClientSite && SUCCEEDED(hres))
2513  {
2514  TRACE("trying to set clientsite %p\n", pClientSite);
2515  hres = IOleObject_SetClientSite(pOleObject, pClientSite);
2516  TRACE("-- result 0x%08x\n", hres);
2517  }
2518 
2519  if (pOleObject)
2520  IOleObject_Release(pOleObject);
2521 
2522  if (((renderopt == OLERENDER_DRAW) || (renderopt == OLERENDER_FORMAT)) &&
2523  SUCCEEDED(hres))
2524  {
2525  hres = OleRun(pUnk);
2526  if (SUCCEEDED(hres))
2527  {
2528  IOleCache *pOleCache;
2529 
2530  if (SUCCEEDED(IUnknown_QueryInterface(pUnk, &IID_IOleCache, (void **)&pOleCache)))
2531  {
2532  DWORD dwConnection;
2533  if (renderopt == OLERENDER_DRAW && !pFormatEtc) {
2534  FORMATETC pfe;
2535  pfe.cfFormat = 0;
2536  pfe.ptd = NULL;
2537  pfe.dwAspect = DVASPECT_CONTENT;
2538  pfe.lindex = -1;
2539  pfe.tymed = TYMED_NULL;
2540  hres = IOleCache_Cache(pOleCache, &pfe, ADVF_PRIMEFIRST, &dwConnection);
2541  }
2542  else
2543  hres = IOleCache_Cache(pOleCache, pFormatEtc, ADVF_PRIMEFIRST, &dwConnection);
2544  IOleCache_Release(pOleCache);
2545  }
2546  }
2547  }
2548 
2549  if (FAILED(hres) && pUnk)
2550  {
2551  IUnknown_Release(pUnk);
2552  pUnk = NULL;
2553  }
2554 
2555  *ppvObj = pUnk;
2556 
2557  TRACE("-- %p\n", pUnk);
2558  return hres;
2559 }
REFIID riid
Definition: precomp.h:44
HRESULT WINAPI DECLSPEC_HOTPATCH OleRun(LPUNKNOWN pUnknown)
Definition: ole2.c:1196
const GUID IID_IPersistStorage
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IOleObject
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
DWORD dwStatus
Definition: mediaobj.idl:95
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
const GUID IID_IOleCache
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ OleCreateDefaultHandler()

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

Definition at line 2288 of file defaulthandler.c.

2290 {
2291  TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter,debugstr_guid(riid), ppvObj);
2293  NULL, riid, ppvObj);
2294 }
HRESULT WINAPI OleCreateEmbeddingHelper(REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF, REFIID riid, LPVOID *ppvObj)
REFIID riid
Definition: precomp.h:44
#define EMBDHLP_CREATENOW
Definition: ole2.h:49
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define EMBDHLP_INPROC_HANDLER
Definition: ole2.h:47
REFCLSID clsid
Definition: msctf.c:84

Referenced by add_icon_to_control(), HandlerCF_CreateInstance(), insert_static_object(), 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 2235 of file defaulthandler.c.

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

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 }
static IOleClientSite * client_site
Definition: activex.c:198
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
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(), and 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 49 of file ole2stubs.c.

51 {
52  FIXME("(not shown), stub!\n");
53  return E_NOTIMPL;
54 }
#define FIXME(fmt,...)
Definition: debug.h:110
#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 38 of file ole2stubs.c.

41 {
42  FIXME("(%p,%p,%i,%p,%p,%p,%p), stub!\n",lpszFileName, riid, renderopt, lpFormatEtc, pClientSite, pStg, ppvObj);
43  return E_NOTIMPL;
44 }
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ OleCreateMenuDescriptor()

HOLEMENU WINAPI OleCreateMenuDescriptor ( HMENU  hmenuCombined,
LPOLEMENUGROUPWIDTHS  lpMenuWidths 
)

Definition at line 1803 of file ole2.c.

1806 {
1807  HOLEMENU hOleMenu;
1808  OleMenuDescriptor *pOleMenuDescriptor;
1809  int i;
1810 
1811  if ( !hmenuCombined || !lpMenuWidths )
1812  return 0;
1813 
1814  /* Create an OLE menu descriptor */
1815  if ( !(hOleMenu = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
1816  sizeof(OleMenuDescriptor) ) ) )
1817  return 0;
1818 
1819  pOleMenuDescriptor = GlobalLock( hOleMenu );
1820  if ( !pOleMenuDescriptor )
1821  return 0;
1822 
1823  /* Initialize menu group widths and hmenu */
1824  for ( i = 0; i < 6; i++ )
1825  pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
1826 
1827  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
1828  pOleMenuDescriptor->bIsServerItem = FALSE;
1829  GlobalUnlock( hOleMenu );
1830 
1831  return hOleMenu;
1832 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HMENU hmenuCombined
Definition: ole2.c:82
GLenum GLclampf GLint i
Definition: glfuncs.h:14
OLEMENUGROUPWIDTHS mgw
Definition: ole2.c:81
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL bIsServerItem
Definition: ole2.c:83
#define GMEM_MOVEABLE
Definition: winbase.h:291
#define GMEM_ZEROINIT
Definition: winbase.h:303

◆ 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 1838 of file ole2.c.

1840 {
1841  if ( hmenuDescriptor )
1842  GlobalFree( hmenuDescriptor );
1843  return S_OK;
1844 }
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define S_OK
Definition: intsafe.h:59

◆ OleDoAutoConvert()

HRESULT WINAPI OleDoAutoConvert ( LPSTORAGE  pStg,
LPCLSID  pClsidNew 
)

Definition at line 2618 of file ole2.c.

2619 {
2620  WCHAR *user_type_old, *user_type_new;
2621  CLIPFORMAT cf;
2622  STATSTG stat;
2623  CLSID clsid;
2624  HRESULT hr;
2625 
2626  TRACE("(%p, %p)\n", pStg, pClsidNew);
2627 
2628  *pClsidNew = CLSID_NULL;
2629  if(!pStg)
2630  return E_INVALIDARG;
2631  hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME);
2632  if(FAILED(hr))
2633  return hr;
2634 
2635  *pClsidNew = stat.clsid;
2636  hr = OleGetAutoConvert(&stat.clsid, &clsid);
2637  if(FAILED(hr))
2638  return hr;
2639 
2640  hr = IStorage_SetClass(pStg, &clsid);
2641  if(FAILED(hr))
2642  return hr;
2643 
2644  hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old);
2645  if(FAILED(hr)) {
2646  cf = 0;
2647  user_type_new = NULL;
2648  }
2649 
2650  hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new);
2651  if(FAILED(hr))
2652  user_type_new = NULL;
2653 
2654  hr = WriteFmtUserTypeStg(pStg, cf, user_type_new);
2655  CoTaskMemFree(user_type_new);
2656  if(FAILED(hr))
2657  {
2658  CoTaskMemFree(user_type_old);
2659  IStorage_SetClass(pStg, &stat.clsid);
2660  return hr;
2661  }
2662 
2663  hr = SetConvertStg(pStg, TRUE);
2664  if(FAILED(hr))
2665  {
2666  WriteFmtUserTypeStg(pStg, cf, user_type_old);
2667  IStorage_SetClass(pStg, &stat.clsid);
2668  }
2669  else
2670  *pClsidNew = clsid;
2671  CoTaskMemFree(user_type_old);
2672  return hr;
2673 }
static IClassFactory * cf
static LPCLSID pClsidNew
Definition: compobj.c:77
#define TRUE
Definition: types.h:120
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
Definition: storage32.c:9357
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
Definition: storage32.c:10650
__wchar_t WCHAR
Definition: xmlstorage.h:180
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
Definition: ole2.c:2564
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define CLSID_NULL
Definition: guiddef.h:94
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:672
HRESULT WINAPI ReadFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
Definition: storage32.c:9401

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 332 of file ole2impl.c.

334 {
335  HANDLE hDst = NULL;
336 
337  TRACE("(%p,%x,%x)\n", hSrc, cfFormat, uiFlags);
338 
339  if (!uiFlags) uiFlags = GMEM_MOVEABLE;
340 
341  switch (cfFormat)
342  {
343  case CF_ENHMETAFILE:
344  hDst = CopyEnhMetaFileW(hSrc, NULL);
345  break;
346  case CF_METAFILEPICT:
347  hDst = CopyMetaFileW(hSrc, NULL);
348  break;
349  case CF_PALETTE:
350  {
352  UINT nEntries = GetPaletteEntries(hSrc, 0, 0, NULL);
353  if (!nEntries) return NULL;
355  FIELD_OFFSET(LOGPALETTE, palPalEntry[nEntries]));
356  if (!logpalette) return NULL;
357  if (!GetPaletteEntries(hSrc, 0, nEntries, logpalette->palPalEntry))
358  {
360  return NULL;
361  }
362  logpalette->palVersion = 0x300;
363  logpalette->palNumEntries = (WORD)nEntries;
364 
365  hDst = CreatePalette(logpalette);
366 
368  break;
369  }
370  case CF_BITMAP:
371  {
372  LONG size;
373  BITMAP bm;
374  if (!GetObjectW(hSrc, sizeof(bm), &bm))
375  return NULL;
376  size = GetBitmapBits(hSrc, 0, NULL);
377  if (!size) return NULL;
378  bm.bmBits = HeapAlloc(GetProcessHeap(), 0, size);
379  if (!bm.bmBits) return NULL;
380  if (GetBitmapBits(hSrc, size, bm.bmBits))
381  hDst = CreateBitmapIndirect(&bm);
382  HeapFree(GetProcessHeap(), 0, bm.bmBits);
383  break;
384  }
385  default:
386  {
387  SIZE_T size = GlobalSize(hSrc);
388  LPVOID pvSrc = NULL;
389  LPVOID pvDst = NULL;
390 
391  /* allocate space for object */
392  if (!size) return NULL;
393  hDst = GlobalAlloc(uiFlags, size);
394  if (!hDst) return NULL;
395 
396  /* lock pointers */
397  pvSrc = GlobalLock(hSrc);
398  if (!pvSrc)
399  {
400  GlobalFree(hDst);
401  return NULL;
402  }
403  pvDst = GlobalLock(hDst);
404  if (!pvDst)
405  {
406  GlobalUnlock(hSrc);
407  GlobalFree(hDst);
408  return NULL;
409  }
410  /* copy data */
411  memcpy(pvDst, pvSrc, size);
412 
413  /* cleanup */
414  GlobalUnlock(hDst);
415  GlobalUnlock(hSrc);
416  }
417  }
418 
419  TRACE("returning %p\n", hDst);
420  return hDst;
421 }
static const LOGPALETTE logpalette
Definition: clipboard.c:1346
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HBITMAP WINAPI CreateBitmapIndirect(_In_ const BITMAP *pbm)
#define CF_ENHMETAFILE
Definition: constants.h:409
#define CF_METAFILEPICT
Definition: constants.h:398
WORD palVersion
Definition: wingdi.h:1810
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
long LONG
Definition: pedump.c:60
#define CF_BITMAP
Definition: constants.h:397
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)
unsigned int UINT
Definition: ndis.h:50
unsigned short WORD
Definition: ntddk_ex.h:93
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HENHMETAFILE WINAPI CopyEnhMetaFileW(_In_ HENHMETAFILE hemfSrc, _In_opt_ LPCWSTR pszFile)
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define CF_PALETTE
Definition: constants.h:404
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
ULONG_PTR SIZE_T
Definition: typedefs.h:78
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
Definition: bl.h:1331
HMETAFILE WINAPI CopyMetaFileW(_In_ HMETAFILE hmfSrc, _In_opt_ LPCWSTR pszFile)
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:254
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
WORD palNumEntries
Definition: wingdi.h:1811
#define HeapFree(x, y, z)
Definition: compat.h:394
#define GMEM_MOVEABLE
Definition: winbase.h:291

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

◆ OleFlushClipboard()

HRESULT WINAPI OleFlushClipboard ( void  )

Definition at line 2264 of file clipboard.c.

2265 {
2266  HRESULT hr;
2267  ole_clipbrd *clipbrd;
2268  HWND wnd;
2269 
2270  TRACE("()\n");
2271 
2272  if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;
2273 
2274  if(FAILED(hr = get_clipbrd_window(clipbrd, &wnd))) return hr;
2275 
2276  /*
2277  * Already flushed or no source DataObject? Nothing to do.
2278  */
2279  if (!clipbrd->src_data) return S_OK;
2280 
2281  if (!OpenClipboard(wnd)) return CLIPBRD_E_CANT_OPEN;
2282 
2283  SendMessageW(wnd, WM_RENDERALLFORMATS, 0, 0);
2284 
2286 
2288  set_src_dataobject(clipbrd, NULL);
2289 
2290  if ( !CloseClipboard() ) hr = CLIPBRD_E_CANT_CLOSE;
2291 
2292  return hr;
2293 }
static HRESULT expose_marshalled_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1928
#define WM_RENDERALLFORMATS
Definition: winuser.h:1828
IDataObject * src_data
Definition: clipboard.c:154
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI OpenClipboard(HWND hWndNewOwner)
Definition: clipboard.c:23
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
BOOL WINAPI CloseClipboard(void)
Definition: ntwrapper.h:178
static HRESULT get_clipbrd_window(ole_clipbrd *clipbrd, HWND *wnd)
Definition: clipboard.c:1889
static HRESULT set_src_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1960
#define CLIPBRD_E_CANT_CLOSE
Definition: winerror.h:2770
#define S_OK
Definition: intsafe.h:59
static HRESULT set_dataobject_format(HWND hwnd)
Definition: clipboard.c:2132
static HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd)
Definition: clipboard.c:186
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define CLIPBRD_E_CANT_OPEN
Definition: winerror.h:2766

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 2564 of file ole2.c.

2565 {
2566  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2567  HKEY hkey = NULL;
2569  LONG len;
2570  HRESULT res = S_OK;
2571 
2572  res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey);
2573  if (FAILED(res))
2574  goto done;
2575 
2576  len = sizeof(buf);
2577  if (RegQueryValueW(hkey, NULL, buf, &len))
2578  {
2580  goto done;
2581  }
2583 done:
2584  if (hkey) RegCloseKey(hkey);
2585  return res;
2586 }
static LPCLSID pClsidNew
Definition: compobj.c:77
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CHARS_IN_GUID
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
LONG HRESULT
Definition: typedefs.h:77
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4272
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2250

Referenced by OleDoAutoConvert(), and test_OleDoAutoConvert().

◆ OleGetClipboard()

HRESULT WINAPI OleGetClipboard ( IDataObject **  ppDataObj)

Definition at line 2220 of file clipboard.c.

2221 {
2222  HRESULT hr;
2223  ole_clipbrd *clipbrd;
2224  DWORD seq_no;
2225 
2226  TRACE("(%p)\n", obj);
2227 
2228  if(!obj) return E_INVALIDARG;
2229  *obj = NULL;
2230 
2231  if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;
2232 
2233  seq_no = GetClipboardSequenceNumber();
2235  if(clipbrd->latest_snapshot && clipbrd->latest_snapshot->seq_no != seq_no)
2236  clipbrd->latest_snapshot = NULL;
2237 
2238  if(!clipbrd->latest_snapshot)
2239  {
2240  clipbrd->latest_snapshot = snapshot_construct(seq_no);
2241  if(!clipbrd->latest_snapshot)
2242  {
2244  return E_OUTOFMEMORY;
2245  }
2246  }
2247 
2248  *obj = &clipbrd->latest_snapshot->IDataObject_iface;
2249  IDataObject_AddRef(*obj);
2251 
2252  return S_OK;
2253 }
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static CRITICAL_SECTION latest_snapshot_cs
Definition: clipboard.c:177
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
DWORD seq_no
Definition: clipboard.c:141
IDataObject IDataObject_iface
Definition: clipboard.c:138
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
EXTINLINE DWORD WINAPI GetClipboardSequenceNumber(VOID)
Definition: ntwrapper.h:202
snapshot * latest_snapshot
Definition: clipboard.c:151
#define S_OK
Definition: intsafe.h:59
static snapshot * snapshot_construct(DWORD seq_no)
Definition: clipboard.c:1697
static HRESULT get_ole_clipbrd(ole_clipbrd **clipbrd)
Definition: clipboard.c:186
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)

Referenced by CDefViewBckgrndMenu::_bCanPaste(), CDefaultContextMenu::DoPaste(), HasClipboardData(), OleUIPasteSpecialW(), paste_special(), 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 59 of file ole2stubs.c.

60 {
61  FIXME("(%p,%p,%x), stub!\n", rclsid, lpszLabel, fUseTypeAsLabel);
62  return NULL;
63 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416

◆ OleGetIconOfFile()

HGLOBAL WINAPI OleGetIconOfFile ( LPOLESTR  lpszPath,
BOOL  fUseFileAsLabel 
)

Definition at line 68 of file ole2stubs.c.

69 {
70  FIXME("(%s, %d), stub!\n", debugstr_w(path), use_file_as_label);
71  return NULL;
72 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
Definition: services.c:325

◆ 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 }
DWORD ole_inits
static struct oletls * COM_CurrentInfo(void)
void OLEClipbrd_Initialize(void)
Definition: clipboard.c:1752
r reserved
Definition: btrfs.c:2655
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static LONG OLE_moduleLockCount
Definition: ole2.c:101
LONG HRESULT
Definition: typedefs.h:77
static void OLEDD_Initialize(void)
Definition: ole2.c:2114
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:1938
static void OLEMenu_Initialize(void)
Definition: ole2.c:1402

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(), SHBrowseForFolderW(), 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(), and CHardErrorThread::ThreadProc().

◆ OleIsCurrentClipboard()

HRESULT WINAPI OleIsCurrentClipboard ( LPDATAOBJECT  )

◆ OleIsRunning()

BOOL WINAPI OleIsRunning ( LPOLEOBJECT  pObject)

Definition at line 2678 of file ole2.c.

2679 {
2680  IRunnableObject *pRunnable;
2681  HRESULT hr;
2682  BOOL running;
2683 
2684  TRACE("(%p)\n", object);
2685 
2686  if (!object) return FALSE;
2687 
2688  hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
2689  if (FAILED(hr))
2690  return TRUE;
2691  running = IRunnableObject_IsRunning(pRunnable);
2692  IRunnableObject_Release(pRunnable);
2693  return running;
2694 }
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
unsigned int BOOL
Definition: ntddk_ex.h:94
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IRunnableObject

Referenced by test_runnable().

◆ OleLoad()

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

Definition at line 1215 of file ole2.c.

1220 {
1221  IPersistStorage* persistStorage = NULL;
1222  IUnknown* pUnk;
1223  IOleObject* pOleObject = NULL;
1224  STATSTG storageInfo;
1225  HRESULT hres;
1226 
1227  TRACE("(%p, %s, %p, %p)\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
1228 
1229  *ppvObj = NULL;
1230 
1231  /*
1232  * TODO, Conversion ... OleDoAutoConvert
1233  */
1234 
1235  /*
1236  * Get the class ID for the object.
1237  */
1238  hres = IStorage_Stat(pStg, &storageInfo, STATFLAG_NONAME);
1239  if (FAILED(hres))
1240  return hres;
1241 
1242  /*
1243  * Now, try and create the handler for the object
1244  */
1245  hres = CoCreateInstance(&storageInfo.clsid,
1246  NULL,
1247  CLSCTX_INPROC_HANDLER|CLSCTX_INPROC_SERVER,
1248  riid,
1249  (void**)&pUnk);
1250 
1251  /*
1252  * If that fails, as it will most times, load the default
1253  * OLE handler.
1254  */
1255  if (FAILED(hres))
1256  {
1257  hres = OleCreateDefaultHandler(&storageInfo.clsid,
1258  NULL,
1259  riid,
1260  (void**)&pUnk);
1261  }
1262 
1263  /*
1264  * If we couldn't find a handler... this is bad. Abort the whole thing.
1265  */
1266  if (FAILED(hres))
1267  return hres;
1268 
1269  if (pClientSite)
1270  {
1271  hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (void **)&pOleObject);
1272  if (SUCCEEDED(hres))
1273  {
1274  DWORD dwStatus;
1275  hres = IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
1276  }
1277  }
1278 
1279  /*
1280  * Initialize the object with its IPersistStorage interface.
1281  */
1282  hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (void**)&persistStorage);
1283  if (SUCCEEDED(hres))
1284  {
1285  hres = IPersistStorage_Load(persistStorage, pStg);
1286 
1287  IPersistStorage_Release(persistStorage);
1288  persistStorage = NULL;
1289  }
1290 
1291  if (SUCCEEDED(hres) && pClientSite)
1292  /*
1293  * Inform the new object of its client site.
1294  */
1295  hres = IOleObject_SetClientSite(pOleObject, pClientSite);
1296 
1297  /*
1298  * Cleanup interfaces used internally
1299  */
1300  if (pOleObject)
1301  IOleObject_Release(pOleObject);
1302 
1303  if (SUCCEEDED(hres))
1304  {
1305  IOleLink *pOleLink;
1306  HRESULT hres1;
1307  hres1 = IUnknown_QueryInterface(pUnk, &IID_IOleLink, (void **)&pOleLink);
1308  if (SUCCEEDED(hres1))
1309  {
1310  FIXME("handle OLE link\n");
1311  IOleLink_Release(pOleLink);
1312  }
1313  }
1314 
1315  if (FAILED(hres))
1316  {
1317  IUnknown_Release(pUnk);
1318  pUnk = NULL;
1319  }
1320 
1321  *ppvObj = pUnk;
1322 
1323  return hres;
1324 }
const GUID IID_IOleLink
REFIID riid
Definition: precomp.h:44
const GUID IID_IPersistStorage
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IOleObject
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
DWORD dwStatus
Definition: mediaobj.idl:95
HRESULT WINAPI OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ OleLoadFromStream()

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

Definition at line 9130 of file storage32.c.

9131 {
9132  CLSID clsid;
9133  HRESULT res;
9134  LPPERSISTSTREAM xstm;
9135 
9136  TRACE("(%p,%s,%p)\n",pStm,debugstr_guid(iidInterface),ppvObj);
9137 
9138  res=ReadClassStm(pStm,&clsid);
9139  if (FAILED(res))
9140  return res;
9141  res=CoCreateInstance(&clsid,NULL,CLSCTX_INPROC_SERVER,iidInterface,ppvObj);
9142  if (FAILED(res))
9143  return res;
9144  res=IUnknown_QueryInterface((IUnknown*)*ppvObj,&IID_IPersistStream,(LPVOID*)&xstm);
9145  if (FAILED(res)) {
9146  IUnknown_Release((IUnknown*)*ppvObj);
9147  return res;
9148  }
9149  res=IPersistStream_Load(xstm,pStm);
9150  IPersistStream_Release(xstm);
9151  /* FIXME: all refcounts ok at this point? I think they should be:
9152  * pStm : unchanged
9153  * ppvObj : 1
9154  * xstm : 0 (released)
9155  */
9156  return res;
9157 }
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IPersistStream
Definition: proxy.cpp:13
REFCLSID clsid
Definition: msctf.c:84
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3237
HRESULT WINAPI ReadClassStm(IStream *pStm, CLSID *pclsid)
Definition: storage32.c:9550
interface IPersistStream * LPPERSISTSTREAM
Definition: objfwd.h:16
GLuint res
Definition: glext.h:9613

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

◆ OleLockRunning()

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

Definition at line 1368 of file ole2.c.

1369 {
1371  HRESULT hres;
1372 
1373  TRACE("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses);
1374 
1375  hres = IUnknown_QueryInterface(pUnknown,
1377  (void**)&runnable);
1378 
1379  if (SUCCEEDED(hres))
1380  {
1381  hres = IRunnableObject_LockRunning(runnable, fLock, fLastUnlockCloses);
1382 
1383  IRunnableObject_Release(runnable);
1384 
1385  return hres;
1386  }
1387 
1388  return S_OK;
1389 }
static IRunnableObject * runnable
Definition: ole2.c:82
smooth NULL
Definition: ftsmooth.c:416
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_OleLockRunning().

◆ OleMetafilePictFromIconAndLabel()

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

Definition at line 43 of file ole32_main.c.

45 {
46  METAFILEPICT mfp;
47  HDC hdc;
48  HGLOBAL hmem = NULL;
49  LPVOID mfdata;
50  static const char szIconOnly[] = "IconOnly";
51  SIZE text_size = { 0, 0 };
52  INT width;
53  INT icon_width;
54  INT icon_height;
55  INT label_offset;
56  HDC hdcScreen;
57  LOGFONTW lf;
58  HFONT font;
59 
60  TRACE("%p %p %s %d\n", hIcon, lpszLabel, debugstr_w(lpszSourceFile), iIconIndex);
61 
62  if( !hIcon )
63  return NULL;
64 
65  if (!SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0))
66  return NULL;
67 
69  if (!font)
70  return NULL;
71 
73  if( !hdc )
74  {
76  return NULL;
77  }
78 
80 
81  ExtEscape(hdc, MFCOMMENT, sizeof(szIconOnly), szIconOnly, 0, NULL);
82 
83  icon_width = GetSystemMetrics(SM_CXICON);
84  icon_height = GetSystemMetrics(SM_CYICON);
85  /* FIXME: should we give the label a bit of padding here? */
86  label_offset = icon_height;
87  if (lpszLabel)
88  {
89  HFONT screen_old_font;
90  /* metafile DCs don't support GetTextExtentPoint32, so size the font
91  * using the desktop window DC */
92  hdcScreen = GetDC(NULL);
93  screen_old_font = SelectObject(hdcScreen, font);
94  GetTextExtentPoint32W(hdcScreen, lpszLabel, lstrlenW(lpszLabel), &text_size);
95  SelectObject(hdcScreen, screen_old_font);
96  ReleaseDC(NULL, hdcScreen);
97 
98  width = 3 * icon_width;
99  }
100  else
101  width = icon_width;
102 
104  SetWindowOrgEx(hdc, 0, 0, NULL);
105  SetWindowExtEx(hdc, width, label_offset + text_size.cy, NULL);
106 
107  /* draw the icon centered */
108  DrawIcon(hdc, (width-icon_width) / 2, 0, hIcon);
109  if(lpszLabel)
110  /* draw the label centered too, if provided */
111  TextOutW(hdc, (width-text_size.cx) / 2, label_offset, lpszLabel, lstrlenW(lpszLabel));
112 
113  if (lpszSourceFile)
114  {
115  char szIconIndex[10];
116  int path_length = WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,NULL,0,NULL,NULL);
117  if (path_length > 1)
118  {
119  char * szPath = CoTaskMemAlloc(path_length * sizeof(CHAR));
120  if (szPath)
121  {
122  WideCharToMultiByte(CP_ACP,0,lpszSourceFile,-1,szPath,path_length,NULL,NULL);
125  }
126  }
127  snprintf(szIconIndex, 10, "%u", iIconIndex);
128  ExtEscape(hdc, MFCOMMENT, strlen(szIconIndex)+1, szIconIndex, 0, NULL);
129  }
130 
131  mfp.mm = MM_ANISOTROPIC;
132  hdcScreen = GetDC(NULL);
134  mfp.yExt = MulDiv(label_offset + text_size.cy, HIMETRIC_INCHES, GetDeviceCaps(hdcScreen, LOGPIXELSY));
135  ReleaseDC(NULL, hdcScreen);
136  mfp.hMF = CloseMetaFile(hdc);
138  if( !mfp.hMF )
139  return NULL;
140 
141  hmem = GlobalAlloc( GMEM_MOVEABLE, sizeof(mfp) );
142  if( !hmem )
143  {
144  DeleteMetaFile(mfp.hMF);
145  return NULL;
146  }
147 
148  mfdata = GlobalLock( hmem );
149  if( !mfdata )
150  {
151  GlobalFree( hmem );
152  DeleteMetaFile(mfp.hMF);
153  return NULL;
154  }
155 
156  memcpy(mfdata,&mfp,sizeof(mfp));
157  GlobalUnlock( hmem );
158 
159  TRACE("returning %p\n",hmem);
160 
161  return hmem;
162 }
#define HDC
Definition: msvc.h:22
GLint GLint GLsizei width
Definition: gl.h:1546
HMETAFILE hMF
Definition: wingdi.h:2585
#define LOGPIXELSX
Definition: wingdi.h:716
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define WideCharToMultiByte
Definition: compat.h:101
HDC WINAPI GetDC(_In_opt_ HWND)
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
Definition: mk_font.cpp:20
#define CP_ACP
Definition: compat.h:99
char CHAR
Definition: xmlstorage.h:175
HDC WINAPI CreateMetaFileW(_In_opt_ LPCWSTR)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
#define snprintf
Definition: wintirpc.h:48
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define MFCOMMENT
Definition: wingdi.h:996
#define lstrlenW
Definition: compat.h:407
int32_t INT
Definition: typedefs.h:56
int WINAPI SetMapMode(_In_ HDC, _In_ int)
#define debugstr_w
Definition: kernel32.h:32
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SM_CXICON
Definition: winuser.h:962
HDC hdc
Definition: msvc.h:53
smooth NULL
Definition: ftsmooth.c:416
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
LONG cx
Definition: windef.h:319
HMETAFILE WINAPI CloseMetaFile(_In_ HDC hdc)
BOOL WINAPI SystemParametersInfoW(_In_ UINT, _In_ UINT, _Inout_opt_ PVOID, _In_ UINT)
#define TRACE(s)
Definition: solgame.cpp:4
static long path_length
Definition: maze.c:116
int WINAPI GetSystemMetrics(_In_ int)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
#define SM_CYICON
Definition: winuser.h:963
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define MM_ANISOTROPIC
Definition: wingdi.h:865
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL WINAPI TextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_reads_(c) LPCWSTR lpString, _In_ int c)
BOOL WINAPI DrawIcon(_In_ HDC, _In_ int, _In_ int, _In_ HICON)
Definition: cursoricon.c:1987
#define HIMETRIC_INCHES
Definition: ole32_main.c:38
HICON hIcon
Definition: msconfig.c:44
LPCWSTR szPath
Definition: env.c:35
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define SPI_GETICONTITLELOGFONT
Definition: winuser.h:1362
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
BOOL WINAPI SetWindowOrgEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
Definition: coord.c:526
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
#define LOGPIXELSY
Definition: wingdi.h:717
LONG cy
Definition: windef.h:320
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406
#define MulDiv(x, y, z)
Definition: gdifloat.h:86
#define GMEM_MOVEABLE
Definition: winbase.h:291
BOOL WINAPI GetTextExtentPoint32W(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE psizl)
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)

Referenced by test_data_cache().

◆ OleNoteObjectVisible()

HRESULT WINAPI OleNoteObjectVisible ( LPUNKNOWN  pUnknown,
BOOL  fVisible 
)

Definition at line 2699 of file ole2.c.

2700 {
2701  TRACE("(%p, %s)\n", pUnknown, bVisible ? "TRUE" : "FALSE");
2702  return CoLockObjectExternal(pUnknown, bVisible, TRUE);
2703 }
#define TRUE
Definition: types.h:120
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases)
Definition: compobj.c:3655

◆ OleQueryCreateFromData()

HRESULT WINAPI OleQueryCreateFromData ( LPDATAOBJECT  pSrcDataObject)

◆ OleQueryLinkFromData()

HRESULT WINAPI OleQueryLinkFromData ( IDataObject pSrcDataObject)

Definition at line 845 of file ole2.c.

847 {
848  FIXME("(%p),stub!\n", pSrcDataObject);
849  return S_FALSE;
850 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357

◆ OleRegEnumFormatEtc()

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

Definition at line 77 of file ole2stubs.c.

81 {
82  FIXME("(%p, %d, %p), stub!\n", clsid, dwDirection, ppenumFormatetc);
83 
84  return E_NOTIMPL;
85 }
#define FIXME(fmt,...)
Definition: debug.h:110
REFCLSID clsid
Definition: msctf.c:84
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by DefaultHandler_EnumFormatEtc().

◆ OleRegEnumVerbs()

HRESULT WINAPI OleRegEnumVerbs ( REFCLSID  clsid,
LPENUMOLEVERB *  ppenum 
)

Definition at line 1116 of file ole2.c.

1117 {
1118  LONG res;
1119  HKEY hkeyVerb;
1120  DWORD dwSubKeys;
1121  static const WCHAR wszVerb[] = {'V','e','r','b',0};
1122 
1123  TRACE("(%s, %p)\n", debugstr_guid(clsid), ppenum);
1124 
1125  res = COM_OpenKeyForCLSID(clsid, wszVerb, KEY_READ, &hkeyVerb);
1126  if (FAILED(res))
1127  {
1128  if (res == REGDB_E_CLASSNOTREG)
1129  ERR("CLSID %s not registered\n", debugstr_guid(clsid));
1130  else if (res == REGDB_E_KEYMISSING)
1131  ERR("no Verbs key for class %s\n", debugstr_guid(clsid));
1132  else
1133  ERR("failed to open Verbs key for CLSID %s with error %d\n",
1134  debugstr_guid(clsid), res);
1135  return res;
1136  }
1137 
1138  res = RegQueryInfoKeyW(hkeyVerb, NULL, NULL, NULL, &dwSubKeys, NULL,
1139  NULL, NULL, NULL, NULL, NULL, NULL);
1140  if (res != ERROR_SUCCESS)
1141  {
1142  ERR("failed to get subkey count with error %d\n", GetLastError());
1143  return REGDB_E_READREGDB;
1144  }
1145 
1146  if (!dwSubKeys)
1147  {
1148  WARN("class %s has no verbs\n", debugstr_guid(clsid));
1149  RegCloseKey(hkeyVerb);
1150  return OLEOBJ_E_NOVERBS;
1151  }
1152 
1153  return EnumOLEVERB_Construct(hkeyVerb, 0, ppenum);
1154 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WARN(fmt,...)
Definition: debug.h:111
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
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:3704
REFCLSID clsid
Definition: msctf.c:84
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1084
#define ERR(fmt,...)
Definition: debug.h:109
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:2696
#define OLEOBJ_E_NOVERBS
Definition: winerror.h:2722
GLuint res
Definition: glext.h:9613

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

◆ OleRegGetMiscStatus()

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

Definition at line 855 of file ole2.c.

859 {
860  static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
861  static const WCHAR dfmtW[] = {'%','d',0};
862  WCHAR keyName[16];
863  HKEY miscStatusKey;
864  HKEY aspectKey;
865  LONG result;
866  HRESULT hr;
867 
868  TRACE("(%s, %d, %p)\n", debugstr_guid(clsid), dwAspect, pdwStatus);
869 
870  if (!pdwStatus) return E_INVALIDARG;
871 
872  *pdwStatus = 0;
873 
874  if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
875 
876  hr = COM_OpenKeyForCLSID(clsid, miscstatusW, KEY_READ, &miscStatusKey);
877  if (FAILED(hr))
878  /* missing key is not a failure */
879  return hr == REGDB_E_KEYMISSING ? S_OK : hr;
880 
881  OLEUTL_ReadRegistryDWORDValue(miscStatusKey, pdwStatus);
882 
883  /*
884  * Open the key specific to the requested aspect.
885  */
886  sprintfW(keyName, dfmtW, dwAspect);
887 
888  result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
889  if (result == ERROR_SUCCESS)
890  {
891  OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
892  RegCloseKey(aspectKey);
893  }
894 
895  RegCloseKey(miscStatusKey);
896  return S_OK;
897 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD *pdwValue)
Definition: ole2.c:2386
#define REGDB_E_KEYMISSING
Definition: winerror.h:2694
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
#define debugstr_guid
Definition: kernel32.h:35
static const WCHAR miscstatusW[]
Definition: actctx.c:625
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:425
#define sprintfW
Definition: unicode.h:58
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
Definition: compobj.c:259
GLuint64EXT * result
Definition: glext.h:11304
DWORD dwAspect
Definition: msvc.h:106

Referenced by DefaultHandler_GetMiscStatus(), and test_OleRegGetMiscStatus().

◆ OleRegGetUserType()

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

Definition at line 672 of file ole2.c.

673 {
674  static const WCHAR auxusertypeW[] = {'A','u','x','U','s','e','r','T','y','p','e','\\','%','d',0};
675  DWORD valuetype, valuelen;
676  WCHAR auxkeynameW[16];
677  HKEY usertypekey;
678  HRESULT hres;
679  LONG ret;
680 
681  TRACE("(%s, %u, %p)\n", debugstr_guid(clsid), form, usertype);
682 
683  if (!usertype)
684  return E_INVALIDARG;
685 
686  *usertype = NULL;
687 
688  /* Return immediately if it's not registered. */
689  hres = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &usertypekey);
690  if (FAILED(hres))
691  return hres;
692 
693  valuelen = 0;
694 
695  /* Try additional types if requested. If they don't exist fall back to USERCLASSTYPE_FULL. */
696  if (form != USERCLASSTYPE_FULL)
697  {
698  HKEY auxkey;
699 
700  sprintfW(auxkeynameW, auxusertypeW, form);
701  if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK)
702  {
703  if (!RegQueryValueExW(auxkey, emptyW, NULL, &valuetype, NULL, &valuelen) && valuelen)
704  {
705  RegCloseKey(usertypekey);
706  usertypekey = auxkey;
707  }
708  else
709  RegCloseKey(auxkey);
710  }
711  }
712 
713  valuelen = 0;
714  if (RegQueryValueExW(usertypekey, emptyW, NULL, &valuetype, NULL, &valuelen))
715  {
716  RegCloseKey(usertypekey);
717  return REGDB_E_READREGDB;
718  }
719 
720  *usertype = CoTaskMemAlloc(valuelen);
721  if (!*usertype)
722  {
723  RegCloseKey(usertypekey);
724  return E_OUTOFMEMORY;
725  }
726 
727  ret = RegQueryValueExW(usertypekey,
728  emptyW,
729  NULL,
730  &valuetype,
731  (LPBYTE)*usertype,
732  &valuelen);
733  RegCloseKey(usertypekey);
734  if (ret != ERROR_SUCCESS)
735  {
736  CoTaskMemFree(*usertype);
737  *usertype = NULL;
738  return REGDB_E_READREGDB;
739  }
740 
741  return S_OK;
742 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
__wchar_t WCHAR
Definition: xmlstorage.h:180
int form
Definition: main.c:89
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4134
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
REFCLSID clsid
Definition: msctf.c:84
static const WCHAR emptyW[]
Definition: ole2.c:123
#define S_OK
Definition: intsafe.h:59
#define sprintfW
Definition: unicode.h:58
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

Referenced by DefaultHandler_GetUserType(), get_descriptors(), OleDoAutoConvert(), OleObject_GetUserType(), and test_OleRegGetUserType().

◆ OleRun()

HRESULT WINAPI OleRun ( LPUNKNOWN  pUnknown)

Definition at line 1196 of file ole2.c.

1197 {
1198  IRunnableObject *runable;
1199  HRESULT hres;
1200 
1201  TRACE("(%p)\n", pUnknown);
1202 
1203  hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, (void**)&runable);
1204  if (FAILED(hres))
1205  return S_OK; /* Appears to return no error. */
1206 
1207  hres = IRunnableObject_Run(runable, NULL);
1208  IRunnableObject_Release(runable);
1209  return hres;
1210 }
smooth NULL
Definition: ftsmooth.c:416
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59

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

◆ OleSave()

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

Definition at line 1329 of file ole2.c.

1333 {
1334  HRESULT hres;
1335  CLSID objectClass;
1336 
1337  TRACE("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad);
1338 
1339  /*
1340  * First, we transfer the class ID (if available)
1341  */
1342  hres = IPersistStorage_GetClassID(pPS, &objectClass);
1343 
1344  if (SUCCEEDED(hres))
1345  {
1346  WriteClassStg(pStg, &objectClass);
1347  }
1348 
1349  /*
1350  * Then, we ask the object to save itself to the
1351  * storage. If it is successful, we commit the storage.
1352  */
1353  hres = IPersistStorage_Save(pPS, pStg, fSameAsLoad);
1354 
1355  if (SUCCEEDED(hres))
1356  {
1357  IStorage_Commit(pStg,
1358  STGC_DEFAULT);
1359  }
1360 
1361  return hres;
1362 }
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
Definition: storage32.c:9079
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ OleSaveToStream()

HRESULT WINAPI OleSaveToStream ( IPersistStream pPStm,
IStream pStm 
)

Definition at line 9165 of file storage32.c.

9166 {
9167 
9168  CLSID clsid;
9169  HRESULT res;
9170 
9171  TRACE("(%p,%p)\n",pPStm,pStm);
9172 
9173  res=IPersistStream_GetClassID(pPStm,&clsid);
9174 
9175  if (SUCCEEDED(res)){
9176 
9177  res=WriteClassStm(pStm,&clsid);
9178 
9179  if (SUCCEEDED(res))
9180 
9181  res=IPersistStream_Save(pPStm,pStm,TRUE);
9182  }
9183 
9184  TRACE("Finished Save\n");
9185  return res;
9186 }
#define TRUE
Definition: types.h:120
HRESULT WINAPI WriteClassStm(IStream *pStm, REFCLSID rclsid)
Definition: storage32.c:9527
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
GLuint res
Definition: glext.h:9613
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ OleSetAutoConvert()

HRESULT WINAPI OleSetAutoConvert ( REFCLSID  clsidOld,
REFCLSID  clsidNew 
)

Definition at line 2591 of file ole2.c.

2592 {
2593  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2594  HKEY hkey = NULL;
2595  WCHAR szClsidNew[CHARS_IN_GUID];
2596  HRESULT res = S_OK;
2597 
2598  TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
2599 
2600  res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
2601  if (FAILED(res))
2602  goto done;
2603  StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
2604  if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (strlenW(szClsidNew)+1) * sizeof(WCHAR)))
2605  {
2607  goto done;
2608  }
2609 
2610 done:
2611  if (hkey) RegCloseKey(hkey);
2612  return res;
2613 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define KEY_READ
Definition: nt_native.h:1023
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CHARS_IN_GUID
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5036
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2360
#define debugstr_guid
Definition: kernel32.h:35
#define KEY_WRITE
Definition: nt_native.h:1031
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2346
#define REGDB_E_WRITEREGDB
Definition: winerror.h:2693
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
#define REG_SZ
Definition: layer.c:22

Referenced by test_OleDoAutoConvert().

◆ OleSetClipboard()

HRESULT WINAPI OleSetClipboard ( LPDATAOBJECT  )

◆ OleSetContainedObject()

HRESULT WINAPI OleSetContainedObject ( LPUNKNOWN  pUnknown,
BOOL  fContained 
)

Definition at line 1159 of file ole2.c.

1162 {
1164  HRESULT hres;
1165 
1166  TRACE("(%p,%x)\n", pUnknown, fContained);
1167 
1168  hres = IUnknown_QueryInterface(pUnknown,
1170  (void**)&runnable);
1171 
1172  if (SUCCEEDED(hres))
1173  {
1174  hres = IRunnableObject_SetContainedObject(runnable, fContained);
1175 
1176  IRunnableObject_Release(runnable);
1177 
1178  return hres;
1179  }
1180 
1181  return S_OK;
1182 }
static IRunnableObject * runnable
Definition: ole2.c:82
smooth NULL
Definition: ftsmooth.c:416
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IRunnableObject
#define S_OK
Definition: intsafe.h:59
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by InitWebBrowser().

◆ OleSetMenuDescriptor()

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

Definition at line 1866 of file ole2.c.

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

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  */
263  CoUninitialize();
264 }
void OLEClipbrd_UnInitialize(void)
Definition: clipboard.c:1998
return
Definition: dirsup.c:529
#define WARN(fmt,...)
Definition: debug.h:111
static void OLEMenu_UnInitialize(void)
Definition: ole2.c:1411
DWORD ole_inits
static struct oletls * COM_CurrentInfo(void)
#define TRACE(s)
Definition: solgame.cpp:4
static LONG OLE_moduleLockCount
Definition: ole2.c:101
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1994

Referenced by _tWinMain(), adv_install(), BrowserThreadProc(), display_cpl_sheets(), do_enum(), GetFileName95(), hook_proc(), ME_DestroyEditor(), ReleaseHelpViewer(), CHardErrorThread::s_HardErrorThreadProc(), SHBrowseForFolderW(), 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 9104 of file storage32.c.

9104  {
9105 
9106  STATSTG pstatstg;
9107  HRESULT hRes;
9108 
9109  TRACE("(%p, %p)\n", pstg, pclsid);
9110 
9111  if(!pstg || !pclsid)
9112  return E_INVALIDARG;
9113 
9114  /*
9115  * read a STATSTG structure (contains the clsid) from the storage
9116  */
9117  hRes=IStorage_Stat(pstg,&pstatstg,STATFLAG_NONAME);
9118 
9119  if(SUCCEEDED(hRes))
9120  *pclsid=pstatstg.clsid;
9121 
9122  return hRes;
9123 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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 9550 of file storage32.c.

9551 {
9552  ULONG nbByte;
9553  HRESULT res;
9554 
9555  TRACE("(%p,%p)\n",pStm,pclsid);
9556 
9557  if (!pStm || !pclsid)
9558  return E_INVALIDARG;
9559 
9560  /* clear the output args */
9561  *pclsid = CLSID_NULL;
9562 
9563  res = IStream_Read(pStm, pclsid, sizeof(CLSID), &nbByte);
9564 
9565  if (FAILED(res))
9566  return res;
9567 
9568  if (nbByte != sizeof(CLSID))
9569  return STG_E_READFAULT;
9570  else
9571  return S_OK;
9572 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define CLSID_NULL
Definition: guiddef.h:94
LONG HRESULT
Definition: typedefs.h:77
#define S_OK
Definition: intsafe.h:59
#define STG_E_READFAULT
Definition: winerror.h:2576
GLuint res
Definition: glext.h:9613
unsigned int ULONG
Definition: retypes.h:1

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

◆ ReadFmtUserTypeStg()

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

Definition at line 9401 of file storage32.c.

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

Referenced by OleDoAutoConvert().

◆ RegisterDragDrop()

HRESULT WINAPI RegisterDragDrop ( HWND  ,
LPDROPTARGET   
)

Definition at line 551 of file ole2.c.

552 {
553  DWORD pid = 0;
554  HRESULT hr;
555  IStream *stream;
556  HANDLE map;
557  IDropTarget *wrapper;
558 
559  TRACE("(%p,%p)\n", hwnd, pDropTarget);
560 
561  if (!COM_CurrentApt())
562  {
563  ERR("COM not initialized\n");
564  return E_OUTOFMEMORY;
565  }
566 
567  if (!pDropTarget)
568  return E_INVALIDARG;
569 
570  if (!IsWindow(hwnd))
571  {
572  ERR("invalid hwnd %p\n", hwnd);
573  return DRAGDROP_E_INVALIDHWND;
574  }
575 
576  /* block register for other processes windows */
578  if (pid != GetCurrentProcessId())
579  {
580  FIXME("register for another process windows is disabled\n");
581  return DRAGDROP_E_INVALIDHWND;
582  }
583 
584  /* check if the window is already registered */
585  if (is_droptarget(hwnd))
587 
588  /*
589  * Marshal the drop target pointer into a shared memory map and
590  * store the map's handle in a Wine specific window prop. We also
591  * store the drop target pointer itself in the
592  * "OleDropTargetInterface" prop for compatibility with Windows.
593  */
594 
596  if(FAILED(hr)) return hr;
597 
598  /* IDropTarget::QueryInterface() shouldn't be called, some (broken) apps depend on this. */
599  wrapper = WrapDropTarget( hwnd );
600  if(!wrapper)
601  {
602  IStream_Release(stream);
603  return E_OUTOFMEMORY;
604  }
605  hr = CoMarshalInterface(stream, &IID_IDropTarget, (IUnknown*)wrapper, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
606  IDropTarget_Release(wrapper);
607 
608  if(SUCCEEDED(hr))
609  {
611  if(SUCCEEDED(hr))
612  {
613  IDropTarget_AddRef(pDropTarget);
614  SetPropW(hwnd, prop_oledroptarget, pDropTarget);
616  }
617  else
618  {
620  zero.QuadPart = 0;
621  IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
623  }
624  }
625  IStream_Release(stream);
626 
627  return hr;
628 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:1907
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
#define TRUE
Definition: types.h:120
BOOL WINAPI IsWindow(_In_opt_ HWND)
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum map
Definition: glfuncs.h:124
static HRESULT create_map_from_stream(IStream *stream, HANDLE *map)
Definition: ole2.c:331
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
static APARTMENT * COM_CurrentApt(void)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FIXME(fmt,...)
Definition: debug.h:110
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:2654
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _map.h:44
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:120
static double zero
Definition: j0_y0.c:96
static IDropTarget * WrapDropTarget(HWND hwnd)
Definition: ole2.c:512
Definition: parse.h:22
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:2653
GLuint GLuint stream
Definition: glext.h:7522
#define ERR(fmt,...)
Definition: debug.h:109
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:116
HRESULT WINAPI CoMarshalInterface(IStream *pStream, REFIID riid, IUnknown *pUnk, DWORD dwDestContext, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:1724
static BOOL is_droptarget(HWND hwnd)
Definition: ole2.c:291
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1188
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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

◆ ReleaseStgMedium()

VOID WINAPI ReleaseStgMedium ( LPSTGMEDIUM  )

◆ RevokeDragDrop()

HRESULT WINAPI RevokeDragDrop ( HWND  )

Definition at line 633 of file ole2.c.

634 {
635  HANDLE map;
636  IStream *stream;
637  IDropTarget *drop_target;
638  HRESULT hr;
639 
640  TRACE("(%p)\n", hwnd);
641 
642  if (!IsWindow(hwnd))
643  {
644  ERR("invalid hwnd %p\n", hwnd);
645  return DRAGDROP_E_INVALIDHWND;
646  }
647 
648  /* no registration data */
649  if (!(map = get_droptarget_handle(hwnd)))
651 
652  drop_target = GetPropW(hwnd, prop_oledroptarget);
653  if(drop_target) IDropTarget_Release(drop_target);
654 
657 
659  if(SUCCEEDED(hr))
660  {
662  IStream_Release(stream);
663  }
664  CloseHandle(map);
665 
666  return hr;
667 }
HRESULT WINAPI CoReleaseMarshalData(IStream *pStream)
Definition: marshal.c:1907
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:357
#define CloseHandle
Definition: compat.h:398
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:2652
GLenum GLclampf GLint GLenum GLuint GLenum GLenum GLsizei GLenum const GLvoid GLfloat GLfloat GLfloat GLfloat GLclampd GLint 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 GLboolean GLboolean GLboolean GLint GLenum GLsizei const GLvoid GLenum GLint GLenum GLint GLint GLsizei GLint GLenum GLint GLint GLint GLint GLsizei GLenum GLsizei const GLuint GLboolean GLenum GLenum GLint GLsizei GLenum GLsizei GLenum const GLvoid GLboolean const GLboolean GLenum const GLdouble const GLfloat const GLdouble const GLfloat GLenum GLint GLint GLint GLint GLint GLint GLenum GLfloat GLenum GLint GLenum GLsizei GLenum GLboolean GLenum GLdouble GLenum GLfloat GLenum GLenum GLfloat GLenum GLenum GLdouble GLenum GLenum GLint GLenum GLenum GLint GLenum map
Definition: glfuncs.h:124
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:2654
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
Definition: _map.h:44
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:120
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
#define ERR(fmt,...)
Definition: debug.h:109
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:116
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:281
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by CExplorerBand::DestroyExplorerBand(), 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 9079 of file storage32.c.

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

Referenced by 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 9527 of file storage32.c.

9528 {
9529  TRACE("(%p,%p)\n",pStm,rclsid);
9530 
9531  if (!pStm || !rclsid)
9532  return E_INVALIDARG;
9533 
9534  return IStream_Write(pStm,rclsid,sizeof(CLSID),NULL);
9535 }
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4

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

◆ WriteFmtUserTypeStg()

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

Definition at line 9357 of file storage32.c.

9359 {
9360  STATSTG stat;
9361  HRESULT r;
9362  WCHAR szwClipName[0x40];
9363  CLSID clsid;
9364  LPWSTR wstrProgID = NULL;
9365  DWORD n;
9366 
9367  TRACE("(%p,%x,%s)\n",pstg,cf,debugstr_w(lpszUserType));
9368 
9369  /* get the clipboard format name */
9370  if( cf )
9371  {
9372  n = GetClipboardFormatNameW( cf, szwClipName,
9373  sizeof(szwClipName)/sizeof(szwClipName[0]) );
9374  szwClipName[n]=0;
9375  }
9376 
9377  TRACE("Clipboard name is %s\n", debugstr_w(szwClipName));
9378 
9379  r = IStorage_Stat(pstg, &stat, STATFLAG_NONAME);
9380  if(SUCCEEDED(r))
9381  clsid = stat.clsid;
9382  else
9383  clsid = CLSID_NULL;
9384 
9385  ProgIDFromCLSID(&clsid, &wstrProgID);
9386 
9387  TRACE("progid is %s\n",debugstr_w(wstrProgID));
9388 
9389  r = STORAGE_WriteCompObj( pstg, &clsid, lpszUserType,
9390  cf ? szwClipName : NULL, wstrProgID );
9391 
9392  CoTaskMemFree(wstrProgID);
9393 
9394  return r;
9395 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
int WINAPI GetClipboardFormatNameW(_In_ UINT format, _Out_writes_(cchMaxCount) LPWSTR lpszFormatName, _In_ int cchMaxCount)
GLuint n
Definition: s_context.h:57
HRESULT WINAPI DECLSPEC_HOTPATCH ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *ppszProgID)
Definition: compobj.c:2442
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define CLSID_NULL
Definition: guiddef.h:94
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
REFCLSID clsid
Definition: msctf.c:84
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
static HRESULT STORAGE_WriteCompObj(LPSTORAGE pstg, CLSID *clsid, LPCWSTR lpszUserType, LPCWSTR szClipName, LPCWSTR szProgIDName)
Definition: storage32.c:9310
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define SUCCEEDED(hr)
Definition: intsafe.h:57

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