ReactOS  0.4.12-dev-918-g6c6e7b8
ole2.c File Reference
#include "config.h"
#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 "wine/unicode.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 34 of file ole2.c.

◆ DRAG_TIMER_ID

#define DRAG_TIMER_ID   1

Definition at line 2151 of file ole2.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 35 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 340 of file ole2.c.

341 {
342  HGLOBAL hmem;
343  DWORD size;
344  HRESULT hr;
345  void *data;
346 
347  hr = GetHGlobalFromStream(stream, &hmem);
348  if(FAILED(hr)) return hr;
349 
350  size = GlobalSize(hmem);
352  if(!*map) return E_OUTOFMEMORY;
353 
355  memcpy(data, GlobalLock(hmem), size);
356  GlobalUnlock(hmem);
358  return S_OK;
359 }
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
#define MapViewOfFile
Definition: compat.h:402
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
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:401
#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:403
#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 366 of file ole2.c.

367 {
369  HGLOBAL hmem;
370  void *data;
372 
373  data = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
374  if(!data) return hr;
375 
376  VirtualQuery(data, &info, sizeof(info));
377  TRACE("size %d\n", (int)info.RegionSize);
378 
379  hmem = GlobalAlloc(GMEM_MOVEABLE, info.RegionSize);
380  if(hmem)
381  {
382  memcpy(GlobalLock(hmem), data, info.RegionSize);
383  GlobalUnlock(hmem);
385  }
387  return hr;
388 }
#define TRUE
Definition: types.h:120
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define MapViewOfFile
Definition: compat.h:402
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:427
#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:403
#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 3265 of file ole2.c.

3266 {
3267  FIXME("stub\n");
3268  return TRUE;
3269 }
#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 756 of file ole2.c.

761 {
762  static const WCHAR trackerW[] = {'T','r','a','c','k','e','r','W','i','n','d','o','w',0};
763  TrackerWindowInfo trackerInfo;
764  HWND hwndTrackWindow;
765  MSG msg;
766 
767  TRACE("(%p, %p, %08x, %p)\n", pDataObject, pDropSource, dwOKEffect, pdwEffect);
768 
769  if (!pDataObject || !pDropSource || !pdwEffect)
770  return E_INVALIDARG;
771 
772  /*
773  * Setup the drag n drop tracking window.
774  */
775 
776  trackerInfo.dataObject = pDataObject;
777  trackerInfo.dropSource = pDropSource;
778  trackerInfo.dwOKEffect = dwOKEffect;
779  trackerInfo.pdwEffect = pdwEffect;
780  trackerInfo.trackingDone = FALSE;
781  trackerInfo.escPressed = FALSE;
782  trackerInfo.curTargetHWND = 0;
783  trackerInfo.curDragTarget = 0;
784 #ifdef __REACTOS__
785  trackerInfo.accepterHWND = NULL;
786 #endif
787 
788  hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, trackerW,
790  CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, 0,
791  &trackerInfo);
792 
793  if (hwndTrackWindow)
794  {
795  /*
796  * Capture the mouse input
797  */
798  SetCapture(hwndTrackWindow);
799 
800  msg.message = 0;
801 
802  /*
803  * Pump messages. All mouse input should go to the capture window.
804  */
805  while (!trackerInfo.trackingDone && GetMessageW(&msg, 0, 0, 0) )
806  {
807  trackerInfo.curMousePos.x = msg.pt.x;
808  trackerInfo.curMousePos.y = msg.pt.y;
809  trackerInfo.dwKeyState = OLEDD_GetButtonState();
810 
811  if ( (msg.message >= WM_KEYFIRST) &&
812  (msg.message <= WM_KEYLAST) )
813  {
814  /*
815  * When keyboard messages are sent to windows on this thread, we
816  * want to ignore notify the drop source that the state changed.
817  * in the case of the Escape key, we also notify the drop source
818  * we give it a special meaning.
819  */
820  if ( (msg.message==WM_KEYDOWN) &&
821  (msg.wParam==VK_ESCAPE) )
822  {
823  trackerInfo.escPressed = TRUE;
824  }
825 
826  /*
827  * Notify the drop source.
828  */
829  OLEDD_TrackStateChange(&trackerInfo);
830  }
831  else
832  {
833  /*
834  * Dispatch the messages only when it's not a keyboard message.
835  */
837  }
838  }
839 
840  /* re-post the quit message to outer message loop */
841  if (msg.message == WM_QUIT)
842  PostQuitMessage(msg.wParam);
843  /*
844  * Destroy the temporary window.
845  */
846  DestroyWindow(hwndTrackWindow);
847 
848  return trackerInfo.returnValue;
849  }
850 
851  return E_FAIL;
852 }
DWORD dwOKEffect
Definition: ole2.c:65
#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:67
#define VK_ESCAPE
Definition: winuser.h:2168
IDataObject * dataObject
Definition: ole2.c:63
#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:4185
LONG y
Definition: windef.h:315
DWORD dwKeyState
Definition: ole2.c:77
#define WM_KEYFIRST
Definition: winuser.h:1690
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:1691
static void OLEDD_TrackStateChange(TrackerWindowInfo *trackerInfo)
Definition: ole2.c:2419
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_KEYLAST
Definition: winuser.h:1704
LONG x
Definition: windef.h:314
HRESULT returnValue
Definition: ole2.c:68
POINTL curMousePos
Definition: ole2.c:76
HWND curTargetHWND
Definition: ole2.c:71
static const WCHAR OLEDD_DRAGTRACKERCLASS[]
Definition: ole2.c:109
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:64
IDropTarget * curDragTarget
Definition: ole2.c:72
static DWORD OLEDD_GetButtonState(void)
Definition: ole2.c:2487
DWORD * pdwEffect
Definition: ole2.c:66
__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 2322 of file ole2.c.

2323 {
2324  HRESULT hr;
2325 
2326  info->trackingDone = TRUE;
2327  ReleaseCapture();
2328 
2329  if (info->curDragTarget)
2330  {
2331  if (info->returnValue == DRAGDROP_S_DROP &&
2332  *info->pdwEffect != DROPEFFECT_NONE)
2333  {
2334  *info->pdwEffect = info->dwOKEffect;
2335  hr = IDropTarget_Drop( info->curDragTarget, info->dataObject, info->dwKeyState,
2336  info->curMousePos, info->pdwEffect );
2337  *info->pdwEffect &= info->dwOKEffect;
2338 
2339  if (FAILED( hr ))
2340  info->returnValue = hr;
2341  }
2342  else
2343  {
2344  IDropTarget_DragLeave( info->curDragTarget );
2345  *info->pdwEffect = DROPEFFECT_NONE;
2346  }
2347  IDropTarget_Release( info->curDragTarget );
2348  info->curDragTarget = NULL;
2349  }
2350 #ifdef __REACTOS__
2351  else if (info->accepterHWND)
2352  {
2353  if (info->returnValue == DRAGDROP_S_DROP &&
2354  *info->pdwEffect != DROPEFFECT_NONE)
2355  {
2356  *info->pdwEffect = info->dwOKEffect;
2357  hr = DefaultDrop(info->accepterHWND, info->dataObject, info->dwKeyState,
2358  info->curMousePos, info->pdwEffect);
2359  *info->pdwEffect &= info->dwOKEffect;
2360 
2361  if (FAILED( hr ))
2362  info->returnValue = hr;
2363  }
2364  else
2365  {
2366  *info->pdwEffect = DROPEFFECT_NONE;
2367  }
2368  info->accepterHWND = NULL;
2369  }
2370 #endif
2371  else
2372  *info->pdwEffect = DROPEFFECT_NONE;
2373 }
#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 2263 of file ole2.c.

