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

Go to the source code of this file.

Classes

struct  tagTrackerWindowInfo
 
struct  tagOleMenuDescriptor
 
struct  tagOleMenuHookItem
 
struct  DropTargetWrapper
 
struct  EnumOLEVERB
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define DRAG_TIMER_ID   1
 

Typedefs

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

Functions

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

Variables

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

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 32 of file ole2.c.

◆ DRAG_TIMER_ID

#define DRAG_TIMER_ID   1

Definition at line 2148 of file ole2.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 33 of file ole2.c.

Typedef Documentation

◆ OleMenuDescriptor

◆ OleMenuHookItem

◆ TrackerWindowInfo

Function Documentation

◆ create_map_from_stream()

static HRESULT create_map_from_stream ( IStream stream,
HANDLE map 
)
static

Definition at line 337 of file ole2.c.

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

Referenced by RegisterDragDrop().

◆ create_stream_from_map()

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

Definition at line 363 of file ole2.c.

364{
366 HGLOBAL hmem;
367 void *data;
369
370 data = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
371 if(!data) return hr;
372
373 VirtualQuery(data, &info, sizeof(info));
374 TRACE("size %d\n", (int)info.RegionSize);
375
376 hmem = GlobalAlloc(GMEM_MOVEABLE, info.RegionSize);
377 if(hmem)
378 {
379 memcpy(GlobalLock(hmem), data, info.RegionSize);
380 GlobalUnlock(hmem);
382 }
384 return hr;
385}
#define TRUE
Definition: types.h:120
#define FILE_MAP_READ
Definition: compat.h:776
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
#define TRACE(s)
Definition: solgame.cpp:4
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
Definition: virtmem.c:211
#define GMEM_MOVEABLE
Definition: winbase.h:294

Referenced by get_droptarget_pointer(), and RevokeDragDrop().

◆ DllDebugObjectRPCHook()

BOOL WINAPI DllDebugObjectRPCHook ( BOOL  b,
void dummy 
)

Definition at line 3288 of file ole2.c.

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

◆ DoDragDrop()

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

Definition at line 753 of file ole2.c.

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

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

◆ drag_end()

static void drag_end ( TrackerWindowInfo info)
static

Definition at line 2319 of file ole2.c.

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

Referenced by OLEDD_TrackStateChange().

◆ drag_enter()

static void drag_enter ( TrackerWindowInfo info,
HWND  new_target 
)
static

Definition at line 2260 of file ole2.c.

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

Referenced by OLEDD_TrackStateChange().

◆ DropTargetWrapper_AddRef()

static ULONG WINAPI DropTargetWrapper_AddRef ( IDropTarget iface)
static

Definition at line 421 of file ole2.c.

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

◆ DropTargetWrapper_DragEnter()

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

Definition at line 444 of file ole2.c.

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

◆ DropTargetWrapper_DragLeave()

static HRESULT WINAPI DropTargetWrapper_DragLeave ( IDropTarget iface)
static

Definition at line 477 of file ole2.c.

478{
481
482 if (SUCCEEDED( r ))
483 {
484 r = IDropTarget_DragLeave( target );
485 IDropTarget_Release( target );
486 }
487 return r;
488}

◆ DropTargetWrapper_DragOver()

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

Definition at line 461 of file ole2.c.

465{
468
469 if (SUCCEEDED( r ))
470 {
471 r = IDropTarget_DragOver( target, grfKeyState, pt, pdwEffect );
472 IDropTarget_Release( target );
473 }
474 return r;
475}

◆ DropTargetWrapper_Drop()

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

Definition at line 490 of file ole2.c.

495{
498
499 if (SUCCEEDED( r ))
500 {
501 r = IDropTarget_Drop( target, pDataObj, grfKeyState, pt, pdwEffect );
502 IDropTarget_Release( target );
503 }
504 return r;
505}

◆ DropTargetWrapper_QueryInterface()

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

Definition at line 405 of file ole2.c.

408{
411 IsEqualIID(riid, &IID_IDropTarget))
412 {
413 IDropTarget_AddRef(&This->IDropTarget_iface);
414 *ppvObject = &This->IDropTarget_iface;
415 return S_OK;
416 }
417 *ppvObject = NULL;
418 return E_NOINTERFACE;
419}
const GUID IID_IUnknown
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ DropTargetWrapper_Release()

static ULONG WINAPI DropTargetWrapper_Release ( IDropTarget iface)
static

Definition at line 427 of file ole2.c.

428{
430 ULONG refs = InterlockedDecrement(&This->refs);
431 if (!refs) HeapFree(GetProcessHeap(), 0, This);
432 return refs;
433}
#define InterlockedDecrement
Definition: armddk.h:52
#define GetProcessHeap()
Definition: compat.h:736
#define HeapFree(x, y, z)
Definition: compat.h:735
uint32_t ULONG
Definition: typedefs.h:59

◆ EnumOLEVERB_AddRef()

static ULONG WINAPI EnumOLEVERB_AddRef ( IEnumOLEVERB iface)
static

Definition at line 938 of file ole2.c.

940{
942 TRACE("()\n");
943 return InterlockedIncrement(&This->ref);
944}
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:919

◆ EnumOLEVERB_Clone()

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

Definition at line 1070 of file ole2.c.

1073{
1075 HKEY hkeyVerb;
1076 TRACE("(%p)\n", ppenum);
1079 return EnumOLEVERB_Construct(hkeyVerb, This->index, ppenum);
1080}
#define GetCurrentProcess()
Definition: compat.h:759
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
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1093
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define DUPLICATE_SAME_ACCESS

◆ EnumOLEVERB_Construct()

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

Definition at line 1093 of file ole2.c.

1094{
1095 EnumOLEVERB *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1096 if (!This)
1097 {
1098 RegCloseKey(hkeyVerb);
1099 return E_OUTOFMEMORY;
1100 }
1101 This->IEnumOLEVERB_iface.lpVtbl = &EnumOLEVERB_VTable;
1102 This->ref = 1;
1103 This->index = index;
1104 This->hkeyVerb = hkeyVerb;
1105 *ppenum = &This->IEnumOLEVERB_iface;
1106 return S_OK;
1107}
#define index(s, c)
Definition: various.h:29
#define RegCloseKey(hKey)
Definition: registry.h:49
#define HeapAlloc
Definition: compat.h:733
static const IEnumOLEVERBVtbl EnumOLEVERB_VTable
Definition: ole2.c:1082

Referenced by EnumOLEVERB_Clone(), and OleRegEnumVerbs().

◆ EnumOLEVERB_Next()

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

Definition at line 960 of file ole2.c.

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

◆ EnumOLEVERB_QueryInterface()

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

Definition at line 924 of file ole2.c.

926{
927 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
930 {
931 IEnumOLEVERB_AddRef(iface);
932 *ppv = iface;
933 return S_OK;
934 }
935 return E_NOINTERFACE;
936}
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IEnumOLEVERB

◆ EnumOLEVERB_Release()

static ULONG WINAPI EnumOLEVERB_Release ( IEnumOLEVERB iface)
static

Definition at line 946 of file ole2.c.

948{
950 LONG refs = InterlockedDecrement(&This->ref);
951 TRACE("()\n");
952 if (!refs)
953 {
954 RegCloseKey(This->hkeyVerb);
956 }
957 return refs;
958}

◆ EnumOLEVERB_Reset()

static HRESULT WINAPI EnumOLEVERB_Reset ( IEnumOLEVERB iface)
static

Definition at line 1059 of file ole2.c.

1061{
1063
1064 TRACE("()\n");
1065
1066 This->index = 0;
1067 return S_OK;
1068}

◆ EnumOLEVERB_Skip()

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

Definition at line 1048 of file ole2.c.

