When creating volatile environment registry keys during first wineprefix creation, none of the user folders are existent. Create them before setting registry keys so that volatile environment gets initialized and corresponding environment variables such as %USERPROFILE% can be set. Otherwise, such environment variables are set only after another wineboot, causing applications to fail if they need them after first boot.
Signed-off-by: Zhiyi Zhang zzhang@codeweavers.com --- programs/wineboot/wineboot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 17ef9cbcca..075b4c8b08 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -385,14 +385,14 @@ static void create_volatile_environment_registry_key(void) KEY_ALL_ACCESS, NULL, &hkey, NULL )) return;
- hr = SHGetFolderPathW( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path ); + hr = SHGetFolderPathW( NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, path ); if (SUCCEEDED(hr)) set_reg_value( hkey, AppDataW, path );
set_reg_value( hkey, ClientNameW, ConsoleW );
/* Write the profile path's drive letter and directory components into * HOMEDRIVE and HOMEPATH respectively. */ - hr = SHGetFolderPathW( NULL, CSIDL_PROFILE, NULL, SHGFP_TYPE_CURRENT, path ); + hr = SHGetFolderPathW( NULL, CSIDL_PROFILE | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, path ); if (SUCCEEDED(hr)) { set_reg_value( hkey, UserProfileW, path ); @@ -406,7 +406,7 @@ static void create_volatile_environment_registry_key(void)
set_reg_value( hkey, HomeShareW, EmptyW );
- hr = SHGetFolderPathW( NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path ); + hr = SHGetFolderPathW( NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, SHGFP_TYPE_CURRENT, path ); if (SUCCEEDED(hr)) set_reg_value( hkey, LocalAppDataW, path );