Commit 747d58d2 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add management of the Wow64 filesystem redirection flag.

parent 4f8ce1b2
......@@ -2130,6 +2130,29 @@ done:
/******************************************************************
* RtlWow64EnableFsRedirection (NTDLL.@)
*/
NTSTATUS WINAPI RtlWow64EnableFsRedirection( BOOLEAN enable )
{
if (!is_wow64) return STATUS_NOT_IMPLEMENTED;
ntdll_get_thread_data()->wow64_redir = enable;
return STATUS_SUCCESS;
}
/******************************************************************
* RtlWow64EnableFsRedirectionEx (NTDLL.@)
*/
NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx( ULONG enable, ULONG *old_value )
{
if (!is_wow64) return STATUS_NOT_IMPLEMENTED;
*old_value = ntdll_get_thread_data()->wow64_redir;
ntdll_get_thread_data()->wow64_redir = enable;
return STATUS_SUCCESS;
}
/******************************************************************
* RtlDoesFileExists_U (NTDLL.@)
*/
BOOLEAN WINAPI RtlDoesFileExists_U(LPCWSTR file_name)
......
......@@ -913,6 +913,8 @@
@ stdcall -arch=x86_64 RtlVirtualUnwind(long long long ptr ptr ptr ptr ptr)
@ stub RtlWalkFrameChain
@ stdcall RtlWalkHeap(long ptr)
@ stdcall RtlWow64EnableFsRedirection(long)
@ stdcall RtlWow64EnableFsRedirectionEx(long ptr)
@ stub RtlWriteMemoryStream
@ stdcall RtlWriteRegistryValue(long ptr ptr long ptr long)
@ stub RtlZeroHeap
......
......@@ -71,7 +71,7 @@ extern void virtual_init_threading(void);
/* server support */
extern timeout_t server_start_time;
extern unsigned int server_cpus;
extern int is_wow64;
extern void server_init_process(void);
extern NTSTATUS server_init_process_done(void);
extern size_t server_init_thread( void *entry_point );
......@@ -198,8 +198,9 @@ struct ntdll_thread_data
int request_fd; /* 1e0/310 fd for sending server requests */
int reply_fd; /* 1e4/314 fd for receiving server replies */
int wait_fd[2]; /* 1e8/318 fd for sleeping server requests */
void *vm86_ptr; /* 1f0/320 data for vm86 mode */
pthread_t pthread_id; /* 1f4/328 pthread thread id */
BOOL wow64_redir; /* 1f0/320 Wow64 filesystem redirection flag */
void *vm86_ptr; /* 1f4/328 data for vm86 mode */
pthread_t pthread_id; /* 1f8/330 pthread thread id */
};
static inline struct ntdll_thread_data *ntdll_get_thread_data(void)
......
......@@ -307,11 +307,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
case ProcessWow64Information:
if (ProcessInformationLength == sizeof(DWORD))
{
#ifdef __i386__
*(DWORD *)ProcessInformation = (server_cpus & (1 << CPU_x86_64)) != 0;
#else
*(DWORD *)ProcessInformation = FALSE;
#endif
*(DWORD *)ProcessInformation = is_wow64;
len = sizeof(DWORD);
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
......
......@@ -94,7 +94,8 @@ static const enum cpu_type client_cpu = CPU_SPARC;
#error Unsupported CPU
#endif
unsigned int server_cpus = 0;
static unsigned int server_cpus;
int is_wow64 = FALSE;
#ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
/* data structure used to pass an fd with sendmsg/recvmsg */
......@@ -1081,6 +1082,11 @@ size_t server_init_thread( void *entry_point )
}
SERVER_END_REQ;
#ifndef _WIN64
is_wow64 = (server_cpus & (1 << CPU_x86_64)) != 0;
#endif
ntdll_get_thread_data()->wow64_redir = is_wow64;
if (ret)
{
if (ret == STATUS_NOT_SUPPORTED)
......
......@@ -2512,6 +2512,8 @@ NTSYSAPI BOOLEAN WINAPI RtlValidSid(PSID);
NTSYSAPI BOOLEAN WINAPI RtlValidateHeap(HANDLE,ULONG,LPCVOID);
NTSYSAPI NTSTATUS WINAPI RtlVerifyVersionInfo(const RTL_OSVERSIONINFOEXW*,DWORD,DWORDLONG);
NTSYSAPI NTSTATUS WINAPI RtlWalkHeap(HANDLE,PVOID);
NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirection(BOOLEAN);
NTSYSAPI NTSTATUS WINAPI RtlWow64EnableFsRedirectionEx(ULONG,ULONG*);
NTSYSAPI NTSTATUS WINAPI RtlWriteRegistryValue(ULONG,PCWSTR,PCWSTR,ULONG,PVOID,ULONG);
NTSYSAPI NTSTATUS WINAPI RtlpNtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULONG,const UNICODE_STRING*,ULONG,PULONG);
NTSYSAPI NTSTATUS WINAPI RtlpNtEnumerateSubKey(HANDLE,UNICODE_STRING *, ULONG);
......
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