ReactOS 0.4.16-dev-2354-g16de117
defaulthandler.c
Go to the documentation of this file.
1/*
2 * OLE 2 default object handler
3 *
4 * Copyright 1999 Francis Beaudet
5 * Copyright 2000 Abey George
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 *
21 * NOTES:
22 * The OLE2 default object handler supports a whole whack of
23 * interfaces including:
24 * IOleObject, IDataObject, IPersistStorage, IViewObject2,
25 * IRunnableObject, IOleCache2, IOleCacheControl and much more.
26 *
27 * All the implementation details are taken from: Inside OLE
28 * second edition by Kraig Brockschmidt,
29 *
30 * TODO
31 * - This implementation of the default handler does not launch the
32 * server in the DoVerb, Update, GetData, GetDataHere and Run
33 * methods. When it is fixed to do so, all the methods will have
34 * to be revisited to allow delegating to the running object
35 *
36 * - All methods in the class that use the class ID should be
37 * aware that it is possible for a class to be treated as
38 * another one and go into emulation mode. Nothing has been
39 * done in this area.
40 *
41 * - Some functions still return E_NOTIMPL they have to be
42 * implemented. Most of those are related to the running of the
43 * actual server.
44 *
45 * - All the methods related to notification and advise sinks are
46 * in place but no notifications are sent to the sinks yet.
47 */
48#include <assert.h>
49#include <stdarg.h>
50#include <string.h>
51
52#define COBJMACROS
53
54#include "windef.h"
55#include "winbase.h"
56#include "winuser.h"
57#include "winerror.h"
58#include "ole2.h"
59
60#include "compobj_private.h"
61#include "storage32.h"
62
63#include "wine/debug.h"
64
66
68{
72};
73
75{
79};
80
81/****************************************************************************
82 * DefaultHandler
83 *
84 */
86{
93
94 /* Reference count of this object */
96
97 /* IUnknown implementation of the outer object. */
99
100 /* Class Id that this handler object represents. */
102
103 /* IUnknown implementation of the datacache. */
105 /* IPersistStorage implementation of the datacache. */
107
108 /* Client site for the embedded object. */
110
111 /*
112 * The IOleAdviseHolder maintains the connections
113 * on behalf of the default handler.
114 */
116
117 /*
118 * The IDataAdviseHolder maintains the data
119 * connections on behalf of the default handler.
120 */
122
123 /* Name of the container and object contained */
126
127 /* IOleObject delegate */
129 /* IPersistStorage delegate */
131 /* IDataObject delegate */
135
136 /* connection cookie for the advise on the delegate OLE object */
138
139 /* storage passed to Load or InitNew */
142
143 /* optional class factory for object */
145 /* TRUE if acting as an inproc server instead of an inproc handler */
147};
148
150
152{
154}
155
157{
159}
160
162{
164}
165
167{
169}
170
172{
174}
175
177{
179}
180
182
184{
185 return IRunnableObject_IsRunning(&This->IRunnableObject_iface);
186}
187
189
191{
192 This->in_call++;
193}
194
196{
197 This->in_call--;
198 if (This->in_call == 0 && This->object_state == object_state_deferred_close)
200}
201
202/*********************************************************
203 * Method implementation for the non delegating IUnknown
204 * part of the DefaultHandler class.
205 */
206
207/************************************************************************
208 * DefaultHandler_NDIUnknown_QueryInterface (IUnknown)
209 *
210 * See Windows documentation for more details on IUnknown methods.
211 *
212 * This version of QueryInterface will not delegate its implementation
213 * to the outer unknown.
214 */
216 IUnknown* iface,
217 REFIID riid,
218 void** ppvObject)
219{
221
222 if (!ppvObject)
223 return E_INVALIDARG;
224
225 *ppvObject = NULL;
226
228 *ppvObject = iface;
229 else if (IsEqualIID(&IID_IOleObject, riid))
230 *ppvObject = &This->IOleObject_iface;
231 else if (IsEqualIID(&IID_IDataObject, riid))
232 *ppvObject = &This->IDataObject_iface;
234 *ppvObject = &This->IRunnableObject_iface;
235 else if (IsEqualIID(&IID_IPersist, riid) ||
237 *ppvObject = &This->IPersistStorage_iface;
238 else if (IsEqualIID(&IID_IViewObject, riid) ||
242 {
243 HRESULT hr = IUnknown_QueryInterface(This->dataCache, riid, ppvObject);
244 if (FAILED(hr)) FIXME("interface %s not implemented by data cache\n", debugstr_guid(riid));
245 return hr;
246 }
247 else if (This->inproc_server && This->pOleDelegate)
248 {
249 return IOleObject_QueryInterface(This->pOleDelegate, riid, ppvObject);
250 }
251
252 /* Check that we obtained an interface. */
253 if (*ppvObject == NULL)
254 {
255 WARN( "() : asking for unsupported interface %s\n", debugstr_guid(riid));
256 return E_NOINTERFACE;
257 }
258
259 /*
260 * Query Interface always increases the reference count by one when it is
261 * successful.
262 */
263 IUnknown_AddRef((IUnknown*)*ppvObject);
264
265 return S_OK;
266}
267
268/************************************************************************
269 * DefaultHandler_NDIUnknown_AddRef (IUnknown)
270 *
271 * See Windows documentation for more details on IUnknown methods.
272 *
273 * This version of QueryInterface will not delegate its implementation
274 * to the outer unknown.
275 */
277 IUnknown* iface)
278{
280 return InterlockedIncrement(&This->ref);
281}
282
283/************************************************************************
284 * DefaultHandler_NDIUnknown_Release (IUnknown)
285 *
286 * See Windows documentation for more details on IUnknown methods.
287 *
288 * This version of QueryInterface will not delegate its implementation
289 * to the outer unknown.
290 */
292 IUnknown* iface)
293{
295 ULONG ref;
296
298
300
301 return ref;
302}
303
304/*********************************************************
305 * Methods implementation for the IOleObject part of
306 * the DefaultHandler class.
307 */
308
309/************************************************************************
310 * DefaultHandler_QueryInterface (IUnknown)
311 *
312 * See Windows documentation for more details on IUnknown methods.
313 */
315 IOleObject* iface,
316 REFIID riid,
317 void** ppvObject)
318{
320
321 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
322}
323
324/************************************************************************
325 * DefaultHandler_AddRef (IUnknown)
326 *
327 * See Windows documentation for more details on IUnknown methods.
328 */
330 IOleObject* iface)
331{
333
334 return IUnknown_AddRef(This->outerUnknown);
335}
336
337/************************************************************************
338 * DefaultHandler_Release (IUnknown)
339 *
340 * See Windows documentation for more details on IUnknown methods.
341 */
343 IOleObject* iface)
344{
346
347 return IUnknown_Release(This->outerUnknown);
348}
349
350/************************************************************************
351 * DefaultHandler_SetClientSite (IOleObject)
352 *
353 * The default handler's implementation of this method only keeps the
354 * client site pointer for future reference.
355 *
356 * See Windows documentation for more details on IOleObject methods.
357 */
359 IOleObject* iface,
360 IOleClientSite* pClientSite)
361{
363 HRESULT hr = S_OK;
364
365 TRACE("(%p, %p)\n", iface, pClientSite);
366
368 {
370 hr = IOleObject_SetClientSite(This->pOleDelegate, pClientSite);
372 }
373
374 /*
375 * Make sure we release the previous client site if there
376 * was one.
377 */
378 if (This->clientSite)
379 IOleClientSite_Release(This->clientSite);
380
381 This->clientSite = pClientSite;
382
383 if (This->clientSite)
384 IOleClientSite_AddRef(This->clientSite);
385
386 return hr;
387}
388
389/************************************************************************
390 * DefaultHandler_GetClientSite (IOleObject)
391 *
392 * The default handler's implementation of this method returns the
393 * last pointer set in IOleObject_SetClientSite.
394 *
395 * See Windows documentation for more details on IOleObject methods.
396 */
398 IOleObject* iface,
399 IOleClientSite** ppClientSite)
400{
402
403 if (!ppClientSite)
404 return E_POINTER;
405
406 *ppClientSite = This->clientSite;
407
408 if (This->clientSite)
409 IOleClientSite_AddRef(This->clientSite);
410
411 return S_OK;
412}
413
414/************************************************************************
415 * DefaultHandler_SetHostNames (IOleObject)
416 *
417 * The default handler's implementation of this method just stores
418 * the strings and returns S_OK.
419 *
420 * See Windows documentation for more details on IOleObject methods.
421 */
423 IOleObject* iface,
424 LPCOLESTR szContainerApp,
425 LPCOLESTR szContainerObj)
426{
428
429 TRACE("(%p, %s, %s)\n",
430 iface,
431 debugstr_w(szContainerApp),
432 debugstr_w(szContainerObj));
433
435 {
437 IOleObject_SetHostNames(This->pOleDelegate, szContainerApp, szContainerObj);
439 }
440
441 /* Be sure to cleanup before re-assigning the strings. */
442 HeapFree( GetProcessHeap(), 0, This->containerApp );
443 This->containerApp = NULL;
444 HeapFree( GetProcessHeap(), 0, This->containerObj );
445 This->containerObj = NULL;
446
447 if (szContainerApp)
448 {
449 if ((This->containerApp = HeapAlloc( GetProcessHeap(), 0,
450 (lstrlenW(szContainerApp) + 1) * sizeof(WCHAR) )))
451 lstrcpyW( This->containerApp, szContainerApp );
452 }
453
454 if (szContainerObj)
455 {
456 if ((This->containerObj = HeapAlloc( GetProcessHeap(), 0,
457 (lstrlenW(szContainerObj) + 1) * sizeof(WCHAR) )))
458 lstrcpyW( This->containerObj, szContainerObj );
459 }
460 return S_OK;
461}
462
464{
465 if (This->pDataDelegate)
466 {
467 IDataObject_Release(This->pDataDelegate);
468 This->pDataDelegate = NULL;
469 }
470 if (This->pPSDelegate)
471 {
472 IPersistStorage_Release(This->pPSDelegate);
473 This->pPSDelegate = NULL;
474 }
475 if (This->pOleDelegate)
476 {
477 IOleObject_Release(This->pOleDelegate);
478 This->pOleDelegate = NULL;
479 }
480}
481
482/* undoes the work done by DefaultHandler_Run */
484{
485 IOleCacheControl *cache_ctrl;
486 HRESULT hr;
487
488 if (This->object_state == object_state_not_running)
489 return;
490
491 hr = IUnknown_QueryInterface( This->dataCache, &IID_IOleCacheControl, (void **)&cache_ctrl );
492 if (SUCCEEDED(hr))
493 {
494 hr = IOleCacheControl_OnStop( cache_ctrl );
495 IOleCacheControl_Release( cache_ctrl );
496 }
497
498 IOleObject_Unadvise(This->pOleDelegate, This->dwAdvConn);
499
500 if (This->dataAdviseHolder)
501 DataAdviseHolder_OnDisconnect(This->dataAdviseHolder);
502
503 This->object_state = object_state_not_running;
505}
506
507/************************************************************************
508 * DefaultHandler_Close (IOleObject)
509 *
510 * The default handler's implementation of this method is meaningless
511 * without a running server so it does nothing.
512 *
513 * See Windows documentation for more details on IOleObject methods.
514 */
516 IOleObject* iface,
517 DWORD dwSaveOption)
518{
520 HRESULT hr;
521
522 TRACE("%ld\n", dwSaveOption);
523
525 return S_OK;
526
528 hr = IOleObject_Close(This->pOleDelegate, dwSaveOption);
530
532
533 return hr;
534}
535
536/************************************************************************
537 * DefaultHandler_SetMoniker (IOleObject)
538 *
539 * The default handler's implementation of this method does nothing.
540 *
541 * See Windows documentation for more details on IOleObject methods.
542 */
544 IOleObject* iface,
545 DWORD dwWhichMoniker,
546 IMoniker* pmk)
547{
549 HRESULT hr = S_OK;
550
551 TRACE("%p, %ld, %p.\n", iface, dwWhichMoniker, pmk);
552
554 {
556 hr = IOleObject_SetMoniker(This->pOleDelegate, dwWhichMoniker, pmk);
558 }
559
560 return hr;
561}
562
563/************************************************************************
564 * DefaultHandler_GetMoniker (IOleObject)
565 *
566 * Delegate this request to the client site if we have one.
567 *
568 * See Windows documentation for more details on IOleObject methods.
569 */
571 IOleObject* iface,
572 DWORD dwAssign,
573 DWORD dwWhichMoniker,
574 IMoniker** ppmk)
575{
577 HRESULT hr;
578
579 TRACE("%p, %ld, %ld, %p.\n", iface, dwAssign, dwWhichMoniker, ppmk);
580
582 {
584 hr = IOleObject_GetMoniker(This->pOleDelegate, dwAssign, dwWhichMoniker,
585 ppmk);
587 return hr;
588 }
589
590 /* FIXME: dwWhichMoniker == OLEWHICHMK_CONTAINER only? */
591 if (This->clientSite)
592 {
593 return IOleClientSite_GetMoniker(This->clientSite,
594 dwAssign,
595 dwWhichMoniker,
596 ppmk);
597
598 }
599
600 return E_FAIL;
601}
602
603/************************************************************************
604 * DefaultHandler_InitFromData (IOleObject)
605 *
606 * This method is meaningless if the server is not running
607 *
608 * See Windows documentation for more details on IOleObject methods.
609 */
611 IOleObject* iface,
612 IDataObject* pDataObject,
613 BOOL fCreation,
615{
618
619 TRACE("%p, %p, %d, %ld.\n", iface, pDataObject, fCreation, dwReserved);
620
622 {
624 hr = IOleObject_InitFromData(This->pOleDelegate, pDataObject, fCreation,
625 dwReserved);
627 }
628
629 return hr;
630}
631
632/************************************************************************
633 * DefaultHandler_GetClipboardData (IOleObject)
634 *
635 * This method is meaningless if the server is not running
636 *
637 * See Windows documentation for more details on IOleObject methods.
638 */
640 IOleObject* iface,
642 IDataObject** ppDataObject)
643{
646
647 TRACE("%p, %ld, %p.\n", iface, dwReserved, ppDataObject);
648
650 {
652 hr = IOleObject_GetClipboardData(This->pOleDelegate, dwReserved,
653 ppDataObject);
655 }
656
657 return hr;
658}
659
661 IOleObject* iface,
662 LONG iVerb,
663 struct tagMSG* lpmsg,
664 IOleClientSite* pActiveSite,
665 LONG lindex,
667 LPCRECT lprcPosRect)
668{
670 IRunnableObject *pRunnableObj = &This->IRunnableObject_iface;
671 HRESULT hr;
672
673 TRACE("%ld, %p, %p, %ld, %p, %s.\n", iVerb, lpmsg, pActiveSite, lindex, hwndParent, wine_dbgstr_rect(lprcPosRect));
674
675 hr = IRunnableObject_Run(pRunnableObj, NULL);
676 if (FAILED(hr)) return hr;
677
679 hr = IOleObject_DoVerb(This->pOleDelegate, iVerb, lpmsg, pActiveSite,
680 lindex, hwndParent, lprcPosRect);
682
683 return hr;
684}
685
686/************************************************************************
687 * DefaultHandler_EnumVerbs (IOleObject)
688 *
689 * The default handler implementation of this method simply delegates
690 * to OleRegEnumVerbs
691 *
692 * See Windows documentation for more details on IOleObject methods.
693 */
695 IOleObject* iface,
696 IEnumOLEVERB** ppEnumOleVerb)
697{
700
701 TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
702
704 {
706 hr = IOleObject_EnumVerbs(This->pOleDelegate, ppEnumOleVerb);
708 }
709
710 if (hr == OLE_S_USEREG)
711 return OleRegEnumVerbs(&This->clsid, ppEnumOleVerb);
712 else
713 return hr;
714}
715
717 IOleObject* iface)
718{
720 HRESULT hr;
721
722 TRACE("(%p)\n", iface);
723
725 {
726 FIXME("Should run object\n");
727 return E_NOTIMPL;
728 }
729
731 hr = IOleObject_Update(This->pOleDelegate);
733
734 return hr;
735}
736
737/************************************************************************
738 * DefaultHandler_IsUpToDate (IOleObject)
739 *
740 * This method is meaningless if the server is not running
741 *
742 * See Windows documentation for more details on IOleObject methods.
743 */
745 IOleObject* iface)
746{
749 TRACE("(%p)\n", iface);
750
752 {
754 hr = IOleObject_IsUpToDate(This->pOleDelegate);
756 }
757
758 return hr;
759}
760
761/************************************************************************
762 * DefaultHandler_GetUserClassID (IOleObject)
763 *
764 * TODO: Map to a new class ID if emulation is active.
765 *
766 * See Windows documentation for more details on IOleObject methods.
767 */
769 IOleObject* iface,
770 CLSID* pClsid)
771{
773 HRESULT hr;
774
775 TRACE("(%p, %p)\n", iface, pClsid);
776
778 {
780 hr = IOleObject_GetUserClassID(This->pOleDelegate, pClsid);
782 return hr;
783 }
784
785 if (!pClsid)
786 return E_POINTER;
787
788 *pClsid = This->clsid;
789
790 return S_OK;
791}
792
793/************************************************************************
794 * DefaultHandler_GetUserType (IOleObject)
795 *
796 * The default handler implementation of this method simply delegates
797 * to OleRegGetUserType
798 *
799 * See Windows documentation for more details on IOleObject methods.
800 */
802 IOleObject* iface,
803 DWORD dwFormOfType,
804 LPOLESTR* pszUserType)
805{
807 HRESULT hr;
808
809 TRACE("%p, %ld, %p.\n", iface, dwFormOfType, pszUserType);
811 {
813 hr = IOleObject_GetUserType(This->pOleDelegate, dwFormOfType, pszUserType);
815 return hr;
816 }
817
818 return OleRegGetUserType(&This->clsid, dwFormOfType, pszUserType);
819}
820
821/************************************************************************
822 * DefaultHandler_SetExtent (IOleObject)
823 *
824 * This method is meaningless if the server is not running
825 *
826 * See Windows documentation for more details on IOleObject methods.
827 */
829 IOleObject* iface,
830 DWORD dwDrawAspect,
831 SIZEL* psizel)
832{
835
836 TRACE("%p, %lx, (%ld x %ld))\n", iface, dwDrawAspect, psizel->cx, psizel->cy);
837
839 {
841 hr = IOleObject_SetExtent(This->pOleDelegate, dwDrawAspect, psizel);
843 }
844
845 return hr;
846}
847
848/************************************************************************
849 * DefaultHandler_GetExtent (IOleObject)
850 *
851 * The default handler's implementation of this method returns uses
852 * the cache to locate the aspect and extract the extent from it.
853 *
854 * See Windows documentation for more details on IOleObject methods.
855 */
857 IOleObject* iface,
858 DWORD dwDrawAspect,
859 SIZEL* psizel)
860{
861 DVTARGETDEVICE* targetDevice;
862 IViewObject2* cacheView = NULL;
864
866
867 TRACE("%p, %lx, %p.\n", iface, dwDrawAspect, psizel);
868
870 {
872 hres = IOleObject_GetExtent(This->pOleDelegate, dwDrawAspect, psizel);
874 return hres;
875 }
876
877 hres = IUnknown_QueryInterface(This->dataCache, &IID_IViewObject2, (void**)&cacheView);
878 if (FAILED(hres))
879 return E_UNEXPECTED;
880
881 /*
882 * Prepare the call to the cache's GetExtent method.
883 *
884 * Here we would build a valid DVTARGETDEVICE structure
885 * but, since we are calling into the data cache, we
886 * know its implementation and we'll skip this
887 * extra work until later.
888 */
889 targetDevice = NULL;
890
891 hres = IViewObject2_GetExtent(cacheView,
892 dwDrawAspect,
893 -1,
894 targetDevice,
895 psizel);
896
897 IViewObject2_Release(cacheView);
898
899 return hres;
900}
901
902/************************************************************************
903 * DefaultHandler_Advise (IOleObject)
904 *
905 * The default handler's implementation of this method simply
906 * delegates to the OleAdviseHolder.
907 *
908 * See Windows documentation for more details on IOleObject methods.
909 */
911 IOleObject* iface,
912 IAdviseSink* pAdvSink,
913 DWORD* pdwConnection)
914{
915 HRESULT hres = S_OK;
917
918 TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
919
920 /* Make sure we have an advise holder before we start. */
921 if (!This->oleAdviseHolder)
922 hres = CreateOleAdviseHolder(&This->oleAdviseHolder);
923
924 if (SUCCEEDED(hres))
925 hres = IOleAdviseHolder_Advise(This->oleAdviseHolder,
926 pAdvSink,
927 pdwConnection);
928
929 return hres;
930}
931
932/************************************************************************
933 * DefaultHandler_Unadvise (IOleObject)
934 *
935 * The default handler's implementation of this method simply
936 * delegates to the OleAdviseHolder.
937 *
938 * See Windows documentation for more details on IOleObject methods.
939 */
941 IOleObject* iface,
942 DWORD dwConnection)
943{
945
946 TRACE("%p, %ld.\n", iface, dwConnection);
947
948 /*
949 * If we don't have an advise holder yet, it means we don't have
950 * a connection.
951 */
952 if (!This->oleAdviseHolder)
953 return OLE_E_NOCONNECTION;
954
955 return IOleAdviseHolder_Unadvise(This->oleAdviseHolder,
956 dwConnection);
957}
958
959/************************************************************************
960 * DefaultHandler_EnumAdvise (IOleObject)
961 *
962 * The default handler's implementation of this method simply
963 * delegates to the OleAdviseHolder.
964 *
965 * See Windows documentation for more details on IOleObject methods.
966 */
968 IOleObject* iface,
969 IEnumSTATDATA** ppenumAdvise)
970{
972
973 TRACE("(%p, %p)\n", iface, ppenumAdvise);
974
975 if (!ppenumAdvise)
976 return E_POINTER;
977
978 *ppenumAdvise = NULL;
979
980 if (!This->oleAdviseHolder)
981 return S_OK;
982
983 return IOleAdviseHolder_EnumAdvise(This->oleAdviseHolder, ppenumAdvise);
984}
985
986/************************************************************************
987 * DefaultHandler_GetMiscStatus (IOleObject)
988 *
989 * The default handler's implementation of this method simply delegates
990 * to OleRegGetMiscStatus.
991 *
992 * See Windows documentation for more details on IOleObject methods.
993 */
995 IOleObject* iface,
996 DWORD dwAspect,
997 DWORD* pdwStatus)
998{
1001
1002 TRACE("%p, %lx, %p.\n", iface, dwAspect, pdwStatus);
1003
1005 {
1007 hres = IOleObject_GetMiscStatus(This->pOleDelegate, dwAspect, pdwStatus);
1009 return hres;
1010 }
1011
1012 hres = OleRegGetMiscStatus(&This->clsid, dwAspect, pdwStatus);
1013
1014 if (FAILED(hres))
1015 *pdwStatus = 0;
1016
1017 return hres;
1018}
1019
1020/************************************************************************
1021 * DefaultHandler_SetColorScheme (IOleObject)
1022 *
1023 * This method is meaningless if the server is not running
1024 *
1025 * See Windows documentation for more details on IOleObject methods.
1026 */
1028 IOleObject* iface,
1029 struct tagLOGPALETTE* pLogpal)
1030{
1033
1034 TRACE("(%p, %p))\n", iface, pLogpal);
1035
1037 {
1039 hr = IOleObject_SetColorScheme(This->pOleDelegate, pLogpal);
1041 }
1042
1043 return hr;
1044}
1045
1046/*********************************************************
1047 * Methods implementation for the IDataObject part of
1048 * the DefaultHandler class.
1049 */
1050
1051/************************************************************************
1052 * DefaultHandler_IDataObject_QueryInterface (IUnknown)
1053 *
1054 * See Windows documentation for more details on IUnknown methods.
1055 */
1057 IDataObject* iface,
1058 REFIID riid,
1059 void** ppvObject)
1060{
1062
1063 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
1064}
1065
1066/************************************************************************
1067 * DefaultHandler_IDataObject_AddRef (IUnknown)
1068 *
1069 * See Windows documentation for more details on IUnknown methods.
1070 */
1072 IDataObject* iface)
1073{
1075
1076 return IUnknown_AddRef(This->outerUnknown);
1077}
1078
1079/************************************************************************
1080 * DefaultHandler_IDataObject_Release (IUnknown)
1081 *
1082 * See Windows documentation for more details on IUnknown methods.
1083 */
1085 IDataObject* iface)
1086{
1088
1089 return IUnknown_Release(This->outerUnknown);
1090}
1091
1092/************************************************************************
1093 * DefaultHandler_GetData
1094 *
1095 * Get Data from a source dataobject using format pformatetcIn->cfFormat
1096 * See Windows documentation for more details on GetData.
1097 * Default handler's implementation of this method delegates to the cache.
1098 */
1100 IDataObject* iface,
1101 LPFORMATETC pformatetcIn,
1102 STGMEDIUM* pmedium)
1103{
1104 IDataObject* cacheDataObject = NULL;
1105 HRESULT hres;
1106
1108
1109 TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pmedium);
1110
1111 hres = IUnknown_QueryInterface(This->dataCache,
1113 (void**)&cacheDataObject);
1114
1115 if (FAILED(hres))
1116 return E_UNEXPECTED;
1117
1118 hres = IDataObject_GetData(cacheDataObject,
1119 pformatetcIn,
1120 pmedium);
1121
1122 IDataObject_Release(cacheDataObject);
1123
1124 if (hres == S_OK) return hres;
1125
1126 if (object_is_running( This ))
1127 {
1129 hres = IDataObject_GetData(This->pDataDelegate, pformatetcIn, pmedium);
1131 if (hres == S_OK) return hres;
1132 }
1133
1134 /* Query running state again, as the object may have closed during _GetData call */
1135 if (!object_is_running( This ))
1137
1138 return hres;
1139}
1140
1142 IDataObject* iface,
1143 LPFORMATETC pformatetc,
1144 STGMEDIUM* pmedium)
1145{
1146 FIXME(": Stub\n");
1147 return E_NOTIMPL;
1148}
1149
1150/************************************************************************
1151 * DefaultHandler_QueryGetData (IDataObject)
1152 *
1153 * The default handler's implementation of this method delegates to
1154 * the cache.
1155 *
1156 * See Windows documentation for more details on IDataObject methods.
1157 */
1159 IDataObject* iface,
1160 LPFORMATETC pformatetc)
1161{
1162 IDataObject* cacheDataObject = NULL;
1163 HRESULT hres;
1164
1166
1167 TRACE("(%p, %p)\n", iface, pformatetc);
1168
1169 hres = IUnknown_QueryInterface(This->dataCache,
1171 (void**)&cacheDataObject);
1172
1173 if (FAILED(hres))
1174 return E_UNEXPECTED;
1175
1176 hres = IDataObject_QueryGetData(cacheDataObject,
1177 pformatetc);
1178
1179 IDataObject_Release(cacheDataObject);
1180
1181 if (hres == S_OK) return hres;
1182
1183 if (object_is_running( This ))
1184 {
1186 hres = IDataObject_QueryGetData(This->pDataDelegate, pformatetc);
1188 if (hres == S_OK) return hres;
1189 }
1190
1191 /* Query running state again, as the object may have closed during _QueryGetData call */
1192 if (!object_is_running( This ))
1194
1195 return hres;
1196}
1197
1198/************************************************************************
1199 * DefaultHandler_GetCanonicalFormatEtc (IDataObject)
1200 *
1201 * This method is meaningless if the server is not running
1202 *
1203 * See Windows documentation for more details on IDataObject methods.
1204 */
1206 IDataObject* iface,
1207 LPFORMATETC pformatetcIn,
1208 LPFORMATETC pformatetcOut)
1209{
1211 HRESULT hr;
1212
1213 TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pformatetcOut);
1214
1215 if (!object_is_running( This ))
1216 return OLE_E_NOTRUNNING;
1217
1219 hr = IDataObject_GetCanonicalFormatEtc(This->pDataDelegate, pformatetcIn, pformatetcOut);
1221
1222 return hr;
1223}
1224
1225/************************************************************************
1226 * DefaultHandler_SetData (IDataObject)
1227 *
1228 * The default handler's implementation of this method delegates to
1229 * the cache.
1230 *
1231 * See Windows documentation for more details on IDataObject methods.
1232 */
1234 IDataObject* iface,
1235 LPFORMATETC pformatetc,
1236 STGMEDIUM* pmedium,
1237 BOOL fRelease)
1238{
1240 IDataObject* cacheDataObject = NULL;
1241 HRESULT hres;
1242
1243 TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
1244
1245 hres = IUnknown_QueryInterface(This->dataCache,
1247 (void**)&cacheDataObject);
1248
1249 if (FAILED(hres))
1250 return E_UNEXPECTED;
1251
1252 hres = IDataObject_SetData(cacheDataObject,
1253 pformatetc,
1254 pmedium,
1255 fRelease);
1256
1257 IDataObject_Release(cacheDataObject);
1258
1259 return hres;
1260}
1261
1262/************************************************************************
1263 * DefaultHandler_EnumFormatEtc (IDataObject)
1264 *
1265 * The default handler's implementation of This method simply delegates
1266 * to OleRegEnumFormatEtc.
1267 *
1268 * See Windows documentation for more details on IDataObject methods.
1269 */
1271 IDataObject* iface,
1272 DWORD dwDirection,
1273 IEnumFORMATETC** ppenumFormatEtc)
1274{
1276
1277 TRACE("%p, %lx, %p.\n", iface, dwDirection, ppenumFormatEtc);
1278
1279 return OleRegEnumFormatEtc(&This->clsid, dwDirection, ppenumFormatEtc);
1280}
1281
1282/************************************************************************
1283 * DefaultHandler_DAdvise (IDataObject)
1284 *
1285 * The default handler's implementation of this method simply
1286 * delegates to the DataAdviseHolder.
1287 *
1288 * See Windows documentation for more details on IDataObject methods.
1289 */
1291 IDataObject* iface,
1292 FORMATETC* pformatetc,
1293 DWORD advf,
1294 IAdviseSink* pAdvSink,
1295 DWORD* pdwConnection)
1296{
1297 HRESULT hres = S_OK;
1299
1300 TRACE("%p, %p, %ld, %p, %p.\n", iface, pformatetc, advf, pAdvSink, pdwConnection);
1301
1302 /* Make sure we have a data advise holder before we start. */
1303 if (!This->dataAdviseHolder)
1304 {
1305 hres = CreateDataAdviseHolder(&This->dataAdviseHolder);
1307 {
1309 DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
1311 }
1312 }
1313
1314 if (SUCCEEDED(hres))
1315 hres = IDataAdviseHolder_Advise(This->dataAdviseHolder,
1316 iface,
1317 pformatetc,
1318 advf,
1319 pAdvSink,
1320 pdwConnection);
1321
1322 return hres;
1323}
1324
1325/************************************************************************
1326 * DefaultHandler_DUnadvise (IDataObject)
1327 *
1328 * The default handler's implementation of this method simply
1329 * delegates to the DataAdviseHolder.
1330 *
1331 * See Windows documentation for more details on IDataObject methods.
1332 */
1334 IDataObject* iface,
1335 DWORD dwConnection)
1336{
1338
1339 TRACE("%p, %ld.\n", iface, dwConnection);
1340
1341 /*
1342 * If we don't have a data advise holder yet, it means that
1343 * we don't have any connections..
1344 */
1345 if (!This->dataAdviseHolder)
1346 return OLE_E_NOCONNECTION;
1347
1348 return IDataAdviseHolder_Unadvise(This->dataAdviseHolder,
1349 dwConnection);
1350}
1351
1352/************************************************************************
1353 * DefaultHandler_EnumDAdvise (IDataObject)
1354 *
1355 * The default handler's implementation of this method simply
1356 * delegates to the DataAdviseHolder.
1357 *
1358 * See Windows documentation for more details on IDataObject methods.
1359 */
1361 IDataObject* iface,
1362 IEnumSTATDATA** ppenumAdvise)
1363{
1365
1366 TRACE("(%p, %p)\n", iface, ppenumAdvise);
1367
1368 if (!ppenumAdvise)
1369 return E_POINTER;
1370
1371 *ppenumAdvise = NULL;
1372
1373 /* If we have a data advise holder object, delegate. */
1374 if (This->dataAdviseHolder)
1375 return IDataAdviseHolder_EnumAdvise(This->dataAdviseHolder,
1376 ppenumAdvise);
1377
1378 return S_OK;
1379}
1380
1381/*********************************************************
1382 * Methods implementation for the IRunnableObject part
1383 * of the DefaultHandler class.
1384 */
1385
1386/************************************************************************
1387 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1388 *
1389 * See Windows documentation for more details on IUnknown methods.
1390 */
1392 IRunnableObject* iface,
1393 REFIID riid,
1394 void** ppvObject)
1395{
1397
1398 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
1399}
1400
1401/************************************************************************
1402 * DefaultHandler_IRunnableObject_AddRef (IUnknown)
1403 *
1404 * See Windows documentation for more details on IUnknown methods.
1405 */
1407 IRunnableObject* iface)
1408{
1410
1411 return IUnknown_AddRef(This->outerUnknown);
1412}
1413
1414/************************************************************************
1415 * DefaultHandler_IRunnableObject_Release (IUnknown)
1416 *
1417 * See Windows documentation for more details on IUnknown methods.
1418 */
1420 IRunnableObject* iface)
1421{
1423
1424 return IUnknown_Release(This->outerUnknown);
1425}
1426
1427/************************************************************************
1428 * DefaultHandler_GetRunningClass (IRunnableObject)
1429 *
1430 * See Windows documentation for more details on IRunnableObject methods.
1431 */
1433 IRunnableObject* iface,
1434 LPCLSID lpClsid)
1435{
1436 FIXME("()\n");
1437 return S_OK;
1438}
1439
1441 IRunnableObject* iface,
1442 IBindCtx* pbc)
1443{
1445 HRESULT hr;
1446 IOleCacheControl *cache_ctrl;
1447
1448 FIXME("(%p): semi-stub\n", pbc);
1449
1450 /* already running? if so nothing to do */
1452 return S_OK;
1453
1455
1456 hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_LOCAL_SERVER | CLSCTX_REMOTE_SERVER,
1457 &IID_IOleObject, (void **)&This->pOleDelegate);
1458 if (FAILED(hr))
1459 return hr;
1460
1461 hr = IOleObject_Advise(This->pOleDelegate, &This->IAdviseSink_iface, &This->dwAdvConn);
1462 if (FAILED(hr)) goto fail;
1463
1464 if (This->clientSite)
1465 {
1466 hr = IOleObject_SetClientSite(This->pOleDelegate, This->clientSite);
1467 if (FAILED(hr)) goto fail;
1468 }
1469
1470 hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage,
1471 (void **)&This->pPSDelegate);
1472 if (FAILED(hr)) goto fail;
1473
1474 if (This->storage_state == storage_state_initialised)
1475 hr = IPersistStorage_InitNew(This->pPSDelegate, This->storage);
1476 else if (This->storage_state == storage_state_loaded)
1477 hr = IPersistStorage_Load(This->pPSDelegate, This->storage);
1478 if (FAILED(hr)) goto fail;
1479
1480 if (This->containerApp)
1481 {
1482 hr = IOleObject_SetHostNames(This->pOleDelegate, This->containerApp,
1483 This->containerObj);
1484 if (FAILED(hr)) goto fail;
1485 }
1486
1487 /* FIXME: do more stuff here:
1488 * - IOleObject_GetMiscStatus
1489 * - IOleObject_GetMoniker
1490 */
1491
1492 hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject,
1493 (void **)&This->pDataDelegate);
1494 if (FAILED(hr)) goto fail;
1495
1496 This->object_state = object_state_running;
1497
1498 if (This->dataAdviseHolder)
1499 {
1500 hr = DataAdviseHolder_OnConnect(This->dataAdviseHolder, This->pDataDelegate);
1501 if (FAILED(hr)) goto fail;
1502 }
1503
1504 hr = IUnknown_QueryInterface( This->dataCache, &IID_IOleCacheControl, (void **)&cache_ctrl );
1505 if (FAILED(hr)) goto fail;
1506 hr = IOleCacheControl_OnRun( cache_ctrl, This->pDataDelegate );
1507 IOleCacheControl_Release( cache_ctrl );
1508 if (FAILED(hr)) goto fail;
1509
1510 return hr;
1511
1512fail:
1514 return hr;
1515}
1516
1517/************************************************************************
1518 * DefaultHandler_IsRunning (IRunnableObject)
1519 *
1520 * See Windows documentation for more details on IRunnableObject methods.
1521 */
1523 IRunnableObject* iface)
1524{
1526
1527 TRACE("()\n");
1528
1529 if (This->object_state == object_state_running)
1530 return TRUE;
1531 else
1532 return FALSE;
1533}
1534
1535/************************************************************************
1536 * DefaultHandler_LockRunning (IRunnableObject)
1537 *
1538 * See Windows documentation for more details on IRunnableObject methods.
1539 */
1541 IRunnableObject* iface,
1542 BOOL fLock,
1543 BOOL fLastUnlockCloses)
1544{
1545 FIXME("()\n");
1546 return S_OK;
1547}
1548
1549/************************************************************************
1550 * DefaultHandler_SetContainedObject (IRunnableObject)
1551 *
1552 * See Windows documentation for more details on IRunnableObject methods.
1553 */
1555 IRunnableObject* iface,
1556 BOOL fContained)
1557{
1558 FIXME("()\n");
1559 return S_OK;
1560}
1561
1563 IAdviseSink *iface,
1564 REFIID riid,
1565 void **ppvObject)
1566{
1567 if (IsEqualIID(riid, &IID_IUnknown) ||
1569 {
1570 *ppvObject = iface;
1571 IAdviseSink_AddRef(iface);
1572 return S_OK;
1573 }
1574
1575 return E_NOINTERFACE;
1576}
1577
1579 IAdviseSink *iface)
1580{
1582
1583 return IUnknown_AddRef(&This->IUnknown_iface);
1584}
1585
1587 IAdviseSink *iface)
1588{
1590
1591 return IUnknown_Release(&This->IUnknown_iface);
1592}
1593
1595 IAdviseSink *iface,
1596 FORMATETC *pFormatetc,
1597 STGMEDIUM *pStgmed)
1598{
1599 FIXME(": stub\n");
1600}
1601
1603 IAdviseSink *iface,
1604 DWORD dwAspect,
1605 LONG lindex)
1606{
1607 FIXME(": stub\n");
1608}
1609
1611 IAdviseSink *iface,
1612 IMoniker *pmk)
1613{
1615
1616 TRACE("(%p)\n", pmk);
1617
1618 if (This->oleAdviseHolder)
1619 IOleAdviseHolder_SendOnRename(This->oleAdviseHolder, pmk);
1620}
1621
1623 IAdviseSink *iface)
1624{
1626
1627 TRACE("()\n");
1628
1629 if (This->oleAdviseHolder)
1630 IOleAdviseHolder_SendOnSave(This->oleAdviseHolder);
1631}
1632
1634 IAdviseSink *iface)
1635{
1637
1638 TRACE("()\n");
1639
1640 if (This->oleAdviseHolder)
1641 IOleAdviseHolder_SendOnClose(This->oleAdviseHolder);
1642
1643 if(!This->in_call)
1645 else
1646 {
1647 TRACE("OnClose during call. Deferring shutdown\n");
1648 This->object_state = object_state_deferred_close;
1649 }
1650}
1651
1652/************************************************************************
1653 * DefaultHandler_IPersistStorage_QueryInterface
1654 *
1655 */
1657 IPersistStorage* iface,
1658 REFIID riid,
1659 void** ppvObject)
1660{
1662
1663 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
1664}
1665
1666/************************************************************************
1667 * DefaultHandler_IPersistStorage_AddRef
1668 *
1669 */
1671 IPersistStorage* iface)
1672{
1674
1675 return IUnknown_AddRef(This->outerUnknown);
1676}
1677
1678/************************************************************************
1679 * DefaultHandler_IPersistStorage_Release
1680 *
1681 */
1683 IPersistStorage* iface)
1684{
1686
1687 return IUnknown_Release(This->outerUnknown);
1688}
1689
1690/************************************************************************
1691 * DefaultHandler_IPersistStorage_GetClassID
1692 *
1693 */
1695 IPersistStorage* iface,
1696 CLSID* clsid)
1697{
1699 HRESULT hr;
1700
1701 TRACE("(%p)->(%p)\n", iface, clsid);
1702
1704 {
1706 hr = IPersistStorage_GetClassID(This->pPSDelegate, clsid);
1708 }
1709 else
1710 hr = IPersistStorage_GetClassID(This->dataCache_PersistStg, clsid);
1711
1712 return hr;
1713}
1714
1715/************************************************************************
1716 * DefaultHandler_IPersistStorage_IsDirty
1717 *
1718 */
1720 IPersistStorage* iface)
1721{
1723 HRESULT hr;
1724
1725 TRACE("(%p)\n", iface);
1726
1727 hr = IPersistStorage_IsDirty(This->dataCache_PersistStg);
1728 if(hr != S_FALSE) return hr;
1729
1731 {
1733 hr = IPersistStorage_IsDirty(This->pPSDelegate);
1735 }
1736
1737 return hr;
1738}
1739
1740/***********************************************************************
1741 *
1742 * The format of '\1Ole' stream is as follows:
1743 *
1744 * DWORD Version == 0x02000001
1745 * DWORD Flags - low bit set indicates the object is a link otherwise it's embedded.
1746 * DWORD LinkupdateOption - [MS-OLEDS describes this as an implementation specific hint
1747 * supplied by the app that creates the data structure. May be
1748 * ignored on processing].
1749 *
1750 * DWORD Reserved == 0
1751 * DWORD MonikerStreamSize - size of the rest of the data (ie CLSID + moniker stream data).
1752 * CLSID clsid - class id of object capable of processing the moniker
1753 * BYTE data[] - moniker data for a link
1754 */
1755
1756typedef struct
1757{
1764static const DWORD ole_stream_version = 0x02000001;
1765
1767{
1768 IStream *stream;
1769 HRESULT hr;
1770
1771 hr = IStorage_OpenStream(storage, L"\1Ole", NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream);
1772
1773 if(SUCCEEDED(hr))
1774 {
1775 DWORD read;
1777
1778 hr = IStream_Read(stream, &header, sizeof(header), &read);
1779 if(hr == S_OK && read == sizeof(header) && header.version == ole_stream_version)
1780 {
1781 if(header.flags & 1)
1782 {
1783 /* FIXME: Read the moniker and deal with the link */
1784 FIXME("Linked objects are not supported yet\n");
1785 }
1786 }
1787 else
1788 {
1789 WARN("Incorrect OleStream header\n");
1791 }
1792 IStream_Release(stream);
1793 }
1794 else
1796
1797 return hr;
1798}
1799
1800/************************************************************************
1801 * DefaultHandler_IPersistStorage_InitNew
1802 *
1803 */
1805 IPersistStorage* iface,
1806 IStorage* pStg)
1807{
1809 HRESULT hr;
1810
1811 TRACE("(%p)->(%p)\n", iface, pStg);
1812 hr = STORAGE_CreateOleStream(pStg, 0);
1813 if (hr != S_OK) return hr;
1814
1815 hr = IPersistStorage_InitNew(This->dataCache_PersistStg, pStg);
1816
1818 {
1820 hr = IPersistStorage_InitNew(This->pPSDelegate, pStg);
1822 }
1823
1824 if(SUCCEEDED(hr))
1825 {
1826 IStorage_AddRef(pStg);
1827 This->storage = pStg;
1828 This->storage_state = storage_state_initialised;
1829 }
1830
1831 return hr;
1832}
1833
1834
1835/************************************************************************
1836 * DefaultHandler_IPersistStorage_Load
1837 *
1838 */
1840 IPersistStorage* iface,
1841 IStorage* pStg)
1842{
1844 HRESULT hr;
1845
1846 TRACE("(%p)->(%p)\n", iface, pStg);
1847
1848 hr = load_ole_stream(This, pStg);
1849
1850 if(SUCCEEDED(hr))
1851 hr = IPersistStorage_Load(This->dataCache_PersistStg, pStg);
1852
1854 {
1856 hr = IPersistStorage_Load(This->pPSDelegate, pStg);
1858 }
1859
1860 if(SUCCEEDED(hr))
1861 {
1862 IStorage_AddRef(pStg);
1863 This->storage = pStg;
1864 This->storage_state = storage_state_loaded;
1865 }
1866 return hr;
1867}
1868
1869
1870/************************************************************************
1871 * DefaultHandler_IPersistStorage_Save
1872 *
1873 */
1875 IPersistStorage* iface,
1876 IStorage* pStgSave,
1877 BOOL fSameAsLoad)
1878{
1880 HRESULT hr;
1881
1882 TRACE("(%p)->(%p, %d)\n", iface, pStgSave, fSameAsLoad);
1883
1884 hr = IPersistStorage_Save(This->dataCache_PersistStg, pStgSave, fSameAsLoad);
1886 {
1888 hr = IPersistStorage_Save(This->pPSDelegate, pStgSave, fSameAsLoad);
1890 }
1891
1892 return hr;
1893}
1894
1895
1896/************************************************************************
1897 * DefaultHandler_IPersistStorage_SaveCompleted
1898 *
1899 */
1901 IPersistStorage* iface,
1902 IStorage* pStgNew)
1903{
1905 HRESULT hr;
1906
1907 TRACE("(%p)->(%p)\n", iface, pStgNew);
1908
1909 hr = IPersistStorage_SaveCompleted(This->dataCache_PersistStg, pStgNew);
1910
1912 {
1914 hr = IPersistStorage_SaveCompleted(This->pPSDelegate, pStgNew);
1916 }
1917
1918 if(pStgNew)
1919 {
1920 IStorage_AddRef(pStgNew);
1921 if(This->storage) IStorage_Release(This->storage);
1922 This->storage = pStgNew;
1923 This->storage_state = storage_state_loaded;
1924 }
1925
1926 return hr;
1927}
1928
1929
1930/************************************************************************
1931 * DefaultHandler_IPersistStorage_HandsOffStorage
1932 *
1933 */
1935 IPersistStorage* iface)
1936{
1938 HRESULT hr;
1939
1940 TRACE("(%p)\n", iface);
1941
1942 hr = IPersistStorage_HandsOffStorage(This->dataCache_PersistStg);
1943
1945 {
1947 hr = IPersistStorage_HandsOffStorage(This->pPSDelegate);
1949 }
1950
1951 if(This->storage) IStorage_Release(This->storage);
1952 This->storage = NULL;
1953 This->storage_state = storage_state_uninitialised;
1954
1955 return hr;
1956}
1957
1958
1959/*
1960 * Virtual function tables for the DefaultHandler class.
1961 */
1962static const IOleObjectVtbl DefaultHandler_IOleObject_VTable =
1963{
1988};
1989
1990static const IUnknownVtbl DefaultHandler_NDIUnknown_VTable =
1991{
1995};
1996
1997static const IDataObjectVtbl DefaultHandler_IDataObject_VTable =
1998{
2011};
2012
2013static const IRunnableObjectVtbl DefaultHandler_IRunnableObject_VTable =
2014{
2023};
2024
2025static const IAdviseSinkVtbl DefaultHandler_IAdviseSink_VTable =
2026{
2035};
2036
2037static const IPersistStorageVtbl DefaultHandler_IPersistStorage_VTable =
2038{
2049};
2050
2051/*********************************************************
2052 * Methods implementation for the DefaultHandler class.
2053 */
2056 LPUNKNOWN pUnkOuter,
2057 DWORD flags,
2058 IClassFactory *pCF)
2059{
2061 HRESULT hr;
2062
2064
2065 if (!This)
2066 return This;
2067
2068 This->IOleObject_iface.lpVtbl = &DefaultHandler_IOleObject_VTable;
2069 This->IUnknown_iface.lpVtbl = &DefaultHandler_NDIUnknown_VTable;
2070 This->IDataObject_iface.lpVtbl = &DefaultHandler_IDataObject_VTable;
2071 This->IRunnableObject_iface.lpVtbl = &DefaultHandler_IRunnableObject_VTable;
2072 This->IAdviseSink_iface.lpVtbl = &DefaultHandler_IAdviseSink_VTable;
2073 This->IPersistStorage_iface.lpVtbl = &DefaultHandler_IPersistStorage_VTable;
2074
2075 This->inproc_server = (flags & EMBDHLP_INPROC_SERVER) != 0;
2076
2077 /*
2078 * Start with one reference count. The caller of this function
2079 * must release the interface pointer when it is done.
2080 */
2081 This->ref = 1;
2082
2083 /*
2084 * Initialize the outer unknown
2085 * We don't keep a reference on the outer unknown since, the way
2086 * aggregation works, our lifetime is at least as large as its
2087 * lifetime.
2088 */
2089 if (!pUnkOuter)
2090 pUnkOuter = &This->IUnknown_iface;
2091
2092 This->outerUnknown = pUnkOuter;
2093
2094 /*
2095 * Create a datacache object.
2096 * We aggregate with the datacache. Make sure we pass our outer
2097 * unknown as the datacache's outer unknown.
2098 */
2099 hr = CreateDataCache(This->outerUnknown,
2100 clsid,
2101 &IID_IUnknown,
2102 (void**)&This->dataCache);
2103 if(SUCCEEDED(hr))
2104 {
2105 hr = IUnknown_QueryInterface(This->dataCache, &IID_IPersistStorage, (void**)&This->dataCache_PersistStg);
2106 /* keeping a reference to This->dataCache_PersistStg causes us to keep a
2107 * reference on the outer object */
2108 if (SUCCEEDED(hr))
2109 IUnknown_Release(This->outerUnknown);
2110 else
2111 IUnknown_Release(This->dataCache);
2112 }
2113 if(FAILED(hr))
2114 {
2115 ERR("Unexpected error creating data cache\n");
2117 return NULL;
2118 }
2119
2120 This->clsid = *clsid;
2121 This->clientSite = NULL;
2122 This->oleAdviseHolder = NULL;
2123 This->dataAdviseHolder = NULL;
2124 This->containerApp = NULL;
2125 This->containerObj = NULL;
2126 This->pOleDelegate = NULL;
2127 This->pPSDelegate = NULL;
2128 This->pDataDelegate = NULL;
2129 This->object_state = object_state_not_running;
2130 This->in_call = 0;
2131
2132 This->dwAdvConn = 0;
2133 This->storage = NULL;
2134 This->storage_state = storage_state_uninitialised;
2135
2136 if (This->inproc_server && !(flags & EMBDHLP_DELAYCREATE))
2137 {
2138 HRESULT hr;
2139 This->pCFObject = NULL;
2140 if (pCF)
2141 hr = IClassFactory_CreateInstance(pCF, NULL, &IID_IOleObject, (void **)&This->pOleDelegate);
2142 else
2143 hr = CoCreateInstance(&This->clsid, NULL, CLSCTX_INPROC_SERVER,
2144 &IID_IOleObject, (void **)&This->pOleDelegate);
2145 if (SUCCEEDED(hr))
2146 hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IPersistStorage, (void **)&This->pPSDelegate);
2147 if (SUCCEEDED(hr))
2148 hr = IOleObject_QueryInterface(This->pOleDelegate, &IID_IDataObject, (void **)&This->pDataDelegate);
2149 if (SUCCEEDED(hr))
2150 This->object_state = object_state_running;
2151 if (FAILED(hr))
2152 WARN("object creation failed with error %#lx\n", hr);
2153 }
2154 else
2155 {
2156 This->pCFObject = pCF;
2157 if (pCF) IClassFactory_AddRef(pCF);
2158 }
2159
2160 return This;
2161}
2162
2165{
2166 TRACE("(%p)\n", This);
2167
2168 /* AddRef/Release may be called on this object during destruction.
2169 * Prevent the object being destroyed recursively by artificially raising
2170 * the reference count. */
2171 This->ref = 10000;
2172
2173 /* release delegates */
2175
2176 HeapFree( GetProcessHeap(), 0, This->containerApp );
2177 This->containerApp = NULL;
2178 HeapFree( GetProcessHeap(), 0, This->containerObj );
2179 This->containerObj = NULL;
2180
2181 if (This->dataCache)
2182 {
2183 /* to balance out the release of dataCache_PersistStg which will result
2184 * in a reference being released from the outer unknown */
2185 IUnknown_AddRef(This->outerUnknown);
2186 IPersistStorage_Release(This->dataCache_PersistStg);
2187 IUnknown_Release(This->dataCache);
2188 This->dataCache_PersistStg = NULL;
2189 This->dataCache = NULL;
2190 }
2191
2192 if (This->clientSite)
2193 {
2194 IOleClientSite_Release(This->clientSite);
2195 This->clientSite = NULL;
2196 }
2197
2198 if (This->oleAdviseHolder)
2199 {
2200 IOleAdviseHolder_Release(This->oleAdviseHolder);
2201 This->oleAdviseHolder = NULL;
2202 }
2203
2204 if (This->dataAdviseHolder)
2205 {
2206 IDataAdviseHolder_Release(This->dataAdviseHolder);
2207 This->dataAdviseHolder = NULL;
2208 }
2209
2210 if (This->storage)
2211 {
2212 IStorage_Release(This->storage);
2213 This->storage = NULL;
2214 }
2215
2216 if (This->pCFObject)
2217 {
2218 IClassFactory_Release(This->pCFObject);
2219 This->pCFObject = NULL;
2220 }
2221
2223}
2224
2225/******************************************************************************
2226 * OleCreateEmbeddingHelper [OLE32.@]
2227 */
2230 LPUNKNOWN pUnkOuter,
2231 DWORD flags,
2232 IClassFactory *pCF,
2233 REFIID riid,
2234 LPVOID* ppvObj)
2235{
2236 DefaultHandler* newHandler = NULL;
2237 HRESULT hr = S_OK;
2238
2239 TRACE("%s, %p, %#lx, %p, %s, %p.\n", debugstr_guid(clsid), pUnkOuter, flags, pCF, debugstr_guid(riid), ppvObj);
2240
2241 if (!ppvObj)
2242 return E_POINTER;
2243
2244 *ppvObj = NULL;
2245
2246 /*
2247 * If This handler is constructed for aggregation, make sure
2248 * the caller is requesting the IUnknown interface.
2249 * This is necessary because it's the only time the non-delegating
2250 * IUnknown pointer can be returned to the outside.
2251 */
2252 if (pUnkOuter && !IsEqualIID(&IID_IUnknown, riid))
2253 return CLASS_E_NOAGGREGATION;
2254
2255 /*
2256 * Try to construct a new instance of the class.
2257 */
2258 newHandler = DefaultHandler_Construct(clsid, pUnkOuter, flags, pCF);
2259
2260 if (!newHandler)
2261 return E_OUTOFMEMORY;
2262
2263 /*
2264 * Make sure it supports the interface required by the caller.
2265 */
2266 hr = IUnknown_QueryInterface(&newHandler->IUnknown_iface, riid, ppvObj);
2267
2268 /*
2269 * Release the reference obtained in the constructor. If
2270 * the QueryInterface was unsuccessful, it will free the class.
2271 */
2272 IUnknown_Release(&newHandler->IUnknown_iface);
2273
2274 return hr;
2275}
2276
2277
2278/******************************************************************************
2279 * OleCreateDefaultHandler [OLE32.@]
2280 */
2282 REFIID riid, LPVOID* ppvObj)
2283{
2284 TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter,debugstr_guid(riid), ppvObj);
2286 NULL, riid, ppvObj);
2287}
2288
2289typedef struct HandlerCF
2290{
2295
2297{
2298 return CONTAINING_RECORD(iface, HandlerCF, IClassFactory_iface);
2299}
2300
2301static HRESULT WINAPI
2303{
2304 *ppv = NULL;
2307 {
2308 *ppv = iface;
2309 IClassFactory_AddRef(iface);
2310 return S_OK;
2311 }
2312 return E_NOINTERFACE;
2313}
2314
2315static ULONG WINAPI HandlerCF_AddRef(LPCLASSFACTORY iface)
2316{
2318 return InterlockedIncrement(&This->refs);
2319}
2320
2321static ULONG WINAPI HandlerCF_Release(LPCLASSFACTORY iface)
2322{
2324 ULONG refs = InterlockedDecrement(&This->refs);
2325 if (!refs)
2327 return refs;
2328}
2329
2330static HRESULT WINAPI
2333{
2335 return OleCreateDefaultHandler(&This->clsid, pUnk, riid, ppv);
2336}
2337
2338static HRESULT WINAPI HandlerCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
2339{
2340 FIXME("(%d), stub!\n",fLock);
2341 return S_OK;
2342}
2343
2344static const IClassFactoryVtbl HandlerClassFactoryVtbl = {
2350};
2351
2353{
2354 HRESULT hr;
2355 HandlerCF *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
2356 if (!This) return E_OUTOFMEMORY;
2357 This->IClassFactory_iface.lpVtbl = &HandlerClassFactoryVtbl;
2358 This->refs = 0;
2359 This->clsid = *rclsid;
2360
2361 hr = IClassFactory_QueryInterface(&This->IClassFactory_iface, riid, ppv);
2362 if (FAILED(hr))
2364
2365 return hr;
2366}
#define read
Definition: acwin.h:96
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#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
const GUID IID_IClassFactory
HRESULT DataAdviseHolder_OnConnect(IDataAdviseHolder *iface, IDataObject *pDelegate)
Definition: oleobj.c:805
void DataAdviseHolder_OnDisconnect(IDataAdviseHolder *iface)
Definition: oleobj.c:827
static HWND hwndParent
Definition: cryptui.c:300
HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID riid, LPVOID *ppvObj)
Definition: datacache.c:3029
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
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
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define lstrcpyW
Definition: compat.h:749
#define lstrlenW
Definition: compat.h:750
static HRESULT WINAPI DefaultHandler_GetDataHere(IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium)
static HRESULT WINAPI DefaultHandler_SetData(IDataObject *iface, LPFORMATETC pformatetc, STGMEDIUM *pmedium, BOOL fRelease)
static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(IDataObject *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI DefaultHandler_Unadvise(IOleObject *iface, DWORD dwConnection)
static HRESULT WINAPI DefaultHandler_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
static HRESULT WINAPI DefaultHandler_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
static HRESULT WINAPI DefaultHandler_IPersistStorage_InitNew(IPersistStorage *iface, IStorage *pStg)
static void DefaultHandler_Stop(DefaultHandler *This)
static void WINAPI DefaultHandler_IAdviseSink_OnViewChange(IAdviseSink *iface, DWORD dwAspect, LONG lindex)
static HRESULT WINAPI HandlerCF_LockServer(LPCLASSFACTORY iface, BOOL fLock)
static HRESULT WINAPI DefaultHandler_IPersistStorage_Load(IPersistStorage *iface, IStorage *pStg)
HRESULT WINAPI OleCreateEmbeddingHelper(REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF, REFIID riid, LPVOID *ppvObj)
static DefaultHandler * impl_from_IRunnableObject(IRunnableObject *iface)
static DefaultHandler * impl_from_IOleObject(IOleObject *iface)
static ULONG WINAPI DefaultHandler_IDataObject_Release(IDataObject *iface)
static ULONG WINAPI DefaultHandler_Release(IOleObject *iface)
static HRESULT WINAPI HandlerCF_QueryInterface(LPCLASSFACTORY iface, REFIID riid, LPVOID *ppv)
static HandlerCF * impl_from_IClassFactory(IClassFactory *iface)
static HRESULT WINAPI HandlerCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
static DefaultHandler * impl_from_IUnknown(IUnknown *iface)
static ULONG WINAPI DefaultHandler_IRunnableObject_Release(IRunnableObject *iface)
static HRESULT WINAPI DefaultHandler_EnumDAdvise(IDataObject *iface, IEnumSTATDATA **ppenumAdvise)
HRESULT WINAPI OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObj)
static BOOL object_is_running(DefaultHandler *This)
static DefaultHandler * impl_from_IDataObject(IDataObject *iface)
static HRESULT WINAPI DefaultHandler_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation, DWORD dwReserved)
HRESULT HandlerCF_Create(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
static ULONG WINAPI DefaultHandler_AddRef(IOleObject *iface)
static const DWORD ole_stream_version
static DefaultHandler * impl_from_IAdviseSink(IAdviseSink *iface)
static HRESULT WINAPI DefaultHandler_Close(IOleObject *iface, DWORD dwSaveOption)
static ULONG WINAPI DefaultHandler_IAdviseSink_AddRef(IAdviseSink *iface)
static HRESULT WINAPI DefaultHandler_SetColorScheme(IOleObject *iface, struct tagLOGPALETTE *pLogpal)
static HRESULT WINAPI DefaultHandler_Update(IOleObject *iface)
static const IAdviseSinkVtbl DefaultHandler_IAdviseSink_VTable
static void start_object_call(DefaultHandler *This)
static void DefaultHandler_Destroy(DefaultHandler *This)
static ULONG WINAPI DefaultHandler_IAdviseSink_Release(IAdviseSink *iface)
static const IClassFactoryVtbl HandlerClassFactoryVtbl
static HRESULT WINAPI DefaultHandler_QueryGetData(IDataObject *iface, LPFORMATETC pformatetc)
static HRESULT WINAPI DefaultHandler_GetData(IDataObject *iface, LPFORMATETC pformatetcIn, STGMEDIUM *pmedium)
static const IRunnableObjectVtbl DefaultHandler_IRunnableObject_VTable
static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(IDataObject *iface, LPFORMATETC pformatetcIn, LPFORMATETC pformatetcOut)
static HRESULT WINAPI DefaultHandler_IAdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid, void **ppvObject)
static const IOleObjectVtbl DefaultHandler_IOleObject_VTable
static BOOL WINAPI DefaultHandler_IsRunning(IRunnableObject *iface)
static HRESULT WINAPI DefaultHandler_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
static HRESULT WINAPI DefaultHandler_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
static HRESULT WINAPI DefaultHandler_DAdvise(IDataObject *iface, FORMATETC *pformatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection)
static ULONG WINAPI HandlerCF_Release(LPCLASSFACTORY iface)
static HRESULT WINAPI DefaultHandler_IPersistStorage_Save(IPersistStorage *iface, IStorage *pStgSave, BOOL fSameAsLoad)
static HRESULT WINAPI DefaultHandler_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI DefaultHandler_IsUpToDate(IOleObject *iface)
static HRESULT WINAPI DefaultHandler_IPersistStorage_IsDirty(IPersistStorage *iface)
static void WINAPI DefaultHandler_IAdviseSink_OnSave(IAdviseSink *iface)
static void WINAPI DefaultHandler_IAdviseSink_OnRename(IAdviseSink *iface, IMoniker *pmk)
static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(IRunnableObject *iface, REFIID riid, void **ppvObject)
static ULONG WINAPI DefaultHandler_NDIUnknown_Release(IUnknown *iface)
static HRESULT load_ole_stream(DefaultHandler *This, IStorage *storage)
static HRESULT WINAPI DefaultHandler_IPersistStorage_QueryInterface(IPersistStorage *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI DefaultHandler_DUnadvise(IDataObject *iface, DWORD dwConnection)
static HRESULT WINAPI DefaultHandler_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
static HRESULT WINAPI DefaultHandler_GetRunningClass(IRunnableObject *iface, LPCLSID lpClsid)
static HRESULT WINAPI DefaultHandler_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
static HRESULT WINAPI DefaultHandler_Run(IRunnableObject *iface, IBindCtx *pbc)
object_state
@ object_state_not_running
@ object_state_deferred_close
@ object_state_running
static HRESULT WINAPI DefaultHandler_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
static HRESULT WINAPI DefaultHandler_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
static HRESULT WINAPI DefaultHandler_IPersistStorage_GetClassID(IPersistStorage *iface, CLSID *clsid)
static HRESULT WINAPI DefaultHandler_IPersistStorage_HandsOffStorage(IPersistStorage *iface)
static void WINAPI DefaultHandler_IAdviseSink_OnClose(IAdviseSink *iface)
static HRESULT WINAPI DefaultHandler_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObject)
static HRESULT WINAPI DefaultHandler_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
static HRESULT WINAPI DefaultHandler_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
static ULONG WINAPI DefaultHandler_IPersistStorage_AddRef(IPersistStorage *iface)
static ULONG WINAPI HandlerCF_AddRef(LPCLASSFACTORY iface)
static DefaultHandler * impl_from_IPersistStorage(IPersistStorage *iface)
static HRESULT WINAPI DefaultHandler_DoVerb(IOleObject *iface, LONG iVerb, struct tagMSG *lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
static HRESULT WINAPI DefaultHandler_IPersistStorage_SaveCompleted(IPersistStorage *iface, IStorage *pStgNew)
storage_state
@ storage_state_uninitialised
@ storage_state_initialised
@ storage_state_loaded
static ULONG WINAPI DefaultHandler_IPersistStorage_Release(IPersistStorage *iface)
static HRESULT WINAPI DefaultHandler_EnumFormatEtc(IDataObject *iface, DWORD dwDirection, IEnumFORMATETC **ppenumFormatEtc)
static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(IRunnableObject *iface)
static HRESULT WINAPI DefaultHandler_SetContainedObject(IRunnableObject *iface, BOOL fContained)
static HRESULT WINAPI DefaultHandler_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(IUnknown *iface)
static void end_object_call(DefaultHandler *This)
static void release_delegates(DefaultHandler *This)
static HRESULT WINAPI DefaultHandler_GetUserClassID(IOleObject *iface, CLSID *pClsid)
static void WINAPI DefaultHandler_IAdviseSink_OnDataChange(IAdviseSink *iface, FORMATETC *pFormatetc, STGMEDIUM *pStgmed)
static ULONG WINAPI DefaultHandler_IDataObject_AddRef(IDataObject *iface)
static const IPersistStorageVtbl DefaultHandler_IPersistStorage_VTable
static HRESULT WINAPI DefaultHandler_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
static HRESULT WINAPI DefaultHandler_LockRunning(IRunnableObject *iface, BOOL fLock, BOOL fLastUnlockCloses)
static DefaultHandler * DefaultHandler_Construct(REFCLSID clsid, LPUNKNOWN pUnkOuter, DWORD flags, IClassFactory *pCF)
static const IUnknownVtbl DefaultHandler_NDIUnknown_VTable
static const IDataObjectVtbl DefaultHandler_IDataObject_VTable
HRESULT WINAPI OleRegGetUserType(REFCLSID clsid, DWORD form, LPOLESTR *usertype)
Definition: ole2.c:668
HRESULT WINAPI OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
Definition: ole2.c:848
HRESULT WINAPI OleRegEnumVerbs(REFCLSID clsid, LPENUMOLEVERB *ppenum)
Definition: ole2.c:1107
HRESULT STORAGE_CreateOleStream(IStorage *storage, DWORD flags)
Definition: storage32.c:9079
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
static BSTR *static LPOLESTR
Definition: varformat.c:44
const CLSID * clsid
Definition: msctf.cpp:50
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:95
#define STGM_SHARE_EXCLUSIVE
Definition: objbase.h:940
#define STGM_READ
Definition: objbase.h:934
#define EMBDHLP_INPROC_HANDLER
Definition: ole2.h:47
#define EMBDHLP_INPROC_SERVER
Definition: ole2.h:48
#define EMBDHLP_CREATENOW
Definition: ole2.h:49
#define EMBDHLP_DELAYCREATE
Definition: ole2.h:50
HRESULT WINAPI DECLSPEC_HOTPATCH OleRegEnumFormatEtc(REFCLSID clsid, DWORD dwDirection, LPENUMFORMATETC *ppenumFormatetc)
Definition: ole2stubs.c:75
HRESULT WINAPI CreateDataAdviseHolder(IDataAdviseHolder **ppDAHolder)
Definition: oleobj.c:892
HRESULT WINAPI CreateOleAdviseHolder(IOleAdviseHolder **ppOAHolder)
Definition: oleobj.c:874
const GUID IID_IViewObject
const GUID IID_IOleCache
const GUID IID_IAdviseSink
const GUID IID_IViewObject2
const GUID IID_IRunnableObject
const GUID IID_IOleCache2
const GUID IID_IOleCacheControl
const GUID IID_IDataObject
const GUID IID_IPersistStorage
const GUID IID_IOleObject
long LONG
Definition: pedump.c:60
const GUID IID_IPersist
Definition: proxy.cpp:14
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IUnknown * outerUnknown
IUnknown IUnknown_iface
IUnknown * dataCache
IAdviseSink IAdviseSink_iface
enum storage_state storage_state
enum object_state object_state
IPersistStorage * pPSDelegate
IOleClientSite * clientSite
IDataObject IDataObject_iface
IDataAdviseHolder * dataAdviseHolder
IRunnableObject IRunnableObject_iface
IOleAdviseHolder * oleAdviseHolder
IStorage * storage
IDataObject * pDataDelegate
IOleObject IOleObject_iface
IOleObject * pOleDelegate
IPersistStorage * dataCache_PersistStg
IClassFactory * pCFObject
IPersistStorage IPersistStorage_iface
IClassFactory IClassFactory_iface
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
Definition: send.c:48
Definition: parse.h:23
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define OLE_E_NOCONNECTION
Definition: winerror.h:3729
#define OLE_E_NOTRUNNING
Definition: winerror.h:3730
#define E_NOINTERFACE
Definition: winerror.h:3479
#define OLE_S_USEREG
Definition: winerror.h:3722
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define E_UNEXPECTED
Definition: winerror.h:3528
#define DV_E_CLIPFORMAT
Definition: winerror.h:3750
#define E_POINTER
Definition: winerror.h:3480
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184