ReactOS  0.4.14-dev-608-gd495a4f
ole2.c File Reference
#include <assert.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "ole2.h"
#include "ole2ver.h"
#include "compobj_private.h"
#include "olestd.h"
#include "wine/list.h"
#include "wine/debug.h"
Include dependency graph for ole2.c:

Go to the source code of this file.

Classes

struct  tagTrackerWindowInfo
 
struct  tagOleMenuDescriptor
 
struct  tagOleMenuHookItem
 
struct  DropTargetWrapper
 
struct  EnumOLEVERB
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define DRAG_TIMER_ID   1
 

Typedefs

typedef struct tagTrackerWindowInfo TrackerWindowInfo
 
typedef struct tagOleMenuDescriptor OleMenuDescriptor
 
typedef struct tagOleMenuHookItem OleMenuHookItem
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (ole)
 
 WINE_DECLARE_DEBUG_CHANNEL (accel)
 
static void OLEUTL_ReadRegistryDWORDValue (HKEY regKey, DWORD *pdwValue)
 
static void OLEMenu_Initialize (void)
 
static void OLEMenu_UnInitialize (void)
 
static BOOL OLEMenu_InstallHooks (DWORD tid)
 
static BOOL OLEMenu_UnInstallHooks (DWORD tid)
 
static OleMenuHookItemOLEMenu_IsHookInstalled (DWORD tid)
 
static BOOL OLEMenu_FindMainMenuIndex (HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos)
 
static BOOL OLEMenu_SetIsServerMenu (HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor)
 
static LRESULT CALLBACK OLEMenu_CallWndProc (INT code, WPARAM wParam, LPARAM lParam)
 
static LRESULT CALLBACK OLEMenu_GetMsgProc (INT code, WPARAM wParam, LPARAM lParam)
 
void OLEClipbrd_UnInitialize (void)
 
void OLEClipbrd_Initialize (void)
 
static void OLEDD_Initialize (void)
 
static LRESULT WINAPI OLEDD_DragTrackerWindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static void OLEDD_TrackStateChange (TrackerWindowInfo *trackerInfo)
 
static DWORD OLEDD_GetButtonState (void)
 
DWORD WINAPI OleBuildVersion (void)
 
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize (LPVOID reserved)
 
void WINAPI DECLSPEC_HOTPATCH OleUninitialize (void)
 
HRESULT WINAPI OleInitializeWOW (DWORD x, DWORD y)
 
static HANDLE get_droptarget_handle (HWND hwnd)
 
static BOOL is_droptarget (HWND hwnd)
 
static HANDLE get_droptarget_local_handle (HWND hwnd)
 
static HRESULT create_map_from_stream (IStream *stream, HANDLE *map)
 
static HRESULT create_stream_from_map (HANDLE map, IStream **stream)
 
static DropTargetWrapperimpl_from_IDropTarget (IDropTarget *iface)
 
