一个非常完整的取WINDOWS OS 版本信息的函数
作者:陆岛工作室
本人写的一个能取目前所有 Windows 操作系统的版本信息文本的函数。支持VISTA的版本信息。
uses Shlobj, ShellAPI;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
{*---------------------------------*}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
function GetOSVersionText: string;
var
Info:TOSVersionInfoEx;
Key: HKEY;
begin
Result := '';
if (not GetOSVersionInfo(Info)) then Exit;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
case Info.dwPlatformId of
{ Win32s }
VER_PLATFORM_WIN32s:
Result := 'Microsoft Win32s';
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
{ Windows 9x }
VER_PLATFORM_WIN32_WINDOWS:
if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 0) then
begin
Result := 'Microsoft Windows 95';
if (Info.szCSDVersion[1] in ['B', 'C']) then
Result := Result +'OSR2';
end
else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 10) then
begin
Result := 'Microsoft Windows 98';
if (Info.szCSDVersion[1] = 'A') then
Result := Result + ' SE';
end
else if (Info.dwMajorVersion = 4) and (Info.dwMinorVersion = 90) then
Result := 'Microsoft Windows Millennium Edition';
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
{ Windows NT }
VER_PLATFORM_WIN32_NT:
begin
{ Version }
if (Info.dwMajorVersion > 5) then
Result := 'Microsoft Vista'
else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then
Result := 'Microsoft Windows Server 2003'
else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 1) then
Result := 'Microsoft Windows XP'
else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then
Result := 'Microsoft Windows 2000'
else
Result := 'Microsoft Windows NT';
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
{ Extended }
if (Info.dwOSVersionInfoSize >= SizeOf(TOSVersionInfoEx)) then
begin
{ ProductType }
if (Info.wProductType = VER_NT_WORKSTATION) then
begin
if (Info.dwMajorVersion = 4) then
Result := Result + #10'Workstation 4.0'
else if (Info.wSuiteMask and VER_SUITE_PERSONAL <> 0) then
Result := Result + #13'Home Edition'
else
Result := Result + #10'Professional';
end
else if (Info.wProductType = VER_NT_SERVER) then
begin
if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 2) then
begin
if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then
Result := Result + #10'Datacenter Edition'
else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
Result := Result + #10'Enterprise Edition'
else if (Info.wSuiteMask = VER_SUITE_BLADE) then
Result := Result + #10'Web Edition'
else
Result := Result + #10'Standard Edition';
end
else if (Info.dwMajorVersion = 5) and (Info.dwMinorVersion = 0) then
begin
if (Info.wSuiteMask and VER_SUITE_DATACENTER <> 0) then
Result := Result + #10'Datacenter Server'
else if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
Result := Result + #10'Advanced Server'
else
Result := Result + #10'Server';
end
else
begin
Result := Result + #10'Server ' +
IntToStr(Info.dwMajorVersion) + '.' +
IntToStr(Info.dwMinorVersion);
if (Info.wSuiteMask and VER_SUITE_ENTERPRISE <> 0) then
Result := Result + ', Enterprise Edition';
end;
end;
end;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
{ CSDVersion }
if (Info.dwMajorVersion = 4) and
(StrIComp(Info.szCSDVersion, 'Service Pack 6') = 0) and
(RegOpenKeyEx(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\Q246009', 0,
KEY_QUERY_VALUE, Key) = ERROR_SUCCESS) then
begin
Result := Result + #10'Service Pack 6a';
RegCloseKey(Key);
end
else
Result := Result + #10 + StrPas(Info.szCSDVersion);
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
Result := Result + #10'Build ' + IntToStr(Info.dwBuildNumber and $FFFF) + '';
end;
end;
end;
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
本人写的一个能取目前所有 Windows 操作系统的版本信息文本的函数。支持VISTA的版本信息。
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
作者: 陆岛工作室