ReactOS 0.4.16-dev-2354-g16de117
ole2.c
Go to the documentation of this file.
1/*
2 * OLE2 library
3 *
4 * Copyright 1995 Martin von Loewis
5 * Copyright 1999 Francis Beaudet
6 * Copyright 1999 Noel Borthwick
7 * Copyright 1999, 2000 Marcus Meissner
8 * Copyright 1999-2000 Abey George
9 * Copyright 2005 Juan Lang
10 * Copyright 2011 Adam Martinson for CodeWeavers
11 *
12 * This library is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * This library is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
27#include <assert.h>
28#include <stdlib.h>
29#include <stdarg.h>
30#include <stdio.h>
31#include <string.h>
32
33#define COBJMACROS
34#include "windef.h"
35#include "winbase.h"
36#include "winerror.h"
37#include "wingdi.h"
38#include "winuser.h"
39#include "winnls.h"
40#include "winreg.h"
41#include "ole2.h"
42#include "ole2ver.h"
43
44#include "compobj_private.h"
45#include "olestd.h"
46#include "wine/list.h"
47
48#include "wine/debug.h"
49
52
53/******************************************************************************
54 * These are static/global variables and internal data structures that the
55 * OLE module uses to maintain its state.
56 */
58{
66
68 HWND curTargetHWND; /* window the mouse is hovering over */
70#ifdef __REACTOS__
71 HWND accepterHWND;
72#endif
73 POINTL curMousePos; /* current position of the mouse in screen coordinates */
74 DWORD dwKeyState; /* current state of the shift and ctrl keys and the mouse buttons */
76
77typedef struct tagOleMenuDescriptor /* OleMenuDescriptor */
78{
79 HWND hwndFrame; /* The containers frame window */
80 HWND hwndActiveObject; /* The active objects window */
81 OLEMENUGROUPWIDTHS mgw; /* OLE menu group widths for the shared menu */
82 HMENU hmenuCombined; /* The combined menu */
83 BOOL bIsServerItem; /* True if the currently open popup belongs to the server */
85
86typedef struct tagOleMenuHookItem /* OleMenu hook item in per thread hook list */
87{
88 DWORD tid; /* Thread Id */
89 HANDLE hHeap; /* Heap this is allocated from */
90 HHOOK GetMsg_hHook; /* message hook for WH_GETMESSAGE */
91 HHOOK CallWndProc_hHook; /* message hook for WH_CALLWNDPROC */
94
96
97/*
98 * This is the lock count on the OLE library. It is controlled by the
99 * OLEInitialize/OLEUninitialize methods.
100 */
102
103/*
104 * Name of our registered window class.
105 */
106static const WCHAR OLEDD_DRAGTRACKERCLASS[] = L"WineDragDropTracker32";
107
108/*
109 * Name of menu descriptor property.
110 */
111static const WCHAR prop_olemenuW[] = L"PROP_OLEMenuDescriptor";
112
113/* property to store IDropTarget pointer */
114static const WCHAR prop_oledroptarget[] = L"OleDropTargetInterface";
115
116/* property to store Marshalled IDropTarget pointer */
117static const WCHAR prop_marshalleddroptarget[] = L"WineMarshalledDropTarget";
118
119/******************************************************************************
120 * These are the prototypes of miscellaneous utility methods
121 */
122static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD* pdwValue);
123
124/******************************************************************************
125 * These are the prototypes of the utility methods used to manage a shared menu
126 */
127static void OLEMenu_Initialize(void);
128static void OLEMenu_UnInitialize(void);
132static BOOL OLEMenu_FindMainMenuIndex( HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos );
133static BOOL OLEMenu_SetIsServerMenu( HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor );
136
137/******************************************************************************
138 * This is a prototype of the OLE Clipboard uninitialization method (in clipboard.c)
139 */
140extern void clipbrd_uninitialize(void);
141
142/******************************************************************************
143 * These are the prototypes of the utility methods used for OLE Drag n Drop
144 */
145static void OLEDD_Initialize(void);
147static void OLEDD_TrackStateChange(TrackerWindowInfo* trackerInfo);
148static DWORD OLEDD_GetButtonState(void);
149
150/******************************************************************************
151 * OleBuildVersion [OLE32.@]
152 */
154{
155 TRACE("Returning version %d, build %d.\n", rmm, rup);
156 return (rmm<<16)+rup;
157}
158
159/***********************************************************************
160 * OleInitialize (OLE32.@)
161 */
163{
164 HRESULT hr;
165
166 TRACE("(%p)\n", reserved);
167
168 /*
169 * The first duty of the OleInitialize is to initialize the COM libraries.
170 */
172
173 /*
174 * If the CoInitializeEx call failed, the OLE libraries can't be
175 * initialized.
176 */
177 if (FAILED(hr))
178 return hr;
179
180 if (!COM_CurrentInfo()->ole_inits)
181 hr = S_OK;
182 else
183 hr = S_FALSE;
184
185 /*
186 * Then, it has to initialize the OLE specific modules.
187 * This includes:
188 * Clipboard
189 * Drag and Drop
190 * Object linking and Embedding
191 * In-place activation
192 */
193 if (!COM_CurrentInfo()->ole_inits++ &&
195 {
196 /*
197 * Initialize the libraries.
198 */
199 TRACE("() - Initializing the OLE libraries\n");
200
201 /*
202 * Drag and Drop
203 */
205
206 /*
207 * OLE shared menu
208 */
210 }
211
212 return hr;
213}
214
215/******************************************************************************
216 * OleUninitialize [OLE32.@]
217 */
219{
220 TRACE("()\n");
221
222 if (COM_CurrentInfo()->ole_inits == 0)
223 {
224 WARN("ole_inits is already 0\n");
225 return ;
226 }
227 /*
228 * If we hit the bottom of the lock stack, free the libraries.
229 */
231 {
232 /*
233 * Actually free the libraries.
234 */
235 TRACE("() - Freeing the last reference count\n");
236
237 /*
238 * OLE Clipboard
239 */
241
242 /*
243 * OLE shared menu
244 */
246 }
247
248 /*
249 * Then, uninitialize the COM libraries.
250 */
252}
253
254/******************************************************************************
255 * OleInitializeWOW [OLE32.@]
256 */
258{
259 FIXME("%#lx, %#lx stub!\n", x, y);
260 return 0;
261}
262
263/*************************************************************
264 * get_droptarget_handle
265 *
266 * Retrieve a handle to the map containing the marshalled IDropTarget.
267 * This handle belongs to the process that called RegisterDragDrop.
268 * See get_droptarget_local_handle().
269 */
271{
273}
274
275/*************************************************************
276 * is_droptarget
277 *
278 * Is the window a droptarget.
279 */
281{
282 return get_droptarget_handle(hwnd) != 0;
283}
284
285#ifdef __REACTOS__
286static inline BOOL is_acceptfiles(HWND hwnd)
287{
289}
290#endif
291
292/*************************************************************
293 * get_droptarget_local_handle
294 *
295 * Retrieve a handle to the map containing the marshalled IDropTarget.
296 * The handle should be closed when finished with.
297 */
299{
300 HANDLE handle, local_handle = 0;
301
303
304 if(handle)
305 {
306 DWORD pid;
308
311 if(process)
312 {
315 }
316 }
317 return local_handle;
318}
319
320/***********************************************************************
321 * create_map_from_stream
322 *
323 * Helper for RegisterDragDrop. Creates a file mapping object
324 * with the contents of the provided stream. The stream must
325 * be a global memory backed stream.
326 */
328{
329 HGLOBAL hmem;
330 DWORD size;
331 HRESULT hr;
332 void *data;
333
335 if(FAILED(hr)) return hr;
336
337 size = GlobalSize(hmem);
339 if(!*map) return E_OUTOFMEMORY;
340
342 memcpy(data, GlobalLock(hmem), size);
343 GlobalUnlock(hmem);
345 return S_OK;
346}
347
348/***********************************************************************
349 * create_stream_from_map
350 *
351 * Creates a stream from the provided map.
352 */
354{
356 HGLOBAL hmem;
357 void *data;
359
360 data = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
361 if(!data) return hr;
362
363 VirtualQuery(data, &info, sizeof(info));
364 TRACE("size %d\n", (int)info.RegionSize);
365
366 hmem = GlobalAlloc(GMEM_MOVEABLE, info.RegionSize);
367 if(hmem)
368 {
369 memcpy(GlobalLock(hmem), data, info.RegionSize);
370 GlobalUnlock(hmem);
372 }
374 return hr;
375}
376
377/* This is to work around apps which break COM rules by not implementing
378 * IDropTarget::QueryInterface(). Windows doesn't expose this because it
379 * doesn't call CoMarshallInterface() in RegisterDragDrop().
380 * The wrapper is only used internally, and only exists for the life of
381 * the marshal. We don't want to hold a ref on the app provided target
382 * as some apps destroy this prior to CoUninitialize without calling
383 * RevokeDragDrop. The only (long-term) ref is held by the window prop. */
384typedef struct {
389
391{
392 return CONTAINING_RECORD(iface, DropTargetWrapper, IDropTarget_iface);
393}
394
396 REFIID riid,
397 void** ppvObject)
398{
401 IsEqualIID(riid, &IID_IDropTarget))
402 {
403 IDropTarget_AddRef(&This->IDropTarget_iface);
404 *ppvObject = &This->IDropTarget_iface;
405 return S_OK;
406 }
407 *ppvObject = NULL;
408 return E_NOINTERFACE;
409}
410
412{
414 return InterlockedIncrement(&This->refs);
415}
416
418{
420 ULONG refs = InterlockedDecrement(&This->refs);
421 if (!refs) HeapFree(GetProcessHeap(), 0, This);
422 return refs;
423}
424
426{
429 if (!*target) return DRAGDROP_E_NOTREGISTERED;
430 IDropTarget_AddRef( *target );
431 return S_OK;
432}
433
435 IDataObject* pDataObj,
436 DWORD grfKeyState,
437 POINTL pt,
438 DWORD* pdwEffect)
439{
442
443 if (SUCCEEDED( r ))
444 {
445 r = IDropTarget_DragEnter( target, pDataObj, grfKeyState, pt, pdwEffect );
446 IDropTarget_Release( target );
447 }
448 return r;
449}
450
452 DWORD grfKeyState,
453 POINTL pt,
454 DWORD* pdwEffect)
455{
458
459 if (SUCCEEDED( r ))
460 {
461 r = IDropTarget_DragOver( target, grfKeyState, pt, pdwEffect );
462 IDropTarget_Release( target );
463 }
464 return r;
465}
466
468{
471
472 if (SUCCEEDED( r ))
473 {
474 r = IDropTarget_DragLeave( target );
475 IDropTarget_Release( target );
476 }
477 return r;
478}
479
481 IDataObject* pDataObj,
482 DWORD grfKeyState,
483 POINTL pt,
484 DWORD* pdwEffect)
485{
488
489 if (SUCCEEDED( r ))
490 {
491 r = IDropTarget_Drop( target, pDataObj, grfKeyState, pt, pdwEffect );
492 IDropTarget_Release( target );
493 }
494 return r;
495}
496
497static const IDropTargetVtbl DropTargetWrapperVTbl =
498{
506};
507
509{
511
512 if (This)
513 {
514 This->IDropTarget_iface.lpVtbl = &DropTargetWrapperVTbl;
515 This->hwnd = hwnd;
516 This->refs = 1;
517 }
518 return &This->IDropTarget_iface;
519}
520
521/***********************************************************************
522 * get_droptarget_pointer
523 *
524 * Retrieves the marshalled IDropTarget from the window.
525 */
527{
528 IDropTarget *droptarget = NULL;
529 HANDLE map;
531
533 if(!map) return NULL;
534
536 {
537 CoUnmarshalInterface(stream, &IID_IDropTarget, (void**)&droptarget);
538 IStream_Release(stream);
539 }
541 return droptarget;
542}
543
544/***********************************************************************
545 * RegisterDragDrop (OLE32.@)
546 */
547HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
548{
549 DWORD pid = 0;
550 HRESULT hr;
552 HANDLE map;
553 IDropTarget *wrapper;
554
555 TRACE("(%p,%p)\n", hwnd, pDropTarget);
556
557 if (!COM_CurrentApt())
558 {
559 ERR("COM not initialized\n");
560 return E_OUTOFMEMORY;
561 }
562
563 if (!pDropTarget)
564 return E_INVALIDARG;
565
566 if (!IsWindow(hwnd))
567 {
568 ERR("invalid hwnd %p\n", hwnd);
570 }
571
572 /* block register for other processes windows */
574 if (pid != GetCurrentProcessId())
575 {
576 FIXME("register for another process windows is disabled\n");
578 }
579
580 /* check if the window is already registered */
581 if (is_droptarget(hwnd))
583
584 /*
585 * Marshal the drop target pointer into a shared memory map and
586 * store the map's handle in a Wine specific window prop. We also
587 * store the drop target pointer itself in the
588 * "OleDropTargetInterface" prop for compatibility with Windows.
589 */
590
592 if(FAILED(hr)) return hr;
593
594 /* IDropTarget::QueryInterface() shouldn't be called, some (broken) apps depend on this. */
595 wrapper = WrapDropTarget( hwnd );
596 if(!wrapper)
597 {
598 IStream_Release(stream);
599 return E_OUTOFMEMORY;
600 }
601 hr = CoMarshalInterface(stream, &IID_IDropTarget, (IUnknown*)wrapper, MSHCTX_LOCAL, NULL, MSHLFLAGS_TABLESTRONG);
602 IDropTarget_Release(wrapper);
603
604 if(SUCCEEDED(hr))
605 {
607 if(SUCCEEDED(hr))
608 {
609 IDropTarget_AddRef(pDropTarget);
610 SetPropW(hwnd, prop_oledroptarget, pDropTarget);
612 }
613 else
614 {
616 zero.QuadPart = 0;
617 IStream_Seek(stream, zero, STREAM_SEEK_SET, NULL);
619 }
620 }
621 IStream_Release(stream);
622
623 return hr;
624}
625
626/***********************************************************************
627 * RevokeDragDrop (OLE32.@)
628 */
630{
631 HANDLE map;
633 IDropTarget *drop_target;
634 HRESULT hr;
635
636 TRACE("(%p)\n", hwnd);
637
638 if (!IsWindow(hwnd))
639 {
640 ERR("invalid hwnd %p\n", hwnd);
642 }
643
644 /* no registration data */
647
648 drop_target = GetPropW(hwnd, prop_oledroptarget);
649 if(drop_target) IDropTarget_Release(drop_target);
650
653
655 if(SUCCEEDED(hr))
656 {
658 IStream_Release(stream);
659 }
661
662 return hr;
663}
664
665/***********************************************************************
666 * OleRegGetUserType (OLE32.@)
667 */
669{
670 DWORD valuetype, valuelen;
671 WCHAR auxkeynameW[16];
672 HKEY usertypekey;
674 LONG ret;
675
676 TRACE("%s, %lu, %p.\n", debugstr_guid(clsid), form, usertype);
677
678 if (!usertype)
679 return E_INVALIDARG;
680
681 *usertype = NULL;
682
683 /* Return immediately if it's not registered. */
684 hres = COM_OpenKeyForCLSID(clsid, NULL, KEY_READ, &usertypekey);
685 if (FAILED(hres))
686 return hres;
687
688 valuelen = 0;
689
690 /* Try additional types if requested. If they don't exist fall back to USERCLASSTYPE_FULL. */
691 if (form != USERCLASSTYPE_FULL)
692 {
693 HKEY auxkey;
694
695 swprintf(auxkeynameW, ARRAY_SIZE(auxkeynameW), L"AuxUserType\\%d", form);
696 if (COM_OpenKeyForCLSID(clsid, auxkeynameW, KEY_READ, &auxkey) == S_OK)
697 {
698 if (!RegQueryValueExW(auxkey, L"", NULL, &valuetype, NULL, &valuelen) && valuelen)
699 {
700 RegCloseKey(usertypekey);
701 usertypekey = auxkey;
702 }
703 else
704 RegCloseKey(auxkey);
705 }
706 }
707
708 valuelen = 0;
709 if (RegQueryValueExW(usertypekey, L"", NULL, &valuetype, NULL, &valuelen))
710 {
711 RegCloseKey(usertypekey);
712 return REGDB_E_READREGDB;
713 }
714
715 *usertype = CoTaskMemAlloc(valuelen);
716 if (!*usertype)
717 {
718 RegCloseKey(usertypekey);
719 return E_OUTOFMEMORY;
720 }
721
722 ret = RegQueryValueExW(usertypekey, L"", NULL, &valuetype, (BYTE *)*usertype, &valuelen);
723 RegCloseKey(usertypekey);
724 if (ret != ERROR_SUCCESS)
725 {
726 CoTaskMemFree(*usertype);
727 *usertype = NULL;
728 return REGDB_E_READREGDB;
729 }
730
731 return S_OK;
732}
733
734/***********************************************************************
735 * DoDragDrop [OLE32.@]
736 */
738 IDataObject *pDataObject, /* [in] ptr to the data obj */
739 IDropSource* pDropSource, /* [in] ptr to the source obj */
740 DWORD dwOKEffect, /* [in] effects allowed by the source */
741 DWORD *pdwEffect) /* [out] ptr to effects of the source */
742{
743 TrackerWindowInfo trackerInfo;
744 HWND hwndTrackWindow;
745 MSG msg;
746
747 TRACE("%p, %p, %#lx, %p.\n", pDataObject, pDropSource, dwOKEffect, pdwEffect);
748
749 if (!pDataObject || !pDropSource || !pdwEffect)
750 return E_INVALIDARG;
751
752 /*
753 * Setup the drag n drop tracking window.
754 */
755
756 trackerInfo.dataObject = pDataObject;
757 trackerInfo.dropSource = pDropSource;
758 trackerInfo.dwOKEffect = dwOKEffect;
759 trackerInfo.pdwEffect = pdwEffect;
760 trackerInfo.trackingDone = FALSE;
761 trackerInfo.inTrackCall = FALSE;
762 trackerInfo.escPressed = FALSE;
763 trackerInfo.curTargetHWND = 0;
764 trackerInfo.curDragTarget = 0;
765#ifdef __REACTOS__
766 trackerInfo.accepterHWND = NULL;
767#endif
768
769 hwndTrackWindow = CreateWindowW(OLEDD_DRAGTRACKERCLASS, L"TrackerWindow",
772 &trackerInfo);
773
774 if (hwndTrackWindow)
775 {
776 /*
777 * Capture the mouse input
778 */
779 SetCapture(hwndTrackWindow);
780
781 msg.message = 0;
782
783 /*
784 * Pump messages. All mouse input should go to the capture window.
785 */
786 while (!trackerInfo.trackingDone && GetMessageW(&msg, 0, 0, 0) )
787 {
788 trackerInfo.curMousePos.x = msg.pt.x;
789 trackerInfo.curMousePos.y = msg.pt.y;
790 trackerInfo.dwKeyState = OLEDD_GetButtonState();
791
792 if ( (msg.message >= WM_KEYFIRST) &&
793 (msg.message <= WM_KEYLAST) )
794 {
795 /*
796 * When keyboard messages are sent to windows on this thread, we
797 * want to ignore notify the drop source that the state changed.
798 * in the case of the Escape key, we also notify the drop source
799 * we give it a special meaning.
800 */
801 if ( (msg.message==WM_KEYDOWN) &&
802 (msg.wParam==VK_ESCAPE) )
803 {
804 trackerInfo.escPressed = TRUE;
805 }
806
807 /*
808 * Notify the drop source.
809 */
810 OLEDD_TrackStateChange(&trackerInfo);
811 }
812 else
813 {
814 /*
815 * Dispatch the messages only when it's not a keyboard message.
816 */
818 }
819 }
820
821 /* re-post the quit message to outer message loop */
822 if (msg.message == WM_QUIT)
823 PostQuitMessage(msg.wParam);
824 /*
825 * Destroy the temporary window.
826 */
827 DestroyWindow(hwndTrackWindow);
828
829 return trackerInfo.returnValue;
830 }
831
832 return E_FAIL;
833}
834
835/***********************************************************************
836 * OleQueryLinkFromData [OLE32.@]
837 */
839 IDataObject* pSrcDataObject)
840{
841 FIXME("(%p),stub!\n", pSrcDataObject);
842 return S_FALSE;
843}
844
845/***********************************************************************
846 * OleRegGetMiscStatus [OLE32.@]
847 */
850 DWORD dwAspect,
851 DWORD* pdwStatus)
852{
853 WCHAR keyName[16];
854 HKEY miscStatusKey;
855 HKEY aspectKey;
856 LONG result;
857 HRESULT hr;
858
859 TRACE("%s, %ld, %p.\n", debugstr_guid(clsid), dwAspect, pdwStatus);
860
861 if (!pdwStatus) return E_INVALIDARG;
862
863 *pdwStatus = 0;
864
865 if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
866
867 hr = COM_OpenKeyForCLSID(clsid, L"MiscStatus", KEY_READ, &miscStatusKey);
868 if (FAILED(hr))
869 /* missing key is not a failure */
870 return hr == REGDB_E_KEYMISSING ? S_OK : hr;
871
872 OLEUTL_ReadRegistryDWORDValue(miscStatusKey, pdwStatus);
873
874 /*
875 * Open the key specific to the requested aspect.
876 */
877 swprintf(keyName, ARRAY_SIZE(keyName), L"%d", dwAspect);
878
879 result = open_classes_key(miscStatusKey, keyName, KEY_READ, &aspectKey);
880 if (result == ERROR_SUCCESS)
881 {
882 OLEUTL_ReadRegistryDWORDValue(aspectKey, pdwStatus);
883 RegCloseKey(aspectKey);
884 }
885
886 RegCloseKey(miscStatusKey);
887 return S_OK;
888}
889
890static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum);
891
892typedef struct
893{
894 IEnumOLEVERB IEnumOLEVERB_iface;
895 LONG ref;
896
900
902{
903 return CONTAINING_RECORD(iface, EnumOLEVERB, IEnumOLEVERB_iface);
904}
905
907 IEnumOLEVERB *iface, REFIID riid, void **ppv)
908{
909 TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
912 {
913 IEnumOLEVERB_AddRef(iface);
914 *ppv = iface;
915 return S_OK;
916 }
917 return E_NOINTERFACE;
918}
919
921 IEnumOLEVERB *iface)
922{
924 TRACE("()\n");
925 return InterlockedIncrement(&This->ref);
926}
927
929 IEnumOLEVERB *iface)
930{
932 LONG refs = InterlockedDecrement(&This->ref);
933 TRACE("()\n");
934 if (!refs)
935 {
936 RegCloseKey(This->hkeyVerb);
938 }
939 return refs;
940}
941
943 IEnumOLEVERB *iface, ULONG celt, LPOLEVERB rgelt,
944 ULONG *pceltFetched)
945{
947 HRESULT hr = S_OK;
948
949 TRACE("%p, %lu, %p, %p.\n", iface, celt, rgelt, pceltFetched);
950
951 if (pceltFetched)
952 *pceltFetched = 0;
953
954 for (; celt; celt--, rgelt++)
955 {
956 WCHAR wszSubKey[20];
957 LONG cbData;
958 LPWSTR pwszOLEVERB;
959 LPWSTR pwszMenuFlags;
960 LPWSTR pwszAttribs;
961 LONG res = RegEnumKeyW(This->hkeyVerb, This->index, wszSubKey, ARRAY_SIZE(wszSubKey));
963 {
964 hr = S_FALSE;
965 break;
966 }
967 else if (res != ERROR_SUCCESS)
968 {
969 ERR("RegEnumKeyW failed with error %ld\n", res);
971 break;
972 }
973 res = RegQueryValueW(This->hkeyVerb, wszSubKey, NULL, &cbData);
974 if (res != ERROR_SUCCESS)
975 {
976 ERR("RegQueryValueW failed with error %ld\n", res);
978 break;
979 }
980 pwszOLEVERB = CoTaskMemAlloc(cbData);
981 if (!pwszOLEVERB)
982 {
984 break;
985 }
986 res = RegQueryValueW(This->hkeyVerb, wszSubKey, pwszOLEVERB, &cbData);
987 if (res != ERROR_SUCCESS)
988 {
989 ERR("RegQueryValueW failed with error %ld\n", res);
991 CoTaskMemFree(pwszOLEVERB);
992 break;
993 }
994
995 TRACE("verb string: %s\n", debugstr_w(pwszOLEVERB));
996 pwszMenuFlags = wcschr(pwszOLEVERB, ',');
997 if (!pwszMenuFlags)
998 {
1000 CoTaskMemFree(pwszOLEVERB);
1001 break;
1002 }
1003 /* nul terminate the name string and advance to first character */
1004 *pwszMenuFlags = '\0';
1005 pwszMenuFlags++;
1006 pwszAttribs = wcschr(pwszMenuFlags, ',');
1007 if (!pwszAttribs)
1008 {
1010 CoTaskMemFree(pwszOLEVERB);
1011 break;
1012 }
1013 /* nul terminate the menu string and advance to first character */
1014 *pwszAttribs = '\0';
1015 pwszAttribs++;
1016
1017 /* fill out structure for this verb */
1018 rgelt->lVerb = wcstol(wszSubKey, NULL, 10);
1019 rgelt->lpszVerbName = pwszOLEVERB; /* user should free */
1020 rgelt->fuFlags = wcstol(pwszMenuFlags, NULL, 10);
1021 rgelt->grfAttribs = wcstol(pwszAttribs, NULL, 10);
1022
1023 if (pceltFetched)
1024 (*pceltFetched)++;
1025 This->index++;
1026 }
1027 return hr;
1028}
1029
1031 IEnumOLEVERB *iface, ULONG celt)
1032{
1034
1035 TRACE("%p, %lu.\n", iface, celt);
1036
1037 This->index += celt;
1038 return S_OK;
1039}
1040
1042 IEnumOLEVERB *iface)
1043{
1045
1046 TRACE("()\n");
1047
1048 This->index = 0;
1049 return S_OK;
1050}
1051
1053 IEnumOLEVERB *iface,
1054 IEnumOLEVERB **ppenum)
1055{
1057 HKEY hkeyVerb;
1058 TRACE("(%p)\n", ppenum);
1061 return EnumOLEVERB_Construct(hkeyVerb, This->index, ppenum);
1062}
1063
1064static const IEnumOLEVERBVtbl EnumOLEVERB_VTable =
1065{
1073};
1074
1076{
1077 EnumOLEVERB *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
1078 if (!This)
1079 {
1080 RegCloseKey(hkeyVerb);
1081 return E_OUTOFMEMORY;
1082 }
1083 This->IEnumOLEVERB_iface.lpVtbl = &EnumOLEVERB_VTable;
1084 This->ref = 1;
1085 This->index = index;
1086 This->hkeyVerb = hkeyVerb;
1087 *ppenum = &This->IEnumOLEVERB_iface;
1088 return S_OK;
1089}
1090
1091/***********************************************************************
1092 * OleRegEnumVerbs [OLE32.@]
1093 *
1094 * Enumerates verbs associated with a class stored in the registry.
1095 *
1096 * PARAMS
1097 * clsid [I] Class ID to enumerate the verbs for.
1098 * ppenum [O] Enumerator.
1099 *
1100 * RETURNS
1101 * S_OK: Success.
1102 * REGDB_E_CLASSNOTREG: The specified class does not have a key in the registry.
1103 * REGDB_E_READREGDB: The class key could not be opened for some other reason.
1104 * OLE_E_REGDB_KEY: The Verb subkey for the class is not present.
1105 * OLEOBJ_E_NOVERBS: The Verb subkey for the class is empty.
1106 */
1108{
1109 LONG res;
1110 HKEY hkeyVerb;
1111 DWORD dwSubKeys;
1112
1113 TRACE("(%s, %p)\n", debugstr_guid(clsid), ppenum);
1114
1115 res = COM_OpenKeyForCLSID(clsid, L"Verb", KEY_READ, &hkeyVerb);
1116 if (FAILED(res))
1117 {
1118 if (res == REGDB_E_CLASSNOTREG)
1119 ERR("CLSID %s not registered\n", debugstr_guid(clsid));
1120 else if (res == REGDB_E_KEYMISSING)
1121 ERR("no Verbs key for class %s\n", debugstr_guid(clsid));
1122 else
1123 ERR("failed to open Verbs key for CLSID %s with error %ld\n",
1125 return res;
1126 }
1127
1128 res = RegQueryInfoKeyW(hkeyVerb, NULL, NULL, NULL, &dwSubKeys, NULL,
1129 NULL, NULL, NULL, NULL, NULL, NULL);
1130 if (res != ERROR_SUCCESS)
1131 {
1132 ERR("failed to get subkey count with error %ld\n", GetLastError());
1133 return REGDB_E_READREGDB;
1134 }
1135
1136 if (!dwSubKeys)
1137 {
1138 WARN("class %s has no verbs\n", debugstr_guid(clsid));
1139 RegCloseKey(hkeyVerb);
1140 return OLEOBJ_E_NOVERBS;
1141 }
1142
1143 return EnumOLEVERB_Construct(hkeyVerb, 0, ppenum);
1144}
1145
1146/******************************************************************************
1147 * OleSetContainedObject [OLE32.@]
1148 */
1151 BOOL fContained)
1152{
1154 HRESULT hres;
1155
1156 TRACE("(%p,%x)\n", pUnknown, fContained);
1157
1158 hres = IUnknown_QueryInterface(pUnknown,
1160 (void**)&runnable);
1161
1162 if (SUCCEEDED(hres))
1163 {
1164 hres = IRunnableObject_SetContainedObject(runnable, fContained);
1165
1166 IRunnableObject_Release(runnable);
1167
1168 return hres;
1169 }
1170
1171 return S_OK;
1172}
1173
1174/******************************************************************************
1175 * OleRun [OLE32.@]
1176 *
1177 * Set the OLE object to the running state.
1178 *
1179 * PARAMS
1180 * pUnknown [I] OLE object to run.
1181 *
1182 * RETURNS
1183 * Success: S_OK.
1184 * Failure: Any HRESULT code.
1185 */
1187{
1188 IRunnableObject *runable;
1189 HRESULT hres;
1190
1191 TRACE("(%p)\n", pUnknown);
1192
1193 hres = IUnknown_QueryInterface(pUnknown, &IID_IRunnableObject, (void**)&runable);
1194 if (FAILED(hres))
1195 return S_OK; /* Appears to return no error. */
1196
1197 hres = IRunnableObject_Run(runable, NULL);
1198 IRunnableObject_Release(runable);
1199 return hres;
1200}
1201
1202/******************************************************************************
1203 * OleLoad [OLE32.@]
1204 */
1206 LPSTORAGE pStg,
1207 REFIID riid,
1208 LPOLECLIENTSITE pClientSite,
1209 LPVOID* ppvObj)
1210{
1211 IPersistStorage* persistStorage = NULL;
1212 IUnknown* pUnk;
1213 IOleObject* pOleObject = NULL;
1214 STATSTG storageInfo;
1215 HRESULT hres;
1216
1217 TRACE("(%p, %s, %p, %p)\n", pStg, debugstr_guid(riid), pClientSite, ppvObj);
1218
1219 *ppvObj = NULL;
1220
1221 /*
1222 * TODO, Conversion ... OleDoAutoConvert
1223 */
1224
1225 /*
1226 * Get the class ID for the object.
1227 */
1228 hres = IStorage_Stat(pStg, &storageInfo, STATFLAG_NONAME);
1229 if (FAILED(hres))
1230 return hres;
1231
1232 /*
1233 * Now, try and create the handler for the object
1234 */
1235 hres = CoCreateInstance(&storageInfo.clsid,
1236 NULL,
1237 CLSCTX_INPROC_HANDLER|CLSCTX_INPROC_SERVER,
1238 riid,
1239 (void**)&pUnk);
1240
1241 /*
1242 * If that fails, as it will most times, load the default
1243 * OLE handler.
1244 */
1245 if (FAILED(hres))
1246 {
1247 hres = OleCreateDefaultHandler(&storageInfo.clsid,
1248 NULL,
1249 riid,
1250 (void**)&pUnk);
1251 }
1252
1253 /*
1254 * If we couldn't find a handler... this is bad. Abort the whole thing.
1255 */
1256 if (FAILED(hres))
1257 return hres;
1258
1259 if (pClientSite)
1260 {
1261 hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (void **)&pOleObject);
1262 if (SUCCEEDED(hres))
1263 {
1265 hres = IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
1266 }
1267 }
1268
1269 /*
1270 * Initialize the object with its IPersistStorage interface.
1271 */
1272 hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (void**)&persistStorage);
1273 if (SUCCEEDED(hres))
1274 {
1275 hres = IPersistStorage_Load(persistStorage, pStg);
1276
1277 IPersistStorage_Release(persistStorage);
1278 persistStorage = NULL;
1279 }
1280
1281 if (SUCCEEDED(hres) && pClientSite)
1282 /*
1283 * Inform the new object of its client site.
1284 */
1285 hres = IOleObject_SetClientSite(pOleObject, pClientSite);
1286
1287 /*
1288 * Cleanup interfaces used internally
1289 */
1290 if (pOleObject)
1291 IOleObject_Release(pOleObject);
1292
1293 if (SUCCEEDED(hres))
1294 {
1295 IOleLink *pOleLink;
1296 HRESULT hres1;
1297 hres1 = IUnknown_QueryInterface(pUnk, &IID_IOleLink, (void **)&pOleLink);
1298 if (SUCCEEDED(hres1))
1299 {
1300 FIXME("handle OLE link\n");
1301 IOleLink_Release(pOleLink);
1302 }
1303 }
1304
1305 if (FAILED(hres))
1306 {
1307 IUnknown_Release(pUnk);
1308 pUnk = NULL;
1309 }
1310
1311 *ppvObj = pUnk;
1312
1313 return hres;
1314}
1315
1316/***********************************************************************
1317 * OleSave [OLE32.@]
1318 */
1320 LPPERSISTSTORAGE pPS,
1321 LPSTORAGE pStg,
1322 BOOL fSameAsLoad)
1323{
1324 HRESULT hres;
1325 CLSID objectClass;
1326
1327 TRACE("(%p,%p,%x)\n", pPS, pStg, fSameAsLoad);
1328
1329 /*
1330 * First, we transfer the class ID (if available)
1331 */
1332 hres = IPersistStorage_GetClassID(pPS, &objectClass);
1333
1334 if (SUCCEEDED(hres))
1335 {
1336 WriteClassStg(pStg, &objectClass);
1337 }
1338
1339 /*
1340 * Then, we ask the object to save itself to the
1341 * storage. If it is successful, we commit the storage.
1342 */
1343 hres = IPersistStorage_Save(pPS, pStg, fSameAsLoad);
1344
1345 if (SUCCEEDED(hres))
1346 {
1347 IStorage_Commit(pStg,
1348 STGC_DEFAULT);
1349 }
1350
1351 return hres;
1352}
1353
1354
1355/******************************************************************************
1356 * OleLockRunning [OLE32.@]
1357 */
1359{
1361 HRESULT hres;
1362
1363 TRACE("(%p,%x,%x)\n", pUnknown, fLock, fLastUnlockCloses);
1364
1365 hres = IUnknown_QueryInterface(pUnknown,
1367 (void**)&runnable);
1368
1369 if (SUCCEEDED(hres))
1370 {
1371 hres = IRunnableObject_LockRunning(runnable, fLock, fLastUnlockCloses);
1372
1373 IRunnableObject_Release(runnable);
1374
1375 return hres;
1376 }
1377
1378 return S_OK;
1379}
1380
1381
1382/**************************************************************************
1383 * Internal methods to manage the shared OLE menu in response to the
1384 * OLE***MenuDescriptor API
1385 */
1386
1387/***
1388 * OLEMenu_Initialize()
1389 *
1390 * Initializes the OLEMENU data structures.
1391 */
1392static void OLEMenu_Initialize(void)
1393{
1394}
1395
1396/***
1397 * OLEMenu_UnInitialize()
1398 *
1399 * Releases the OLEMENU data structures.
1400 */
1401static void OLEMenu_UnInitialize(void)
1402{
1403}
1404
1405/*************************************************************************
1406 * OLEMenu_InstallHooks
1407 * Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC
1408 *
1409 * RETURNS: TRUE if message hooks were successfully installed
1410 * FALSE on failure
1411 */
1413{
1414 OleMenuHookItem *pHookItem;
1415
1416 /* Create an entry for the hook table */
1417 if ( !(pHookItem = HeapAlloc(GetProcessHeap(), 0,
1418 sizeof(OleMenuHookItem)) ) )
1419 return FALSE;
1420
1421 pHookItem->tid = tid;
1422 pHookItem->hHeap = GetProcessHeap();
1423 pHookItem->CallWndProc_hHook = NULL;
1424
1425 /* Install a thread scope message hook for WH_GETMESSAGE */
1427 0, GetCurrentThreadId() );
1428 if ( !pHookItem->GetMsg_hHook )
1429 goto CLEANUP;
1430
1431 /* Install a thread scope message hook for WH_CALLWNDPROC */
1433 0, GetCurrentThreadId() );
1434 if ( !pHookItem->CallWndProc_hHook )
1435 goto CLEANUP;
1436
1437 /* Insert the hook table entry */
1438 pHookItem->next = hook_list;
1439 hook_list = pHookItem;
1440
1441 return TRUE;
1442
1443CLEANUP:
1444 /* Unhook any hooks */
1445 if ( pHookItem->GetMsg_hHook )
1446 UnhookWindowsHookEx( pHookItem->GetMsg_hHook );
1447 if ( pHookItem->CallWndProc_hHook )
1449 /* Release the hook table entry */
1450 HeapFree(pHookItem->hHeap, 0, pHookItem );
1451
1452 return FALSE;
1453}
1454
1455/*************************************************************************
1456 * OLEMenu_UnInstallHooks
1457 * UnInstall thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC
1458 *
1459 * RETURNS: TRUE if message hooks were successfully installed
1460 * FALSE on failure
1461 */
1463{
1464 OleMenuHookItem *pHookItem = NULL;
1465 OleMenuHookItem **ppHook = &hook_list;
1466
1467 while (*ppHook)
1468 {
1469 if ((*ppHook)->tid == tid)
1470 {
1471 pHookItem = *ppHook;
1472 *ppHook = pHookItem->next;
1473 break;
1474 }
1475 ppHook = &(*ppHook)->next;
1476 }
1477 if (!pHookItem) return FALSE;
1478
1479 /* Uninstall the hooks installed for this thread */
1480 if ( !UnhookWindowsHookEx( pHookItem->GetMsg_hHook ) )
1481 goto CLEANUP;
1482 if ( !UnhookWindowsHookEx( pHookItem->CallWndProc_hHook ) )
1483 goto CLEANUP;
1484
1485 /* Release the hook table entry */
1486 HeapFree(pHookItem->hHeap, 0, pHookItem );
1487
1488 return TRUE;
1489
1490CLEANUP:
1491 /* Release the hook table entry */
1492 HeapFree(pHookItem->hHeap, 0, pHookItem );
1493
1494 return FALSE;
1495}
1496
1497/*************************************************************************
1498 * OLEMenu_IsHookInstalled
1499 * Tests if OLEMenu hooks have been installed for a thread
1500 *
1501 * RETURNS: The pointer and index of the hook table entry for the tid
1502 * NULL and -1 for the index if no hooks were installed for this thread
1503 */
1505{
1506 OleMenuHookItem *pHookItem;
1507
1508 /* Do a simple linear search for an entry whose tid matches ours.
1509 * We really need a map but efficiency is not a concern here. */
1510 for (pHookItem = hook_list; pHookItem; pHookItem = pHookItem->next)
1511 {
1512 if ( tid == pHookItem->tid )
1513 return pHookItem;
1514 }
1515
1516 return NULL;
1517}
1518
1519/***********************************************************************
1520 * OLEMenu_FindMainMenuIndex
1521 *
1522 * Used by OLEMenu API to find the top level group a menu item belongs to.
1523 * On success pnPos contains the index of the item in the top level menu group
1524 *
1525 * RETURNS: TRUE if the ID was found, FALSE on failure
1526 */
1528{
1529 INT i, nItems;
1530
1532
1533 for (i = 0; i < nItems; i++)
1534 {
1535 HMENU hsubmenu;
1536
1537 /* Is the current item a submenu? */
1538 if ( (hsubmenu = GetSubMenu(hMainMenu, i)) )
1539 {
1540 /* If the handle is the same we're done */
1541 if ( hsubmenu == hPopupMenu )
1542 {
1543 if (pnPos)
1544 *pnPos = i;
1545 return TRUE;
1546 }
1547 /* Recursively search without updating pnPos */
1548 else if ( OLEMenu_FindMainMenuIndex( hsubmenu, hPopupMenu, NULL ) )
1549 {
1550 if (pnPos)
1551 *pnPos = i;
1552 return TRUE;
1553 }
1554 }
1555 }
1556
1557 return FALSE;
1558}
1559
1560/***********************************************************************
1561 * OLEMenu_SetIsServerMenu
1562 *
1563 * Checks whether a popup menu belongs to a shared menu group which is
1564 * owned by the server, and sets the menu descriptor state accordingly.
1565 * All menu messages from these groups should be routed to the server.
1566 *
1567 * RETURNS: TRUE if the popup menu is part of a server owned group
1568 * FALSE if the popup menu is part of a container owned group
1569 */
1571{
1572 UINT nPos = 0, nWidth, i;
1573
1574 pOleMenuDescriptor->bIsServerItem = FALSE;
1575
1576 /* Don't bother searching if the popup is the combined menu itself */
1577 if ( hmenu == pOleMenuDescriptor->hmenuCombined )
1578 return FALSE;
1579
1580 /* Find the menu item index in the shared OLE menu that this item belongs to */
1581 if ( !OLEMenu_FindMainMenuIndex( pOleMenuDescriptor->hmenuCombined, hmenu, &nPos ) )
1582 return FALSE;
1583
1584 /* The group widths array has counts for the number of elements
1585 * in the groups File, Edit, Container, Object, Window, Help.
1586 * The Edit, Object & Help groups belong to the server object
1587 * and the other three belong to the container.
1588 * Loop through the group widths and locate the group we are a member of.
1589 */
1590 for ( i = 0, nWidth = 0; i < 6; i++ )
1591 {
1592 nWidth += pOleMenuDescriptor->mgw.width[i];
1593 if ( nPos < nWidth )
1594 {
1595 /* Odd elements are server menu widths */
1596 pOleMenuDescriptor->bIsServerItem = i%2;
1597 break;
1598 }
1599 }
1600
1601 return pOleMenuDescriptor->bIsServerItem;
1602}
1603
1604/*************************************************************************
1605 * OLEMenu_CallWndProc
1606 * Thread scope WH_CALLWNDPROC hook proc filter function (callback)
1607 * This is invoked from a message hook installed in OleSetMenuDescriptor.
1608 */
1610{
1611 LPCWPSTRUCT pMsg;
1612 HOLEMENU hOleMenu = 0;
1613 OleMenuDescriptor *pOleMenuDescriptor = NULL;
1614 OleMenuHookItem *pHookItem = NULL;
1615 WORD fuFlags;
1616
1617 TRACE("%i, %#Ix, %#Ix.\n", code, wParam, lParam );
1618
1619 /* Check if we're being asked to process the message */
1620 if ( HC_ACTION != code )
1621 goto NEXTHOOK;
1622
1623 /* Retrieve the current message being dispatched from lParam */
1624 pMsg = (LPCWPSTRUCT)lParam;
1625
1626 /* Check if the message is destined for a window we are interested in:
1627 * If the window has an OLEMenu property we may need to dispatch
1628 * the menu message to its active objects window instead. */
1629
1630 hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1631 if ( !hOleMenu )
1632 goto NEXTHOOK;
1633
1634 /* Get the menu descriptor */
1635 pOleMenuDescriptor = GlobalLock( hOleMenu );
1636 if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1637 goto NEXTHOOK;
1638
1639 /* Process menu messages */
1640 switch( pMsg->message )
1641 {
1642 case WM_INITMENU:
1643 {
1644 /* Reset the menu descriptor state */
1645 pOleMenuDescriptor->bIsServerItem = FALSE;
1646
1647 /* Send this message to the server as well */
1648 SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1649 pMsg->message, pMsg->wParam, pMsg->lParam );
1650 goto NEXTHOOK;
1651 }
1652
1653 case WM_INITMENUPOPUP:
1654 {
1655 /* Save the state for whether this is a server owned menu */
1656 OLEMenu_SetIsServerMenu( (HMENU)pMsg->wParam, pOleMenuDescriptor );
1657 break;
1658 }
1659
1660 case WM_MENUSELECT:
1661 {
1662 fuFlags = HIWORD(pMsg->wParam); /* Get flags */
1663 if ( fuFlags & MF_SYSMENU )
1664 goto NEXTHOOK;
1665
1666 /* Save the state for whether this is a server owned popup menu */
1667 else if ( fuFlags & MF_POPUP )
1668 OLEMenu_SetIsServerMenu( (HMENU)pMsg->lParam, pOleMenuDescriptor );
1669
1670 break;
1671 }
1672
1673 case WM_DRAWITEM:
1674 {
1676 if ( pMsg->wParam != 0 || lpdis->CtlType != ODT_MENU )
1677 goto NEXTHOOK; /* Not a menu message */
1678
1679 break;
1680 }
1681
1682 default:
1683 goto NEXTHOOK;
1684 }
1685
1686 /* If the message was for the server dispatch it accordingly */
1687 if ( pOleMenuDescriptor->bIsServerItem )
1688 {
1689 SendMessageW( pOleMenuDescriptor->hwndActiveObject,
1690 pMsg->message, pMsg->wParam, pMsg->lParam );
1691 }
1692
1693NEXTHOOK:
1694 if ( pOleMenuDescriptor )
1695 GlobalUnlock( hOleMenu );
1696
1697 /* Lookup the hook item for the current thread */
1698 if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1699 {
1700 /* This should never fail!! */
1701 WARN("could not retrieve hHook for current thread!\n" );
1702 return 0;
1703 }
1704
1705 /* Pass on the message to the next hooker */
1706 return CallNextHookEx( pHookItem->CallWndProc_hHook, code, wParam, lParam );
1707}
1708
1709/*************************************************************************
1710 * OLEMenu_GetMsgProc
1711 * Thread scope WH_GETMESSAGE hook proc filter function (callback)
1712 * This is invoked from a message hook installed in OleSetMenuDescriptor.
1713 */
1715{
1716 LPMSG pMsg;
1717 HOLEMENU hOleMenu = 0;
1718 OleMenuDescriptor *pOleMenuDescriptor = NULL;
1719 OleMenuHookItem *pHookItem = NULL;
1720 WORD wCode;
1721
1722 TRACE("%i, %#Ix, %#Ix.\n", code, wParam, lParam );
1723
1724 /* Check if we're being asked to process a messages */
1725 if ( HC_ACTION != code )
1726 goto NEXTHOOK;
1727
1728 /* Retrieve the current message being dispatched from lParam */
1729 pMsg = (LPMSG)lParam;
1730
1731 /* Check if the message is destined for a window we are interested in:
1732 * If the window has an OLEMenu property we may need to dispatch
1733 * the menu message to its active objects window instead. */
1734
1735 hOleMenu = GetPropW( pMsg->hwnd, prop_olemenuW );
1736 if ( !hOleMenu )
1737 goto NEXTHOOK;
1738
1739 /* Process menu messages */
1740 switch( pMsg->message )
1741 {
1742 case WM_COMMAND:
1743 {
1744 wCode = HIWORD(pMsg->wParam); /* Get notification code */
1745 if ( wCode )
1746 goto NEXTHOOK; /* Not a menu message */
1747 break;
1748 }
1749 default:
1750 goto NEXTHOOK;
1751 }
1752
1753 /* Get the menu descriptor */
1754 pOleMenuDescriptor = GlobalLock( hOleMenu );
1755 if ( !pOleMenuDescriptor ) /* Bad descriptor! */
1756 goto NEXTHOOK;
1757
1758 /* If the message was for the server dispatch it accordingly */
1759 if ( pOleMenuDescriptor->bIsServerItem )
1760 {
1761 /* Change the hWnd in the message to the active objects hWnd.
1762 * The message loop which reads this message will automatically
1763 * dispatch it to the embedded objects window. */
1764 pMsg->hwnd = pOleMenuDescriptor->hwndActiveObject;
1765 }
1766
1767NEXTHOOK:
1768 if ( pOleMenuDescriptor )
1769 GlobalUnlock( hOleMenu );
1770
1771 /* Lookup the hook item for the current thread */
1772 if ( !( pHookItem = OLEMenu_IsHookInstalled( GetCurrentThreadId() ) ) )
1773 {
1774 /* This should never fail!! */
1775 WARN("could not retrieve hHook for current thread!\n" );
1776 return FALSE;
1777 }
1778
1779 /* Pass on the message to the next hooker */
1780 return CallNextHookEx( pHookItem->GetMsg_hHook, code, wParam, lParam );
1781}
1782
1783/***********************************************************************
1784 * OleCreateMenuDescriptor [OLE32.@]
1785 * Creates an OLE menu descriptor for OLE to use when dispatching
1786 * menu messages and commands.
1787 *
1788 * PARAMS:
1789 * hmenuCombined - Handle to the objects combined menu
1790 * lpMenuWidths - Pointer to array of 6 LONG's indicating menus per group
1791 *
1792 */
1794 HMENU hmenuCombined,
1795 LPOLEMENUGROUPWIDTHS lpMenuWidths)
1796{
1797 HOLEMENU hOleMenu;
1798 OleMenuDescriptor *pOleMenuDescriptor;
1799 int i;
1800
1801 if ( !hmenuCombined || !lpMenuWidths )
1802 return 0;
1803
1804 /* Create an OLE menu descriptor */
1805 if ( !(hOleMenu = GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT,
1806 sizeof(OleMenuDescriptor) ) ) )
1807 return 0;
1808
1809 pOleMenuDescriptor = GlobalLock( hOleMenu );
1810 if ( !pOleMenuDescriptor )
1811 return 0;
1812
1813 /* Initialize menu group widths and hmenu */
1814 for ( i = 0; i < 6; i++ )
1815 pOleMenuDescriptor->mgw.width[i] = lpMenuWidths->width[i];
1816
1817 pOleMenuDescriptor->hmenuCombined = hmenuCombined;
1818 pOleMenuDescriptor->bIsServerItem = FALSE;
1819 GlobalUnlock( hOleMenu );
1820
1821 return hOleMenu;
1822}
1823
1824/***********************************************************************
1825 * OleDestroyMenuDescriptor [OLE32.@]
1826 * Destroy the shared menu descriptor
1827 */
1829 HOLEMENU hmenuDescriptor)
1830{
1831 if ( hmenuDescriptor )
1832 GlobalFree( hmenuDescriptor );
1833 return S_OK;
1834}
1835
1836/***********************************************************************
1837 * OleSetMenuDescriptor [OLE32.@]
1838 * Installs or removes OLE dispatching code for the containers frame window.
1839 *
1840 * PARAMS
1841 * hOleMenu Handle to composite menu descriptor
1842 * hwndFrame Handle to containers frame window
1843 * hwndActiveObject Handle to objects in-place activation window
1844 * lpFrame Pointer to IOleInPlaceFrame on containers window
1845 * lpActiveObject Pointer to IOleInPlaceActiveObject on active in-place object
1846 *
1847 * RETURNS
1848 * S_OK - menu installed correctly
1849 * E_FAIL, E_INVALIDARG, E_UNEXPECTED - failure
1850 *
1851 * FIXME
1852 * The lpFrame and lpActiveObject parameters are currently ignored
1853 * OLE should install context sensitive help F1 filtering for the app when
1854 * these are non null.
1855 */
1857 HOLEMENU hOleMenu,
1858 HWND hwndFrame,
1859 HWND hwndActiveObject,
1860 LPOLEINPLACEFRAME lpFrame,
1861 LPOLEINPLACEACTIVEOBJECT lpActiveObject)
1862{
1863 OleMenuDescriptor *pOleMenuDescriptor = NULL;
1864
1865 /* Check args */
1866 if ( !hwndFrame || (hOleMenu && !hwndActiveObject) )
1867 return E_INVALIDARG;
1868
1869 if ( lpFrame || lpActiveObject )
1870 {
1871 FIXME("(%p, %p, %p, %p, %p), Context sensitive help filtering not implemented!\n",
1872 hOleMenu,
1873 hwndFrame,
1874 hwndActiveObject,
1875 lpFrame,
1876 lpActiveObject);
1877 }
1878
1879 /* Set up a message hook to intercept the containers frame window messages.
1880 * The message filter is responsible for dispatching menu messages from the
1881 * shared menu which are intended for the object.
1882 */
1883
1884 if ( hOleMenu ) /* Want to install dispatching code */
1885 {
1886 /* If OLEMenu hooks are already installed for this thread, fail
1887 * Note: This effectively means that OleSetMenuDescriptor cannot
1888 * be called twice in succession on the same frame window
1889 * without first calling it with a null hOleMenu to uninstall
1890 */
1892 return E_FAIL;
1893
1894 /* Get the menu descriptor */
1895 pOleMenuDescriptor = GlobalLock( hOleMenu );
1896 if ( !pOleMenuDescriptor )
1897 return E_UNEXPECTED;
1898
1899 /* Update the menu descriptor */
1900 pOleMenuDescriptor->hwndFrame = hwndFrame;
1901 pOleMenuDescriptor->hwndActiveObject = hwndActiveObject;
1902
1903 GlobalUnlock( hOleMenu );
1904 pOleMenuDescriptor = NULL;
1905
1906 /* Add a menu descriptor windows property to the frame window */
1907 SetPropW( hwndFrame, prop_olemenuW, hOleMenu );
1908
1909 /* Install thread scope message hooks for WH_GETMESSAGE and WH_CALLWNDPROC */
1911 return E_FAIL;
1912 }
1913 else /* Want to uninstall dispatching code */
1914 {
1915 /* Uninstall the hooks */
1917 return E_FAIL;
1918
1919 /* Remove the menu descriptor property from the frame window */
1920 RemovePropW( hwndFrame, prop_olemenuW );
1921 }
1922
1923 return S_OK;
1924}
1925
1926/******************************************************************************
1927 * IsAccelerator [OLE32.@]
1928 * Mostly copied from controls/menu.c TranslateAccelerator implementation
1929 */
1930BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD* lpwCmd)
1931{
1932 LPACCEL lpAccelTbl;
1933 int i;
1934
1935 if(!lpMsg) return FALSE;
1936 if (!hAccel)
1937 {
1938 WARN_(accel)("NULL accel handle\n");
1939 return FALSE;
1940 }
1941 if((lpMsg->message != WM_KEYDOWN &&
1942 lpMsg->message != WM_SYSKEYDOWN &&
1943 lpMsg->message != WM_SYSCHAR &&
1944 lpMsg->message != WM_CHAR)) return FALSE;
1945 lpAccelTbl = HeapAlloc(GetProcessHeap(), 0, cAccelEntries * sizeof(ACCEL));
1946 if (NULL == lpAccelTbl)
1947 {
1948 return FALSE;
1949 }
1950 if (CopyAcceleratorTableW(hAccel, lpAccelTbl, cAccelEntries) != cAccelEntries)
1951 {
1952 WARN_(accel)("CopyAcceleratorTableW failed\n");
1953 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
1954 return FALSE;
1955 }
1956
1957 TRACE_(accel)("hAccel=%p, cAccelEntries=%d,"
1958 "msg->hwnd=%p, msg->message=%04x, wParam=%#Ix, lParam=%#Ix\n",
1959 hAccel, cAccelEntries,
1960 lpMsg->hwnd, lpMsg->message, lpMsg->wParam, lpMsg->lParam);
1961 for(i = 0; i < cAccelEntries; i++)
1962 {
1963 if(lpAccelTbl[i].key != lpMsg->wParam)
1964 continue;
1965
1966 if(lpMsg->message == WM_CHAR)
1967 {
1968 if(!(lpAccelTbl[i].fVirt & FALT) && !(lpAccelTbl[i].fVirt & FVIRTKEY))
1969 {
1970 TRACE_(accel)("found accel for WM_CHAR: ('%c')\n", LOWORD(lpMsg->wParam) & 0xff);
1971 goto found;
1972 }
1973 }
1974 else
1975 {
1976 if(lpAccelTbl[i].fVirt & FVIRTKEY)
1977 {
1978 INT mask = 0;
1979 TRACE_(accel)("found accel for virt_key %Ix (scan %04x)\n",
1980 lpMsg->wParam, HIWORD(lpMsg->lParam) & 0xff);
1981 if(GetKeyState(VK_SHIFT) & 0x8000) mask |= FSHIFT;
1982 if(GetKeyState(VK_CONTROL) & 0x8000) mask |= FCONTROL;
1983 if(GetKeyState(VK_MENU) & 0x8000) mask |= FALT;
1984 if(mask == (lpAccelTbl[i].fVirt & (FSHIFT | FCONTROL | FALT))) goto found;
1985 TRACE_(accel)("incorrect SHIFT/CTRL/ALT-state\n");
1986 }
1987 else
1988 {
1989 if(!(lpMsg->lParam & 0x01000000)) /* no special_key */
1990 {
1991 if((lpAccelTbl[i].fVirt & FALT) && (lpMsg->lParam & 0x20000000))
1992 { /* ^^ ALT pressed */
1993 TRACE_(accel)("found accel for Alt-%c\n", LOWORD(lpMsg->wParam) & 0xff);
1994 goto found;
1995 }
1996 }
1997 }
1998 }
1999 }
2000
2001 WARN_(accel)("couldn't translate accelerator key\n");
2002 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2003 return FALSE;
2004
2005found:
2006 if(lpwCmd) *lpwCmd = lpAccelTbl[i].cmd;
2007 HeapFree(GetProcessHeap(), 0, lpAccelTbl);
2008 return TRUE;
2009}
2010
2011/***********************************************************************
2012 * ReleaseStgMedium [OLE32.@]
2013 */
2015 STGMEDIUM* pmedium)
2016{
2017 if (!pmedium) return;
2018
2019 switch (pmedium->tymed)
2020 {
2021 case TYMED_HGLOBAL:
2022 {
2023 if ( (pmedium->pUnkForRelease==0) &&
2024 (pmedium->hGlobal!=0) )
2025 GlobalFree(pmedium->hGlobal);
2026 break;
2027 }
2028 case TYMED_FILE:
2029 {
2030 if (pmedium->lpszFileName!=0)
2031 {
2032 if (pmedium->pUnkForRelease==0)
2033 {
2034 DeleteFileW(pmedium->lpszFileName);
2035 }
2036
2037 CoTaskMemFree(pmedium->lpszFileName);
2038 }
2039 break;
2040 }
2041 case TYMED_ISTREAM:
2042 {
2043 if (pmedium->pstm!=0)
2044 {
2045 IStream_Release(pmedium->pstm);
2046 }
2047 break;
2048 }
2049 case TYMED_ISTORAGE:
2050 {
2051 if (pmedium->pstg!=0)
2052 {
2053 IStorage_Release(pmedium->pstg);
2054 }
2055 break;
2056 }
2057 case TYMED_GDI:
2058 {
2059 if ( (pmedium->pUnkForRelease==0) &&
2060 (pmedium->hBitmap!=0) )
2061 DeleteObject(pmedium->hBitmap);
2062 break;
2063 }
2064 case TYMED_MFPICT:
2065 {
2066 if ( (pmedium->pUnkForRelease==0) &&
2067 (pmedium->hMetaFilePict!=0) )
2068 {
2069 LPMETAFILEPICT pMP = GlobalLock(pmedium->hMetaFilePict);
2070 DeleteMetaFile(pMP->hMF);
2071 GlobalUnlock(pmedium->hMetaFilePict);
2072 GlobalFree(pmedium->hMetaFilePict);
2073 }
2074 break;
2075 }
2076 case TYMED_ENHMF:
2077 {
2078 if ( (pmedium->pUnkForRelease==0) &&
2079 (pmedium->hEnhMetaFile!=0) )
2080 {
2081 DeleteEnhMetaFile(pmedium->hEnhMetaFile);
2082 }
2083 break;
2084 }
2085 case TYMED_NULL:
2086 default:
2087 break;
2088 }
2089 pmedium->tymed=TYMED_NULL;
2090
2091 /*
2092 * After cleaning up, the unknown is released
2093 */
2094 if (pmedium->pUnkForRelease!=0)
2095 {
2096 IUnknown_Release(pmedium->pUnkForRelease);
2097 pmedium->pUnkForRelease = 0;
2098 }
2099}
2100
2101/***
2102 * OLEDD_Initialize()
2103 *
2104 * Initializes the OLE drag and drop data structures.
2105 */
2106static void OLEDD_Initialize(void)
2107{
2108 WNDCLASSW wndClass;
2109
2110 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2111 wndClass.style = CS_GLOBALCLASS;
2113 wndClass.cbClsExtra = 0;
2114 wndClass.cbWndExtra = sizeof(TrackerWindowInfo*);
2115 wndClass.hCursor = 0;
2116 wndClass.hbrBackground = 0;
2118
2119 RegisterClassW (&wndClass);
2120}
2121
2122/***
2123 * OLEDD_DragTrackerWindowProc()
2124 *
2125 * This method is the WindowProcedure of the drag n drop tracking
2126 * window. During a drag n Drop operation, an invisible window is created
2127 * to receive the user input and act upon it. This procedure is in charge
2128 * of this behavior.
2129 */
2130
2131#define DRAG_TIMER_ID 1
2132
2134 HWND hwnd,
2135 UINT uMsg,
2136 WPARAM wParam,
2137 LPARAM lParam)
2138{
2139 switch (uMsg)
2140 {
2141 case WM_CREATE:
2142 {
2143 LPCREATESTRUCTA createStruct = (LPCREATESTRUCTA)lParam;
2144
2145 SetWindowLongPtrW(hwnd, 0, (LONG_PTR)createStruct->lpCreateParams);
2147
2148 break;
2149 }
2150 case WM_TIMER:
2151 case WM_MOUSEMOVE:
2152 case WM_LBUTTONUP:
2153 case WM_MBUTTONUP:
2154 case WM_RBUTTONUP:
2155 case WM_LBUTTONDOWN:
2156 case WM_MBUTTONDOWN:
2157 case WM_RBUTTONDOWN:
2158 {
2160 if (trackerInfo->trackingDone) break;
2161 OLEDD_TrackStateChange(trackerInfo);
2162 break;
2163 }
2164 case WM_DESTROY:
2165 {
2167 break;
2168 }
2169 }
2170
2171 /*
2172 * This is a window proc after all. Let's call the default.
2173 */
2174 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2175}
2176
2177#ifdef __REACTOS__
2178static HRESULT WINAPI DefaultDragEnter(HWND hwndTarget,
2179 IDataObject* pDataObj,
2180 DWORD grfKeyState,
2181 POINTL pt,
2182 DWORD* pdwEffect)
2183{
2184 HRESULT hr;
2185 FORMATETC fme;
2186
2187 ZeroMemory(&fme, sizeof(fme));
2188 fme.cfFormat = CF_HDROP;
2189 fme.ptd = NULL;
2190 fme.dwAspect = DVASPECT_CONTENT;
2191 fme.lindex = -1;
2192 fme.tymed = TYMED_HGLOBAL;
2193 hr = pDataObj->lpVtbl->QueryGetData(pDataObj, &fme);
2194
2195 *pdwEffect = SUCCEEDED(hr) ? DROPEFFECT_COPY : DROPEFFECT_NONE;
2196
2197 if (*pdwEffect == DROPEFFECT_NONE)
2198 return DRAGDROP_S_CANCEL;
2199
2200 return S_OK;
2201}
2202
2203static HRESULT WINAPI DefaultDrop(HWND hwndAccepter,
2204 IDataObject* pDataObj,
2205 DWORD grfKeyState,
2206 POINTL pt,
2207 DWORD* pdwEffect)
2208{
2209 FORMATETC fme;
2210 STGMEDIUM stgm;
2211 HRESULT hr;
2212 HGLOBAL hGlobal = NULL;
2213
2214 ZeroMemory(&fme, sizeof(fme));
2215 fme.cfFormat = CF_HDROP;
2216 fme.ptd = NULL;
2217 fme.dwAspect = DVASPECT_CONTENT;
2218 fme.lindex = -1;
2219 fme.tymed = TYMED_HGLOBAL;
2220 hr = pDataObj->lpVtbl->QueryGetData(pDataObj, &fme);
2221 if (FAILED(hr))
2222 return hr;
2223
2224 ZeroMemory(&stgm, sizeof(stgm));
2225 hr = pDataObj->lpVtbl->GetData(pDataObj, &fme, &stgm);
2226 if (SUCCEEDED(hr))
2227 {
2228 hGlobal = stgm.hGlobal;
2229 if (hGlobal)
2230 {
2231 if (IsWindowUnicode(hwndAccepter))
2232 PostMessageW(hwndAccepter, WM_DROPFILES, (WPARAM)hGlobal, 0);
2233 else
2234 PostMessageA(hwndAccepter, WM_DROPFILES, (WPARAM)hGlobal, 0);
2235 }
2236 ReleaseStgMedium(&stgm);
2237 }
2238
2239 return hr;
2240}
2241#endif
2242
2243static void drag_enter( TrackerWindowInfo *info, HWND new_target )
2244{
2245 HRESULT hr;
2246#ifdef __REACTOS__
2247 DWORD dwEffect = *info->pdwEffect;
2248#endif
2249
2250 info->curTargetHWND = new_target;
2251
2252#ifdef __REACTOS__
2253 info->accepterHWND = NULL;
2254 while (new_target && !is_droptarget( new_target ))
2255 {
2256 if (is_acceptfiles(new_target))
2257 {
2258 dwEffect = info->dwOKEffect;
2259 hr = DefaultDragEnter(new_target, info->dataObject,
2260 info->dwKeyState, info->curMousePos,
2261 &dwEffect);
2262 dwEffect &= info->dwOKEffect;
2263
2264 if (hr == S_OK)
2265 {
2266 info->accepterHWND = new_target;
2267 info->curDragTarget = NULL;
2268 *info->pdwEffect = dwEffect;
2269 return;
2270 }
2271 }
2272 new_target = GetParent( new_target );
2273 }
2274#else
2275 while (new_target && !is_droptarget( new_target ))
2276 new_target = GetParent( new_target );
2277#endif
2278
2279 info->curDragTarget = get_droptarget_pointer( new_target );
2280
2281 if (info->curDragTarget)
2282 {
2283 *info->pdwEffect = info->dwOKEffect;
2284 hr = IDropTarget_DragEnter( info->curDragTarget, info->dataObject,
2285 info->dwKeyState, info->curMousePos,
2286 info->pdwEffect );
2287 *info->pdwEffect &= info->dwOKEffect;
2288
2289 /* failed DragEnter() means invalid target */
2290 if (hr != S_OK)
2291 {
2292 IDropTarget_Release( info->curDragTarget );
2293 info->curDragTarget = NULL;
2294 info->curTargetHWND = NULL;
2295#ifdef __REACTOS__
2296 info->accepterHWND = NULL;
2297#endif
2298 }
2299 }
2300}
2301
2303{
2304 HRESULT hr;
2305
2306 info->trackingDone = TRUE;
2308
2309 if (info->curDragTarget)
2310 {
2311 if (info->returnValue == DRAGDROP_S_DROP &&
2312 *info->pdwEffect != DROPEFFECT_NONE)
2313 {
2314 *info->pdwEffect = info->dwOKEffect;
2315 hr = IDropTarget_Drop( info->curDragTarget, info->dataObject, info->dwKeyState,
2316 info->curMousePos, info->pdwEffect );
2317 *info->pdwEffect &= info->dwOKEffect;
2318
2319 if (FAILED( hr ))
2320 info->returnValue = hr;
2321 }
2322 else
2323 {
2324 IDropTarget_DragLeave( info->curDragTarget );
2325 *info->pdwEffect = DROPEFFECT_NONE;
2326 }
2327 IDropTarget_Release( info->curDragTarget );
2328 info->curDragTarget = NULL;
2329 }
2330#ifdef __REACTOS__
2331 else if (info->accepterHWND)
2332 {
2333 if (info->returnValue == DRAGDROP_S_DROP &&
2334 *info->pdwEffect != DROPEFFECT_NONE)
2335 {
2336 *info->pdwEffect = info->dwOKEffect;
2337 hr = DefaultDrop(info->accepterHWND, info->dataObject, info->dwKeyState,
2338 info->curMousePos, info->pdwEffect);
2339 *info->pdwEffect &= info->dwOKEffect;
2340
2341 if (FAILED( hr ))
2342 info->returnValue = hr;
2343 }
2344 else
2345 {
2346 *info->pdwEffect = DROPEFFECT_NONE;
2347 }
2348 info->accepterHWND = NULL;
2349 }
2350#endif
2351 else
2352 *info->pdwEffect = DROPEFFECT_NONE;
2353}
2354
2356{
2357 HRESULT hr;
2358 int res;
2359 HCURSOR cur;
2360
2361#ifdef __REACTOS__
2362 if (info->curDragTarget == NULL && info->accepterHWND == NULL)
2363 *info->pdwEffect = DROPEFFECT_NONE;
2364#else
2365 if (info->curDragTarget == NULL)
2366 *info->pdwEffect = DROPEFFECT_NONE;
2367#endif
2368
2369 hr = IDropSource_GiveFeedback( info->dropSource, *info->pdwEffect );
2370
2372 {
2373 if (*info->pdwEffect & DROPEFFECT_MOVE)
2374 res = CURSOR_MOVE;
2375 else if (*info->pdwEffect & DROPEFFECT_COPY)
2376 res = CURSOR_COPY;
2377 else if (*info->pdwEffect & DROPEFFECT_LINK)
2378 res = CURSOR_LINK;
2379 else
2381
2383 SetCursor( cur );
2384 }
2385
2386 return hr;
2387}
2388
2389/***
2390 * OLEDD_TrackStateChange()
2391 *
2392 * This method is invoked while a drag and drop operation is in effect.
2393 *
2394 * params:
2395 * trackerInfo - Pointer to the structure identifying the
2396 * drag & drop operation that is currently
2397 * active.
2398 */
2400{
2401 HWND hwndNewTarget = 0;
2402 POINT pt;
2403
2404 /*
2405 * This method may be called from QueryContinueDrag again,
2406 * (i.e. by running message loop) so avoid recursive call chain.
2407 */
2408 if (trackerInfo->inTrackCall) return;
2409 trackerInfo->inTrackCall = TRUE;
2410
2411 /*
2412 * Get the handle of the window under the mouse
2413 */
2414 pt.x = trackerInfo->curMousePos.x;
2415 pt.y = trackerInfo->curMousePos.y;
2416 hwndNewTarget = WindowFromPoint(pt);
2417
2418 trackerInfo->returnValue = IDropSource_QueryContinueDrag(trackerInfo->dropSource,
2419 trackerInfo->escPressed,
2420 trackerInfo->dwKeyState);
2421
2422 if (trackerInfo->curTargetHWND != hwndNewTarget &&
2423 (trackerInfo->returnValue == S_OK ||
2424 trackerInfo->returnValue == DRAGDROP_S_DROP))
2425 {
2426 if (trackerInfo->curDragTarget)
2427 {
2428 IDropTarget_DragLeave(trackerInfo->curDragTarget);
2429 IDropTarget_Release(trackerInfo->curDragTarget);
2430 trackerInfo->curDragTarget = NULL;
2431 trackerInfo->curTargetHWND = NULL;
2432 }
2433#ifdef __REACTOS__
2434 trackerInfo->accepterHWND = NULL;
2435#endif
2436
2437 if (hwndNewTarget)
2438 drag_enter( trackerInfo, hwndNewTarget );
2439
2440 give_feedback( trackerInfo );
2441
2442 }
2443
2444 if (trackerInfo->returnValue == S_OK)
2445 {
2446 if (trackerInfo->curDragTarget)
2447 {
2448 *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2449 IDropTarget_DragOver(trackerInfo->curDragTarget,
2450 trackerInfo->dwKeyState,
2451 trackerInfo->curMousePos,
2452 trackerInfo->pdwEffect);
2453 *trackerInfo->pdwEffect &= trackerInfo->dwOKEffect;
2454 }
2455#ifdef __REACTOS__
2456 else if (trackerInfo->accepterHWND)
2457 {
2458 *trackerInfo->pdwEffect = trackerInfo->dwOKEffect;
2459 }
2460#endif
2461 give_feedback( trackerInfo );
2462 }
2463 else
2464 drag_end( trackerInfo );
2465
2466 trackerInfo->inTrackCall = FALSE;
2467}
2468
2469/***
2470 * OLEDD_GetButtonState()
2471 *
2472 * This method will use the current state of the keyboard to build
2473 * a button state mask equivalent to the one passed in the
2474 * WM_MOUSEMOVE wParam.
2475 */
2477{
2478 BYTE keyboardState[256];
2479 DWORD keyMask = 0;
2480
2481 GetKeyboardState(keyboardState);
2482
2483 if ( (keyboardState[VK_SHIFT] & 0x80) !=0)
2484 keyMask |= MK_SHIFT;
2485
2486 if ( (keyboardState[VK_CONTROL] & 0x80) !=0)
2487 keyMask |= MK_CONTROL;
2488
2489 if ( (keyboardState[VK_MENU] & 0x80) !=0)
2490 keyMask |= MK_ALT;
2491
2492 if ( (keyboardState[VK_LBUTTON] & 0x80) !=0)
2493 keyMask |= MK_LBUTTON;
2494
2495 if ( (keyboardState[VK_RBUTTON] & 0x80) !=0)
2496 keyMask |= MK_RBUTTON;
2497
2498 if ( (keyboardState[VK_MBUTTON] & 0x80) !=0)
2499 keyMask |= MK_MBUTTON;
2500
2501 return keyMask;
2502}
2503
2504/***
2505 * OLEDD_GetButtonState()
2506 *
2507 * This method will read the default value of the registry key in
2508 * parameter and extract a DWORD value from it. The registry key value
2509 * can be in a string key or a DWORD key.
2510 *
2511 * params:
2512 * regKey - Key to read the default value from
2513 * pdwValue - Pointer to the location where the DWORD
2514 * value is returned. This value is not modified
2515 * if the value is not found.
2516 */
2517
2519 HKEY regKey,
2520 DWORD* pdwValue)
2521{
2522 WCHAR buffer[20];
2523 DWORD cbData = sizeof(buffer);
2524 DWORD dwKeyType;
2525 LONG lres;
2526
2527 lres = RegQueryValueExW(regKey, L"", NULL, &dwKeyType, (BYTE *)buffer, &cbData);
2528
2529 if (lres==ERROR_SUCCESS)
2530 {
2531 switch (dwKeyType)
2532 {
2533 case REG_DWORD:
2534 *pdwValue = *(DWORD*)buffer;
2535 break;
2536 case REG_EXPAND_SZ:
2537 case REG_MULTI_SZ:
2538 case REG_SZ:
2539 *pdwValue = wcstoul(buffer, NULL, 10);
2540 break;
2541 }
2542 }
2543}
2544
2545/******************************************************************************
2546 * OleDraw (OLE32.@)
2547 *
2548 * The operation of this function is documented literally in the WinAPI
2549 * documentation to involve a QueryInterface for the IViewObject interface,
2550 * followed by a call to IViewObject::Draw.
2551 */
2553 IUnknown *pUnk,
2554 DWORD dwAspect,
2555 HDC hdcDraw,
2556 LPCRECT rect)
2557{
2558 HRESULT hres;
2560
2561 if (!pUnk) return E_INVALIDARG;
2562
2563 hres = IUnknown_QueryInterface(pUnk,
2565 (void**)&viewobject);
2566 if (SUCCEEDED(hres))
2567 {
2568 hres = IViewObject_Draw(viewobject, dwAspect, -1, 0, 0, 0, hdcDraw, (RECTL*)rect, 0, 0, 0);
2569 IViewObject_Release(viewobject);
2570 return hres;
2571 }
2572 else
2573 return DV_E_NOIVIEWOBJECT;
2574}
2575
2576/***********************************************************************
2577 * OleTranslateAccelerator [OLE32.@]
2578 */
2579HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame,
2580 LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg)
2581{
2582 WORD wID;
2583
2584 TRACE("(%p,%p,%p)\n", lpFrame, lpFrameInfo, lpmsg);
2585
2586 if (IsAccelerator(lpFrameInfo->haccel,lpFrameInfo->cAccelEntries,lpmsg,&wID))
2587 return IOleInPlaceFrame_TranslateAccelerator(lpFrame,lpmsg,wID);
2588
2589 return S_FALSE;
2590}
2591
2592/******************************************************************************
2593 * OleCreate [OLE32.@]
2594 *
2595 */
2597 REFCLSID rclsid,
2598 REFIID riid,
2599 DWORD renderopt,
2600 LPFORMATETC pFormatEtc,
2601 LPOLECLIENTSITE pClientSite,
2602 LPSTORAGE pStg,
2603 LPVOID* ppvObj)
2604{
2605 HRESULT hres;
2606 IUnknown * pUnk = NULL;
2607 IOleObject *pOleObject = NULL;
2608
2609 TRACE("%s, %s, %ld, %p, %p, %p, %p.\n", debugstr_guid(rclsid),
2610 debugstr_guid(riid), renderopt, pFormatEtc, pClientSite, pStg, ppvObj);
2611
2612 hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, riid, (LPVOID*)&pUnk);
2613
2614 if (SUCCEEDED(hres))
2615 hres = IStorage_SetClass(pStg, rclsid);
2616
2617 if (pClientSite && SUCCEEDED(hres))
2618 {
2619 hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (LPVOID*)&pOleObject);
2620 if (SUCCEEDED(hres))
2621 {
2623 IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus);
2624 }
2625 }
2626
2627 if (SUCCEEDED(hres))
2628 {
2629 IPersistStorage * pPS;
2630 if (SUCCEEDED((hres = IUnknown_QueryInterface(pUnk, &IID_IPersistStorage, (LPVOID*)&pPS))))
2631 {
2632 TRACE("trying to set stg %p\n", pStg);
2633 hres = IPersistStorage_InitNew(pPS, pStg);
2634 TRACE("-- result %#lx\n", hres);
2635 IPersistStorage_Release(pPS);
2636 }
2637 }
2638
2639 if (pClientSite && SUCCEEDED(hres))
2640 {
2641 TRACE("trying to set clientsite %p\n", pClientSite);
2642 hres = IOleObject_SetClientSite(pOleObject, pClientSite);
2643 TRACE("-- result %#lx\n", hres);
2644 }
2645
2646 if (pOleObject)
2647 IOleObject_Release(pOleObject);
2648
2649 if (((renderopt == OLERENDER_DRAW) || (renderopt == OLERENDER_FORMAT)) &&
2650 SUCCEEDED(hres))
2651 {
2652 hres = OleRun(pUnk);
2653 if (SUCCEEDED(hres))
2654 {
2655 IOleCache *pOleCache;
2656
2657 if (SUCCEEDED(IUnknown_QueryInterface(pUnk, &IID_IOleCache, (void **)&pOleCache)))
2658 {
2659 DWORD dwConnection;
2660 if (renderopt == OLERENDER_DRAW && !pFormatEtc) {
2661 FORMATETC pfe;
2662 pfe.cfFormat = 0;
2663 pfe.ptd = NULL;
2664 pfe.dwAspect = DVASPECT_CONTENT;
2665 pfe.lindex = -1;
2666 pfe.tymed = TYMED_NULL;
2667 hres = IOleCache_Cache(pOleCache, &pfe, ADVF_PRIMEFIRST, &dwConnection);
2668 }
2669 else
2670 hres = IOleCache_Cache(pOleCache, pFormatEtc, ADVF_PRIMEFIRST, &dwConnection);
2671 IOleCache_Release(pOleCache);
2672 }
2673 }
2674 }
2675
2676 if (FAILED(hres) && pUnk)
2677 {
2678 IUnknown_Release(pUnk);
2679 pUnk = NULL;
2680 }
2681
2682 *ppvObj = pUnk;
2683
2684 TRACE("-- %p\n", pUnk);
2685 return hres;
2686}
2687
2688/******************************************************************************
2689 * OleGetAutoConvert [OLE32.@]
2690 */
2692{
2693 HKEY hkey = NULL;
2695 LONG len;
2696 HRESULT res = S_OK;
2697
2698 res = COM_OpenKeyForCLSID(clsidOld, L"AutoConvertTo", KEY_READ, &hkey);
2699 if (FAILED(res))
2700 goto done;
2701
2702 len = sizeof(buf);
2703 if (RegQueryValueW(hkey, NULL, buf, &len))
2704 {
2706 goto done;
2707 }
2708 res = CLSIDFromString(buf, pClsidNew);
2709done:
2710 if (hkey) RegCloseKey(hkey);
2711 return res;
2712}
2713
2714/******************************************************************************
2715 * OleSetAutoConvert [OLE32.@]
2716 */
2718{
2719 HKEY hkey = NULL;
2720 WCHAR szClsidNew[CHARS_IN_GUID];
2721 HRESULT res = S_OK;
2722
2723 TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
2724
2725 res = COM_OpenKeyForCLSID(clsidOld, NULL, KEY_READ | KEY_WRITE, &hkey);
2726 if (FAILED(res))
2727 goto done;
2728 StringFromGUID2(clsidNew, szClsidNew, CHARS_IN_GUID);
2729 if (RegSetValueW(hkey, L"AutoConvertTo", REG_SZ, szClsidNew, (lstrlenW(szClsidNew)+1) * sizeof(WCHAR)))
2730 {
2732 goto done;
2733 }
2734
2735done:
2736 if (hkey) RegCloseKey(hkey);
2737 return res;
2738}
2739
2740/******************************************************************************
2741 * OleDoAutoConvert [OLE32.@]
2742 */
2744{
2745 WCHAR *user_type_old, *user_type_new;
2746 CLIPFORMAT cf;
2747 STATSTG stat;
2748 CLSID clsid;
2749 HRESULT hr;
2750
2751 TRACE("(%p, %p)\n", pStg, pClsidNew);
2752
2753 *pClsidNew = CLSID_NULL;
2754 if(!pStg)
2755 return E_INVALIDARG;
2756 hr = IStorage_Stat(pStg, &stat, STATFLAG_NONAME);
2757 if(FAILED(hr))
2758 return hr;
2759
2760 *pClsidNew = stat.clsid;
2761 hr = OleGetAutoConvert(&stat.clsid, &clsid);
2762 if(FAILED(hr))
2763 return hr;
2764
2765 hr = IStorage_SetClass(pStg, &clsid);
2766 if(FAILED(hr))
2767 return hr;
2768
2769 hr = ReadFmtUserTypeStg(pStg, &cf, &user_type_old);
2770 if(FAILED(hr)) {
2771 cf = 0;
2772 user_type_new = NULL;
2773 }
2774
2775 hr = OleRegGetUserType(&clsid, USERCLASSTYPE_FULL, &user_type_new);
2776 if(FAILED(hr))
2777 user_type_new = NULL;
2778
2779 hr = WriteFmtUserTypeStg(pStg, cf, user_type_new);
2780 CoTaskMemFree(user_type_new);
2781 if(FAILED(hr))
2782 {
2783 CoTaskMemFree(user_type_old);
2784 IStorage_SetClass(pStg, &stat.clsid);
2785 return hr;
2786 }
2787
2788 hr = SetConvertStg(pStg, TRUE);
2789 if(FAILED(hr))
2790 {
2791 WriteFmtUserTypeStg(pStg, cf, user_type_old);
2792 IStorage_SetClass(pStg, &stat.clsid);
2793 }
2794 else
2795 *pClsidNew = clsid;
2796 CoTaskMemFree(user_type_old);
2797 return hr;
2798}
2799
2800/******************************************************************************
2801 * OleIsRunning [OLE32.@]
2802 */
2804{
2805 IRunnableObject *pRunnable;
2806 HRESULT hr;
2807 BOOL running;
2808
2809 TRACE("(%p)\n", object);
2810
2811 if (!object) return FALSE;
2812
2813 hr = IOleObject_QueryInterface(object, &IID_IRunnableObject, (void **)&pRunnable);
2814 if (FAILED(hr))
2815 return TRUE;
2816 running = IRunnableObject_IsRunning(pRunnable);
2817 IRunnableObject_Release(pRunnable);
2818 return running;
2819}
2820
2821/***********************************************************************
2822 * OleNoteObjectVisible [OLE32.@]
2823 */
2825{
2826 TRACE("(%p, %s)\n", pUnknown, bVisible ? "TRUE" : "FALSE");
2827 return CoLockObjectExternal(pUnknown, bVisible, TRUE);
2828}
2829
2830/***********************************************************************
2831 * PropSysAllocString [OLE32.@]
2832 * NOTES
2833 * Forward to oleaut32.
2834 */
2836{
2837 return SysAllocString(str);
2838}
2839
2840/***********************************************************************
2841 * PropSysFreeString [OLE32.@]
2842 * NOTES
2843 * Forward to oleaut32.
2844 */
2846{
2848}
2849
2850/******************************************************************************
2851 * OleQueryCreateFromData [OLE32.@]
2852 *
2853 * Checks whether an object can become an embedded object.
2854 * the clipboard or OLE drag and drop.
2855 * Returns : S_OK - Format that supports Embedded object creation are present.
2856 * OLE_E_STATIC - Format that supports static object creation are present.
2857 * S_FALSE - No acceptable format is available.
2858 */
2859
2861{
2862 IEnumFORMATETC *enum_fmt;
2863 FORMATETC fmt;
2864 BOOL found_static = FALSE;
2865 HRESULT hr;
2866
2867 hr = IDataObject_EnumFormatEtc(data, DATADIR_GET, &enum_fmt);
2868
2869 if(FAILED(hr)) return hr;
2870
2871 do
2872 {
2873 hr = IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL);
2874 if(hr == S_OK)
2875 {
2876 if(fmt.cfFormat == embedded_object_clipboard_format ||
2877 fmt.cfFormat == embed_source_clipboard_format ||
2878 fmt.cfFormat == filename_clipboard_format)
2879 {
2880 IEnumFORMATETC_Release(enum_fmt);
2881 return S_OK;
2882 }
2883
2884 if(fmt.cfFormat == CF_METAFILEPICT ||
2885 fmt.cfFormat == CF_BITMAP ||
2886 fmt.cfFormat == CF_DIB)
2887 found_static = TRUE;
2888 }
2889 } while (hr == S_OK);
2890
2891 IEnumFORMATETC_Release(enum_fmt);
2892
2893 return found_static ? OLE_S_STATIC : S_FALSE;
2894}
2895
2896static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed)
2897{
2898 fmt->cfFormat = cf;
2899 fmt->ptd = NULL;
2900 fmt->dwAspect = DVASPECT_CONTENT;
2901 fmt->lindex = -1;
2902 fmt->tymed = tymed;
2903}
2904
2905/***************************************************************************
2906 * get_storage
2907 *
2908 * Retrieve an object's storage from a variety of sources.
2909 *
2910 * FIXME: CF_FILENAME.
2911 */
2912static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf, BOOL other_fmts)
2913{
2914 static const UINT fmt_id[] = { CF_METAFILEPICT, CF_BITMAP, CF_DIB };
2915 UINT i;
2916 HRESULT hr;
2917 FORMATETC fmt;
2918 STGMEDIUM med;
2919 IPersistStorage *persist;
2920 CLSID clsid;
2921
2922 if (src_cf) *src_cf = 0;
2923
2924 /* CF_EMBEDEDOBJECT */
2926 med.tymed = TYMED_ISTORAGE;
2927 med.pstg = stg;
2928 med.pUnkForRelease = NULL;
2929 hr = IDataObject_GetDataHere(data, &fmt, &med);
2930 if(SUCCEEDED(hr))
2931 {
2932 if (src_cf) *src_cf = embedded_object_clipboard_format;
2933 return hr;
2934 }
2935
2936 /* CF_EMBEDSOURCE */
2938 med.tymed = TYMED_ISTORAGE;
2939 med.pstg = stg;
2940 med.pUnkForRelease = NULL;
2941 hr = IDataObject_GetDataHere(data, &fmt, &med);
2942 if(SUCCEEDED(hr))
2943 {
2944 if (src_cf) *src_cf = embed_source_clipboard_format;
2945 return hr;
2946 }
2947
2948 if (other_fmts)
2949 {
2950 for (i = 0; i < ARRAY_SIZE(fmt_id); i++)
2951 {
2952 init_fmtetc(&fmt, fmt_id[i], TYMED_ISTORAGE);
2953 hr = IDataObject_QueryGetData(data, &fmt);
2954 if (SUCCEEDED(hr))
2955 {
2956 if (src_cf) *src_cf = fmt_id[i];
2957 return hr;
2958 }
2959 }
2960 }
2961
2962 /* IPersistStorage */
2963 hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist);
2964 if(FAILED(hr)) return hr;
2965
2966 hr = IPersistStorage_GetClassID(persist, &clsid);
2967 if(FAILED(hr)) goto end;
2968
2969 hr = IStorage_SetClass(stg, &clsid);
2970 if(FAILED(hr)) goto end;
2971
2972 hr = IPersistStorage_Save(persist, stg, FALSE);
2973 if(FAILED(hr)) goto end;
2974
2975 hr = IPersistStorage_SaveCompleted(persist, NULL);
2976
2977end:
2978 IPersistStorage_Release(persist);
2979
2980 return hr;
2981}
2982
2983/******************************************************************************
2984 * OleCreateFromDataEx [OLE32.@]
2985 *
2986 * Creates an embedded object from data transfer object retrieved from
2987 * the clipboard or OLE drag and drop.
2988 */
2990 DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts,
2991 IAdviseSink *sink, DWORD *conns,
2992 IOleClientSite *client_site, IStorage *stg, void **obj)
2993{
2994 HRESULT hr;
2995 UINT src_cf;
2996
2997 FIXME("%p, %s, %#lx, %#lx, %ld, %p, %p, %p, %p, %p, %p, %p: stub\n",
2998 data, debugstr_guid(iid), flags, renderopt, num_cache_fmts, adv_flags, cache_fmts,
2999 sink, conns, client_site, stg, obj);
3000
3001 hr = get_storage(data, stg, &src_cf, TRUE);
3002 if(FAILED(hr)) return hr;
3003
3004 hr = OleLoad(stg, iid, client_site, obj);
3005 if(FAILED(hr)) return hr;
3006
3007 /* FIXME: Init cache */
3008
3009 return hr;
3010}
3011
3012/******************************************************************************
3013 * OleCreateFromData [OLE32.@]
3014 */
3016 IOleClientSite *client_site, IStorage *stg, void **obj)
3017{
3018 DWORD advf = ADVF_PRIMEFIRST;
3019
3020 return OleCreateFromDataEx(data, iid, 0, renderopt, fmt ? 1 : 0, fmt ? &advf : NULL,
3021 fmt, NULL, NULL, client_site, stg, obj);
3022}
3023
3024/******************************************************************************
3025 * OleCreateLinkFromData [OLE32.@]
3026 */
3028 IOleClientSite *client_site, IStorage *stg, void **obj)
3029{
3030 FIXME("%p, %s, %#lx, %p, %p, %p, %p: semi-stub\n",
3031 data, debugstr_guid(iid), renderopt, fmt, client_site, stg, obj);
3032 return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
3033}
3034
3035/******************************************************************************
3036 * OleCreateStaticFromData [OLE32.@]
3037 */
3039 IOleClientSite *client_site, IStorage *stg, void **obj)
3040{
3041 HRESULT hr;
3042 CLSID clsid;
3043 IOleObject * ole_object = NULL;
3044 IOleCache2 *ole_cache = NULL;
3045 IPersistStorage *persist = NULL;
3046 DWORD connection;
3047 STGMEDIUM stgmedium;
3048 LPOLESTR ole_typename;
3049
3050 TRACE("%p, %s, %#lx, %p, %p, %p, %p.\n", data, debugstr_guid(iid), renderopt, fmt, client_site, stg, obj);
3051
3052 if (!obj || !stg)
3053 return E_INVALIDARG;
3054
3055 if (renderopt != OLERENDER_FORMAT)
3056 {
3057 FIXME("semi-stub\n");
3058 return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
3059 }
3060
3061 if (!fmt)
3062 return E_INVALIDARG;
3063
3064 hr = IDataObject_GetData(data, fmt, &stgmedium);
3065 if (FAILED(hr)) return hr;
3066
3067 switch (fmt->cfFormat)
3068 {
3069 case CF_BITMAP:
3070 case CF_DIB:
3072 break;
3073 case CF_ENHMETAFILE:
3075 break;
3076 case CF_METAFILEPICT:
3078 break;
3079 default:
3080 ReleaseStgMedium(&stgmedium);
3081 return DV_E_CLIPFORMAT;
3082 }
3083 hr = OleCreateDefaultHandler(&clsid, NULL, &IID_IOleObject, (void **)&ole_object);
3084 if (FAILED(hr)) goto end;
3085
3086 if (client_site)
3087 {
3088 hr = IOleObject_SetClientSite(ole_object, client_site);
3089 if (FAILED(hr)) goto end;
3090 }
3091
3092 hr = IOleObject_QueryInterface(ole_object, &IID_IOleCache2, (void **)&ole_cache);
3093 if (FAILED(hr)) goto end;
3094
3095 hr = IOleObject_QueryInterface(ole_object, &IID_IPersistStorage, (void **)&persist);
3096 if (FAILED(hr)) goto end;
3097
3098 hr = WriteClassStg(stg, &clsid);
3099 if (FAILED(hr)) goto end;
3100
3101 hr = IPersistStorage_InitNew(persist, stg);
3102 if (FAILED(hr)) goto end;
3103
3104 hr = IOleCache2_Cache(ole_cache, fmt, ADVF_PRIMEFIRST, &connection);
3105 if (FAILED(hr)) goto end;
3106
3107 hr = IOleCache2_SetData(ole_cache, fmt, &stgmedium, TRUE);
3108 if (FAILED(hr)) goto end;
3109 stgmedium.tymed = TYMED_NULL;
3110
3111 hr = IOleObject_GetUserType(ole_object, USERCLASSTYPE_FULL, &ole_typename);
3112 if(FAILED(hr))
3113 ole_typename = NULL;
3114 hr = WriteFmtUserTypeStg(stg, fmt->cfFormat, ole_typename);
3115 CoTaskMemFree(ole_typename);
3116 if (FAILED(hr)) goto end;
3117
3118 hr = IPersistStorage_Save(persist, stg, TRUE);
3119 if (FAILED(hr)) goto end;
3120
3121 hr = IPersistStorage_SaveCompleted(persist, NULL);
3122 if (FAILED(hr)) goto end;
3123
3124 hr = IOleObject_QueryInterface(ole_object, iid, obj);
3125
3126end:
3127 if (stgmedium.tymed == TYMED_NULL)
3128 ReleaseStgMedium(&stgmedium);
3129 if (persist)
3130 IPersistStorage_Release(persist);
3131 if (ole_cache)
3132 IOleCache2_Release(ole_cache);
3133 if (ole_object)
3134 IOleObject_Release(ole_object);
3135 return hr;
3136}
3137
3138/******************************************************************************
3139 * OleCreateFromFileEx [OLE32.@]
3140 */
3142 DWORD renderopt, ULONG num_fmts, DWORD *adv_flags, FORMATETC *fmts, IAdviseSink *sink,
3143 DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj)
3144{
3145 HRESULT hr;
3146 IMoniker *mon;
3148 IUnknown *unk = NULL;
3149 IOleCache *cache = NULL;
3150 ULONG i;
3151
3152 TRACE("cls %s, %s, iid %s, flags %ld, render opts %ld, num fmts %ld, adv flags %p, fmts %p\n", debugstr_guid(clsid),
3153 debugstr_w(filename), debugstr_guid(iid), flags, renderopt, num_fmts, adv_flags, fmts);
3154 TRACE("sink %p, conns %p, client site %p, storage %p, obj %p\n", sink, conns, client_site, stg, obj);
3155 for (i = 0; i < num_fmts; i++)
3156 TRACE("\t%ld: fmt %s adv flags %ld\n", i, debugstr_formatetc(fmts + i), adv_flags[i]);
3157
3158 hr = CreateFileMoniker( filename, &mon );
3159 if (FAILED(hr)) return hr;
3160
3161 hr = BindMoniker( mon, 0, &IID_IDataObject, (void**)&data );
3162 IMoniker_Release( mon );
3163 if (FAILED(hr)) return hr;
3164
3165 hr = get_storage( data, stg, NULL, FALSE );
3166 if (FAILED(hr)) goto end;
3167
3168 hr = OleLoad( stg, &IID_IUnknown, client_site, (void**)&unk );
3169 if (FAILED(hr)) goto end;
3170
3171 if (renderopt == OLERENDER_FORMAT)
3172 {
3173 hr = IUnknown_QueryInterface( unk, &IID_IOleCache, (void**)&cache );
3174 if (FAILED(hr)) goto end;
3175
3176 for (i = 0; i < num_fmts; i++)
3177 {
3178 STGMEDIUM med;
3179 DWORD dummy_conn;
3180
3181 memset( &med, 0, sizeof(med) );
3182 hr = IDataObject_GetData( data, fmts + i, &med );
3183 if (FAILED(hr)) goto end;
3184 hr = IOleCache_Cache( cache, fmts + i, adv_flags[i], &dummy_conn );
3185 if (SUCCEEDED(hr))
3186 hr = IOleCache_SetData( cache, fmts + i, &med, TRUE );
3187 if (FAILED(hr))
3188 {
3189 ReleaseStgMedium( &med );
3190 goto end;
3191 }
3192 }
3193 }
3194
3195 hr = IUnknown_QueryInterface( unk, iid, obj );
3196
3197end:
3198 if (cache) IOleCache_Release( cache );
3199 if (unk) IUnknown_Release( unk );
3200 IDataObject_Release( data );
3201 return hr;
3202}
3203
3204/******************************************************************************
3205 * OleCreateFromFile [OLE32.@]
3206 */
3208 FORMATETC *fmt, IOleClientSite *client_site, IStorage *storage, void **obj)
3209{
3210 DWORD advf = ADVF_PRIMEFIRST;
3211
3212 return OleCreateFromFileEx(clsid, filename, iid, 0, renderopt, fmt ? 1 : 0, fmt ? &advf : NULL, fmt,
3214}
3215
3216/******************************************************************************
3217 * OleDuplicateData [OLE32.@]
3218 */
3219HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
3220{
3221 HANDLE hDst = NULL;
3222
3223 TRACE("(%p,%x,%x)\n", hSrc, cfFormat, uiFlags);
3224
3225 if (!uiFlags) uiFlags = GMEM_MOVEABLE;
3226
3227 switch (cfFormat)
3228 {
3229 case CF_ENHMETAFILE:
3230 hDst = CopyEnhMetaFileW(hSrc, NULL);
3231 break;
3232 case CF_METAFILEPICT:
3233 hDst = CopyMetaFileW(hSrc, NULL);
3234 break;
3235 case CF_PALETTE:
3236 {
3238 UINT nEntries = GetPaletteEntries(hSrc, 0, 0, NULL);
3239 if (!nEntries) return NULL;
3241 FIELD_OFFSET(LOGPALETTE, palPalEntry[nEntries]));
3242 if (!logpalette) return NULL;
3243 if (!GetPaletteEntries(hSrc, 0, nEntries, logpalette->palPalEntry))
3244 {
3246 return NULL;
3247 }
3248 logpalette->palVersion = 0x300;
3249 logpalette->palNumEntries = (WORD)nEntries;
3250
3251 hDst = CreatePalette(logpalette);
3252
3254 break;
3255 }
3256 case CF_BITMAP:
3257 {
3258 LONG size;
3259 BITMAP bm;
3260 if (!GetObjectW(hSrc, sizeof(bm), &bm))
3261 return NULL;
3262 size = GetBitmapBits(hSrc, 0, NULL);
3263 if (!size) return NULL;
3264 bm.bmBits = HeapAlloc(GetProcessHeap(), 0, size);
3265 if (!bm.bmBits) return NULL;
3266 if (GetBitmapBits(hSrc, size, bm.bmBits))
3267 hDst = CreateBitmapIndirect(&bm);
3268 HeapFree(GetProcessHeap(), 0, bm.bmBits);
3269 break;
3270 }
3271 default:
3272 {
3273 SIZE_T size = GlobalSize(hSrc);
3274 LPVOID pvSrc = NULL;
3275 LPVOID pvDst = NULL;
3276
3277 /* allocate space for object */
3278 if (!size) return NULL;
3279 hDst = GlobalAlloc(uiFlags, size);
3280 if (!hDst) return NULL;
3281
3282 /* lock pointers */
3283 pvSrc = GlobalLock(hSrc);
3284 if (!pvSrc)
3285 {
3286 GlobalFree(hDst);
3287 return NULL;
3288 }
3289 pvDst = GlobalLock(hDst);
3290 if (!pvDst)
3291 {
3292 GlobalUnlock(hSrc);
3293 GlobalFree(hDst);
3294 return NULL;
3295 }
3296 /* copy data */
3297 memcpy(pvDst, pvSrc, size);
3298
3299 /* cleanup */
3300 GlobalUnlock(hDst);
3301 GlobalUnlock(hSrc);
3302 }
3303 }
3304
3305 TRACE("returning %p\n", hDst);
3306 return hDst;
3307}
#define DECLSPEC_HOTPATCH
Definition: _mingw.h:240
#define stat
Definition: acwin.h:99
int nItems
Definition: appswitch.c:55
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define CF_METAFILEPICT
Definition: constants.h:398
#define CF_BITMAP
Definition: constants.h:397
#define CF_PALETTE
Definition: constants.h:404
#define CF_HDROP
Definition: constants.h:410
#define CF_ENHMETAFILE
Definition: constants.h:409
#define CF_DIB
Definition: constants.h:403
#define index(s, c)
Definition: various.h:29
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
#define RegCloseKey(hKey)
Definition: registry.h:49
return
Definition: dirsup.c:529
const CLSID CLSID_Picture_EnhMetafile
const CLSID CLSID_Picture_Dib
const CLSID CLSID_Picture_Metafile
Definition: _map.h:48
#define CHARS_IN_GUID
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
static struct apartment * COM_CurrentApt(void)
static struct oletls * COM_CurrentInfo(void)
const char * debugstr_formatetc(const FORMATETC *formatetc)
Definition: datacache.c:214
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_FAIL
Definition: ddrawi.h:102
#define ERROR_SUCCESS
Definition: deptool.c:10
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
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
LSTATUS WINAPI RegQueryValueW(HKEY hkey, LPCWSTR name, LPWSTR data, LPLONG count)
Definition: reg.c:4241
LONG WINAPI RegSetValueW(HKEY hKeyOriginal, LPCWSTR lpSubKey, DWORD dwType, LPCWSTR lpData, DWORD cbData)
Definition: reg.c:5000
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
LONG WINAPI RegEnumKeyW(HKEY hKey, DWORD dwIndex, LPWSTR lpName, DWORD cbName)
Definition: reg.c:2393
INT WINAPI StringFromGUID2(REFGUID guid, LPOLESTR str, INT cmax)
Definition: combase.c:1525
HINSTANCE hProxyDll
Definition: combase.c:40
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
static LSTATUS open_classes_key(HKEY hkey, const WCHAR *name, REGSAM access, HKEY *retkey)
Definition: combase.c:297
HRESULT WINAPI CoLockObjectExternal(IUnknown *object, BOOL lock, BOOL last_unlock_releases)
Definition: combase.c:3237
HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
Definition: combase.c:1470
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
HRESULT WINAPI GetHGlobalFromStream(IStream *stream, HGLOBAL *phglobal)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL delete_on_release, IStream **stream)
HRESULT WINAPI CoMarshalInterface(IStream *stream, REFIID riid, IUnknown *unk, DWORD dest_context, void *pvDestContext, DWORD mshlFlags)
Definition: marshal.c:483
HRESULT WINAPI CoReleaseMarshalData(IStream *stream)
Definition: marshal.c:673
HRESULT WINAPI CoUnmarshalInterface(IStream *stream, REFIID riid, void **ppv)
Definition: marshal.c:793
HRESULT WINAPI WriteClassStg(IStorage *pStg, REFCLSID rclsid)
Definition: storage32.c:58
#define CloseHandle
Definition: compat.h:739
#define wcschr
Definition: compat.h:17
#define GetProcessHeap()
Definition: compat.h:736
#define UnmapViewOfFile
Definition: compat.h:746
#define TRACE_(x)
Definition: compat.h:76
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define HeapAlloc
Definition: compat.h:733
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
WCHAR OLECHAR
Definition: compat.h:2292
OLECHAR * BSTR
Definition: compat.h:2293
#define GetCurrentProcess()
Definition: compat.h:759
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:105
#define HeapFree(x, y, z)
Definition: compat.h:735
#define FILE_MAP_READ
Definition: compat.h:776
#define WINE_DECLARE_DEBUG_CHANNEL(x)
Definition: compat.h:45
#define CALLBACK
Definition: compat.h:35
#define MapViewOfFile
Definition: compat.h:745
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
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
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1225
_ACRTIMP __msvcrt_ulong __cdecl wcstoul(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2912
_ACRTIMP __msvcrt_long __cdecl wcstol(const wchar_t *, wchar_t **, int)
Definition: wcs.c:2747
UINT embedded_object_clipboard_format
Definition: clipboard.c:193
UINT filename_clipboard_format
Definition: clipboard.c:190
UINT embed_source_clipboard_format
Definition: clipboard.c:194
HRESULT COM_OpenKeyForCLSID(REFCLSID clsid, LPCWSTR keyname, REGSAM access, HKEY *subkey)
Definition: compobj.c:540
BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
Definition: compobj.c:160
HRESULT WINAPI OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
#define DRAG_TIMER_ID
Definition: ole2.c:2131
HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
Definition: ole2.c:2717
static IDropTarget * WrapDropTarget(HWND hwnd)
Definition: ole2.c:508
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:668
HRESULT WINAPI DECLSPEC_HOTPATCH OleInitialize(LPVOID reserved)
Definition: ole2.c:162
static ULONG WINAPI DropTargetWrapper_Release(IDropTarget *iface)
Definition: ole2.c:417
void WINAPI ReleaseStgMedium(STGMEDIUM *pmedium)
Definition: ole2.c:2014
struct tagTrackerWindowInfo TrackerWindowInfo
static HRESULT give_feedback(TrackerWindowInfo *info)
Definition: ole2.c:2355
static void drag_enter(TrackerWindowInfo *info, HWND new_target)
Definition: ole2.c:2243
static IDropTarget * get_droptarget_pointer(HWND hwnd)
Definition: ole2.c:526
static BOOL OLEMenu_InstallHooks(DWORD tid)
Definition: ole2.c:1412
HRESULT WINAPI RegisterDragDrop(HWND hwnd, LPDROPTARGET pDropTarget)
Definition: ole2.c:547
HRESULT WINAPI DECLSPEC_HOTPATCH OleRun(LPUNKNOWN pUnknown)
Definition: ole2.c:1186
static HRESULT WINAPI EnumOLEVERB_QueryInterface(IEnumOLEVERB *iface, REFIID riid, void **ppv)
Definition: ole2.c:906
static const WCHAR prop_oledroptarget[]
Definition: ole2.c:114
static BOOL OLEMenu_FindMainMenuIndex(HMENU hMainMenu, HMENU hPopupMenu, UINT *pnPos)
Definition: ole2.c:1527
static ULONG WINAPI EnumOLEVERB_AddRef(IEnumOLEVERB *iface)
Definition: ole2.c:920
static LONG OLE_moduleLockCount
Definition: ole2.c:101
static HRESULT WINAPI DropTargetWrapper_DragLeave(IDropTarget *iface)
Definition: ole2.c:467
HRESULT WINAPI OleCreateLinkFromData(IDataObject *data, REFIID iid, DWORD renderopt, FORMATETC *fmt, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2.c:3027
HRESULT WINAPI OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
Definition: ole2.c:1358
HRESULT WINAPI OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained)
Definition: ole2.c:1149
static LRESULT CALLBACK OLEMenu_CallWndProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1609
static const IEnumOLEVERBVtbl EnumOLEVERB_VTable
Definition: ole2.c:1064
static HRESULT WINAPI DropTargetWrapper_DragEnter(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:434
static HANDLE get_droptarget_handle(HWND hwnd)
Definition: ole2.c:270
static OleMenuHookItem * OLEMenu_IsHookInstalled(DWORD tid)
Definition: ole2.c:1504
static HRESULT WINAPI DropTargetWrapper_DragOver(IDropTarget *iface, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:451
HRESULT WINAPI DoDragDrop(IDataObject *pDataObject, IDropSource *pDropSource, DWORD dwOKEffect, DWORD *pdwEffect)
Definition: ole2.c:737
static HRESULT WINAPI EnumOLEVERB_Next(IEnumOLEVERB *iface, ULONG celt, LPOLEVERB rgelt, ULONG *pceltFetched)
Definition: ole2.c:942
static HRESULT WINAPI DropTargetWrapper_Drop(IDropTarget *iface, IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: ole2.c:480
static void OLEDD_TrackStateChange(TrackerWindowInfo *trackerInfo)
Definition: ole2.c:2399
HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags, DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts, IAdviseSink *sink, DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2.c:2989
BOOL WINAPI IsAccelerator(HACCEL hAccel, int cAccelEntries, LPMSG lpMsg, WORD *lpwCmd)
Definition: ole2.c:1930
static ULONG WINAPI EnumOLEVERB_Release(IEnumOLEVERB *iface)
Definition: ole2.c:928
static HRESULT get_target_from_wrapper(IDropTarget *wrapper, IDropTarget **target)
Definition: ole2.c:425
static HRESULT WINAPI EnumOLEVERB_Reset(IEnumOLEVERB *iface)
Definition: ole2.c:1041
static const IDropTargetVtbl DropTargetWrapperVTbl
Definition: ole2.c:497
static LRESULT CALLBACK OLEMenu_GetMsgProc(INT code, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:1714
static void drag_end(TrackerWindowInfo *info)
Definition: ole2.c:2302
HRESULT WINAPI OleDraw(IUnknown *pUnk, DWORD dwAspect, HDC hdcDraw, LPCRECT rect)
Definition: ole2.c:2552
static ULONG WINAPI DropTargetWrapper_AddRef(IDropTarget *iface)
Definition: ole2.c:411
static HRESULT create_stream_from_map(HANDLE map, IStream **stream)
Definition: ole2.c:353
static void OLEUTL_ReadRegistryDWORDValue(HKEY regKey, DWORD *pdwValue)
Definition: ole2.c:2518
HRESULT WINAPI OleQueryCreateFromData(IDataObject *data)
Definition: ole2.c:2860
static HANDLE get_droptarget_local_handle(HWND hwnd)
Definition: ole2.c:298
static HRESULT EnumOLEVERB_Construct(HKEY hkeyVerb, ULONG index, IEnumOLEVERB **ppenum)
Definition: ole2.c:1075
void WINAPI DECLSPEC_HOTPATCH OleUninitialize(void)
Definition: ole2.c:218
static HRESULT create_map_from_stream(IStream *stream, HANDLE *map)
Definition: ole2.c:327
static HRESULT WINAPI EnumOLEVERB_Clone(IEnumOLEVERB *iface, IEnumOLEVERB **ppenum)
Definition: ole2.c:1052
struct tagOleMenuDescriptor OleMenuDescriptor
BOOL WINAPI OleIsRunning(LPOLEOBJECT object)
Definition: ole2.c:2803
DWORD WINAPI OleBuildVersion(void)
Definition: ole2.c:153
static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf, BOOL other_fmts)
Definition: ole2.c:2912
HRESULT WINAPI OleDestroyMenuDescriptor(HOLEMENU hmenuDescriptor)
Definition: ole2.c:1828
struct tagOleMenuHookItem OleMenuHookItem
HRESULT WINAPI OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
Definition: ole2.c:848
HOLEMENU WINAPI OleCreateMenuDescriptor(HMENU hmenuCombined, LPOLEMENUGROUPWIDTHS lpMenuWidths)
Definition: ole2.c:1793
static void OLEMenu_UnInitialize(void)
Definition: ole2.c:1401
static const WCHAR prop_marshalleddroptarget[]
Definition: ole2.c:117
HRESULT WINAPI OleCreateStaticFromData(IDataObject *data, REFIID iid, DWORD renderopt, FORMATETC *fmt, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2.c:3038
static OleMenuHookItem * hook_list
Definition: ole2.c:95
HRESULT WINAPI OleSave(LPPERSISTSTORAGE pPS, LPSTORAGE pStg, BOOL fSameAsLoad)
Definition: ole2.c:1319
static LRESULT WINAPI OLEDD_DragTrackerWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: ole2.c:2133
void WINAPI PropSysFreeString(LPOLESTR str)
Definition: ole2.c:2845
HRESULT WINAPI OleQueryLinkFromData(IDataObject *pSrcDataObject)
Definition: ole2.c:838
static void OLEMenu_Initialize(void)
Definition: ole2.c:1392
static DropTargetWrapper * impl_from_IDropTarget(IDropTarget *iface)
Definition: ole2.c:390
HRESULT WINAPI OleDoAutoConvert(LPSTORAGE pStg, LPCLSID pClsidNew)
Definition: ole2.c:2743
HRESULT WINAPI OleCreateFromFileEx(REFCLSID clsid, const OLECHAR *filename, REFIID iid, DWORD flags, DWORD renderopt, ULONG num_fmts, DWORD *adv_flags, FORMATETC *fmts, IAdviseSink *sink, DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2.c:3141
HRESULT WINAPI OleCreateFromData(IDataObject *data, REFIID iid, DWORD renderopt, FORMATETC *fmt, IOleClientSite *client_site, IStorage *stg, void **obj)
Definition: ole2.c:3015
HRESULT WINAPI OleLoad(LPSTORAGE pStg, REFIID riid, LPOLECLIENTSITE pClientSite, LPVOID *ppvObj)
Definition: ole2.c:1205
static HRESULT WINAPI EnumOLEVERB_Skip(IEnumOLEVERB *iface, ULONG celt)
Definition: ole2.c:1030
static BOOL OLEMenu_SetIsServerMenu(HMENU hmenu, OleMenuDescriptor *pOleMenuDescriptor)
Definition: ole2.c:1570
HRESULT WINAPI OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID *ppvObj)
Definition: ole2.c:2596
HANDLE WINAPI OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
Definition: ole2.c:3219
HRESULT WINAPI OleCreateFromFile(REFCLSID clsid, const OLECHAR *filename, REFIID iid, DWORD renderopt, FORMATETC *fmt, IOleClientSite *client_site, IStorage *storage, void **obj)
Definition: ole2.c:3207
HRESULT WINAPI OleRegEnumVerbs(REFCLSID clsid, LPENUMOLEVERB *ppenum)
Definition: ole2.c:1107
HRESULT WINAPI OleSetMenuDescriptor(HOLEMENU hOleMenu, HWND hwndFrame, HWND hwndActiveObject, LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEACTIVEOBJECT lpActiveObject)
Definition: ole2.c:1856
HRESULT WINAPI OleNoteObjectVisible(LPUNKNOWN pUnknown, BOOL bVisible)
Definition: ole2.c:2824
static void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed)
Definition: ole2.c:2896
HRESULT WINAPI OleTranslateAccelerator(LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo, LPMSG lpmsg)
Definition: ole2.c:2579
static const WCHAR prop_olemenuW[]
Definition: ole2.c:111
static void OLEDD_Initialize(void)
Definition: ole2.c:2106
static BOOL is_droptarget(HWND hwnd)
Definition: ole2.c:280
static HRESULT WINAPI DropTargetWrapper_QueryInterface(IDropTarget *iface, REFIID riid, void **ppvObject)
Definition: ole2.c:395
static DWORD OLEDD_GetButtonState(void)
Definition: ole2.c:2476
void clipbrd_uninitialize(void)
Definition: clipboard.c:2009
HRESULT WINAPI RevokeDragDrop(HWND hwnd)
Definition: ole2.c:629
static EnumOLEVERB * impl_from_IEnumOLEVERB(IEnumOLEVERB *iface)
Definition: ole2.c:901
HRESULT WINAPI OleInitializeWOW(DWORD x, DWORD y)
Definition: ole2.c:257
static BOOL OLEMenu_UnInstallHooks(DWORD tid)
Definition: ole2.c:1462
static const WCHAR OLEDD_DRAGTRACKERCLASS[]
Definition: ole2.c:106
HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
Definition: ole2.c:2691
BSTR WINAPI PropSysAllocString(LPCOLESTR str)
Definition: ole2.c:2835
HRESULT WINAPI ReadFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT *pcf, LPOLESTR *lplpszUserType)
Definition: storage32.c:9269
HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)
Definition: storage32.c:9226
HRESULT WINAPI SetConvertStg(IStorage *storage, BOOL convert)
Definition: storage32.c:10377
#define swprintf
Definition: precomp.h:40
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define pt(x, y)
Definition: drawing.c:79
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
_In_ PUNKNOWN pUnknown
Definition: drmk.h:76
HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, IMoniker **ppmk)
Definition: filemoniker.c:1360
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
int form
Definition: main.c:89
pKey DeleteObject()
FxCollectionEntry * cur
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLuint res
Definition: glext.h:9613
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLuint index
Definition: glext.h:6031
GLenum GLint GLuint mask
Definition: glext.h:6028
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLuint64EXT * result
Definition: glext.h:11304
GLenum GLsizei len
Definition: glext.h:6722
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
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define PROCESS_DUP_HANDLE
static TfClientId tid
HRESULT GetData([in, unique] FORMATETC *pformatetcIn, [out] STGMEDIUM *pmedium)
HRESULT QueryGetData([in, unique] FORMATETC *pformatetc)
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
#define REG_SZ
Definition: layer.c:22
if(dx< 0)
Definition: linetemp.h:194
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define ZeroMemory
Definition: minwinbase.h:31
LONG_PTR LPARAM
Definition: minwindef.h:175
LONG_PTR LRESULT
Definition: minwindef.h:176
UINT_PTR WPARAM
Definition: minwindef.h:174
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
HACCEL hAccel
Definition: main.c:47
static HDC
Definition: imagelist.c:88
static struct fmt fmts[]
HRESULT hres
Definition: protocol.c:465
static IOleClientSite * client_site
Definition: activex.c:198
static IViewObject viewobject
Definition: ole2.c:963
static IRunnableObject * runnable
Definition: ole2.c:76
static BSTR *static LPOLESTR
Definition: varformat.c:44
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
static DWORD tymed
Definition: url.c:174
static const LOGPALETTE logpalette
Definition: clipboard.c:1342
static HMENU hmenu
Definition: win.c:66
HMENU hMainMenu
Definition: mplay32.c:25
const CLSID * clsid
Definition: msctf.cpp:50
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define KEY_READ
Definition: nt_native.h:1026
#define REG_MULTI_SZ
Definition: nt_native.h:1504
#define KEY_WRITE
Definition: nt_native.h:1034
#define REG_EXPAND_SZ
Definition: nt_native.h:1497
@ COINIT_APARTMENTTHREADED
Definition: objbase.h:279
interface IStorage * LPSTORAGE
Definition: objfwd.h:30
interface IPersistStorage * LPPERSISTSTORAGE
Definition: objfwd.h:31
#define rup
Definition: ole2ver.h:42
#define rmm
Definition: ole2ver.h:41
HRESULT WINAPI BindMoniker(LPMONIKER pmk, DWORD grfOpt, REFIID riid, LPVOID *ppvResult)
Definition: bindctx.c:537
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
const GUID IID_IViewObject
const GUID IID_IOleCache
const GUID IID_IRunnableObject
const GUID IID_IOleCache2
const GUID IID_IDataObject
const GUID IID_IPersistStorage
const GUID IID_IOleLink
const GUID IID_IOleObject
const GUID IID_IEnumOLEVERB
#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
#define LOWORD(l)
Definition: pedump.c:82
#define WS_EX_ACCEPTFILES
Definition: pedump.c:648
#define WS_POPUP
Definition: pedump.c:616
long LONG
Definition: pedump.c:60
#define CLSID_NULL
Definition: guiddef.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
DWORD dwStatus
Definition: mediaobj.idl:95
_In_opt_ _In_opt_ _In_ _In_ DWORD cbData
Definition: shlwapi.h:761
const WCHAR * str
#define REG_DWORD
Definition: sdbapi.c:615
#define WARN_(ch,...)
Definition: debug.h:157
#define memset(x, y, z)
Definition: compat.h:39
int zero
Definition: sehframes.cpp:29
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
& rect
Definition: startmenu.cpp:1413
IDropTarget IDropTarget_iface
Definition: ole2.c:385
ULONG index
Definition: ole2.c:898
HKEY hkeyVerb
Definition: ole2.c:897
LONG y
Definition: windef.h:130
LONG x
Definition: windef.h:129
LPCWSTR lpszClassName
Definition: winuser.h:3287
HBRUSH hbrBackground
Definition: winuser.h:3285
int cbClsExtra
Definition: winuser.h:3280
UINT style
Definition: winuser.h:3278
WNDPROC lpfnWndProc
Definition: winuser.h:3279
int cbWndExtra
Definition: winuser.h:3281
HCURSOR hCursor
Definition: winuser.h:3284
Definition: cache.c:49
Definition: inflate.c:139
Definition: dsound.c:943
Definition: copy.c:22
Definition: send.c:48
Definition: stat.h:66
Definition: parse.h:23
WORD cmd
Definition: winuser.h:3027
BYTE fVirt
Definition: winuser.h:3025
LPVOID bmBits
Definition: wingdi.h:1873
LPVOID lpCreateParams
Definition: winuser.h:3042
LPARAM lParam
Definition: winuser.h:3127
WPARAM wParam
Definition: winuser.h:3128
UINT message
Definition: winuser.h:3129
WORD palNumEntries
Definition: wingdi.h:2280
WORD palVersion
Definition: wingdi.h:2279
HMETAFILE hMF
Definition: wingdi.h:3054
UINT message
Definition: winuser.h:3217
HWND hwnd
Definition: winuser.h:3216
WPARAM wParam
Definition: winuser.h:3218
LPARAM lParam
Definition: winuser.h:3219
BOOL bIsServerItem
Definition: ole2.c:83
HMENU hmenuCombined
Definition: ole2.c:82
HWND hwndActiveObject
Definition: ole2.c:80
OLEMENUGROUPWIDTHS mgw
Definition: ole2.c:81
HANDLE hHeap
Definition: ole2.c:89
HHOOK GetMsg_hHook
Definition: ole2.c:90
HHOOK CallWndProc_hHook
Definition: ole2.c:91
struct tagOleMenuHookItem * next
Definition: ole2.c:92
HWND curTargetHWND
Definition: ole2.c:68
BOOL trackingDone
Definition: ole2.c:63
POINTL curMousePos
Definition: ole2.c:73
BOOL inTrackCall
Definition: ole2.c:64
IDropTarget * curDragTarget
Definition: ole2.c:69
DWORD dwKeyState
Definition: ole2.c:74
IDataObject * dataObject
Definition: ole2.c:59
IDropSource * dropSource
Definition: ole2.c:60
HRESULT returnValue
Definition: ole2.c:65
DWORD dwOKEffect
Definition: ole2.c:61
DWORD * pdwEffect
Definition: ole2.c:62
Definition: tools.h:99
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
ULONG_PTR SIZE_T
Definition: typedefs.h:80
int32_t INT
Definition: typedefs.h:58
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
SIZE_T NTAPI VirtualQuery(IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
Definition: virtmem.c:211
UINT WINAPI GetPaletteEntries(HPALETTE hpal, UINT iStartIndex, UINT cEntries, LPPALETTEENTRY ppe)
Definition: palette.c:64
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define FILE_MAP_WRITE
Definition: winbase.h:156
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1156
#define GMEM_ZEROINIT
Definition: winbase.h:330
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
#define GMEM_MOVEABLE
Definition: winbase.h:318
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837
HICON HCURSOR
Definition: windef.h:99
#define WINAPI
Definition: msvc.h:6
#define REGDB_E_CLASSNOTREG
Definition: winerror.h:3801
#define DRAGDROP_E_ALREADYREGISTERED
Definition: winerror.h:3762
#define OLE_S_STATIC
Definition: winerror.h:3724
#define S_FALSE
Definition: winerror.h:3451
#define DRAGDROP_S_USEDEFAULTCURSORS
Definition: winerror.h:3763
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210
#define DRAGDROP_S_DROP
Definition: winerror.h:3758
#define E_NOINTERFACE
Definition: winerror.h:3479
#define DRAGDROP_E_NOTREGISTERED
Definition: winerror.h:3760
#define DRAGDROP_E_INVALIDHWND
Definition: winerror.h:3764
#define REGDB_E_READREGDB
Definition: winerror.h:3797
#define REGDB_E_WRITEREGDB
Definition: winerror.h:3798
#define OLEOBJ_E_NOVERBS
Definition: winerror.h:3840
#define DRAGDROP_S_CANCEL
Definition: winerror.h:3761
#define E_UNEXPECTED
Definition: winerror.h:3528
#define DV_E_CLIPFORMAT
Definition: winerror.h:3750
#define OLEOBJ_E_INVALIDVERB
Definition: winerror.h:3842
#define REGDB_E_KEYMISSING
Definition: winerror.h:3799
#define DV_E_NOIVIEWOBJECT
Definition: winerror.h:3753
BOOL WINAPI DeleteMetaFile(_In_ HMETAFILE)
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
BOOL WINAPI DeleteEnhMetaFile(_In_opt_ HENHMETAFILE)
HPALETTE WINAPI CreatePalette(_In_reads_(_Inexpressible_(2 *sizeof(WORD)+plpal->palNumEntries *sizeof(PALETTEENTRY))) const LOGPALETTE *)
HBITMAP WINAPI CreateBitmapIndirect(_In_ const BITMAP *pbm)
HENHMETAFILE WINAPI CopyEnhMetaFileW(_In_ HENHMETAFILE hemfSrc, _In_opt_ LPCWSTR pszFile)
HMETAFILE WINAPI CopyMetaFileW(_In_ HMETAFILE hmfSrc, _In_opt_ LPCWSTR pszFile)
LONG WINAPI GetBitmapBits(_In_ HBITMAP hbit, _In_ LONG cb, _Out_writes_bytes_(cb) LPVOID lpvBits)
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
HWND WINAPI SetCapture(_In_ HWND hWnd)
#define MK_RBUTTON
Definition: winuser.h:2404
BOOL WINAPI IsWindow(_In_opt_ HWND)
#define MK_SHIFT
Definition: winuser.h:2405
#define WM_QUIT
Definition: winuser.h:1651
HANDLE WINAPI RemovePropW(_In_ HWND, _In_ LPCWSTR)
BOOL WINAPI ReleaseCapture(void)
Definition: message.c:2890
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_CREATE
Definition: winuser.h:1636
HHOOK WINAPI SetWindowsHookExW(_In_ int, _In_ HOOKPROC, _In_opt_ HINSTANCE, _In_ DWORD)
__analysis_noreturn void WINAPI PostQuitMessage(_In_ int)
#define WM_DROPFILES
Definition: winuser.h:1853
#define WM_COMMAND
Definition: winuser.h:1768
struct tagCREATESTRUCTA * LPCREATESTRUCTA
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
#define VK_RBUTTON
Definition: winuser.h:2227
int WINAPI CopyAcceleratorTableW(_In_ HACCEL hAccelSrc, _Out_writes_to_opt_(cAccelEntries, return) LPACCEL lpAccelDst, _In_ int cAccelEntries)
#define WM_KEYFIRST
Definition: winuser.h:1742
#define VK_CONTROL
Definition: winuser.h:2239
#define HC_ACTION
Definition: winuser.h:48
#define WM_RBUTTONUP
Definition: winuser.h:1808
HCURSOR WINAPI SetCursor(_In_opt_ HCURSOR)
#define WM_MOUSEMOVE
Definition: winuser.h:1803
#define VK_MBUTTON
Definition: winuser.h:2229
#define WM_INITMENU
Definition: winuser.h:1773
#define MF_SYSMENU
Definition: winuser.h:141
#define GetWindowLongPtrA
Definition: winuser.h:4930
_Check_return_ BOOL WINAPI GetKeyboardState(_Out_writes_(256) PBYTE lpKeyState)
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2474
#define FVIRTKEY
Definition: winuser.h:24
#define MF_POPUP
Definition: winuser.h:136
#define WM_DRAWITEM
Definition: winuser.h:1673
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
struct tagCWPSTRUCT * LPCWPSTRUCT
#define WM_RBUTTONDOWN
Definition: winuser.h:1807
#define FSHIFT
Definition: winuser.h:23
BOOL WINAPI IsWindowUnicode(_In_ HWND)
#define MK_MBUTTON
Definition: winuser.h:2407
#define WM_SYSCHAR
Definition: winuser.h:1749
HMENU WINAPI GetSubMenu(_In_ HMENU, _In_ int)
#define WM_INITMENUPOPUP
Definition: winuser.h:1774
#define MK_CONTROL
Definition: winuser.h:2406
BOOL WINAPI UnhookWindowsHookEx(_In_ HHOOK)
#define WM_TIMER
Definition: winuser.h:1770
BOOL WINAPI SetPropW(_In_ HWND, _In_ LPCWSTR, _In_opt_ HANDLE)
#define FCONTROL
Definition: winuser.h:21
#define GetWindowLong
Definition: winuser.h:5907
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4418
#define WM_LBUTTONUP
Definition: winuser.h:1805
struct tagMSG * LPMSG
#define WM_CHAR
Definition: winuser.h:1745
#define CW_USEDEFAULT
Definition: winuser.h:225
#define WH_GETMESSAGE
Definition: winuser.h:33
HWND WINAPI GetParent(_In_ HWND)
HANDLE WINAPI GetPropW(_In_ HWND, _In_ LPCWSTR)
#define CS_GLOBALCLASS
Definition: winuser.h:660
LRESULT WINAPI CallNextHookEx(_In_opt_ HHOOK, _In_ int, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
HWND WINAPI WindowFromPoint(_In_ POINT)
#define MK_LBUTTON
Definition: winuser.h:2403
#define VK_SHIFT
Definition: winuser.h:2238
#define WM_DESTROY
Definition: winuser.h:1637
#define WM_KEYDOWN
Definition: winuser.h:1743
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
#define FALT
Definition: winuser.h:20
#define SetWindowLongPtrW
Definition: winuser.h:5457
#define WM_MBUTTONUP
Definition: winuser.h:1811
#define WM_KEYLAST
Definition: winuser.h:1756
#define WM_MENUSELECT
Definition: winuser.h:1775
#define VK_ESCAPE
Definition: winuser.h:2250
BOOL WINAPI DestroyWindow(_In_ HWND)
#define ODT_MENU
Definition: winuser.h:2573
BOOL WINAPI PostMessageA(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define WM_MBUTTONDOWN
Definition: winuser.h:1810
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
SHORT WINAPI GetKeyState(_In_ int)
#define VK_MENU
Definition: winuser.h:2240
#define WH_CALLWNDPROC
Definition: winuser.h:34
#define GWL_EXSTYLE
Definition: winuser.h:862
#define VK_LBUTTON
Definition: winuser.h:2226
#define DUPLICATE_SAME_ACCESS
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
unsigned char BYTE
Definition: xxhash.c:193