Alexandre Julliard : mountmgr.sys: Avoid using wine_get_config_dir().

Alexandre Julliard julliard at winehq.org
Fri Apr 17 16:12:56 CDT 2020


Module: wine
Branch: master
Commit: 77bb698b325045d6d96b7e78a57e4aeb12dc5d14
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=77bb698b325045d6d96b7e78a57e4aeb12dc5d14

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr 17 13:18:55 2020 +0200

mountmgr.sys: Avoid using wine_get_config_dir().

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/mountmgr.sys/device.c | 29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index f68ab4de9b..a6794fa6ac 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -38,7 +38,6 @@
 #include "winuser.h"
 #include "dbt.h"
 
-#include "wine/library.h"
 #include "wine/list.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"
@@ -131,12 +130,19 @@ static CRITICAL_SECTION device_section = { &critsect_debug, -1, 0, 0, 0, 0 };
 
 static char *get_dosdevices_path( char **device )
 {
-    const char *config_dir = wine_get_config_dir();
-    size_t len = strlen(config_dir) + sizeof("/dosdevices/com256");
+    const char *home = getenv( "HOME" );
+    const char *prefix = getenv( "WINEPREFIX" );
+    size_t len = (prefix ? strlen(prefix) : strlen(home) + strlen("/.wine")) + sizeof("/dosdevices/com256");
     char *path = HeapAlloc( GetProcessHeap(), 0, len );
+
     if (path)
     {
-        strcpy( path, config_dir );
+        if (prefix) strcpy( path, prefix );
+        else
+        {
+            strcpy( path, home );
+            strcat( path, "/.wine" );
+        }
         strcat( path, "/dosdevices/a::" );
         *device = path + len - sizeof("com256");
     }
@@ -254,13 +260,20 @@ static int open_volume_file( const struct volume *volume, const char *file )
     }
     else
     {
-        const char *config_dir = wine_get_config_dir();
+        const char *home = getenv( "HOME" );
+        const char *prefix = getenv( "WINEPREFIX" );
+        size_t len = prefix ? strlen(prefix) : strlen(home) + strlen("/.wine");
 
-        if (!(path = HeapAlloc( GetProcessHeap(), 0, strlen( config_dir )
-                + strlen("/dosdevices/") + strlen(unix_mount) + 1 + strlen( file ) + 1 )))
+        if (!(path = HeapAlloc( GetProcessHeap(), 0, len + strlen("/dosdevices/") +
+                                strlen(unix_mount) + 1 + strlen( file ) + 1 )))
             return -1;
 
-        strcpy( path, config_dir );
+        if (prefix) strcpy( path, prefix );
+        else
+        {
+            strcpy( path, home );
+            strcat( path, "/.wine" );
+        }
         strcat( path, "/dosdevices/" );
         strcat( path, unix_mount );
     }




More information about the wine-cvs mailing list