
Эксперт
  
Профиль
Группа: Участник Клуба
Сообщений: 1708
Регистрация: 21.6.2004
Где: Moscow
Репутация: 8 Всего: 76
|
Вот что у мя получилось. У кого есть виста потестите, а то у мя нету. Код слизан с мсдн. Код | const BUFSIZE = 255; VER_NT_WORKSTATION = $0000001;
PRODUCT_BUSINESS = $00000006; // Business Edition PRODUCT_BUSINESS_N = $00000010; // Business Edition PRODUCT_CLUSTER_SERVER = $00000012; // Cluster Server Edition PRODUCT_DATACENTER_SERVER = $00000008; // Server Datacenter Edition (full installation) PRODUCT_DATACENTER_SERVER_CORE = $0000000C; // Server Datacenter Edition (core installation) PRODUCT_DATACENTER_SERVER_CORE_V = $00000027; // Server Datacenter Edition without Hyper-V (core installation) PRODUCT_DATACENTER_SERVER_V = $00000025; // Server Datacenter Edition without Hyper-V (full installation) PRODUCT_ENTERPRISE = $00000004; // Enterprise Edition PRODUCT_ENTERPRISE_N = $0000001B; // Enterprise Edition PRODUCT_ENTERPRISE_SERVER = $0000000A; // Server Enterprise Edition (full installation) PRODUCT_ENTERPRISE_SERVER_CORE = $0000000E; // Server Enterprise Edition (core installation) PRODUCT_ENTERPRISE_SERVER_CORE_V = $00000029; // Server Enterprise Edition without Hyper-V (core installation) PRODUCT_ENTERPRISE_SERVER_IA64 = $0000000F; // Server Enterprise Edition for Itanium-based Systems PRODUCT_ENTERPRISE_SERVER_V = $00000026; // Server Enterprise Edition without Hyper-V (full installation) PRODUCT_HOME_BASIC = $00000002; // Home Basic Edition PRODUCT_HOME_BASIC_N = $00000005; // Home Basic Edition PRODUCT_HOME_PREMIUM = $00000003; // Home Premium Edition PRODUCT_HOME_PREMIUM_N = $0000001A; // Home Premium Edition PRODUCT_HOME_SERVER = $00000013; // Home Server Edition PRODUCT_HYPERV = $0000002A; // Hyper-V PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT = $0000001E; // Windows Essential Business Server Management Server PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING = $00000020; // Windows Essential Business Server Messaging Server PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY = $0000001F; // Windows Essential Business Server Security Server PRODUCT_SERVER_FOR_SMALLBUSINESS = $00000018; // Server for Small Business Edition PRODUCT_SMALLBUSINESS_SERVER = $00000009; // Small Business Server PRODUCT_SMALLBUSINESS_SERVER_PREMIUM = $00000019; // Small Business Server Premium Edition PRODUCT_STANDARD_SERVER = $00000007; //Server Standard Edition (full installation) PRODUCT_STANDARD_SERVER_CORE = $0000000D; // Server Standard Edition (core installation) PRODUCT_STANDARD_SERVER_CORE_V = $00000028; // Server Standard Edition without Hyper-V (core installation) PRODUCT_STANDARD_SERVER_V = $00000024; // Server Standard Edition without Hyper-V (full installation) PRODUCT_STARTER = $0000000B; // Starter Edition PRODUCT_STORAGE_ENTERPRISE_SERVER = $00000017; // Storage Server Enterprise Edition PRODUCT_STORAGE_EXPRESS_SERVER = $00000014; // Storage Server Express Edition PRODUCT_STORAGE_STANDARD_SERVER = $00000015; // Storage Server Standard Edition PRODUCT_STORAGE_WORKGROUP_SERVER = $00000016; // Storage Server Workgroup Edition PRODUCT_UNDEFINED = $00000000; // An unknown product PRODUCT_ULTIMATE = $00000001; // Ultimate Edition PRODUCT_ULTIMATE_N = $0000001C; // Ultimate Edition PRODUCT_WEB_SERVER = $00000011; // Web Server Edition (full installation) PRODUCT_WEB_SERVER_CORE = $0000001D; // Web Server Edition (core installation)
PROCESSOR_ARCHITECTURE_AMD64 = 9; // x64 (AMD or Intel) PROCESSOR_ARCHITECTURE_IA64 = 6; // Intel Itanium Processor Family (IPF) PROCESSOR_ARCHITECTURE_INTEL = 0; // x86 PROCESSOR_ARCHITECTURE_UNKNOWN = $ffff; // Unknown processor.
SM_SERVERR2 = 89;
VER_SUITE_BACKOFFICE = $00000004; // Microsoft BackOffice components are installed. VER_SUITE_BLADE = $00000400; // Windows Server 2003, Web Edition is installed. VER_SUITE_COMPUTE_SERVER = $00004000; // Windows Server 2003, Compute Cluster Edition is installed. VER_SUITE_DATACENTER = $00000080; // Windows Server 2008 Datacenter, Windows Server 2003, Datacenter Edition, or Windows 2000 Datacenter Server is installed. VER_SUITE_ENTERPRISE = $00000002; // Windows Server 2008 Enterprise, Windows Server 2003, Enterprise Edition, or Windows 2000 Advanced Server is installed. Refer to the Remarks section for more information about this bit flag. VER_SUITE_EMBEDDEDNT = $00000040; // Windows XP Embedded is installed. VER_SUITE_PERSONAL = $00000200; // Windows Vista Home Premium, Windows Vista Home Basic, or Windows XP Home Edition is installed. VER_SUITE_SINGLEUSERTS = $00000100; // Remote Desktop is supported, but only one interactive session is supported. This value is set unless the system is running in application server mode. VER_SUITE_SMALLBUSINESS = $00000001; // Microsoft Small Business Server was once installed on the system, but may have been upgraded to another version of Windows. Refer to the Remarks section for more information about this bit flag. VER_SUITE_SMALLBUSINESS_RESTRICTED = $00000020; // Microsoft Small Business Server is installed with the restrictive client license in force. Refer to the Remarks section for more information about this bit flag. VER_SUITE_STORAGE_SERVER = $00002000; // Windows Storage Server 2003 R2 or Windows Storage Server 2003is installed. VER_SUITE_TERMINAL = $00000010; // Terminal Services is installed. This value is always set. //If VER_SUITE_TERMINAL is set but VER_SUITE_SINGLEUSERTS is not set, the system is running in application server mode. VER_SUITE_WH_SERVER = $00008000; // Windows Home Server is installed.
type POSVERSIONINFOEX = ^OSVERSIONINFOEX; OSVERSIONINFOEX = record dwOSVersionInfoSize: DWORD; dwMajorVersion: DWORD; dwMinorVersion: DWORD; dwBuildNumber: DWORD; dwPlatformId: DWORD; szCSDVersion: array [0..127] of Char; wServicePackMajor: WORD; wServicePackMinor: WORD; wSuiteMask: WORD; wProductType: BYTE; wReserved: BYTE; end;
function GetVersionEx(var lpVersionInformation: OSVERSIONINFOEX): boolean; stdcall; external 'kernel32.dll' name 'GetVersionExA';
function GetOSDisplayString: string; var osvi: OSVERSIONINFOEX;
pGNSI: procedure (lpSystemInfo: PSYSTEMINFO); stdcall; pGPI: function (dwOSMajorVersion: DWORD; dwOSMinorVersion: DWORD; dwSpMajorVersion: DWORD; dwSpMinorVersion: DWORD; pdwReturnedProductType: PDWORD): Boolean; stdcall;
si: SYSTEM_INFO; bOsVersionInfoEx: Boolean; dwType: DWORD; pszOS: LPTSTR; begin pszOS := StrAlloc(BUFSIZE); ZeroMemory(pszOS, BUFSIZE); ZeroMemory(@si, sizeof(SYSTEM_INFO)); ZeroMemory(@osvi, sizeof(TOSVersionInfo));
osvi.dwOSVersionInfoSize := sizeof(TOSVersionInfo);
bOsVersionInfoEx := GetVersionEx(osvi); if not bOsVersionInfoEx then begin Result := ''; Exit; end;
// Call GetNativeSystemInfo if supported or GetSystemInfo otherwise.
pGNSI := GetProcAddress(GetModuleHandle('kernel32.dll'), 'GetNativeSystemInfo'); if Assigned(pGNSI) then pGNSI(@si) else GetSystemInfo(si);
if (VER_PLATFORM_WIN32_NT = osvi.dwPlatformId) and (osvi.dwMajorVersion > 4) then begin StrCat(pszOS, 'Microsoft ');
// Test for the specific product.
if (osvi.dwMajorVersion = 6) and (osvi.dwMinorVersion = 0) then begin if (osvi.wProductType = VER_NT_WORKSTATION) then StrCat(pszOS, 'Windows Vista ') else StrCat(pszOS, 'Windows Server 2008 ');
pGPI := GetProcAddress(GetModuleHandle('kernel32.dll'), 'GetProductInfo');
pGPI(6, 0, 0, 0, @dwType);
case dwType of PRODUCT_ULTIMATE: StrCat(pszOS, 'Ultimate Edition'); PRODUCT_HOME_PREMIUM: StrCat(pszOS, 'Home Premium Edition'); PRODUCT_HOME_BASIC: StrCat(pszOS, 'Home Basic Edition'); PRODUCT_ENTERPRISE: StrCat(pszOS, 'Enterprise Edition'); PRODUCT_BUSINESS: StrCat(pszOS, 'Business Edition'); PRODUCT_STARTER: StrCat(pszOS, 'Starter Edition'); PRODUCT_CLUSTER_SERVER: StrCat(pszOS, 'Cluster Server Edition'); PRODUCT_DATACENTER_SERVER: StrCat(pszOS, 'Datacenter Edition'); PRODUCT_DATACENTER_SERVER_CORE: StrCat(pszOS, 'Datacenter Edition (core installation)'); PRODUCT_ENTERPRISE_SERVER: StrCat(pszOS, 'Enterprise Edition'); PRODUCT_ENTERPRISE_SERVER_CORE: StrCat(pszOS, 'Enterprise Edition (core installation)'); PRODUCT_ENTERPRISE_SERVER_IA64: StrCat(pszOS, 'Enterprise Edition for Itanium-based Systems'); PRODUCT_SMALLBUSINESS_SERVER: StrCat(pszOS, 'Small Business Server'); PRODUCT_SMALLBUSINESS_SERVER_PREMIUM: StrCat(pszOS, 'Small Business Server Premium Edition'); PRODUCT_STANDARD_SERVER: StrCat(pszOS, 'Standard Edition'); PRODUCT_STANDARD_SERVER_CORE: StrCat(pszOS, 'Standard Edition (core installation)'); PRODUCT_WEB_SERVER: StrCat(pszOS, 'Web Server Edition'); end;
if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) then StrCat(pszOS, ', 64-bit') else if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL) then StrCat(pszOS, ', 32-bit'); end;
if (osvi.dwMajorVersion = 5) and (osvi.dwMinorVersion = 2) then begin if Boolean(GetSystemMetrics(SM_SERVERR2)) then StrCat(pszOS, 'Windows Server 2003 R2, ') else if (osvi.wSuiteMask = VER_SUITE_STORAGE_SERVER) then StrCat(pszOS, 'Windows Storage Server 2003') else if (osvi.wProductType = VER_NT_WORKSTATION) and (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) then StrCat(pszOS, 'Windows XP Professional x64 Edition') else StrCat(pszOS, 'Windows Server 2003, ');
// Test for the server type. if (osvi.wProductType <> VER_NT_WORKSTATION) then begin if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_IA64) then begin if (osvi.wSuiteMask = VER_SUITE_DATACENTER ) then //? StrCat(pszOS, 'Datacenter Edition for Itanium-based Systems') else if (osvi.wSuiteMask = VER_SUITE_ENTERPRISE) then StrCat(pszOS, 'Enterprise Edition for Itanium-based Systems'); end
else if (si.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_AMD64) then begin if (osvi.wSuiteMask = VER_SUITE_DATACENTER) then StrCat(pszOS, 'Datacenter x64 Edition') else if( osvi.wSuiteMask = VER_SUITE_ENTERPRISE) then StrCat(pszOS, 'Enterprise x64 Edition') else StrCat(pszOS, 'Standard x64 Edition') end
else begin if (osvi.wSuiteMask = VER_SUITE_COMPUTE_SERVER) then StrCat(pszOS, 'Compute Cluster Edition') else if (osvi.wSuiteMask = VER_SUITE_DATACENTER) then StrCat(pszOS, 'Datacenter Edition') else if (osvi.wSuiteMask = VER_SUITE_ENTERPRISE) then StrCat(pszOS, 'Enterprise Edition') else if (osvi.wSuiteMask = VER_SUITE_BLADE) then StrCat(pszOS, 'Web Edition') else StrCat(pszOS, 'Standard Edition') end; end; end;
if (osvi.dwMajorVersion = 5) and (osvi.dwMinorVersion = 1) then begin StrCat(pszOS, 'Windows XP '); if (osvi.wSuiteMask = VER_SUITE_PERSONAL) then StrCat(pszOS, 'Home Edition') else StrCat(pszOS, 'Professional'); end;
if (osvi.dwMajorVersion = 5) and (osvi.dwMinorVersion = 0) then begin StrCat(pszOS, 'Windows 2000 '); if (osvi.wProductType = VER_NT_WORKSTATION) then StrCat(pszOS, 'Professional') else begin if (osvi.wSuiteMask = VER_SUITE_DATACENTER) then StrCat(pszOS, 'Datacenter Server') else if (osvi.wSuiteMask = VER_SUITE_ENTERPRISE) then StrCat(pszOS, 'Advanced Server') else StrCat(pszOS, 'Server') end; end;
// Include service pack (if any) and build number.
if Length(osvi.szCSDVersion) > 0 then begin StrCat(pszOS, ' '); StrCat(pszOS, osvi.szCSDVersion); end;
StrCat(pszOS, PChar(' (build' + IntToStr(osvi.dwBuildNumber) + ')')); Result := StrPas(pszOS); end else Result := 'This sample does not support this version of Windows.'; end;
|
Это сообщение отредактировал(а) Rennigth - 1.7.2008, 17:10
--------------------
(* Honesta mors turpi vita potior *)
|