2 * ICLRMetaHost - discovery and management of available .NET runtimes
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
25 #include "wine/unicode.h"
26 #include "wine/library.h"
33 #include "mscoree_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL( mscoree );
41 const struct ICLRMetaHostVtbl *CLRMetaHost_vtbl;
44 static const struct CLRMetaHost GlobalCLRMetaHost;
46 static HRESULT WINAPI CLRMetaHost_QueryInterface(ICLRMetaHost* iface,
50 TRACE("%s %p\n", debugstr_guid(riid), ppvObject);
52 if ( IsEqualGUID( riid, &IID_ICLRMetaHost ) ||
53 IsEqualGUID( riid, &IID_IUnknown ) )
59 FIXME("Unsupported interface %s\n", debugstr_guid(riid));
63 ICLRMetaHost_AddRef( iface );
68 static ULONG WINAPI CLRMetaHost_AddRef(ICLRMetaHost* iface)
73 static ULONG WINAPI CLRMetaHost_Release(ICLRMetaHost* iface)
78 static HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
79 LPCWSTR pwzVersion, REFIID iid, LPVOID *ppRuntime)
81 FIXME("%s %s %p\n", debugstr_w(pwzVersion), debugstr_guid(iid), ppRuntime);
86 static HRESULT WINAPI CLRMetaHost_GetVersionFromFile(ICLRMetaHost* iface,
87 LPCWSTR pwzFilePath, LPWSTR pwzBuffer, DWORD *pcchBuffer)
92 ULONG buffer_size=*pcchBuffer;
94 TRACE("%s %p %p\n", debugstr_w(pwzFilePath), pwzBuffer, pcchBuffer);
96 hr = assembly_create(&assembly, pwzFilePath);
100 hr = assembly_get_runtime_version(assembly, &version);
104 *pcchBuffer = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
108 if (buffer_size >= *pcchBuffer)
109 MultiByteToWideChar(CP_UTF8, 0, version, -1, pwzBuffer, buffer_size);
111 hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
115 assembly_release(assembly);
121 static HRESULT WINAPI CLRMetaHost_EnumerateInstalledRuntimes(ICLRMetaHost* iface,
122 IEnumUnknown **ppEnumerator)
124 FIXME("%p\n", ppEnumerator);
129 static HRESULT WINAPI CLRMetaHost_EnumerateLoadedRuntimes(ICLRMetaHost* iface,
130 HANDLE hndProcess, IEnumUnknown **ppEnumerator)
132 FIXME("%p %p\n", hndProcess, ppEnumerator);
137 static HRESULT WINAPI CLRMetaHost_RequestRuntimeLoadedNotification(ICLRMetaHost* iface,
138 RuntimeLoadedCallbackFnPtr pCallbackFunction)
140 FIXME("%p\n", pCallbackFunction);
145 static HRESULT WINAPI CLRMetaHost_QueryLegacyV2RuntimeBinding(ICLRMetaHost* iface,
146 REFIID riid, LPVOID *ppUnk)
148 FIXME("%s %p\n", debugstr_guid(riid), ppUnk);
153 static HRESULT WINAPI CLRMetaHost_ExitProcess(ICLRMetaHost* iface, INT32 iExitCode)
155 FIXME("%i: stub\n", iExitCode);
157 ExitProcess(iExitCode);
160 static const struct ICLRMetaHostVtbl CLRMetaHost_vtbl =
162 CLRMetaHost_QueryInterface,
165 CLRMetaHost_GetRuntime,
166 CLRMetaHost_GetVersionFromFile,
167 CLRMetaHost_EnumerateInstalledRuntimes,
168 CLRMetaHost_EnumerateLoadedRuntimes,
169 CLRMetaHost_RequestRuntimeLoadedNotification,
170 CLRMetaHost_QueryLegacyV2RuntimeBinding,
171 CLRMetaHost_ExitProcess
174 static const struct CLRMetaHost GlobalCLRMetaHost = {
178 extern HRESULT CLRMetaHost_CreateInstance(REFIID riid, void **ppobj)
180 return ICLRMetaHost_QueryInterface((ICLRMetaHost*)&GlobalCLRMetaHost, riid, ppobj);