1050{
1052
1053 TRACE("(%d)\n", celt);
1054
1055 This->index += celt;
1056 return S_OK;
1057}

◆ FreePropVariantArray()

HRESULT WINAPI FreePropVariantArray ( ULONG  cVariants,
PROPVARIANT *  rgvars 
)

Definition at line 3267 of file ole2.c.

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

Referenced by PropVariantClear().

◆ get_droptarget_handle()

static HANDLE get_droptarget_handle ( HWND  hwnd)
inlinestatic

Definition at line 281 of file ole2.c.

282{
284}
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:120
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)

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

◆ get_droptarget_local_handle()

static HANDLE get_droptarget_local_handle ( HWND  hwnd)
static

Definition at line 308 of file ole2.c.

309{
310 HANDLE handle, local_handle = 0;
311
313
314 if(handle)
315 {
316 DWORD pid;
318
321 if(process)
322 {
325 }
326 }
327 return local_handle;
328}
#define CloseHandle
Definition: compat.h:739
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1227
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:281
#define PROCESS_DUP_HANDLE
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

Referenced by get_droptarget_pointer().

◆ get_droptarget_pointer()

static IDropTarget * get_droptarget_pointer ( HWND  hwnd)
static

Definition at line 536 of file ole2.c.

537{
538 IDropTarget *droptarget = NULL;
539 HANDLE map;
541
543 if(!map) return NULL;
544
546 {
547 CoUnmarshalInterface(stream, &IID_IDropTarget, (void**)&droptarget);
548 IStream_Release(stream);
549 }
551 return droptarget;
552}
HRESULT WINAPI CoUnmarshalInterface(IStream *pStream, REFIID riid, LPVOID *ppv)
Definition: marshal.c:1981
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:363
static HANDLE get_droptarget_local_handle(HWND hwnd)
Definition: ole2.c:308

Referenced by drag_enter().

◆ get_target_from_wrapper()

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

Definition at line 435 of file ole2.c.

436{
439 if (!*target) return DRAGDROP_E_NOTREGISTERED;
440 IDropTarget_AddRef( *target );
441 return S_OK;
442}
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:116
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:2652

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

◆ give_feedback()

static HRESULT give_feedback ( TrackerWindowInfo info)
static

Definition at line 2372 of file ole2.c.

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

Referenced by OLEDD_TrackStateChange().

◆ impl_from_IDropTarget()

static DropTargetWrapper * impl_from_IDropTarget ( IDropTarget iface)
inlinestatic

Definition at line 400 of file ole2.c.

401{
402 return CONTAINING_RECORD(iface, DropTargetWrapper, IDropTarget_iface);
403}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

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

◆ impl_from_IEnumOLEVERB()

static EnumOLEVERB * impl_from_IEnumOLEVERB ( IEnumOLEVERB iface)
inlinestatic

Definition at line 919 of file ole2.c.

920{
921 return CONTAINING_RECORD(iface, EnumOLEVERB, IEnumOLEVERB_iface);
922}

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

◆ is_droptarget()

static BOOL is_droptarget ( HWND  hwnd)
inlinestatic

Definition at line 291 of file ole2.c.

292{
293 return get_droptarget_handle(hwnd) != 0;
294}

Referenced by drag_enter(), and RegisterDragDrop().

◆ IsAccelerator()

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

Definition at line 1949 of file ole2.c.

1950{
1951 LPACCEL lpAccelTbl;
1952 int i;
1953
1954 if(!lpMsg) return FALSE;
1955 if (!hAccel)
1956 {
1957 WARN_(accel)("NULL accel handle\n");
1958 return FALSE;
1959 }
1960 if((lpMsg->message != WM_KEYDOWN &&
1961 lpMsg->message != WM_SYSKEYDOWN &&
1962 lpMsg->message != WM_SYSCHAR &&
1963 lpMsg->message != WM_CHAR)) return FALSE;
1964 lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL));
1965 if (NULL == lpAccelTbl)
1966 {
1967 return FALSE;
1968 }
1969 if (CopyAcceleratorTableW(hAccel, lpAccelTbl, cAccelEntries) != cAccelEntries)
1970 {
1971 WARN_(accel)("CopyAcceleratorTableW failed\n");
1972 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
1973 return FALSE;
1974 }
1975
1976 TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
1977 "msg->hwnd=%p, msg->message=%04x, wParam=%08lx, lParam=%08lx\n",
1978 hAccel, cAccelEntries,
1979 lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1980 for(i = 0; i < cAccelEntries; i++)
1981 {
1982 if(lpAccelTbl[i].key != lpMsg->wParam)
1983 continue;
1984
1985 if(lpMsg->message == WM_CHAR)
1986 {
1987 if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
1988 {
1989 TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", LOWORD(lpMsg->wParam) & 0xff);
1990 goto found;
1991 }
1992 }
1993 else
1994 {
1995 if(lpAccelTbl[i].fVirt & FVIRTKEY)
1996 {
1997 INT mask = 0;
1998 TRACE_(accel)("found accel for virt_key %04lx (scan %04x)\n",
1999 lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
2000 if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
2001 if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
2002 if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
2003 if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
2004 TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
2005 }
2006 else
2007 {
2008 if(!(lpMsg->lParam & 0x01000000)) /* no special_key */
2009 {
2010 if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
2011 { /* ^^ ALT pressed */
2012 TRACE_(accel)("found accel for Alt-%c\n", LOWORD(lpMsg->wParam) & 0xff);
2013 goto found;
2014 }
2015 }
2016 }
2017 }
2018 }
2019
2020 WARN_(accel)("couldn't translate accelerator key\n");
2021 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2022 return FALSE;
2023
2024found:
2025 if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
2026 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2027 return TRUE;
2028}
#define TRACE_(x)
Definition: compat.h:76
GLenum GLint GLuint mask
Definition: glext.h:6028
HACCEL hAccel
Definition: main.c:47
#define LOWORD(l)
Definition: pedump.c:82
#define WARN_(ch,...)
Definition: debug.h:157
Definition: copy.c:22
WORD cmd
Definition: winuser.h:2925
BYTE fVirt
Definition: winuser.h:2923
UINT message
Definition: winuser.h:3115
HWND hwnd
Definition: winuser.h:3114
WPARAM wParam
Definition: winuser.h:3116
LPARAM lParam
Definition: winuser.h:3117
int32_t INT
Definition: typedefs.h:58
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI CopyAcceleratorTableW(_In_ HACCEL hAccelSrc, _Out_writes_to_opt_(cAccelEntries, return) LPACCEL lpAccelDst, _In_ int cAccelEntries)
#define VK_CONTROL
Definition: winuser.h:2203
#define FVIRTKEY
Definition: winuser.h:24
#define FSHIFT
Definition: winuser.h:23
#define WM_SYSCHAR
Definition: winuser.h:1721
#define FCONTROL
Definition: winuser.h:21
#define WM_CHAR
Definition: winuser.h:1717
#define VK_SHIFT
Definition: winuser.h:2202
#define FALT
Definition: winuser.h:20
#define WM_SYSKEYDOWN
Definition: winuser.h:1719
SHORT WINAPI GetKeyState(_In_ int)
#define VK_MENU
Definition: winuser.h:2204

Referenced by OleTranslateAccelerator().

◆ OLE_FreeClipDataArray()

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

Definition at line 2852 of file ole2.c.

2853{
2854 ULONG i;
2855 for (i = 0; i < count; i++)
2856 CoTaskMemFree(pClipDataArray[i].pClipData);
2857}
GLuint GLuint GLsizei count
Definition: gl.h:1545

Referenced by PropVariantClear().

◆ OleBuildVersion()

DWORD WINAPI OleBuildVersion ( void  )

