[PATCH] mscoree: Always base the config file path on the main exe.

Esme Povirk esme at codeweavers.com
Fri Aug 27 15:20:25 CDT 2021


Signed-off-by: Esme Povirk <esme at codeweavers.com>
---
I have a test in Wine Mono that verifies this behavior:
https://github.com/madewokherd/wine-mono/commit/ada970fb12cf739c4bb47df40507c0597b85a861

 dlls/mscoree/corruntimehost.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c
index 51522c57d83..d47492b7d4d 100644
--- a/dlls/mscoree/corruntimehost.c
+++ b/dlls/mscoree/corruntimehost.c
@@ -137,7 +137,7 @@ static void domain_restore(MonoDomain *prev_domain)
 
 static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *config_path, MonoDomain **result)
 {
-    WCHAR config_dir[MAX_PATH];
+    WCHAR exe_config[MAX_PATH];
     WCHAR base_dir[MAX_PATH];
     char *base_dirA, *config_pathA, *slash;
     HRESULT res=S_OK;
@@ -151,18 +151,10 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
 
     if (!config_path)
     {
-        DWORD len = ARRAY_SIZE(config_dir);
+        GetModuleFileNameW(NULL, exe_config, MAX_PATH);
+        lstrcatW(exe_config, L".config");
 
-        static const WCHAR machine_configW[] = {'\\','C','O','N','F','I','G','\\','m','a','c','h','i','n','e','.','c','o','n','f','i','g',0};
-
-        res = ICLRRuntimeInfo_GetRuntimeDirectory(&This->version->ICLRRuntimeInfo_iface,
-                config_dir, &len);
-        if (FAILED(res))
-            goto end;
-
-        lstrcatW(config_dir, machine_configW);
-
-        config_path = config_dir;
+        config_path = exe_config;
     }
 
     config_pathA = WtoA(config_path);
-- 
2.30.2




More information about the wine-devel mailing list