server: Create the windows directories at startup if necessary.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-02-12 20:20:33 +01:00
parent c0f693f6fc
commit 156965eae9
2 changed files with 8 additions and 12 deletions

View file

@ -1125,28 +1125,16 @@ done:
/***********************************************************************
* init_windows_dirs
*
* Create the windows and system directories if necessary.
*/
static void init_windows_dirs(void)
{
static const WCHAR default_syswow64W[] = {'C',':','\\','w','i','n','d','o','w','s',
'\\','s','y','s','w','o','w','6','4',0};
if (!CreateDirectoryW( DIR_Windows, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
ERR( "directory %s could not be created, error %u\n",
debugstr_w(DIR_Windows), GetLastError() );
if (!CreateDirectoryW( DIR_System, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
ERR( "directory %s could not be created, error %u\n",
debugstr_w(DIR_System), GetLastError() );
if (is_win64 || is_wow64) /* SysWow64 is always defined on 64-bit */
{
DIR_SysWow64 = default_syswow64W;
memcpy( winevdm, default_syswow64W, sizeof(default_syswow64W) - sizeof(WCHAR) );
if (!CreateDirectoryW( DIR_SysWow64, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS)
ERR( "directory %s could not be created, error %u\n",
debugstr_w(DIR_SysWow64), GetLastError() );
}
}

View file

@ -1866,6 +1866,14 @@ void init_registry(void)
/* start the periodic save timer */
set_periodic_save_timer();
/* create windows directories */
if (!mkdir( "drive_c/windows", 0777 ))
{
mkdir( "drive_c/windows/system32", 0777 );
if (prefix_type == PREFIX_64BIT) mkdir( "drive_c/windows/syswow64", 0777 );
}
/* go back to the server dir */
if (fchdir( server_dir_fd ) == -1) fatal_error( "chdir to server dir: %s\n", strerror( errno ));
}