Incorrect use of IsWow64Process in Cygwin sources

Cesar Strauss cestrauss@gmail.com
Sun Apr 27 18:18:00 GMT 2008


Please consider the following snippet from src/winsup/cygwin/wincap.cc
(wincapc::init):

   BOOL is_wow64_proc = FALSE;
   if (IsWow64Process (GetCurrentProcess (), &is_wow64_proc))
     wow64 = is_wow64_proc;
   else
     {
       ((wincaps *)this->caps)->needs_count_in_si_lpres2 = false;
       ((wincaps *)this->caps)->has_restricted_stack_args = false;
     }

If I understood correctly, the "else" block is meant to be executed on 
32 bit systems, so that those flags are reset on Vista 32.

But you are testing the return value of IsWow64Process, which is only an 
indication that the function succeeded. For instance, it always returns 
true on my 32 bit system (Windows XP Home Edition). The correct return 
value is in the is_wow64_proc flag, you should use it.

The relevant MSDN page documenting IsWow64Process is:
http://msdn2.microsoft.com/en-us/library/ms684139(VS.85).aspx

Regards,
Cesar


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list