2264 {
2265  HRESULT hr;
2266 #ifdef __REACTOS__
2267  DWORD dwEffect = *info->pdwEffect;
2268 #endif
2269 
2270  info->curTargetHWND = new_target;
2271 
2272 #ifdef __REACTOS__
2273  info->accepterHWND = NULL;
2274  while (new_target && !is_droptarget( new_target ))
2275  {
2276  if (is_acceptfiles(new_target))
2277  {
2278  dwEffect = info->dwOKEffect;
2279  hr = DefaultDragEnter(new_target, info->dataObject,
2280  info->dwKeyState, info->curMousePos,
2281  &dwEffect);
2282  dwEffect &= info->dwOKEffect;
2283 
2284  if (hr == S_OK)
2285  {
2286  info->accepterHWND = new_target;
2287  info->curDragTarget = NULL;
2288  *info->pdwEffect = dwEffect;
2289  return;
2290  }
2291  }
2292  new_target = GetParent( new_target );
2293  }
2294 #else
2295  while (new_target && !is_droptarget( new_target ))
2296  new_target = GetParent( new_target );
2297 #endif
2298 
2299  info->curDragTarget = get_droptarget_pointer( new_target );
2300 
2301  if (info->curDragTarget)
2302  {
2303  *info->pdwEffect = info->dwOKEffect;
2304  hr = IDropTarget_DragEnter( info->curDragTarget, info->dataObject,
2305  info->dwKeyState, info->curMousePos,
2306  info->pdwEffect );
2307  *info->pdwEffect &= info->dwOKEffect;
2308 
2309  /* failed DragEnter() means invalid target */
2310  if (hr != S_OK)
2311  {
2312  IDropTarget_Release( info->curDragTarget );
2313  info->curDragTarget = NULL;
2314  info->curTargetHWND = NULL;
2315 #ifdef __REACTOS__
2316  info->accepterHWND = NULL;
2317 #endif
2318  }
2319  }
2320 }
static IDropTarget * get_droptarget_pointer(HWND hwnd)
Definition: ole2.c:539
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:294

Referenced by OLEDD_TrackStateChange().

◆ DropTargetWrapper_AddRef()

static ULONG WINAPI DropTargetWrapper_AddRef ( IDropTarget iface)
static

Definition at line 424 of file ole2.c.

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

◆ DropTargetWrapper_DragEnter()

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

Definition at line 447 of file ole2.c.

452 {
455 
456  if (SUCCEEDED( r ))
457  {
458  r = IDropTarget_DragEnter( target, pDataObj, grfKeyState, pt, pdwEffect );
459  IDropTarget_Release( target );
460  }
461  return r;
462 }
#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:438
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 480 of file ole2.c.

481 {
484 
485  if (SUCCEEDED( r ))
486  {
487  r = IDropTarget_DragLeave( target );
488  IDropTarget_Release( target );
489  }
490  return r;
491 }
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:438
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 464 of file ole2.c.

468 {
471 
472  if (SUCCEEDED( r ))
473  {
474  r = IDropTarget_DragOver( target, grfKeyState, pt, pdwEffect );
475  IDropTarget_Release( target );
476  }
477  return r;
478 }
#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:438
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 493 of file ole2.c.

498 {
501 
502  if (SUCCEEDED( r ))
503  {
504  r = IDropTarget_Drop( target, pDataObj, grfKeyState, pt, pdwEffect );
505  IDropTarget_Release( target );
506  }
507  return r;
508 }
#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:438
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 408 of file ole2.c.

411 {
413  if (IsEqualIID(riid, &IID_IUnknown) ||
414  IsEqualIID(riid, &IID_IDropTarget))
415  {
416  IDropTarget_AddRef(&This->IDropTarget_iface);
417  *ppvObject = &This->IDropTarget_iface;
418  return S_OK;
419  }
420  *ppvObject = NULL;
421  return E_NOINTERFACE;
422 }
#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:403
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90

◆ DropTargetWrapper_Release()

static ULONG WINAPI DropTargetWrapper_Release ( IDropTarget iface)
static

Definition at line 430 of file ole2.c.

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

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 941 of file ole2.c.