Definition at line 160 of file ole2.c.

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

◆ 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
1808 {
1809 GlobalFree(h);
1810 HeapFree(GetProcessHeap(), 0, clipbrd);
1811 return;
1812 }
1813
1814 theOleClipboard = clipbrd;
1815 }
1816}
static void register_clipboard_formats(void)
Definition: clipboard.c:1744
static ole_clipbrd * theOleClipboard
Definition: clipboard.c:175
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
HWND window
Definition: clipboard.c:153
snapshot * latest_snapshot
Definition: clipboard.c:151
IStream * marshal_data
Definition: clipboard.c:156
ole_priv_data * cached_enum
Definition: clipboard.c:155
IDataObject * src_data
Definition: clipboard.c:154
#define GMEM_DDESHARE
Definition: winbase.h:298

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};
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}
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
static HRESULT set_src_dataobject(ole_clipbrd *clipbrd, IDataObject *data)
Definition: clipboard.c:1989
static const WCHAR clipbrd_wndclass[]
Definition: clipboard.c:201
static HINSTANCE hinst
Definition: edit.c:551
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)

Referenced by OleUninitialize().

◆ OleCreate()

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

Definition at line 2609 of file ole2.c.

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

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

◆ OleCreateMenuDescriptor()

HOLEMENU WINAPI OleCreateMenuDescriptor ( HMENU  hmenuCombined,
LPOLEMENUGROUPWIDTHS  lpMenuWidths 
)

Definition at line 1812 of file ole2.c.

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

◆ OLEDD_DragTrackerWindowProc()

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

Definition at line 2150 of file ole2.c.

2155{
2156 switch (uMsg)
2157 {
2158 case WM_CREATE:
2159 {
2160 LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
2161
2162 SetWindowLongPtrW(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams);
2164
2165 break;
2166 }
2167 case WM_TIMER:
2168 case WM_MOUSEMOVE:
2169 case WM_LBUTTONUP:
2170 case WM_MBUTTONUP:
2171 case WM_RBUTTONUP:
2172 case WM_LBUTTONDOWN:
2173 case WM_MBUTTONDOWN:
2174 case WM_RBUTTONDOWN:
2175 {
2177 if (trackerInfo->trackingDone) break;
2178 OLEDD_TrackStateChange(trackerInfo);
2179 break;
2180 }
2181 case WM_DESTROY:
2182 {
2184 break;
2185 }
2186 }
2187
2188 /*
2189 * This is a window proc after all. Let's call the default.
2190 */
2191 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2192}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define DRAG_TIMER_ID
Definition: ole2.c:2148
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LPVOID lpCreateParams
Definition: winuser.h:2940
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1608
struct tagCREATESTRUCTA * LPCREATESTRUCTA
#define WM_RBUTTONUP
Definition: winuser.h:1780
#define WM_MOUSEMOVE
Definition: winuser.h:1775
#define GetWindowLongPtrA
Definition: winuser.h:4828
#define WM_LBUTTONDOWN
Definition: winuser.h:1776
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1779
#define WM_TIMER
Definition: winuser.h:1742
#define WM_LBUTTONUP
Definition: winuser.h:1777
#define WM_DESTROY
Definition: winuser.h:1609
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define SetWindowLongPtrW
Definition: winuser.h:5355
#define WM_MBUTTONUP
Definition: winuser.h:1783
#define WM_MBUTTONDOWN
Definition: winuser.h:1782

Referenced by OLEDD_Initialize().

◆ OLEDD_GetButtonState()

static DWORD OLEDD_GetButtonState ( void  )
static

Definition at line 2484 of file ole2.c.

2485{
2486 BYTE keyboardState[256];
2487 DWORD keyMask = 0;
2488
2489 GetKeyboardState(keyboardState);
2490
2491 if ( (keyboardState[VK_SHIFT] & 0x80) !=0)
2492 keyMask |= MK_SHIFT;
2493
2494 if ( (keyboardState[VK_CONTROL] & 0x80) !=0)
2495 keyMask |= MK_CONTROL;
2496
2497 if ( (keyboardState[VK_MENU] & 0x80) !=0)
2498 keyMask |= MK_ALT;
2499
2500 if ( (keyboardState[VK_LBUTTON] & 0x80) !=0)
2501 keyMask |= MK_LBUTTON;
2502
2503 if ( (keyboardState[VK_RBUTTON] & 0x80) !=0)
2504 keyMask |= MK_RBUTTON;
2505
2506 if ( (keyboardState[VK_MBUTTON] & 0x80) !=0)
2507 keyMask |= MK_MBUTTON;
2508
2509 return keyMask;
2510}
#define MK_RBUTTON
Definition: winuser.h:2368
#define MK_SHIFT
Definition: winuser.h:2369
#define VK_RBUTTON
Definition: winuser.h:2191
#define VK_MBUTTON
Definition: winuser.h:2193
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define MK_MBUTTON
Definition: winuser.h:2371
#define MK_CONTROL
Definition: winuser.h:2370
#define MK_LBUTTON
Definition: winuser.h:2367
#define VK_LBUTTON
Definition: winuser.h:2190
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DoDragDrop().

◆ OLEDD_Initialize()

static void OLEDD_Initialize ( void  )
static

Definition at line 2123 of file ole2.c.

2124{
2125 WNDCLASSW wndClass;
2126
2127 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2128 wndClass.style = CS_GLOBALCLASS;
2130 wndClass.cbClsExtra = 0;
2131 wndClass.cbWndExtra = sizeof(TrackerWindowInfo*);
2132 wndClass.hCursor = 0;
2133 wndClass.hbrBackground = 0;
2135
2136 RegisterClassW (&wndClass);
2137}
static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:2150
LPCWSTR lpszClassName
Definition: winuser.h:3185
HBRUSH hbrBackground
Definition: winuser.h:3183
int cbClsExtra
Definition: winuser.h:3178
UINT style
Definition: winuser.h:3176
WNDPROC lpfnWndProc
Definition: winuser.h:3177
int cbWndExtra
Definition: winuser.h:3179
HCURSOR hCursor
Definition: winuser.h:3182
#define ZeroMemory
Definition: winbase.h:1712
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define CS_GLOBALCLASS
Definition: winuser.h:652

Referenced by OleInitialize().

◆ OLEDD_TrackStateChange()

static void OLEDD_TrackStateChange ( TrackerWindowInfo trackerInfo)
static

Definition at line 2416 of file ole2.c.

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

Referenced by DoDragDrop(), and OLEDD_DragTrackerWindowProc().

◆ OleDestroyMenuDescriptor()

HRESULT WINAPI OleDestroyMenuDescriptor ( HOLEMENU  hmenuDescriptor)

Definition at line 1847 of file ole2.c.

1849{
1850 if ( hmenuDescriptor )
1851 GlobalFree( hmenuDescriptor );
1852 return S_OK;
1853}

◆ OleDoAutoConvert()

HRESULT WINAPI OleDoAutoConvert ( LPSTORAGE  pStg,
LPCLSID  pClsidNew 
)

Definition at line 2758 of file ole2.c.

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

Referenced by test_OleDoAutoConvert().

◆ OleDraw()

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

Definition at line 2565 of file ole2.c.

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

Referenced by test_OleDraw(), and test_OleLoad().

◆ OleGetAutoConvert()

HRESULT WINAPI OleGetAutoConvert ( REFCLSID  clsidOld,
LPCLSID  pClsidNew 
)

Definition at line 2704 of file ole2.c.

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

Referenced by OleDoAutoConvert(), and test_OleDoAutoConvert().

◆ OleInitialize()

HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize ( LPVOID  reserved)

Definition at line 169 of file ole2.c.

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

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

◆ OleInitializeWOW()

