winevdm: Avoid using wine_get_config_dir().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-04-17 12:50:23 +02:00
parent 43e80d235e
commit a094f5173a
1 changed files with 12 additions and 6 deletions

View File

@ -31,7 +31,6 @@
#include "winuser.h"
#include "wincon.h"
#include "wine/unicode.h"
#include "wine/library.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winevdm);
@ -150,11 +149,12 @@ static char *find_dosbox(void)
static void start_dosbox( const char *appname, const char *args )
{
static const WCHAR cfgW[] = {'c','f','g',0};
const char *config_dir = wine_get_config_dir();
const char *home = getenv( "HOME" );
const char *prefix = getenv( "WINEPREFIX" );
WCHAR path[MAX_PATH], config[MAX_PATH];
HANDLE file;
char *p, *buffer, app[MAX_PATH];
int i;
int i, len;
int ret = 1;
DWORD written, drives = GetLogicalDrives();
char *dosbox = find_dosbox();
@ -168,9 +168,10 @@ static void start_dosbox( const char *appname, const char *args )
file = CreateFileW( config, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0 );
if (file == INVALID_HANDLE_VALUE) return;
len = prefix ? strlen(prefix) : strlen(home) + strlen("/.wine");
buffer = HeapAlloc( GetProcessHeap(), 0, sizeof("[autoexec]") +
sizeof("mount -z c") + sizeof("config -securemode") +
25 * (strlen(config_dir) + sizeof("mount c /dosdevices/c:")) +
25 * (len + sizeof("mount c /dosdevices/c:")) +
4 * strlenW( path ) +
6 + strlen( app ) + strlen( args ) + 20 );
p = buffer;
@ -182,8 +183,13 @@ static void start_dosbox( const char *appname, const char *args )
break;
}
for (i = 0; i <= 25; i++)
if (drives & (1 << i))
p += sprintf( p, "mount %c %s/dosdevices/%c:\n", 'a' + i, config_dir, 'a' + i );
{
if (!(drives & (1 << i))) continue;
if (prefix)
p += sprintf( p, "mount %c %s/dosdevices/%c:\n", 'a' + i, prefix, 'a' + i );
else
p += sprintf( p, "mount %c %s/.wine/dosdevices/%c:\n", 'a' + i, home, 'a' + i );
}
p += sprintf( p, "%c:\ncd ", path[0] );
p += WideCharToMultiByte( CP_UNIXCP, 0, path + 2, -1, p, 4 * strlenW(path), NULL, NULL ) - 1;
p += sprintf( p, "\nconfig -securemode\n" );