Checking for a Windows 64-bit

Re: Checking for a Windows 64-bit

Postby hua » Wed Aug 18, 2010 2:27 am

StefanHaupt wrote:Daniel,

maybe the name of the function is a little bit confusing. The other funcions (IsWinXP(),...) are returning the version of the OS, so I think it would be clearer if IsWin64() would return the type of the OS (.f. for 32bit and .t. for a 64bit OS).

I suggest IsWin64() for the OS and IsWow64() for the application. IsWin64() should return .t. if a 64bit OS is running, IsWow64() should return .t. if a 32bit app is running under 64bit.


+1

I think it's more intuitive and in line with the rest of IsWin...() functions.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Checking for a Windows 64-bit

Postby Daniel Garcia-Gil » Wed Aug 18, 2010 3:51 am

hua, stefan

we can not change IsWin64() functionality, maybe other user use this function, we could break compatibility.

yes the function is not intuitive, but return a correct value ( .T. in applications built under 64 and .F. in applications built under 32 )

Daniel Garcia-Gil wrote:Stefan...

the return value is correct in both case
the point is call IsWin64 in 32 bit program (built) never shall return .T. because run in emulation mode (WOW64) under 64 bit OS, this emulation is 32bits
like say : http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx
IsWow64 Determines whether the specified process is running under WOW64.
i mean, no verify OS verify emulation mode
so we need use IsWow64 in 32bit applications



to run 32 bits applications under 64bit, only is possible in emulation mode, we can not skip this "layer", only way is with new function IsWow64 (thanks to davide)
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Checking for a Windows 64-bit

Postby Davide » Wed Aug 18, 2010 10:14 am

Daniel,
Daniel Garcia-Gil wrote:we can not change IsWin64() functionality, maybe other user use this function

you're right, but if someone did you use it as advertised in the Wiki (like I did), they've already found it doesn't work that way.

I would suggest:

1) Rename IsWin64() as IsMyPrg64()
(including all the calls to IsWin64() in the different sources, like rPreview.prg)
2) Function IsWin64() ; Return ( IsMyPrg64() .or. IsWow64() )

This way IsWin64() would really check the OS rather then the prg, either with FWH32 or with FWH64, without breaking backward compatibility for most of the FiveWin users, apart those that eventually did use it in their own prg's to check whether they were compiled under 32 or 64 bit (they would just have to rename IsWin64() as above however)

Alternatively, we can leave IsWin64() like it is now, but then the Wiki needs to be updated or more and more people will make the mistake to use it with FWH32 to check if the OS is 64bit or not.

Hi,
Davide
Davide
 
Posts: 190
Joined: Tue Mar 14, 2006 1:59 am
Location: Italy

Re: Checking for a Windows 64-bit

Postby StefanHaupt » Wed Aug 18, 2010 10:28 am

Daniel,

I think it's more intuitive and in line with the rest of IsWin...() functions.


That was my intention. Maybe changing the function could break compatibility with existing apps, but are there already 64bit apps ? I think, it´s not too late to change the function.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: Checking for a Windows 64-bit

Postby Daniel Garcia-Gil » Wed Aug 18, 2010 12:32 pm

Davide wrote:Alternatively, we can leave IsWin64() like it is now, but then the Wiki needs to be updated or more and more people will make the mistake to use it with FWH32 to check if the OS is 64bit or not.


http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_iswin64
The return section explain perfectly this point:
Returns
<lWin64> This function returns .t. if we are executing the application under Windows 64 bit
i will change IsWind64 section
already is:
IsWin64()
It checks if the version of Windows is 64 bit.
for this
it check if we are executing the application under Windows 64 bit
Remarks:
32 bis applications no run in 64 bit, these run under 32 bit emulation, for detect emulation mode use IsWow64

wiki for IsWow64() could be, it check if we are executing the application under 32 bit emulation
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Checking for a Windows 64-bit

Postby Daniel Garcia-Gil » Wed Aug 18, 2010 12:46 pm

Already changed wiki

http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_iswin64

http://wiki.fivetechsoft.com/doku.php?id=fivewin_function_iswow64

please any thing else or additional comment, please let us know, thanks by feedback
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 53 guests