HRESULT WINAPI OleInitializeWOW ( DWORD  x,
DWORD  y 
)

Definition at line 269 of file ole2.c.

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

◆ OleIsRunning()

BOOL WINAPI OleIsRunning ( LPOLEOBJECT  object)

Definition at line 2818 of file ole2.c.

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

Referenced by test_runnable().

◆ OleLoad()

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

Definition at line 1224 of file ole2.c.

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

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

◆ OleLockRunning()

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

Definition at line 1377 of file ole2.c.

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

Referenced by test_OleLockRunning().

◆ OLEMenu_CallWndProc()

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

Definition at line 1628 of file ole2.c.

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

Referenced by OLEMenu_InstallHooks().

◆ OLEMenu_FindMainMenuIndex()

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

Definition at line 1546 of file ole2.c.

1547{
1548 INT i, nItems;
1549
1551
1552 for (i = 0; i < nItems; i++)
1553 {
1554 HMENU hsubmenu;
1555
1556 /* Is the current item a submenu? */
1557 if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
1558 {
1559 /* If the handle is the same we're done */
1560 if ( hsubmenu == hPopupMenu )
1561 {
1562 if (pnPos)
1563 *pnPos = i;
1564 return TRUE;
1565 }
1566 /* Recursively search without updating pnPos */
1567 else if ( OLEMenu_FindMainMenuIndex( hsubmenu, hPopupMenu, NULL ) )
1568 {
1569 if (pnPos)
1570 *pnPos = i;
1571 return TRUE;
1572 }
1573 }
1574 }
1575
1576 return FALSE;
1577}
int nItems
Definition: appswitch.c:56
static BOOL OLEMenu_FindMainMenuIndex(HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos)
Definition: ole2.c:1546
HMENU hMainMenu
Definition: mplay32.c:25
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)

Referenced by OLEMenu_FindMainMenuIndex(), and OLEMenu_SetIsServerMenu().

◆ OLEMenu_GetMsgProc()

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

Definition at line 1733 of file ole2.c.

1734{
1735 LPMSG pMsg;
1736 HOLEMENU hOleMenu = 0;
1737 OleMenuDescriptor *pOleMenuDescriptor = NULL;
1738 OleMenuHookItem *pHookItem = NULL;
1739 WORD wCode;
1740
1741 TRACE("%i, %04lx, %08lx\n", code, wParam, lParam );
1742
1743 /* Check if we're being asked to process a messages */
1744 if ( HC_ACTION != code )
1745 goto NEXTHOOK;
1746
1747 /* Retrieve the current message being dispatched from lParam */
1748 pMsg = (LPMSG)lParam;
1749
1750 /* Check if the message is destined for a window we are interested in:
1751 * If the window has an OLEMenu property we may need to dispatch
1752 * the menu message to its active objects window instead. */
1753
1754 hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1755 if ( !hOleMenu )
1756 goto NEXTHOOK;
1757
1758 /* Process menu messages */
1759 switch( pMsg->message )
1760 {
1761 case WM_COMMAND:
1762 {
1763 wCode = HIWORD(pMsg->wParam); /* Get notification code */
1764 if ( wCode )
1765 goto NEXTHOOK; /* Not a menu message */
1766 break;
1767 }
1768 default:
1769 goto NEXTHOOK;
1770 }
1771
1772 /* Get the menu descriptor */
1773 pOleMenuDescriptor = GlobalLock( hOleMenu );
1774 if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1775 goto NEXTHOOK;
1776
1777 /* If the message was for the server dispatch it accordingly */
1778 if ( pOleMenuDescriptor->bIsServerItem )
1779 {
1780 /* Change the hWnd in the message to the active objects hWnd.
1781 * The message loop which reads this message will automatically
1782 * dispatch it to the embedded objects window. */
1783 pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
1784 }
1785
1786NEXTHOOK:
1787 if ( pOleMenuDescriptor )
1788 GlobalUnlock( hOleMenu );
1789
1790 /* Lookup the hook item for the current thread */
1791 if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1792 {
1793 /* This should never fail!! */
1794 WARN("could not retrieve hHook for current thread!\n" );
1795 return FALSE;
1796 }
1797
1798 /* Pass on the message to the next hooker */
1799 return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
1800}
HHOOK GetMsg_hHook
Definition: ole2.c:90
#define WM_COMMAND
Definition: winuser.h:1740
struct tagMSG * LPMSG

Referenced by OLEMenu_InstallHooks().

◆ OLEMenu_Initialize()

static void OLEMenu_Initialize ( void  )
static

Definition at line 1411 of file ole2.c.

1412{
1413}

Referenced by OleInitialize().

◆ OLEMenu_InstallHooks()

static BOOL OLEMenu_InstallHooks ( DWORD  tid)
static

Definition at line 1431 of file ole2.c.

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

Referenced by OleSetMenuDescriptor().

◆ OLEMenu_IsHookInstalled()

static OleMenuHookItem * OLEMenu_IsHookInstalled ( DWORD  tid)
static

Definition at line 1523 of file ole2.c.

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

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

◆ OLEMenu_SetIsServerMenu()

static BOOL OLEMenu_SetIsServerMenu ( HMENU  hmenu,
OleMenuDescriptor pOleMenuDescriptor 
)
static

Definition at line 1589 of file ole2.c.

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

Referenced by OLEMenu_CallWndProc().

◆ OLEMenu_UnInitialize()

static void OLEMenu_UnInitialize ( void  )
static

Definition at line 1420 of file ole2.c.

1421{
1422}

Referenced by OleUninitialize().

◆ OLEMenu_UnInstallHooks()

static BOOL OLEMenu_UnInstallHooks ( DWORD  tid)
static

Definition at line 1481 of file ole2.c.

1482{
1483 OleMenuHookItem *pHookItem = NULL;
1484 OleMenuHookItem **ppHook = &hook_list;
1485
1486 while (*ppHook)
1487 {
1488 if ((*ppHook)->tid == tid)
1489 {
1490 pHookItem = *ppHook;
1491 *ppHook = pHookItem->next;
1492 break;
1493 }
1494 ppHook = &(*ppHook)->next;
1495 }
1496 if (!pHookItem) return FALSE;
1497
1498 /* Uninstall the hooks installed for this thread */
1499 if ( !UnhookWindowsHookEx( pHookItem->GetMsg_hHook ) )
1500 goto CLEANUP;
1501 if ( !UnhookWindowsHookEx( pHookItem->CallWndProc_hHook ) )
1502 goto CLEANUP;
1503
1504 /* Release the hook table entry */
1505 HeapFree(pHookItem->hHeap, 0, pHookItem );
1506
1507 return TRUE;
1508
1509CLEANUP:
1510 /* Release the hook table entry */
1511 HeapFree(pHookItem->hHeap, 0, pHookItem );
1512
1513 return FALSE;
1514}

Referenced by OleSetMenuDescriptor().

◆ OleNoteObjectVisible()

HRESULT WINAPI OleNoteObjectVisible ( LPUNKNOWN  pUnknown,
BOOL  bVisible 
)

Definition at line 2839 of file ole2.c.

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

◆ OleQueryLinkFromData()

HRESULT WINAPI OleQueryLinkFromData ( IDataObject pSrcDataObject)

Definition at line 854 of file ole2.c.

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

◆ OleRegEnumVerbs()

HRESULT WINAPI OleRegEnumVerbs ( REFCLSID  clsid,
LPENUMOLEVERB *  ppenum 
)

Definition at line 1125 of file ole2.c.

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

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

◆ OleRegGetMiscStatus()

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

Definition at line 864 of file ole2.c.

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

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

◆ OleRegGetUserType()

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

Definition at line 678 of file ole2.c.

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

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

◆ OleRun()