943 {
945  TRACE("()\n");
946  return InterlockedIncrement(&This->ref);
947 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:922
#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 1073 of file ole2.c.

1076 {
1078  HKEY hkeyVerb;
1079  TRACE("(%p)\n", ppenum);
1081  return HRESULT_FROM_WIN32(GetLastError());
1082  return EnumOLEVERB_Construct(hkeyVerb, This->index, ppenum);
1083 }
#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:922
#define DUPLICATE_SAME_ACCESS
#define TRACE(s)
Definition: solgame.cpp:4
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1096
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 1096 of file ole2.c.

1097 {
1098  EnumOLEVERB *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1099  if (!This)
1100  {
1101  RegCloseKey(hkeyVerb);
1102  return E_OUTOFMEMORY;
1103  }
1104  This->IEnumOLEVERB_iface.lpVtbl = &EnumOLEVERB_VTable;
1105  This->ref = 1;
1106  This->index = index;
1107  This->hkeyVerb = hkeyVerb;
1108  *ppenum = &This->IEnumOLEVERB_iface;
1109  return S_OK;
1110 }
static const IEnumOLEVERBVtbl EnumOLEVERB_VTable
Definition: ole2.c:1085
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:395
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 963 of file ole2.c.

966 {
968  HRESULT hr = S_OK;
969 
970  TRACE("(%d, %p, %p)\n", celt, rgelt, pceltFetched);
971 
972  if (pceltFetched)
973  *pceltFetched = 0;
974 
975  for (; celt; celt--, rgelt++)
976  {
977  WCHAR wszSubKey[20];
978  LONG cbData;
979  LPWSTR pwszOLEVERB;
980  LPWSTR pwszMenuFlags;
981  LPWSTR pwszAttribs;
982  LONG res = RegEnumKeyW(This->hkeyVerb, This->index, wszSubKey, ARRAY_SIZE(wszSubKey));
983  if (res == ERROR_NO_MORE_ITEMS)
984  {
985  hr = S_FALSE;
986  break;
987  }
988  else if (res != ERROR_SUCCESS)
989  {
990  ERR("RegEnumKeyW failed with error %d\n", res);
992  break;
993  }
994  res = RegQueryValueW(This->hkeyVerb, wszSubKey, NULL, &cbData);
995  if (res != ERROR_SUCCESS)
996  {
997  ERR("RegQueryValueW failed with error %d\n", res);
999  break;
1000  }
1001  pwszOLEVERB = CoTaskMemAlloc(cbData);
1002  if (!pwszOLEVERB)
1003  {
1004  hr = E_OUTOFMEMORY;
1005  break;
1006  }
1007  res = RegQueryValueW(This->hkeyVerb, wszSubKey, pwszOLEVERB, &cbData);
1008  if (res != ERROR_SUCCESS)
1009  {
1010  ERR("RegQueryValueW failed with error %d\n", res);
1012  CoTaskMemFree(pwszOLEVERB);
1013  break;
1014  }
1015 
1016  TRACE("verb string: %s\n", debugstr_w(pwszOLEVERB));
1017  pwszMenuFlags = strchrW(pwszOLEVERB, ',');
1018  if (!pwszMenuFlags)
1019  {
1021  CoTaskMemFree(pwszOLEVERB);
1022  break;
1023  }
1024  /* nul terminate the name string and advance to first character */
1025  *pwszMenuFlags = '\0';
1026  pwszMenuFlags++;
1027  pwszAttribs = strchrW(pwszMenuFlags, ',');
1028  if (!pwszAttribs)
1029  {
1031  CoTaskMemFree(pwszOLEVERB);
1032  break;
1033  }
1034  /* nul terminate the menu string and advance to first character */
1035  *pwszAttribs = '\0';
1036  pwszAttribs++;
1037 
1038  /* fill out structure for this verb */
1039  rgelt->lVerb = atolW(wszSubKey);
1040  rgelt->lpszVerbName = pwszOLEVERB; /* user should free */
1041  rgelt->fuFlags = atolW(pwszMenuFlags);
1042  rgelt->grfAttribs = atolW(pwszAttribs);
1043 
1044  if (pceltFetched)
1045  (*pceltFetched)++;
1046  This->index++;
1047  }
1048  return hr;
1049 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
#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
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define OLEOBJ_E_INVALIDVERB
Definition: winerror.h:2723
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:922
#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
WINE_UNICODE_INLINE long int atolW(const WCHAR *str)
Definition: unicode.h:310
#define TRACE(s)
Definition: solgame.cpp:4
__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:4272
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2430
#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:406

◆ EnumOLEVERB_QueryInterface()

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

Definition at line 927 of file ole2.c.

929 {
930  TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
931  if (IsEqualIID(riid, &IID_IUnknown) ||
933  {
934  IEnumOLEVERB_AddRef(iface);
935  *ppv = iface;
936  return S_OK;
937  }
938  return E_NOINTERFACE;
939 }
#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:90

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 949 of file ole2.c.

951 {
953  LONG refs = InterlockedDecrement(&This->ref);
954  TRACE("()\n");
955  if (!refs)
956  {
957  RegCloseKey(This->hkeyVerb);
959  }
960  return refs;
961 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:922
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:395
#define InterlockedDecrement
Definition: armddk.h:52
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 1062 of file ole2.c.

1064 {
1066 
1067  TRACE("()\n");
1068 
1069  This->index = 0;
1070  return S_OK;
1071 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:922
#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 1051 of file ole2.c.

1053 {
1055 
1056  TRACE("(%d)\n", celt);
1057 
1058  This->index += celt;
1059  return S_OK;
1060 }
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:922
#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 3244 of file ole2.c.

3246 {
3247  ULONG i;
3248 
3249  TRACE("(%u, %p)\n", cVariants, rgvars);
3250 
3251  if (!rgvars)
3252  return E_INVALIDARG;
3253 
3254  for(i = 0; i < cVariants; i++)
3255  PropVariantClear(&rgvars[i]);
3256 
3257  return S_OK;
3258 }
HRESULT WINAPI PropVariantClear(PROPVARIANT *pvar)
Definition: ole2.c:2952
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 284 of file ole2.c.

285 {
287 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:123
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 311 of file ole2.c.

312 {
313  HANDLE handle, local_handle = 0;
314 
316 
317  if(handle)
318  {
319  DWORD pid;
320  HANDLE process;
321 
324  if(process)
325  {
328  }
329  }
330  return local_handle;
331 }
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:398
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:1168
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1257
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:284
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 539 of file ole2.c.

540 {
541  IDropTarget *droptarget = NULL;
542  HANDLE map;
543  IStream *stream;
544 
546  if(!map) return NULL;
547 
549  {
550  CoUnmarshalInterface(stream, &IID_IDropTarget, (void**)&droptarget);
551  IStream_Release(stream);
552  }
553  CloseHandle(map);
554  return droptarget;
555 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1982
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:366
#define CloseHandle
Definition: compat.h:398
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:311
#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 438 of file ole2.c.

439 {
441  *target = GetPropW( This->hwnd, prop_oledroptarget );
442  if (!*target) return DRAGDROP_E_NOTREGISTERED;
443  IDropTarget_AddRef( *target );
444  return S_OK;
445 }
#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:119
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:403
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 2375 of file ole2.c.

2376 {
2377  HRESULT hr;
2378  int res;
2379  HCURSOR cur;
2380 
2381 #ifdef __REACTOS__
2382  if (info->curDragTarget == NULL && info->accepterHWND == NULL)
2383  *info->pdwEffect = DROPEFFECT_NONE;
2384 #else
2385  if (info->curDragTarget == NULL)
2386  *info->pdwEffect = DROPEFFECT_NONE;
2387 #endif
2388 
2389  hr = IDropSource_GiveFeedback( info->dropSource, *info->pdwEffect );
2390 
2392  {
2393  if (*info->pdwEffect & DROPEFFECT_MOVE)
2394  res = CURSOR_MOVE;
2395  else if (*info->pdwEffect & DROPEFFECT_COPY)
2396  res = CURSOR_COPY;
2397  else if (*info->pdwEffect & DROPEFFECT_LINK)
2398  res = CURSOR_LINK;
2399  else
2400  res = CURSOR_NODROP;
2401 
2402  cur = LoadCursorW( hProxyDll, MAKEINTRESOURCEW( res ) );
2403  SetCursor( cur );
2404  }
2405 
2406  return hr;
2407 }
HRESULT hr
Definition: shlfolder.c:183
#define CURSOR_LINK
Definition: olestd.h:55
HICON HCURSOR
Definition: windef.h:284
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 403 of file ole2.c.

404 {
405  return CONTAINING_RECORD(iface, DropTargetWrapper, IDropTarget_iface);
406 }
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 922 of file ole2.c.

923 {
924  return CONTAINING_RECORD(iface, EnumOLEVERB, IEnumOLEVERB_iface);
925 }
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 294 of file ole2.c.

295 {
296  return get_droptarget_handle(hwnd) != 0;
297 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:284

Referenced by drag_enter(), and RegisterDragDrop().

◆ IsAccelerator()

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

Definition at line 1952 of file ole2.c.

1953 {
1954  LPACCEL lpAccelTbl;
1955  int i;
1956 
1957  if(!lpMsg) return FALSE;
1958  if (!hAccel)
1959  {
1960  WARN_(accel)("NULL accel handle\n");
1961  return FALSE;
1962  }
1963  if((lpMsg->message != WM_KEYDOWN &&
1964  lpMsg->message != WM_SYSKEYDOWN &&
1965  lpMsg->message != WM_SYSCHAR &&
1966  lpMsg->message != WM_CHAR)) return FALSE;
1967  lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL));
1968  if (NULL == lpAccelTbl)
1969  {
1970  return FALSE;
1971  }
1972  if (CopyAcceleratorTableW(hAccel, lpAccelTbl, cAccelEntries) != cAccelEntries)
1973  {
1974  WARN_(accel)("CopyAcceleratorTableW failed\n");
1975  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
1976  return FALSE;
1977  }
1978 
1979  TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
1980  "msg->hwnd=%p, msg->message=%04x, wParam=%08lx, lParam=%08lx\n",
1981  hAccel, cAccelEntries,
1982  lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1983  for(i = 0; i < cAccelEntries; i++)
1984  {
1985  if(lpAccelTbl[i].key != lpMsg->wParam)
1986  continue;
1987 
1988  if(lpMsg->message == WM_CHAR)
1989  {
1990  if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
1991  {
1992  TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", LOWORD(lpMsg->wParam) & 0xff);
1993  goto found;
1994  }
1995  }
1996  else
1997  {
1998  if(lpAccelTbl[i].fVirt & FVIRTKEY)
1999  {
2000  INT mask = 0;
2001  TRACE_(accel)("found accel for virt_key %04lx (scan %04x)\n",
2002  lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
2003  if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
2004  if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
2005  if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
2006  if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
2007  TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
2008  }
2009  else
2010  {
2011  if(!(lpMsg->lParam & 0x01000000)) /* no special_key */
2012  {
2013  if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
2014  { /* ^^ ALT pressed */
2015  TRACE_(accel)("found accel for Alt-%c\n", LOWORD(lpMsg->wParam) & 0xff);
2016  goto found;
2017  }
2018  }
2019  }
2020  }
2021  }
2022 
2023  WARN_(accel)("couldn't translate accelerator key\n");
2024  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2025  return FALSE;
2026 
2027 found:
2028  if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
2029  HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2030  return TRUE;
2031 }
#define TRUE
Definition: types.h:120
#define WM_CHAR
Definition: winuser.h:1693
BYTE fVirt
Definition: winuser.h:2876
WORD cmd
Definition: winuser.h:2878
WPARAM wParam
Definition: winuser.h:3069
#define VK_MENU
Definition: winuser.h:2158
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:1697
#define VK_SHIFT
Definition: winuser.h:2156
smooth NULL
Definition: ftsmooth.c:416
#define WM_KEYDOWN
Definition: winuser.h:1691
LPARAM lParam
Definition: winuser.h:3070
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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define FCONTROL
Definition: winuser.h:21
HWND hwnd
Definition: winuser.h:3067
#define VK_CONTROL
Definition: winuser.h:2157
#define WM_SYSKEYDOWN
Definition: winuser.h:1695
#define HIWORD(l)
Definition: typedefs.h:246
UINT message
Definition: winuser.h:3068
#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:394
Definition: path.c:42

Referenced by OleTranslateAccelerator().

◆ OLE_FreeClipDataArray()

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

Definition at line 2855 of file ole2.c.

2856 {
2857  ULONG i;
2858  for (i = 0; i < count; i++)
2859  CoTaskMemFree(pClipDataArray[i].pClipData);
2860 }
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
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 163 of file ole2.c.

164 {
165  TRACE("Returning version %d, build %d.\n", rmm, rup);
166  return (rmm<<16)+rup;
167 }
#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:395
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:394
#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:395
__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:845
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:394

Referenced by OleUninitialize().

◆ OleCreate()

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

Definition at line 2612 of file ole2.c.

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

1818 {
1819  HOLEMENU hOleMenu;
1820  OleMenuDescriptor *pOleMenuDescriptor;
1821  int i;
1822 
1823  if ( !hmenuCombined || !lpMenuWidths )
1824  return 0;
1825 
1826  /* Create an OLE menu descriptor */
1827  if ( !(hOleMenu = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
1828  sizeof(OleMenuDescriptor) ) ) )
1829  return 0;
1830 
1831  pOleMenuDescriptor = GlobalLock( hOleMenu );
1832  if ( !pOleMenuDescriptor )
1833  return 0;
1834 
1835  /* Initialize menu group widths and hmenu */
1836  for ( i = 0; i < 6; i++ )
1837  pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
1838 
1839  pOleMenuDescriptor->hmenuCombined = hmenuCombined;
1840  pOleMenuDescriptor->bIsServerItem = FALSE;
1841  GlobalUnlock( hOleMenu );
1842 
1843  return hOleMenu;
1844 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
HMENU hmenuCombined
Definition: ole2.c:85
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:84
LPVOID NTAPI GlobalLock(HGLOBAL hMem)
Definition: heapmem.c:755
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
BOOL bIsServerItem
Definition: ole2.c:86
#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 2153 of file ole2.c.

2158 {
2159  switch (uMsg)
2160  {
2161  case WM_CREATE:
2162  {
2163  LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
2164 
2165  SetWindowLongPtrW(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams);
2167 
2168  break;
2169  }
2170  case WM_TIMER:
2171  case WM_MOUSEMOVE:
2172  case WM_LBUTTONUP:
2173  case WM_MBUTTONUP:
2174  case WM_RBUTTONUP:
2175  case WM_LBUTTONDOWN:
2176  case WM_MBUTTONDOWN:
2177  case WM_RBUTTONDOWN:
2178  {
2180  if (trackerInfo->trackingDone) break;
2181  OLEDD_TrackStateChange(trackerInfo);
2182  break;
2183  }
2184  case WM_DESTROY:
2185  {
2187  break;
2188  }
2189  }
2190 
2191  /*
2192  * This is a window proc after all. Let's call the default.
2193  */
2194  return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2195 }
#define WM_MBUTTONUP
Definition: winuser.h:1759
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define WM_LBUTTONDOWN
Definition: winuser.h:1752
BOOL trackingDone
Definition: ole2.c:67
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:1755
#define GetWindowLongPtrA
Definition: winuser.h:4697
static void OLEDD_TrackStateChange(TrackerWindowInfo *trackerInfo)
Definition: ole2.c:2419
#define WM_TIMER
Definition: winuser.h:1718
#define WM_RBUTTONUP
Definition: winuser.h:1756
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
LPVOID lpCreateParams
Definition: winuser.h:2893
#define WM_LBUTTONUP
Definition: winuser.h:1753
#define WM_MBUTTONDOWN
Definition: winuser.h:1758
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WM_MOUSEMOVE
Definition: winuser.h:1751
#define WM_CREATE
Definition: winuser.h:1590
#define SetWindowLongPtrW
Definition: winuser.h:5215
LPARAM lParam
Definition: combotst.c:139
#define DRAG_TIMER_ID
Definition: ole2.c:2151

Referenced by OLEDD_Initialize().

◆ OLEDD_GetButtonState()

static DWORD OLEDD_GetButtonState ( void  )
static

Definition at line 2487 of file ole2.c.

2488 {
2489  BYTE keyboardState[256];
2490  DWORD keyMask = 0;
2491 
2492  GetKeyboardState(keyboardState);
2493 
2494  if ( (keyboardState[VK_SHIFT] & 0x80) !=0)
2495  keyMask |= MK_SHIFT;
2496 
2497  if ( (keyboardState[VK_CONTROL] & 0x80) !=0)
2498  keyMask |= MK_CONTROL;
2499 
2500  if ( (keyboardState[VK_MENU] & 0x80) !=0)
2501  keyMask |= MK_ALT;
2502 
2503  if ( (keyboardState[VK_LBUTTON] & 0x80) !=0)
2504  keyMask |= MK_LBUTTON;
2505 
2506  if ( (keyboardState[VK_RBUTTON] & 0x80) !=0)
2507  keyMask |= MK_RBUTTON;
2508 
2509  if ( (keyboardState[VK_MBUTTON] & 0x80) !=0)
2510  keyMask |= MK_MBUTTON;
2511 
2512  return keyMask;
2513 }
#define MK_SHIFT
Definition: winuser.h:2323
#define MK_LBUTTON
Definition: winuser.h:2321
#define VK_LBUTTON
Definition: winuser.h:2144
#define MK_MBUTTON
Definition: winuser.h:2325
#define VK_MENU
Definition: winuser.h:2158
#define VK_RBUTTON
Definition: winuser.h:2145
#define VK_SHIFT
Definition: winuser.h:2156
#define MK_RBUTTON
Definition: winuser.h:2322
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:2324
#define VK_CONTROL
Definition: winuser.h:2157
#define VK_MBUTTON
Definition: winuser.h:2147

Referenced by DoDragDrop().

◆ OLEDD_Initialize()

static void OLEDD_Initialize ( void  )
static

Definition at line 2126 of file ole2.c.

2127 {
2128  WNDCLASSW wndClass;
2129 
2130  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2131  wndClass.style = CS_GLOBALCLASS;
2133  wndClass.cbClsExtra = 0;
2134  wndClass.cbWndExtra = sizeof(TrackerWindowInfo*);
2135  wndClass.hCursor = 0;
2136  wndClass.hbrBackground = 0;
2138 
2139  RegisterClassW (&wndClass);
2140 }
UINT style
Definition: winuser.h:3129
static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:2153
#define ZeroMemory
Definition: winbase.h:1635
int cbClsExtra
Definition: winuser.h:3131
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
WNDPROC lpfnWndProc
Definition: winuser.h:3130
LPCWSTR lpszClassName
Definition: winuser.h:3138
int cbWndExtra
Definition: winuser.h:3132
#define CS_GLOBALCLASS
Definition: winuser.h:647
static const WCHAR OLEDD_DRAGTRACKERCLASS[]
Definition: ole2.c:109
HCURSOR hCursor
Definition: winuser.h:3135
HBRUSH hbrBackground
Definition: winuser.h:3136

Referenced by OleInitialize().

◆ OLEDD_TrackStateChange()

static void OLEDD_TrackStateChange ( TrackerWindowInfo trackerInfo)
static

Definition at line 2419 of file ole2.c.

2420 {
2421  HWND hwndNewTarget = 0;
2422  POINT pt;
2423 
2424  /*
2425  * Get the handle of the window under the mouse
2426  */
2427  pt.x = trackerInfo->curMousePos.x;
2428  pt.y = trackerInfo->curMousePos.y;
2429  hwndNewTarget = WindowFromPoint(pt);
2430 
2431  trackerInfo->returnValue = IDropSource_QueryContinueDrag(trackerInfo->dropSource,
2432  trackerInfo->escPressed,
2433  trackerInfo->dwKeyState);
2434 
2435  if (trackerInfo->curTargetHWND != hwndNewTarget &&
2436  (trackerInfo->returnValue == S_OK ||
2437  trackerInfo->returnValue == DRAGDROP_S_DROP))
2438  {
2439  if (trackerInfo->curDragTarget)
2440  {
2441  IDropTarget_DragLeave(trackerInfo->curDragTarget);
2442  IDropTarget_Release(trackerInfo->curDragTarget);
2443  trackerInfo->curDragTarget = NULL;
2444  trackerInfo->curTargetHWND = NULL;
2445  }
2446 #ifdef __REACTOS__
2447  trackerInfo->accepterHWND = NULL;
2448 #endif
2449 
2450  if (hwndNewTarget)
2451  drag_enter( trackerInfo, hwndNewTarget );
2452 
2453  give_feedback( trackerInfo );
2454 
2455  }
2456 
2457  if (trackerInfo->returnValue == S_OK)
2458  {
2459  if (trackerInfo->curDragTarget)
2460  {
2461  *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2462  IDropTarget_DragOver(trackerInfo->curDragTarget,
2463  trackerInfo->dwKeyState,
2464  trackerInfo->curMousePos,
2465  trackerInfo->pdwEffect);
2466  *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect;
2467  }
2468 #ifdef __REACTOS__
2469  else if (trackerInfo->accepterHWND)
2470  {
2471  *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2472  }
2473 #endif
2474  give_feedback( trackerInfo );
2475  }
2476  else
2477  drag_end( trackerInfo );
2478 }
DWORD dwOKEffect
Definition: ole2.c:65
#define pt(x, y)
Definition: drawing.c:79
LONG y
Definition: windef.h:315
DWORD dwKeyState
Definition: ole2.c:77
smooth NULL
Definition: ftsmooth.c:416
LONG x
Definition: windef.h:314
HRESULT returnValue
Definition: ole2.c:68
POINTL curMousePos
Definition: ole2.c:76
static void drag_end(TrackerWindowInfo *info)
Definition: ole2.c:2322
HWND curTargetHWND
Definition: ole2.c:71
#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:2375
IDropSource * dropSource
Definition: ole2.c:64
static void drag_enter(TrackerWindowInfo *info, HWND new_target)
Definition: ole2.c:2263
IDropTarget * curDragTarget
Definition: ole2.c:72
DWORD * pdwEffect
Definition: ole2.c:66

Referenced by DoDragDrop(), and OLEDD_DragTrackerWindowProc().

◆ OleDestroyMenuDescriptor()

HRESULT WINAPI OleDestroyMenuDescriptor ( HOLEMENU  hmenuDescriptor)

Definition at line 1850 of file ole2.c.

1852 {
1853  if ( hmenuDescriptor )
1854  GlobalFree( hmenuDescriptor );
1855  return S_OK;
1856 }
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 2761 of file ole2.c.

2762 {
2763  WCHAR *user_type_old, *user_type_new;
2764  CLIPFORMAT cf;
2765  STATSTG stat;
2766  CLSID clsid;
2767  HRESULT hr;
2768 
2769  TRACE("(%p, %p)\n", pStg, pClsidNew);
2770 
2771  *pClsidNew = CLSID_NULL;
2772  if(!pStg)
2773  return E_INVALIDARG;
2774  hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME);
2775  if(FAILED(hr))
2776  return hr;
2777 
2778  *pClsidNew = stat.clsid;
2779  hr = OleGetAutoConvert(&stat.clsid, &clsid);
2780  if(FAILED(hr))
2781  return hr;
2782 
2783  hr = IStorage_SetClass(pStg, &clsid);
2784  if(FAILED(hr))
2785  return hr;
2786 
2787  hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old);
2788  if(FAILED(hr)) {
2789  cf = 0;
2790  user_type_new = NULL;
2791  }
2792 
2793  hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new);
2794  if(FAILED(hr))
2795  user_type_new = NULL;
2796 
2797  hr = WriteFmtUserTypeStg(pStg, cf, user_type_new);
2798  CoTaskMemFree(user_type_new);
2799  if(FAILED(hr))
2800  {
2801  CoTaskMemFree(user_type_old);
2802  IStorage_SetClass(pStg, &stat.clsid);
2803  return hr;
2804  }
2805 
2806  hr = SetConvertStg(pStg, TRUE);
2807  if(FAILED(hr))
2808  {
2809  WriteFmtUserTypeStg(pStg, cf, user_type_old);
2810  IStorage_SetClass(pStg, &stat.clsid);
2811  }
2812  else
2813  *pClsidNew = clsid;
2814  CoTaskMemFree(user_type_old);
2815  return hr;
2816 }
static IClassFactory * cf
static LPCLSID pClsidNew
Definition: compobj.c:71
#define TRUE
Definition: types.h:120
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
Definition: storage32.c:9357
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
Definition: storage32.c:10649
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
Definition: ole2.c:2707
#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:94
LONG HRESULT
Definition: typedefs.h:77
REFCLSID clsid
Definition: msctf.c:84
Definition: stat.h:55
_CRTIMP int __cdecl stat(const char *_Filename, struct stat *_Stat)
Definition: stat.h:345
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:681
HRESULT WINAPI ReadFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
Definition: storage32.c:9400

Referenced by test_OleDoAutoConvert().

◆ OleDraw()

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

Definition at line 2568 of file ole2.c.

2573 {
2574  HRESULT hres;
2576 
2577  if (!pUnk) return E_INVALIDARG;
2578 
2579  hres = IUnknown_QueryInterface(pUnk,
2580  &IID_IViewObject,
2581  (void**)&viewobject);
2582  if (SUCCEEDED(hres))
2583  {
2584  hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, (RECTL*)rect, 0, 0, 0);
2585  IViewObject_Release(viewobject);
2586  return hres;
2587  }
2588  else
2589  return DV_E_NOIVIEWOBJECT;
2590 }
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 2707 of file ole2.c.

2708 {
2709  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2710  HKEY hkey = NULL;
2712  LONG len;
2713  HRESULT res = S_OK;
2714 
2715  res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey);
2716  if (FAILED(res))
2717  goto done;
2718 
2719  len = sizeof(buf);
2720  if (RegQueryValueW(hkey, NULL, buf, &len))
2721  {
2723  goto done;
2724  }
2726 done:
2727  if (hkey) RegCloseKey(hkey);
2728  return res;
2729 }
static LPCLSID pClsidNew
Definition: compobj.c:71
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:2357
__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:4272
GLenum GLsizei len
Definition: glext.h:6722
#define S_OK
Definition: intsafe.h:59
GLuint res
Definition: glext.h:9613
HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id)
Definition: compobj.c:2247

Referenced by OleDoAutoConvert(), and test_OleDoAutoConvert().

◆ OleInitialize()

HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize ( LPVOID  reserved)

Definition at line 172 of file ole2.c.

173 {
174  HRESULT hr;
175 
176  TRACE("(%p)\n", reserved);
177 
178  /*
179  * The first duty of the OleInitialize is to initialize the COM libraries.
180  */
182 
183  /*
184  * If the CoInitializeEx call failed, the OLE libraries can't be
185  * initialized.
186  */
187  if (FAILED(hr))
188  return hr;
189 
190  if (!COM_CurrentInfo()->ole_inits)
191  hr = S_OK;
192  else
193  hr = S_FALSE;
194 
195  /*
196  * Then, it has to initialize the OLE specific modules.
197  * This includes:
198  * Clipboard
199  * Drag and Drop
200  * Object linking and Embedding
201  * In-place activation
202  */
203  if (!COM_CurrentInfo()->ole_inits++ &&
205  {
206  /*
207  * Initialize the libraries.
208  */
209  TRACE("() - Initializing the OLE libraries\n");
210 
211  /*
212  * OLE Clipboard
213  */
215 
216  /*
217  * Drag and Drop
218  */
220 
221  /*
222  * OLE shared menu
223  */
225  }
226 
227  return hr;
228 }
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:2655
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static LONG OLE_moduleLockCount
Definition: ole2.c:104
LONG HRESULT
Definition: typedefs.h:77
static void OLEDD_Initialize(void)
Definition: ole2.c:2126
#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:1935
static void OLEMenu_Initialize(void)
Definition: ole2.c:1414

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

272  {
273  FIXME("(0x%08x, 0x%08x),stub!\n",x, y);
274  return 0;
275 }
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 2821 of file ole2.c.

2822 {
2823  IRunnableObject *pRunnable;
2824  HRESULT hr;
2825  BOOL running;
2826 
2827  TRACE("(%p)\n", object);
2828 
2829  if (!object) return FALSE;
2830 
2831  hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
2832  if (FAILED(hr))
2833  return TRUE;
2834  running = IRunnableObject_IsRunning(pRunnable);
2835  IRunnableObject_Release(pRunnable);
2836  return running;
2837 }
#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 1227 of file ole2.c.

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

1381 {
1383  HRESULT hres;
1384 
1385  TRACE("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses);
1386 
1387  hres = IUnknown_QueryInterface(pUnknown,
1389  (void**)&runnable);
1390 
1391  if (SUCCEEDED(hres))
1392  {
1393  hres = IRunnableObject_LockRunning(runnable, fLock, fLastUnlockCloses);
1394 
1395  IRunnableObject_Release(runnable);
1396 
1397  return hres;
1398  }
1399 
1400  return S_OK;
1401 }
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 1631 of file ole2.c.

1632 {
1633  LPCWPSTRUCT pMsg;
1634  HOLEMENU hOleMenu = 0;
1635  OleMenuDescriptor *pOleMenuDescriptor = NULL;
1636  OleMenuHookItem *pHookItem = NULL;
1637  WORD fuFlags;
1638 
1639  TRACE("%i, %04lx, %08lx\n", code, wParam, lParam );
1640 
1641  /* Check if we're being asked to process the message */
1642  if ( HC_ACTION != code )
1643  goto NEXTHOOK;
1644 
1645  /* Retrieve the current message being dispatched from lParam */
1646  pMsg = (LPCWPSTRUCT)lParam;
1647 
1648  /* Check if the message is destined for a window we are interested in:
1649  * If the window has an OLEMenu property we may need to dispatch
1650  * the menu message to its active objects window instead. */
1651 
1652  hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1653  if ( !hOleMenu )
1654  goto NEXTHOOK;
1655 
1656  /* Get the menu descriptor */
1657  pOleMenuDescriptor = GlobalLock( hOleMenu );
1658  if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1659  goto NEXTHOOK;
1660 
1661  /* Process menu messages */
1662  switch( pMsg->message )
1663  {
1664  case WM_INITMENU:
1665  {
1666  /* Reset the menu descriptor state */
1667  pOleMenuDescriptor->bIsServerItem = FALSE;
1668 
1669  /* Send this message to the server as well */
1670  SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1671  pMsg->message, pMsg->wParam, pMsg->lParam );
1672  goto NEXTHOOK;
1673  }
1674 
1675  case WM_INITMENUPOPUP:
1676  {
1677  /* Save the state for whether this is a server owned menu */
1678  OLEMenu_SetIsServerMenu( (HMENU)pMsg->wParam, pOleMenuDescriptor );
1679  break;
1680  }
1681 
1682  case WM_MENUSELECT:
1683  {
1684  fuFlags = HIWORD(pMsg->wParam); /* Get flags */
1685  if ( fuFlags & MF_SYSMENU )
1686  goto NEXTHOOK;
1687 
1688  /* Save the state for whether this is a server owned popup menu */
1689  else if ( fuFlags & MF_POPUP )
1690  OLEMenu_SetIsServerMenu( (HMENU)pMsg->lParam, pOleMenuDescriptor );
1691 
1692  break;
1693  }
1694 
1695  case WM_DRAWITEM:
1696  {
1697  LPDRAWITEMSTRUCT lpdis = (LPDRAWITEMSTRUCT) pMsg->lParam;
1698  if ( pMsg->wParam != 0 || lpdis->CtlType != ODT_MENU )
1699  goto NEXTHOOK; /* Not a menu message */
1700 
1701  break;
1702  }
1703 
1704  default:
1705  goto NEXTHOOK;
1706  }
1707 
1708  /* If the message was for the server dispatch it accordingly */
1709  if ( pOleMenuDescriptor->bIsServerItem )
1710  {
1711  SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1712  pMsg->message, pMsg->wParam, pMsg->lParam );
1713  }
1714 
1715 NEXTHOOK:
1716  if ( pOleMenuDescriptor )
1717  GlobalUnlock( hOleMenu );
1718 
1719  /* Lookup the hook item for the current thread */
1720  if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1721  {
1722  /* This should never fail!! */
1723  WARN("could not retrieve hHook for current thread!\n" );
1724  return 0;
1725  }
1726 
1727  /* Pass on the message to the next hooker */
1728  return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
1729 }
static const WCHAR prop_olemenuW[]
Definition: ole2.c:115
HWND hwndActiveObject
Definition: ole2.c:83
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define WM_INITMENUPOPUP
Definition: winuser.h:1722
#define WARN(fmt,...)
Definition: debug.h:111
#define ODT_MENU
Definition: winuser.h:2491
WPARAM wParam
Definition: combotst.c:138
static OleMenuHookItem * OLEMenu_IsHookInstalled(DWORD tid)
Definition: ole2.c:1526
#define WM_MENUSELECT
Definition: winuser.h:1723
smooth NULL
Definition: ftsmooth.c:416
#define MF_SYSMENU
Definition: winuser.h:141
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
#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:2978
WPARAM wParam
Definition: winuser.h:2979
#define MF_POPUP
Definition: winuser.h:136
UINT message
Definition: winuser.h:2980
HHOOK CallWndProc_hHook
Definition: ole2.c:94
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:1721
static BOOL OLEMenu_SetIsServerMenu(HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor)
Definition: ole2.c:1592
#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:86
#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 1549 of file ole2.c.

1550 {
1551  INT i, nItems;
1552 
1554 
1555  for (i = 0; i < nItems; i++)
1556  {
1557  HMENU hsubmenu;
1558 
1559  /* Is the current item a submenu? */
1560  if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
1561  {
1562  /* If the handle is the same we're done */
1563  if ( hsubmenu == hPopupMenu )
1564  {
1565  if (pnPos)
1566  *pnPos = i;
1567  return TRUE;
1568  }
1569  /* Recursively search without updating pnPos */
1570  else if ( OLEMenu_FindMainMenuIndex( hsubmenu, hPopupMenu, NULL ) )
1571  {
1572  if (pnPos)
1573  *pnPos = i;
1574  return TRUE;
1575  }
1576  }
1577  }
1578 
1579  return FALSE;
1580 }
#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:1549
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 1736 of file ole2.c.

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

Referenced by OLEMenu_InstallHooks().

◆ OLEMenu_Initialize()

static void OLEMenu_Initialize ( void  )
static

Definition at line 1414 of file ole2.c.

1415 {
1416 }

Referenced by OleInitialize().

◆ OLEMenu_InstallHooks()

static BOOL OLEMenu_InstallHooks ( DWORD  tid)
static

Definition at line 1434 of file ole2.c.

1435 {
1436  OleMenuHookItem *pHookItem;
1437 
1438  /* Create an entry for the hook table */
1439  if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0,
1440  sizeof(OleMenuHookItem)) ) )
1441  return FALSE;
1442 
1443  pHookItem->tid = tid;
1444  pHookItem->hHeap = GetProcessHeap();
1445  pHookItem->CallWndProc_hHook = NULL;
1446 
1447  /* Install a thread scope message hook for WH_GETMESSAGE */
1449  0, GetCurrentThreadId() );
1450  if ( !pHookItem->GetMsg_hHook )
1451  goto CLEANUP;
1452 
1453  /* Install a thread scope message hook for WH_CALLWNDPROC */
1455  0, GetCurrentThreadId() );
1456  if ( !pHookItem->CallWndProc_hHook )
1457  goto CLEANUP;
1458 
1459  /* Insert the hook table entry */
1460  pHookItem->next = hook_list;
1461  hook_list = pHookItem;
1462 
1463  return TRUE;
1464 
1465 CLEANUP:
1466  /* Unhook any hooks */
1467  if ( pHookItem->GetMsg_hHook )
1468  UnhookWindowsHookEx( pHookItem->GetMsg_hHook );
1469  if ( pHookItem->CallWndProc_hHook )
1470  UnhookWindowsHookEx( pHookItem->CallWndProc_hHook );
1471  /* Release the hook table entry */
1472  HeapFree(pHookItem->hHeap, 0, pHookItem );
1473 
1474  return FALSE;
1475 }
#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:95
DWORD WINAPI GetCurrentThreadId(VOID)
Definition: thread.c:421
static OleMenuHookItem * hook_list
Definition: ole2.c:98
HANDLE hHeap
Definition: ole2.c:92
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1736
static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1631
HHOOK GetMsg_hHook
Definition: ole2.c:93
HHOOK CallWndProc_hHook
Definition: ole2.c:94
#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:394

Referenced by OleSetMenuDescriptor().

◆ OLEMenu_IsHookInstalled()

static OleMenuHookItem * OLEMenu_IsHookInstalled ( DWORD  tid)
static

Definition at line 1526 of file ole2.c.

1527 {
1528  OleMenuHookItem *pHookItem;
1529 
1530  /* Do a simple linear search for an entry whose tid matches ours.
1531  * We really need a map but efficiency is not a concern here. */
1532  for (pHookItem = hook_list; pHookItem; pHookItem = pHookItem->next)
1533  {
1534  if ( tid == pHookItem->tid )
1535  return pHookItem;
1536  }
1537 
1538  return NULL;
1539 }
smooth NULL
Definition: ftsmooth.c:416
struct tagOleMenuHookItem * next
Definition: ole2.c:95
static OleMenuHookItem * hook_list
Definition: ole2.c:98
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 1592 of file ole2.c.

1593 {
1594  UINT nPos = 0, nWidth, i;
1595 
1596  pOleMenuDescriptor->bIsServerItem = FALSE;
1597 
1598  /* Don't bother searching if the popup is the combined menu itself */
1599  if ( hmenu == pOleMenuDescriptor->hmenuCombined )
1600  return FALSE;
1601 
1602  /* Find the menu item index in the shared OLE menu that this item belongs to */
1603  if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu, &nPos ) )
1604  return FALSE;
1605 
1606  /* The group widths array has counts for the number of elements
1607  * in the groups File, Edit, Container, Object, Window, Help.
1608  * The Edit, Object & Help groups belong to the server object
1609  * and the other three belong to the container.
1610  * Loop through the group widths and locate the group we are a member of.
1611  */
1612  for ( i = 0, nWidth = 0; i < 6; i++ )
1613  {
1614  nWidth += pOleMenuDescriptor->mgw.width[i];
1615  if ( nPos < nWidth )
1616  {
1617  /* Odd elements are server menu widths */
1618  pOleMenuDescriptor->bIsServerItem = i%2;
1619  break;
1620  }
1621  }
1622 
1623  return pOleMenuDescriptor->bIsServerItem;
1624 }
static HMENU hmenu
Definition: win.c:66
HMENU hmenuCombined
Definition: ole2.c:85
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:1549
OLEMENUGROUPWIDTHS mgw
Definition: ole2.c:84
unsigned int UINT
Definition: ndis.h:50
BOOL bIsServerItem
Definition: ole2.c:86

