From: Erik B. <eb...@us...> - 2007-02-26 06:18:57
|
Update of /cvsroot/gexperts/gexperts/unstable/Src/Utils In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv10047/Src/Utils Modified Files: GX_GenericUtils.pas Log Message: Detect XP64 and Longhorn Index: GX_GenericUtils.pas =================================================================== RCS file: /cvsroot/gexperts/gexperts/unstable/Src/Utils/GX_GenericUtils.pas,v retrieving revision 1.151 retrieving revision 1.152 diff -u -d -r1.151 -r1.152 --- GX_GenericUtils.pas 16 Oct 2006 06:56:59 -0000 1.151 +++ GX_GenericUtils.pas 26 Feb 2007 06:18:49 -0000 1.152 @@ -50,6 +50,20 @@ ); end; + TOSVersionInfoExA = packed record + dwOSVersionInfoSize: DWORD; + dwMajorVersion: DWORD; + dwMinorVersion: DWORD; + dwBuildNumber: DWORD; + dwPlatformId: DWORD; + szCSDVersion: array[0..127] of AnsiChar; + wServicePackMajor: WORD; + wServicePackMinor: WORD; + wSuiteMask: WORD; + wProductType: Byte; + wReserved: Byte; + end; + EVersionInfoNotFound = class(Exception); TListBoxCheckAction = (chAll, chNone, chInvert); @@ -2622,14 +2636,29 @@ {$ENDIF LINUX} {$IFDEF MSWINDOWS} +function GetVersionExA(lpVersionInformation: Pointer): BOOL; stdcall; + external kernel32 name 'GetVersionExA'; + function GetOSString: string; +const + VER_NT_WORKSTATION = $01; var OSPlatform: string; BuildNumber: Integer; + SysInfo: TSystemInfo; + VerInfoEx: TOSVersionInfoExA; begin Result := 'Unknown Windows Version'; OSPlatform := 'Windows'; BuildNumber := 0; + ZeroMemory(@SysInfo, SizeOf(SysInfo)); + GetSystemInfo(SysInfo); + + ZeroMemory(@VerInfoEx, SizeOf(VerInfoEx)); + VerInfoEx.dwOSVersionInfoSize := SizeOf(TOSVersionInfoA); + if not GetVersionExA(@VerInfoEx) then + VerInfoEx.dwOSVersionInfoSize := 0; + case Win32Platform of VER_PLATFORM_WIN32_WINDOWS: begin @@ -2662,11 +2691,19 @@ case Win32MinorVersion of 0: OSPlatform := 'Windows 2000'; 1: OSPlatform := 'Windows XP'; - 2: OSPlatform := 'Windows Server 2003'; + 2: begin + OSPlatform := 'Windows XP64'; + if (VerInfoEx.dwOSVersionInfoSize > 0) and (VerInfoEx.wProductType <> VER_NT_WORKSTATION) then + OSPlatform := 'Windows Server 2003'; + end; end; end else if Win32MajorVersion = 6 then + begin OSPlatform := 'Windows Vista'; + if (VerInfoEx.dwOSVersionInfoSize > 0) and (VerInfoEx.wProductType <> VER_NT_WORKSTATION) then + OSPlatform := 'Windows Server Longhorn'; + end; BuildNumber := Win32BuildNumber; end; VER_PLATFORM_WIN32s: |