Just for the benefit of those not reading the comments etc in the various articles and pages being posted, be aware that IsWOW64Process() will return FALSE for a 64-bit process running on a 64-bit OS, because it is not a WOW64 process, but a fully paid up 64-bit process!
IsWOW64Process is, as its name suggests, a way of detecting when a 32-bit process is running on 64-bit. It is not strictly speaking determining whether you are running on 64-bit Windows per se. Of course, should we ever get a 64-bit compiler, you can be pretty damned sure you are running on 64-bit Windows if/when you are compiling to a 64-bit target, so, for a 64-bitness check, if you don't want to bother with Get[Native]SystemInfo: class function TOSInfo.Is64Bit: Boolean begin {$if CompileTarget=WIN64} // Purely speculative on my part ... result := TRUE; {$else} result := IsWOW64; {$endif} end; Of course, this will fail if Microsoft ever come up with a way of running a 64-bit process on a 32-bit Windows OS (but if we were going to get a Win64(S), a la Win32(S), I imagine we would have seen it by now) -----Original Message----- From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On Behalf Of Alan Rose Sent: Monday, 13 December 2010 14:30 To: NZ Borland Developers Group - Delphi List Subject: Re: [DUG] Help Detecting Windows Version FWIW I found what I needed regarding 64 bit detection with this code I found online class function TOSInfo.IsWOW64: Boolean; type TIsWow64Process = function( Handle: THandle; var Res: BOOL ): BOOL; stdcall; var IsWow64Result: BOOL; IsWow64Process: TIsWow64Process; begin IsWow64Process := GetProcAddress( GetModuleHandle('kernel32'), 'IsWow64Process'); if Assigned(IsWow64Process) then begin if not IsWow64Process(GetCurrentProcess, IsWow64Result) then raise Exception.Create('Bad process handle'); Result := IsWow64Result; end else Result := False; end; PRODUCT TYPE The code to get the right product type (e.g diff between win7 and 2008) I found in this link http://code.google.com/p/sbd-utilities/source/browse/lowlevelutils/trunk /run/uSBD_OS_Version.pas?r=17 Be aware I did find some things in this link like detecting 64 bit and WMWare did not work, so just copy parts you need and test carefully. > -----Original Message----- > From: delphi-boun...@delphi.org.nz > [mailto:delphi-boun...@delphi.org.nz] On Behalf Of Jolyon Smith > Sent: Monday, 13 December 2010 2:09 p.m. > To: 'NZ Borland Developers Group - Delphi List' > Subject: Re: [DUG] Help Detecting Windows Version > > > ProgramFiles(x86) environment variable which is only set on 64 bit > > versions > > Only set **automatically by the OS**- there's presumably > nothing stopping someone from setting such an environment > variable for their own purposes should they choose so to do. > > Why would they? Who knows. But they *could*. Perhaps if > they wanted to fool an app that used a crude 64-bitness > detection algorithm into doing something it otherwise wouldn't... ;) > > > -----Original Message----- > From: delphi-boun...@delphi.org.nz > [mailto:delphi-boun...@delphi.org.nz] On Behalf Of John Bird > Sent: Monday, 13 December 2010 13:47 > To: NZ Borland Developers Group - Delphi List > Subject: Re: [DUG] Help Detecting Windows Version > > ?http://stackoverflow.com/questions/601089/detect-whether-curr > ent-windows-ve > rsion-is-32-bit-or-64-bit > > easiest way depends on whether Windows 7 or Server 2008, or older. > Simplest and most general over windows versions looks to be > There are more specific ways added for Windows 7/Vista/Server 2008. > > John > > Hi, has anyone got a function they can share that will detect > all current versions of Windows out there? > F.i. My old routine cant detect Windows Server 2008 64 bit > Tried googling but can only find outdated code like mine. > > > > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz > with Subject: > unsubscribe > > _______________________________________________ > NZ Borland Developers Group - Delphi mailing list > Post: delphi@delphi.org.nz > Admin: http://delphi.org.nz/mailman/listinfo/delphi > Unsubscribe: send an email to delphi-requ...@delphi.org.nz > with Subject: unsubscribe > _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe _______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe