ole32: Call the object's IPersistStorage_SaveCompleted() if the object is running.
[wine] / dlls / ole32 / oleproxy.c
1 /*
2  *      OLE32 proxy/stub handler
3  *
4  *  Copyright 2002  Marcus Meissner
5  *  Copyright 2001  Ove Kåven, TransGaming Technologies
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <stdio.h>
27 #include <string.h>
28
29 #define COBJMACROS
30 #define NONAMELESSUNION
31 #define NONAMELESSSTRUCT
32
33 #include "windef.h"
34 #include "winbase.h"
35 #include "winuser.h"
36 #include "objbase.h"
37 #include "ole2.h"
38 #include "rpc.h"
39 #include "rpcproxy.h"
40
41 #include "compobj_private.h"
42 #include "moniker.h"
43 #include "comcat.h"
44
45 #include "wine/debug.h"
46
47 WINE_DEFAULT_DEBUG_CHANNEL(ole);
48
49 static CStdPSFactoryBuffer PSFactoryBuffer;
50
51 CSTDSTUBBUFFERRELEASE(&PSFactoryBuffer)
52
53 extern const ExtendedProxyFileInfo dcom_ProxyFileInfo;
54 extern const ExtendedProxyFileInfo ole32_objidl_ProxyFileInfo;
55 extern const ExtendedProxyFileInfo ole32_oleidl_ProxyFileInfo;
56 extern const ExtendedProxyFileInfo ole32_unknwn_ProxyFileInfo;
57
58 static const ProxyFileInfo *OLE32_ProxyFileList[] = {
59   &dcom_ProxyFileInfo,
60   &ole32_objidl_ProxyFileInfo,
61   &ole32_oleidl_ProxyFileInfo,
62   &ole32_unknwn_ProxyFileInfo,
63   NULL
64 };
65
66 /***********************************************************************
67  *           DllGetClassObject [OLE32.@]
68  */
69 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
70 {
71     *ppv = NULL;
72     if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&(
73                 IsEqualIID(iid,&IID_IClassFactory) ||
74                 IsEqualIID(iid,&IID_IUnknown)
75         )
76     )
77         return MARSHAL_GetStandardMarshalCF(ppv);
78     if (IsEqualIID(rclsid,&CLSID_StdGlobalInterfaceTable) && (IsEqualIID(iid,&IID_IClassFactory) || IsEqualIID(iid,&IID_IUnknown)))
79         return StdGlobalInterfaceTable_GetFactory(ppv);
80     if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
81         return FileMonikerCF_Create(iid, ppv);
82     if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
83         return ItemMonikerCF_Create(iid, ppv);
84     if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
85         return AntiMonikerCF_Create(iid, ppv);
86     if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))
87         return CompositeMonikerCF_Create(iid, ppv);
88     if (IsEqualCLSID(rclsid, &CLSID_ClassMoniker))
89         return ClassMonikerCF_Create(iid, ppv);
90     if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
91         return PointerMonikerCF_Create(iid, ppv);
92     if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
93         return ComCatCF_Create(iid, ppv);
94
95     return NdrDllGetClassObject(rclsid, iid, ppv, OLE32_ProxyFileList,
96                                 &CLSID_PSFactoryBuffer, &PSFactoryBuffer);
97 }