Cygwin: wincap: drop wow64 flag and all conditions depending on it

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2022-03-07 10:31:15 +01:00
parent 0597c84b9b
commit 2610b681a4
6 changed files with 4 additions and 46 deletions

View File

@ -784,11 +784,7 @@ struct thread_info
char *fill_if_match (char *base, ULONG type, char *dest) char *fill_if_match (char *base, ULONG type, char *dest)
{ {
for (region *r = regions; r; r = r->next) for (region *r = regions; r; r = r->next)
if ((base >= r->start && base < r->end) if (base >= r->start && base < r->end)
/* Special case WOW64. The TEB is 8K within the region reserved
for it. No idea what the lower 8K are used for. */
|| (r->teb && wincap.is_wow64 ()
&& r->start == base + 2 * wincap.page_size ()))
{ {
char *p = dest + __small_sprintf (dest, "[%s (tid %ld)", char *p = dest + __small_sprintf (dest, "[%s (tid %ld)",
r->teb ? "teb" : "stack", r->teb ? "teb" : "stack",

View File

@ -3461,28 +3461,6 @@ restart:
differ, return the final path as symlink content and set symlen differ, return the final path as symlink content and set symlen
to a negative value. This forces path_conv::check to restart to a negative value. This forces path_conv::check to restart
symlink evaluation with the new path. */ symlink evaluation with the new path. */
#ifdef __i386__
/* On WOW64, ignore any potential problems if the path is inside
the Windows dir to avoid false positives for stuff under File
System Redirector control. Believe it or not, but even
GetFinalPathNameByHandleA returns the converted path for the
Sysnative dir. I. e.
C:\Windows\Sysnative --> C:\Windows\System32
This is obviously wrong when using this path for further
file manipulation because the non-final path points to another
file than the final path. Oh well... */
if (!fs.is_remote_drive () && wincap.is_wow64 ())
{
/* windows_directory_path is stored without trailing backslash,
so we have to check this explicitely. */
if (RtlEqualUnicodePathPrefix (&upath, &windows_directory_path, TRUE)
&& upath.Buffer[windows_directory_path.Length / sizeof (WCHAR)]
== L'\\')
goto file_not_symlink;
}
#endif /* __i386__ */
if ((pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW) if ((pc_flags & (PC_SYM_FOLLOW | PC_SYM_NOFOLLOW_REP)) == PC_SYM_FOLLOW)
{ {
PWCHAR fpbuf = tp.w_get (); PWCHAR fpbuf = tp.w_get ();

View File

@ -4417,8 +4417,7 @@ gethostid (void)
int32_t hostid = 0x40291372; /* Choose a nice start value */ int32_t hostid = 0x40291372; /* Choose a nice start value */
WCHAR wguid[38]; WCHAR wguid[38];
reg_key key (HKEY_LOCAL_MACHINE, reg_key key (HKEY_LOCAL_MACHINE, KEY_READ,
KEY_READ | (wincap.is_wow64() ? KEY_WOW64_64KEY : 0),
L"SOFTWARE", L"Microsoft", L"Cryptography", NULL); L"SOFTWARE", L"Microsoft", L"Cryptography", NULL);
key.get_string (L"MachineGuid", wguid, 38, key.get_string (L"MachineGuid", wguid, 38,
L"00000000-0000-0000-0000-000000000000"); L"00000000-0000-0000-0000-000000000000");

View File

@ -36,9 +36,8 @@ uname_x (struct utsname *name)
memset (name, 0, sizeof (*name)); memset (name, 0, sizeof (*name));
/* sysname */ /* sysname */
__small_sprintf (name->sysname, "CYGWIN_%s-%u%s", __small_sprintf (name->sysname, "CYGWIN_%s-%u",
wincap.osname (), wincap.build_number (), wincap.osname (), wincap.build_number ());
wincap.is_wow64 () ? "-WOW64" : "");
/* nodename */ /* nodename */
memset (buf, 0, sizeof buf); memset (buf, 0, sizeof buf);
cygwin_gethostname (buf, sizeof buf - 1); cygwin_gethostname (buf, sizeof buf - 1);
@ -100,12 +99,6 @@ uname (struct utsname *in_name)
memset (name, 0, sizeof (*name)); memset (name, 0, sizeof (*name));
__small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ()); __small_sprintf (name->sysname, "CYGWIN_%s", wincap.osname ());
/* Add a hint to the sysname, that we're running under WOW64. This might
give an early clue if somebody encounters problems. */
if (wincap.is_wow64 ())
strncat (name->sysname, "-WOW",
sizeof name->sysname - strlen (name->sysname) - 1);
/* Computer name */ /* Computer name */
cygwin_gethostname (name->nodename, sizeof (name->nodename) - 1); cygwin_gethostname (name->nodename, sizeof (name->nodename) - 1);

View File

@ -461,14 +461,8 @@ wincapc::init ()
((wincaps *)caps)->is_server = (version.wProductType != VER_NT_WORKSTATION); ((wincaps *)caps)->is_server = (version.wProductType != VER_NT_WORKSTATION);
#ifdef __x86_64__ #ifdef __x86_64__
wow64 = 0;
/* 64 bit systems have one more guard page than their 32 bit counterpart. */ /* 64 bit systems have one more guard page than their 32 bit counterpart. */
++((wincaps *)caps)->def_guard_pages; ++((wincaps *)caps)->def_guard_pages;
#else
if (NT_SUCCESS (NtQueryInformationProcess (NtCurrentProcess (),
ProcessWow64Information,
&wow64, sizeof wow64, NULL))
&& !wow64)
#endif #endif
{ {
((wincaps *)caps)->has_gaa_largeaddress_bug = false; ((wincaps *)caps)->has_gaa_largeaddress_bug = false;

View File

@ -49,7 +49,6 @@ class wincapc
SYSTEM_INFO system_info; SYSTEM_INFO system_info;
RTL_OSVERSIONINFOEXW version; RTL_OSVERSIONINFOEXW version;
char osnam[40]; char osnam[40];
ULONG_PTR wow64;
void *caps; void *caps;
public: public:
@ -69,7 +68,6 @@ public:
{ return (size_t) system_info.dwAllocationGranularity; } { return (size_t) system_info.dwAllocationGranularity; }
const char *osname () const { return osnam; } const char *osname () const { return osnam; }
const DWORD build_number () const { return version.dwBuildNumber; } const DWORD build_number () const { return version.dwBuildNumber; }
const bool is_wow64 () const { return !!wow64; }
#define IMPLEMENT(cap) cap() const { return ((wincaps *) this->caps)->cap; } #define IMPLEMENT(cap) cap() const { return ((wincaps *) this->caps)->cap; }