static HRESULT WINAPI DropTargetWrapper_QueryInterface (IDropTarget *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI DropTargetWrapper_AddRef (IDropTarget *iface)
 
static ULONG WINAPI DropTargetWrapper_Release (IDropTarget *iface)
 
static HRESULT get_target_from_wrapper (IDropTarget *wrapper, IDropTarget **target)
 
static HRESULT WINAPI DropTargetWrapper_DragEnter (IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static HRESULT WINAPI DropTargetWrapper_DragOver (IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static HRESULT WINAPI DropTargetWrapper_DragLeave (IDropTarget *iface)
 
static HRESULT WINAPI DropTargetWrapper_Drop (IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
 
static IDropTargetWrapDropTarget (HWND hwnd)
 
static IDropTargetget_droptarget_pointer (HWND hwnd)
 
HRESULT WINAPI RegisterDragDrop (HWND hwnd, LPDROPTARGET pDropTarget)
 
HRESULT WINAPI RevokeDragDrop (HWND hwnd)
 
HRESULT WINAPI OleRegGetUserType (REFCLSID clsid, DWORD form, LPOLESTR *usertype)
 
HRESULT WINAPI DoDragDrop (IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
 
HRESULT WINAPI OleQueryLinkFromData (IDataObject *pSrcDataObject)
 
HRESULT WINAPI OleRegGetMiscStatus (REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
 
static HRESULT EnumOLEVERB_Construct (HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
 
static EnumOLEVERBimpl_from_IEnumOLEVERB (IEnumOLEVERB *iface)
 
static HRESULT WINAPI EnumOLEVERB_QueryInterface (IEnumOLEVERB *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI EnumOLEVERB_AddRef (IEnumOLEVERB *iface)
 
static ULONG WINAPI EnumOLEVERB_Release (IEnumOLEVERB *iface)
 
static HRESULT WINAPI EnumOLEVERB_Next (IEnumOLEVERB *iface, ULONG celt, LPOLEVERB rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI EnumOLEVERB_Skip (IEnumOLEVERB *iface, ULONG celt)
 
static HRESULT WINAPI EnumOLEVERB_Reset (IEnumOLEVERB *iface)
 
static HRESULT WINAPI EnumOLEVERB_Clone (IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
 
HRESULT WINAPI OleRegEnumVerbs (REFCLSID clsid, LPENUMOLEVERB *ppenum)
 
HRESULT WINAPI OleSetContainedObject (LPUNKNOWN pUnknown, BOOL fContained)
 
HRESULT WINAPI DECLSPEC_HOTPATCH OleRun (LPUNKNOWN pUnknown)
 
HRESULT WINAPI OleLoad (LPSTORAGE pStg, REFIID riid, LPOLECLIENTSITE pClientSite, LPVOID *ppvObj)
 
HRESULT WINAPI OleSave (LPPERSISTSTORAGE pPS, LPSTORAGE pStg, BOOL fSameAsLoad)
 
HRESULT WINAPI OleLockRunning (LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
 
HOLEMENU WINAPI OleCreateMenuDescriptor (HMENU hmenuCombined, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 
HRESULT WINAPI OleDestroyMenuDescriptor (HOLEMENU hmenuDescriptor)
 
HRESULT WINAPI OleSetMenuDescriptor (HOLEMENU hOleMenu, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
 
BOOL WINAPI IsAccelerator (HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD *lpwCmd)
 
void WINAPI ReleaseStgMedium (STGMEDIUM *pmedium)
 
static void drag_enter (TrackerWindowInfo *info, HWND new_target)
 
static void drag_end (TrackerWindowInfo *info)
 
static HRESULT give_feedback (TrackerWindowInfo *info)
 
HRESULT WINAPI OleDraw (IUnknown *pUnk, DWORD dwAspect, HDC hdcDraw, LPCRECT rect)
 
HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg)
 
HRESULT WINAPI OleCreate (REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
 
HRESULT WINAPI OleGetAutoConvert (REFCLSID clsidOld, LPCLSID pClsidNew)
 
HRESULT WINAPI OleSetAutoConvert (REFCLSID clsidOld, REFCLSID clsidNew)
 
HRESULT WINAPI OleDoAutoConvert (LPSTORAGE pStg, LPCLSID pClsidNew)
 
BOOL WINAPI OleIsRunning (LPOLEOBJECT object)
 
HRESULT WINAPI OleNoteObjectVisible (LPUNKNOWN pUnknown, BOOL bVisible)
 
static void OLE_FreeClipDataArray (ULONG count, CLIPDATA *pClipDataArray)
 
BSTR WINAPI PropSysAllocString (LPCOLESTR str)
 
void WINAPI PropSysFreeString (LPOLESTR str)
 
static HRESULT PROPVARIANT_ValidateType (VARTYPE vt)
 
HRESULT WINAPI PropVariantClear (PROPVARIANT *pvar)
 
HRESULT WINAPI PropVariantCopy (PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
 
HRESULT WINAPI FreePropVariantArray (ULONG cVariants, PROPVARIANT *rgvars)
 
BOOL WINAPI DllDebugObjectRPCHook (BOOL b, void *dummy)
 

Variables

static OleMenuHookItemhook_list
 
static LONG OLE_moduleLockCount = 0
 
static const WCHAR OLEDD_DRAGTRACKERCLASS []
 
static const WCHAR prop_olemenuW []
 
static const WCHAR prop_oledroptarget []
 
static const WCHAR prop_marshalleddroptarget []
 
static const WCHAR emptyW [] = { 0 }
 
static const IDropTargetVtbl DropTargetWrapperVTbl
 
static const IEnumOLEVERBVtbl EnumOLEVERB_VTable
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 32 of file ole2.c.

◆ DRAG_TIMER_ID

#define DRAG_TIMER_ID   1

Definition at line 2148 of file ole2.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 33 of file ole2.c.

Typedef Documentation

◆ OleMenuDescriptor

◆ OleMenuHookItem

◆ TrackerWindowInfo

Function Documentation

◆ create_map_from_stream()

static HRESULT create_map_from_stream ( IStream stream,
HANDLE map 
)
static

Definition at line 337 of file ole2.c.

338 {
339  HGLOBAL hmem;
340  DWORD size;
341  HRESULT hr;
342  void *data;
343 
344  hr = GetHGlobalFromStream(stream, &hmem);
345  if(FAILED(hr)) return hr;
346 
347  size = GlobalSize(hmem);
349  if(!*map) return E_OUTOFMEMORY;
350 
352  memcpy(data, GlobalLock(hmem), size);
353  GlobalUnlock(hmem);
355  return S_OK;
356 }
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
#define MapViewOfFile
Definition: compat.h:410
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:77
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:409
#define FILE_MAP_WRITE
Definition: winbase.h:154
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: _map.h:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define UnmapViewOfFile
Definition: compat.h:411
#define PAGE_READWRITE
Definition: nt_native.h:1304

Referenced by RegisterDragDrop().

◆ create_stream_from_map()

static HRESULT create_stream_from_map ( HANDLE  map,
IStream **  stream 
)
static

Definition at line 363 of file ole2.c.

364 {
366  HGLOBAL hmem;
367  void *data;
369 
370  data = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
371  if(!data) return hr;
372 
373  VirtualQuery(data, &info, sizeof(info));
374  TRACE("size %d\n", (int)info.RegionSize);
375 
376  hmem = GlobalAlloc(GMEM_MOVEABLE, info.RegionSize);
377  if(hmem)
378  {
379  memcpy(GlobalLock(hmem), data, info.RegionSize);
380  GlobalUnlock(hmem);
382  }
384  return hr;
385 }
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define MapViewOfFile
Definition: compat.h:410
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
struct _test_info info[]
Definition: SetCursorPos.c:19
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FILE_MAP_READ
Definition: compat.h:435
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
Definition: virtmem.c:220
Definition: _map.h:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
Definition: parse.h:22
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
#define UnmapViewOfFile
Definition: compat.h:411
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by get_droptarget_pointer(), and RevokeDragDrop().

◆ DllDebugObjectRPCHook()

BOOL WINAPI DllDebugObjectRPCHook ( BOOL  b,
void dummy 
)

Definition at line 3288 of file ole2.c.

3289 {
3290  FIXME("stub\n");
3291  return TRUE;
3292 }
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:110

◆ DoDragDrop()

HRESULT WINAPI DoDragDrop ( IDataObject pDataObject,
IDropSource pDropSource,
DWORD  dwOKEffect,
DWORD pdwEffect 
)

Definition at line 753 of file ole2.c.

758 {
759  static const WCHAR trackerW[] = {'T','r','a','c','k','e','r','W','i','n','d','o','w',0};
760  TrackerWindowInfo trackerInfo;
761  HWND hwndTrackWindow;
762  MSG msg;
763 
764  TRACE("(%p, %p, %08x, %p)\n", pDataObject, pDropSource, dwOKEffect, pdwEffect);
765 
766  if (!pDataObject || !pDropSource || !pdwEffect)
767  return E_INVALIDARG;
768 
769  /*
770  * Setup the drag n drop tracking window.
771  */
772 
773  trackerInfo.dataObject = pDataObject;
774  trackerInfo.dropSource = pDropSource;
775  trackerInfo.dwOKEffect = dwOKEffect;
776  trackerInfo.pdwEffect = pdwEffect;
777  trackerInfo.trackingDone = FALSE;
778  trackerInfo.escPressed = FALSE;
779  trackerInfo.curTargetHWND = 0;
780  trackerInfo.curDragTarget = 0;
781 #ifdef __REACTOS__
782  trackerInfo.accepterHWND = NULL;
783 #endif
784 
785  hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, trackerW,
787  CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0,
788  &trackerInfo);
789 
790  if (hwndTrackWindow)
791  {
792  /*
793  * Capture the mouse input
794  */
795  SetCapture(hwndTrackWindow);
796 
797  msg.message = 0;
798 
799  /*
800  * Pump messages. All mouse input should go to the capture window.
801  */
802  while (!trackerInfo.trackingDone && GetMessageW(&msg, 0, 0, 0) )
803  {
804  trackerInfo.curMousePos.x = msg.pt.x;
805  trackerInfo.curMousePos.y = msg.pt.y;
806  trackerInfo.dwKeyState = OLEDD_GetButtonState();
807 
808  if ( (msg.message >= WM_KEYFIRST) &&
809  (msg.message <= WM_KEYLAST) )
810  {
811  /*
812  * When keyboard messages are sent to windows on this thread, we
813  * want to ignore notify the drop source that the state changed.
814  * in the case of the Escape key, we also notify the drop source
815  * we give it a special meaning.
816  */
817  if ( (msg.message==WM_KEYDOWN) &&
818  (msg.wParam==VK_ESCAPE) )
819  {
820  trackerInfo.escPressed = TRUE;
821  }
822 
823  /*
824  * Notify the drop source.
825  */
826  OLEDD_TrackStateChange(&trackerInfo);
827  }
828  else
829  {
830  /*
831  * Dispatch the messages only when it's not a keyboard message.
832  */
834  }
835  }
836 
837  /* re-post the quit message to outer message loop */
838  if (msg.message == WM_QUIT)
839  PostQuitMessage(msg.wParam);
840  /*
841  * Destroy the temporary window.
842  */
843  DestroyWindow(hwndTrackWindow);
844 
845  return trackerInfo.returnValue;
846  }
847 
848  return E_FAIL;
849 }
DWORD dwOKEffect
Definition: ole2.c:62
#define TRUE
Definition: types.h:120
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1827
#define WM_QUIT
Definition: winuser.h:1605
BOOL trackingDone
Definition: ole2.c:64
#define VK_ESCAPE
Definition: winuser.h:2189
IDataObject * dataObject
Definition: ole2.c:60
#define E_FAIL
Definition: ddrawi.h:102
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
LONG y
Definition: windef.h:330
DWORD dwKeyState
Definition: ole2.c:74
#define WM_KEYFIRST
Definition: winuser.h:1696
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define CW_USEDEFAULT
Definition: winuser.h:225
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
static void OLEDD_TrackStateChange(TrackerWindowInfo *trackerInfo)
Definition: ole2.c:2416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_KEYLAST
Definition: winuser.h:1710
LONG x
Definition: windef.h:329
HRESULT returnValue
Definition: ole2.c:65
POINTL curMousePos
Definition: ole2.c:73
HWND curTargetHWND
Definition: ole2.c:68
static const WCHAR OLEDD_DRAGTRACKERCLASS[]
Definition: ole2.c:106
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define WS_POPUP
Definition: pedump.c:616
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
#define msg(x)
Definition: auth_time.c:54
IDropSource * dropSource
Definition: ole2.c:61
IDropTarget * curDragTarget
Definition: ole2.c:69
static DWORD OLEDD_GetButtonState(void)
Definition: ole2.c:2484
DWORD * pdwEffect
Definition: ole2.c:63
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)

Referenced by CDefView::OnNotify(), CExplorerBand::OnTreeItemDragging(), SHDoDragDrop(), and test_DoDragDrop().

◆ drag_end()

static void drag_end ( TrackerWindowInfo info)
static

Definition at line 2319 of file ole2.c.

2320 {
2321  HRESULT hr;
2322 
2323  info->trackingDone = TRUE;
2324  ReleaseCapture();
2325 
2326  if (info->curDragTarget)
2327  {
2328  if (info->returnValue == DRAGDROP_S_DROP &&
2329  *info->pdwEffect != DROPEFFECT_NONE)
2330  {
2331  *info->pdwEffect = info->dwOKEffect;
2332  hr = IDropTarget_Drop( info->curDragTarget, info->dataObject, info->dwKeyState,
2333  info->curMousePos, info->pdwEffect );
2334  *info->pdwEffect &= info->dwOKEffect;
2335 
2336  if (FAILED( hr ))
2337  info->returnValue = hr;
2338  }
2339  else
2340  {
2341  IDropTarget_DragLeave( info->curDragTarget );
2342  *info->pdwEffect = DROPEFFECT_NONE;
2343  }
2344  IDropTarget_Release( info->curDragTarget );
2345  info->curDragTarget = NULL;
2346  }
2347 #ifdef __REACTOS__
2348  else if (info->accepterHWND)
2349  {
2350  if (info->returnValue == DRAGDROP_S_DROP &&
2351  *info->pdwEffect != DROPEFFECT_NONE)
2352  {
2353  *info->pdwEffect = info->dwOKEffect;
2354  hr = DefaultDrop(info->accepterHWND, info->dataObject, info->dwKeyState,
2355  info->curMousePos, info->pdwEffect);
2356  *info->pdwEffect &= info->dwOKEffect;
2357 
2358  if (FAILED( hr ))
2359  info->returnValue = hr;
2360  }
2361  else
2362  {
2363  *info->pdwEffect = DROPEFFECT_NONE;
2364  }
2365  info->accepterHWND = NULL;
2366  }
2367 #endif
2368  else
2369  *info->pdwEffect = DROPEFFECT_NONE;
2370 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
#define DRAGDROP_S_DROP
Definition: winerror.h:2646
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2888

Referenced by OLEDD_TrackStateChange().

◆ drag_enter()

static void drag_enter ( TrackerWindowInfo info,
HWND  new_target 
)
static

Definition at line 2260 of file ole2.c.

2261 {
2262  HRESULT hr;
2263 #ifdef __REACTOS__
2264  DWORD dwEffect = *info->pdwEffect;
2265 #endif
2266 
2267  info->curTargetHWND = new_target;
2268 
2269 #ifdef __REACTOS__
2270  info->accepterHWND = NULL;
2271  while (new_target && !is_droptarget( new_target ))
2272  {
2273  if (is_acceptfiles(new_target))
2274  {
2275  dwEffect = info->dwOKEffect;
2276  hr = DefaultDragEnter(new_target, info->dataObject,
2277  info->dwKeyState, info->curMousePos,
2278  &dwEffect);
2279  dwEffect &= info->dwOKEffect;
2280 
2281  if (hr == S_OK)
2282  {
2283  info->accepterHWND = new_target;
2284  info->curDragTarget = NULL;
2285  *info->pdwEffect = dwEffect;
2286  return;
2287  }
2288  }
2289  new_target = GetParent( new_target );
2290  }
2291 #else
2292  while (new_target && !is_droptarget( new_target ))
2293  new_target = GetParent( new_target );
2294 #endif
2295 
2296  info->curDragTarget = get_droptarget_pointer( new_target );
2297 
2298  if (info->curDragTarget)
2299  {
2300  *info->pdwEffect = info->dwOKEffect;
2301  hr = IDropTarget_DragEnter( info->curDragTarget, info->dataObject,
2302  info->dwKeyState, info->curMousePos,
2303  info->pdwEffect );
2304  *info->pdwEffect &= info->dwOKEffect;
2305 
2306  /* failed DragEnter() means invalid target */
2307  if (hr != S_OK)
2308  {
2309  IDropTarget_Release( info->curDragTarget );
2310  info->curDragTarget = NULL;
2311  info->curTargetHWND = NULL;
2312 #ifdef __REACTOS__
2313  info->accepterHWND = NULL;
2314 #endif
2315  }
2316  }
2317 }
static IDropTarget * get_droptarget_pointer(HWND hwnd)
Definition: ole2.c:536
HRESULT hr
Definition: shlfolder.c:183
smooth NULL
Definition: ftsmooth.c:416
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HWND WINAPI GetParent(_In_ HWND)
#define S_OK
Definition: intsafe.h:59
static BOOL is_droptarget(HWND hwnd)
Definition: ole2.c:291

Referenced by OLEDD_TrackStateChange().

◆ DropTargetWrapper_AddRef()

static ULONG WINAPI DropTargetWrapper_AddRef ( IDropTarget iface)
static

Definition at line 421 of file ole2.c.

422 {
424  return InterlockedIncrement(&This->refs);
425 }
#define InterlockedIncrement
Definition: armddk.h:53
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:400

◆ DropTargetWrapper_DragEnter()

static HRESULT WINAPI DropTargetWrapper_DragEnter ( IDropTarget iface,
IDataObject pDataObj,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 444 of file ole2.c.

449 {
452 
453  if (SUCCEEDED( r ))
454  {
455  r = IDropTarget_DragEnter( target, pDataObj, grfKeyState, pt, pdwEffect );
456  IDropTarget_Release( target );
457  }
458  return r;
459 }
#define pt(x, y)
Definition: drawing.c:79
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_target_from_wrapper(IDropTarget *wrapper, IDropTarget **target)
Definition: ole2.c:435
GLenum target
Definition: glext.h:7315
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ DropTargetWrapper_DragLeave()

static HRESULT WINAPI DropTargetWrapper_DragLeave ( IDropTarget iface)
static

Definition at line 477 of file ole2.c.

478 {
481 
482  if (SUCCEEDED( r ))
483  {
484  r = IDropTarget_DragLeave( target );
485  IDropTarget_Release( target );
486  }
487  return r;
488 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_target_from_wrapper(IDropTarget *wrapper, IDropTarget **target)
Definition: ole2.c:435
GLenum target
Definition: glext.h:7315
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ DropTargetWrapper_DragOver()

static HRESULT WINAPI DropTargetWrapper_DragOver ( IDropTarget iface,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 461 of file ole2.c.

465 {
468 
469  if (SUCCEEDED( r ))
470  {
471  r = IDropTarget_DragOver( target, grfKeyState, pt, pdwEffect );
472  IDropTarget_Release( target );
473  }
474  return r;
475 }
#define pt(x, y)
Definition: drawing.c:79
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_target_from_wrapper(IDropTarget *wrapper, IDropTarget **target)
Definition: ole2.c:435
GLenum target
Definition: glext.h:7315
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ DropTargetWrapper_Drop()

static HRESULT WINAPI DropTargetWrapper_Drop ( IDropTarget iface,
IDataObject pDataObj,
DWORD  grfKeyState,
POINTL  pt,
DWORD pdwEffect 
)
static

Definition at line 490 of file ole2.c.

495 {
498 
499  if (SUCCEEDED( r ))
500  {
501  r = IDropTarget_Drop( target, pDataObj, grfKeyState, pt, pdwEffect );
502  IDropTarget_Release( target );
503  }
504  return r;
505 }
#define pt(x, y)
Definition: drawing.c:79
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
LONG HRESULT
Definition: typedefs.h:77
static HRESULT get_target_from_wrapper(IDropTarget *wrapper, IDropTarget **target)
Definition: ole2.c:435
GLenum target
Definition: glext.h:7315
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ DropTargetWrapper_QueryInterface()

static HRESULT WINAPI DropTargetWrapper_QueryInterface ( IDropTarget iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 405 of file ole2.c.

408 {
410  if (IsEqualIID(riid, &IID_IUnknown) ||
411  IsEqualIID(riid, &IID_IDropTarget))
412  {
413  IDropTarget_AddRef(&This->IDropTarget_iface);
414  *ppvObject = &This->IDropTarget_iface;
415  return S_OK;
416  }
417  *ppvObject = NULL;
418  return E_NOINTERFACE;
419 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
smooth NULL
Definition: ftsmooth.c:416
const GUID IID_IUnknown
REFIID LPVOID * ppvObject
Definition: precomp.h:44
#define S_OK
Definition: intsafe.h:59
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:400
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ DropTargetWrapper_Release()

static ULONG WINAPI DropTargetWrapper_Release ( IDropTarget iface)
static

Definition at line 427 of file ole2.c.

428 {
430  ULONG refs = InterlockedDecrement(&This->refs);
431  if (!refs) HeapFree(GetProcessHeap(), 0, This);
432  return refs;
433 }
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:400
unsigned int ULONG
Definition: retypes.h:1
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 938 of file ole2.c.

940 {
942  TRACE("()\n");
943  return InterlockedIncrement(&This->ref);
944 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ EnumOLEVERB_Clone()

static HRESULT WINAPI EnumOLEVERB_Clone ( IEnumOLEVERB iface,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 1070 of file ole2.c.

1073 {
1075  HKEY hkeyVerb;
1076  TRACE("(%p)\n", ppenum);
1078  return HRESULT_FROM_WIN32(GetLastError());
1079  return EnumOLEVERB_Construct(hkeyVerb, This->index, ppenum);
1080 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
#define DUPLICATE_SAME_ACCESS
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1093
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149

◆ EnumOLEVERB_Construct()

static HRESULT EnumOLEVERB_Construct ( HKEY  hkeyVerb,
ULONG  index,
IEnumOLEVERB **  ppenum 
)
static

Definition at line 1093 of file ole2.c.

1094 {
1095  EnumOLEVERB *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1096  if (!This)
1097  {
1098  RegCloseKey(hkeyVerb);
1099  return E_OUTOFMEMORY;
1100  }
1101  This->IEnumOLEVERB_iface.lpVtbl = &EnumOLEVERB_VTable;
1102  This->ref = 1;
1103  This->index = index;
1104  This->hkeyVerb = hkeyVerb;
1105  *ppenum = &This->IEnumOLEVERB_iface;
1106  return S_OK;
1107 }
static const IEnumOLEVERBVtbl EnumOLEVERB_VTable
Definition: ole2.c:1082
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define index(s, c)
Definition: various.h:29
#define S_OK
Definition: intsafe.h:59

Referenced by EnumOLEVERB_Clone(), and OleRegEnumVerbs().

◆ EnumOLEVERB_Next()

static HRESULT WINAPI EnumOLEVERB_Next ( IEnumOLEVERB iface,
ULONG  celt,
LPOLEVERB  rgelt,
ULONG pceltFetched 
)
static

Definition at line 960 of file ole2.c.

963 {
965  HRESULT hr = S_OK;
966 
967  TRACE("(%d, %p, %p)\n", celt, rgelt, pceltFetched);
968 
969  if (pceltFetched)
970  *pceltFetched = 0;
971 
972  for (; celt; celt--, rgelt++)
973  {
974  WCHAR wszSubKey[20];
975  LONG cbData;
976  LPWSTR pwszOLEVERB;
977  LPWSTR pwszMenuFlags;
978  LPWSTR pwszAttribs;
979  LONG res = RegEnumKeyW(This->hkeyVerb, This->index, wszSubKey, ARRAY_SIZE(wszSubKey));
980  if (res == ERROR_NO_MORE_ITEMS)
981  {
982  hr = S_FALSE;
983  break;
984  }
985  else if (res != ERROR_SUCCESS)
986  {
987  ERR("RegEnumKeyW failed with error %d\n", res);
989  break;
990  }
991  res = RegQueryValueW(This->hkeyVerb, wszSubKey, NULL, &cbData);
992  if (res != ERROR_SUCCESS)
993  {
994  ERR("RegQueryValueW failed with error %d\n", res);
996  break;
997  }
998  pwszOLEVERB = CoTaskMemAlloc(cbData);
999  if (!pwszOLEVERB)
1000  {
1001  hr = E_OUTOFMEMORY;
1002  break;
1003  }
1004  res = RegQueryValueW(This->hkeyVerb, wszSubKey, pwszOLEVERB, &cbData);
1005  if (res != ERROR_SUCCESS)
1006  {
1007  ERR("RegQueryValueW failed with error %d\n", res);
1009  CoTaskMemFree(pwszOLEVERB);
1010  break;
1011  }
1012 
1013  TRACE("verb string: %s\n", debugstr_w(pwszOLEVERB));
1014  pwszMenuFlags = wcschr(pwszOLEVERB, ',');
1015  if (!pwszMenuFlags)
1016  {
1018  CoTaskMemFree(pwszOLEVERB);
1019  break;
1020  }
1021  /* nul terminate the name string and advance to first character */
1022  *pwszMenuFlags = '\0';
1023  pwszMenuFlags++;
1024  pwszAttribs = wcschr(pwszMenuFlags, ',');
1025  if (!pwszAttribs)
1026  {
1028  CoTaskMemFree(pwszOLEVERB);
1029  break;
1030  }
1031  /* nul terminate the menu string and advance to first character */
1032  *pwszAttribs = '\0';
1033  pwszAttribs++;
1034 
1035  /* fill out structure for this verb */
1036  rgelt->lVerb = wcstol(wszSubKey, NULL, 10);
1037  rgelt->lpszVerbName = pwszOLEVERB; /* user should free */
1038  rgelt->fuFlags = wcstol(pwszMenuFlags, NULL, 10);
1039  rgelt->grfAttribs = wcstol(pwszAttribs, NULL, 10);
1040 
1041  if (pceltFetched)
1042  (*pceltFetched)++;
1043  This->index++;
1044  }
1045  return hr;
1046 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define REGDB_E_READREGDB
Definition: winerror.h:2692
#define OLEOBJ_E_INVALIDVERB
Definition: winerror.h:2723
_Check_return_ long __cdecl wcstol(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4254
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2416
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
#define ARRAY_SIZE(a)
Definition: main.h:24
GLuint res
Definition: glext.h:9613
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

◆ EnumOLEVERB_QueryInterface()

static HRESULT WINAPI EnumOLEVERB_QueryInterface ( IEnumOLEVERB iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 924 of file ole2.c.

926 {
927  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
928  if (IsEqualIID(riid, &IID_IUnknown) ||
930  {
931  IEnumOLEVERB_AddRef(iface);
932  *ppv = iface;
933  return S_OK;
934  }
935  return E_NOINTERFACE;
936 }
#define E_NOINTERFACE
Definition: winerror.h:2364
const GUID IID_IEnumOLEVERB
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 946 of file ole2.c.

948 {
950  LONG refs = InterlockedDecrement(&This->ref);
951  TRACE("()\n");
952  if (!refs)
953  {
954  RegCloseKey(This->hkeyVerb);
956  }
957  return refs;
958 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 1059 of file ole2.c.

1061 {
1063 
1064  TRACE("()\n");
1065 
1066  This->index = 0;
1067  return S_OK;
1068 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ EnumOLEVERB_Skip()

static HRESULT WINAPI EnumOLEVERB_Skip ( IEnumOLEVERB iface,
ULONG  celt 
)
static

Definition at line 1048 of file ole2.c.

1050 {
1052 
1053  TRACE("(%d)\n", celt);
1054 
1055  This->index += celt;
1056  return S_OK;
1057 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ FreePropVariantArray()

HRESULT WINAPI FreePropVariantArray ( ULONG  cVariants,
PROPVARIANT *  rgvars 
)

Definition at line 3267 of file ole2.c.

3269 {
3270  ULONG i;
3271 
3272  TRACE("(%u, %p)\n", cVariants, rgvars);
3273 
3274  if (!rgvars)
3275  return E_INVALIDARG;
3276 
3277  for(i = 0; i < cVariants; i++)
3278  PropVariantClear(&rgvars[i]);
3279 
3280  return S_OK;
3281 }
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2968
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
unsigned int ULONG
Definition: retypes.h:1

Referenced by PropVariantClear().

◆ get_droptarget_handle()

static HANDLE get_droptarget_handle ( HWND  hwnd)
inlinestatic

Definition at line 281 of file ole2.c.

282 {
284 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:120
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)

Referenced by get_droptarget_local_handle(), is_droptarget(), and RevokeDragDrop().

◆ get_droptarget_local_handle()

static HANDLE get_droptarget_local_handle ( HWND  hwnd)
static

Definition at line 308 of file ole2.c.

309 {
310  HANDLE handle, local_handle = 0;
311 
313 
314  if(handle)
315  {
316  DWORD pid;
317  HANDLE process;
318 
321  if(process)
322  {
325  }
326  }
327  return local_handle;
328 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3835
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED LPLOOKUPSERVICE_COMPLETION_ROUTINE HANDLE * handle
Definition: sock.c:82
#define CloseHandle
Definition: compat.h:406
static HANDLE process
Definition: process.c:76
#define DUPLICATE_SAME_ACCESS
#define PROCESS_DUP_HANDLE
DWORD WINAPI GetWindowThreadProcessId(HWND, PDWORD)
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:281
BOOL WINAPI DuplicateHandle(IN HANDLE hSourceProcessHandle, IN HANDLE hSourceHandle, IN HANDLE hTargetProcessHandle, OUT LPHANDLE lpTargetHandle, IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwOptions)
Definition: handle.c:149

Referenced by get_droptarget_pointer().

◆ get_droptarget_pointer()

static IDropTarget* get_droptarget_pointer ( HWND  hwnd)
static

Definition at line 536 of file ole2.c.

537 {
538  IDropTarget *droptarget = NULL;
539  HANDLE map;
540  IStream *stream;
541 
543  if(!map) return NULL;
544 
546  {
547  CoUnmarshalInterface(stream, &IID_IDropTarget, (void**)&droptarget);
548  IStream_Release(stream);
549  }
550  CloseHandle(map);
551  return droptarget;
552 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:363
#define CloseHandle
Definition: compat.h:406
smooth NULL
Definition: ftsmooth.c:416
Definition: _map.h:44
Definition: parse.h:22
GLuint GLuint stream
Definition: glext.h:7522
static HANDLE get_droptarget_local_handle(HWND hwnd)
Definition: ole2.c:308
#define SUCCEEDED(hr)
Definition: intsafe.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint GLenum GLenum GLenum GLint GLuint GLenum GLenum GLfloat GLenum GLfloat GLenum map
Definition: glfuncs.h:262

Referenced by drag_enter().

◆ get_target_from_wrapper()

static HRESULT get_target_from_wrapper ( IDropTarget wrapper,
IDropTarget **  target 
)
inlinestatic

Definition at line 435 of file ole2.c.

436 {
438  *target = GetPropW( This->hwnd, prop_oledroptarget );
439  if (!*target) return DRAGDROP_E_NOTREGISTERED;
440  IDropTarget_AddRef( *target );
441  return S_OK;
442 }
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:2652
#define S_OK
Definition: intsafe.h:59
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:116
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:400
GLenum target
Definition: glext.h:7315

Referenced by DropTargetWrapper_DragEnter(), DropTargetWrapper_DragLeave(), DropTargetWrapper_DragOver(), and DropTargetWrapper_Drop().

◆ give_feedback()

static HRESULT give_feedback ( TrackerWindowInfo info)
static

Definition at line 2372 of file ole2.c.

2373 {
2374  HRESULT hr;
2375  int res;
2376  HCURSOR cur;
2377 
2378 #ifdef __REACTOS__
2379  if (info->curDragTarget == NULL && info->accepterHWND == NULL)
2380  *info->pdwEffect = DROPEFFECT_NONE;
2381 #else
2382  if (info->curDragTarget == NULL)
2383  *info->pdwEffect = DROPEFFECT_NONE;
2384 #endif
2385 
2386  hr = IDropSource_GiveFeedback( info->dropSource, *info->pdwEffect );
2387 
2389  {
2390  if (*info->pdwEffect & DROPEFFECT_MOVE)
2391  res = CURSOR_MOVE;
2392  else if (*info->pdwEffect & DROPEFFECT_COPY)
2393  res = CURSOR_COPY;
2394  else if (*info->pdwEffect & DROPEFFECT_LINK)
2395  res = CURSOR_LINK;
2396  else
2397  res = CURSOR_NODROP;
2398 
2399  cur = LoadCursorW( hProxyDll, MAKEINTRESOURCEW( res ) );
2400  SetCursor( cur );
2401  }
2402 
2403  return hr;
2404 }
HRESULT hr
Definition: shlfolder.c:183
#define CURSOR_LINK
Definition: olestd.h:55
HICON HCURSOR
Definition: windef.h:299
smooth NULL
Definition: ftsmooth.c:416
#define CURSOR_MOVE
Definition: olestd.h:53
LONG HRESULT
Definition: typedefs.h:77
#define CURSOR_COPY
Definition: olestd.h:54
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:2648
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
GLuint res
Definition: glext.h:9613
#define CURSOR_NODROP
Definition: olestd.h:52
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582

Referenced by OLEDD_TrackStateChange().

◆ impl_from_IDropTarget()

static DropTargetWrapper* impl_from_IDropTarget ( IDropTarget iface)
inlinestatic

Definition at line 400 of file ole2.c.

401 {
402  return CONTAINING_RECORD(iface, DropTargetWrapper, IDropTarget_iface);
403 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by DropTargetWrapper_AddRef(), DropTargetWrapper_QueryInterface(), DropTargetWrapper_Release(), and get_target_from_wrapper().

◆ impl_from_IEnumOLEVERB()

static EnumOLEVERB* impl_from_IEnumOLEVERB ( IEnumOLEVERB iface)
inlinestatic

Definition at line 919 of file ole2.c.

920 {
921  return CONTAINING_RECORD(iface, EnumOLEVERB, IEnumOLEVERB_iface);
922 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by EnumOLEVERB_AddRef(), EnumOLEVERB_Clone(), EnumOLEVERB_Next(), EnumOLEVERB_Release(), EnumOLEVERB_Reset(), and EnumOLEVERB_Skip().

◆ is_droptarget()

static BOOL is_droptarget ( HWND  hwnd)
inlinestatic

Definition at line 291 of file ole2.c.

292 {
293  return get_droptarget_handle(hwnd) != 0;
294 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:281

Referenced by drag_enter(), and RegisterDragDrop().

◆ IsAccelerator()

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

Definition at line 1949 of file ole2.c.

1950 {
1951  LPACCEL lpAccelTbl;
1952  int i;
1953 
1954  if(!lpMsg) return FALSE;
1955  if (!hAccel)
1956  {
1957  WARN_(accel)("NULL accel handle\n");
1958  return FALSE;
1959  }
1960  if((lpMsg->message != WM_KEYDOWN &&
1961  lpMsg->message != WM_SYSKEYDOWN &&
1962  lpMsg->message != WM_SYSCHAR &&
1963  lpMsg->message != WM_CHAR)) return FALSE;
1964  lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL));
1965  if (NULL == lpAccelTbl)
1966  {
1967  return FALSE;
1968  }
1969  if (CopyAcceleratorTableW(hAccel, lpAccelTbl, cAccelEntries) != cAccelEntries)
1970  {
1971  WARN_(accel)("CopyAcceleratorTableW failed\n");
1972  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
1973  return FALSE;
1974  }
1975 
1976  TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
1977  "msg->hwnd=%p, msg->message=%04x, wParam=%08lx, lParam=%08lx\n",
1978  hAccel, cAccelEntries,
1979  lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1980  for(i = 0; i < cAccelEntries; i++)
1981  {
1982  if(lpAccelTbl[i].key != lpMsg->wParam)
1983  continue;
1984 
1985  if(lpMsg->message == WM_CHAR)
1986  {
1987  if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
1988  {
1989  TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", LOWORD(lpMsg->wParam) & 0xff);
1990  goto found;
1991  }
1992  }
1993  else
1994  {
1995  if(lpAccelTbl[i].fVirt & FVIRTKEY)
1996  {
1997  INT mask = 0;
1998  TRACE_(accel)("found accel for virt_key %04lx (scan %04x)\n",
1999  lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
2000  if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
2001  if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
2002  if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
2003  if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
2004  TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
2005  }
2006  else
2007  {
2008  if(!(lpMsg->lParam & 0x01000000)) /* no special_key */
2009  {
2010  if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
2011  { /* ^^ ALT pressed */
2012  TRACE_(accel)("found accel for Alt-%c\n", LOWORD(lpMsg->wParam) & 0xff);
2013  goto found;
2014  }
2015  }
2016  }
2017  }
2018  }
2019 
2020  WARN_(accel)("couldn't translate accelerator key\n");
2021  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2022  return FALSE;
2023 
2024 found:
2025  if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
2026  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2027  return TRUE;
2028 }
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1699
BYTE fVirt
Definition: winuser.h:2898
WORD cmd
Definition: winuser.h:2900
WPARAM wParam
Definition: winuser.h:3091
#define VK_MENU
Definition: winuser.h:2179
int32_t INT
Definition: typedefs.h:56
#define FALT
Definition: winuser.h:20
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLenum GLint GLuint mask
Definition: glext.h:6028
HACCEL hAccel
Definition: main.c:47
#define WM_SYSCHAR
Definition: winuser.h:1703
#define VK_SHIFT
Definition: winuser.h:2177
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1697
LPARAM lParam
Definition: winuser.h:3092
int WINAPI CopyAcceleratorTableW(_In_ HACCEL hAccelSrc, _Out_writes_to_opt_(cAccelEntries, return) LPACCEL lpAccelDst, _In_ int cAccelEntries)
SHORT WINAPI GetKeyState(_In_ int)
#define TRACE_(x)
Definition: compat.h:66
#define FSHIFT
Definition: winuser.h:23
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define FCONTROL
Definition: winuser.h:21
HWND hwnd
Definition: winuser.h:3089
#define VK_CONTROL
Definition: winuser.h:2178
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define HIWORD(l)
Definition: typedefs.h:246
UINT message
Definition: winuser.h:3090
#define FVIRTKEY
Definition: winuser.h:24
#define WARN_(ch,...)
Definition: debug.h:157
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
Definition: path.c:41

Referenced by OleTranslateAccelerator().

◆ OLE_FreeClipDataArray()

static void OLE_FreeClipDataArray ( ULONG  count,
CLIPDATA *  pClipDataArray 
)
static

Definition at line 2852 of file ole2.c.

2853 {
2854  ULONG i;
2855  for (i = 0; i < count; i++)
2856  CoTaskMemFree(pClipDataArray[i].pClipData);
2857 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int ULONG
Definition: retypes.h:1

Referenced by PropVariantClear().

◆ 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

◆ OLEClipbrd_Initialize()

void OLEClipbrd_Initialize ( void  )

Definition at line 1781 of file clipboard.c.

1782 {
1784 
1785  if ( !theOleClipboard )
1786  {
1787  ole_clipbrd* clipbrd;
1788  HGLOBAL h;
1789 
1790  TRACE("()\n");
1791 
1792  clipbrd = HeapAlloc( GetProcessHeap(), 0, sizeof(*clipbrd) );
1793  if (!clipbrd) return;
1794 
1795  clipbrd->latest_snapshot = NULL;
1796  clipbrd->window = NULL;
1797  clipbrd->src_data = NULL;
1798  clipbrd->cached_enum = NULL;
1799 
1801  if(!h)
1802  {
1803  HeapFree(GetProcessHeap(), 0, clipbrd);
1804  return;
1805  }
1806 
1807  if(FAILED(CreateStreamOnHGlobal(h, TRUE, &clipbrd->marshal_data)))
1808  {
1809  GlobalFree(h);
1810  HeapFree(GetProcessHeap(), 0, clipbrd);
1811  return;
1812  }
1813 
1814  theOleClipboard = clipbrd;
1815  }
1816 }
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HWND window
Definition: clipboard.c:153
IDataObject * src_data
Definition: clipboard.c:154
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
IStream * marshal_data
Definition: clipboard.c:156
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
snapshot * latest_snapshot
Definition: clipboard.c:151
ole_priv_data * cached_enum
Definition: clipboard.c:155
#define GMEM_DDESHARE
Definition: winbase.h:295
static void register_clipboard_formats(void)
Definition: clipboard.c:1744
static ole_clipbrd * theOleClipboard
Definition: clipboard.c:175
#define HeapFree(x, y, z)
Definition: compat.h:402
#define GMEM_MOVEABLE
Definition: winbase.h:291

Referenced by OleInitialize().

◆ OLEClipbrd_UnInitialize()

void OLEClipbrd_UnInitialize ( void  )

Definition at line 2027 of file clipboard.c.

2028 {
2029  ole_clipbrd *clipbrd = theOleClipboard;
2030 
2031  TRACE("()\n");
2032 
2033  if ( clipbrd )
2034  {
2035  static const WCHAR ole32W[] = {'o','l','e','3','2',0};
2036  HINSTANCE hinst = GetModuleHandleW(ole32W);
2037 
2038  /* OleUninitialize() does not release the reference to the dataobject, so
2039  take an additional reference here. This reference is then leaked. */
2040  if (clipbrd->src_data)
2041  {
2042  IDataObject_AddRef(clipbrd->src_data);
2043  set_src_dataobject(clipbrd, NULL);
2044  }
2045 
2046  if ( clipbrd->window )
2047  {
2048  DestroyWindow(clipbrd->window);
2050  }
2051 
2052  IStream_Release(clipbrd->marshal_data);
2053  HeapFree(GetProcessHeap(), 0, clipbrd);
2055  }
2056 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HWND window
Definition: clipboard.c:153
BOOL WINAPI DestroyWindow(_In_ HWND)
IDataObject * src_data
Definition: clipboard.c:154
IStream * marshal_data
Definition: clipboard.c:156
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
__wchar_t WCHAR
Definition: xmlstorage.h:180
static HRESULT set_src_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1989
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:847
static const WCHAR clipbrd_wndclass[]
Definition: clipboard.c:201
static HINSTANCE hinst
Definition: edit.c:551
static ole_clipbrd * theOleClipboard
Definition: clipboard.c:175
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by OleUninitialize().

◆ OleCreate()

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

Definition at line 2609 of file ole2.c.

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

◆ OleCreateMenuDescriptor()

HOLEMENU WINAPI OleCreateMenuDescriptor ( HMENU  hmenuCombined,
LPOLEMENUGROUPWIDTHS  lpMenuWidths 
)

Definition at line 1812 of file ole2.c.

1815 {
1816  HOLEMENU hOleMenu;
1817  OleMenuDescriptor *pOleMenuDescriptor;
1818  int i;
1819 
1820  if ( !hmenuCombined || !lpMenuWidths )
1821  return 0;
1822 
1823  /* Create an OLE menu descriptor */
1824  if ( !(hOleMenu = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
1825  sizeof(OleMenuDescriptor) ) ) )
1826  return 0;
1827 
1828  pOleMenuDescriptor = GlobalLock( hOleMenu );
1829  if ( !pOleMenuDescriptor )
1830  return 0;
1831 
1832  /* Initialize menu group widths and hmenu */
1833  for ( i = 0; i < 6; i++ )
1834  pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
1835 
1836  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
1837  pOleMenuDescriptor->bIsServerItem = FALSE;
1838  GlobalUnlock( hOleMenu );
1839 
1840  return hOleMenu;
1841 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HMENU hmenuCombined
Definition: ole2.c:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
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

◆ OLEDD_DragTrackerWindowProc()

static LRESULT WINAPI OLEDD_DragTrackerWindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2150 of file ole2.c.

2155 {
2156  switch (uMsg)
2157  {
2158  case WM_CREATE:
2159  {
2160  LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
2161 
2162  SetWindowLongPtrW(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams);
2164 
2165  break;
2166  }
2167  case WM_TIMER:
2168  case WM_MOUSEMOVE:
2169  case WM_LBUTTONUP:
2170  case WM_MBUTTONUP:
2171  case WM_RBUTTONUP:
2172  case WM_LBUTTONDOWN:
2173  case WM_MBUTTONDOWN:
2174  case WM_RBUTTONDOWN:
2175  {
2177  if (trackerInfo->trackingDone) break;
2178  OLEDD_TrackStateChange(trackerInfo);
2179  break;
2180  }
2181  case WM_DESTROY:
2182  {
2184  break;
2185  }
2186  }
2187 
2188  /*
2189  * This is a window proc after all. Let's call the default.
2190  */
2191  return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2192 }
#define WM_MBUTTONUP
Definition: winuser.h:1765
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
BOOL trackingDone
Definition: ole2.c:64
WPARAM wParam
Definition: combotst.c:138
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
struct tagCREATESTRUCTA * LPCREATESTRUCTA
smooth NULL
Definition: ftsmooth.c:416
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
#define GetWindowLongPtrA
Definition: winuser.h:4803
static void OLEDD_TrackStateChange(TrackerWindowInfo *trackerInfo)
Definition: ole2.c:2416
#define WM_TIMER
Definition: winuser.h:1724
#define WM_RBUTTONUP
Definition: winuser.h:1762
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
LPVOID lpCreateParams
Definition: winuser.h:2915
#define WM_LBUTTONUP
Definition: winuser.h:1759
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_MOUSEMOVE
Definition: winuser.h:1757
#define WM_CREATE
Definition: winuser.h:1590
#define SetWindowLongPtrW
Definition: winuser.h:5321
LPARAM lParam
Definition: combotst.c:139
#define DRAG_TIMER_ID
Definition: ole2.c:2148

Referenced by OLEDD_Initialize().

◆ OLEDD_GetButtonState()

static DWORD OLEDD_GetButtonState ( void  )
static

Definition at line 2484 of file ole2.c.

2485 {
2486  BYTE keyboardState[256];
2487  DWORD keyMask = 0;
2488 
2489  GetKeyboardState(keyboardState);
2490 
2491  if ( (keyboardState[VK_SHIFT] & 0x80) !=0)
2492  keyMask |= MK_SHIFT;
2493 
2494  if ( (keyboardState[VK_CONTROL] & 0x80) !=0)
2495  keyMask |= MK_CONTROL;
2496 
2497  if ( (keyboardState[VK_MENU] & 0x80) !=0)
2498  keyMask |= MK_ALT;
2499 
2500  if ( (keyboardState[VK_LBUTTON] & 0x80) !=0)
2501  keyMask |= MK_LBUTTON;
2502 
2503  if ( (keyboardState[VK_RBUTTON] & 0x80) !=0)
2504  keyMask |= MK_RBUTTON;
2505 
2506  if ( (keyboardState[VK_MBUTTON] & 0x80) !=0)
2507  keyMask |= MK_MBUTTON;
2508 
2509  return keyMask;
2510 }
#define MK_SHIFT
Definition: winuser.h:2344
#define MK_LBUTTON
Definition: winuser.h:2342
#define VK_LBUTTON
Definition: winuser.h:2165
#define MK_MBUTTON
Definition: winuser.h:2346
#define VK_MENU
Definition: winuser.h:2179
#define VK_RBUTTON
Definition: winuser.h:2166
#define VK_SHIFT
Definition: winuser.h:2177
#define MK_RBUTTON
Definition: winuser.h:2343
unsigned long DWORD
Definition: ntddk_ex.h:95
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
unsigned char BYTE
Definition: mem.h:68
#define MK_CONTROL
Definition: winuser.h:2345
#define VK_CONTROL
Definition: winuser.h:2178
#define VK_MBUTTON
Definition: winuser.h:2168

Referenced by DoDragDrop().

◆ OLEDD_Initialize()

static void OLEDD_Initialize ( void  )
static

Definition at line 2123 of file ole2.c.

2124 {
2125  WNDCLASSW wndClass;
2126 
2127  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2128  wndClass.style = CS_GLOBALCLASS;
2130  wndClass.cbClsExtra = 0;
2131  wndClass.cbWndExtra = sizeof(TrackerWindowInfo*);
2132  wndClass.hCursor = 0;
2133  wndClass.hbrBackground = 0;
2135 
2136  RegisterClassW (&wndClass);
2137 }
UINT style
Definition: winuser.h:3151
static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:2150
#define ZeroMemory
Definition: winbase.h:1642
int cbClsExtra
Definition: winuser.h:3153
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WNDPROC lpfnWndProc
Definition: winuser.h:3152
LPCWSTR lpszClassName
Definition: winuser.h:3160
int cbWndExtra
Definition: winuser.h:3154
#define CS_GLOBALCLASS
Definition: winuser.h:647
static const WCHAR OLEDD_DRAGTRACKERCLASS[]
Definition: ole2.c:106
HCURSOR hCursor
Definition: winuser.h:3157
HBRUSH hbrBackground
Definition: winuser.h:3158

Referenced by OleInitialize().

◆ OLEDD_TrackStateChange()

static void OLEDD_TrackStateChange ( TrackerWindowInfo trackerInfo)
static

Definition at line 2416 of file ole2.c.

2417 {
2418  HWND hwndNewTarget = 0;
2419  POINT pt;
2420 
2421  /*
2422  * Get the handle of the window under the mouse
2423  */
2424  pt.x = trackerInfo->curMousePos.x;
2425  pt.y = trackerInfo->curMousePos.y;
2426  hwndNewTarget = WindowFromPoint(pt);
2427 
2428  trackerInfo->returnValue = IDropSource_QueryContinueDrag(trackerInfo->dropSource,
2429  trackerInfo->escPressed,
2430  trackerInfo->dwKeyState);
2431 
2432  if (trackerInfo->curTargetHWND != hwndNewTarget &&
2433  (trackerInfo->returnValue == S_OK ||
2434  trackerInfo->returnValue == DRAGDROP_S_DROP))
2435  {
2436  if (trackerInfo->curDragTarget)
2437  {
2438  IDropTarget_DragLeave(trackerInfo->curDragTarget);
2439  IDropTarget_Release(trackerInfo->curDragTarget);
2440  trackerInfo->curDragTarget = NULL;
2441  trackerInfo->curTargetHWND = NULL;
2442  }
2443 #ifdef __REACTOS__
2444  trackerInfo->accepterHWND = NULL;
2445 #endif
2446 
2447  if (hwndNewTarget)
2448  drag_enter( trackerInfo, hwndNewTarget );
2449 
2450  give_feedback( trackerInfo );
2451 
2452  }
2453 
2454  if (trackerInfo->returnValue == S_OK)
2455  {
2456  if (trackerInfo->curDragTarget)
2457  {
2458  *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2459  IDropTarget_DragOver(trackerInfo->curDragTarget,
2460  trackerInfo->dwKeyState,
2461  trackerInfo->curMousePos,
2462  trackerInfo->pdwEffect);
2463  *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect;
2464  }
2465 #ifdef __REACTOS__
2466  else if (trackerInfo->accepterHWND)
2467  {
2468  *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2469  }
2470 #endif
2471  give_feedback( trackerInfo );
2472  }
2473  else
2474  drag_end( trackerInfo );
2475 }
DWORD dwOKEffect
Definition: ole2.c:62
#define pt(x, y)
Definition: drawing.c:79
LONG y
Definition: windef.h:330
DWORD dwKeyState
Definition: ole2.c:74
smooth NULL
Definition: ftsmooth.c:416
LONG x
Definition: windef.h:329
HRESULT returnValue
Definition: ole2.c:65
POINTL curMousePos
Definition: ole2.c:73
static void drag_end(TrackerWindowInfo *info)
Definition: ole2.c:2319
HWND curTargetHWND
Definition: ole2.c:68
#define S_OK
Definition: intsafe.h:59
#define DRAGDROP_S_DROP
Definition: winerror.h:2646
HWND WINAPI WindowFromPoint(_In_ POINT)
static HRESULT give_feedback(TrackerWindowInfo *info)
Definition: ole2.c:2372
IDropSource * dropSource
Definition: ole2.c:61
static void drag_enter(TrackerWindowInfo *info, HWND new_target)
Definition: ole2.c:2260
IDropTarget * curDragTarget
Definition: ole2.c:69
DWORD * pdwEffect
Definition: ole2.c:63

Referenced by DoDragDrop(), and OLEDD_DragTrackerWindowProc().

◆ OleDestroyMenuDescriptor()

HRESULT WINAPI OleDestroyMenuDescriptor ( HOLEMENU  hmenuDescriptor)

Definition at line 1847 of file ole2.c.

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

◆ OleDoAutoConvert()

HRESULT WINAPI OleDoAutoConvert ( LPSTORAGE  pStg,
LPCLSID  pClsidNew 
)

Definition at line 2758 of file ole2.c.

2759 {
2760  WCHAR *user_type_old, *user_type_new;
2761  CLIPFORMAT cf;
2762  STATSTG stat;
2763  CLSID clsid;
2764  HRESULT hr;
2765 
2766  TRACE("(%p, %p)\n", pStg, pClsidNew);
2767 
2768  *pClsidNew = CLSID_NULL;
2769  if(!pStg)
2770  return E_INVALIDARG;
2771  hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME);
2772  if(FAILED(hr))
2773  return hr;
2774 
2775  *pClsidNew = stat.clsid;
2776  hr = OleGetAutoConvert(&stat.clsid, &clsid);
2777  if(FAILED(hr))
2778  return hr;
2779 
2780  hr = IStorage_SetClass(pStg, &clsid);
2781  if(FAILED(hr))
2782  return hr;
2783 
2784  hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old);
2785  if(FAILED(hr)) {
2786  cf = 0;
2787  user_type_new = NULL;
2788  }
2789 
2790  hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new);
2791  if(FAILED(hr))
2792  user_type_new = NULL;
2793 
2794  hr = WriteFmtUserTypeStg(pStg, cf, user_type_new);
2795  CoTaskMemFree(user_type_new);
2796  if(FAILED(hr))
2797  {
2798  CoTaskMemFree(user_type_old);
2799  IStorage_SetClass(pStg, &stat.clsid);
2800  return hr;
2801  }
2802 
2803  hr = SetConvertStg(pStg, TRUE);
2804  if(FAILED(hr))
2805  {
2806  WriteFmtUserTypeStg(pStg, cf, user_type_old);
2807  IStorage_SetClass(pStg, &stat.clsid);
2808  }
2809  else
2810  *pClsidNew = clsid;
2811  CoTaskMemFree(user_type_old);
2812  return hr;
2813 }
static IClassFactory * cf
static LPCLSID pClsidNew
Definition: compobj.c:76
#define TRUE
Definition: types.h:120
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
Definition: storage32.c:9356
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
Definition: storage32.c:10648
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
Definition: ole2.c:2704
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define CLSID_NULL
Definition: guiddef.h:99
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:82
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:678
HRESULT WINAPI ReadFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
Definition: storage32.c:9399

Referenced by test_OleDoAutoConvert().

◆ OleDraw()

HRESULT WINAPI OleDraw ( IUnknown pUnk,
DWORD  dwAspect,
HDC  hdcDraw,
LPCRECT  rect 
)

Definition at line 2565 of file ole2.c.

2570 {
2571  HRESULT hres;
2573 
2574  if (!pUnk) return E_INVALIDARG;
2575 
2576  hres = IUnknown_QueryInterface(pUnk,
2577  &IID_IViewObject,
2578  (void**)&viewobject);
2579  if (SUCCEEDED(hres))
2580  {
2581  hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, (RECTL*)rect, 0, 0, 0);
2582  IViewObject_Release(viewobject);
2583  return hres;
2584  }
2585  else
2586  return DV_E_NOIVIEWOBJECT;
2587 }
const GUID IID_IViewObject
& rect
Definition: startmenu.cpp:1413
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static IViewObject viewobject
Definition: ole2.c:972
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define DV_E_NOIVIEWOBJECT
Definition: winerror.h:2642
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by test_OleDraw(), and test_OleLoad().

◆ OleGetAutoConvert()

HRESULT WINAPI OleGetAutoConvert ( REFCLSID  clsidOld,
LPCLSID  pClsidNew 
)

Definition at line 2704 of file ole2.c.

2705 {
2706  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2707  HKEY hkey = NULL;
2709  LONG len;
2710  HRESULT res = S_OK;
2711 
2712  res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey);
2713  if (FAILED(res))
2714  goto done;
2715 
2716  len = sizeof(buf);
2717  if (RegQueryValueW(hkey, NULL, buf, &len))
2718  {
2720  goto done;
2721  }
2723 done:
2724  if (hkey) RegCloseKey(hkey);
2725  return res;
2726 }
static LPCLSID pClsidNew
Definition: compobj.c:76
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define KEY_READ
Definition: nt_native.h:1023
#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:2448
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4254
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:2338

Referenced by OleDoAutoConvert(), and test_OleDoAutoConvert().

◆ OleInitialize()

HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize ( LPVOID  reserved)

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 }
HRESULT hr
Definition: shlfolder.c:183
static struct oletls * COM_CurrentInfo(void)
void OLEClipbrd_Initialize(void)
Definition: clipboard.c:1781
r reserved
Definition: btrfs.c:2865
#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:2123
#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:2002
static void OLEMenu_Initialize(void)
Definition: ole2.c:1411

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

◆ OleInitializeWOW()

HRESULT WINAPI OleInitializeWOW ( DWORD  x,
DWORD  y 
)

Definition at line 269 of file ole2.c.

269  {
270  FIXME("(0x%08x, 0x%08x),stub!\n",x, y);
271  return 0;
272 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define FIXME(fmt,...)
Definition: debug.h:110
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

◆ OleIsRunning()

BOOL WINAPI OleIsRunning ( LPOLEOBJECT  object)

Definition at line 2818 of file ole2.c.

2819 {
2820  IRunnableObject *pRunnable;
2821  HRESULT hr;
2822  BOOL running;
2823 
2824  TRACE("(%p)\n", object);
2825 
2826  if (!object) return FALSE;
2827 
2828  hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
2829  if (FAILED(hr))
2830  return TRUE;
2831  running = IRunnableObject_IsRunning(pRunnable);
2832  IRunnableObject_Release(pRunnable);
2833  return running;
2834 }
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
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 1224 of file ole2.c.

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

◆ OleLockRunning()

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

Definition at line 1377 of file ole2.c.

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

◆ OLEMenu_CallWndProc()

static LRESULT CALLBACK OLEMenu_CallWndProc ( INT  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1628 of file ole2.c.

1629 {
1630  LPCWPSTRUCT pMsg;
1631  HOLEMENU hOleMenu = 0;
1632  OleMenuDescriptor *pOleMenuDescriptor = NULL;
1633  OleMenuHookItem *pHookItem = NULL;
1634  WORD fuFlags;
1635 
1636  TRACE("%i, %04lx, %08lx\n", code, wParam, lParam );
1637 
1638  /* Check if we're being asked to process the message */
1639  if ( HC_ACTION != code )
1640  goto NEXTHOOK;
1641 
1642  /* Retrieve the current message being dispatched from lParam */
1643  pMsg = (LPCWPSTRUCT)lParam;
1644 
1645  /* Check if the message is destined for a window we are interested in:
1646  * If the window has an OLEMenu property we may need to dispatch
1647  * the menu message to its active objects window instead. */
1648 
1649  hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1650  if ( !hOleMenu )
1651  goto NEXTHOOK;
1652 
1653  /* Get the menu descriptor */
1654  pOleMenuDescriptor = GlobalLock( hOleMenu );
1655  if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1656  goto NEXTHOOK;
1657 
1658  /* Process menu messages */
1659  switch( pMsg->message )
1660  {
1661  case WM_INITMENU:
1662  {
1663  /* Reset the menu descriptor state */
1664  pOleMenuDescriptor->bIsServerItem = FALSE;
1665 
1666  /* Send this message to the server as well */
1667  SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1668  pMsg->message, pMsg->wParam, pMsg->lParam );
1669  goto NEXTHOOK;
1670  }
1671 
1672  case WM_INITMENUPOPUP:
1673  {
1674  /* Save the state for whether this is a server owned menu */
1675  OLEMenu_SetIsServerMenu( (HMENU)pMsg->wParam, pOleMenuDescriptor );
1676  break;
1677  }
1678 
1679  case WM_MENUSELECT:
1680  {
1681  fuFlags = HIWORD(pMsg->wParam); /* Get flags */
1682  if ( fuFlags & MF_SYSMENU )
1683  goto NEXTHOOK;
1684 
1685  /* Save the state for whether this is a server owned popup menu */
1686  else if ( fuFlags & MF_POPUP )
1687  OLEMenu_SetIsServerMenu( (HMENU)pMsg->lParam, pOleMenuDescriptor );
1688 
1689  break;
1690  }
1691 
1692  case WM_DRAWITEM:
1693  {
1694  LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) pMsg->lParam;
1695  if ( pMsg->wParam != 0 || lpdis->CtlType != ODT_MENU )
1696  goto NEXTHOOK; /* Not a menu message */
1697 
1698  break;
1699  }
1700 
1701  default:
1702  goto NEXTHOOK;
1703  }
1704 
1705  /* If the message was for the server dispatch it accordingly */
1706  if ( pOleMenuDescriptor->bIsServerItem )
1707  {
1708  SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1709  pMsg->message, pMsg->wParam, pMsg->lParam );
1710  }
1711 
1712 NEXTHOOK:
1713  if ( pOleMenuDescriptor )
1714  GlobalUnlock( hOleMenu );
1715 
1716  /* Lookup the hook item for the current thread */
1717  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1718  {
1719  /* This should never fail!! */
1720  WARN("could not retrieve hHook for current thread!\n" );
1721  return 0;
1722  }
1723 
1724  /* Pass on the message to the next hooker */
1725  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
1726 }
static const WCHAR prop_olemenuW[]
Definition: ole2.c:112
HWND hwndActiveObject
Definition: ole2.c:80
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define WM_INITMENUPOPUP
Definition: winuser.h:1728
#define WARN(fmt,...)
Definition: debug.h:111
#define ODT_MENU
Definition: winuser.h:2512
WPARAM wParam
Definition: combotst.c:138
static OleMenuHookItem * OLEMenu_IsHookInstalled(DWORD tid)
Definition: ole2.c:1523
#define WM_MENUSELECT
Definition: winuser.h:1729
smooth NULL
Definition: ftsmooth.c:416
#define MF_SYSMENU
Definition: winuser.h:141
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define TRACE(s)
Definition: solgame.cpp:4
if(!(yy_init))
Definition: macro.lex.yy.c:714
unsigned short WORD
Definition: ntddk_ex.h:93
LPARAM lParam
Definition: winuser.h:3000
WPARAM wParam
Definition: winuser.h:3001
#define MF_POPUP
Definition: winuser.h:136
UINT message
Definition: winuser.h:3002
HHOOK CallWndProc_hHook
Definition: ole2.c:91
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define WM_INITMENU
Definition: winuser.h:1727
static BOOL OLEMenu_SetIsServerMenu(HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor)
Definition: ole2.c:1589
#define HC_ACTION
Definition: winuser.h:48
struct tagCWPSTRUCT * LPCWPSTRUCT
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define WM_DRAWITEM
Definition: winuser.h:1627
BOOL bIsServerItem
Definition: ole2.c:83
#define HIWORD(l)
Definition: typedefs.h:246
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
LPARAM lParam
Definition: combotst.c:139

Referenced by OLEMenu_InstallHooks().

◆ OLEMenu_FindMainMenuIndex()

static BOOL OLEMenu_FindMainMenuIndex ( HMENU  hMainMenu,
HMENU  hPopupMenu,
UINT pnPos 
)
static

Definition at line 1546 of file ole2.c.

1547 {
1548  INT i, nItems;
1549 
1551 
1552  for (i = 0; i < nItems; i++)
1553  {
1554  HMENU hsubmenu;
1555 
1556  /* Is the current item a submenu? */
1557  if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
1558  {
1559  /* If the handle is the same we're done */
1560  if ( hsubmenu == hPopupMenu )
1561  {
1562  if (pnPos)
1563  *pnPos = i;
1564  return TRUE;
1565  }
1566  /* Recursively search without updating pnPos */
1567  else if ( OLEMenu_FindMainMenuIndex( hsubmenu, hPopupMenu, NULL ) )
1568  {
1569  if (pnPos)
1570  *pnPos = i;
1571  return TRUE;
1572  }
1573  }
1574  }
1575 
1576  return FALSE;
1577 }
#define TRUE
Definition: types.h:120
int32_t INT
Definition: typedefs.h:56
HMENU hMainMenu
Definition: mplay32.c:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int nItems
Definition: appswitch.c:56
smooth NULL
Definition: ftsmooth.c:416
static BOOL OLEMenu_FindMainMenuIndex(HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos)
Definition: ole2.c:1546
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60

Referenced by OLEMenu_SetIsServerMenu().

◆ OLEMenu_GetMsgProc()

static LRESULT CALLBACK OLEMenu_GetMsgProc ( INT  code,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1733 of file ole2.c.

1734 {
1735  LPMSG pMsg;
1736  HOLEMENU hOleMenu = 0;
1737  OleMenuDescriptor *pOleMenuDescriptor = NULL;
1738  OleMenuHookItem *pHookItem = NULL;
1739  WORD wCode;
1740 
1741  TRACE("%i, %04lx, %08lx\n", code, wParam, lParam );
1742 
1743  /* Check if we're being asked to process a messages */
1744  if ( HC_ACTION != code )
1745  goto NEXTHOOK;
1746 
1747  /* Retrieve the current message being dispatched from lParam */
1748  pMsg = (LPMSG)lParam;
1749 
1750  /* Check if the message is destined for a window we are interested in:
1751  * If the window has an OLEMenu property we may need to dispatch
1752  * the menu message to its active objects window instead. */
1753 
1754  hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1755  if ( !hOleMenu )
1756  goto NEXTHOOK;
1757 
1758  /* Process menu messages */
1759  switch( pMsg->message )
1760  {
1761  case WM_COMMAND:
1762  {
1763  wCode = HIWORD(pMsg->wParam); /* Get notification code */
1764  if ( wCode )
1765  goto NEXTHOOK; /* Not a menu message */
1766  break;
1767  }
1768  default:
1769  goto NEXTHOOK;
1770  }
1771 
1772  /* Get the menu descriptor */
1773  pOleMenuDescriptor = GlobalLock( hOleMenu );
1774  if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1775  goto NEXTHOOK;
1776 
1777  /* If the message was for the server dispatch it accordingly */
1778  if ( pOleMenuDescriptor->bIsServerItem )
1779  {
1780  /* Change the hWnd in the message to the active objects hWnd.
1781  * The message loop which reads this message will automatically
1782  * dispatch it to the embedded objects window. */
1783  pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
1784  }
1785 
1786 NEXTHOOK:
1787  if ( pOleMenuDescriptor )
1788  GlobalUnlock( hOleMenu );
1789 
1790  /* Lookup the hook item for the current thread */
1791  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1792  {
1793  /* This should never fail!! */
1794  WARN("could not retrieve hHook for current thread!\n" );
1795  return FALSE;
1796  }
1797 
1798  /* Pass on the message to the next hooker */
1799  return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
1800 }
static const WCHAR prop_olemenuW[]
Definition: ole2.c:112
HWND hwndActiveObject
Definition: ole2.c:80
#define WARN(fmt,...)
Definition: debug.h:111
WPARAM wParam
Definition: winuser.h:3091
WPARAM wParam
Definition: combotst.c:138
static OleMenuHookItem * OLEMenu_IsHookInstalled(DWORD tid)
Definition: ole2.c:1523
smooth NULL
Definition: ftsmooth.c:416
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
#define TRACE(s)
Definition: solgame.cpp:4
struct tagMSG * LPMSG
unsigned short WORD
Definition: ntddk_ex.h:93
HHOOK GetMsg_hHook
Definition: ole2.c:90
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
#define WM_COMMAND
Definition: winuser.h:1722
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
#define HC_ACTION
Definition: winuser.h:48
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
HWND hwnd
Definition: winuser.h:3089
BOOL bIsServerItem
Definition: ole2.c:83
#define HIWORD(l)
Definition: typedefs.h:246
UINT message
Definition: winuser.h:3090
LPARAM lParam
Definition: combotst.c:139

Referenced by OLEMenu_InstallHooks().

◆ OLEMenu_Initialize()

static void OLEMenu_Initialize ( void  )
static

Definition at line 1411 of file ole2.c.

1412 {
1413 }

Referenced by OleInitialize().

◆ OLEMenu_InstallHooks()

static BOOL OLEMenu_InstallHooks ( DWORD  tid)
static

Definition at line 1431 of file ole2.c.

1432 {
1433  OleMenuHookItem *pHookItem;
1434 
1435  /* Create an entry for the hook table */
1436  if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0,
1437  sizeof(OleMenuHookItem)) ) )
1438  return FALSE;
1439 
1440  pHookItem->tid = tid;
1441  pHookItem->hHeap = GetProcessHeap();
1442  pHookItem->CallWndProc_hHook = NULL;
1443 
1444  /* Install a thread scope message hook for WH_GETMESSAGE */
1446  0, GetCurrentThreadId() );
1447  if ( !pHookItem->GetMsg_hHook )
1448  goto CLEANUP;
1449 
1450  /* Install a thread scope message hook for WH_CALLWNDPROC */
1452  0, GetCurrentThreadId() );
1453  if ( !pHookItem->CallWndProc_hHook )
1454  goto CLEANUP;
1455 
1456  /* Insert the hook table entry */
1457  pHookItem->next = hook_list;
1458  hook_list = pHookItem;
1459 
1460  return TRUE;
1461 
1462 CLEANUP:
1463  /* Unhook any hooks */
1464  if ( pHookItem->GetMsg_hHook )
1465  UnhookWindowsHookEx( pHookItem->GetMsg_hHook );
1466  if ( pHookItem->CallWndProc_hHook )
1467  UnhookWindowsHookEx( pHookItem->CallWndProc_hHook );
1468  /* Release the hook table entry */
1469  HeapFree(pHookItem->hHeap, 0, pHookItem );
1470 
1471  return FALSE;
1472 }
#define TRUE
Definition: types.h:120
#define WH_GETMESSAGE
Definition: winuser.h:33
#define CLEANUP
Definition: ntuser.h:5
smooth NULL
Definition: ftsmooth.c:416
struct tagOleMenuHookItem * next
Definition: ole2.c:92
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:458
static OleMenuHookItem * hook_list
Definition: ole2.c:95
HANDLE hHeap
Definition: ole2.c:89
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1733
static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1628
HHOOK GetMsg_hHook
Definition: ole2.c:90
HHOOK CallWndProc_hHook
Definition: ole2.c:91
#define WH_CALLWNDPROC
Definition: winuser.h:34
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
static TfClientId tid
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by OleSetMenuDescriptor().

◆ OLEMenu_IsHookInstalled()

static OleMenuHookItem * OLEMenu_IsHookInstalled ( DWORD  tid)
static

Definition at line 1523 of file ole2.c.

1524 {
1525  OleMenuHookItem *pHookItem;
1526 
1527  /* Do a simple linear search for an entry whose tid matches ours.
1528  * We really need a map but efficiency is not a concern here. */
1529  for (pHookItem = hook_list; pHookItem; pHookItem = pHookItem->next)
1530  {
1531  if ( tid == pHookItem->tid )
1532  return pHookItem;
1533  }
1534 
1535  return NULL;
1536 }
smooth NULL
Definition: ftsmooth.c:416
struct tagOleMenuHookItem * next
Definition: ole2.c:92
static OleMenuHookItem * hook_list
Definition: ole2.c:95
static TfClientId tid

Referenced by OLEMenu_CallWndProc(), OLEMenu_GetMsgProc(), and OleSetMenuDescriptor().

◆ OLEMenu_SetIsServerMenu()

static BOOL OLEMenu_SetIsServerMenu ( HMENU  hmenu,
OleMenuDescriptor pOleMenuDescriptor 
)
static

Definition at line 1589 of file ole2.c.

1590 {
1591  UINT nPos = 0, nWidth, i;
1592 
1593  pOleMenuDescriptor->bIsServerItem = FALSE;
1594 
1595  /* Don't bother searching if the popup is the combined menu itself */
1596  if ( hmenu == pOleMenuDescriptor->hmenuCombined )
1597  return FALSE;
1598 
1599  /* Find the menu item index in the shared OLE menu that this item belongs to */
1600  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu, &nPos ) )
1601  return FALSE;
1602 
1603  /* The group widths array has counts for the number of elements
1604  * in the groups File, Edit, Container, Object, Window, Help.
1605  * The Edit, Object & Help groups belong to the server object
1606  * and the other three belong to the container.
1607  * Loop through the group widths and locate the group we are a member of.
1608  */
1609  for ( i = 0, nWidth = 0; i < 6; i++ )
1610  {
1611  nWidth += pOleMenuDescriptor->mgw.width[i];
1612  if ( nPos < nWidth )
1613  {
1614  /* Odd elements are server menu widths */
1615  pOleMenuDescriptor->bIsServerItem = i%2;
1616  break;
1617  }
1618  }
1619 
1620  return pOleMenuDescriptor->bIsServerItem;
1621 }
static HMENU hmenu
Definition: win.c:66
HMENU hmenuCombined
Definition: ole2.c:82
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static BOOL OLEMenu_FindMainMenuIndex(HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos)
Definition: ole2.c:1546
OLEMENUGROUPWIDTHS mgw
Definition: ole2.c:81
unsigned int UINT
Definition: ndis.h:50
BOOL bIsServerItem
Definition: ole2.c:83

Referenced by OLEMenu_CallWndProc().

◆ OLEMenu_UnInitialize()

static void OLEMenu_UnInitialize ( void  )
static

Definition at line 1420 of file ole2.c.

1421 {
1422 }

Referenced by OleUninitialize().

◆ OLEMenu_UnInstallHooks()

static BOOL OLEMenu_UnInstallHooks ( DWORD  tid)
static

Definition at line 1481 of file ole2.c.

1482 {
1483  OleMenuHookItem *pHookItem = NULL;
1484  OleMenuHookItem **ppHook = &hook_list;
1485 
1486  while (*ppHook)
1487  {
1488  if ((*ppHook)->tid == tid)
1489  {
1490  pHookItem = *ppHook;
1491  *ppHook = pHookItem->next;
1492  break;
1493  }
1494  ppHook = &(*ppHook)->next;
1495  }
1496  if (!pHookItem) return FALSE;
1497 
1498  /* Uninstall the hooks installed for this thread */
1499  if ( !UnhookWindowsHookEx( pHookItem->GetMsg_hHook ) )
1500  goto CLEANUP;
1501  if ( !UnhookWindowsHookEx( pHookItem->CallWndProc_hHook ) )
1502  goto CLEANUP;
1503 
1504  /* Release the hook table entry */
1505  HeapFree(pHookItem->hHeap, 0, pHookItem );
1506 
1507  return TRUE;
1508 
1509 CLEANUP:
1510  /* Release the hook table entry */
1511  HeapFree(pHookItem->hHeap, 0, pHookItem );
1512 
1513  return FALSE;
1514 }
#define TRUE
Definition: types.h:120
#define CLEANUP
Definition: ntuser.h:5
smooth NULL
Definition: ftsmooth.c:416
struct tagOleMenuHookItem * next
Definition: ole2.c:92
static OleMenuHookItem * hook_list
Definition: ole2.c:95
HANDLE hHeap
Definition: ole2.c:89
HHOOK GetMsg_hHook
Definition: ole2.c:90
HHOOK CallWndProc_hHook
Definition: ole2.c:91
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
static TfClientId tid
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by OleSetMenuDescriptor().

◆ OleNoteObjectVisible()

HRESULT WINAPI OleNoteObjectVisible ( LPUNKNOWN  pUnknown,
BOOL  bVisible 
)

Definition at line 2839 of file ole2.c.

2840 {
2841  TRACE("(%p, %s)\n", pUnknown, bVisible ? "TRUE" : "FALSE");
2842  return CoLockObjectExternal(pUnknown, bVisible, TRUE);
2843 }
#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:3743

◆ OleQueryLinkFromData()

HRESULT WINAPI OleQueryLinkFromData ( IDataObject pSrcDataObject)

Definition at line 854 of file ole2.c.

856 {
857  FIXME("(%p),stub!\n", pSrcDataObject);
858  return S_FALSE;
859 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357

◆ OleRegEnumVerbs()

HRESULT WINAPI OleRegEnumVerbs ( REFCLSID  clsid,
LPENUMOLEVERB *  ppenum 
)

Definition at line 1125 of file ole2.c.

1126 {
1127  LONG res;
1128  HKEY hkeyVerb;
1129  DWORD dwSubKeys;
1130  static const WCHAR wszVerb[] = {'V','e','r','b',0};
1131 
1132  TRACE("(%s, %p)\n", debugstr_guid(clsid), ppenum);
1133 
1134  res = COM_OpenKeyForCLSID(clsid, wszVerb, KEY_READ, &hkeyVerb);
1135  if (FAILED(res))
1136  {
1137  if (res == REGDB_E_CLASSNOTREG)
1138  ERR("CLSID %s not registered\n", debugstr_guid(clsid));
1139  else if (res == REGDB_E_KEYMISSING)
1140  ERR("no Verbs key for class %s\n", debugstr_guid(clsid));
1141  else
1142  ERR("failed to open Verbs key for CLSID %s with error %d\n",
1143  debugstr_guid(clsid), res);
1144  return res;
1145  }
1146 
1147  res = RegQueryInfoKeyW(hkeyVerb, NULL, NULL, NULL, &dwSubKeys, NULL,
1148  NULL, NULL, NULL, NULL, NULL, NULL);
1149  if (res != ERROR_SUCCESS)
1150  {
1151  ERR("failed to get subkey count with error %d\n", GetLastError());
1152  return REGDB_E_READREGDB;
1153  }
1154 
1155  if (!dwSubKeys)
1156  {
1157  WARN("class %s has no verbs\n", debugstr_guid(clsid));
1158  RegCloseKey(hkeyVerb);
1159  return OLEOBJ_E_NOVERBS;
1160  }
1161 
1162  return EnumOLEVERB_Construct(hkeyVerb, 0, ppenum);
1163 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
#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:2448
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
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:3686
REFCLSID clsid
Definition: msctf.c:82
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1093
#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 864 of file ole2.c.

868 {
869  static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
870  static const WCHAR dfmtW[] = {'%','d',0};
871  WCHAR keyName[16];
872  HKEY miscStatusKey;
873  HKEY aspectKey;
874  LONG result;
875  HRESULT hr;
876 
877  TRACE("(%s, %d, %p)\n", debugstr_guid(clsid), dwAspect, pdwStatus);
878 
879  if (!pdwStatus) return E_INVALIDARG;
880 
881  *pdwStatus = 0;
882 
883  if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
884 
885  hr = COM_OpenKeyForCLSID(clsid, miscstatusW, KEY_READ, &miscStatusKey);
886  if (FAILED(hr))
887  /* missing key is not a failure */
888  return hr == REGDB_E_KEYMISSING ? S_OK : hr;
889 
890  OLEUTL_ReadRegistryDWORDValue(miscStatusKey, pdwStatus);
891 
892  /*
893  * Open the key specific to the requested aspect.
894  */
895  swprintf(keyName, dfmtW, dwAspect);
896 
897  result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
898  if (result == ERROR_SUCCESS)
899  {
900  OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
901  RegCloseKey(aspectKey);
902  }
903 
904  RegCloseKey(miscStatusKey);
905  return S_OK;
906 }
#define ERROR_SUCCESS
Definition: deptool.c:10
HRESULT hr
Definition: shlfolder.c:183
#define KEY_READ
Definition: nt_native.h:1023
static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD *pdwValue)
Definition: ole2.c:2526
#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:2448
#define debugstr_guid
Definition: kernel32.h:35
static const WCHAR miscstatusW[]
Definition: actctx.c:625
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define swprintf(buf, format,...)
Definition: sprintf.c:56
REFCLSID clsid
Definition: msctf.c:82
#define S_OK
Definition: intsafe.h:59
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:420
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
Definition: compobj.c:254
GLuint64EXT * result
Definition: glext.h:11304

Referenced by DefaultHandler_GetMiscStatus(), and test_OleRegGetMiscStatus().

◆ OleRegGetUserType()

HRESULT WINAPI OleRegGetUserType ( REFCLSID  clsid,
DWORD  form,
LPOLESTR usertype 
)

Definition at line 678 of file ole2.c.

679 {
680  static const WCHAR auxusertypeW[] = {'A','u','x','U','s','e','r','T','y','p','e','\\','%','d',0};
681  DWORD valuetype, valuelen;
682  WCHAR auxkeynameW[16];
683  HKEY usertypekey;
684  HRESULT hres;
685  LONG ret;
686 
687  TRACE("(%s, %u, %p)\n", debugstr_guid(clsid), form, usertype);
688 
689  if (!usertype)
690  return E_INVALIDARG;
691 
692  *usertype = NULL;
693 
694  /* Return immediately if it's not registered. */
695  hres = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &usertypekey);
696  if (FAILED(hres))
697  return hres;
698 
699  valuelen = 0;
700 
701  /* Try additional types if requested. If they don't exist fall back to USERCLASSTYPE_FULL. */
702  if (form != USERCLASSTYPE_FULL)
703  {
704  HKEY auxkey;
705 
706  swprintf(auxkeynameW, auxusertypeW, form);
707  if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK)
708  {
709  if (!RegQueryValueExW(auxkey, emptyW, NULL, &valuetype, NULL, &valuelen) && valuelen)
710  {
711  RegCloseKey(usertypekey);
712  usertypekey = auxkey;
713  }
714  else
715  RegCloseKey(auxkey);
716  }
717  }
718 
719  valuelen = 0;
720  if (RegQueryValueExW(usertypekey, emptyW, NULL, &valuetype, NULL, &valuelen))
721  {
722  RegCloseKey(usertypekey);
723  return REGDB_E_READREGDB;
724  }
725 
726  *usertype = CoTaskMemAlloc(valuelen);
727  if (!*usertype)
728  {
729  RegCloseKey(usertypekey);
730  return E_OUTOFMEMORY;
731  }
732 
733  ret = RegQueryValueExW(usertypekey,
734  emptyW,
735  NULL,
736  &valuetype,
737  (LPBYTE)*usertype,
738  &valuelen);
739  RegCloseKey(usertypekey);
740  if (ret != ERROR_SUCCESS)
741  {
742  CoTaskMemFree(*usertype);
743  *usertype = NULL;
744  return REGDB_E_READREGDB;
745  }
746 
747  return S_OK;
748 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
#define REGDB_E_READREGDB
Definition: winerror.h:2692
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:2448
#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:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
REFCLSID clsid
Definition: msctf.c:82
static const WCHAR emptyW[]
Definition: ole2.c:123
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:404

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

◆ OleRun()

HRESULT WINAPI DECLSPEC_HOTPATCH OleRun ( LPUNKNOWN  pUnknown)

Definition at line 1205 of file ole2.c.

1206 {
1207  IRunnableObject *runable;
1208  HRESULT hres;
1209 
1210  TRACE("(%p)\n", pUnknown);
1211 
1212  hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, (void**)&runable);
1213  if (FAILED(hres))
1214  return S_OK; /* Appears to return no error. */
1215 
1216  hres = IRunnableObject_Run(runable, NULL);
1217  IRunnableObject_Release(runable);
1218  return hres;
1219 }
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 1338 of file ole2.c.

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

◆ OleSetAutoConvert()

HRESULT WINAPI OleSetAutoConvert ( REFCLSID  clsidOld,
REFCLSID  clsidNew 
)

Definition at line 2731 of file ole2.c.

2732 {
2733  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2734  HKEY hkey = NULL;
2735  WCHAR szClsidNew[CHARS_IN_GUID];
2736  HRESULT res = S_OK;
2737 
2738  TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
2739 
2740  res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
2741  if (FAILED(res))
2742  goto done;
2743  StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
2744  if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR)))
2745  {
2747  goto done;
2748  }
2749 
2750 done:
2751  if (hkey) RegCloseKey(hkey);
2752  return res;
2753 }
#define KEY_READ
Definition: nt_native.h:1023
#define CHARS_IN_GUID
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5014
#define lstrlenW
Definition: compat.h:415
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:2448
#define debugstr_guid
Definition: kernel32.h:35
#define KEY_WRITE
Definition: nt_native.h:1031
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax)
Definition: compobj.c:2434
#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().

◆ OleSetContainedObject()

HRESULT WINAPI OleSetContainedObject ( LPUNKNOWN  pUnknown,
BOOL  fContained 
)

Definition at line 1168 of file ole2.c.

1171 {
1173  HRESULT hres;
1174 
1175  TRACE("(%p,%x)\n", pUnknown, fContained);
1176 
1177  hres = IUnknown_QueryInterface(pUnknown,
1179  (void**)&runnable);
1180 
1181  if (SUCCEEDED(hres))
1182  {
1183  hres = IRunnableObject_SetContainedObject(runnable, fContained);
1184 
1185  IRunnableObject_Release(runnable);
1186 
1187  return hres;
1188  }
1189 
1190  return S_OK;
1191 }
static IRunnableObject * runnable
Definition: ole2.c:76
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  hOleMenu,
HWND  hwndFrame,
HWND  hwndActiveObject,
LPOLEINPLACEFRAME  lpFrame,
LPOLEINPLACEACTIVEOBJECT  lpActiveObject 
)

Definition at line 1875 of file ole2.c.

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

Definition at line 2592 of file ole2.c.

2594 {
2595  WORD wID;
2596 
2597  TRACE("(%p,%p,%p)\n", lpFrame, lpFrameInfo, lpmsg);
2598 
2599  if (IsAccelerator(lpFrameInfo->haccel,lpFrameInfo->cAccelEntries,lpmsg,&wID))
2600  return IOleInPlaceFrame_TranslateAccelerator(lpFrame,lpmsg,wID);
2601 
2602  return S_FALSE;
2603 }
BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD *lpwCmd)
Definition: ole2.c:1949
#define S_FALSE
Definition: winerror.h:2357
#define TRACE(s)
Definition: solgame.cpp:4
unsigned short WORD
Definition: ntddk_ex.h:93

◆ OleUninitialize()

void WINAPI DECLSPEC_HOTPATCH 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  */
242  if (!--COM_CurrentInfo()->ole_inits && !InterlockedDecrement(&OLE_moduleLockCount))
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:2027
return
Definition: dirsup.c:529
#define WARN(fmt,...)
Definition: debug.h:111
static void OLEMenu_UnInitialize(void)
Definition: ole2.c:1420
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:2067

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

◆ OLEUTL_ReadRegistryDWORDValue()

static void OLEUTL_ReadRegistryDWORDValue ( HKEY  regKey,
DWORD pdwValue 
)
static

Definition at line 2526 of file ole2.c.

2529 {
2530  WCHAR buffer[20];
2531  DWORD cbData = sizeof(buffer);
2532  DWORD dwKeyType;
2533  LONG lres;
2534 
2535  lres = RegQueryValueExW(regKey,
2536  emptyW,
2537  NULL,
2538  &dwKeyType,
2539  (LPBYTE)buffer,
2540  &cbData);
2541 
2542  if (lres==ERROR_SUCCESS)
2543  {
2544  switch (dwKeyType)
2545  {
2546  case REG_DWORD:
2547  *pdwValue = *(DWORD*)buffer;
2548  break;
2549  case REG_EXPAND_SZ:
2550  case REG_MULTI_SZ:
2551  case REG_SZ:
2552  *pdwValue = wcstoul(buffer, NULL, 10);
2553  break;
2554  }
2555  }
2556 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint buffer
Definition: glext.h:5915
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR emptyW[]
Definition: ole2.c:123
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_DWORD
Definition: sdbapi.c:596
#define REG_SZ
Definition: layer.c:22

Referenced by OleRegGetMiscStatus().

◆ PropSysAllocString()

BSTR WINAPI PropSysAllocString ( LPCOLESTR  str)

Definition at line 2864 of file ole2.c.

2865 {
2866  return SysAllocString(str);
2867 }
const WCHAR * str
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238

Referenced by PropVariantCopy().

◆ PropSysFreeString()

void WINAPI PropSysFreeString ( LPOLESTR  str)

Definition at line 2874 of file ole2.c.

2875 {
2876  SysFreeString(str);
2877 }
const WCHAR * str
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by PropVariantClear().

◆ PROPVARIANT_ValidateType()

static HRESULT PROPVARIANT_ValidateType ( VARTYPE  vt)
inlinestatic

Definition at line 2882 of file ole2.c.

2883 {
2884  switch (vt)
2885  {
2886  case VT_EMPTY:
2887  case VT_NULL:
2888  case VT_I1:
2889  case VT_I2:
2890  case VT_I4:
2891  case VT_I8:
2892  case VT_R4:
2893  case VT_R8:
2894  case VT_CY:
2895  case VT_DATE:
2896  case VT_BSTR:
2897  case VT_ERROR:
2898  case VT_BOOL:
2899  case VT_DECIMAL:
2900  case VT_UI1:
2901  case VT_UI2:
2902  case VT_UI4:
2903  case VT_UI8:
2904  case VT_INT:
2905  case VT_UINT:
2906  case VT_LPSTR:
2907  case VT_LPWSTR:
2908  case VT_FILETIME:
2909  case VT_BLOB:
2910  case VT_DISPATCH:
2911  case VT_UNKNOWN:
2912  case VT_STREAM:
2913  case VT_STORAGE:
2914  case VT_STREAMED_OBJECT:
2915  case VT_STORED_OBJECT:
2916  case VT_BLOB_OBJECT:
2917  case VT_CF:
2918  case VT_CLSID:
2919  case VT_I1|VT_VECTOR:
2920  case VT_I2|VT_VECTOR:
2921  case VT_I4|VT_VECTOR:
2922  case VT_I8|VT_VECTOR:
2923  case VT_R4|VT_VECTOR:
2924  case VT_R8|VT_VECTOR:
2925  case VT_CY|VT_VECTOR:
2926  case VT_DATE|VT_VECTOR:
2927  case VT_BSTR|VT_VECTOR:
2928  case VT_ERROR|VT_VECTOR:
2929  case VT_BOOL|VT_VECTOR:
2930  case VT_VARIANT|VT_VECTOR:
2931  case VT_UI1|VT_VECTOR:
2932  case VT_UI2|VT_VECTOR:
2933  case VT_UI4|VT_VECTOR:
2934  case VT_UI8|VT_VECTOR:
2935  case VT_LPSTR|VT_VECTOR:
2936  case VT_LPWSTR|VT_VECTOR:
2937  case VT_FILETIME|VT_VECTOR:
2938  case VT_CF|VT_VECTOR:
2939  case VT_CLSID|VT_VECTOR:
2940  case VT_ARRAY|VT_I1:
2941  case VT_ARRAY|VT_UI1:
2942  case VT_ARRAY|VT_I2:
2943  case VT_ARRAY|VT_UI2:
2944  case VT_ARRAY|VT_I4:
2945  case VT_ARRAY|VT_UI4:
2946  case VT_ARRAY|VT_INT:
2947  case VT_ARRAY|VT_UINT:
2948  case VT_ARRAY|VT_R4:
2949  case VT_ARRAY|VT_R8:
2950  case VT_ARRAY|VT_CY:
2951  case VT_ARRAY|VT_DATE:
2952  case VT_ARRAY|VT_BSTR:
2953  case VT_ARRAY|VT_BOOL:
2954  case VT_ARRAY|VT_DECIMAL:
2955  case VT_ARRAY|VT_DISPATCH:
2956  case VT_ARRAY|VT_UNKNOWN:
2957  case VT_ARRAY|VT_ERROR:
2958  case VT_ARRAY|VT_VARIANT:
2959  return S_OK;
2960  }
2961  WARN("Bad type %d\n", vt);
2962  return STG_E_INVALIDPARAMETER;
2963 }
Definition: compat.h:1947
Definition: compat.h:1963
Definition: compat.h:1959
#define WARN(fmt,...)
Definition: debug.h:111
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:85
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
Definition: compat.h:1948
Definition: compat.h:1950
Definition: compat.h:1985
#define S_OK
Definition: intsafe.h:59
Definition: compat.h:1949
Definition: compat.h:1946

Referenced by PropVariantClear(), and PropVariantCopy().

◆ PropVariantClear()

HRESULT WINAPI PropVariantClear ( PROPVARIANT *  pvar)

Definition at line 2968 of file ole2.c.

2969 {
2970  HRESULT hr;
2971 
2972  TRACE("(%p)\n", pvar);
2973 
2974  if (!pvar)
2975  return S_OK;
2976 
2977  hr = PROPVARIANT_ValidateType(pvar->vt);
2978  if (FAILED(hr))
2979  {
2980  memset(pvar, 0, sizeof(*pvar));
2981  return hr;
2982  }
2983 
2984  switch(pvar->vt)
2985  {
2986  case VT_EMPTY:
2987  case VT_NULL:
2988  case VT_I1:
2989  case VT_I2:
2990  case VT_I4:
2991  case VT_I8:
2992  case VT_R4:
2993  case VT_R8:
2994  case VT_CY:
2995  case VT_DATE:
2996  case VT_ERROR:
2997  case VT_BOOL:
2998  case VT_DECIMAL:
2999  case VT_UI1:
3000  case VT_UI2:
3001  case VT_UI4:
3002  case VT_UI8:
3003  case VT_INT:
3004  case VT_UINT:
3005  case VT_FILETIME:
3006  break;
3007  case VT_DISPATCH:
3008  case VT_UNKNOWN:
3009  case VT_STREAM:
3010  case VT_STREAMED_OBJECT:
3011  case VT_STORAGE:
3012  case VT_STORED_OBJECT:
3013  if (pvar->u.pStream)
3014  IStream_Release(pvar->u.pStream);
3015  break;
3016  case VT_CLSID:
3017  case VT_LPSTR:
3018  case VT_LPWSTR:
3019  /* pick an arbitrary typed pointer - we don't care about the type
3020  * as we are just freeing it */
3021  CoTaskMemFree(pvar->u.puuid);
3022  break;
3023  case VT_BLOB:
3024  case VT_BLOB_OBJECT:
3025  CoTaskMemFree(pvar->u.blob.pBlobData);
3026  break;
3027  case VT_BSTR:
3028  PropSysFreeString(pvar->u.bstrVal);
3029  break;
3030  case VT_CF:
3031  if (pvar->u.pclipdata)
3032  {
3033  OLE_FreeClipDataArray(1, pvar->u.pclipdata);
3034  CoTaskMemFree(pvar->u.pclipdata);
3035  }
3036  break;
3037  default:
3038  if (pvar->vt & VT_VECTOR)
3039  {
3040  ULONG i;
3041 
3042  switch (pvar->vt & ~VT_VECTOR)
3043  {
3044  case VT_VARIANT:
3045  FreePropVariantArray(pvar->u.capropvar.cElems, pvar->u.capropvar.pElems);
3046  break;
3047  case VT_CF:
3048  OLE_FreeClipDataArray(pvar->u.caclipdata.cElems, pvar->u.caclipdata.pElems);
3049  break;
3050  case VT_BSTR:
3051  for (i = 0; i < pvar->u.cabstr.cElems; i++)
3052  PropSysFreeString(pvar->u.cabstr.pElems[i]);
3053  break;
3054  case VT_LPSTR:
3055  for (i = 0; i < pvar->u.calpstr.cElems; i++)
3056  CoTaskMemFree(pvar->u.calpstr.pElems[i]);
3057  break;
3058  case VT_LPWSTR:
3059  for (i = 0; i < pvar->u.calpwstr.cElems; i++)
3060  CoTaskMemFree(pvar->u.calpwstr.pElems[i]);
3061  break;
3062  }
3063  if (pvar->vt & ~VT_VECTOR)
3064  {
3065  /* pick an arbitrary VT_VECTOR structure - they all have the same
3066  * memory layout */
3067  CoTaskMemFree(pvar->u.capropvar.pElems);
3068  }
3069  }
3070  else if (pvar->vt & VT_ARRAY)
3071  hr = SafeArrayDestroy(pvar->u.parray);
3072  else
3073  {
3074  WARN("Invalid/unsupported type %d\n", pvar->vt);
3076  }
3077  }
3078 
3079  memset(pvar, 0, sizeof(*pvar));
3080  return hr;
3081 }
Definition: compat.h:1947
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:420
Definition: compat.h:1963
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1959
HRESULT WINAPI FreePropVariantArray(ULONG cVariants, PROPVARIANT *rgvars)
Definition: ole2.c:3267
#define WARN(fmt,...)
Definition: debug.h:111
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248