urlmon: Fix return value from QueryService.
[wine.git] / dlls / mscoree / metadata.c
blob7a5336d0447b8ec4e815b71f16b8fba5d7efd19e
1 /*
2 * IMetaDataDispenserEx - dynamic creation/editing of assemblies
4 * Copyright 2010 Vincent Povirk for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #include <stdarg.h>
23 #include <assert.h>
25 #define COBJMACROS
27 #include "wine/library.h"
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "ole2.h"
33 #include "cor.h"
34 #include "metahost.h"
35 #include "wine/list.h"
36 #include "mscoree_private.h"
38 #include "wine/debug.h"
40 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
42 typedef struct MetaDataDispenser
44 IMetaDataDispenserEx IMetaDataDispenserEx_iface;
45 LONG ref;
46 } MetaDataDispenser;
48 static inline MetaDataDispenser *impl_from_IMetaDataDispenserEx(IMetaDataDispenserEx *iface)
50 return CONTAINING_RECORD(iface, MetaDataDispenser, IMetaDataDispenserEx_iface);
53 static HRESULT WINAPI MetaDataDispenser_QueryInterface(IMetaDataDispenserEx* iface,
54 REFIID riid, void **ppvObject)
56 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
58 if (IsEqualGUID(riid, &IID_IMetaDataDispenserEx) ||
59 IsEqualGUID(riid, &IID_IMetaDataDispenser) ||
60 IsEqualGUID(riid, &IID_IUnknown))
62 *ppvObject = iface;
64 else
66 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
67 return E_NOINTERFACE;
70 IMetaDataDispenserEx_AddRef( iface );
72 return S_OK;
75 static ULONG WINAPI MetaDataDispenser_AddRef(IMetaDataDispenserEx* iface)
77 MetaDataDispenser *This = impl_from_IMetaDataDispenserEx(iface);
78 ULONG ref = InterlockedIncrement(&This->ref);
80 TRACE("%p ref=%u\n", This, ref);
82 MSCOREE_LockModule();
84 return ref;
87 static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface)
89 MetaDataDispenser *This = impl_from_IMetaDataDispenserEx(iface);
90 ULONG ref = InterlockedDecrement(&This->ref);
92 TRACE("%p ref=%u\n", This, ref);
94 if (ref == 0)
96 HeapFree(GetProcessHeap(), 0, This);
99 MSCOREE_UnlockModule();
101 return ref;
104 static HRESULT WINAPI MetaDataDispenser_DefineScope(IMetaDataDispenserEx* iface,
105 REFCLSID rclsid, DWORD dwCreateFlags, REFIID riid, IUnknown **ppIUnk)
107 FIXME("%p %s %x %s %p\n", iface, debugstr_guid(rclsid), dwCreateFlags,
108 debugstr_guid(riid), ppIUnk);
109 return E_NOTIMPL;
112 static HRESULT WINAPI MetaDataDispenser_OpenScope(IMetaDataDispenserEx* iface,
113 LPCWSTR szScope, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
115 FIXME("%p %s %x %s %p\n", iface, debugstr_w(szScope), dwOpenFlags,
116 debugstr_guid(riid), ppIUnk);
117 return E_NOTIMPL;
120 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnMemory(IMetaDataDispenserEx* iface,
121 const void *pData, ULONG cbData, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
123 FIXME("%p %p %u %x %s %p\n", iface, pData, cbData, dwOpenFlags,
124 debugstr_guid(riid), ppIUnk);
125 return E_NOTIMPL;
128 static HRESULT WINAPI MetaDataDispenser_SetOption(IMetaDataDispenserEx* iface,
129 REFGUID optionid, const VARIANT *value)
131 FIXME("%p %s\n", iface, debugstr_guid(optionid));
132 return E_NOTIMPL;
135 static HRESULT WINAPI MetaDataDispenser_GetOption(IMetaDataDispenserEx* iface,
136 REFGUID optionid, VARIANT *pvalue)
138 FIXME("%p %s\n", iface, debugstr_guid(optionid));
139 return E_NOTIMPL;
142 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnITypeInfo(IMetaDataDispenserEx* iface,
143 ITypeInfo *pITI, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
145 FIXME("%p %p %u %s %p\n", iface, pITI, dwOpenFlags, debugstr_guid(riid), ppIUnk);
146 return E_NOTIMPL;
149 static HRESULT WINAPI MetaDataDispenser_GetCORSystemDirectory(IMetaDataDispenserEx* iface,
150 LPWSTR szBuffer, DWORD cchBuffer, DWORD *pchBuffer)
152 FIXME("%p %p %u %p\n", iface, szBuffer, cchBuffer, pchBuffer);
153 return E_NOTIMPL;
156 static HRESULT WINAPI MetaDataDispenser_FindAssembly(IMetaDataDispenserEx* iface,
157 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
158 LPWSTR szName, ULONG cchName, ULONG *pcName)
160 FIXME("%p %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
161 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin),
162 debugstr_w(szAssemblyName), szName, cchName, pcName);
163 return E_NOTIMPL;
166 static HRESULT WINAPI MetaDataDispenser_FindAssemblyModule(IMetaDataDispenserEx* iface,
167 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
168 LPCWSTR szModuleName, LPWSTR szName, ULONG cchName, ULONG *pcName)
170 FIXME("%p %s %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
171 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin), debugstr_w(szAssemblyName),
172 debugstr_w(szModuleName), szName, cchName, pcName);
173 return E_NOTIMPL;
176 const struct IMetaDataDispenserExVtbl MetaDataDispenserVtbl =
178 MetaDataDispenser_QueryInterface,
179 MetaDataDispenser_AddRef,
180 MetaDataDispenser_Release,
181 MetaDataDispenser_DefineScope,
182 MetaDataDispenser_OpenScope,
183 MetaDataDispenser_OpenScopeOnMemory,
184 MetaDataDispenser_SetOption,
185 MetaDataDispenser_GetOption,
186 MetaDataDispenser_OpenScopeOnITypeInfo,
187 MetaDataDispenser_GetCORSystemDirectory,
188 MetaDataDispenser_FindAssembly,
189 MetaDataDispenser_FindAssemblyModule
192 HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
194 MetaDataDispenser *This;
196 This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetaDataDispenser));
198 if (!This)
199 return E_OUTOFMEMORY;
201 This->IMetaDataDispenserEx_iface.lpVtbl = &MetaDataDispenserVtbl;
202 This->ref = 1;
204 *ppUnk = (IUnknown*)This;
206 return S_OK;