Louis Lenders : mscoree: Improve GetRequestedRuntimeInfo.

Alexandre Julliard julliard at winehq.org
Thu Aug 26 11:42:06 CDT 2010


Module: wine
Branch: master
Commit: 9ea1d13d1443568fa1bcb244d65a7316b9d90afb
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9ea1d13d1443568fa1bcb244d65a7316b9d90afb

Author: Louis Lenders <xerox_xerox2000 at yahoo.co.uk>
Date:   Thu Aug 26 00:14:41 2010 +0200

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..1269f9c 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 c8776f6..59ba58e 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)




More information about the wine-cvs mailing list