Referenced by OLEMenu_CallWndProc().

◆ OLEMenu_UnInitialize()

static void OLEMenu_UnInitialize ( void  )
static

Definition at line 1423 of file ole2.c.

1424 {
1425 }

Referenced by OleUninitialize().

◆ OLEMenu_UnInstallHooks()

static BOOL OLEMenu_UnInstallHooks ( DWORD  tid)
static

Definition at line 1484 of file ole2.c.

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

Referenced by OleSetMenuDescriptor().

◆ OleNoteObjectVisible()

HRESULT WINAPI OleNoteObjectVisible ( LPUNKNOWN  pUnknown,
BOOL  bVisible 
)

Definition at line 2842 of file ole2.c.

2843 {
2844  TRACE("(%p, %s)\n", pUnknown, bVisible ? "TRUE" : "FALSE");
2845  return CoLockObjectExternal(pUnknown, bVisible, TRUE);
2846 }
#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:3652

◆ OleQueryLinkFromData()

HRESULT WINAPI OleQueryLinkFromData ( IDataObject pSrcDataObject)

Definition at line 857 of file ole2.c.

859 {
860  FIXME("(%p),stub!\n", pSrcDataObject);
861  return S_FALSE;
862 }
#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 1128 of file ole2.c.

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

871 {
872  static const WCHAR miscstatusW[] = {'M','i','s','c','S','t','a','t','u','s',0};
873  static const WCHAR dfmtW[] = {'%','d',0};
874  WCHAR keyName[16];
875  HKEY miscStatusKey;
876  HKEY aspectKey;
877  LONG result;
878  HRESULT hr;
879 
880  TRACE("(%s, %d, %p)\n", debugstr_guid(clsid), dwAspect, pdwStatus);
881 
882  if (!pdwStatus) return E_INVALIDARG;
883 
884  *pdwStatus = 0;
885 
886  if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
887 
888  hr = COM_OpenKeyForCLSID(clsid, miscstatusW, KEY_READ, &miscStatusKey);
889  if (FAILED(hr))
890  /* missing key is not a failure */
891  return hr == REGDB_E_KEYMISSING ? S_OK : hr;
892 
893  OLEUTL_ReadRegistryDWORDValue(miscStatusKey, pdwStatus);
894 
895  /*
896  * Open the key specific to the requested aspect.
897  */
898  sprintfW(keyName, dfmtW, dwAspect);
899 
900  result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
901  if (result == ERROR_SUCCESS)
902  {
903  OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
904  RegCloseKey(aspectKey);
905  }
906 
907  RegCloseKey(miscStatusKey);
908  return S_OK;
909 }
#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:2529
#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:2357
#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
REFCLSID clsid
Definition: msctf.c:84
#define S_OK
Definition: intsafe.h:59
LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: compobj.c:423
#define sprintfW
Definition: unicode.h:58
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
Definition: compobj.c:257
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 681 of file ole2.c.

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

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

