mscoree: Improve GetRequestedRuntimeInfo.

This commit is contained in:
Louis Lenders 2010-08-26 00:14:41 +02:00 committed by Alexandre Julliard
parent 830867a121
commit 9ea1d13d14
2 changed files with 34 additions and 6 deletions

View file

@ -32,6 +32,7 @@
#include "initguid.h"
#include "cor.h"
#include "corerror.h"
#include "mscoree.h"
#include "mscoree_private.h"
@ -414,10 +415,37 @@ HRESULT WINAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWST
DWORD startupFlags, DWORD runtimeInfoFlags, LPWSTR pDirectory, DWORD dwDirectory, DWORD *dwDirectoryLength,
LPWSTR pVersion, DWORD cchBuffer, DWORD *dwlength)
{
FIXME("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p) stub\n", debugstr_w(pExe),
HRESULT ret;
DWORD ver_len, dir_len;
WCHAR dirW[MAX_PATH], verW[MAX_PATH];
FIXME("(%s, %s, %s, 0x%08x, 0x%08x, %p, 0x%08x, %p, %p, 0x%08x, %p) semi-stub\n", debugstr_w(pExe),
debugstr_w(pwszVersion), debugstr_w(pConfigurationFile), startupFlags, runtimeInfoFlags, pDirectory,
dwDirectory, dwDirectoryLength, pVersion, cchBuffer, dwlength);
return GetCORVersion(pVersion, cchBuffer, dwlength);
if (!pwszVersion && !(runtimeInfoFlags & RUNTIME_INFO_UPGRADE_VERSION))
return CLR_E_SHIM_RUNTIME;
ret = GetCORSystemDirectory(dirW, dwDirectory, &dir_len);
if (ret == S_OK)
{
if (dwDirectoryLength)
*dwDirectoryLength = dir_len;
if (pDirectory)
lstrcpyW(pDirectory, dirW);
ret = GetCORVersion(verW, cchBuffer, &ver_len);
if (ret == S_OK)
{
if (dwlength)
*dwlength = ver_len;
if (pVersion)
lstrcpyW(pVersion, verW);
}
}
return ret;
}
HRESULT WINAPI LoadLibraryShim( LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE * phModDll)

View file

@ -103,13 +103,13 @@ static void test_versioninfo(void)
trace(" installed in directory %s is .net version %s \n", wine_dbgstr_w(path), wine_dbgstr_w(version));
/* version number NULL not allowed without RUNTIME_INFO_UPGRADE_VERSION flag */
hr = pGetRequestedRuntimeInfo( NULL, NULL, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
todo_wine ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08x\n", hr);
ok(hr == CLR_E_SHIM_RUNTIME, "GetRequestedRuntimeInfo returned %08x\n", hr);
/* with RUNTIME_INFO_UPGRADE_VERSION flag and version number NULL, latest installed version is returned */
hr = pGetRequestedRuntimeInfo( NULL, NULL, NULL, 0, RUNTIME_INFO_UPGRADE_VERSION, path, MAX_PATH, &path_len, version, MAX_PATH, &size);
ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr);
hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, 1, &path_len, version, MAX_PATH, &size);
todo_wine ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "GetRequestedRuntimeInfo returned %08x\n", hr);
ok(hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), "GetRequestedRuntimeInfo returned %08x\n", hr);
/* if one of the buffers is NULL, the other one is still happily filled */
memset(version, 0, sizeof(version));
@ -119,8 +119,8 @@ static void test_versioninfo(void)
/* With NULL-pointer for bufferlength, the buffer itsself still gets filled with correct string */
memset(version, 0, sizeof(version));
hr = pGetRequestedRuntimeInfo( NULL, v2_0, NULL, 0, 0, path, MAX_PATH, &path_len, version, MAX_PATH, NULL);
todo_wine ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr);
todo_wine ok(!lstrcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
ok(hr == S_OK, "GetRequestedRuntimeInfo returned %08x\n", hr);
ok(!lstrcmpW(version, v2_0), "version is %s , expected %s\n", wine_dbgstr_w(version), wine_dbgstr_w(v2_0));
}
START_TEST(mscoree)