ReactOS  0.4.13-dev-79-gcd489d8
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 "config.h"
23 
24 #include <stdlib.h>
25 #include <stdarg.h>
26 #include <stdio.h>
27 #include <string.h>
28 
29 #define COBJMACROS
30 
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winuser.h"
34 #include "objbase.h"
35 #include "ole2.h"
36 #include "rpc.h"
37 
38 #include "compobj_private.h"
39 #include "moniker.h"
40 #include "comcat.h"
41 
42 #include "wine/debug.h"
43 
45 
47 {
48  TRACE("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
49 
51  {
52  *ppv = iface;
53  return S_OK;
54  }
55 
56  *ppv = NULL;
57  return E_NOINTERFACE;
58 }
59 
61 {
62  return 2;
63 }
64 
66 {
67  return 1;
68 }
69 
71 {
72  TRACE("(%x)\n", fLock);
73  return S_OK;
74 }
75 
76 static const IClassFactoryVtbl FileMonikerCFVtbl =
77 {
83 };
84 
86 
87 static const IClassFactoryVtbl ItemMonikerCFVtbl =
88 {
94 };
95 
97 
98 static const IClassFactoryVtbl AntiMonikerCFVtbl =
99 {
105 };
106 
108 
109 static const IClassFactoryVtbl CompositeMonikerCFVtbl =
110 {
116 };
117 
119 
120 static const IClassFactoryVtbl ClassMonikerCFVtbl =
121 {
127 };
128 
130 
131 static const IClassFactoryVtbl PointerMonikerCFVtbl =
132 {
138 };
139 
141 
142 static const IClassFactoryVtbl ComCatCFVtbl =
143 {
149 };
150 
152 
153 static const IClassFactoryVtbl GlobalOptionsCFVtbl =
154 {
160 };
161 
163 
164 /***********************************************************************
165  * DllGetClassObject [OLE32.@]
166  */
168 {
169  HRESULT hr;
170 
171  *ppv = NULL;
172  if (IsEqualIID(rclsid,&CLSID_DfMarshal)&&(
175  )
176  )
180  if (IsEqualCLSID(rclsid, &CLSID_FileMoniker))
181  return IClassFactory_QueryInterface(&FileMonikerCF, iid, ppv);
182  if (IsEqualCLSID(rclsid, &CLSID_ItemMoniker))
183  return IClassFactory_QueryInterface(&ItemMonikerCF, iid, ppv);
184  if (IsEqualCLSID(rclsid, &CLSID_AntiMoniker))
185  return IClassFactory_QueryInterface(&AntiMonikerCF, iid, ppv);
186  if (IsEqualCLSID(rclsid, &CLSID_CompositeMoniker))
187  return IClassFactory_QueryInterface(&CompositeMonikerCF, iid, ppv);
188  if (IsEqualCLSID(rclsid, &CLSID_ClassMoniker))
189  return IClassFactory_QueryInterface(&ClassMonikerCF, iid, ppv);
190  if (IsEqualCLSID(rclsid, &CLSID_PointerMoniker))
191  return IClassFactory_QueryInterface(&PointerMonikerCF, iid, ppv);
192  if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr))
193  return IClassFactory_QueryInterface(&ComCatCF, iid, ppv);
194 
195  hr = OLE32_DllGetClassObject(rclsid, iid, ppv);
196  if (SUCCEEDED(hr))
197  return hr;
198 
199  return Handler_DllGetClassObject(rclsid, iid, ppv);
200 }
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
Definition: oleproxy.c:167
#define REFIID
Definition: guiddef.h:113
#define E_NOINTERFACE
Definition: winerror.h:2364
static const IClassFactoryVtbl GlobalOptionsCFVtbl
Definition: oleproxy.c:153
HRESULT hr
Definition: shlfolder.c:183
WINE_DEFAULT_DEBUG_CHANNEL(ole)
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:112
HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv) DECLSPEC_HIDDEN
Definition: marshal.c:2206
static IClassFactory ComCatCF
Definition: oleproxy.c:151
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:131
static IClassFactory ItemMonikerCF
Definition: oleproxy.c:96
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:5076
static const IClassFactoryVtbl ItemMonikerCFVtbl
Definition: oleproxy.c:87
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:140
static const IClassFactoryVtbl AntiMonikerCFVtbl
Definition: oleproxy.c:98
HRESULT WINAPI ClassMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: classmoniker.c:807
#define debugstr_guid
Definition: kernel32.h:35
static const IClassFactoryVtbl ComCatCFVtbl
Definition: oleproxy.c:142
static const IClassFactoryVtbl FileMonikerCFVtbl
Definition: oleproxy.c:76
static IClassFactory CompositeMonikerCF
Definition: oleproxy.c:118
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: oleproxy.c:60
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
const CLSID CLSID_StdGlobalInterfaceTable
#define WINAPI
Definition: msvc.h:8
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
Definition: oleproxy.c:70
static const IClassFactoryVtbl CompositeMonikerCFVtbl
Definition: oleproxy.c:109
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: oleproxy.c:46
static const IClassFactoryVtbl ClassMonikerCFVtbl
Definition: oleproxy.c:120
static IClassFactory ClassMonikerCF
Definition: oleproxy.c:129
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: oleproxy.c:65
IClassFactory GlobalOptionsCF
Definition: oleproxy.c:162
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI FileMoniker_CreateInstance(IClassFactory *iface, IUnknown *pUnk, REFIID riid, void **ppv)
Definition: filemoniker.c:1544
HRESULT WINAPI ComCat_CreateInstance(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppvObj)
Definition: comcat.c:703
static IClassFactory FileMonikerCF
Definition: oleproxy.c:85
HRESULT WINAPI GlobalOptions_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: compobj.c:5240
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
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:959
const GUID IID_IClassFactory
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:91
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:90
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static IClassFactory AntiMonikerCF
Definition: oleproxy.c:107