◆ OleRun()

HRESULT WINAPI DECLSPEC_HOTPATCH OleRun ( LPUNKNOWN  pUnknown)

Definition at line 1208 of file ole2.c.

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

1345 {
1346  HRESULT hres;
1347  CLSID objectClass;
1348 
1349  TRACE("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad);
1350 
1351  /*
1352  * First, we transfer the class ID (if available)
1353  */
1354  hres = IPersistStorage_GetClassID(pPS, &objectClass);
1355 
1356  if (SUCCEEDED(hres))
1357  {
1358  WriteClassStg(pStg, &objectClass);
1359  }
1360 
1361  /*
1362  * Then, we ask the object to save itself to the
1363  * storage. If it is successful, we commit the storage.
1364  */
1365  hres = IPersistStorage_Save(pPS, pStg, fSameAsLoad);
1366 
1367  if (SUCCEEDED(hres))
1368  {
1369  IStorage_Commit(pStg,
1370  STGC_DEFAULT);
1371  }
1372 
1373  return hres;
1374 }
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
Definition: storage32.c:9079
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ OleSetAutoConvert()

HRESULT WINAPI OleSetAutoConvert ( REFCLSID  clsidOld,
REFCLSID  clsidNew 
)

Definition at line 2734 of file ole2.c.

2735 {
2736  static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0};
2737  HKEY hkey = NULL;
2738  WCHAR szClsidNew[CHARS_IN_GUID];
2739  HRESULT res = S_OK;
2740 
2741  TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
2742 
2743  res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
2744  if (FAILED(res))
2745  goto done;
2746  StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
2747  if (RegSetValueW(hkey, wszAutoConvertTo, REG_SZ, szClsidNew, (strlenW(szClsidNew)+1) * sizeof(WCHAR)))
2748  {
2750  goto done;
2751  }
2752 
2753 done:
2754  if (hkey) RegCloseKey(hkey);
2755  return res;
2756 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#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:5036
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
smooth NULL
Definition: ftsmooth.c:416
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:2357
#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:2343
#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 1171 of file ole2.c.

1174 {
1176  HRESULT hres;
1177 
1178  TRACE("(%p,%x)\n", pUnknown, fContained);
1179 
1180  hres = IUnknown_QueryInterface(pUnknown,
1182  (void**)&runnable);
1183 
1184  if (SUCCEEDED(hres))
1185  {
1186  hres = IRunnableObject_SetContainedObject(runnable, fContained);
1187 
1188  IRunnableObject_Release(runnable);
1189 
1190  return hres;
1191  }
1192 
1193  return S_OK;
1194 }
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 1878 of file ole2.c.

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

2597 {
2598  WORD wID;
2599 
2600  TRACE("(%p,%p,%p)\n", lpFrame, lpFrameInfo, lpmsg);
2601 
2602  if (IsAccelerator(lpFrameInfo->haccel,lpFrameInfo->cAccelEntries,lpmsg,&wID))
2603  return IOleInPlaceFrame_TranslateAccelerator(lpFrame,lpmsg,wID);
2604 
2605  return S_FALSE;
2606 }
BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD *lpwCmd)
Definition: ole2.c:1952
#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 233 of file ole2.c.

