Commit 84ef0fca authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

mscoree: Use the new search methods for GetCORVersion/GetCORSystemDirectory.

parent add7454d
......@@ -460,56 +460,48 @@ HRESULT WINAPI _CorValidateImage(PVOID* imageBase, LPCWSTR imageName)
HRESULT WINAPI GetCORSystemDirectory(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
{
static const WCHAR slash[] = {'\\',0};
WCHAR system_dir[MAX_PATH];
WCHAR version[MAX_PATH];
ICLRRuntimeInfo *info;
HRESULT ret;
FIXME("(%p, %d, %p): semi-stub!\n", pbuffer, cchBuffer, dwLength);
TRACE("(%p, %d, %p)!\n", pbuffer, cchBuffer, dwLength);
if (!dwLength)
if (!dwLength || !pbuffer)
return E_POINTER;
if (!pbuffer)
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
if (!get_install_root(system_dir))
{
ERR("error reading registry key for installroot, returning empty path\n");
*dwLength = 0;
}
else
if (SUCCEEDED(ret))
{
GetCORVersion(version, MAX_PATH, dwLength);
lstrcatW(system_dir, version);
lstrcatW(system_dir, slash);
*dwLength = lstrlenW(system_dir) + 1;
*dwLength = cchBuffer;
ret = ICLRRuntimeInfo_GetRuntimeDirectory(info, pbuffer, dwLength);
if (cchBuffer < *dwLength)
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
lstrcpyW(pbuffer, system_dir);
ICLRRuntimeInfo_Release(info);
}
return S_OK;
return ret;
}
HRESULT WINAPI GetCORVersion(LPWSTR pbuffer, DWORD cchBuffer, DWORD *dwLength)
{
static const WCHAR version[] = {'v','2','.','0','.','5','0','7','2','7',0};
ICLRRuntimeInfo *info;
HRESULT ret;
FIXME("(%p, %d, %p): semi-stub!\n", pbuffer, cchBuffer, dwLength);
TRACE("(%p, %d, %p)!\n", pbuffer, cchBuffer, dwLength);
if (!dwLength || !pbuffer)
return E_POINTER;
*dwLength = lstrlenW(version) + 1;
ret = get_runtime_info(NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, TRUE, &info);
if (cchBuffer < *dwLength)
return HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
if (SUCCEEDED(ret))
{
*dwLength = cchBuffer;
ret = ICLRRuntimeInfo_GetVersionString(info, pbuffer, dwLength);
lstrcpyW(pbuffer, version);
ICLRRuntimeInfo_Release(info);
}
return S_OK;
return ret;
}
HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile,
......
......@@ -87,6 +87,14 @@ static void test_versioninfo(void)
}
hr = pGetCORVersion(version, 1, &size);
if (hr == CLR_E_SHIM_RUNTIME)
{
/* FIXME: Get Mono packaged properly so we can fail here. */
todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),"GetCORVersion returned %08x\n", hr);
skip("No .NET runtimes are installed\n");
return;
}
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER),"GetCORVersion returned %08x\n", hr);
hr = pGetCORVersion(version, MAX_PATH, &size);
......
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