HRESULT WINAPI DECLSPEC_HOTPATCH OleRun ( LPUNKNOWN  pUnknown)

Definition at line 1205 of file ole2.c.

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

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

◆ OleSave()

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

Definition at line 1338 of file ole2.c.

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

◆ OleSetAutoConvert()

HRESULT WINAPI OleSetAutoConvert ( REFCLSID  clsidOld,
REFCLSID  clsidNew 
)

Definition at line 2731 of file ole2.c.

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

Referenced by test_OleDoAutoConvert().

◆ OleSetContainedObject()

HRESULT WINAPI OleSetContainedObject ( LPUNKNOWN  pUnknown,
BOOL  fContained 
)

Definition at line 1168 of file ole2.c.

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

Referenced by InitWebBrowser().

◆ OleSetMenuDescriptor()

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

Definition at line 1875 of file ole2.c.

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

Referenced by test_ole_menu().

◆ OleTranslateAccelerator()

HRESULT WINAPI OleTranslateAccelerator ( LPOLEINPLACEFRAME  lpFrame,
LPOLEINPLACEFRAMEINFO  lpFrameInfo,
LPMSG  lpmsg 
)

Definition at line 2592 of file ole2.c.

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

◆ OleUninitialize()

void WINAPI DECLSPEC_HOTPATCH OleUninitialize ( void  )

Definition at line 230 of file ole2.c.

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

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

◆ OLEUTL_ReadRegistryDWORDValue()

static void OLEUTL_ReadRegistryDWORDValue ( HKEY  regKey,
DWORD pdwValue 
)
static

Definition at line 2526 of file ole2.c.

2529{
2530 WCHAR buffer[20];
2531 DWORD cbData = sizeof(buffer);
2532 DWORD dwKeyType;
2533 LONG lres;
2534
2535 lres = RegQueryValueExW(regKey,
2536 emptyW,
2537 NULL,
2538 &dwKeyType,
2539 (LPBYTE)buffer,
2540 &cbData);
2541
2542 if (lres==ERROR_SUCCESS)
2543 {
2544 switch (dwKeyType)
2545 {
2546 case REG_DWORD:
2547 *pdwValue = *(DWORD*)buffer;
2548 break;
2549 case REG_EXPAND_SZ:
2550 case REG_MULTI_SZ:
2551 case REG_SZ:
2552 *pdwValue = wcstoul(buffer, NULL, 10);
2553 break;
2554 }
2555 }
2556}
GLuint buffer
Definition: glext.h:5915
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by OleRegGetMiscStatus().

◆ PropSysAllocString()

BSTR WINAPI PropSysAllocString ( LPCOLESTR  str)

Definition at line 2864 of file ole2.c.

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

Referenced by PropVariantCopy().

◆ PropSysFreeString()

void WINAPI PropSysFreeString ( LPOLESTR  str)

Definition at line 2874 of file ole2.c.

2875{
2877}
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by PropVariantClear().

◆ PROPVARIANT_ValidateType()

static HRESULT PROPVARIANT_ValidateType ( VARTYPE  vt)
inlinestatic

Definition at line 2882 of file ole2.c.

2883{
2884 switch (vt)
2885 {
2886 case VT_EMPTY:
2887 case VT_NULL:
2888 case VT_I1:
2889 case VT_I2:
2890 case VT_I4:
2891 case VT_I8:
2892 case VT_R4:
2893 case VT_R8:
2894 case VT_CY:
2895 case VT_DATE:
2896 case VT_BSTR:
2897 case VT_ERROR:
2898 case VT_BOOL:
2899 case VT_DECIMAL:
2900 case VT_UI1:
2901 case VT_UI2:
2902 case VT_UI4:
2903 case VT_UI8:
2904 case VT_INT:
2905 case VT_UINT:
2906 case VT_LPSTR:
2907 case VT_LPWSTR:
2908 case VT_FILETIME:
2909 case VT_BLOB:
2910 case VT_DISPATCH:
2911 case VT_UNKNOWN:
2912 case VT_STREAM:
2913 case VT_STORAGE:
2914 case VT_STREAMED_OBJECT:
2915 case VT_STORED_OBJECT:
2916 case VT_BLOB_OBJECT:
2917 case VT_CF:
2918 case VT_CLSID:
2919 case VT_I1|VT_VECTOR:
2920 case VT_I2|VT_VECTOR:
2921 case VT_I4|VT_VECTOR:
2922 case VT_I8|VT_VECTOR:
2923 case VT_R4|VT_VECTOR:
2924 case VT_R8|VT_VECTOR:
2925 case VT_CY|VT_VECTOR:
2926 case VT_DATE|VT_VECTOR:
2927 case VT_BSTR|VT_VECTOR:
2928 case VT_ERROR|VT_VECTOR:
2929 case VT_BOOL|VT_VECTOR:
2930 case VT_VARIANT|VT_VECTOR:
2931 case VT_UI1|VT_VECTOR:
2932 case VT_UI2|VT_VECTOR:
2933 case VT_UI4|VT_VECTOR:
2934 case VT_UI8|VT_VECTOR:
2935 case VT_LPSTR|VT_VECTOR:
2936 case VT_LPWSTR|VT_VECTOR:
2938 case VT_CF|VT_VECTOR:
2939 case VT_CLSID|VT_VECTOR:
2940 case VT_ARRAY|VT_I1:
2941 case VT_ARRAY|VT_UI1:
2942 case VT_ARRAY|VT_I2:
2943 case VT_ARRAY|VT_UI2:
2944 case VT_ARRAY|VT_I4:
2945 case VT_ARRAY|VT_UI4:
2946 case VT_ARRAY|VT_INT:
2947 case VT_ARRAY|VT_UINT:
2948 case VT_ARRAY|VT_R4:
2949 case VT_ARRAY|VT_R8:
2950 case VT_ARRAY|VT_CY:
2951 case VT_ARRAY|VT_DATE:
2952 case VT_ARRAY|VT_BSTR:
2953 case VT_ARRAY|VT_BOOL:
2954 case VT_ARRAY|VT_DECIMAL:
2955 case VT_ARRAY|VT_DISPATCH:
2956 case VT_ARRAY|VT_UNKNOWN:
2957 case VT_ARRAY|VT_ERROR:
2958 case VT_ARRAY|VT_VARIANT:
2959 return S_OK;
2960 }
2961 WARN("Bad type %d\n", vt);
2963}
@ VT_BLOB
Definition: compat.h:2330
@ VT_UI8
Definition: compat.h:2315
@ VT_BLOB_OBJECT
Definition: compat.h:2335
@ VT_BSTR
Definition: compat.h:2303
@ VT_INT
Definition: compat.h:2316
@ VT_LPSTR
Definition: compat.h:2324
@ VT_R4
Definition: compat.h:2299
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_UI2
Definition: compat.h:2312
@ VT_DECIMAL
Definition: compat.h:2309
@ VT_ERROR
Definition: compat.h:2305
@ VT_CLSID
Definition: compat.h:2337
@ VT_STREAM
Definition: compat.h:2331
@ VT_ARRAY
Definition: compat.h:2341
@ VT_STORED_OBJECT
Definition: compat.h:2334
@ VT_LPWSTR
Definition: compat.h:2325
@ VT_R8
Definition: compat.h:2300
@ VT_CY
Definition: compat.h:2301
@ VT_VARIANT
Definition: compat.h:2307
@ VT_I8
Definition: compat.h:2314
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_CF
Definition: compat.h:2336
@ VT_STORAGE
Definition: compat.h:2332
@ VT_FILETIME
Definition: compat.h:2329
@ VT_DATE
Definition: compat.h:2302
@ VT_BOOL
Definition: compat.h:2306
@ VT_STREAMED_OBJECT
Definition: compat.h:2333
@ VT_I2
Definition: compat.h:2297
@ VT_UI4
Definition: compat.h:2313
@ VT_UINT
Definition: compat.h:2317
@ VT_EMPTY
Definition: compat.h:2295
@ VT_VECTOR
Definition: compat.h:2340
@ VT_DISPATCH
Definition: compat.h:2304
@ VT_UI1
Definition: compat.h:2311
static REFPROPVARIANT PROPVAR_CHANGE_FLAGS VARTYPE vt
Definition: suminfo.c:86
#define STG_E_INVALIDPARAMETER
Definition: winerror.h:2580

