dbghelp: Use local declarations of r_debug and link_map structs.
[wine.git] / dlls / mscoree / metadata.c
blob4853dd0c6b98f98fe35b19f0c1dce432e658e25f
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 "windef.h"
28 #include "winbase.h"
29 #include "winreg.h"
30 #include "ole2.h"
31 #include "cor.h"
32 #include "mscoree.h"
33 #include "corhdr.h"
34 #include "cordebug.h"
35 #include "metahost.h"
36 #include "wine/list.h"
37 #include "mscoree_private.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
43 typedef struct MetaDataDispenser
45 IMetaDataDispenserEx IMetaDataDispenserEx_iface;
46 LONG ref;
47 } MetaDataDispenser;
49 static inline MetaDataDispenser *impl_from_IMetaDataDispenserEx(IMetaDataDispenserEx *iface)
51 return CONTAINING_RECORD(iface, MetaDataDispenser, IMetaDataDispenserEx_iface);
54 static HRESULT WINAPI MetaDataDispenser_QueryInterface(IMetaDataDispenserEx* iface,
55 REFIID riid, void **ppvObject)
57 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
59 if (IsEqualGUID(riid, &IID_IMetaDataDispenserEx) ||
60 IsEqualGUID(riid, &IID_IMetaDataDispenser) ||
61 IsEqualGUID(riid, &IID_IUnknown))
63 *ppvObject = iface;
65 else
67 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
68 return E_NOINTERFACE;
71 IMetaDataDispenserEx_AddRef( iface );
73 return S_OK;
76 static ULONG WINAPI MetaDataDispenser_AddRef(IMetaDataDispenserEx* iface)
78 MetaDataDispenser *This = impl_from_IMetaDataDispenserEx(iface);
79 ULONG ref = InterlockedIncrement(&This->ref);
81 TRACE("%p ref=%u\n", This, ref);
83 return ref;
86 static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface)
88 MetaDataDispenser *This = impl_from_IMetaDataDispenserEx(iface);
89 ULONG ref = InterlockedDecrement(&This->ref);
91 TRACE("%p ref=%u\n", This, ref);
93 if (ref == 0)
95 HeapFree(GetProcessHeap(), 0, This);
98 return ref;
101 static HRESULT WINAPI MetaDataDispenser_DefineScope(IMetaDataDispenserEx* iface,
102 REFCLSID rclsid, DWORD dwCreateFlags, REFIID riid, IUnknown **ppIUnk)
104 FIXME("%p %s %x %s %p\n", iface, debugstr_guid(rclsid), dwCreateFlags,
105 debugstr_guid(riid), ppIUnk);
106 return E_NOTIMPL;
109 static HRESULT WINAPI MetaDataDispenser_OpenScope(IMetaDataDispenserEx* iface,
110 LPCWSTR szScope, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
112 FIXME("%p %s %x %s %p\n", iface, debugstr_w(szScope), dwOpenFlags,
113 debugstr_guid(riid), ppIUnk);
114 return E_NOTIMPL;
117 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnMemory(IMetaDataDispenserEx* iface,
118 const void *pData, ULONG cbData, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
120 FIXME("%p %p %u %x %s %p\n", iface, pData, cbData, dwOpenFlags,
121 debugstr_guid(riid), ppIUnk);
122 return E_NOTIMPL;
125 static HRESULT WINAPI MetaDataDispenser_SetOption(IMetaDataDispenserEx* iface,
126 REFGUID optionid, const VARIANT *value)
128 FIXME("%p %s\n", iface, debugstr_guid(optionid));
129 return E_NOTIMPL;
132 static HRESULT WINAPI MetaDataDispenser_GetOption(IMetaDataDispenserEx* iface,
133 REFGUID optionid, VARIANT *pvalue)
135 FIXME("%p %s\n", iface, debugstr_guid(optionid));
136 return E_NOTIMPL;
139 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnITypeInfo(IMetaDataDispenserEx* iface,
140 ITypeInfo *pITI, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
142 FIXME("%p %p %u %s %p\n", iface, pITI, dwOpenFlags, debugstr_guid(riid), ppIUnk);
143 return E_NOTIMPL;
146 static HRESULT WINAPI MetaDataDispenser_GetCORSystemDirectory(IMetaDataDispenserEx* iface,
147 LPWSTR szBuffer, DWORD cchBuffer, DWORD *pchBuffer)
149 FIXME("%p %p %u %p\n", iface, szBuffer, cchBuffer, pchBuffer);
150 return E_NOTIMPL;
153 static HRESULT WINAPI MetaDataDispenser_FindAssembly(IMetaDataDispenserEx* iface,
154 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
155 LPWSTR szName, ULONG cchName, ULONG *pcName)
157 FIXME("%p %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
158 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin),
159 debugstr_w(szAssemblyName), szName, cchName, pcName);
160 return E_NOTIMPL;
163 static HRESULT WINAPI MetaDataDispenser_FindAssemblyModule(IMetaDataDispenserEx* iface,
164 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
165 LPCWSTR szModuleName, LPWSTR szName, ULONG cchName, ULONG *pcName)
167 FIXME("%p %s %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
168 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin), debugstr_w(szAssemblyName),
169 debugstr_w(szModuleName), szName, cchName, pcName);
170 return E_NOTIMPL;
173 static const struct IMetaDataDispenserExVtbl MetaDataDispenserVtbl =
175 MetaDataDispenser_QueryInterface,
176 MetaDataDispenser_AddRef,
177 MetaDataDispenser_Release,
178 MetaDataDispenser_DefineScope,
179 MetaDataDispenser_OpenScope,
180 MetaDataDispenser_OpenScopeOnMemory,
181 MetaDataDispenser_SetOption,
182 MetaDataDispenser_GetOption,
183 MetaDataDispenser_OpenScopeOnITypeInfo,
184 MetaDataDispenser_GetCORSystemDirectory,
185 MetaDataDispenser_FindAssembly,
186 MetaDataDispenser_FindAssemblyModule
189 HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
191 MetaDataDispenser *This;
193 This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetaDataDispenser));
195 if (!This)
196 return E_OUTOFMEMORY;
198 This->IMetaDataDispenserEx_iface.lpVtbl = &MetaDataDispenserVtbl;
199 This->ref = 1;
201 *ppUnk = (IUnknown*)&This->IMetaDataDispenserEx_iface;
203 return S_OK;