[DUG] Help Detecting Windows Version

Alan Rose Alan.Rose at trimble.co.nz
Mon Dec 13 14:29:58 NZDT 2010


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-bounces at delphi.org.nz 
> [mailto:delphi-bounces at 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-bounces at delphi.org.nz 
> [mailto:delphi-bounces at 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 at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz 
> with Subject:
> unsubscribe
> 
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz 
> with Subject: unsubscribe
> 



More information about the Delphi mailing list