Referenced by PropVariantClear(), and PropVariantCopy().

◆ PropVariantClear()

HRESULT WINAPI PropVariantClear ( PROPVARIANT *  pvar)

Definition at line 2968 of file ole2.c.

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

Referenced by check_tiff_format(), compare_metadata(), destroy_format(), free_header(), FreePropVariantArray(), GdipGetAllPropertyItems(), GdipGetPropertyItem(), GdipGetPropertyItemSize(), GdipGetPropertySize(), get_bool_property(), get_next_reader(), get_property(), get_token(), get_ulong_by_index(), MetadataHandler_FreeItems(), MimeBody_GetProp(), MMDevice_Create(), MMDevice_GetPropValue(), mqr_GetMetadataByName(), on_mime_message_available(), PersistFile_Save(), png_metadata_reader(), PropertyStorage_PropertyDestroy(), PropertyStorage_ReadFromStream(), PropertyStorage_StorePropWithId(), PropertyStore_SetValue(), PropertyStore_SetValueAndState(), PropVariantCompareEx(), set_driver_prop_value(), test_BodyDeleteProp(), test_convert(), test_copy(), test_CreateMessage(), test_deviceinterface(), test_first_device(), test_InitPropVariantFromBuffer(), test_InitPropVariantFromCLSID(), test_intconversions(), test_MessageGetPropInfo(), test_MessageOptions(), test_MessageSetProp(), test_metadata_APE(), test_metadata_cHRM(), test_metadata_gAMA(), test_metadata_gif(), test_metadata_GIF_comment(), test_metadata_IFD(), test_metadata_tEXt(), test_metadata_unknown(), test_propertystore(), test_propertytovariant(), test_PropVariantChangeType_LPWSTR(), test_PropVariantToBuffer(), test_PropVariantToDouble(), test_PropVariantToGUID(), test_PropVariantToString(), test_PropVariantToStringAlloc(), test_queryreader(), test_validtypes(), testCodepage(), and testPropsHelper().

◆ PropVariantCopy()

HRESULT WINAPI PropVariantCopy ( PROPVARIANT *  pvarDest,
const PROPVARIANT *  pvarSrc 
)

Definition at line 3086 of file ole2.c.

3088{
3089 ULONG len;
3090 HRESULT hr;
3091
3092 TRACE("(%p, %p vt %04x)\n", pvarDest, pvarSrc, pvarSrc->vt);
3093
3094 hr = PROPVARIANT_ValidateType(pvarSrc->vt);
3095 if (FAILED(hr))
3096 return DISP_E_BADVARTYPE;
3097
3098 /* this will deal with most cases */
3099 *pvarDest = *pvarSrc;
3100
3101 switch(pvarSrc->vt)
3102 {
3103 case VT_EMPTY:
3104 case VT_NULL:
3105 case VT_I1:
3106 case VT_UI1:
3107 case VT_I2:
3108 case VT_UI2:
3109 case VT_BOOL:
3110 case VT_DECIMAL:
3111 case VT_I4:
3112 case VT_UI4:
3113 case VT_R4:
3114 case VT_ERROR:
3115 case VT_I8:
3116 case VT_UI8:
3117 case VT_INT:
3118 case VT_UINT:
3119 case VT_R8:
3120 case VT_CY:
3121 case VT_DATE:
3122 case VT_FILETIME:
3123 break;
3124 case VT_DISPATCH:
3125 case VT_UNKNOWN:
3126 case VT_STREAM:
3127 case VT_STREAMED_OBJECT:
3128 case VT_STORAGE:
3129 case VT_STORED_OBJECT:
3130 if (pvarDest->u.pStream)
3131 IStream_AddRef(pvarDest->u.pStream);
3132 break;
3133 case VT_CLSID:
3134 pvarDest->u.puuid = CoTaskMemAlloc(sizeof(CLSID));
3135 *pvarDest->u.puuid = *pvarSrc->u.puuid;
3136 break;
3137 case VT_LPSTR:
3138 if (pvarSrc->u.pszVal)
3139 {
3140 len = strlen(pvarSrc->u.pszVal);
3141 pvarDest->u.pszVal = CoTaskMemAlloc((len+1)*sizeof(CHAR));
3142 CopyMemory(pvarDest->u.pszVal, pvarSrc->u.pszVal, (len+1)*sizeof(CHAR));
3143 }
3144 break;
3145 case VT_LPWSTR:
3146 if (pvarSrc->u.pwszVal)
3147 {
3148 len = lstrlenW(pvarSrc->u.pwszVal);
3149 pvarDest->u.pwszVal = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
3150 CopyMemory(pvarDest->u.pwszVal, pvarSrc->u.pwszVal, (len+1)*sizeof(WCHAR));
3151 }
3152 break;
3153 case VT_BLOB:
3154 case VT_BLOB_OBJECT:
3155 if (pvarSrc->u.blob.pBlobData)
3156 {
3157 len = pvarSrc->u.blob.cbSize;
3158 pvarDest->u.blob.pBlobData = CoTaskMemAlloc(len);
3159 CopyMemory(pvarDest->u.blob.pBlobData, pvarSrc->u.blob.pBlobData, len);
3160 }
3161 break;
3162 case VT_BSTR:
3163 pvarDest->u.bstrVal = PropSysAllocString(pvarSrc->u.bstrVal);
3164 break;
3165 case VT_CF:
3166 if (pvarSrc->u.pclipdata)
3167 {
3168 len = pvarSrc->u.pclipdata->cbSize - sizeof(pvarSrc->u.pclipdata->ulClipFmt);
3169 pvarDest->u.pclipdata = CoTaskMemAlloc(sizeof (CLIPDATA));
3170 pvarDest->u.pclipdata->cbSize = pvarSrc->u.pclipdata->cbSize;
3171 pvarDest->u.pclipdata->ulClipFmt = pvarSrc->u.pclipdata->ulClipFmt;
3172 pvarDest->u.pclipdata->pClipData = CoTaskMemAlloc(len);
3173 CopyMemory(pvarDest->u.pclipdata->pClipData, pvarSrc->u.pclipdata->pClipData, len);
3174 }
3175 break;
3176 default:
3177 if (pvarSrc->vt & VT_VECTOR)
3178 {
3179 int elemSize;
3180 ULONG i;
3181
3182 switch(pvarSrc->vt & ~VT_VECTOR)
3183 {
3184 case VT_I1: elemSize = sizeof(pvarSrc->u.cVal); break;
3185 case VT_UI1: elemSize = sizeof(pvarSrc->u.bVal); break;
3186 case VT_I2: elemSize = sizeof(pvarSrc->u.iVal); break;
3187 case VT_UI2: elemSize = sizeof(pvarSrc->u.uiVal); break;
3188 case VT_BOOL: elemSize = sizeof(pvarSrc->u.boolVal); break;
3189 case VT_I4: elemSize = sizeof(pvarSrc->u.lVal); break;
3190 case VT_UI4: elemSize = sizeof(pvarSrc->u.ulVal); break;
3191 case VT_R4: elemSize = sizeof(pvarSrc->u.fltVal); break;
3192 case VT_R8: elemSize = sizeof(pvarSrc->u.dblVal); break;
3193 case VT_ERROR: elemSize = sizeof(pvarSrc->u.scode); break;
3194 case VT_I8: elemSize = sizeof(pvarSrc->u.hVal); break;
3195 case VT_UI8: elemSize = sizeof(pvarSrc->u.uhVal); break;
3196 case VT_CY: elemSize = sizeof(pvarSrc->u.cyVal); break;
3197 case VT_DATE: elemSize = sizeof(pvarSrc->u.date); break;
3198 case VT_FILETIME: elemSize = sizeof(pvarSrc->u.filetime); break;
3199 case VT_CLSID: elemSize = sizeof(*pvarSrc->u.puuid); break;
3200 case VT_CF: elemSize = sizeof(*pvarSrc->u.pclipdata); break;
3201 case VT_BSTR: elemSize = sizeof(pvarSrc->u.bstrVal); break;
3202 case VT_LPSTR: elemSize = sizeof(pvarSrc->u.pszVal); break;
3203 case VT_LPWSTR: elemSize = sizeof(pvarSrc->u.pwszVal); break;
3204 case VT_VARIANT: elemSize = sizeof(*pvarSrc->u.pvarVal); break;
3205
3206 default:
3207 FIXME("Invalid element type: %ul\n", pvarSrc->vt & ~VT_VECTOR);
3208 return E_INVALIDARG;
3209 }
3210 len = pvarSrc->u.capropvar.cElems;
3211 pvarDest->u.capropvar.pElems = len ? CoTaskMemAlloc(len * elemSize) : NULL;
3212 if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT))
3213 {
3214 for (i = 0; i < len; i++)
3215 PropVariantCopy(&pvarDest->u.capropvar.pElems[i], &pvarSrc->u.capropvar.pElems[i]);
3216 }
3217 else if (pvarSrc->vt == (VT_VECTOR | VT_CF))
3218 {
3219 FIXME("Copy clipformats\n");
3220 }
3221 else if (pvarSrc->vt == (VT_VECTOR | VT_BSTR))
3222 {
3223 for (i = 0; i < len; i++)
3224 pvarDest->u.cabstr.pElems[i] = PropSysAllocString(pvarSrc->u.cabstr.pElems[i]);
3225 }
3226 else if (pvarSrc->vt == (VT_VECTOR | VT_LPSTR))
3227 {
3228 size_t strLen;
3229 for (i = 0; i < len; i++)
3230 {
3231 strLen = lstrlenA(pvarSrc->u.calpstr.pElems[i]) + 1;
3232 pvarDest->u.calpstr.pElems[i] = CoTaskMemAlloc(strLen);
3233 memcpy(pvarDest->u.calpstr.pElems[i],
3234 pvarSrc->u.calpstr.pElems[i], strLen);
3235 }
3236 }
3237 else if (pvarSrc->vt == (VT_VECTOR | VT_LPWSTR))
3238 {
3239 size_t strLen;
3240 for (i = 0; i < len; i++)
3241 {
3242 strLen = (lstrlenW(pvarSrc->u.calpwstr.pElems[i]) + 1) *
3243 sizeof(WCHAR);
3244 pvarDest->u.calpstr.pElems[i] = CoTaskMemAlloc(strLen);
3245 memcpy(pvarDest->u.calpstr.pElems[i],
3246 pvarSrc->u.calpstr.pElems[i], strLen);
3247 }
3248 }
3249 else
3250 CopyMemory(pvarDest->u.capropvar.pElems, pvarSrc->u.capropvar.pElems, len * elemSize);
3251 }
3252 else if (pvarSrc->vt & VT_ARRAY)
3253 {
3254 pvarDest->u.uhVal.QuadPart = 0;
3255 return SafeArrayCopy(pvarSrc->u.parray, &pvarDest->u.parray);
3256 }
3257 else
3258 WARN("Invalid/unsupported type %d\n", pvarSrc->vt);
3259 }
3260
3261 return S_OK;
3262}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest, const PROPVARIANT *pvarSrc)
Definition: ole2.c:3086
BSTR WINAPI PropSysAllocString(LPCOLESTR str)
Definition: ole2.c:2864
HRESULT WINAPI SafeArrayCopy(SAFEARRAY *psa, SAFEARRAY **ppsaOut)
Definition: safearray.c:1379
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define CopyMemory
Definition: winbase.h:1710
#define DISP_E_BADVARTYPE
Definition: winerror.h:2517
char CHAR
Definition: xmlstorage.h:175

Referenced by IPropertyStorage_fnWriteMultiple(), MetadataHandler_GetValue(), MetadataHandler_GetValueByIndex(), MetadataHandlerEnum_Next(), MimeBody_SetProp(), PropertyStorage_PropVariantCopy(), PropertyStore_GetValue(), PropertyStore_GetValueAndState(), PropertyStore_SetValue(), PropertyStore_SetValueAndState(), PropVariantChangeType(), PropVariantCopy(), test_copy(), and test_validtypes().

◆ RegisterDragDrop()

HRESULT WINAPI RegisterDragDrop ( HWND  hwnd,
LPDROPTARGET  pDropTarget 
)

Definition at line 557 of file ole2.c.

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

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

◆ ReleaseStgMedium()

void WINAPI ReleaseStgMedium ( STGMEDIUM *  pmedium)

Definition at line 2033 of file ole2.c.

2035{
2036 switch (pmedium->tymed)
2037 {
2038 case TYMED_HGLOBAL:
2039 {
2040 if ( (pmedium->pUnkForRelease==0) &&
2041 (pmedium->u.hGlobal!=0) )
2042 GlobalFree(pmedium->u.hGlobal);
2043 break;
2044 }
2045 case TYMED_FILE:
2046 {
2047 if (pmedium->u.lpszFileName!=0)
2048 {
2049 if (pmedium->pUnkForRelease==0)
2050 {
2051 DeleteFileW(pmedium->u.lpszFileName);
2052 }
2053
2054 CoTaskMemFree(pmedium->u.lpszFileName);
2055 }
2056 break;
2057 }
2058 case TYMED_ISTREAM:
2059 {
2060 if (pmedium->u.pstm!=0)
2061 {
2062 IStream_Release(pmedium->u.pstm);
2063 }
2064 break;
2065 }
2066 case TYMED_ISTORAGE:
2067 {
2068 if (pmedium->u.pstg!=0)
2069 {
2070 IStorage_Release(pmedium->u.pstg);
2071 }
2072 break;
2073 }
2074 case TYMED_GDI:
2075 {
2076 if ( (pmedium->pUnkForRelease==0) &&
2077 (pmedium->u.hBitmap!=0) )
2078 DeleteObject(pmedium->u.hBitmap);
2079 break;
2080 }
2081 case TYMED_MFPICT:
2082 {
2083 if ( (pmedium->pUnkForRelease==0) &&
2084 (pmedium->u.hMetaFilePict!=0) )
2085 {
2086 LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hMetaFilePict);
2087 DeleteMetaFile(pMP->hMF);
2088 GlobalUnlock(pmedium->u.hMetaFilePict);
2089 GlobalFree(pmedium->u.hMetaFilePict);
2090 }
2091 break;
2092 }
2093 case TYMED_ENHMF:
2094 {
2095 if ( (pmedium->pUnkForRelease==0) &&
2096 (pmedium->u.hEnhMetaFile!=0) )
2097 {
2098 DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
2099 }
2100 break;
2101 }
2102 case TYMED_NULL:
2103 default:
2104 break;
2105 }
2106 pmedium->tymed=TYMED_NULL;
2107
2108 /*
2109 * After cleaning up, the unknown is released
2110 */
2111 if (pmedium->pUnkForRelease!=0)
2112 {
2113 IUnknown_Release(pmedium->pUnkForRelease);
2114 pmedium->pUnkForRelease = 0;
2115 }
2116}
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
pKey DeleteObject()
HMETAFILE hMF
Definition: wingdi.h:2608
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)

