;-------------------------------------------------------------------------------------
#ifndef IS_ENHANCED
  #error Enhanced edition of Inno Setup (restools) is required to compile this script
#endif
;-------------------------------------------------------------------------------------
#define advansed_vc  /* более точное определение видаокарти (на мой взгляд) - если средствами Isab, то закомментировать */
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application
OutputDir=.
[files]
Source: Isab.dll; DestDir: {tmp}; Flags: dontcopy
[code]
type
   TSysInfo = record
     ProcessorName: PAnsiChar;
     MaxClockSpeed,CurrentClockSpeed: integer;
     Manufacturer: PAnsiChar;
     NumberofPhysicalCores,NumberOfLogicalProcessors: integer;
     VgaAdapterName: PAnsiChar;
     VgaAdapterRam: integer;
     VideoModeDescription, AudioDeviceName: PAnsiChar;
     TotalVisibleMemorySize,FreePhysicalMemory: integer;
     OSName: PAnsiChar;
     OSVersionMajor,OSVersionMinor,OSBuildNumbers: Cardinal;
     ServicePackMajorVersion,ServicePackMinorVersion: Word;
     OSArchitecture: Byte;
   end;
var
   SysInfo: TSysInfo;
   Sp,bit,OSName,S,VCName: String;
   i: Integer;
procedure GetSysInfo(var SysInfo: TSysInfo);external 'GetSysInfo@files:Isab.dll stdcall delayload';
#ifdef advansed_vc
function VCard: Boolean;
begin
   for i:= 0 to 5 do RegQueryStringValue(HKLM,'SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\000'+inttostr(i),'DriverDesc',VCName);
     Result:= Pos('Radeon',VCName)<>Pos('GeForce',VCName) or Pos('Intel(R)',VCName);
end;
function MVCard: Cardinal;
var
   VCM: Cardinal;
begin
   for i:= 0 to 5 do RegQueryDWordValue(HKLM,'SYSTEM\ControlSet001\Control\Class\{4D36E968-E325-11CE-BFC1-08002BE10318}\000'+inttostr(i),'HardwareInformation.MemorySize',VCM);
     Result:= VCM/1048576;
end;
#endif
function MbOrTb(Float: Extended): String;
begin
   if Float < 1024 then Result:= FormatFloat('0', Float)+' мб' else
     if Float/1024 < 1024 then Result:= format('%.1n', [Float/1024])+' гб' else
       Result:= format('%.1n', [Float/(1024*1024)])+' тб';
  StringChange(Result, ',', '.');
end;
function InitializeSetup: Boolean;
begin
  GetSysInfo(SysInfo);
   S:= SysInfo.OSName;
   OSName:= Copy(S,Pos(' ',S)+1,Length(S));
   Delete(OSName,4,4);
   if SysInfo.ServicePackMajorVersion > 0 then Sp:= 'SP'+inttostr(SysInfo.ServicePackMajorVersion) else Sp:= '';
   if SysInfo.OSArchitecture > 0 then bit:= ' x'+inttostr(SysInfo.OSArchitecture) else bit:= '';
#ifdef advansed_vc
   VCard;
#endif
   MsgBox('Процессор: '+SysInfo.ProcessorName+#13#10+
          'Физические ядра процессора: '+inttostr(SysInfo.NumberofPhysicalCores)+#13#10+
          'Логические ядра процессора: '+inttostr(SysInfo.NumberOfLogicalProcessors)+#13#10+
#ifdef advansed_vc
          'Видеоадаптер: '+VCName+#13#10+
          'Видеопамять: '+MbOrTb(MVCard)+#13#10+
#else
          'Видеокарта: '+SysInfo.VgaAdapterName+#13#10+
          'Видеопамять: '+MbOrTb(SysInfo.VgaAdapterRam)+#13#10+
#endif
          'Разрешение монитора: '+IntToStr(Screen.Width)+' x '+IntToStr(Screen.Height)+' пикселей'+#13#10+
          'Звук: '+SysInfo.AudioDeviceName+#13#10+
          'Оперативная память: '+MbOrTb(SysInfo.TotalVisibleMemorySize)+';'+' Свободно: '+MbOrTb(SysInfo.FreePhysicalMemory)+#13#10+
          'Система: '+OSName+Sp+bit+' сборка '+inttostr(SysInfo.OSBuildNumbers),
   mbInformation, mb_Ok);
  Result:= false;
end;