mf/session: Forward more events to the application.
[wine/zf.git] / dlls / ole32 / oleproxy.c
blobe40e2b073e547879853b535b79353224754fcfee
1 /*
2 * OLE32 proxy/stub handler
4 * Copyright 2002 Marcus Meissner
5 * Copyright 2001 Ove Kåven, TransGaming Technologies
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdlib.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <string.h>
27 #define COBJMACROS
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "objbase.h"
33 #include "ole2.h"
34 #include "rpc.h"
36 #include "compobj_private.h"
37 #include "moniker.h"
38 #include "comcat.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(ole);
44 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
46 TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
48 if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
50 *ppv = iface;
51 return S_OK;
54 *ppv = NULL;
55 return E_NOINTERFACE;
58 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
60 return 2;
63 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
65 return 1;
68 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
70 TRACE("(%x)\n", fLock);
71 return S_OK;
74 static const IClassFactoryVtbl FileMonikerCFVtbl =
76 ClassFactory_QueryInterface,
77 ClassFactory_AddRef,
78 ClassFactory_Release,
79 FileMoniker_CreateInstance,
80 ClassFactory_LockServer
83 static IClassFactory FileMonikerCF = { &FileMonikerCFVtbl };
85 static const IClassFactoryVtbl ItemMonikerCFVtbl =
87 ClassFactory_QueryInterface,
88 ClassFactory_AddRef,
89 ClassFactory_Release,
90 ItemMoniker_CreateInstance,
91 ClassFactory_LockServer
94 static IClassFactory ItemMonikerCF = { &ItemMonikerCFVtbl };
96 static const IClassFactoryVtbl AntiMonikerCFVtbl =
98 ClassFactory_QueryInterface,
99 ClassFactory_AddRef,
100 ClassFactory_Release,
101 AntiMoniker_CreateInstance,
102 ClassFactory_LockServer
105 static IClassFactory AntiMonikerCF = { &AntiMonikerCFVtbl };
107 static const IClassFactoryVtbl CompositeMonikerCFVtbl =
109 ClassFactory_QueryInterface,
110 ClassFactory_AddRef,
111 ClassFactory_Release,
112 CompositeMoniker_CreateInstance,
113 ClassFactory_LockServer
116 static IClassFactory CompositeMonikerCF = { &CompositeMonikerCFVtbl };
118 static const IClassFactoryVtbl ClassMonikerCFVtbl =
120 ClassFactory_QueryInterface,
121 ClassFactory_AddRef,
122 ClassFactory_Release,
123 ClassMoniker_CreateInstance,
124 ClassFactory_LockServer
127 static IClassFactory ClassMonikerCF = { &ClassMonikerCFVtbl };
129 static const IClassFactoryVtbl PointerMonikerCFVtbl =
131 ClassFactory_QueryInterface,
132 ClassFactory_AddRef,
133 ClassFactory_Release,
134 PointerMoniker_CreateInstance,
135 ClassFactory_LockServer
138 static IClassFactory PointerMonikerCF = { &PointerMonikerCFVtbl };
140 static const IClassFactoryVtbl ComCatCFVtbl =
142 ClassFactory_QueryInterface,
143 ClassFactory_AddRef,
144 ClassFactory_Release,
145 ComCat_CreateInstance,
146 ClassFactory_LockServer
149 static IClassFactory ComCatCF = { &ComCatCFVtbl };
151 static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl =
153 ClassFactory_QueryInterface,
154 ClassFactory_AddRef,
155 ClassFactory_Release,
156 GlobalInterfaceTable_CreateInstance,
157 ClassFactory_LockServer
160 IClassFactory GlobalInterfaceTableCF = { &GlobalInterfaceTableCFVtbl };
162 static const IClassFactoryVtbl ManualResetEventCFVtbl =
164 ClassFactory_QueryInterface,
165 ClassFactory_AddRef,
166 ClassFactory_Release,
167 ManualResetEvent_CreateInstance,
168 ClassFactory_LockServer
171 IClassFactory ManualResetEventCF = { &ManualResetEventCFVtbl };
173 /***********************************************************************
174 * DllGetClassObject [OLE32.@]
176 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)
178 HRESULT hr;
180 *ppv = NULL;
181 if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&(
182 IsEqualIID(iid,&IID_IClassFactory) ||
183 IsEqualIID(iid,&IID_IUnknown)
186 return MARSHAL_GetStandardMarshalCF(ppv);
187 if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
188 return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, iid, ppv);
189 if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
190 return IClassFactory_QueryInterface(&ManualResetEventCF, iid, ppv);
191 if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
192 return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
193 if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
194 return IClassFactory_QueryInterface(&ItemMonikerCF, iid, ppv);
195 if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
196 return IClassFactory_QueryInterface(&AntiMonikerCF, iid, ppv);
197 if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))
198 return IClassFactory_QueryInterface(&CompositeMonikerCF, iid, ppv);
199 if (IsEqualCLSID(rclsid, &CLSID_ClassMoniker))
200 return IClassFactory_QueryInterface(&ClassMonikerCF, iid, ppv);
201 if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
202 return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv);
203 if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
204 return IClassFactory_QueryInterface(&ComCatCF, iid, ppv);
206 hr = OLE32_DllGetClassObject(rclsid, iid, ppv);
207 if (SUCCEEDED(hr))
208 return hr;
210 return Handler_DllGetClassObject(rclsid, iid, ppv);
213 /***********************************************************************
214 * Ole32DllGetClassObject [OLE32.@]
216 HRESULT WINAPI Ole32DllGetClassObject(REFCLSID rclsid, REFIID riid, void **obj)
218 if (IsEqualCLSID(rclsid, &CLSID_StdGlobalInterfaceTable))
219 return IClassFactory_QueryInterface(&GlobalInterfaceTableCF, riid, obj);
220 else if (IsEqualCLSID(rclsid, &CLSID_ManualResetEvent))
221 return IClassFactory_QueryInterface(&ManualResetEventCF, riid, obj);
222 else if (IsEqualCLSID(rclsid, &CLSID_InProcFreeMarshaler))
223 return FTMarshalCF_Create(riid, obj);
224 else
225 return CLASS_E_CLASSNOTAVAILABLE;