234 {
235  TRACE("()\n");
236 
237  if (COM_CurrentInfo()->ole_inits == 0)
238  {
239  WARN("ole_inits is already 0\n");
240  return ;
241  }
242  /*
243  * If we hit the bottom of the lock stack, free the libraries.
244  */
245  if (!--COM_CurrentInfo()->ole_inits && !InterlockedDecrement(&OLE_moduleLockCount))
246  {
247  /*
248  * Actually free the libraries.
249  */
250  TRACE("() - Freeing the last reference count\n");
251 
252  /*
253  * OLE Clipboard
254  */
256 
257  /*
258  * OLE shared menu
259  */
261  }
262 
263  /*
264  * Then, uninitialize the COM libraries.
265  */
266  CoUninitialize();
267 }
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:1423
static struct oletls * COM_CurrentInfo(void)
#define TRACE(s)
Definition: solgame.cpp:4
static LONG OLE_moduleLockCount
Definition: ole2.c:104
#define InterlockedDecrement
Definition: armddk.h:52
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:1991

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

2532 {
2533  WCHAR buffer[20];
2534  DWORD cbData = sizeof(buffer);
2535  DWORD dwKeyType;
2536  LONG lres;
2537 
2538  lres = RegQueryValueExW(regKey,
2539  emptyW,
2540  NULL,
2541  &dwKeyType,
2542  (LPBYTE)buffer,
2543  &cbData);
2544 
2545  if (lres==ERROR_SUCCESS)
2546  {
2547  switch (dwKeyType)
2548  {
2549  case REG_DWORD:
2550  *pdwValue = *(DWORD*)buffer;
2551  break;
2552  case REG_EXPAND_SZ:
2553  case REG_MULTI_SZ:
2554  case REG_SZ:
2555  *pdwValue = (DWORD)strtoulW(buffer, NULL, 10);
2556  break;
2557  }
2558  }
2559 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint buffer
Definition: glext.h:5915
#define DWORD
Definition: nt_native.h:44
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:4134
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR emptyW[]
Definition: ole2.c:126
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define strtoulW(s1, s2, b)
Definition: unicode.h:41
#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 2867 of file ole2.c.

2868 {
2869  return SysAllocString(str);
2870 }
const WCHAR * str
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241

Referenced by PropVariantCopy().

◆ PropSysFreeString()

void WINAPI PropSysFreeString ( LPOLESTR  str)

Definition at line 2877 of file ole2.c.

2878 {
2879  SysFreeString(str);
2880 }
const WCHAR * str
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

Referenced by PropVariantClear().

◆ PROPVARIANT_ValidateType()

static HRESULT PROPVARIANT_ValidateType ( VARTYPE  vt)
inlinestatic

Definition at line 2885 of file ole2.c.

2886 {
2887  switch (vt)
2888  {
2889  case VT_EMPTY:
2890  case VT_NULL:
2891  case VT_I1:
2892  case VT_I2:
2893  case VT_I4:
2894  case VT_I8:
2895  case VT_R4:
2896  case VT_R8:
2897  case VT_CY:
2898  case VT_DATE:
2899  case VT_BSTR:
2900  case VT_ERROR:
2901  case VT_BOOL:
2902  case VT_DECIMAL:
2903  case VT_UI1:
2904  case VT_UI2:
2905  case VT_UI4:
2906  case VT_UI8:
2907  case VT_INT:
2908  case VT_UINT:
2909  case VT_LPSTR:
2910  case VT_LPWSTR:
2911  case VT_FILETIME:
2912  case VT_BLOB:
2913  case VT_DISPATCH:
2914  case VT_UNKNOWN:
2915  case VT_STREAM:
2916  case VT_STORAGE:
2917  case VT_STREAMED_OBJECT:
2918  case VT_STORED_OBJECT:
2919  case VT_BLOB_OBJECT:
2920  case VT_CF:
2921  case VT_CLSID:
2922  case VT_I1|VT_VECTOR:
2923  case VT_I2|VT_VECTOR:
2924  case VT_I4|VT_VECTOR:
2925  case VT_I8|VT_VECTOR:
2926  case VT_R4|VT_VECTOR:
2927  case VT_R8|VT_VECTOR:
2928  case VT_CY|VT_VECTOR:
2929  case VT_DATE|VT_VECTOR:
2930  case VT_BSTR|VT_VECTOR:
2931  case VT_ERROR|VT_VECTOR:
2932  case VT_BOOL|VT_VECTOR:
2933  case VT_VARIANT|VT_VECTOR:
2934  case VT_UI1|VT_VECTOR:
2935  case VT_UI2|VT_VECTOR:
2936  case VT_UI4|VT_VECTOR:
2937  case VT_UI8|VT_VECTOR:
2938  case VT_LPSTR|VT_VECTOR:
2939  case VT_LPWSTR|VT_VECTOR:
2940  case VT_FILETIME|VT_VECTOR:
2941  case VT_CF|VT_VECTOR:
2942  case VT_CLSID|VT_VECTOR:
2943  return S_OK;
2944  }
2945  WARN("Bad type %d\n", vt);
2946  return STG_E_INVALIDPARAMETER;
2947 }
Definition: compat.h:1932
Definition: compat.h:1948
Definition: compat.h:1944
#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:1933
Definition: compat.h:1935
Definition: compat.h:1970
#define S_OK
Definition: intsafe.h:59
Definition: compat.h:1934
Definition: compat.h:1931

Referenced by PropVariantClear(), and PropVariantCopy().

◆ PropVariantClear()

HRESULT WINAPI PropVariantClear ( PROPVARIANT *  pvar)

Definition at line 2952 of file ole2.c.

2953 {
2954  HRESULT hr;
2955 
2956  TRACE("(%p)\n", pvar);
2957 
2958  if (!pvar)
2959  return S_OK;
2960 
2961  hr = PROPVARIANT_ValidateType(pvar->vt);
2962  if (FAILED(hr))
2963  {
2964  memset(pvar, 0, sizeof(*pvar));
2965  return hr;
2966  }
2967 
2968  switch(pvar->vt)
2969  {
2970  case VT_EMPTY:
2971  case VT_NULL:
2972  case VT_I1:
2973  case VT_I2:
2974  case VT_I4:
2975  case VT_I8:
2976  case VT_R4:
2977  case VT_R8:
2978  case VT_CY:
2979  case VT_DATE:
2980  case VT_ERROR:
2981  case VT_BOOL:
2982  case VT_DECIMAL:
2983  case VT_UI1:
2984  case VT_UI2:
2985  case VT_UI4:
2986  case VT_UI8:
2987  case VT_INT:
2988  case VT_UINT:
2989  case VT_FILETIME:
2990  break;
2991  case VT_DISPATCH:
2992  case VT_UNKNOWN:
2993  case VT_STREAM:
2994  case VT_STREAMED_OBJECT:
2995  case VT_STORAGE:
2996  case VT_STORED_OBJECT:
2997  if (pvar->u.pStream)
2998  IStream_Release(pvar->u.pStream);
2999  break;
3000  case VT_CLSID:
3001  case VT_LPSTR:
3002  case VT_LPWSTR:
3003  /* pick an arbitrary typed pointer - we don't care about the type
3004  * as we are just freeing it */
3005  CoTaskMemFree(pvar->u.puuid);
3006  break;
3007  case VT_BLOB:
3008  case VT_BLOB_OBJECT:
3009  CoTaskMemFree(pvar->u.blob.pBlobData);
3010  break;
3011  case VT_BSTR:
3012  PropSysFreeString(pvar->u.bstrVal);
3013  break;
3014  case VT_CF:
3015  if (pvar->u.pclipdata)
3016  {
3017  OLE_FreeClipDataArray(1, pvar->u.pclipdata);
3018  CoTaskMemFree(pvar->u.pclipdata);
3019  }
3020  break;
3021  default:
3022  if (pvar->vt & VT_VECTOR)
3023  {
3024  ULONG i;
3025 
3026  switch (pvar->vt & ~VT_VECTOR)
3027  {
3028  case VT_VARIANT:
3029  FreePropVariantArray(pvar->u.capropvar.cElems, pvar->u.capropvar.pElems);
3030  break;
3031  case VT_CF:
3032  OLE_FreeClipDataArray(pvar->u.caclipdata.cElems, pvar->u.caclipdata.pElems);
3033  break;
3034  case VT_BSTR:
3035  for (i = 0; i < pvar->u.cabstr.cElems; i++)
3036  PropSysFreeString(pvar->u.cabstr.pElems[i]);
3037  break;
3038  case VT_LPSTR:
3039  for (i = 0; i < pvar->u.calpstr.cElems; i++)
3040  CoTaskMemFree(pvar->u.calpstr.pElems[i]);
3041  break;
3042  case VT_LPWSTR:
3043  for (i = 0; i < pvar->u.calpwstr.cElems; i++)
3044  CoTaskMemFree(pvar->u.calpwstr.pElems[i]);
3045  break;
3046  }
3047  if (pvar->vt & ~VT_VECTOR)
3048  {
3049  /* pick an arbitrary VT_VECTOR structure - they all have the same
3050  * memory layout */
3051  CoTaskMemFree(pvar->u.capropvar.pElems);
3052  }
3053  }
3054  else
3055  {
3056  WARN("Invalid/unsupported type %d\n", pvar->vt);
3058  }
3059  }
3060 
3061  memset(pvar, 0, sizeof(*pvar));
3062  return hr;
3063 }
Definition: compat.h:1932
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
Definition: compat.h:1948
HRESULT hr
Definition: shlfolder.c:183
Definition: compat.h:1944
HRESULT WINAPI FreePropVariantArray(ULONG cVariants, PROPVARIANT *rgvars)
Definition: ole2.c:3244
#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
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
void WINAPI PropSysFreeString(LPOLESTR str)
Definition: ole2.c:2877
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580
Definition: compat.h:1933
Definition: compat.h:1935
Definition: compat.h:1970
#define S_OK
Definition: intsafe.h:59
static void OLE_FreeClipDataArray(ULONG count, CLIPDATA *pClipDataArray)
Definition: ole2.c:2855