Commit d5400af7 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32: Set environment variables for the various Wine paths.

parent 201d13a3
......@@ -676,6 +676,23 @@ static WCHAR *get_reg_value( HKEY hkey, const WCHAR *name )
return ret;
}
/* set an environment variable for one of the wine path variables */
static void set_wine_path_variable( const WCHAR *name, const char *unix_path )
{
UNICODE_STRING nt_name, var_name;
ANSI_STRING unix_name;
RtlInitUnicodeString( &var_name, name );
if (unix_path)
{
RtlInitAnsiString( &unix_name, unix_path );
if (wine_unix_to_nt_file_name( &unix_name, &nt_name )) return;
RtlSetEnvironmentVariable( NULL, &var_name, &nt_name );
RtlFreeUnicodeString( &nt_name );
}
else RtlSetEnvironmentVariable( NULL, &var_name, NULL );
}
/***********************************************************************
* set_additional_environment
......@@ -697,12 +714,31 @@ static void set_additional_environment(void)
static const WCHAR allusersW[] = {'A','L','L','U','S','E','R','S','P','R','O','F','I','L','E',0};
static const WCHAR programdataW[] = {'P','r','o','g','r','a','m','D','a','t','a',0};
static const WCHAR publicW[] = {'P','U','B','L','I','C',0};
static const WCHAR winedlldirW[] = {'W','I','N','E','D','L','L','D','I','R','%','u',0};
static const WCHAR winehomedirW[] = {'W','I','N','E','H','O','M','E','D','I','R',0};
static const WCHAR winedatadirW[] = {'W','I','N','E','D','A','T','A','D','I','R',0};
static const WCHAR winebuilddirW[] = {'W','I','N','E','B','U','I','L','D','D','I','R',0};
static const WCHAR wineconfigdirW[] = {'W','I','N','E','C','O','N','F','I','G','D','I','R',0};
OBJECT_ATTRIBUTES attr;
UNICODE_STRING nameW;
const char *path;
WCHAR *profile_dir = NULL, *program_data_dir = NULL, *public_dir = NULL;
WCHAR buf[MAX_COMPUTERNAME_LENGTH+1];
WCHAR buf[32];
HANDLE hkey;
DWORD len;
DWORD len, i;
/* wine paths */
set_wine_path_variable( winedatadirW, wine_get_data_dir() );
set_wine_path_variable( winehomedirW, getenv("HOME") );
set_wine_path_variable( winebuilddirW, wine_get_build_dir() );
set_wine_path_variable( wineconfigdirW, wine_get_config_dir() );
for (i = 0; (path = wine_dll_enum_load_path( i )); i++)
{
sprintfW( buf, winedlldirW, i );
set_wine_path_variable( buf, path );
}
sprintfW( buf, winedlldirW, i );
set_wine_path_variable( buf, NULL );
/* ComputerName */
len = ARRAY_SIZE( buf );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment