Alexandre Julliard : ntdll: Fetch the windows directory from the shared user data.
Alexandre Julliard
julliard at winehq.org
Thu Jun 16 14:28:48 CDT 2011
Module: wine
Branch: master
Commit: f4024eaa49bfd6ecbbd96ae4deb97efa3691754f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f4024eaa49bfd6ecbbd96ae4deb97efa3691754f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jun 16 12:27:01 2011 +0200
ntdll: Fetch the windows directory from the shared user data.
---
dlls/ntdll/actctx.c | 8 +++++---
dlls/ntdll/directory.c | 9 ++++-----
dlls/ntdll/loader.c | 10 +++++-----
dlls/ntdll/ntdll_misc.h | 1 -
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index a1b1e3b..80f69a8 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -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 ))
{
diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c
index b57741a..42b3639 100644
--- a/dlls/ntdll/directory.c
+++ b/dlls/ntdll/directory.c
@@ -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
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index 4c8d727..5ee7d0a 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 77f8603..4956537 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -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);
More information about the wine-cvs
mailing list