Commit c8fcf420 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

mscoree: COM cleanup for the ICLRRuntimeInfo iface.

parent 52dd3156
...@@ -51,9 +51,9 @@ static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl; ...@@ -51,9 +51,9 @@ static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl;
#define NUM_RUNTIMES 3 #define NUM_RUNTIMES 3
static struct CLRRuntimeInfo runtimes[NUM_RUNTIMES] = { static struct CLRRuntimeInfo runtimes[NUM_RUNTIMES] = {
{&CLRRuntimeInfoVtbl, net_11_subdir, 1, 1, 4322, 0}, {{&CLRRuntimeInfoVtbl}, net_11_subdir, 1, 1, 4322, 0},
{&CLRRuntimeInfoVtbl, net_20_subdir, 2, 0, 50727, 0}, {{&CLRRuntimeInfoVtbl}, net_20_subdir, 2, 0, 50727, 0},
{&CLRRuntimeInfoVtbl, net_40_subdir, 4, 0, 30319, 0} {{&CLRRuntimeInfoVtbl}, net_40_subdir, 4, 0, 30319, 0}
}; };
static int runtimes_initialized; static int runtimes_initialized;
...@@ -311,6 +311,11 @@ void expect_no_runtimes(void) ...@@ -311,6 +311,11 @@ void expect_no_runtimes(void)
} }
} }
static inline CLRRuntimeInfo *impl_from_ICLRRuntimeInfo(ICLRRuntimeInfo *iface)
{
return CONTAINING_RECORD(iface, CLRRuntimeInfo, ICLRRuntimeInfo_iface);
}
static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo* iface, static HRESULT WINAPI CLRRuntimeInfo_QueryInterface(ICLRRuntimeInfo* iface,
REFIID riid, REFIID riid,
void **ppvObject) void **ppvObject)
...@@ -346,7 +351,7 @@ static ULONG WINAPI CLRRuntimeInfo_Release(ICLRRuntimeInfo* iface) ...@@ -346,7 +351,7 @@ static ULONG WINAPI CLRRuntimeInfo_Release(ICLRRuntimeInfo* iface)
static HRESULT WINAPI CLRRuntimeInfo_GetVersionString(ICLRRuntimeInfo* iface, static HRESULT WINAPI CLRRuntimeInfo_GetVersionString(ICLRRuntimeInfo* iface,
LPWSTR pwzBuffer, DWORD *pcchBuffer) LPWSTR pwzBuffer, DWORD *pcchBuffer)
{ {
struct CLRRuntimeInfo *This = (struct CLRRuntimeInfo*)iface; struct CLRRuntimeInfo *This = impl_from_ICLRRuntimeInfo(iface);
DWORD buffer_size = *pcchBuffer; DWORD buffer_size = *pcchBuffer;
HRESULT hr = S_OK; HRESULT hr = S_OK;
char version[11]; char version[11];
...@@ -475,7 +480,7 @@ static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo* iface, ...@@ -475,7 +480,7 @@ static HRESULT WINAPI CLRRuntimeInfo_GetProcAddress(ICLRRuntimeInfo* iface,
static HRESULT WINAPI CLRRuntimeInfo_GetInterface(ICLRRuntimeInfo* iface, static HRESULT WINAPI CLRRuntimeInfo_GetInterface(ICLRRuntimeInfo* iface,
REFCLSID rclsid, REFIID riid, LPVOID *ppUnk) REFCLSID rclsid, REFIID riid, LPVOID *ppUnk)
{ {
struct CLRRuntimeInfo *This = (struct CLRRuntimeInfo*)iface; struct CLRRuntimeInfo *This = impl_from_ICLRRuntimeInfo(iface);
RuntimeHost *host; RuntimeHost *host;
HRESULT hr; HRESULT hr;
...@@ -548,9 +553,9 @@ static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl = { ...@@ -548,9 +553,9 @@ static const struct ICLRRuntimeInfoVtbl CLRRuntimeInfoVtbl = {
HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result) HRESULT ICLRRuntimeInfo_GetRuntimeHost(ICLRRuntimeInfo *iface, RuntimeHost **result)
{ {
struct CLRRuntimeInfo *This = (struct CLRRuntimeInfo*)iface; struct CLRRuntimeInfo *This = impl_from_ICLRRuntimeInfo(iface);
assert(This->ICLRRuntimeInfo_vtbl == &CLRRuntimeInfoVtbl); assert(This->ICLRRuntimeInfo_iface.lpVtbl == &CLRRuntimeInfoVtbl);
return CLRRuntimeInfo_GetRuntimeHost(This, result); return CLRRuntimeInfo_GetRuntimeHost(This, result);
} }
...@@ -839,7 +844,7 @@ static HRESULT WINAPI InstalledRuntimeEnum_Next(IEnumUnknown *iface, ULONG celt, ...@@ -839,7 +844,7 @@ static HRESULT WINAPI InstalledRuntimeEnum_Next(IEnumUnknown *iface, ULONG celt,
} }
if (runtimes[This->pos].mono_abi_version) if (runtimes[This->pos].mono_abi_version)
{ {
item = (IUnknown*)&runtimes[This->pos]; item = (IUnknown*)&runtimes[This->pos].ICLRRuntimeInfo_iface;
IUnknown_AddRef(item); IUnknown_AddRef(item);
rgelt[num_fetched] = item; rgelt[num_fetched] = item;
num_fetched++; num_fetched++;
...@@ -1022,7 +1027,8 @@ static HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface, ...@@ -1022,7 +1027,8 @@ static HRESULT WINAPI CLRMetaHost_GetRuntime(ICLRMetaHost* iface,
runtimes[i].build == build) runtimes[i].build == build)
{ {
if (runtimes[i].mono_abi_version) if (runtimes[i].mono_abi_version)
return IUnknown_QueryInterface((IUnknown*)&runtimes[i], iid, ppRuntime); return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface, iid,
ppRuntime);
else else
{ {
missing_runtime_message(&runtimes[i]); missing_runtime_message(&runtimes[i]);
...@@ -1315,8 +1321,8 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file, ...@@ -1315,8 +1321,8 @@ HRESULT get_runtime_info(LPCWSTR exefile, LPCWSTR version, LPCWSTR config_file,
while (i--) while (i--)
{ {
if (runtimes[i].mono_abi_version) if (runtimes[i].mono_abi_version)
return IUnknown_QueryInterface((IUnknown*)&runtimes[i], return ICLRRuntimeInfo_QueryInterface(&runtimes[i].ICLRRuntimeInfo_iface,
&IID_ICLRRuntimeInfo, (void**)result); &IID_ICLRRuntimeInfo, (void **)result);
} }
if (legacy) if (legacy)
......
...@@ -37,7 +37,7 @@ typedef struct RuntimeHost RuntimeHost; ...@@ -37,7 +37,7 @@ typedef struct RuntimeHost RuntimeHost;
typedef struct CLRRuntimeInfo typedef struct CLRRuntimeInfo
{ {
const struct ICLRRuntimeInfoVtbl *ICLRRuntimeInfo_vtbl; ICLRRuntimeInfo ICLRRuntimeInfo_iface;
LPCWSTR mono_libdir; LPCWSTR mono_libdir;
DWORD major; DWORD major;
DWORD minor; DWORD minor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment