Commit f4024eaa authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Fetch the windows directory from the shared user data.

parent 155e4fb6
......@@ -32,6 +32,7 @@
#include "ntstatus.h"
#define WIN32_NO_STATUS
#include "winternl.h"
#include "ddk/wdm.h"
#include "ntdll_misc.h"
#include "wine/exception.h"
#include "wine/debug.h"
......@@ -1877,11 +1878,12 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit
if (!ai->arch || !ai->name || !ai->public_key) return STATUS_NO_SUCH_FILE;
if (!(path = RtlAllocateHeap( GetProcessHeap(), 0, windows_dir.Length + sizeof(manifest_dirW) )))
if (!(path = RtlAllocateHeap( GetProcessHeap(), 0, sizeof(manifest_dirW) +
strlenW(user_shared_data->NtSystemRoot) * sizeof(WCHAR) )))
return STATUS_NO_MEMORY;
memcpy( path, windows_dir.Buffer, windows_dir.Length );
memcpy( path + windows_dir.Length/sizeof(WCHAR), manifest_dirW, sizeof(manifest_dirW) );
strcpyW( path, user_shared_data->NtSystemRoot );
memcpy( path + strlenW(path), manifest_dirW, sizeof(manifest_dirW) );
if (!RtlDosPathNameToNtPathName_U( path, &path_us, NULL, NULL ))
{
......
......@@ -77,6 +77,7 @@
#include "windef.h"
#include "winnt.h"
#include "winternl.h"
#include "ddk/wdm.h"
#include "ntdll_misc.h"
#include "wine/unicode.h"
#include "wine/server.h"
......@@ -161,7 +162,6 @@ static int show_dot_files = -1;
/* at some point we may want to allow Winelib apps to set this */
static const int is_case_sensitive = FALSE;
UNICODE_STRING windows_dir = { 0, 0, NULL }; /* windows directory */
UNICODE_STRING system_dir = { 0, 0, NULL }; /* system directory */
static struct file_identity curdir;
......@@ -2282,16 +2282,16 @@ static void init_redirects(void)
struct stat st;
unsigned int i;
if (!RtlDosPathNameToNtPathName_U( windows_dir.Buffer, &nt_name, NULL, NULL ))
if (!RtlDosPathNameToNtPathName_U( user_shared_data->NtSystemRoot, &nt_name, NULL, NULL ))
{
ERR( "can't convert %s\n", debugstr_us(&windows_dir) );
ERR( "can't convert %s\n", debugstr_w(user_shared_data->NtSystemRoot) );
return;
}
status = wine_nt_to_unix_file_name( &nt_name, &unix_name, FILE_OPEN_IF, FALSE );
RtlFreeUnicodeString( &nt_name );
if (status)
{
ERR( "cannot open %s (%x)\n", debugstr_us(&windows_dir), status );
ERR( "cannot open %s (%x)\n", debugstr_w(user_shared_data->NtSystemRoot), status );
return;
}
if (!stat( unix_name.Buffer, &st ))
......@@ -2389,7 +2389,6 @@ void DIR_init_windows_dir( const WCHAR *win, const WCHAR *sys )
{
/* FIXME: should probably store paths as NT file names */
RtlCreateUnicodeString( &windows_dir, win );
RtlCreateUnicodeString( &system_dir, sys );
#ifndef _WIN64
......
......@@ -1753,16 +1753,16 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
}
}
needed = (windows_dir.Length + sizeof(winsxsW) + info->ulAssemblyDirectoryNameLength +
nameW.Length + 2*sizeof(WCHAR));
needed = (strlenW(user_shared_data->NtSystemRoot) * sizeof(WCHAR) +
sizeof(winsxsW) + info->ulAssemblyDirectoryNameLength + nameW.Length + 2*sizeof(WCHAR));
if (!(*fullname = p = RtlAllocateHeap( GetProcessHeap(), 0, needed )))
{
status = STATUS_NO_MEMORY;
goto done;
}
memcpy( p, windows_dir.Buffer, windows_dir.Length );
p += windows_dir.Length / sizeof(WCHAR);
strcpyW( p, user_shared_data->NtSystemRoot );
p += strlenW(p);
memcpy( p, winsxsW, sizeof(winsxsW) );
p += sizeof(winsxsW) / sizeof(WCHAR);
memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
......@@ -2812,8 +2812,8 @@ void CDECL __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir )
PLIST_ENTRY mark, entry;
LPWSTR buffer, p;
DIR_init_windows_dir( windir, sysdir );
strcpyW( user_shared_data->NtSystemRoot, windir );
DIR_init_windows_dir( windir, sysdir );
/* prepend the system dir to the name of the already created modules */
mark = &NtCurrentTeb()->Peb->LdrData->InLoadOrderModuleList;
......
......@@ -107,7 +107,6 @@ extern FARPROC SNOOP_GetProcAddress( HMODULE hmod, const IMAGE_EXPORT_DIRECTORY
FARPROC origfun, DWORD ordinal, const WCHAR *user ) DECLSPEC_HIDDEN;
extern void RELAY_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
extern void SNOOP_SetupDLL( HMODULE hmod ) DECLSPEC_HIDDEN;
extern UNICODE_STRING windows_dir DECLSPEC_HIDDEN;
extern UNICODE_STRING system_dir DECLSPEC_HIDDEN;
typedef LONG (WINAPI *PUNHANDLED_EXCEPTION_FILTER)(PEXCEPTION_POINTERS);
......
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