Referenced by CDefViewBckgrndMenu::_bCanPaste(), CRecyclerDropTarget::_DoDeleteDataObject(), CFSDropTarget::_DoDrop(), CopyBindInfo(), DataCache_UpdateCache(), DataCacheEntry_Destroy(), DataCacheEntry_DiscardData(), DataCacheEntry_SetData(), CFSDropTarget::DragEnter(), CSendToZip::Drop(), CExeDropHandler::Drop(), IDropTargetImpl::Drop(), get_data_from_bitmap(), get_data_from_enhmetafile(), get_data_from_global(), get_data_from_metafilepict(), get_data_from_storage(), get_data_from_stream(), IBindStatusCallback_OnDataAvailable_Stub(), CVfdShExt::Initialize(), CDrvDefExt::Initialize(), BtrfsContextMenu::Initialize(), BtrfsPropSheet::Initialize(), BtrfsVolPropSheet::Initialize(), CShellLink::Initialize(), CFileDefExt::Initialize(), CZipFolder::Initialize(), CLayerUIPropPage::Initialize(), InvokeObjectPickerDialog(), InvokeRemoteRegistryPickerDialog(), load_emf(), ME_DrawOLE(), ME_GetOLEObjectSize(), ok_attributes_(), OleCreateFromFileEx(), OleCreateStaticFromData(), paste_emf(), paste_rtf(), paste_text(), QueryDeskCplExtInterface(), QueryDeskCplString(), ReleaseBindInfo(), render_embed_source_hack(), CIDLDataObj::SetData(), snapshot_GetDataHere(), STGMEDIUM_UserFree(), stream_out_graphics(), test_complex_get_clipboard(), test_consumer_refs(), test_CopyStgMedium(), test_data_cache(), test_data_cache_cache(), test_data_cache_dib_contents_stream(), test_data_cache_save_data(), test_DataObject(), test_DataObject_FirstFile(), test_DataObject_FirstFolder(), test_EnumObjects_Files(), test_EnumObjects_Folders(), test_flushed_getdata(), test_get_clipboard(), test_getdatahere(), test_nonole_clipboard(), test_OleCreateStaticFromData(), TestDefaultFormat(), TestSetAndGetExtraFormat(), BtrfsContextMenu::~BtrfsContextMenu(), BtrfsPropSheet::~BtrfsPropSheet(), BtrfsVolPropSheet::~BtrfsVolPropSheet(), CIDLDataObj::~CIDLDataObj(), IDataObjectImpl::~IDataObjectImpl(), and PIDList::~PIDList().

◆ RevokeDragDrop()

HRESULT WINAPI RevokeDragDrop ( HWND  hwnd)

Definition at line 639 of file ole2.c.

640{
641 HANDLE map;
643 IDropTarget *drop_target;
644 HRESULT hr;
645
646 TRACE("(%p)\n", hwnd);
647
648 if (!IsWindow(hwnd))
649 {
650 ERR("invalid hwnd %p\n", hwnd);
652 }
653
654 /* no registration data */
657
658 drop_target = GetPropW(hwnd, prop_oledroptarget);
659 if(drop_target) IDropTarget_Release(drop_target);
660
663
665 if(SUCCEEDED(hr))
666 {
668 IStream_Release(stream);
669 }
671
672 return hr;
673}

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

◆ WINE_DECLARE_DEBUG_CHANNEL()

WINE_DECLARE_DEBUG_CHANNEL ( accel  )

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( ole  )

◆ WrapDropTarget()

static IDropTarget * WrapDropTarget ( HWND  hwnd)
static

Definition at line 518 of file ole2.c.

519{
521
522 if (This)
523 {
524 This->IDropTarget_iface.lpVtbl = &DropTargetWrapperVTbl;
525 This->hwnd = hwnd;
526 This->refs = 1;
527 }
528 return &This->IDropTarget_iface;
529}
static const IDropTargetVtbl DropTargetWrapperVTbl
Definition: ole2.c:507

Referenced by RegisterDragDrop().

Variable Documentation

◆ DropTargetWrapperVTbl

const IDropTargetVtbl DropTargetWrapperVTbl
static
Initial value:
=
{
}
static ULONG WINAPI DropTargetWrapper_Release(IDropTarget *iface)
Definition: ole2.c:427
static HRESULT WINAPI DropTargetWrapper_DragLeave(IDropTarget *iface)
Definition: ole2.c:477
static HRESULT WINAPI DropTargetWrapper_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:444
static HRESULT WINAPI DropTargetWrapper_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:461
static HRESULT WINAPI DropTargetWrapper_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:490
static ULONG WINAPI DropTargetWrapper_AddRef(IDropTarget *iface)
Definition: ole2.c:421
static HRESULT WINAPI DropTargetWrapper_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObject)
Definition: ole2.c:405

Definition at line 507 of file ole2.c.

Referenced by WrapDropTarget().

◆ emptyW

const WCHAR emptyW[] = { 0 }
static

Definition at line 123 of file ole2.c.

Referenced by OleRegGetUserType(), and OLEUTL_ReadRegistryDWORDValue().

◆ EnumOLEVERB_VTable

const IEnumOLEVERBVtbl EnumOLEVERB_VTable
static
Initial value:
=
{
}
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: ole2.c:924
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
Definition: ole2.c:938
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, LPOLEVERB rgelt, ULONG *pceltFetched)
Definition: ole2.c:960
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
Definition: ole2.c:946
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
Definition: ole2.c:1059
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: ole2.c:1070
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
Definition: ole2.c:1048

Definition at line 1082 of file ole2.c.

Referenced by EnumOLEVERB_Construct().

◆ hook_list

OleMenuHookItem* hook_list
static

Definition at line 95 of file ole2.c.

Referenced by OLEMenu_InstallHooks(), OLEMenu_IsHookInstalled(), and OLEMenu_UnInstallHooks().

◆ OLE_moduleLockCount

LONG OLE_moduleLockCount = 0
static

Definition at line 101 of file ole2.c.

Referenced by OleInitialize(), and OleUninitialize().

◆ OLEDD_DRAGTRACKERCLASS

const WCHAR OLEDD_DRAGTRACKERCLASS[]
static
Initial value:
=
{'W','i','n','e','D','r','a','g','D','r','o','p','T','r','a','c','k','e','r','3','2',0}

Definition at line 106 of file ole2.c.

Referenced by DoDragDrop(), and OLEDD_Initialize().

◆ prop_marshalleddroptarget

const WCHAR prop_marshalleddroptarget[]
static
Initial value:
=
{'W','i','n','e','M','a','r','s','h','a','l','l','e','d','D','r','o','p','T','a','r','g','e','t',0}

Definition at line 120 of file ole2.c.

Referenced by get_droptarget_handle(), RegisterDragDrop(), and RevokeDragDrop().

◆ prop_oledroptarget

const WCHAR prop_oledroptarget[]
static
Initial value:
=
{'O','l','e','D','r','o','p','T','a','r','g','e','t','I','n','t','e','r','f','a','c','e',0}

Definition at line 116 of file ole2.c.

Referenced by get_target_from_wrapper(), RegisterDragDrop(), and RevokeDragDrop().

◆ prop_olemenuW

const WCHAR prop_olemenuW[]
static
Initial value:
=
{'P','R','O','P','_','O','L','E','M','e','n','u','D','e','s','c','r','i','p','t','o','r',0}

Definition at line 112 of file ole2.c.

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