ReactOS  0.4.14-dev-593-g1793dcc
oleproxy.c
Go to the documentation of this file.
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 <stdlib.h>
23 #include <stdarg.h>
24 #include <stdio.h>
25 #include <string.h>
26 
27 #define COBJMACROS
28 
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winuser.h"
32 #include "objbase.h"
33 #include "ole2.h"
34 #include "rpc.h"
35 
36 #include "compobj_private.h"
37 #include "moniker.h"
38 #include "comcat.h"
39 
40 #include "wine/debug.h"
41 
43 
45 {
46  TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
47 
49  {
50  *ppv = iface;
51  return S_OK;
52  }
53 
54  *ppv = NULL;
55  return E_NOINTERFACE;
56 }
57 
59 {
60  return 2;
61 }
62 
64 {
65  return 1;
66 }
67 
69 {
70  TRACE("(%x)\n", fLock);
71  return S_OK;
72 }
73 
74 static const IClassFactoryVtbl FileMonikerCFVtbl =
75 {
81 };
82 
84 
85 static const IClassFactoryVtbl ItemMonikerCFVtbl =
86 {
92 };
93 
95 
96 static const IClassFactoryVtbl AntiMonikerCFVtbl =
97 {
103 };
104 
106 
107 static const IClassFactoryVtbl CompositeMonikerCFVtbl =
108 {
114 };
115 
117 
118 static const IClassFactoryVtbl ClassMonikerCFVtbl =
119 {
125 };
126 
128 
129 static const IClassFactoryVtbl PointerMonikerCFVtbl =
130 {
136 };
137 
139 
140 static const IClassFactoryVtbl ComCatCFVtbl =
141 {
147 };
148 
150 
151 static const IClassFactoryVtbl GlobalOptionsCFVtbl =
152 {
158 };
159 
161 
162 /***********************************************************************
163  * DllGetClassObject [OLE32.@]
164  */
166 {
167  HRESULT hr;
168 
169  *ppv = NULL;
170  if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&(
173  )
174  )
178  if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
179  return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
180  if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
181  return IClassFactory_QueryInterface(&ItemMonikerCF, iid, ppv);
182  if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
183  return IClassFactory_QueryInterface(&AntiMonikerCF, iid, ppv);
184  if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))
185  return IClassFactory_QueryInterface(&CompositeMonikerCF, iid, ppv);
186  if (IsEqualCLSID(rclsid, &CLSID_ClassMoniker))
187  return IClassFactory_QueryInterface(&ClassMonikerCF, iid, ppv);
188  if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
189  return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv);
190  if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
191  return IClassFactory_QueryInterface(&ComCatCF, iid, ppv);
192 
193  hr = OLE32_DllGetClassObject(rclsid, iid, ppv);
194  if (SUCCEEDED(hr))
195  return hr;
196 
197  return Handler_DllGetClassObject(rclsid, iid, ppv);
198 }
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: oleproxy.c:165
#define REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
static const IClassFactoryVtbl GlobalOptionsCFVtbl
Definition: oleproxy.c:151
HRESULT hr
Definition: shlfolder.c:183
WINE_DEFAULT_DEBUG_CHANNEL(ole)
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:117
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv) DECLSPEC_HIDDEN
Definition: marshal.c:2205
static IClassFactory ComCatCF
Definition: oleproxy.c:149
HRESULT WINAPI CompositeMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
REFIID LPVOID * ppv
Definition: atlbase.h:39
HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) DECLSPEC_HIDDEN
static const IClassFactoryVtbl PointerMonikerCFVtbl
Definition: oleproxy.c:129
static IClassFactory ItemMonikerCF
Definition: oleproxy.c:94
HRESULT WINAPI AntiMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: antimoniker.c:631
HRESULT WINAPI PointerMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
HRESULT Handler_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: compobj.c:5167
static const IClassFactoryVtbl ItemMonikerCFVtbl
Definition: oleproxy.c:85
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static const GUID CLSID_DfMarshal
Definition: marshal.c:63
static IClassFactory PointerMonikerCF
Definition: oleproxy.c:138
static const IClassFactoryVtbl AntiMonikerCFVtbl
Definition: oleproxy.c:96
HRESULT WINAPI ClassMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: classmoniker.c:806
#define debugstr_guid
Definition: kernel32.h:35
static const IClassFactoryVtbl ComCatCFVtbl
Definition: oleproxy.c:140
static const IClassFactoryVtbl FileMonikerCFVtbl
Definition: oleproxy.c:74
static IClassFactory CompositeMonikerCF
Definition: oleproxy.c:116
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: oleproxy.c:58
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
const CLSID CLSID_StdGlobalInterfaceTable
#define WINAPI
Definition: msvc.h:6
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
Definition: oleproxy.c:68
static const IClassFactoryVtbl CompositeMonikerCFVtbl
Definition: oleproxy.c:107
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: oleproxy.c:44
static const IClassFactoryVtbl ClassMonikerCFVtbl
Definition: oleproxy.c:118
static IClassFactory ClassMonikerCF
Definition: oleproxy.c:127
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: oleproxy.c:63
IClassFactory GlobalOptionsCF
Definition: oleproxy.c:160
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI FileMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: filemoniker.c:1543
HRESULT WINAPI ComCat_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
Definition: comcat.c:702
static IClassFactory FileMonikerCF
Definition: oleproxy.c:83
HRESULT WINAPI GlobalOptions_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: compobj.c:5351
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
HRESULT StdGlobalInterfaceTable_GetFactory(LPVOID *ppv) DECLSPEC_HIDDEN
Definition: git.c:344
unsigned int ULONG
Definition: retypes.h:1
HRESULT WINAPI ItemMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: itemmoniker.c:958
const GUID IID_IClassFactory
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static IClassFactory AntiMonikerCF
Definition: oleproxy.c:105