From 20f3e6c1f66c9a8c610e9889f014f0c57acba84d Mon Sep 17 00:00:00 2001 From: Louis Lenders Date: Thu, 26 Aug 2010 00:14:41 +0200 Subject: mscoree: improve GetRequestedRuntimeInfo --- dlls/mscoree/mscoree_main.c | 32 ++++++++++++++++++++++++++++++-- dlls/mscoree/tests/mscoree.c | 8 ++++---- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c index e64f9b0..584cb63 100644 --- a/dlls/mscoree/mscoree_main.c +++ b/dlls/mscoree/mscoree_main.c @@ -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) diff --git a/dlls/mscoree/tests/mscoree.c b/dlls/mscoree/tests/mscoree.c index 924cff9..aedc63b 100644 --- a/dlls/mscoree/tests/mscoree.c +++ b/dlls/mscoree/tests/mscoree.c @@ -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) -- 1.7.0.4