source: trunk/src/ole32/defaulthandler.cpp@ 1036

Last change on this file since 1036 was 1033, checked in by davidr, 26 years ago

Ported remaining files pertaining to OLE32 from WINE

File size: 45.4 KB
Line 
1/* $Id: defaulthandler.cpp,v 1.1 1999-09-24 21:49:43 davidr Exp $ */
2/*
3 * OLE 2 default object handler
4 *
5 * 21/9/99
6 *
7 * Copyright 1999 David J. Raison
8 *
9 * Direct port of Wine Implementation
10 * Copyright 1999 Francis Beaudet
11 *
12 * NOTES:
13 * The OLE2 default object handler supports a whole whack of
14 * interfaces including:
15 * IOleObject, IDataObject, IPersistStorage, IViewObject2,
16 * IRunnableObject, IOleCache2, IOleCacheControl and much more.
17 *
18 * All the implementation details are taken from: Inside OLE
19 * second edition by Kraig Brockschmidt,
20 *
21 * TODO
22 * - This implementation of the default handler does not launch the
23 * server in the DoVerb, Update, GetData, GetDataHere and Run
24 * methods. When it is fixed to do so, all the methods will have
25 * to be revisited to allow delegating to the running object
26 *
27 * - All methods in the class that use the class ID should be
28 * aware that it is possible for a class to be treated as
29 * another one and go into emulation mode. Nothing has been
30 * done in This area.
31 *
32 * - Some functions still return E_NOTIMPL they have to be
33 * implemented. Most of those are related to the running of the
34 * actual server.
35 *
36 * - All the methods related to notification and advise sinks are
37 * in place but no notifications are sent to the sinks yet.
38 */
39
40#include "ole32.h"
41#include "heapstring.h"
42#include "oleauto.h"
43#include "debugtools.h"
44
45#include <assert.h>
46
47DEFAULT_DEBUG_CHANNEL(ole)
48
49/****************************************************************************
50 * DefaultHandler
51 *
52 */
53struct DefaultHandler
54{
55 /*
56 * List all interface VTables here
57 */
58 ICOM_VTABLE(IOleObject)* lpvtbl1;
59 ICOM_VTABLE(IUnknown)* lpvtbl2;
60 ICOM_VTABLE(IDataObject)* lpvtbl3;
61 ICOM_VTABLE(IRunnableObject)* lpvtbl4;
62
63 /*
64 * Reference count of This object
65 */
66 ULONG ref;
67
68 /*
69 * IUnknown implementation of the outer object.
70 */
71 IUnknown* outerUnknown;
72
73 /*
74 * Class Id that This handler object represents.
75 */
76 CLSID clsid;
77
78 /*
79 * IUnknown implementation of the datacache.
80 */
81 IUnknown* dataCache;
82
83 /*
84 * Client site for the embedded object.
85 */
86 IOleClientSite* clientSite;
87
88 /*
89 * The IOleAdviseHolder maintains the connections
90 * on behalf of the default handler.
91 */
92 IOleAdviseHolder* oleAdviseHolder;
93
94 /*
95 * The IDataAdviseHolder maintains the data
96 * connections on behalf of the default handler.
97 */
98 IDataAdviseHolder* dataAdviseHolder;
99
100 /*
101 * Name of the container and object contained
102 */
103 BSTR containerApp;
104 BSTR containerObj;
105
106};
107
108typedef struct DefaultHandler DefaultHandler;
109
110/*
111 * Here, I define utility macros to help with the casting of the
112 * "This" parameter.
113 * There is a version to accomodate all of the VTables implemented
114 * by This object.
115 */
116#define _ICOM_THIS_From_IOleObject(class,name) class* This = (class*)name;
117#define _ICOM_THIS_From_NDIUnknown(class, name) class* This = (class*)(((char*)name)-sizeof(void*));
118#define _ICOM_THIS_From_IDataObject(class, name) class* This = (class*)(((char*)name)-2*sizeof(void*));
119#define _ICOM_THIS_From_IRunnableObject(class, name) class* This = (class*)(((char*)name)-3*sizeof(void*));
120
121/*
122 * Prototypes for the methods of the DefaultHandler class.
123 */
124static DefaultHandler* DefaultHandler_Construct(REFCLSID clsid,
125 LPUNKNOWN pUnkOuter);
126static void DefaultHandler_Destroy(DefaultHandler* ptrToDestroy);
127
128/*
129 * Prototypes for the methods of the DefaultHandler class
130 * that implement non delegating IUnknown methods.
131 */
132static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(
133 IUnknown* iface,
134 REFIID riid,
135 void** ppvObject);
136static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
137 IUnknown* iface);
138static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
139 IUnknown* iface);
140
141/*
142 * Prototypes for the methods of the DefaultHandler class
143 * that implement IOleObject methods.
144 */
145static HRESULT WINAPI DefaultHandler_QueryInterface(
146 IOleObject* iface,
147 REFIID riid,
148 void** ppvObject);
149static ULONG WINAPI DefaultHandler_AddRef(
150 IOleObject* iface);
151static ULONG WINAPI DefaultHandler_Release(
152 IOleObject* iface);
153static HRESULT WINAPI DefaultHandler_SetClientSite(
154 IOleObject* iface,
155 IOleClientSite* pClientSite);
156static HRESULT WINAPI DefaultHandler_GetClientSite(
157 IOleObject* iface,
158 IOleClientSite** ppClientSite);
159static HRESULT WINAPI DefaultHandler_SetHostNames(
160 IOleObject* iface,
161 LPCOLESTR szContainerApp,
162 LPCOLESTR szContainerObj);
163static HRESULT WINAPI DefaultHandler_Close(
164 IOleObject* iface,
165 DWORD dwSaveOption);
166static HRESULT WINAPI DefaultHandler_SetMoniker(
167 IOleObject* iface,
168 DWORD dwWhichMoniker,
169 IMoniker* pmk);
170static HRESULT WINAPI DefaultHandler_GetMoniker(
171 IOleObject* iface,
172 DWORD dwAssign,
173 DWORD dwWhichMoniker,
174 IMoniker** ppmk);
175static HRESULT WINAPI DefaultHandler_InitFromData(
176 IOleObject* iface,
177 IDataObject* pDataObject,
178 BOOL fCreation,
179 DWORD dwReserved);
180static HRESULT WINAPI DefaultHandler_GetClipboardData(
181 IOleObject* iface,
182 DWORD dwReserved,
183 IDataObject** ppDataObject);
184static HRESULT WINAPI DefaultHandler_DoVerb(
185 IOleObject* iface,
186 LONG iVerb,
187 LPMSG lpmsg,
188 IOleClientSite* pActiveSite,
189 LONG lindex,
190 HWND hwndParent,
191 LPCRECT lprcPosRect);
192static HRESULT WINAPI DefaultHandler_EnumVerbs(
193 IOleObject* iface,
194 IEnumOLEVERB** ppEnumOleVerb);
195static HRESULT WINAPI DefaultHandler_Update(
196 IOleObject* iface);
197static HRESULT WINAPI DefaultHandler_IsUpToDate(
198 IOleObject* iface);
199static HRESULT WINAPI DefaultHandler_GetUserClassID(
200 IOleObject* iface,
201 CLSID* pClsid);
202static HRESULT WINAPI DefaultHandler_GetUserType(
203 IOleObject* iface,
204 DWORD dwFormOfType,
205 LPOLESTR* pszUserType);
206static HRESULT WINAPI DefaultHandler_SetExtent(
207 IOleObject* iface,
208 DWORD dwDrawAspect,
209 SIZEL* psizel);
210static HRESULT WINAPI DefaultHandler_GetExtent(
211 IOleObject* iface,
212 DWORD dwDrawAspect,
213 SIZEL* psizel);
214static HRESULT WINAPI DefaultHandler_Advise(
215 IOleObject* iface,
216 IAdviseSink* pAdvSink,
217 DWORD* pdwConnection);
218static HRESULT WINAPI DefaultHandler_Unadvise(
219 IOleObject* iface,
220 DWORD dwConnection);
221static HRESULT WINAPI DefaultHandler_EnumAdvise(
222 IOleObject* iface,
223 IEnumSTATDATA** ppenumAdvise);
224static HRESULT WINAPI DefaultHandler_GetMiscStatus(
225 IOleObject* iface,
226 DWORD dwAspect,
227 DWORD* pdwStatus);
228static HRESULT WINAPI DefaultHandler_SetColorScheme(
229 IOleObject* iface,
230 LOGPALETTE* pLogpal);
231
232/*
233 * Prototypes for the methods of the DefaultHandler class
234 * that implement IDataObject methods.
235 */
236static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
237 IDataObject* iface,
238 REFIID riid,
239 void** ppvObject);
240static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
241 IDataObject* iface);
242static ULONG WINAPI DefaultHandler_IDataObject_Release(
243 IDataObject* iface);
244static HRESULT WINAPI DefaultHandler_GetData(
245 IDataObject* iface,
246 LPFORMATETC pformatetcIn,
247 STGMEDIUM* pmedium);
248static HRESULT WINAPI DefaultHandler_GetDataHere(
249 IDataObject* iface,
250 LPFORMATETC pformatetc,
251 STGMEDIUM* pmedium);
252static HRESULT WINAPI DefaultHandler_QueryGetData(
253 IDataObject* iface,
254 LPFORMATETC pformatetc);
255static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
256 IDataObject* iface,
257 LPFORMATETC pformatectIn,
258 LPFORMATETC pformatetcOut);
259static HRESULT WINAPI DefaultHandler_SetData(
260 IDataObject* iface,
261 LPFORMATETC pformatetc,
262 STGMEDIUM* pmedium,
263 BOOL fRelease);
264static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
265 IDataObject* iface,
266 DWORD dwDirection,
267 IEnumFORMATETC** ppenumFormatEtc);
268static HRESULT WINAPI DefaultHandler_DAdvise(
269 IDataObject* iface,
270 FORMATETC* pformatetc,
271 DWORD advf,
272 IAdviseSink* pAdvSink,
273 DWORD* pdwConnection);
274static HRESULT WINAPI DefaultHandler_DUnadvise(
275 IDataObject* iface,
276 DWORD dwConnection);
277static HRESULT WINAPI DefaultHandler_EnumDAdvise(
278 IDataObject* iface,
279 IEnumSTATDATA** ppenumAdvise);
280
281/*
282 * Prototypes for the methods of the DefaultHandler class
283 * that implement IRunnableObject methods.
284 */
285static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(
286 IRunnableObject* iface,
287 REFIID riid,
288 void** ppvObject);
289static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
290 IRunnableObject* iface);
291static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
292 IRunnableObject* iface);
293static HRESULT WINAPI DefaultHandler_GetRunningClass(
294 IRunnableObject* iface,
295 LPCLSID lpClsid);
296static HRESULT WINAPI DefaultHandler_Run(
297 IRunnableObject* iface,
298 IBindCtx* pbc);
299static BOOL WINAPI DefaultHandler_IsRunning(
300 IRunnableObject* iface);
301static HRESULT WINAPI DefaultHandler_LockRunning(
302 IRunnableObject* iface,
303 BOOL fLock,
304 BOOL fLastUnlockCloses);
305static HRESULT WINAPI DefaultHandler_SetContainedObject(
306 IRunnableObject* iface,
307 BOOL fContained);
308
309
310/*
311 * Virtual function tables for the DefaultHandler class.
312 */
313static ICOM_VTABLE(IOleObject) DefaultHandler_IOleObject_VTable =
314{
315 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
316 DefaultHandler_QueryInterface,
317 DefaultHandler_AddRef,
318 DefaultHandler_Release,
319 DefaultHandler_SetClientSite,
320 DefaultHandler_GetClientSite,
321 DefaultHandler_SetHostNames,
322 DefaultHandler_Close,
323 DefaultHandler_SetMoniker,
324 DefaultHandler_GetMoniker,
325 DefaultHandler_InitFromData,
326 DefaultHandler_GetClipboardData,
327 DefaultHandler_DoVerb,
328 DefaultHandler_EnumVerbs,
329 DefaultHandler_Update,
330 DefaultHandler_IsUpToDate,
331 DefaultHandler_GetUserClassID,
332 DefaultHandler_GetUserType,
333 DefaultHandler_SetExtent,
334 DefaultHandler_GetExtent,
335 DefaultHandler_Advise,
336 DefaultHandler_Unadvise,
337 DefaultHandler_EnumAdvise,
338 DefaultHandler_GetMiscStatus,
339 DefaultHandler_SetColorScheme
340};
341
342static ICOM_VTABLE(IUnknown) DefaultHandler_NDIUnknown_VTable =
343{
344 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
345 DefaultHandler_NDIUnknown_QueryInterface,
346 DefaultHandler_NDIUnknown_AddRef,
347 DefaultHandler_NDIUnknown_Release,
348};
349
350static ICOM_VTABLE(IDataObject) DefaultHandler_IDataObject_VTable =
351{
352 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
353 DefaultHandler_IDataObject_QueryInterface,
354 DefaultHandler_IDataObject_AddRef,
355 DefaultHandler_IDataObject_Release,
356 DefaultHandler_GetData,
357 DefaultHandler_GetDataHere,
358 DefaultHandler_QueryGetData,
359 DefaultHandler_GetCanonicalFormatEtc,
360 DefaultHandler_SetData,
361 DefaultHandler_EnumFormatEtc,
362 DefaultHandler_DAdvise,
363 DefaultHandler_DUnadvise,
364 DefaultHandler_EnumDAdvise
365};
366
367static ICOM_VTABLE(IRunnableObject) DefaultHandler_IRunnableObject_VTable =
368{
369 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
370 DefaultHandler_IRunnableObject_QueryInterface,
371 DefaultHandler_IRunnableObject_AddRef,
372 DefaultHandler_IRunnableObject_Release,
373 DefaultHandler_GetRunningClass,
374 DefaultHandler_Run,
375 DefaultHandler_IsRunning,
376 DefaultHandler_LockRunning,
377 DefaultHandler_SetContainedObject
378};
379
380/******************************************************************************
381 * OleCreateDefaultHandler [OLE32.90]
382 */
383HRESULT WINAPI OleCreateDefaultHandler(
384 REFCLSID clsid,
385 LPUNKNOWN pUnkOuter,
386 REFIID riid,
387 LPVOID* ppvObj)
388{
389 DefaultHandler* newHandler = NULL;
390 HRESULT hr = S_OK;
391 char xclsid[50];
392 char xriid[50];
393
394 WINE_StringFromCLSID((LPCLSID)clsid,xclsid);
395 WINE_StringFromCLSID((LPCLSID)riid,xriid);
396
397 TRACE("(%s, %p, %s, %p)\n", xclsid, pUnkOuter, xriid, ppvObj);
398
399 /*
400 * Sanity check
401 */
402 if (ppvObj==0)
403 return E_POINTER;
404
405 *ppvObj = 0;
406
407 /*
408 * If This handler is constructed for aggregation, make sure
409 * the caller is requesting the IUnknown interface.
410 * This is necessary because it's the only time the non-delegating
411 * IUnknown pointer can be returned to the outside.
412 */
413 if ( (pUnkOuter!=NULL) &&
414 (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) )
415 return CLASS_E_NOAGGREGATION;
416
417 /*
418 * Try to construct a new instance of the class.
419 */
420 newHandler = DefaultHandler_Construct(clsid,
421 pUnkOuter);
422
423 if (newHandler == 0)
424 return E_OUTOFMEMORY;
425
426 /*
427 * Make sure it supports the interface required by the caller.
428 */
429 hr = IUnknown_QueryInterface((IUnknown*)&(newHandler->lpvtbl2), riid, ppvObj);
430
431 /*
432 * Release the reference obtained in the constructor. If
433 * the QueryInterface was unsuccessful, it will free the class.
434 */
435 IUnknown_Release((IUnknown*)&(newHandler->lpvtbl2));
436
437 return hr;
438}
439
440/*********************************************************
441 * Methods implementation for the DefaultHandler class.
442 */
443static DefaultHandler* DefaultHandler_Construct(
444 REFCLSID clsid,
445 LPUNKNOWN pUnkOuter)
446{
447 DefaultHandler* newObject = 0;
448
449 /*
450 * Allocate space for the object.
451 */
452 newObject = (DefaultHandler*)HeapAlloc(GetProcessHeap(), 0, sizeof(DefaultHandler));
453
454 if (newObject==0)
455 return newObject;
456
457 /*
458 * Initialize the virtual function table.
459 */
460 newObject->lpvtbl1 = &DefaultHandler_IOleObject_VTable;
461 newObject->lpvtbl2 = &DefaultHandler_NDIUnknown_VTable;
462 newObject->lpvtbl3 = &DefaultHandler_IDataObject_VTable;
463 newObject->lpvtbl4 = &DefaultHandler_IRunnableObject_VTable;
464
465 /*
466 * Start with one reference count. The caller of This function
467 * must release the interface pointer when it is done.
468 */
469 newObject->ref = 1;
470
471 /*
472 * Initialize the outer unknown
473 * We don't keep a reference on the outer unknown since, the way
474 * aggregation works, our lifetime is at least as large as it's
475 * lifetime.
476 */
477 if (pUnkOuter==NULL)
478 pUnkOuter = (IUnknown*)&(newObject->lpvtbl2);
479
480 newObject->outerUnknown = pUnkOuter;
481
482 /*
483 * Create a datacache object.
484 * We aggregate with the datacache. Make sure we pass our outer
485 * unknown as the datacache's outer unknown.
486 */
487 CreateDataCache(newObject->outerUnknown,
488 clsid,
489 &IID_IUnknown,
490 (void**)&newObject->dataCache);
491
492 /*
493 * Initialize the other data members of the class.
494 */
495 memcpy(&(newObject->clsid), clsid, sizeof(CLSID));
496 newObject->clientSite = NULL;
497 newObject->oleAdviseHolder = NULL;
498 newObject->dataAdviseHolder = NULL;
499 newObject->containerApp = NULL;
500 newObject->containerObj = NULL;
501
502 return newObject;
503}
504
505static void DefaultHandler_Destroy(
506 DefaultHandler* ptrToDestroy)
507{
508 /*
509 * Free the strings idenfitying the object
510 */
511 if (ptrToDestroy->containerApp!=NULL)
512 {
513 SysFreeString(ptrToDestroy->containerApp);
514 ptrToDestroy->containerApp = NULL;
515 }
516
517 if (ptrToDestroy->containerObj!=NULL)
518 {
519 SysFreeString(ptrToDestroy->containerObj);
520 ptrToDestroy->containerObj = NULL;
521 }
522
523 /*
524 * Release our reference to the data cache.
525 */
526 if (ptrToDestroy->dataCache!=NULL)
527 {
528 IUnknown_Release(ptrToDestroy->dataCache);
529 ptrToDestroy->dataCache = NULL;
530 }
531
532 /*
533 * Same thing for the client site.
534 */
535 if (ptrToDestroy->clientSite!=NULL)
536 {
537 IOleClientSite_Release(ptrToDestroy->clientSite);
538 ptrToDestroy->clientSite = NULL;
539 }
540
541 /*
542 * And the advise holder.
543 */
544 if (ptrToDestroy->oleAdviseHolder!=NULL)
545 {
546 IOleClientSite_Release(ptrToDestroy->oleAdviseHolder);
547 ptrToDestroy->oleAdviseHolder = NULL;
548 }
549
550 /*
551 * And the data advise holder.
552 */
553 if (ptrToDestroy->dataAdviseHolder!=NULL)
554 {
555 IOleClientSite_Release(ptrToDestroy->dataAdviseHolder);
556 ptrToDestroy->dataAdviseHolder = NULL;
557 }
558
559
560 /*
561 * Free the actual default handler structure.
562 */
563 HeapFree(GetProcessHeap(), 0, ptrToDestroy);
564}
565
566/*********************************************************
567 * Method implementation for the non delegating IUnknown
568 * part of the DefaultHandler class.
569 */
570
571/************************************************************************
572 * DefaultHandler_NDIUnknown_QueryInterface (IUnknown)
573 *
574 * See Windows documentation for more details on IUnknown methods.
575 *
576 * This version of QueryInterface will not delegate it's implementation
577 * to the outer unknown.
578 */
579static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(
580 IUnknown* iface,
581 REFIID riid,
582 void** ppvObject)
583{
584 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
585
586 /*
587 * Perform a sanity check on the parameters.
588 */
589 if ( (This==0) || (ppvObject==0) )
590 return E_INVALIDARG;
591
592 /*
593 * Initialize the return parameter.
594 */
595 *ppvObject = 0;
596
597 /*
598 * Compare the riid with the interface IDs implemented by This object.
599 */
600 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
601 {
602 *ppvObject = iface;
603 }
604 else if (memcmp(&IID_IOleObject, riid, sizeof(IID_IOleObject)) == 0)
605 {
606 *ppvObject = (IOleObject*)&(This->lpvtbl1);
607 }
608 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
609 {
610 *ppvObject = (IDataObject*)&(This->lpvtbl3);
611 }
612 else if (memcmp(&IID_IRunnableObject, riid, sizeof(IID_IRunnableObject)) == 0)
613 {
614 *ppvObject = (IRunnableObject*)&(This->lpvtbl4);
615 }
616 else
617 {
618 /*
619 * Blind aggregate the data cache to "inherit" it's interfaces.
620 */
621 IUnknown_QueryInterface(This->dataCache, riid, ppvObject);
622 }
623
624 /*
625 * Check that we obtained an interface.
626 */
627 if ((*ppvObject)==0)
628 {
629 char clsid[50];
630
631 WINE_StringFromCLSID((LPCLSID)riid,clsid);
632
633 WARN(
634 "() : asking for un supported interface %s\n",
635 clsid);
636
637 return E_NOINTERFACE;
638 }
639
640 /*
641 * Query Interface always increases the reference count by one when it is
642 * successful.
643 */
644 IUnknown_AddRef((IUnknown*)*ppvObject);
645
646 return S_OK;;
647}
648
649/************************************************************************
650 * DefaultHandler_NDIUnknown_AddRef (IUnknown)
651 *
652 * See Windows documentation for more details on IUnknown methods.
653 *
654 * This version of QueryInterface will not delegate it's implementation
655 * to the outer unknown.
656 */
657static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
658 IUnknown* iface)
659{
660 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
661
662 This->ref++;
663
664 return This->ref;
665}
666
667/************************************************************************
668 * DefaultHandler_NDIUnknown_Release (IUnknown)
669 *
670 * See Windows documentation for more details on IUnknown methods.
671 *
672 * This version of QueryInterface will not delegate it's implementation
673 * to the outer unknown.
674 */
675static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
676 IUnknown* iface)
677{
678 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
679
680 /*
681 * Decrease the reference count on This object.
682 */
683 This->ref--;
684
685 /*
686 * If the reference count goes down to 0, perform suicide.
687 */
688 if (This->ref==0)
689 {
690 DefaultHandler_Destroy(This);
691
692 return 0;
693 }
694
695 return This->ref;
696}
697
698/*********************************************************
699 * Methods implementation for the IOleObject part of
700 * the DefaultHandler class.
701 */
702
703/************************************************************************
704 * DefaultHandler_QueryInterface (IUnknown)
705 *
706 * See Windows documentation for more details on IUnknown methods.
707 */
708static HRESULT WINAPI DefaultHandler_QueryInterface(
709 IOleObject* iface,
710 REFIID riid,
711 void** ppvObject)
712{
713 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
714
715 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
716}
717
718/************************************************************************
719 * DefaultHandler_AddRef (IUnknown)
720 *
721 * See Windows documentation for more details on IUnknown methods.
722 */
723static ULONG WINAPI DefaultHandler_AddRef(
724 IOleObject* iface)
725{
726 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
727
728 return IUnknown_AddRef(This->outerUnknown);
729}
730
731/************************************************************************
732 * DefaultHandler_Release (IUnknown)
733 *
734 * See Windows documentation for more details on IUnknown methods.
735 */
736static ULONG WINAPI DefaultHandler_Release(
737 IOleObject* iface)
738{
739 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
740
741 return IUnknown_Release(This->outerUnknown);
742}
743
744/************************************************************************
745 * DefaultHandler_SetClientSite (IOleObject)
746 *
747 * The default handler's implementation of This method only keeps the
748 * client site pointer for future reference.
749 *
750 * See Windows documentation for more details on IOleObject methods.
751 */
752static HRESULT WINAPI DefaultHandler_SetClientSite(
753 IOleObject* iface,
754 IOleClientSite* pClientSite)
755{
756 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
757
758 TRACE("(%p, %p)\n", iface, pClientSite);
759
760 /*
761 * Make sure we release the previous client site if there
762 * was one.
763 */
764 if (This->clientSite!=NULL)
765 {
766 IOleClientSite_Release(This->clientSite);
767 }
768
769 This->clientSite = pClientSite;
770
771 if (This->clientSite!=NULL)
772 {
773 IOleClientSite_AddRef(This->clientSite);
774 }
775
776 return S_OK;
777}
778
779/************************************************************************
780 * DefaultHandler_GetClientSite (IOleObject)
781 *
782 * The default handler's implementation of This method returns the
783 * last pointer set in IOleObject_SetClientSite.
784 *
785 * See Windows documentation for more details on IOleObject methods.
786 */
787static HRESULT WINAPI DefaultHandler_GetClientSite(
788 IOleObject* iface,
789 IOleClientSite** ppClientSite)
790{
791 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
792
793 /*
794 * Sanity check.
795 */
796 if (ppClientSite == NULL)
797 return E_POINTER;
798
799 *ppClientSite = This->clientSite;
800
801 if (*ppClientSite!=NULL)
802 {
803 IOleClientSite_Release(*ppClientSite);
804 }
805
806 return S_OK;
807}
808
809/************************************************************************
810 * DefaultHandler_SetHostNames (IOleObject)
811 *
812 * The default handler's implementation of This method just stores
813 * the strings and returns S_OK.
814 *
815 * See Windows documentation for more details on IOleObject methods.
816 */
817static HRESULT WINAPI DefaultHandler_SetHostNames(
818 IOleObject* iface,
819 LPCOLESTR szContainerApp,
820 LPCOLESTR szContainerObj)
821{
822 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
823
824 TRACE("(%p, %s, %s)\n",
825 iface,
826 debugstr_w(szContainerApp),
827 debugstr_w(szContainerObj));
828
829 /*
830 * Be sure to cleanup before re-assinging the strings.
831 */
832 if (This->containerApp!=NULL)
833 {
834 SysFreeString(This->containerApp);
835 This->containerApp = NULL;
836 }
837
838 if (This->containerObj!=NULL)
839 {
840 SysFreeString(This->containerObj);
841 This->containerObj = NULL;
842 }
843
844 /*
845 * Copy the string supplied.
846 */
847 if (szContainerApp != NULL)
848 This->containerApp = SysAllocString(szContainerApp);
849
850 if (szContainerObj != NULL)
851 This->containerObj = SysAllocString(szContainerObj);
852
853 return S_OK;
854}
855
856/************************************************************************
857 * DefaultHandler_Close (IOleObject)
858 *
859 * The default handler's implementation of This method is meaningless
860 * without a running server so it does nothing.
861 *
862 * See Windows documentation for more details on IOleObject methods.
863 */
864static HRESULT WINAPI DefaultHandler_Close(
865 IOleObject* iface,
866 DWORD dwSaveOption)
867{
868 TRACE("()\n");
869 return S_OK;
870}
871
872/************************************************************************
873 * DefaultHandler_SetMoniker (IOleObject)
874 *
875 * The default handler's implementation of This method does nothing.
876 *
877 * See Windows documentation for more details on IOleObject methods.
878 */
879static HRESULT WINAPI DefaultHandler_SetMoniker(
880 IOleObject* iface,
881 DWORD dwWhichMoniker,
882 IMoniker* pmk)
883{
884 TRACE("(%p, %ld, %p)\n",
885 iface,
886 dwWhichMoniker,
887 pmk);
888
889 return S_OK;
890}
891
892/************************************************************************
893 * DefaultHandler_GetMoniker (IOleObject)
894 *
895 * Delegate This request to the client site if we have one.
896 *
897 * See Windows documentation for more details on IOleObject methods.
898 */
899static HRESULT WINAPI DefaultHandler_GetMoniker(
900 IOleObject* iface,
901 DWORD dwAssign,
902 DWORD dwWhichMoniker,
903 IMoniker** ppmk)
904{
905 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
906
907 TRACE("(%p, %ld, %ld, %p)\n",
908 iface, dwAssign, dwWhichMoniker, ppmk);
909
910 if (This->clientSite)
911 {
912 return IOleClientSite_GetMoniker(This->clientSite,
913 dwAssign,
914 dwWhichMoniker,
915 ppmk);
916
917 }
918
919 return E_UNSPEC;
920}
921
922/************************************************************************
923 * DefaultHandler_InitFromData (IOleObject)
924 *
925 * This method is meaningless if the server is not running
926 *
927 * See Windows documentation for more details on IOleObject methods.
928 */
929static HRESULT WINAPI DefaultHandler_InitFromData(
930 IOleObject* iface,
931 IDataObject* pDataObject,
932 BOOL fCreation,
933 DWORD dwReserved)
934{
935 TRACE("(%p, %p, %d, %ld)\n",
936 iface, pDataObject, fCreation, dwReserved);
937
938 return OLE_E_NOTRUNNING;
939}
940
941/************************************************************************
942 * DefaultHandler_GetClipboardData (IOleObject)
943 *
944 * This method is meaningless if the server is not running
945 *
946 * See Windows documentation for more details on IOleObject methods.
947 */
948static HRESULT WINAPI DefaultHandler_GetClipboardData(
949 IOleObject* iface,
950 DWORD dwReserved,
951 IDataObject** ppDataObject)
952{
953 TRACE("(%p, %ld, %p)\n",
954 iface, dwReserved, ppDataObject);
955
956 return OLE_E_NOTRUNNING;
957}
958
959static HRESULT WINAPI DefaultHandler_DoVerb(
960 IOleObject* iface,
961 LONG iVerb,
962 LPMSG lpmsg,
963 IOleClientSite* pActiveSite,
964 LONG lindex,
965 HWND hwndParent,
966 LPCRECT lprcPosRect)
967{
968 FIXME(": Stub\n");
969 return E_NOTIMPL;
970}
971
972/************************************************************************
973 * DefaultHandler_EnumVerbs (IOleObject)
974 *
975 * The default handler implementation of This method simply delegates
976 * to OleRegEnumVerbs
977 *
978 * See Windows documentation for more details on IOleObject methods.
979 */
980static HRESULT WINAPI DefaultHandler_EnumVerbs(
981 IOleObject* iface,
982 IEnumOLEVERB** ppEnumOleVerb)
983{
984 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
985
986 TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
987
988 return OleRegEnumVerbs(&This->clsid, ppEnumOleVerb);
989}
990
991static HRESULT WINAPI DefaultHandler_Update(
992 IOleObject* iface)
993{
994 FIXME(": Stub\n");
995 return E_NOTIMPL;
996}
997
998/************************************************************************
999 * DefaultHandler_IsUpToDate (IOleObject)
1000 *
1001 * This method is meaningless if the server is not running
1002 *
1003 * See Windows documentation for more details on IOleObject methods.
1004 */
1005static HRESULT WINAPI DefaultHandler_IsUpToDate(
1006 IOleObject* iface)
1007{
1008 TRACE("(%p)\n", iface);
1009
1010 return OLE_E_NOTRUNNING;
1011}
1012
1013/************************************************************************
1014 * DefaultHandler_GetUserClassID (IOleObject)
1015 *
1016 * TODO: Map to a new class ID if emulation is active.
1017 *
1018 * See Windows documentation for more details on IOleObject methods.
1019 */
1020static HRESULT WINAPI DefaultHandler_GetUserClassID(
1021 IOleObject* iface,
1022 CLSID* pClsid)
1023{
1024 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1025
1026 TRACE("(%p, %p)\n", iface, pClsid);
1027
1028 /*
1029 * Sanity check.
1030 */
1031 if (pClsid==NULL)
1032 return E_POINTER;
1033
1034 memcpy(pClsid, &This->clsid, sizeof(CLSID));
1035
1036 return S_OK;
1037}
1038
1039/************************************************************************
1040 * DefaultHandler_GetUserType (IOleObject)
1041 *
1042 * The default handler implementation of This method simply delegates
1043 * to OleRegGetUserType
1044 *
1045 * See Windows documentation for more details on IOleObject methods.
1046 */
1047static HRESULT WINAPI DefaultHandler_GetUserType(
1048 IOleObject* iface,
1049 DWORD dwFormOfType,
1050 LPOLESTR* pszUserType)
1051{
1052 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1053
1054 TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType);
1055
1056 return OleRegGetUserType(&This->clsid, dwFormOfType, pszUserType);
1057}
1058
1059/************************************************************************
1060 * DefaultHandler_SetExtent (IOleObject)
1061 *
1062 * This method is meaningless if the server is not running
1063 *
1064 * See Windows documentation for more details on IOleObject methods.
1065 */
1066static HRESULT WINAPI DefaultHandler_SetExtent(
1067 IOleObject* iface,
1068 DWORD dwDrawAspect,
1069 SIZEL* psizel)
1070{
1071 TRACE("(%p, %lx, (%d,%d))\n", iface, dwDrawAspect, psizel->cx, psizel->cy);
1072 return OLE_E_NOTRUNNING;
1073}
1074
1075/************************************************************************
1076 * DefaultHandler_GetExtent (IOleObject)
1077 *
1078 * The default handler's implementation of This method returns uses
1079 * the cache to locate the aspect and extract the extent from it.
1080 *
1081 * See Windows documentation for more details on IOleObject methods.
1082 */
1083static HRESULT WINAPI DefaultHandler_GetExtent(
1084 IOleObject* iface,
1085 DWORD dwDrawAspect,
1086 SIZEL* psizel)
1087{
1088 DVTARGETDEVICE* targetDevice;
1089 IViewObject2* cacheView = NULL;
1090 HRESULT hres;
1091
1092 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1093
1094 TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
1095
1096 hres = IUnknown_QueryInterface(This->dataCache, &IID_IViewObject2, (void**)&cacheView);
1097
1098 if (FAILED(hres))
1099 return E_UNEXPECTED;
1100
1101 /*
1102 * Prepare the call to the cache's GetExtent method.
1103 *
1104 * Here we would build a valid DVTARGETDEVICE structure
1105 * but, since we are calling into the data cache, we
1106 * know it's implementation and we'll skip This
1107 * extra work until later.
1108 */
1109 targetDevice = NULL;
1110
1111 hres = IViewObject2_GetExtent(cacheView,
1112 dwDrawAspect,
1113 -1,
1114 targetDevice,
1115 psizel);
1116
1117 /*
1118 * Cleanup
1119 */
1120 IViewObject2_Release(cacheView);
1121
1122 return hres;
1123}
1124
1125/************************************************************************
1126 * DefaultHandler_Advise (IOleObject)
1127 *
1128 * The default handler's implementation of This method simply
1129 * delegates to the OleAdviseHolder.
1130 *
1131 * See Windows documentation for more details on IOleObject methods.
1132 */
1133static HRESULT WINAPI DefaultHandler_Advise(
1134 IOleObject* iface,
1135 IAdviseSink* pAdvSink,
1136 DWORD* pdwConnection)
1137{
1138 HRESULT hres = S_OK;
1139 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1140
1141 TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
1142
1143 /*
1144 * Make sure we have an advise holder before we start.
1145 */
1146 if (This->oleAdviseHolder==NULL)
1147 {
1148 hres = CreateOleAdviseHolder(&This->oleAdviseHolder);
1149 }
1150
1151 if (SUCCEEDED(hres))
1152 {
1153 hres = IOleAdviseHolder_Advise(This->oleAdviseHolder,
1154 pAdvSink,
1155 pdwConnection);
1156 }
1157
1158 return hres;
1159}
1160
1161/************************************************************************
1162 * DefaultHandler_Unadvise (IOleObject)
1163 *
1164 * The default handler's implementation of This method simply
1165 * delegates to the OleAdviseHolder.
1166 *
1167 * See Windows documentation for more details on IOleObject methods.
1168 */
1169static HRESULT WINAPI DefaultHandler_Unadvise(
1170 IOleObject* iface,
1171 DWORD dwConnection)
1172{
1173 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1174
1175 TRACE("(%p, %ld)\n", iface, dwConnection);
1176
1177 /*
1178 * If we don't have an advise holder yet, it means we don't have
1179 * a connection.
1180 */
1181 if (This->oleAdviseHolder==NULL)
1182 return OLE_E_NOCONNECTION;
1183
1184 return IOleAdviseHolder_Unadvise(This->oleAdviseHolder,
1185 dwConnection);
1186}
1187
1188/************************************************************************
1189 * DefaultHandler_EnumAdvise (IOleObject)
1190 *
1191 * The default handler's implementation of This method simply
1192 * delegates to the OleAdviseHolder.
1193 *
1194 * See Windows documentation for more details on IOleObject methods.
1195 */
1196static HRESULT WINAPI DefaultHandler_EnumAdvise(
1197 IOleObject* iface,
1198 IEnumSTATDATA** ppenumAdvise)
1199{
1200 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1201
1202 TRACE("(%p, %p)\n", iface, ppenumAdvise);
1203
1204 /*
1205 * Sanity check
1206 */
1207 if (ppenumAdvise==NULL)
1208 return E_POINTER;
1209
1210 /*
1211 * Initialize the out parameter.
1212 */
1213 *ppenumAdvise = NULL;
1214
1215 if (This->oleAdviseHolder==NULL)
1216 return IOleAdviseHolder_EnumAdvise(This->oleAdviseHolder,
1217 ppenumAdvise);
1218
1219 return S_OK;
1220}
1221
1222/************************************************************************
1223 * DefaultHandler_GetMiscStatus (IOleObject)
1224 *
1225 * The default handler's implementation of This method simply delegates
1226 * to OleRegGetMiscStatus.
1227 *
1228 * See Windows documentation for more details on IOleObject methods.
1229 */
1230static HRESULT WINAPI DefaultHandler_GetMiscStatus(
1231 IOleObject* iface,
1232 DWORD dwAspect,
1233 DWORD* pdwStatus)
1234{
1235 HRESULT hres;
1236 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1237
1238 TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
1239
1240 hres = OleRegGetMiscStatus(&(This->clsid), dwAspect, pdwStatus);
1241
1242 if (FAILED(hres))
1243 *pdwStatus = 0;
1244
1245 return S_OK;
1246}
1247
1248/************************************************************************
1249 * DefaultHandler_SetExtent (IOleObject)
1250 *
1251 * This method is meaningless if the server is not running
1252 *
1253 * See Windows documentation for more details on IOleObject methods.
1254 */
1255static HRESULT WINAPI DefaultHandler_SetColorScheme(
1256 IOleObject* iface,
1257 LOGPALETTE* pLogpal)
1258{
1259 TRACE("(%p, %p))\n", iface, pLogpal);
1260 return OLE_E_NOTRUNNING;
1261}
1262
1263/*********************************************************
1264 * Methods implementation for the IDataObject part of
1265 * the DefaultHandler class.
1266 */
1267
1268/************************************************************************
1269 * DefaultHandler_IDataObject_QueryInterface (IUnknown)
1270 *
1271 * See Windows documentation for more details on IUnknown methods.
1272 */
1273static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
1274 IDataObject* iface,
1275 REFIID riid,
1276 void** ppvObject)
1277{
1278 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1279
1280 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
1281}
1282
1283/************************************************************************
1284 * DefaultHandler_IDataObject_AddRef (IUnknown)
1285 *
1286 * See Windows documentation for more details on IUnknown methods.
1287 */
1288static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
1289 IDataObject* iface)
1290{
1291 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1292
1293 return IUnknown_AddRef(This->outerUnknown);
1294}
1295
1296/************************************************************************
1297 * DefaultHandler_IDataObject_Release (IUnknown)
1298 *
1299 * See Windows documentation for more details on IUnknown methods.
1300 */
1301static ULONG WINAPI DefaultHandler_IDataObject_Release(
1302 IDataObject* iface)
1303{
1304 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1305
1306 return IUnknown_Release(This->outerUnknown);
1307}
1308
1309static HRESULT WINAPI DefaultHandler_GetData(
1310 IDataObject* iface,
1311 LPFORMATETC pformatetcIn,
1312 STGMEDIUM* pmedium)
1313{
1314 FIXME(": Stub\n");
1315 return E_NOTIMPL;
1316}
1317
1318static HRESULT WINAPI DefaultHandler_GetDataHere(
1319 IDataObject* iface,
1320 LPFORMATETC pformatetc,
1321 STGMEDIUM* pmedium)
1322{
1323 FIXME(": Stub\n");
1324 return E_NOTIMPL;
1325}
1326
1327/************************************************************************
1328 * DefaultHandler_QueryGetData (IDataObject)
1329 *
1330 * The default handler's implementation of This method delegates to
1331 * the cache.
1332 *
1333 * See Windows documentation for more details on IDataObject methods.
1334 */
1335static HRESULT WINAPI DefaultHandler_QueryGetData(
1336 IDataObject* iface,
1337 LPFORMATETC pformatetc)
1338{
1339 IDataObject* cacheDataObject = NULL;
1340 HRESULT hres;
1341
1342 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1343
1344 TRACE("(%p, %p)\n", iface, pformatetc);
1345
1346 hres = IUnknown_QueryInterface(This->dataCache,
1347 &IID_IDataObject,
1348 (void**)&cacheDataObject);
1349
1350 if (FAILED(hres))
1351 return E_UNEXPECTED;
1352
1353 hres = IDataObject_QueryGetData(cacheDataObject,
1354 pformatetc);
1355
1356 IDataObject_Release(cacheDataObject);
1357
1358 return hres;
1359}
1360
1361/************************************************************************
1362 * DefaultHandler_GetCanonicalFormatEtc (IDataObject)
1363 *
1364 * This method is meaningless if the server is not running
1365 *
1366 * See Windows documentation for more details on IDataObject methods.
1367 */
1368static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
1369 IDataObject* iface,
1370 LPFORMATETC pformatectIn,
1371 LPFORMATETC pformatetcOut)
1372{
1373 FIXME("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut);
1374
1375 return OLE_E_NOTRUNNING;
1376}
1377
1378/************************************************************************
1379 * DefaultHandler_SetData (IDataObject)
1380 *
1381 * The default handler's implementation of This method delegates to
1382 * the cache.
1383 *
1384 * See Windows documentation for more details on IDataObject methods.
1385 */
1386static HRESULT WINAPI DefaultHandler_SetData(
1387 IDataObject* iface,
1388 LPFORMATETC pformatetc,
1389 STGMEDIUM* pmedium,
1390 BOOL fRelease)
1391{
1392 IDataObject* cacheDataObject = NULL;
1393 HRESULT hres;
1394
1395 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1396
1397 TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
1398
1399 hres = IUnknown_QueryInterface(This->dataCache,
1400 &IID_IDataObject,
1401 (void**)&cacheDataObject);
1402
1403 if (FAILED(hres))
1404 return E_UNEXPECTED;
1405
1406 hres = IDataObject_SetData(cacheDataObject,
1407 pformatetc,
1408 pmedium,
1409 fRelease);
1410
1411 IDataObject_Release(cacheDataObject);
1412
1413 return hres;
1414}
1415
1416/************************************************************************
1417 * DefaultHandler_EnumFormatEtc (IDataObject)
1418 *
1419 * The default handler's implementation of This method simply delegates
1420 * to OleRegEnumFormatEtc.
1421 *
1422 * See Windows documentation for more details on IDataObject methods.
1423 */
1424static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
1425 IDataObject* iface,
1426 DWORD dwDirection,
1427 IEnumFORMATETC** ppenumFormatEtc)
1428{
1429 HRESULT hres;
1430 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1431
1432 TRACE("(%p, %lx, %p)\n", iface, dwDirection, ppenumFormatEtc);
1433
1434 hres = OleRegEnumFormatEtc(&(This->clsid), dwDirection, ppenumFormatEtc);
1435
1436 return hres;
1437}
1438
1439/************************************************************************
1440 * DefaultHandler_DAdvise (IDataObject)
1441 *
1442 * The default handler's implementation of This method simply
1443 * delegates to the DataAdviseHolder.
1444 *
1445 * See Windows documentation for more details on IDataObject methods.
1446 */
1447static HRESULT WINAPI DefaultHandler_DAdvise(
1448 IDataObject* iface,
1449 FORMATETC* pformatetc,
1450 DWORD advf,
1451 IAdviseSink* pAdvSink,
1452 DWORD* pdwConnection)
1453{
1454 HRESULT hres = S_OK;
1455 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1456
1457 TRACE("(%p, %p, %ld, %p, %p)\n",
1458 iface, pformatetc, advf, pAdvSink, pdwConnection);
1459
1460 /*
1461 * Make sure we have a data advise holder before we start.
1462 */
1463 if (This->dataAdviseHolder==NULL)
1464 {
1465 hres = CreateDataAdviseHolder(&This->dataAdviseHolder);
1466 }
1467
1468 if (SUCCEEDED(hres))
1469 {
1470 hres = IDataAdviseHolder_Advise(This->dataAdviseHolder,
1471 iface,
1472 pformatetc,
1473 advf,
1474 pAdvSink,
1475 pdwConnection);
1476 }
1477
1478 return hres;
1479}
1480
1481/************************************************************************
1482 * DefaultHandler_DUnadvise (IDataObject)
1483 *
1484 * The default handler's implementation of This method simply
1485 * delegates to the DataAdviseHolder.
1486 *
1487 * See Windows documentation for more details on IDataObject methods.
1488 */
1489static HRESULT WINAPI DefaultHandler_DUnadvise(
1490 IDataObject* iface,
1491 DWORD dwConnection)
1492{
1493 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1494
1495 TRACE("(%p, %ld)\n", iface, dwConnection);
1496
1497 /*
1498 * If we don't have a data advise holder yet, it means that
1499 * we don't have any connections..
1500 */
1501 if (This->dataAdviseHolder==NULL)
1502 {
1503 return OLE_E_NOCONNECTION;
1504 }
1505
1506 return IDataAdviseHolder_Unadvise(This->dataAdviseHolder,
1507 dwConnection);
1508}
1509
1510/************************************************************************
1511 * DefaultHandler_EnumDAdvise (IDataObject)
1512 *
1513 * The default handler's implementation of This method simply
1514 * delegates to the DataAdviseHolder.
1515 *
1516 * See Windows documentation for more details on IDataObject methods.
1517 */
1518static HRESULT WINAPI DefaultHandler_EnumDAdvise(
1519 IDataObject* iface,
1520 IEnumSTATDATA** ppenumAdvise)
1521{
1522 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1523
1524 TRACE("(%p, %p)\n", iface, ppenumAdvise);
1525
1526 /*
1527 * Sanity check
1528 */
1529 if (ppenumAdvise == NULL)
1530 return E_POINTER;
1531
1532 /*
1533 * Initialize the out parameter.
1534 */
1535 *ppenumAdvise = NULL;
1536
1537 /*
1538 * If we have a data advise holder object, delegate.
1539 */
1540 if (This->dataAdviseHolder!=NULL)
1541 {
1542 return IDataAdviseHolder_EnumAdvise(This->dataAdviseHolder,
1543 ppenumAdvise);
1544 }
1545
1546 return S_OK;
1547}
1548
1549/*********************************************************
1550 * Methods implementation for the IRunnableObject part
1551 * of the DefaultHandler class.
1552 */
1553
1554/************************************************************************
1555 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1556 *
1557 * See Windows documentation for more details on IUnknown methods.
1558 */
1559static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(
1560 IRunnableObject* iface,
1561 REFIID riid,
1562 void** ppvObject)
1563{
1564 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1565
1566 return IUnknown_QueryInterface(This->outerUnknown, riid, ppvObject);
1567}
1568
1569/************************************************************************
1570 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1571 *
1572 * See Windows documentation for more details on IUnknown methods.
1573 */
1574static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
1575 IRunnableObject* iface)
1576{
1577 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1578
1579 return IUnknown_AddRef(This->outerUnknown);
1580}
1581
1582/************************************************************************
1583 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1584 *
1585 * See Windows documentation for more details on IUnknown methods.
1586 */
1587static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
1588 IRunnableObject* iface)
1589{
1590 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1591
1592 return IUnknown_Release(This->outerUnknown);
1593}
1594
1595/************************************************************************
1596 * DefaultHandler_GetRunningClass (IRunnableObject)
1597 *
1598 * According to Brockscmidt, Chapter 19, the default handler's
1599 * implementation of IRunnableobject does nothing until the object
1600 * is actually running.
1601 *
1602 * See Windows documentation for more details on IRunnableObject methods.
1603 */
1604static HRESULT WINAPI DefaultHandler_GetRunningClass(
1605 IRunnableObject* iface,
1606 LPCLSID lpClsid)
1607{
1608 TRACE("()\n");
1609 return S_OK;
1610}
1611
1612static HRESULT WINAPI DefaultHandler_Run(
1613 IRunnableObject* iface,
1614 IBindCtx* pbc)
1615{
1616 FIXME(": Stub\n");
1617 return E_NOTIMPL;
1618}
1619
1620/************************************************************************
1621 * DefaultHandler_IsRunning (IRunnableObject)
1622 *
1623 * According to Brockscmidt, Chapter 19, the default handler's
1624 * implementation of IRunnableobject does nothing until the object
1625 * is actually running.
1626 *
1627 * See Windows documentation for more details on IRunnableObject methods.
1628 */
1629static BOOL WINAPI DefaultHandler_IsRunning(
1630 IRunnableObject* iface)
1631{
1632 TRACE("()\n");
1633 return S_FALSE;
1634}
1635
1636/************************************************************************
1637 * DefaultHandler_LockRunning (IRunnableObject)
1638 *
1639 * According to Brockscmidt, Chapter 19, the default handler's
1640 * implementation of IRunnableobject does nothing until the object
1641 * is actually running.
1642 *
1643 * See Windows documentation for more details on IRunnableObject methods.
1644 */
1645static HRESULT WINAPI DefaultHandler_LockRunning(
1646 IRunnableObject* iface,
1647 BOOL fLock,
1648 BOOL fLastUnlockCloses)
1649{
1650 TRACE("()\n");
1651 return S_OK;
1652}
1653
1654/************************************************************************
1655 * DefaultHandler_SetContainedObject (IRunnableObject)
1656 *
1657 * According to Brockscmidt, Chapter 19, the default handler's
1658 * implementation of IRunnableobject does nothing until the object
1659 * is actually running.
1660 *
1661 * See Windows documentation for more details on IRunnableObject methods.
1662 */
1663static HRESULT WINAPI DefaultHandler_SetContainedObject(
1664 IRunnableObject* iface,
1665 BOOL fContained)
1666{
1667 TRACE("()\n");
1668 return S_OK;
1669}
1670
Note: See TracBrowser for help on using the repository browser.