Alexandre Julliard : ntdll: Support querying the Wow64 state of other processes.

Alexandre Julliard julliard at winehq.org
Tue Jul 7 08:08:19 CDT 2009


Module: wine
Branch: master
Commit: 12c90b04dc3b95f5b15d4d64cd3ebaa1374f2f59
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=12c90b04dc3b95f5b15d4d64cd3ebaa1374f2f59

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Jul  7 11:38:19 2009 +0200

ntdll: Support querying the Wow64 state of other processes.

---

 dlls/ntdll/ntdll_misc.h |    1 +
 dlls/ntdll/process.c    |   14 +++++++++++++-
 dlls/ntdll/server.c     |    2 +-
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 3032553..ea2234a 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -71,6 +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);
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 9ec5513..6258569 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -307,7 +307,19 @@ NTSTATUS WINAPI NtQueryInformationProcess(
     case ProcessWow64Information:
         if (ProcessInformationLength == sizeof(DWORD))
         {
-            *(DWORD *)ProcessInformation = is_wow64;
+            DWORD val = 0;
+
+            if (ProcessHandle == GetCurrentProcess()) val = is_wow64;
+            else if (server_cpus & (1 << CPU_x86_64))
+            {
+                SERVER_START_REQ( get_process_info )
+                {
+                    req->handle = wine_server_obj_handle( ProcessHandle );
+                    if (!(ret = wine_server_call( req ))) val = (reply->cpu != CPU_x86_64);
+                }
+                SERVER_END_REQ;
+            }
+            *(DWORD *)ProcessInformation = val;
             len = sizeof(DWORD);
         }
         else ret = STATUS_INFO_LENGTH_MISMATCH;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index a4f2953..1eea402 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -94,7 +94,7 @@ static const enum cpu_type client_cpu = CPU_SPARC;
 #error Unsupported CPU
 #endif
 
-static unsigned int server_cpus;
+unsigned int server_cpus = 0;
 int is_wow64 = FALSE;
 
 #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS




More information about the wine-cvs mailing list