mscoree: Attempt to load the assembly from the application directory (try 2)

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Tue Aug 20 23:13:42 CDT 2013


Hi,
Moved the code to function get_file_from_strongname. However now we 
attempt to find the assembly in the application directory even if a 
valid path exists in the registry.

IMO: The first iteration does a better job.


Changelog:
     mscoree:Attempt to load the assembly from the application directory


Best Regards
  Alistair Leslie-Hughes
-------------- next part --------------
>From e5006fdaac04e62024d9a24aadd38c4e10abe337 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Wed, 14 Aug 2013 15:59:53 +1000
Subject: [PATCH] Attempt to load the assembly from the application directory
To: wine-patches <wine-patches at winehq.org>

---
 dlls/mscoree/metahost.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/dlls/mscoree/metahost.c b/dlls/mscoree/metahost.c
index 519e991..4307bee 100644
--- a/dlls/mscoree/metahost.c
+++ b/dlls/mscoree/metahost.c
@@ -30,6 +30,7 @@
 #include "winbase.h"
 #include "winreg.h"
 #include "ole2.h"
+#include "shlwapi.h"
 
 #include "corerror.h"
 #include "cor.h"
@@ -1244,6 +1245,29 @@ HRESULT get_file_from_strongname(WCHAR* stringnameW, WCHAR* assemblies_path, int
 
         hr = IAssemblyCache_QueryAssemblyInfo(asmcache, 0, stringnameW, &info);
 
+        if (FAILED(hr))
+        {
+            WCHAR *ns;
+            static const WCHAR wszDLL[] = {'.','d','l','l',0};
+
+            GetModuleFileNameW(NULL, assemblies_path, MAX_PATH);
+            ns = strrchrW(assemblies_path, '\\');
+            *(ns+1) = '\0';
+
+            /* Assume the namespace is the Assembly name */
+            ns = strchrW(stringnameW, ',');
+            *(ns) = '\0';
+            strcatW(assemblies_path, stringnameW);
+            *(ns) = '.';
+            strcatW(assemblies_path, wszDLL);
+
+            if(PathFileExistsW(assemblies_path))
+            {
+                WARN("Attempt to load from the application directory.");
+                hr = S_OK;
+            }
+        }
+
         IAssemblyCache_Release(asmcache);
     }
 
-- 
1.8.1.2



More information about the wine-patches mailing list