Release 1.3.7.
[wine/gsoc-2012-control.git] / dlls / mscoree / metadata.c
blobc9b8c723d92242475852424fdccf04ba2136e805
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 const struct IMetaDataDispenserExVtbl *lpVtbl;
45 LONG ref;
46 } MetaDataDispenser;
48 static HRESULT WINAPI MetaDataDispenser_QueryInterface(IMetaDataDispenserEx* iface,
49 REFIID riid, void **ppvObject)
51 TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject);
53 if (IsEqualGUID(riid, &IID_IMetaDataDispenserEx) ||
54 IsEqualGUID(riid, &IID_IMetaDataDispenser) ||
55 IsEqualGUID(riid, &IID_IUnknown))
57 *ppvObject = iface;
59 else
61 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
62 return E_NOINTERFACE;
65 IMetaDataDispenserEx_AddRef( iface );
67 return S_OK;
70 static ULONG WINAPI MetaDataDispenser_AddRef(IMetaDataDispenserEx* iface)
72 MetaDataDispenser *This = (MetaDataDispenser*)iface;
73 ULONG ref = InterlockedIncrement(&This->ref);
75 TRACE("%p ref=%u\n", This, ref);
77 MSCOREE_LockModule();
79 return ref;
82 static ULONG WINAPI MetaDataDispenser_Release(IMetaDataDispenserEx* iface)
84 MetaDataDispenser *This = (MetaDataDispenser*)iface;
85 ULONG ref = InterlockedDecrement(&This->ref);
87 TRACE("%p ref=%u\n", This, ref);
89 if (ref == 0)
91 HeapFree(GetProcessHeap(), 0, This);
94 MSCOREE_UnlockModule();
96 return ref;
99 static HRESULT WINAPI MetaDataDispenser_DefineScope(IMetaDataDispenserEx* iface,
100 REFCLSID rclsid, DWORD dwCreateFlags, REFIID riid, IUnknown **ppIUnk)
102 FIXME("%p %s %x %s %p\n", iface, debugstr_guid(rclsid), dwCreateFlags,
103 debugstr_guid(riid), ppIUnk);
104 return E_NOTIMPL;
107 static HRESULT WINAPI MetaDataDispenser_OpenScope(IMetaDataDispenserEx* iface,
108 LPCWSTR szScope, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
110 FIXME("%p %s %x %s %p\n", iface, debugstr_w(szScope), dwOpenFlags,
111 debugstr_guid(riid), ppIUnk);
112 return E_NOTIMPL;
115 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnMemory(IMetaDataDispenserEx* iface,
116 const void *pData, ULONG cbData, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
118 FIXME("%p %p %u %x %s %p\n", iface, pData, cbData, dwOpenFlags,
119 debugstr_guid(riid), ppIUnk);
120 return E_NOTIMPL;
123 static HRESULT WINAPI MetaDataDispenser_SetOption(IMetaDataDispenserEx* iface,
124 REFGUID optionid, const VARIANT *value)
126 FIXME("%p %s\n", iface, debugstr_guid(optionid));
127 return E_NOTIMPL;
130 static HRESULT WINAPI MetaDataDispenser_GetOption(IMetaDataDispenserEx* iface,
131 REFGUID optionid, VARIANT *pvalue)
133 FIXME("%p %s\n", iface, debugstr_guid(optionid));
134 return E_NOTIMPL;
137 static HRESULT WINAPI MetaDataDispenser_OpenScopeOnITypeInfo(IMetaDataDispenserEx* iface,
138 ITypeInfo *pITI, DWORD dwOpenFlags, REFIID riid, IUnknown **ppIUnk)
140 FIXME("%p %p %u %s %p\n", iface, pITI, dwOpenFlags, debugstr_guid(riid), ppIUnk);
141 return E_NOTIMPL;
144 static HRESULT WINAPI MetaDataDispenser_GetCORSystemDirectory(IMetaDataDispenserEx* iface,
145 LPWSTR szBuffer, DWORD cchBuffer, DWORD *pchBuffer)
147 FIXME("%p %p %u %p\n", iface, szBuffer, cchBuffer, pchBuffer);
148 return E_NOTIMPL;
151 static HRESULT WINAPI MetaDataDispenser_FindAssembly(IMetaDataDispenserEx* iface,
152 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
153 LPWSTR szName, ULONG cchName, ULONG *pcName)
155 FIXME("%p %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
156 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin),
157 debugstr_w(szAssemblyName), szName, cchName, pcName);
158 return E_NOTIMPL;
161 static HRESULT WINAPI MetaDataDispenser_FindAssemblyModule(IMetaDataDispenserEx* iface,
162 LPCWSTR szAppBase, LPCWSTR szPrivateBin, LPCWSTR szGlobalBin, LPCWSTR szAssemblyName,
163 LPCWSTR szModuleName, LPWSTR szName, ULONG cchName, ULONG *pcName)
165 FIXME("%p %s %s %s %s %s %p %u %p\n", iface, debugstr_w(szAppBase),
166 debugstr_w(szPrivateBin), debugstr_w(szGlobalBin), debugstr_w(szAssemblyName),
167 debugstr_w(szModuleName), szName, cchName, pcName);
168 return E_NOTIMPL;
171 const struct IMetaDataDispenserExVtbl MetaDataDispenserVtbl =
173 MetaDataDispenser_QueryInterface,
174 MetaDataDispenser_AddRef,
175 MetaDataDispenser_Release,
176 MetaDataDispenser_DefineScope,
177 MetaDataDispenser_OpenScope,
178 MetaDataDispenser_OpenScopeOnMemory,
179 MetaDataDispenser_SetOption,
180 MetaDataDispenser_GetOption,
181 MetaDataDispenser_OpenScopeOnITypeInfo,
182 MetaDataDispenser_GetCORSystemDirectory,
183 MetaDataDispenser_FindAssembly,
184 MetaDataDispenser_FindAssemblyModule
187 HRESULT MetaDataDispenser_CreateInstance(IUnknown **ppUnk)
189 MetaDataDispenser *This;
191 This = HeapAlloc(GetProcessHeap(), 0, sizeof(MetaDataDispenser));
193 if (!This)
194 return E_OUTOFMEMORY;
196 This->lpVtbl = &MetaDataDispenserVtbl;
197 This->ref = 1;
199 *ppUnk = (IUnknown*)This;
201 return S_OK;