From bbc03d5172d105f3ac5598bfdf02a2c04727b03d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 4 May 2010 20:26:53 +0200 Subject: [PATCH] server: Use the prefix architecture instead of the server one to check for WoW processes. --- server/process.h | 3 +++ server/registry.c | 7 +++++++ server/thread.c | 8 -------- server/thread.h | 1 - 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/server/process.h b/server/process.h index 87e12e0300a..cee7be93816 100644 --- a/server/process.h +++ b/server/process.h @@ -92,6 +92,9 @@ struct process_snapshot int handles; /* number of handles */ }; +#define CPU_FLAG(cpu) (1 << (cpu)) +#define CPU_64BIT_MASK CPU_FLAG(CPU_x86_64) + /* process functions */ extern unsigned int alloc_ptid( void *ptr ); diff --git a/server/registry.c b/server/registry.c index e5c0da496ee..7f782096449 100644 --- a/server/registry.c +++ b/server/registry.c @@ -43,6 +43,7 @@ #include "file.h" #include "handle.h" #include "request.h" +#include "process.h" #include "unicode.h" #include "security.h" @@ -1873,6 +1874,12 @@ void flush_registry(void) if (fchdir( server_dir_fd ) == -1) fatal_perror( "chdir to server dir" ); } +/* determine if the thread is wow64 (32-bit client running on 64-bit prefix) */ +static int is_wow64_thread( struct thread *thread ) +{ + return (prefix_type == PREFIX_64BIT && !(CPU_FLAG(thread->process->cpu) & CPU_64BIT_MASK)); +} + /* create a registry key */ DECL_HANDLER(create_key) diff --git a/server/thread.c b/server/thread.c index a6bc55ae83c..1c3e5bb6eed 100644 --- a/server/thread.c +++ b/server/thread.c @@ -53,7 +53,6 @@ #include "security.h" -#define CPU_FLAG(cpu) (1 << (cpu)) #ifdef __i386__ static const unsigned int supported_cpus = CPU_FLAG(CPU_x86); #elif defined(__x86_64__) @@ -67,7 +66,6 @@ static const unsigned int supported_cpus = CPU_FLAG(CPU_SPARC); #else #error Unsupported CPU #endif -#define CPU_64BIT_MASK CPU_FLAG(CPU_x86_64) /* thread queues */ @@ -409,12 +407,6 @@ struct thread *get_thread_from_pid( int pid ) return NULL; } -/* determine if the thread is wow64 (32-bit client running on 64-bit server) */ -int is_wow64_thread( struct thread *thread ) -{ - return (supported_cpus & CPU_64BIT_MASK) && !(CPU_FLAG(thread->process->cpu) & CPU_64BIT_MASK); -} - int set_thread_affinity( struct thread *thread, affinity_t affinity ) { int ret = 0; diff --git a/server/thread.h b/server/thread.h index 045a43ca66c..1e95732d3a0 100644 --- a/server/thread.h +++ b/server/thread.h @@ -118,7 +118,6 @@ extern int thread_add_inflight_fd( struct thread *thread, int client, int server extern int thread_get_inflight_fd( struct thread *thread, int client ); extern struct thread_snapshot *thread_snap( int *count ); extern struct token *thread_get_impersonation_token( struct thread *thread ); -extern int is_wow64_thread( struct thread *thread ); extern int set_thread_affinity( struct thread *thread, affinity_t affinity ); /* ptrace functions */ -- 2.11.4.GIT