Die function GetWindowsVersion4me(ShortInfo: Boolean): string;
liefert unter Win10 gerade:
"Windows 10 Pro Insider Preview (Version 6.3/Build 10162) 64-Bit"
und unter WinXP:
"Microsoft Windows XP (Version 5.1/Build 2600) 32-Bit"
aber
leider auch unter Wine:
"Microsoft Windows XP (Version 5.1/Build 2600) 32-Bit"
Stimmt ja alles soweit, nur würde ich gerne unterscheiden können, ob jemand ein "
uraltes" XP oder einfach "
nur" Wine unter Linux verwendet.
Wie/Kann man Wine von XP unterscheiden?
Vielen Dank für's Lesen und Antworten.
Delphi-Quellcode:
function IsWow64: Boolean;
type
TIsWow64Process =
function(
// Type of IsWow64Process API fn
Handle: Windows.THandle;
var Res: Windows.BOOL
): Windows.BOOL;
stdcall;
var
IsWow64Result: Windows.BOOL;
// Result from IsWow64Process
IsWow64Process: TIsWow64Process;
// IsWow64Process fn reference
begin
// Try to load required function from kernel32
IsWow64Process := Windows.GetProcAddress(
Windows.GetModuleHandle('
kernel32.dll'), '
IsWow64Process'
);
if Assigned(IsWow64Process)
then
begin
// Function is implemented: call it
if not IsWow64Process(
Windows.GetCurrentProcess, IsWow64Result
)
then
raise SysUtils.Exception.Create('
IsWow64: bad process handle');
// Return result of function
Result := IsWow64Result;
end
else
// Function not implemented: can't be running on Wow64
Result := False;
end;
function Get3264Windows:
string;
begin
result := '
32-Bit';
if IsWow64
then result := '
64-Bit';
end;
function GetWindowsVersion4me(ShortInfo: Boolean):
string;
var
VerInfo: TOsversionInfo;
PlatformId, VersionNumber, BuildNumber:
string;
Reg: TRegistry;
begin
VerInfo.dwOSVersionInfoSize := SizeOf(VerInfo);
GetVersionEx(VerInfo);
Reg := TRegistry.Create;
Reg.RootKey := HKEY_LOCAL_MACHINE;
case VerInfo.dwPlatformId
of
VER_PLATFORM_WIN32s:
begin
PlatformId := '
Windows 3.1';
end;
VER_PLATFORM_WIN32_WINDOWS:
begin
Reg.OpenKeyReadOnly('
\SOFTWARE\Microsoft\Windows\CurrentVersion');
PlatformId := Reg.ReadString('
ProductName');
VersionNumber := Reg.ReadString('
VersionNumber');
BuildNumber := Reg.ReadString('
CurrentBuildNumber');
end;
VER_PLATFORM_WIN32_NT:
begin
Reg.OpenKeyReadOnly('
\SOFTWARE\Microsoft\Windows NT\CurrentVersion');
PlatformId := Reg.ReadString('
ProductName');
VersionNumber := Reg.ReadString('
CurrentVersion');
BuildNumber := Reg.ReadString('
CurrentBuildNumber');
end;
end;
Reg.Free;
if shortinfo
then
Result := '
(' + VersionNumber + '
/' + BuildNumber + '
)'
else
Result := PlatformId + '
(Version ' + VersionNumber + '
/Build ' + BuildNumber
+ '
)';
Result := Result + #32 + Get3264Windows;
end;