Fixed strict aliasing issues in dlls/ole32.
[wine/multimedia.git] / dlls / ole32 / defaulthandler.c
blob639e84ec020aa2a5a4103b02638f54f98325baed
1 /*
2 * OLE 2 default object handler
4 * Copyright 1999 Francis Beaudet
5 * Copyright 2000 Abey George
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
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.
27 * All the implementation details are taken from: Inside OLE
28 * second edition by Kraig Brockschmidt,
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
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.
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.
45 * - All the methods related to notification and advise sinks are
46 * in place but no notifications are sent to the sinks yet.
48 #include <assert.h>
49 #include <stdarg.h>
50 #include <string.h>
52 #include "windef.h"
53 #include "winbase.h"
54 #include "winuser.h"
55 #include "winerror.h"
56 #include "wine/unicode.h"
57 #include "ole2.h"
58 #include "wine/debug.h"
60 WINE_DEFAULT_DEBUG_CHANNEL(ole);
62 /****************************************************************************
63 * DefaultHandler
66 struct DefaultHandler
69 * List all interface VTables here
71 ICOM_VTABLE(IOleObject)* lpvtbl1;
72 ICOM_VTABLE(IUnknown)* lpvtbl2;
73 ICOM_VTABLE(IDataObject)* lpvtbl3;
74 ICOM_VTABLE(IRunnableObject)* lpvtbl4;
77 * Reference count of this object
79 ULONG ref;
82 * IUnknown implementation of the outer object.
84 IUnknown* outerUnknown;
87 * Class Id that this handler object represents.
89 CLSID clsid;
92 * IUnknown implementation of the datacache.
94 IUnknown* dataCache;
97 * Client site for the embedded object.
99 IOleClientSite* clientSite;
102 * The IOleAdviseHolder maintains the connections
103 * on behalf of the default handler.
105 IOleAdviseHolder* oleAdviseHolder;
108 * The IDataAdviseHolder maintains the data
109 * connections on behalf of the default handler.
111 IDataAdviseHolder* dataAdviseHolder;
114 * Name of the container and object contained
116 LPWSTR containerApp;
117 LPWSTR containerObj;
121 typedef struct DefaultHandler DefaultHandler;
124 * Here, I define utility macros to help with the casting of the
125 * "this" parameter.
126 * There is a version to accomodate all of the VTables implemented
127 * by this object.
129 #define _ICOM_THIS_From_IOleObject(class,name) class* this = (class*)name;
130 #define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*));
131 #define _ICOM_THIS_From_IDataObject(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*));
132 #define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
135 * Prototypes for the methods of the DefaultHandler class.
137 static DefaultHandler* DefaultHandler_Construct(REFCLSID clsid,
138 LPUNKNOWN pUnkOuter);
139 static void DefaultHandler_Destroy(DefaultHandler* ptrToDestroy);
142 * Prototypes for the methods of the DefaultHandler class
143 * that implement non delegating IUnknown methods.
145 static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(
146 IUnknown* iface,
147 REFIID riid,
148 void** ppvObject);
149 static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
150 IUnknown* iface);
151 static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
152 IUnknown* iface);
155 * Prototypes for the methods of the DefaultHandler class
156 * that implement IOleObject methods.
158 static HRESULT WINAPI DefaultHandler_QueryInterface(
159 IOleObject* iface,
160 REFIID riid,
161 void** ppvObject);
162 static ULONG WINAPI DefaultHandler_AddRef(
163 IOleObject* iface);
164 static ULONG WINAPI DefaultHandler_Release(
165 IOleObject* iface);
166 static HRESULT WINAPI DefaultHandler_SetClientSite(
167 IOleObject* iface,
168 IOleClientSite* pClientSite);
169 static HRESULT WINAPI DefaultHandler_GetClientSite(
170 IOleObject* iface,
171 IOleClientSite** ppClientSite);
172 static HRESULT WINAPI DefaultHandler_SetHostNames(
173 IOleObject* iface,
174 LPCOLESTR szContainerApp,
175 LPCOLESTR szContainerObj);
176 static HRESULT WINAPI DefaultHandler_Close(
177 IOleObject* iface,
178 DWORD dwSaveOption);
179 static HRESULT WINAPI DefaultHandler_SetMoniker(
180 IOleObject* iface,
181 DWORD dwWhichMoniker,
182 IMoniker* pmk);
183 static HRESULT WINAPI DefaultHandler_GetMoniker(
184 IOleObject* iface,
185 DWORD dwAssign,
186 DWORD dwWhichMoniker,
187 IMoniker** ppmk);
188 static HRESULT WINAPI DefaultHandler_InitFromData(
189 IOleObject* iface,
190 IDataObject* pDataObject,
191 BOOL fCreation,
192 DWORD dwReserved);
193 static HRESULT WINAPI DefaultHandler_GetClipboardData(
194 IOleObject* iface,
195 DWORD dwReserved,
196 IDataObject** ppDataObject);
197 static HRESULT WINAPI DefaultHandler_DoVerb(
198 IOleObject* iface,
199 LONG iVerb,
200 struct tagMSG* lpmsg,
201 IOleClientSite* pActiveSite,
202 LONG lindex,
203 HWND hwndParent,
204 LPCRECT lprcPosRect);
205 static HRESULT WINAPI DefaultHandler_EnumVerbs(
206 IOleObject* iface,
207 IEnumOLEVERB** ppEnumOleVerb);
208 static HRESULT WINAPI DefaultHandler_Update(
209 IOleObject* iface);
210 static HRESULT WINAPI DefaultHandler_IsUpToDate(
211 IOleObject* iface);
212 static HRESULT WINAPI DefaultHandler_GetUserClassID(
213 IOleObject* iface,
214 CLSID* pClsid);
215 static HRESULT WINAPI DefaultHandler_GetUserType(
216 IOleObject* iface,
217 DWORD dwFormOfType,
218 LPOLESTR* pszUserType);
219 static HRESULT WINAPI DefaultHandler_SetExtent(
220 IOleObject* iface,
221 DWORD dwDrawAspect,
222 SIZEL* psizel);
223 static HRESULT WINAPI DefaultHandler_GetExtent(
224 IOleObject* iface,
225 DWORD dwDrawAspect,
226 SIZEL* psizel);
227 static HRESULT WINAPI DefaultHandler_Advise(
228 IOleObject* iface,
229 IAdviseSink* pAdvSink,
230 DWORD* pdwConnection);
231 static HRESULT WINAPI DefaultHandler_Unadvise(
232 IOleObject* iface,
233 DWORD dwConnection);
234 static HRESULT WINAPI DefaultHandler_EnumAdvise(
235 IOleObject* iface,
236 IEnumSTATDATA** ppenumAdvise);
237 static HRESULT WINAPI DefaultHandler_GetMiscStatus(
238 IOleObject* iface,
239 DWORD dwAspect,
240 DWORD* pdwStatus);
241 static HRESULT WINAPI DefaultHandler_SetColorScheme(
242 IOleObject* iface,
243 struct tagLOGPALETTE* pLogpal);
246 * Prototypes for the methods of the DefaultHandler class
247 * that implement IDataObject methods.
249 static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
250 IDataObject* iface,
251 REFIID riid,
252 void** ppvObject);
253 static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
254 IDataObject* iface);
255 static ULONG WINAPI DefaultHandler_IDataObject_Release(
256 IDataObject* iface);
257 static HRESULT WINAPI DefaultHandler_GetData(
258 IDataObject* iface,
259 LPFORMATETC pformatetcIn,
260 STGMEDIUM* pmedium);
261 static HRESULT WINAPI DefaultHandler_GetDataHere(
262 IDataObject* iface,
263 LPFORMATETC pformatetc,
264 STGMEDIUM* pmedium);
265 static HRESULT WINAPI DefaultHandler_QueryGetData(
266 IDataObject* iface,
267 LPFORMATETC pformatetc);
268 static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
269 IDataObject* iface,
270 LPFORMATETC pformatectIn,
271 LPFORMATETC pformatetcOut);
272 static HRESULT WINAPI DefaultHandler_SetData(
273 IDataObject* iface,
274 LPFORMATETC pformatetc,
275 STGMEDIUM* pmedium,
276 BOOL fRelease);
277 static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
278 IDataObject* iface,
279 DWORD dwDirection,
280 IEnumFORMATETC** ppenumFormatEtc);
281 static HRESULT WINAPI DefaultHandler_DAdvise(
282 IDataObject* iface,
283 FORMATETC* pformatetc,
284 DWORD advf,
285 IAdviseSink* pAdvSink,
286 DWORD* pdwConnection);
287 static HRESULT WINAPI DefaultHandler_DUnadvise(
288 IDataObject* iface,
289 DWORD dwConnection);
290 static HRESULT WINAPI DefaultHandler_EnumDAdvise(
291 IDataObject* iface,
292 IEnumSTATDATA** ppenumAdvise);
295 * Prototypes for the methods of the DefaultHandler class
296 * that implement IRunnableObject methods.
298 static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(
299 IRunnableObject* iface,
300 REFIID riid,
301 void** ppvObject);
302 static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
303 IRunnableObject* iface);
304 static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
305 IRunnableObject* iface);
306 static HRESULT WINAPI DefaultHandler_GetRunningClass(
307 IRunnableObject* iface,
308 LPCLSID lpClsid);
309 static HRESULT WINAPI DefaultHandler_Run(
310 IRunnableObject* iface,
311 IBindCtx* pbc);
312 static BOOL WINAPI DefaultHandler_IsRunning(
313 IRunnableObject* iface);
314 static HRESULT WINAPI DefaultHandler_LockRunning(
315 IRunnableObject* iface,
316 BOOL fLock,
317 BOOL fLastUnlockCloses);
318 static HRESULT WINAPI DefaultHandler_SetContainedObject(
319 IRunnableObject* iface,
320 BOOL fContained);
324 * Virtual function tables for the DefaultHandler class.
326 static ICOM_VTABLE(IOleObject) DefaultHandler_IOleObject_VTable =
328 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
329 DefaultHandler_QueryInterface,
330 DefaultHandler_AddRef,
331 DefaultHandler_Release,
332 DefaultHandler_SetClientSite,
333 DefaultHandler_GetClientSite,
334 DefaultHandler_SetHostNames,
335 DefaultHandler_Close,
336 DefaultHandler_SetMoniker,
337 DefaultHandler_GetMoniker,
338 DefaultHandler_InitFromData,
339 DefaultHandler_GetClipboardData,
340 DefaultHandler_DoVerb,
341 DefaultHandler_EnumVerbs,
342 DefaultHandler_Update,
343 DefaultHandler_IsUpToDate,
344 DefaultHandler_GetUserClassID,
345 DefaultHandler_GetUserType,
346 DefaultHandler_SetExtent,
347 DefaultHandler_GetExtent,
348 DefaultHandler_Advise,
349 DefaultHandler_Unadvise,
350 DefaultHandler_EnumAdvise,
351 DefaultHandler_GetMiscStatus,
352 DefaultHandler_SetColorScheme
355 static ICOM_VTABLE(IUnknown) DefaultHandler_NDIUnknown_VTable =
357 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
358 DefaultHandler_NDIUnknown_QueryInterface,
359 DefaultHandler_NDIUnknown_AddRef,
360 DefaultHandler_NDIUnknown_Release,
363 static ICOM_VTABLE(IDataObject) DefaultHandler_IDataObject_VTable =
365 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
366 DefaultHandler_IDataObject_QueryInterface,
367 DefaultHandler_IDataObject_AddRef,
368 DefaultHandler_IDataObject_Release,
369 DefaultHandler_GetData,
370 DefaultHandler_GetDataHere,
371 DefaultHandler_QueryGetData,
372 DefaultHandler_GetCanonicalFormatEtc,
373 DefaultHandler_SetData,
374 DefaultHandler_EnumFormatEtc,
375 DefaultHandler_DAdvise,
376 DefaultHandler_DUnadvise,
377 DefaultHandler_EnumDAdvise
380 static ICOM_VTABLE(IRunnableObject) DefaultHandler_IRunnableObject_VTable =
382 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
383 DefaultHandler_IRunnableObject_QueryInterface,
384 DefaultHandler_IRunnableObject_AddRef,
385 DefaultHandler_IRunnableObject_Release,
386 DefaultHandler_GetRunningClass,
387 DefaultHandler_Run,
388 DefaultHandler_IsRunning,
389 DefaultHandler_LockRunning,
390 DefaultHandler_SetContainedObject
393 /******************************************************************************
394 * OleCreateDefaultHandler [OLE32.@]
396 HRESULT WINAPI OleCreateDefaultHandler(
397 REFCLSID clsid,
398 LPUNKNOWN pUnkOuter,
399 REFIID riid,
400 LPVOID* ppvObj)
402 DefaultHandler* newHandler = NULL;
403 HRESULT hr = S_OK;
405 TRACE("(%s, %p, %s, %p)\n", debugstr_guid(clsid), pUnkOuter, debugstr_guid(riid), ppvObj);
408 * Sanity check
410 if (ppvObj==0)
411 return E_POINTER;
413 *ppvObj = 0;
416 * If this handler is constructed for aggregation, make sure
417 * the caller is requesting the IUnknown interface.
418 * This is necessary because it's the only time the non-delegating
419 * IUnknown pointer can be returned to the outside.
421 if ( (pUnkOuter!=NULL) &&
422 (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) != 0) )
423 return CLASS_E_NOAGGREGATION;
426 * Try to construct a new instance of the class.
428 newHandler = DefaultHandler_Construct(clsid,
429 pUnkOuter);
431 if (newHandler == 0)
432 return E_OUTOFMEMORY;
435 * Make sure it supports the interface required by the caller.
437 hr = IUnknown_QueryInterface((IUnknown*)&(newHandler->lpvtbl2), riid, ppvObj);
440 * Release the reference obtained in the constructor. If
441 * the QueryInterface was unsuccessful, it will free the class.
443 IUnknown_Release((IUnknown*)&(newHandler->lpvtbl2));
445 return hr;
448 /*********************************************************
449 * Methods implementation for the DefaultHandler class.
451 static DefaultHandler* DefaultHandler_Construct(
452 REFCLSID clsid,
453 LPUNKNOWN pUnkOuter)
455 DefaultHandler* newObject = 0;
458 * Allocate space for the object.
460 newObject = HeapAlloc(GetProcessHeap(), 0, sizeof(DefaultHandler));
462 if (newObject==0)
463 return newObject;
466 * Initialize the virtual function table.
468 newObject->lpvtbl1 = &DefaultHandler_IOleObject_VTable;
469 newObject->lpvtbl2 = &DefaultHandler_NDIUnknown_VTable;
470 newObject->lpvtbl3 = &DefaultHandler_IDataObject_VTable;
471 newObject->lpvtbl4 = &DefaultHandler_IRunnableObject_VTable;
474 * Start with one reference count. The caller of this function
475 * must release the interface pointer when it is done.
477 newObject->ref = 1;
480 * Initialize the outer unknown
481 * We don't keep a reference on the outer unknown since, the way
482 * aggregation works, our lifetime is at least as large as it's
483 * lifetime.
485 if (pUnkOuter==NULL)
486 pUnkOuter = (IUnknown*)&(newObject->lpvtbl2);
488 newObject->outerUnknown = pUnkOuter;
491 * Create a datacache object.
492 * We aggregate with the datacache. Make sure we pass our outer
493 * unknown as the datacache's outer unknown.
495 CreateDataCache(newObject->outerUnknown,
496 clsid,
497 &IID_IUnknown,
498 (void**)&newObject->dataCache);
501 * Initialize the other data members of the class.
503 memcpy(&(newObject->clsid), clsid, sizeof(CLSID));
504 newObject->clientSite = NULL;
505 newObject->oleAdviseHolder = NULL;
506 newObject->dataAdviseHolder = NULL;
507 newObject->containerApp = NULL;
508 newObject->containerObj = NULL;
510 return newObject;
513 static void DefaultHandler_Destroy(
514 DefaultHandler* ptrToDestroy)
517 * Free the strings idenfitying the object
519 if (ptrToDestroy->containerApp!=NULL)
521 HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerApp );
522 ptrToDestroy->containerApp = NULL;
525 if (ptrToDestroy->containerObj!=NULL)
527 HeapFree( GetProcessHeap(), 0, ptrToDestroy->containerObj );
528 ptrToDestroy->containerObj = NULL;
532 * Release our reference to the data cache.
534 if (ptrToDestroy->dataCache!=NULL)
536 IUnknown_Release(ptrToDestroy->dataCache);
537 ptrToDestroy->dataCache = NULL;
541 * Same thing for the client site.
543 if (ptrToDestroy->clientSite!=NULL)
545 IOleClientSite_Release(ptrToDestroy->clientSite);
546 ptrToDestroy->clientSite = NULL;
550 * And the advise holder.
552 if (ptrToDestroy->oleAdviseHolder!=NULL)
554 IOleAdviseHolder_Release(ptrToDestroy->oleAdviseHolder);
555 ptrToDestroy->oleAdviseHolder = NULL;
559 * And the data advise holder.
561 if (ptrToDestroy->dataAdviseHolder!=NULL)
563 IDataAdviseHolder_Release(ptrToDestroy->dataAdviseHolder);
564 ptrToDestroy->dataAdviseHolder = NULL;
569 * Free the actual default handler structure.
571 HeapFree(GetProcessHeap(), 0, ptrToDestroy);
574 /*********************************************************
575 * Method implementation for the non delegating IUnknown
576 * part of the DefaultHandler class.
579 /************************************************************************
580 * DefaultHandler_NDIUnknown_QueryInterface (IUnknown)
582 * See Windows documentation for more details on IUnknown methods.
584 * This version of QueryInterface will not delegate it's implementation
585 * to the outer unknown.
587 static HRESULT WINAPI DefaultHandler_NDIUnknown_QueryInterface(
588 IUnknown* iface,
589 REFIID riid,
590 void** ppvObject)
592 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
595 * Perform a sanity check on the parameters.
597 if ( (this==0) || (ppvObject==0) )
598 return E_INVALIDARG;
601 * Initialize the return parameter.
603 *ppvObject = 0;
606 * Compare the riid with the interface IDs implemented by this object.
608 if (memcmp(&IID_IUnknown, riid, sizeof(IID_IUnknown)) == 0)
610 *ppvObject = iface;
612 else if (memcmp(&IID_IOleObject, riid, sizeof(IID_IOleObject)) == 0)
614 *ppvObject = (IOleObject*)&(this->lpvtbl1);
616 else if (memcmp(&IID_IDataObject, riid, sizeof(IID_IDataObject)) == 0)
618 *ppvObject = (IDataObject*)&(this->lpvtbl3);
620 else if (memcmp(&IID_IRunnableObject, riid, sizeof(IID_IRunnableObject)) == 0)
622 *ppvObject = (IRunnableObject*)&(this->lpvtbl4);
624 else
627 * Blind aggregate the data cache to "inherit" it's interfaces.
629 if (IUnknown_QueryInterface(this->dataCache, riid, ppvObject) == S_OK)
630 return S_OK;
634 * Check that we obtained an interface.
636 if ((*ppvObject)==0)
638 WARN( "() : asking for un supported interface %s\n", debugstr_guid(riid));
639 return E_NOINTERFACE;
643 * Query Interface always increases the reference count by one when it is
644 * successful.
646 IUnknown_AddRef((IUnknown*)*ppvObject);
648 return S_OK;
651 /************************************************************************
652 * DefaultHandler_NDIUnknown_AddRef (IUnknown)
654 * See Windows documentation for more details on IUnknown methods.
656 * This version of QueryInterface will not delegate it's implementation
657 * to the outer unknown.
659 static ULONG WINAPI DefaultHandler_NDIUnknown_AddRef(
660 IUnknown* iface)
662 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
664 this->ref++;
666 return this->ref;
669 /************************************************************************
670 * DefaultHandler_NDIUnknown_Release (IUnknown)
672 * See Windows documentation for more details on IUnknown methods.
674 * This version of QueryInterface will not delegate it's implementation
675 * to the outer unknown.
677 static ULONG WINAPI DefaultHandler_NDIUnknown_Release(
678 IUnknown* iface)
680 _ICOM_THIS_From_NDIUnknown(DefaultHandler, iface);
683 * Decrease the reference count on this object.
685 this->ref--;
688 * If the reference count goes down to 0, perform suicide.
690 if (this->ref==0)
692 DefaultHandler_Destroy(this);
694 return 0;
697 return this->ref;
700 /*********************************************************
701 * Methods implementation for the IOleObject part of
702 * the DefaultHandler class.
705 /************************************************************************
706 * DefaultHandler_QueryInterface (IUnknown)
708 * See Windows documentation for more details on IUnknown methods.
710 static HRESULT WINAPI DefaultHandler_QueryInterface(
711 IOleObject* iface,
712 REFIID riid,
713 void** ppvObject)
715 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
717 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
720 /************************************************************************
721 * DefaultHandler_AddRef (IUnknown)
723 * See Windows documentation for more details on IUnknown methods.
725 static ULONG WINAPI DefaultHandler_AddRef(
726 IOleObject* iface)
728 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
730 return IUnknown_AddRef(this->outerUnknown);
733 /************************************************************************
734 * DefaultHandler_Release (IUnknown)
736 * See Windows documentation for more details on IUnknown methods.
738 static ULONG WINAPI DefaultHandler_Release(
739 IOleObject* iface)
741 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
743 return IUnknown_Release(this->outerUnknown);
746 /************************************************************************
747 * DefaultHandler_SetClientSite (IOleObject)
749 * The default handler's implementation of this method only keeps the
750 * client site pointer for future reference.
752 * See Windows documentation for more details on IOleObject methods.
754 static HRESULT WINAPI DefaultHandler_SetClientSite(
755 IOleObject* iface,
756 IOleClientSite* pClientSite)
758 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
760 TRACE("(%p, %p)\n", iface, pClientSite);
763 * Make sure we release the previous client site if there
764 * was one.
766 if (this->clientSite!=NULL)
768 IOleClientSite_Release(this->clientSite);
771 this->clientSite = pClientSite;
773 if (this->clientSite!=NULL)
775 IOleClientSite_AddRef(this->clientSite);
778 return S_OK;
781 /************************************************************************
782 * DefaultHandler_GetClientSite (IOleObject)
784 * The default handler's implementation of this method returns the
785 * last pointer set in IOleObject_SetClientSite.
787 * See Windows documentation for more details on IOleObject methods.
789 static HRESULT WINAPI DefaultHandler_GetClientSite(
790 IOleObject* iface,
791 IOleClientSite** ppClientSite)
793 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
796 * Sanity check.
798 if (ppClientSite == NULL)
799 return E_POINTER;
801 *ppClientSite = this->clientSite;
803 if (this->clientSite != NULL)
805 IOleClientSite_AddRef(this->clientSite);
808 return S_OK;
811 /************************************************************************
812 * DefaultHandler_SetHostNames (IOleObject)
814 * The default handler's implementation of this method just stores
815 * the strings and returns S_OK.
817 * See Windows documentation for more details on IOleObject methods.
819 static HRESULT WINAPI DefaultHandler_SetHostNames(
820 IOleObject* iface,
821 LPCOLESTR szContainerApp,
822 LPCOLESTR szContainerObj)
824 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
826 TRACE("(%p, %s, %s)\n",
827 iface,
828 debugstr_w(szContainerApp),
829 debugstr_w(szContainerObj));
832 * Be sure to cleanup before re-assinging the strings.
834 if (this->containerApp!=NULL)
836 HeapFree( GetProcessHeap(), 0, this->containerApp );
837 this->containerApp = NULL;
840 if (this->containerObj!=NULL)
842 HeapFree( GetProcessHeap(), 0, this->containerObj );
843 this->containerObj = NULL;
847 * Copy the string supplied.
849 if (szContainerApp != NULL)
851 if ((this->containerApp = HeapAlloc( GetProcessHeap(), 0,
852 (lstrlenW(szContainerApp) + 1) * sizeof(WCHAR) )))
853 strcpyW( this->containerApp, szContainerApp );
856 if (szContainerObj != NULL)
858 if ((this->containerObj = HeapAlloc( GetProcessHeap(), 0,
859 (lstrlenW(szContainerObj) + 1) * sizeof(WCHAR) )))
860 strcpyW( this->containerObj, szContainerObj );
862 return S_OK;
865 /************************************************************************
866 * DefaultHandler_Close (IOleObject)
868 * The default handler's implementation of this method is meaningless
869 * without a running server so it does nothing.
871 * See Windows documentation for more details on IOleObject methods.
873 static HRESULT WINAPI DefaultHandler_Close(
874 IOleObject* iface,
875 DWORD dwSaveOption)
877 TRACE("()\n");
878 return S_OK;
881 /************************************************************************
882 * DefaultHandler_SetMoniker (IOleObject)
884 * The default handler's implementation of this method does nothing.
886 * See Windows documentation for more details on IOleObject methods.
888 static HRESULT WINAPI DefaultHandler_SetMoniker(
889 IOleObject* iface,
890 DWORD dwWhichMoniker,
891 IMoniker* pmk)
893 TRACE("(%p, %ld, %p)\n",
894 iface,
895 dwWhichMoniker,
896 pmk);
898 return S_OK;
901 /************************************************************************
902 * DefaultHandler_GetMoniker (IOleObject)
904 * Delegate this request to the client site if we have one.
906 * See Windows documentation for more details on IOleObject methods.
908 static HRESULT WINAPI DefaultHandler_GetMoniker(
909 IOleObject* iface,
910 DWORD dwAssign,
911 DWORD dwWhichMoniker,
912 IMoniker** ppmk)
914 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
916 TRACE("(%p, %ld, %ld, %p)\n",
917 iface, dwAssign, dwWhichMoniker, ppmk);
919 if (this->clientSite)
921 return IOleClientSite_GetMoniker(this->clientSite,
922 dwAssign,
923 dwWhichMoniker,
924 ppmk);
928 return E_FAIL;
931 /************************************************************************
932 * DefaultHandler_InitFromData (IOleObject)
934 * This method is meaningless if the server is not running
936 * See Windows documentation for more details on IOleObject methods.
938 static HRESULT WINAPI DefaultHandler_InitFromData(
939 IOleObject* iface,
940 IDataObject* pDataObject,
941 BOOL fCreation,
942 DWORD dwReserved)
944 TRACE("(%p, %p, %d, %ld)\n",
945 iface, pDataObject, fCreation, dwReserved);
947 return OLE_E_NOTRUNNING;
950 /************************************************************************
951 * DefaultHandler_GetClipboardData (IOleObject)
953 * This method is meaningless if the server is not running
955 * See Windows documentation for more details on IOleObject methods.
957 static HRESULT WINAPI DefaultHandler_GetClipboardData(
958 IOleObject* iface,
959 DWORD dwReserved,
960 IDataObject** ppDataObject)
962 TRACE("(%p, %ld, %p)\n",
963 iface, dwReserved, ppDataObject);
965 return OLE_E_NOTRUNNING;
968 static HRESULT WINAPI DefaultHandler_DoVerb(
969 IOleObject* iface,
970 LONG iVerb,
971 struct tagMSG* lpmsg,
972 IOleClientSite* pActiveSite,
973 LONG lindex,
974 HWND hwndParent,
975 LPCRECT lprcPosRect)
977 FIXME(": Stub\n");
978 return E_NOTIMPL;
981 /************************************************************************
982 * DefaultHandler_EnumVerbs (IOleObject)
984 * The default handler implementation of this method simply delegates
985 * to OleRegEnumVerbs
987 * See Windows documentation for more details on IOleObject methods.
989 static HRESULT WINAPI DefaultHandler_EnumVerbs(
990 IOleObject* iface,
991 IEnumOLEVERB** ppEnumOleVerb)
993 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
995 TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
997 return OleRegEnumVerbs(&this->clsid, ppEnumOleVerb);
1000 static HRESULT WINAPI DefaultHandler_Update(
1001 IOleObject* iface)
1003 FIXME(": Stub\n");
1004 return E_NOTIMPL;
1007 /************************************************************************
1008 * DefaultHandler_IsUpToDate (IOleObject)
1010 * This method is meaningless if the server is not running
1012 * See Windows documentation for more details on IOleObject methods.
1014 static HRESULT WINAPI DefaultHandler_IsUpToDate(
1015 IOleObject* iface)
1017 TRACE("(%p)\n", iface);
1019 return OLE_E_NOTRUNNING;
1022 /************************************************************************
1023 * DefaultHandler_GetUserClassID (IOleObject)
1025 * TODO: Map to a new class ID if emulation is active.
1027 * See Windows documentation for more details on IOleObject methods.
1029 static HRESULT WINAPI DefaultHandler_GetUserClassID(
1030 IOleObject* iface,
1031 CLSID* pClsid)
1033 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1035 TRACE("(%p, %p)\n", iface, pClsid);
1038 * Sanity check.
1040 if (pClsid==NULL)
1041 return E_POINTER;
1043 memcpy(pClsid, &this->clsid, sizeof(CLSID));
1045 return S_OK;
1048 /************************************************************************
1049 * DefaultHandler_GetUserType (IOleObject)
1051 * The default handler implementation of this method simply delegates
1052 * to OleRegGetUserType
1054 * See Windows documentation for more details on IOleObject methods.
1056 static HRESULT WINAPI DefaultHandler_GetUserType(
1057 IOleObject* iface,
1058 DWORD dwFormOfType,
1059 LPOLESTR* pszUserType)
1061 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1063 TRACE("(%p, %ld, %p)\n", iface, dwFormOfType, pszUserType);
1065 return OleRegGetUserType(&this->clsid, dwFormOfType, pszUserType);
1068 /************************************************************************
1069 * DefaultHandler_SetExtent (IOleObject)
1071 * This method is meaningless if the server is not running
1073 * See Windows documentation for more details on IOleObject methods.
1075 static HRESULT WINAPI DefaultHandler_SetExtent(
1076 IOleObject* iface,
1077 DWORD dwDrawAspect,
1078 SIZEL* psizel)
1080 TRACE("(%p, %lx, (%ld x %ld))\n", iface,
1081 dwDrawAspect, psizel->cx, psizel->cy);
1082 return OLE_E_NOTRUNNING;
1085 /************************************************************************
1086 * DefaultHandler_GetExtent (IOleObject)
1088 * The default handler's implementation of this method returns uses
1089 * the cache to locate the aspect and extract the extent from it.
1091 * See Windows documentation for more details on IOleObject methods.
1093 static HRESULT WINAPI DefaultHandler_GetExtent(
1094 IOleObject* iface,
1095 DWORD dwDrawAspect,
1096 SIZEL* psizel)
1098 DVTARGETDEVICE* targetDevice;
1099 IViewObject2* cacheView = NULL;
1100 HRESULT hres;
1102 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1104 TRACE("(%p, %lx, %p)\n", iface, dwDrawAspect, psizel);
1106 hres = IUnknown_QueryInterface(this->dataCache, &IID_IViewObject2, (void**)(char*)&cacheView);
1108 if (FAILED(hres))
1109 return E_UNEXPECTED;
1112 * Prepare the call to the cache's GetExtent method.
1114 * Here we would build a valid DVTARGETDEVICE structure
1115 * but, since we are calling into the data cache, we
1116 * know it's implementation and we'll skip this
1117 * extra work until later.
1119 targetDevice = NULL;
1121 hres = IViewObject2_GetExtent(cacheView,
1122 dwDrawAspect,
1124 targetDevice,
1125 psizel);
1128 * Cleanup
1130 IViewObject2_Release(cacheView);
1132 return hres;
1135 /************************************************************************
1136 * DefaultHandler_Advise (IOleObject)
1138 * The default handler's implementation of this method simply
1139 * delegates to the OleAdviseHolder.
1141 * See Windows documentation for more details on IOleObject methods.
1143 static HRESULT WINAPI DefaultHandler_Advise(
1144 IOleObject* iface,
1145 IAdviseSink* pAdvSink,
1146 DWORD* pdwConnection)
1148 HRESULT hres = S_OK;
1149 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1151 TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
1154 * Make sure we have an advise holder before we start.
1156 if (this->oleAdviseHolder==NULL)
1158 hres = CreateOleAdviseHolder(&this->oleAdviseHolder);
1161 if (SUCCEEDED(hres))
1163 hres = IOleAdviseHolder_Advise(this->oleAdviseHolder,
1164 pAdvSink,
1165 pdwConnection);
1168 return hres;
1171 /************************************************************************
1172 * DefaultHandler_Unadvise (IOleObject)
1174 * The default handler's implementation of this method simply
1175 * delegates to the OleAdviseHolder.
1177 * See Windows documentation for more details on IOleObject methods.
1179 static HRESULT WINAPI DefaultHandler_Unadvise(
1180 IOleObject* iface,
1181 DWORD dwConnection)
1183 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1185 TRACE("(%p, %ld)\n", iface, dwConnection);
1188 * If we don't have an advise holder yet, it means we don't have
1189 * a connection.
1191 if (this->oleAdviseHolder==NULL)
1192 return OLE_E_NOCONNECTION;
1194 return IOleAdviseHolder_Unadvise(this->oleAdviseHolder,
1195 dwConnection);
1198 /************************************************************************
1199 * DefaultHandler_EnumAdvise (IOleObject)
1201 * The default handler's implementation of this method simply
1202 * delegates to the OleAdviseHolder.
1204 * See Windows documentation for more details on IOleObject methods.
1206 static HRESULT WINAPI DefaultHandler_EnumAdvise(
1207 IOleObject* iface,
1208 IEnumSTATDATA** ppenumAdvise)
1210 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1212 TRACE("(%p, %p)\n", iface, ppenumAdvise);
1215 * Sanity check
1217 if (ppenumAdvise==NULL)
1218 return E_POINTER;
1221 * Initialize the out parameter.
1223 *ppenumAdvise = NULL;
1225 if (this->oleAdviseHolder==NULL)
1226 return IOleAdviseHolder_EnumAdvise(this->oleAdviseHolder,
1227 ppenumAdvise);
1229 return S_OK;
1232 /************************************************************************
1233 * DefaultHandler_GetMiscStatus (IOleObject)
1235 * The default handler's implementation of this method simply delegates
1236 * to OleRegGetMiscStatus.
1238 * See Windows documentation for more details on IOleObject methods.
1240 static HRESULT WINAPI DefaultHandler_GetMiscStatus(
1241 IOleObject* iface,
1242 DWORD dwAspect,
1243 DWORD* pdwStatus)
1245 HRESULT hres;
1246 _ICOM_THIS_From_IOleObject(DefaultHandler, iface);
1248 TRACE("(%p, %lx, %p)\n", iface, dwAspect, pdwStatus);
1250 hres = OleRegGetMiscStatus(&(this->clsid), dwAspect, pdwStatus);
1252 if (FAILED(hres))
1253 *pdwStatus = 0;
1255 return S_OK;
1258 /************************************************************************
1259 * DefaultHandler_SetExtent (IOleObject)
1261 * This method is meaningless if the server is not running
1263 * See Windows documentation for more details on IOleObject methods.
1265 static HRESULT WINAPI DefaultHandler_SetColorScheme(
1266 IOleObject* iface,
1267 struct tagLOGPALETTE* pLogpal)
1269 TRACE("(%p, %p))\n", iface, pLogpal);
1270 return OLE_E_NOTRUNNING;
1273 /*********************************************************
1274 * Methods implementation for the IDataObject part of
1275 * the DefaultHandler class.
1278 /************************************************************************
1279 * DefaultHandler_IDataObject_QueryInterface (IUnknown)
1281 * See Windows documentation for more details on IUnknown methods.
1283 static HRESULT WINAPI DefaultHandler_IDataObject_QueryInterface(
1284 IDataObject* iface,
1285 REFIID riid,
1286 void** ppvObject)
1288 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1290 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
1293 /************************************************************************
1294 * DefaultHandler_IDataObject_AddRef (IUnknown)
1296 * See Windows documentation for more details on IUnknown methods.
1298 static ULONG WINAPI DefaultHandler_IDataObject_AddRef(
1299 IDataObject* iface)
1301 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1303 return IUnknown_AddRef(this->outerUnknown);
1306 /************************************************************************
1307 * DefaultHandler_IDataObject_Release (IUnknown)
1309 * See Windows documentation for more details on IUnknown methods.
1311 static ULONG WINAPI DefaultHandler_IDataObject_Release(
1312 IDataObject* iface)
1314 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1316 return IUnknown_Release(this->outerUnknown);
1319 /************************************************************************
1320 * DefaultHandler_GetData
1322 * Get Data from a source dataobject using format pformatetcIn->cfFormat
1323 * See Windows documentation for more details on GetData.
1324 * Default handler's implementation of this method delegates to the cache.
1326 static HRESULT WINAPI DefaultHandler_GetData(
1327 IDataObject* iface,
1328 LPFORMATETC pformatetcIn,
1329 STGMEDIUM* pmedium)
1331 IDataObject* cacheDataObject = NULL;
1332 HRESULT hres;
1334 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1336 TRACE("(%p, %p, %p)\n", iface, pformatetcIn, pmedium);
1338 hres = IUnknown_QueryInterface(this->dataCache,
1339 &IID_IDataObject,
1340 (void**)(char*)&cacheDataObject);
1342 if (FAILED(hres))
1343 return E_UNEXPECTED;
1345 hres = IDataObject_GetData(cacheDataObject,
1346 pformatetcIn,
1347 pmedium);
1349 IDataObject_Release(cacheDataObject);
1351 return hres;
1354 static HRESULT WINAPI DefaultHandler_GetDataHere(
1355 IDataObject* iface,
1356 LPFORMATETC pformatetc,
1357 STGMEDIUM* pmedium)
1359 FIXME(": Stub\n");
1360 return E_NOTIMPL;
1363 /************************************************************************
1364 * DefaultHandler_QueryGetData (IDataObject)
1366 * The default handler's implementation of this method delegates to
1367 * the cache.
1369 * See Windows documentation for more details on IDataObject methods.
1371 static HRESULT WINAPI DefaultHandler_QueryGetData(
1372 IDataObject* iface,
1373 LPFORMATETC pformatetc)
1375 IDataObject* cacheDataObject = NULL;
1376 HRESULT hres;
1378 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1380 TRACE("(%p, %p)\n", iface, pformatetc);
1382 hres = IUnknown_QueryInterface(this->dataCache,
1383 &IID_IDataObject,
1384 (void**)(char*)&cacheDataObject);
1386 if (FAILED(hres))
1387 return E_UNEXPECTED;
1389 hres = IDataObject_QueryGetData(cacheDataObject,
1390 pformatetc);
1392 IDataObject_Release(cacheDataObject);
1394 return hres;
1397 /************************************************************************
1398 * DefaultHandler_GetCanonicalFormatEtc (IDataObject)
1400 * This method is meaningless if the server is not running
1402 * See Windows documentation for more details on IDataObject methods.
1404 static HRESULT WINAPI DefaultHandler_GetCanonicalFormatEtc(
1405 IDataObject* iface,
1406 LPFORMATETC pformatectIn,
1407 LPFORMATETC pformatetcOut)
1409 FIXME("(%p, %p, %p)\n", iface, pformatectIn, pformatetcOut);
1411 return OLE_E_NOTRUNNING;
1414 /************************************************************************
1415 * DefaultHandler_SetData (IDataObject)
1417 * The default handler's implementation of this method delegates to
1418 * the cache.
1420 * See Windows documentation for more details on IDataObject methods.
1422 static HRESULT WINAPI DefaultHandler_SetData(
1423 IDataObject* iface,
1424 LPFORMATETC pformatetc,
1425 STGMEDIUM* pmedium,
1426 BOOL fRelease)
1428 IDataObject* cacheDataObject = NULL;
1429 HRESULT hres;
1431 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1433 TRACE("(%p, %p, %p, %d)\n", iface, pformatetc, pmedium, fRelease);
1435 hres = IUnknown_QueryInterface(this->dataCache,
1436 &IID_IDataObject,
1437 (void**)(char*)&cacheDataObject);
1439 if (FAILED(hres))
1440 return E_UNEXPECTED;
1442 hres = IDataObject_SetData(cacheDataObject,
1443 pformatetc,
1444 pmedium,
1445 fRelease);
1447 IDataObject_Release(cacheDataObject);
1449 return hres;
1452 /************************************************************************
1453 * DefaultHandler_EnumFormatEtc (IDataObject)
1455 * The default handler's implementation of this method simply delegates
1456 * to OleRegEnumFormatEtc.
1458 * See Windows documentation for more details on IDataObject methods.
1460 static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
1461 IDataObject* iface,
1462 DWORD dwDirection,
1463 IEnumFORMATETC** ppenumFormatEtc)
1465 HRESULT hres;
1466 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1468 TRACE("(%p, %lx, %p)\n", iface, dwDirection, ppenumFormatEtc);
1470 hres = OleRegEnumFormatEtc(&(this->clsid), dwDirection, ppenumFormatEtc);
1472 return hres;
1475 /************************************************************************
1476 * DefaultHandler_DAdvise (IDataObject)
1478 * The default handler's implementation of this method simply
1479 * delegates to the DataAdviseHolder.
1481 * See Windows documentation for more details on IDataObject methods.
1483 static HRESULT WINAPI DefaultHandler_DAdvise(
1484 IDataObject* iface,
1485 FORMATETC* pformatetc,
1486 DWORD advf,
1487 IAdviseSink* pAdvSink,
1488 DWORD* pdwConnection)
1490 HRESULT hres = S_OK;
1491 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1493 TRACE("(%p, %p, %ld, %p, %p)\n",
1494 iface, pformatetc, advf, pAdvSink, pdwConnection);
1497 * Make sure we have a data advise holder before we start.
1499 if (this->dataAdviseHolder==NULL)
1501 hres = CreateDataAdviseHolder(&this->dataAdviseHolder);
1504 if (SUCCEEDED(hres))
1506 hres = IDataAdviseHolder_Advise(this->dataAdviseHolder,
1507 iface,
1508 pformatetc,
1509 advf,
1510 pAdvSink,
1511 pdwConnection);
1514 return hres;
1517 /************************************************************************
1518 * DefaultHandler_DUnadvise (IDataObject)
1520 * The default handler's implementation of this method simply
1521 * delegates to the DataAdviseHolder.
1523 * See Windows documentation for more details on IDataObject methods.
1525 static HRESULT WINAPI DefaultHandler_DUnadvise(
1526 IDataObject* iface,
1527 DWORD dwConnection)
1529 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1531 TRACE("(%p, %ld)\n", iface, dwConnection);
1534 * If we don't have a data advise holder yet, it means that
1535 * we don't have any connections..
1537 if (this->dataAdviseHolder==NULL)
1539 return OLE_E_NOCONNECTION;
1542 return IDataAdviseHolder_Unadvise(this->dataAdviseHolder,
1543 dwConnection);
1546 /************************************************************************
1547 * DefaultHandler_EnumDAdvise (IDataObject)
1549 * The default handler's implementation of this method simply
1550 * delegates to the DataAdviseHolder.
1552 * See Windows documentation for more details on IDataObject methods.
1554 static HRESULT WINAPI DefaultHandler_EnumDAdvise(
1555 IDataObject* iface,
1556 IEnumSTATDATA** ppenumAdvise)
1558 _ICOM_THIS_From_IDataObject(DefaultHandler, iface);
1560 TRACE("(%p, %p)\n", iface, ppenumAdvise);
1563 * Sanity check
1565 if (ppenumAdvise == NULL)
1566 return E_POINTER;
1569 * Initialize the out parameter.
1571 *ppenumAdvise = NULL;
1574 * If we have a data advise holder object, delegate.
1576 if (this->dataAdviseHolder!=NULL)
1578 return IDataAdviseHolder_EnumAdvise(this->dataAdviseHolder,
1579 ppenumAdvise);
1582 return S_OK;
1585 /*********************************************************
1586 * Methods implementation for the IRunnableObject part
1587 * of the DefaultHandler class.
1590 /************************************************************************
1591 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1593 * See Windows documentation for more details on IUnknown methods.
1595 static HRESULT WINAPI DefaultHandler_IRunnableObject_QueryInterface(
1596 IRunnableObject* iface,
1597 REFIID riid,
1598 void** ppvObject)
1600 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1602 return IUnknown_QueryInterface(this->outerUnknown, riid, ppvObject);
1605 /************************************************************************
1606 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1608 * See Windows documentation for more details on IUnknown methods.
1610 static ULONG WINAPI DefaultHandler_IRunnableObject_AddRef(
1611 IRunnableObject* iface)
1613 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1615 return IUnknown_AddRef(this->outerUnknown);
1618 /************************************************************************
1619 * DefaultHandler_IRunnableObject_QueryInterface (IUnknown)
1621 * See Windows documentation for more details on IUnknown methods.
1623 static ULONG WINAPI DefaultHandler_IRunnableObject_Release(
1624 IRunnableObject* iface)
1626 _ICOM_THIS_From_IRunnableObject(DefaultHandler, iface);
1628 return IUnknown_Release(this->outerUnknown);
1631 /************************************************************************
1632 * DefaultHandler_GetRunningClass (IRunnableObject)
1634 * According to Brockscmidt, Chapter 19, the default handler's
1635 * implementation of IRunnableobject does nothing until the object
1636 * is actually running.
1638 * See Windows documentation for more details on IRunnableObject methods.
1640 static HRESULT WINAPI DefaultHandler_GetRunningClass(
1641 IRunnableObject* iface,
1642 LPCLSID lpClsid)
1644 TRACE("()\n");
1645 return S_OK;
1648 static HRESULT WINAPI DefaultHandler_Run(
1649 IRunnableObject* iface,
1650 IBindCtx* pbc)
1652 FIXME(": Stub\n");
1653 return E_NOTIMPL;
1656 /************************************************************************
1657 * DefaultHandler_IsRunning (IRunnableObject)
1659 * According to Brockscmidt, Chapter 19, the default handler's
1660 * implementation of IRunnableobject does nothing until the object
1661 * is actually running.
1663 * See Windows documentation for more details on IRunnableObject methods.
1665 static BOOL WINAPI DefaultHandler_IsRunning(
1666 IRunnableObject* iface)
1668 TRACE("()\n");
1669 return S_FALSE;
1672 /************************************************************************
1673 * DefaultHandler_LockRunning (IRunnableObject)
1675 * According to Brockscmidt, Chapter 19, the default handler's
1676 * implementation of IRunnableobject does nothing until the object
1677 * is actually running.
1679 * See Windows documentation for more details on IRunnableObject methods.
1681 static HRESULT WINAPI DefaultHandler_LockRunning(
1682 IRunnableObject* iface,
1683 BOOL fLock,
1684 BOOL fLastUnlockCloses)
1686 TRACE("()\n");
1687 return S_OK;
1690 /************************************************************************
1691 * DefaultHandler_SetContainedObject (IRunnableObject)
1693 * According to Brockscmidt, Chapter 19, the default handler's
1694 * implementation of IRunnableobject does nothing until the object
1695 * is actually running.
1697 * See Windows documentation for more details on IRunnableObject methods.
1699 static HRESULT WINAPI DefaultHandler_SetContainedObject(
1700 IRunnableObject* iface,
1701 BOOL fContained)
1703 TRACE("()\n");
1704 return S_OK;