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
36 #include "compobj_private.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
))
58 static ULONG WINAPI
ClassFactory_AddRef(IClassFactory
*iface
)
63 static ULONG WINAPI
ClassFactory_Release(IClassFactory
*iface
)
68 static HRESULT WINAPI
ClassFactory_LockServer(IClassFactory
*iface
, BOOL fLock
)
70 TRACE("(%x)\n", fLock
);
74 static const IClassFactoryVtbl FileMonikerCFVtbl
=
76 ClassFactory_QueryInterface
,
79 FileMoniker_CreateInstance
,
80 ClassFactory_LockServer
83 static IClassFactory FileMonikerCF
= { &FileMonikerCFVtbl
};
85 static const IClassFactoryVtbl ItemMonikerCFVtbl
=
87 ClassFactory_QueryInterface
,
90 ItemMoniker_CreateInstance
,
91 ClassFactory_LockServer
94 static IClassFactory ItemMonikerCF
= { &ItemMonikerCFVtbl
};
96 static const IClassFactoryVtbl AntiMonikerCFVtbl
=
98 ClassFactory_QueryInterface
,
100 ClassFactory_Release
,
101 AntiMoniker_CreateInstance
,
102 ClassFactory_LockServer
105 static IClassFactory AntiMonikerCF
= { &AntiMonikerCFVtbl
};
107 static const IClassFactoryVtbl CompositeMonikerCFVtbl
=
109 ClassFactory_QueryInterface
,
111 ClassFactory_Release
,
112 CompositeMoniker_CreateInstance
,
113 ClassFactory_LockServer
116 static IClassFactory CompositeMonikerCF
= { &CompositeMonikerCFVtbl
};
118 static const IClassFactoryVtbl ClassMonikerCFVtbl
=
120 ClassFactory_QueryInterface
,
122 ClassFactory_Release
,
123 ClassMoniker_CreateInstance
,
124 ClassFactory_LockServer
127 static IClassFactory ClassMonikerCF
= { &ClassMonikerCFVtbl
};
129 static const IClassFactoryVtbl PointerMonikerCFVtbl
=
131 ClassFactory_QueryInterface
,
133 ClassFactory_Release
,
134 PointerMoniker_CreateInstance
,
135 ClassFactory_LockServer
138 static IClassFactory PointerMonikerCF
= { &PointerMonikerCFVtbl
};
140 static const IClassFactoryVtbl ObjrefMonikerCFVtbl
=
142 ClassFactory_QueryInterface
,
144 ClassFactory_Release
,
145 ObjrefMoniker_CreateInstance
,
146 ClassFactory_LockServer
149 static IClassFactory ObjrefMonikerCF
= { &ObjrefMonikerCFVtbl
};
151 static const IClassFactoryVtbl ComCatCFVtbl
=
153 ClassFactory_QueryInterface
,
155 ClassFactory_Release
,
156 ComCat_CreateInstance
,
157 ClassFactory_LockServer
160 static IClassFactory ComCatCF
= { &ComCatCFVtbl
};
162 static const IClassFactoryVtbl GlobalInterfaceTableCFVtbl
=
164 ClassFactory_QueryInterface
,
166 ClassFactory_Release
,
167 GlobalInterfaceTable_CreateInstance
,
168 ClassFactory_LockServer
171 IClassFactory GlobalInterfaceTableCF
= { &GlobalInterfaceTableCFVtbl
};
173 static const IClassFactoryVtbl ManualResetEventCFVtbl
=
175 ClassFactory_QueryInterface
,
177 ClassFactory_Release
,
178 ManualResetEvent_CreateInstance
,
179 ClassFactory_LockServer
182 IClassFactory ManualResetEventCF
= { &ManualResetEventCFVtbl
};
184 /***********************************************************************
185 * DllGetClassObject [OLE32.@]
187 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
,LPVOID
*ppv
)
192 if (IsEqualIID(rclsid
,&CLSID_DfMarshal
)&&(
193 IsEqualIID(iid
,&IID_IClassFactory
) ||
194 IsEqualIID(iid
,&IID_IUnknown
)
197 return MARSHAL_GetStandardMarshalCF(ppv
);
198 if (IsEqualCLSID(rclsid
, &CLSID_StdGlobalInterfaceTable
))
199 return IClassFactory_QueryInterface(&GlobalInterfaceTableCF
, iid
, ppv
);
200 if (IsEqualCLSID(rclsid
, &CLSID_ManualResetEvent
))
201 return IClassFactory_QueryInterface(&ManualResetEventCF
, iid
, ppv
);
202 if (IsEqualCLSID(rclsid
, &CLSID_FileMoniker
))
203 return IClassFactory_QueryInterface(&FileMonikerCF
, iid
, ppv
);
204 if (IsEqualCLSID(rclsid
, &CLSID_ItemMoniker
))
205 return IClassFactory_QueryInterface(&ItemMonikerCF
, iid
, ppv
);
206 if (IsEqualCLSID(rclsid
, &CLSID_AntiMoniker
))
207 return IClassFactory_QueryInterface(&AntiMonikerCF
, iid
, ppv
);
208 if (IsEqualCLSID(rclsid
, &CLSID_CompositeMoniker
))
209 return IClassFactory_QueryInterface(&CompositeMonikerCF
, iid
, ppv
);
210 if (IsEqualCLSID(rclsid
, &CLSID_ClassMoniker
))
211 return IClassFactory_QueryInterface(&ClassMonikerCF
, iid
, ppv
);
212 if (IsEqualCLSID(rclsid
, &CLSID_ObjrefMoniker
))
213 return IClassFactory_QueryInterface(&ObjrefMonikerCF
, iid
, ppv
);
214 if (IsEqualCLSID(rclsid
, &CLSID_PointerMoniker
))
215 return IClassFactory_QueryInterface(&PointerMonikerCF
, iid
, ppv
);
216 if (IsEqualGUID(rclsid
, &CLSID_StdComponentCategoriesMgr
))
217 return IClassFactory_QueryInterface(&ComCatCF
, iid
, ppv
);
219 hr
= OLE32_DllGetClassObject(rclsid
, iid
, ppv
);
223 return Handler_DllGetClassObject(rclsid
, iid
, ppv
);
226 /***********************************************************************
227 * Ole32DllGetClassObject [OLE32.@]
229 HRESULT WINAPI
Ole32DllGetClassObject(REFCLSID rclsid
, REFIID riid
, void **obj
)
231 if (IsEqualCLSID(rclsid
, &CLSID_StdGlobalInterfaceTable
))
232 return IClassFactory_QueryInterface(&GlobalInterfaceTableCF
, riid
, obj
);
233 else if (IsEqualCLSID(rclsid
, &CLSID_ManualResetEvent
))
234 return IClassFactory_QueryInterface(&ManualResetEventCF
, riid
, obj
);
235 else if (IsEqualCLSID(rclsid
, &CLSID_InProcFreeMarshaler
))
236 return FTMarshalCF_Create(riid
, obj
);
238 return CLASS_E_CLASSNOTAVAILABLE
;