* autoload.cc (IsWow64Process): Remove.

(Wow64DisableWow64FsRedirection): Remove.
	(Wow64RevertWow64FsRedirection): Remove.
	* ntdll.h (enum _PROCESSINFOCLASS): Define ProcessWow64Information.
	* init.cc (respawn_wow64_process): Use NtQueryInformationProcess to
	get WOW64 state.
	* wincap.cc (wincapc::init): Ditto.
	* wincap.h (wincapc::wow64): Change type to ULONG.
This commit is contained in:
Corinna Vinschen 2008-04-28 08:47:06 +00:00
parent 533ce3fb55
commit aacf1864d8
6 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,14 @@
2008-04-28 Corinna Vinschen <corinna@vinschen.de>
* autoload.cc (IsWow64Process): Remove.
(Wow64DisableWow64FsRedirection): Remove.
(Wow64RevertWow64FsRedirection): Remove.
* ntdll.h (enum _PROCESSINFOCLASS): Define ProcessWow64Information.
* init.cc (respawn_wow64_process): Use NtQueryInformationProcess to
get WOW64 state.
* wincap.cc (wincapc::init): Ditto.
* wincap.h (wincapc::wow64): Change type to ULONG.
2008-04-27 Corinna Vinschen <corinna@vinschen.de> 2008-04-27 Corinna Vinschen <corinna@vinschen.de>
* wincap.h (wincapc::wow64): Change type to BOOL. * wincap.h (wincapc::wow64): Change type to BOOL.

View File

@ -402,9 +402,6 @@ LoadDLLfuncEx (FindNextVolumeA, 12, kernel32, 1)
LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1) LoadDLLfuncEx (FindVolumeClose, 4, kernel32, 1)
LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1) LoadDLLfuncEx (GetConsoleWindow, 0, kernel32, 1)
LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1) LoadDLLfuncEx (GetVolumeNameForVolumeMountPointA, 12, kernel32, 1)
LoadDLLfuncEx (IsWow64Process, 8, kernel32, 1);
LoadDLLfuncEx (Wow64DisableWow64FsRedirection, 4, kernel32, 1)
LoadDLLfuncEx (Wow64RevertWow64FsRedirection, 4, kernel32, 1)
LoadDLLfunc (SHGetDesktopFolder, 4, shell32) LoadDLLfunc (SHGetDesktopFolder, 4, shell32)

View File

@ -71,25 +71,25 @@ respawn_wow64_process ()
PROCESS_BASIC_INFORMATION pbi; PROCESS_BASIC_INFORMATION pbi;
HANDLE parent; HANDLE parent;
BOOL is_wow64_proc = TRUE; /* Opt on the safe side. */ ULONG wow64 = TRUE; /* Opt on the safe side. */
/* Unfortunately there's no simpler way to retrieve the /* Unfortunately there's no simpler way to retrieve the
parent process in NT, as far as I know. Hints welcome. */ parent process in NT, as far as I know. Hints welcome. */
ret = NtQueryInformationProcess (GetCurrentProcess (), ret = NtQueryInformationProcess (GetCurrentProcess (),
ProcessBasicInformation, ProcessBasicInformation,
(PVOID) &pbi, &pbi, sizeof pbi, NULL);
sizeof pbi, NULL); if (NT_SUCCESS (ret)
if (ret == STATUS_SUCCESS
&& (parent = OpenProcess (PROCESS_QUERY_INFORMATION, && (parent = OpenProcess (PROCESS_QUERY_INFORMATION,
FALSE, FALSE,
pbi.InheritedFromUniqueProcessId))) pbi.InheritedFromUniqueProcessId)))
{ {
IsWow64Process (parent, &is_wow64_proc); NtQueryInformationProcess (parent, ProcessWow64Information,
&wow64, sizeof wow64, NULL);
CloseHandle (parent); CloseHandle (parent);
} }
/* The parent is a real 64 bit process? Respawn! */ /* The parent is a real 64 bit process? Respawn! */
if (!is_wow64_proc) if (!wow64)
{ {
PROCESS_INFORMATION pi; PROCESS_INFORMATION pi;
STARTUPINFOW si; STARTUPINFOW si;

View File

@ -464,6 +464,7 @@ typedef enum _PROCESSINFOCLASS
ProcessVmCounters = 3, ProcessVmCounters = 3,
ProcessTimes = 4, ProcessTimes = 4,
ProcessSessionInformation = 24, ProcessSessionInformation = 24,
ProcessWow64Information = 26,
} PROCESSINFOCLASS; } PROCESSINFOCLASS;
typedef struct _DEBUG_BUFFER typedef struct _DEBUG_BUFFER

View File

@ -11,6 +11,7 @@ details. */
#include "winsup.h" #include "winsup.h"
#include "security.h" #include "security.h"
#include "ntdll.h"
/* Minimal set of capabilities which is equivalent to NT4. */ /* Minimal set of capabilities which is equivalent to NT4. */
static NO_COPY wincaps wincap_unknown = { static NO_COPY wincaps wincap_unknown = {
@ -394,7 +395,10 @@ wincapc::init ()
if (has_osversioninfoex && version.wProductType != VER_NT_WORKSTATION) if (has_osversioninfoex && version.wProductType != VER_NT_WORKSTATION)
((wincaps *)caps)->is_server = true; ((wincaps *)caps)->is_server = true;
if (IsWow64Process (GetCurrentProcess (), &wow64) && !wow64) if (NT_SUCCESS (NtQueryInformationProcess (GetCurrentProcess (),
ProcessWow64Information,
&wow64, sizeof wow64, NULL))
&& !wow64)
{ {
((wincaps *)caps)->needs_count_in_si_lpres2 = false; ((wincaps *)caps)->needs_count_in_si_lpres2 = false;
((wincaps *)caps)->has_restricted_stack_args = false; ((wincaps *)caps)->has_restricted_stack_args = false;

View File

@ -46,7 +46,7 @@ class wincapc
{ {
OSVERSIONINFOEX version; OSVERSIONINFOEX version;
char osnam[40]; char osnam[40];
BOOL wow64; ULONG wow64;
void *caps; void *caps;
public: public: