Alexandre Julliard : ntdll: Set the WOW64 flag according to the server supported CPUs.

Alexandre Julliard julliard at winehq.org
Fri Apr 3 10:28:42 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr  3 17:05:29 2009 +0200

ntdll: Set the WOW64 flag according to the server supported CPUs.

---

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

diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 75e60ef..542607a 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -66,6 +66,7 @@ extern void virtual_init_threading(void);
 
 /* server support */
 extern timeout_t server_start_time;
+extern unsigned int server_cpus;
 extern void server_init_process(void);
 extern NTSTATUS server_init_process_done(void);
 extern size_t server_init_thread( void *entry_point );
diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c
index 76c8410..c129e0a 100644
--- a/dlls/ntdll/process.c
+++ b/dlls/ntdll/process.c
@@ -305,10 +305,14 @@ NTSTATUS WINAPI NtQueryInformationProcess(
          else ret = STATUS_INFO_LENGTH_MISMATCH;
          break;
     case ProcessWow64Information:
-        if (ProcessInformationLength == 4)
+        if (ProcessInformationLength == sizeof(DWORD))
         {
-            memset(ProcessInformation, 0, ProcessInformationLength);
-            len = 4;
+#ifdef __i386__
+            *(DWORD *)ProcessInformation = (server_cpus & (1 << CPU_x86_64)) != 0;
+#else
+            *(DWORD *)ProcessInformation = FALSE;
+#endif
+            len = sizeof(DWORD);
         }
         else ret = STATUS_INFO_LENGTH_MISMATCH;
         break;
diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c
index 8571325..a7bc493 100644
--- a/dlls/ntdll/server.c
+++ b/dlls/ntdll/server.c
@@ -90,6 +90,8 @@ static const enum cpu_type client_cpu = CPU_SPARC;
 #error Unsupported CPU
 #endif
 
+unsigned int server_cpus = 0;
+
 #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS
 /* data structure used to pass an fd with sendmsg/recvmsg */
 struct cmsg_fd
@@ -1050,6 +1052,7 @@ size_t server_init_thread( void *entry_point )
         NtCurrentTeb()->ClientId.UniqueThread  = ULongToHandle(reply->tid);
         info_size         = reply->info_size;
         server_start_time = reply->server_start;
+        server_cpus       = reply->all_cpus;
     }
     SERVER_END_REQ;
 




More information about the wine-cvs mailing list