home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 September / Chip_2001-09_cd1.bin / zkuste / delphi / kompon / d2345 / MSYSINFO.ZIP / Source / MSI_Overview.pas < prev    next >
Pascal/Delphi Source File  |  2001-06-25  |  39KB  |  1,408 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {         MiTeC System Information Component            }
  5. {                System Overview                        }
  6. {           version 5.5 for Delphi 3,4,5                }
  7. {                                                       }
  8. {       Copyright ⌐ 1997,2001 Michal Mutl               }
  9. {                                                       }
  10. {*******************************************************}
  11.  
  12.  
  13. {$INCLUDE MITEC_DEF.INC}
  14.  
  15. unit MSI_Overview;
  16.  
  17. interface
  18.  
  19. uses
  20.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  21.   MSystemInfo, ComCtrls, StdCtrls, ExtCtrls, CheckLst,
  22.   {$IFDEF D4PLUS} ImgList,{$ENDIF}
  23.   Mask, Menus, Gauges, Buttons;
  24.  
  25. type
  26.   TPage = (pgWksta, pgOS, pgCPU, pgMem, pgDisplay, pgAPM, pgMedia, pgNet, pgDev,
  27.            pgPrn, pgEng, pgDisk, pgTZ, pgProcs, pgStartup, pgSoftware, pgAbout);
  28.  
  29.   TPages = set of TPage;
  30.  
  31. const
  32.   iiComputer      = 0;
  33.   iiSystem        = 1;
  34.   iiDisplay       = 2;
  35.   iiMonitor       = 3;
  36.   iiVolumes       = 4;
  37.   iiFDD           = 5;
  38.   iiHDD           = 6;
  39.   iiCDROM         = 7;
  40.   iiTape          = 8;
  41.   iiAPM           = 9;
  42.   iiImaging       = 10;
  43.   iiKeyboard      = 11;
  44.   iiMouse         = 12;
  45.   iiModem         = 13;
  46.   iiPort          = 14;
  47.   iiAdapter       = 15;
  48.   iiPackage       = 16;
  49.   iiSCSI          = 17;
  50.   iiDriver        = 18;
  51.   iiSound         = 19;
  52.   iiUSB           = 20;
  53.   iiGame          = 21;
  54.   iiNet           = 22;
  55.   iiProcess       = 23;
  56.   iiPCMCIA        = 24;
  57.   iiChanger       = 25;
  58.   iiHID           = 26;
  59.   iiGPS           = 27;
  60.   iiReader        = 28;
  61.   iiInfrared      = 29;
  62.   iiMIDI          = 30;
  63.   iiWave          = 31;
  64.   iiMixer         = 32;
  65.   iiAUX           = 33;
  66.   iiDirectX       = 34;
  67.   iiPrinter       = 35;
  68.   iiPrinterDef    = 36;
  69.   iiNetPrinter    = 37;
  70.   iiNetPrinterDef = 38;
  71.   
  72.  
  73.  
  74.   pgAll = [pgWksta, pgOS, pgCPU, pgMem, pgDisplay, pgAPM, pgMedia, pgNet, pgDev,
  75.            pgPrn, pgEng, pgDisk, pgTZ, pgProcs, pgStartup, pgSoftware];
  76.  
  77.  
  78. type
  79.   TfrmMSI_Overview = class(TForm)
  80.     Panel1: TPanel;
  81.     Panel2: TPanel;
  82.     bRefresh: TButton;
  83.     Panel3: TPanel;
  84.     pc: TPageControl;
  85.     tsWksta: TTabSheet;
  86.     tsOS: TTabSheet;
  87.     tsCPU: TTabSheet;
  88.     gbMID: TGroupBox;
  89.     Label1: TLabel;
  90.     eWksta: TEdit;
  91.     Label2: TLabel;
  92.     eUser: TEdit;
  93.     Image1: TImage;
  94.     GroupBox2: TGroupBox;
  95.     Label3: TLabel;
  96.     Label4: TLabel;
  97.     eBIOSName: TEdit;
  98.     eBIOSCopy: TEdit;
  99.     Label5: TLabel;
  100.     Label6: TLabel;
  101.     eBIOSDate: TEdit;
  102.     eBIOSExt: TEdit;
  103.     GroupBox3: TGroupBox;
  104.     Label7: TLabel;
  105.     Label8: TLabel;
  106.     eLastBoot: TEdit;
  107.     eSysTime: TEdit;
  108.     pNumLock: TPanel;
  109.     pCapsLock: TPanel;
  110.     pScrollLock: TPanel;
  111.     bOK: TButton;
  112.     Image2: TImage;
  113.     lVersion: TLabel;
  114.     lVerNo: TLabel;
  115.     Bevel1: TBevel;
  116.     Label9: TLabel;
  117.     Label10: TLabel;
  118.     ePID: TEdit;
  119.     eRegUser: TEdit;
  120.     Label11: TLabel;
  121.     eRegOrg: TEdit;
  122.     GroupBox4: TGroupBox;
  123.     bEnvironment: TButton;
  124.     Image3: TImage;
  125.     lCPU: TLabel;
  126.     tsMemory: TTabSheet;
  127.     GroupBox7: TGroupBox;
  128.     Image4: TImage;
  129.     Label16: TLabel;
  130.     Label17: TLabel;
  131.     ePT: TEdit;
  132.     ePF: TEdit;
  133.     Label18: TLabel;
  134.     Label19: TLabel;
  135.     Label20: TLabel;
  136.     Label21: TLabel;
  137.     eFT: TEdit;
  138.     eFF: TEdit;
  139.     Label22: TLabel;
  140.     Label23: TLabel;
  141.     Label24: TLabel;
  142.     Label25: TLabel;
  143.     eVT: TEdit;
  144.     eVF: TEdit;
  145.     Label26: TLabel;
  146.     Label27: TLabel;
  147.     GroupBox8: TGroupBox;
  148.     GroupBox9: TGroupBox;
  149.     Label28: TLabel;
  150.     Label29: TLabel;
  151.     eAG: TEdit;
  152.     eAppAddr: TEdit;
  153.     Label30: TLabel;
  154.     ePS: TEdit;
  155.     Label31: TLabel;
  156.     Label32: TLabel;
  157.     tsDisplay: TTabSheet;
  158.     Image5: TImage;
  159.     cbDisplay: TComboBox;
  160.     Label33: TLabel;
  161.     GroupBox10: TGroupBox;
  162.     Label34: TLabel;
  163.     Label35: TLabel;
  164.     Label36: TLabel;
  165.     eChip: TEdit;
  166.     eDAC: TEdit;
  167.     eMem: TEdit;
  168.     GroupBox11: TGroupBox;
  169.     GroupBox12: TGroupBox;
  170.     eBIOS: TEdit;
  171.     lTechnology: TLabel;
  172.     lMetrics: TLabel;
  173.     lPixWidth: TLabel;
  174.     lPixHeight: TLabel;
  175.     lPixDiag: TLabel;
  176.     bCurve: TButton;
  177.     bLine: TButton;
  178.     bPoly: TButton;
  179.     bRaster: TButton;
  180.     bText: TButton;
  181.     Label37: TLabel;
  182.     tsAPM: TTabSheet;
  183.     GroupBox13: TGroupBox;
  184.     Label38: TLabel;
  185.     Label39: TLabel;
  186.     eAC: TEdit;
  187.     eBat: TEdit;
  188.     Image6: TImage;
  189.     GroupBox14: TGroupBox;
  190.     Label40: TLabel;
  191.     Label41: TLabel;
  192.     eBatFull: TEdit;
  193.     eBatLife: TEdit;
  194.     tsMedia: TTabSheet;
  195.     Label42: TLabel;
  196.     Panel5: TPanel;
  197.     img: TImageList;
  198.     tsNetwork: TTabSheet;
  199.     Label47: TLabel;
  200.     Panel6: TPanel;
  201.     lvNetwork: TListView;
  202.     GroupBox16: TGroupBox;
  203.     tsDevices: TTabSheet;
  204.     psd: TPrinterSetupDialog;
  205.     tsPrinters: TTabSheet;
  206.     Label48: TLabel;
  207.     Panel7: TPanel;
  208.     lvPrinter: TListView;
  209.     bPrint: TButton;
  210.     tsEngines: TTabSheet;
  211.     GroupBox17: TGroupBox;
  212.     Image7: TImage;
  213.     GroupBox18: TGroupBox;
  214.     Image8: TImage;
  215.     lODBC: TLabel;
  216.     lBDE: TLabel;
  217.     lDirectX: TLabel;
  218.     tsDrives: TTabSheet;
  219.     Label54: TLabel;
  220.     cbDrive: TComboBox;
  221.     GroupBox19: TGroupBox;
  222.     imgDrive: TImage;
  223.     lDriveType: TLabel;
  224.     clbFlags: TCheckListBox;
  225.     Label55: TLabel;
  226.     Label56: TLabel;
  227.     eUNC: TEdit;
  228.     eDSN: TEdit;
  229.     Bevel3: TBevel;
  230.     lCapacity: TLabel;
  231.     lFree: TLabel;
  232.     lBPS: TLabel;
  233.     lSPC: TLabel;
  234.     lTC: TLabel;
  235.     lFC: TLabel;
  236.     Bevel4: TBevel;
  237.     bReport: TButton;
  238.     ReportMenu: TPopupMenu;
  239.     pmAll: TMenuItem;
  240.     pmSelected: TMenuItem;
  241.     sd: TSaveDialog;
  242.     Panel10: TPanel;
  243.     gDisk: TGauge;
  244.     Panel11: TPanel;
  245.     gAPM: TGauge;
  246.     GroupBox20: TGroupBox;
  247.     Label57: TLabel;
  248.     Label58: TLabel;
  249.     Label59: TLabel;
  250.     Image9: TImage;
  251.     eWSDesc: TEdit;
  252.     eWSVer: TEdit;
  253.     eWSStat: TEdit;
  254.     bModes: TButton;
  255.     tsTZ: TTabSheet;
  256.     Panel12: TPanel;
  257.     Image10: TImage;
  258.     gbStd: TGroupBox;
  259.     Label12: TLabel;
  260.     Label73: TLabel;
  261.     eStdStart: TEdit;
  262.     eStdBias: TEdit;
  263.     eTZ: TEdit;
  264.     Label74: TLabel;
  265.     gbDay: TGroupBox;
  266.     Label75: TLabel;
  267.     Label76: TLabel;
  268.     Label77: TLabel;
  269.     edayStart: TEdit;
  270.     eDayBias: TEdit;
  271.     gMemory: TGauge;
  272.     Panel13: TPanel;
  273.     Panel14: TPanel;
  274.     lbIP: TListBox;
  275.     lbMAC: TListBox;
  276.     Label64: TLabel;
  277.     Label69: TLabel;
  278.     Panel15: TPanel;
  279.     bProto: TButton;
  280.     bServ: TButton;
  281.     bCli: TButton;
  282.     lFontRes: TLabel;
  283.     Panel8: TPanel;
  284.     Tree: TTreeView;
  285.     FolderList: TListView;
  286.     Panel9: TPanel;
  287.     bProps: TButton;
  288.     pcCPU: TPageControl;
  289.     tsID: TTabSheet;
  290.     tsFeatures: TTabSheet;
  291.     GroupBox5: TGroupBox;
  292.     lModel: TLabel;
  293.     lSerial: TLabel;
  294.     lVendor: TLabel;
  295.     lTrans: TLabel;
  296.     GroupBox21: TGroupBox;
  297.     lL1Data: TLabel;
  298.     lL1Code: TLabel;
  299.     lLevel1: TLabel;
  300.     lLevel2: TLabel;
  301.     GroupBox6: TGroupBox;
  302.     Panel4: TPanel;
  303.     clbCPU: TCheckListBox;
  304.     lCodename: TLabel;
  305.     lDAO: TLabel;
  306.     tsAbout: TTabSheet;
  307.     FooterPanel: TPanel;
  308.     sbMail: TSpeedButton;
  309.     TitlePanel: TPanel;
  310.     imgIcon: TImage;
  311.     Panel16: TPanel;
  312.     Memo: TMemo;
  313.     tsProcs: TTabSheet;
  314.     Panel17: TPanel;
  315.     lvProcs: TListView;
  316.     ProcPanel: TPanel;
  317.     bTerminate: TButton;
  318.     bProcProps: TButton;
  319.     tsStartup: TTabSheet;
  320.     tsSoftware: TTabSheet;
  321.     tcStartup: TTabControl;
  322.     bNTSpec: TButton;
  323.     lvMedia: TListView;
  324.     Panel18: TPanel;
  325.     lvSound: TListView;
  326.     Label14: TLabel;
  327.     Panel19: TPanel;
  328.     lvDirectX: TListView;
  329.     Label13: TLabel;
  330.     Panel20: TPanel;
  331.     lvSW: TListView;
  332.     Panel21: TPanel;
  333.     lvStartup: TListView;
  334.     lTitle: TLabel;
  335.     lVer: TLabel;
  336.     lADO: TLabel;
  337.     Label15: TLabel;
  338.     ePKey: TEdit;
  339.     lCSD: TLabel;
  340.     lDVD: TLabel;
  341.     procedure FormCreate(Sender: TObject);
  342.     procedure cmRefresh(Sender: TObject);
  343.     procedure cmClose(Sender: TObject);
  344.     procedure cmEnvironment(Sender: TObject);
  345.     procedure cmCaps(Sender: TObject);
  346.     procedure cmPrintSetup(Sender: TObject);
  347.     procedure cbDriveChange(Sender: TObject);
  348.     procedure cmReportClick(Sender: TObject);
  349.     procedure cmReportAll(Sender: TObject);
  350.     procedure cmReportCurrent(Sender: TObject);
  351.     procedure clbClickCheck(Sender: TObject);
  352.     procedure cmModes(Sender: TObject);
  353.     procedure cmProto(Sender: TObject);
  354.     procedure cmServ(Sender: TObject);
  355.     procedure cmCli(Sender: TObject);
  356.     procedure FormClose(Sender: TObject; var Action: TCloseAction);
  357.     procedure TreeChange(Sender: TObject; Node: TTreeNode);
  358.     procedure cmProps(Sender: TObject);
  359.     procedure cmMail(Sender: TObject);
  360.     procedure cmTerminate(Sender: TObject);
  361.     procedure cmProcProps(Sender: TObject);
  362.     procedure tcStartupChange(Sender: TObject);
  363.     procedure cmNTSpec(Sender: TObject);
  364.   private
  365.     FPages: TPages;
  366.     FSysInfo: TMSystemInfo;
  367.     FShowRepBut: Boolean;
  368.     procedure SetPages(const Value: TPages);
  369.     procedure SetShowRepBut(const Value: Boolean);
  370.     procedure SetCaptionText(const Value: string);
  371.   public
  372.     Report :TStringList;
  373.  
  374.     property DisplayedPages: TPages read FPages write SetPages;
  375.     property SysInfo: TMSystemInfo read FSysInfo write FSysInfo;
  376.     property ShowReportButton: Boolean read FShowRepBut write SetShowRepBut;
  377.     property CaptionText: string Write SetCaptionText;
  378.  
  379.     procedure GetInfo;
  380.  
  381.     procedure GetWkstaInfo;
  382.     procedure GetOSInfo;
  383.     procedure GetCPUInfo;
  384.     procedure GetMemoryInfo;
  385.     procedure GetDisplayInfo;
  386.     procedure GetAPMInfo;
  387.     procedure GetMediaInfo;
  388.     procedure GetNetInfo;
  389.     procedure GetDeviceInfo;
  390.     procedure GetEngInfo;
  391.     procedure GetDriveInfo;
  392.     procedure GetTZInfo;
  393.     procedure GetProcInfo;
  394.     procedure GetPrintInfo;
  395.     procedure GetStartupInfo;
  396.     procedure GetSWInfo;
  397.   end;
  398.  
  399. var
  400.   frmMSI_Overview: TfrmMSI_Overview;
  401.  
  402. implementation
  403.  
  404. uses ShellAPI, MiTeC_Routines, MSI_Devices, MSI_DetailDlg, MSI_OS, MSI_APM,
  405.   MSI_Startup;
  406.  
  407. {$R *.DFM}
  408.  
  409. const
  410.   cDeviceImageIndex: array[TDeviceClass] of integer =
  411.                       (iiAPM, iiSystem, iiVolumes, iiDisplay, iiCDROM, iiVolumes,
  412.                        iiFDD, iiGPS, iiHID, iiVolumes, iiDriver, iiImaging,
  413.                        iiInfrared, iiKeyboard, iiChanger, iiDriver, iiMouse, iiModem,
  414.                        iiMonitor, iiReader, iiPort, iiAdapter, iiDriver,
  415.                        iiPackage, iiDriver, iiAdapter, iiPort, iiPrinter, iiSCSI,
  416.                        iiReader, iiSound, iiHDD, iiSystem, iiTape, iiUSB);
  417.  
  418. { TfrmMSI_Overview }
  419.  
  420. procedure TfrmMSI_Overview.GetWkstaInfo;
  421. begin
  422.   with SysInfo.Machine do begin
  423.     if Trim(Computer)<>'' then
  424.       tsWkSta.Caption:=' '+Computer+' ';
  425.     eWksta.text:=Name;
  426.     eUser.text:=User;
  427.     eBIOSName.text:=BIOSName;
  428.     eBIOSCopy.text:=BIOSCopyright;
  429.     eBIOSDate.text:=BIOSDate;
  430.     eBIOSExt.text:=BIOSExtendedInfo;
  431.     eLastBoot.text:=datetimetostr(LastBoot);
  432.     eSysTime.text:=formatseconds(SystemUpTime,true,false,false);
  433.     if NumLock then
  434.       pNumLock.color:=clLime
  435.     else
  436.       pNumLock.color:=clSilver;
  437.     if CapsLock then
  438.       pCapsLock.color:=clLime
  439.     else
  440.       pCapsLock.color:=clSilver;
  441.     if ScrollLock then
  442.       pScrollLock.color:=clLime
  443.     else
  444.       pScrollLock.color:=clSilver;
  445.   end;
  446. end;
  447.  
  448. procedure TfrmMSI_Overview.GetOSInfo;
  449. var
  450.   i: integer;
  451.   s: string;
  452. begin
  453.   with SysInfo.OS do begin
  454.     s:=OSVersion;
  455.     tsOS.caption:=Platform;
  456.     if IsNT then begin
  457.       case NTSpecific.ProductType of
  458.         ptWorkstation: s:=s+' - Workstation';
  459.         ptServer: s:=s+' - Server';
  460.         ptAdvancedServer: s:=s+' - Advanced Server';
  461.       end;
  462.       lCSD.caption:=CSD;
  463.     end;
  464.  
  465.     lVersion.caption:=s;
  466.     lVerNo.caption:=format('Version: %d.%d.%d',[MajorVersion,MinorVersion,BuildNumber]);
  467.  
  468.     bNTSpec.Enabled:=Is2K or IsXP;
  469.     if IsOSR2 then
  470.       lCSD.caption:='OSR 2'
  471.     else
  472.       if IsSE then
  473.         lCSD.caption:='Second Edition';
  474.     ePID.text:=ProductID;
  475.     ePKey.text:=ProductKey;
  476.     eRegUser.text:=RegisteredUser;
  477.     eRegOrg.text:=RegisteredOrg;
  478.     lDVD.Caption:='DVD Region: '+DVDRegion;
  479.  
  480.     FolderList.Items.Clear;
  481.     for i:=0 to Folders.Count-1 do
  482.       if Folders.Values[Folders.Names[i]]<>'' then
  483.         with FolderList.Items.Add do begin
  484.           Caption:=Folders.Names[i];
  485.           SubItems.Add(Folders.Values[Folders.Names[i]]);
  486.         end;
  487.   end;
  488. end;
  489.  
  490. procedure TfrmMSI_Overview.GetCPUInfo;
  491. var
  492.   sl :TStringList;
  493.   i :Longint;
  494. begin
  495.   with SysInfo.CPU do begin
  496.     lCPU.caption:=format('%d x %s %s - %d MHz',[Count,Trim(Vendor),Trim(VendorID),Frequency]);
  497.     lVendor.Caption:='Vendor: '+VendorEx;
  498.     lSerial.caption:='Serial Number: '+SerialNumber;
  499.     lTrans.Caption:=Format('Transistors: %d',[Transistors]);
  500.     lCodename.Caption:='Code Name: '+Codename;
  501.     lModel.caption:=format('Family %d  Model %d  Stepping %d',[Family,Model,Stepping]);
  502.     sl:=TStringList.Create;
  503.     Features.Report(sl);
  504.     sl.Add(Format('FDIV Bug=%d',[integer(FDIVBug)]));
  505.     clbCPU.items.Clear;
  506.     for i:=1 to sl.count-1 do begin
  507.       clbCPU.items.Add(sl.Names[i]);
  508.       clbCPU.Checked[clbCPU.items.count-1]:=Boolean(StrToInt(sl.Values[sl.Names[i]]));
  509.     end;
  510.     sl.Free;
  511.     lL1Data.Caption:=Format('Level 1 Data Cache: %d Kb',[Cache.L1Data]);
  512.     lL1Code.Caption:=Format('Level 1 Instruction Cache: %d Kb',[Cache.L1Code]);
  513.     lLevel1.Caption:=Format('Level 1 Unified Cache: %d Kb',[Cache.Level1]);
  514.     lLevel2.Caption:=Format('Level 2 Unified Cache: %d Kb',[Cache.Level2]);
  515.   end;
  516. end;
  517.  
  518. procedure TfrmMSI_Overview.GetMemoryInfo;
  519. begin
  520.   with SysInfo.Memory do begin
  521.     ePT.text:=formatfloat('#,##',PhysicalTotal);
  522.     ePF.text:=formatfloat('#,#0',PhysicalFree);
  523.     eFT.text:=formatfloat('#,##',PageFileTotal);
  524.     eFF.text:=formatfloat('#,#0',PageFileFree);
  525.     eVT.text:=formatfloat('#,##',VirtualTotal);
  526.     eVF.text:=formatfloat('#,#0',VirtualFree);
  527.     gMemory.Progress:=MemoryLoad;
  528.     eAG.text:=formatfloat('#,##',AllocGranularity);
  529.     eAppAddr.text:=format('%s - %s',[inttohex(MinAppAddress,8),inttohex(MaxAppAddress,8)]);
  530.     ePS.text:=formatfloat('#,##',PageSize);
  531.   end;
  532. end;
  533.  
  534. procedure TfrmMSI_Overview.GetDisplayInfo;
  535. begin
  536.   with SysInfo, Display do begin
  537.     cbDisplay.Items.Add(Adapter);
  538.     cbDisplay.itemindex:=0;
  539.     eChip.text:=Chipset;
  540.     eDAC.text:=DAC;
  541.     eMem.text:=IntToStr(Memory);
  542.     eBIOS.text:=format('%s (%s)',[BIOSVersion,BIOSDate]);
  543.     lTechnology.caption:='Technology: '+Technology;
  544.     lMetrics.caption:=format('Metrics: %d x %d - %d bit',[HorzRes,VertRes,ColorDepth]);
  545.     lPixWidth.caption:=format('Pixel Width: %d',[PixelWidth]);
  546.     lPixHeight.caption:=format('Pixel Height: %d',[PixelHeight]);
  547.     lPixDiag.caption:=format('Pixel Diagonal: %d',[PixelDiagonal]);
  548.     lFontRes.caption:=format('Font Resolution: %d dpi',[FontResolution]);
  549.   end;
  550. end;
  551.  
  552. procedure TfrmMSI_Overview.GetAPMInfo;
  553. begin
  554.   with SysInfo.APM do begin
  555.     case ACPowerStatus of
  556.       psUnknown: eAC.text:='Unknown';
  557.       psOnline: eAC.text:='Online';
  558.       psOffline: eAC.text:='Offline';
  559.     end;
  560.     case BatteryChargeStatus of
  561.       bsUnknown: eBat.text:='Unknown';
  562.       bsHigh: eBat.text:='High';
  563.       bsLow: eBat.text:='Low';
  564.       bsCritical: eBat.text:='Critical';
  565.       bsCharging: eBat.text:='Charging';
  566.       bsNoBattery: eBat.text:='No Battery';
  567.     end;
  568.     if BatteryLifePercent<=100 then begin
  569.       eBatFull.text:=formatseconds(BatteryLifeFullTime,true,false,false);
  570.       eBatLife.text:=formatseconds(BatteryLifeTime,true,false,false);
  571.       gAPM.Progress:=BatteryLifePercent;
  572.     end else begin
  573.       eBatFull.text:='<info not available>';
  574.       eBatLife.text:='<info not available>';
  575.     end;
  576.   end;
  577. end;
  578.  
  579. procedure TfrmMSI_Overview.GetMediaInfo;
  580. var
  581.   i :integer;
  582. begin
  583.   with SysInfo.Media do begin
  584.     lvMedia.Items.beginUpdate;
  585.     lvMedia.items.clear;
  586.     for i:=0 to Devices.count-1 do
  587.       with lvMedia.items.add do begin
  588.         caption:=Devices[i];
  589.         if i=GamePortIndex then
  590.           imageindex:=iiGame
  591.         else
  592.           if i=SoundCardIndex then
  593.             imageindex:=iiAdapter
  594.           else
  595.             imageindex:=iiSound;
  596.       end;
  597.     lvMedia.Items.EndUpdate;
  598.     lvSound.Items.beginUpdate;
  599.     lvSound.items.clear;
  600.     for i:=0 to WaveIn.count-1 do
  601.       with lvSound.items.add do begin
  602.         caption:=WaveIn[i];
  603.         SubItems.Add('Wave In');
  604.         ImageIndex:=iiWave;
  605.       end;
  606.     for i:=0 to WaveOut.count-1 do
  607.       with lvSound.items.add do begin
  608.         caption:=WaveOut[i];
  609.         SubItems.Add('Wave Out');
  610.         ImageIndex:=iiWave;
  611.       end;
  612.     for i:=0 to MIDIIn.count-1 do
  613.       with lvSound.items.add do begin
  614.         caption:=MIDIIn[i];
  615.         SubItems.Add('MIDI In');
  616.         ImageIndex:=iiMIDI;
  617.       end;
  618.     for i:=0 to MIDIOut.count-1 do
  619.       with lvSound.items.add do begin
  620.         caption:=MIDIOut[i];
  621.         SubItems.Add('MIDI Out');
  622.         ImageIndex:=iiMIDI;
  623.       end;
  624.     for i:=0 to AUX.count-1 do
  625.       with lvSound.items.add do begin
  626.         caption:=AUX[i];
  627.         SubItems.Add('AUX');
  628.         ImageIndex:=iiAUX;
  629.       end;
  630.     for i:=0 to Mixer.count-1 do
  631.       with lvSound.items.add do begin
  632.         caption:=Mixer[i];
  633.         SubItems.Add('Mixer');
  634.         ImageIndex:=iiMixer;
  635.       end;
  636.   end;
  637.   lvSound.Items.endUpdate;
  638. end;
  639.  
  640. procedure TfrmMSI_Overview.GetNetInfo;
  641. var
  642.   i :integer;
  643. begin
  644.   with SysInfo.Network do begin
  645.     lvNetwork.items.clear;
  646.     for i:=0 to Adapters.count-1 do
  647.       with lvNetwork.items.add do begin
  648.         caption:=Adapters[i];
  649.         if CardAdapterIndex=i then
  650.           imageindex:=iiAdapter
  651.         else
  652.           imageindex:=iiNet;
  653.       end;
  654.     lbIP.Items.Text:=IPAddresses.Text;
  655.     lbMAC.Items.Text:=MACAddresses.Text;
  656.     eWSDesc.Text:=Winsock.Description;
  657.     eWSVer.Text:=Format('%d.%d',[Winsock.MajorVersion,Winsock.MinorVersion]);
  658.     eWSStat.Text:=Winsock.Status;
  659.   end;
  660. end;
  661.  
  662. procedure TfrmMSI_Overview.GetDeviceInfo;
  663. var
  664.   i,c: integer;
  665.   r,n: TTreeNode;
  666.   cn,dn: string;
  667.   pi: PInteger;
  668.   ldc: TDeviceClass;
  669. begin
  670.   with SysInfo, Devices, Tree,Items do begin
  671.     c:=DeviceCount-1;
  672.     BeginUpdate;
  673.     while Count>0 do begin
  674.       if Assigned(Items[Count-1].Data) then
  675.         FreeMem(Items[Count-1].Data);
  676.       Delete(Items[Count-1]);
  677.     end;
  678.     r:=Add(nil,GetMachine);
  679.     r.ImageIndex:=0;
  680.     r.SelectedIndex:=r.ImageIndex;
  681.     n:=nil;
  682.     for i:=0 to c do begin
  683.       if Trim(Devices[i].ClassDesc)<>'' then
  684.         cn:=Devices[i].ClassDesc
  685.       else
  686.         cn:=Devices[i].ClassName;
  687.       if not Assigned(n) or (Devices[i].DeviceClass<>ldc) then begin
  688.         ldc:=Devices[i].DeviceClass;
  689.         n:=AddChild(r,cn);
  690.         n.ImageIndex:=cDeviceImageIndex[Devices[i].DeviceClass];
  691.         n.SelectedIndex:=n.ImageIndex;
  692.       end;
  693.       if Trim(Devices[i].FriendlyName)='' then
  694.         dn:=Devices[i].Description
  695.       else
  696.         dn:=Devices[i].FriendlyName;
  697.       with AddChild(n,dn) do begin
  698.         ImageIndex:=n.ImageIndex;
  699.         SelectedIndex:=ImageIndex;
  700.         new(pi);
  701.         pi^:=i;
  702.         Data:=pi;
  703.       end;
  704.       n.AlphaSort;
  705.     end;
  706.     r.AlphaSort;
  707.     r.Expand(False);
  708.     EndUpdate;
  709.   end;
  710. end;
  711.  
  712. procedure TfrmMSI_Overview.GetEngInfo;
  713. var
  714.   i: integer;
  715. begin
  716.   with SysInfo.Engines do begin
  717.     if ODBC<>'' then
  718.       lODBC.caption:='Open Database Connectivity '+ODBC
  719.     else
  720.       lODBC.caption:='Open Database Connectivity not found';
  721.     if BDE<>'' then
  722.       lBDE.caption:='Borland Database Engine '+BDE
  723.     else
  724.       lBDE.caption:='Borland Database Engine not found';
  725.     if DAO<>'' then
  726.       lDAO.caption:='Microsoft Data Access Objects '+DAO
  727.     else
  728.       lDAO.caption:='Microsoft Data Access Objects not found';
  729.     if ADO<>'' then
  730.       lADO.caption:='Microsoft ActiveX Data Objects '+ADO
  731.     else
  732.       lADO.caption:='Microsoft ActiveX Data Objects not found';
  733.   end;
  734.   with SysInfo.DirectX do begin
  735.     if Version<>'' then begin
  736.       lDirectX.caption:='Installed version: '+Version;
  737.       lvDirectX.Items.beginUpdate;
  738.       lvDirectX.items.clear;
  739.       for i:=0 to Direct3D.count-1 do
  740.         with lvDirectX.items.add do begin
  741.           caption:=Direct3D[i];
  742.           SubItems.Add('Direct3D');
  743.           ImageIndex:=iiDirectX;
  744.         end;
  745.       for i:=0 to DirectMusic.count-1 do
  746.         with lvDirectX.items.add do begin
  747.           caption:=DirectMusic[i];
  748.           SubItems.Add('DirectMusic');
  749.           ImageIndex:=iiDirectX;
  750.         end;
  751.       for i:=0 to DirectPlay.count-1 do
  752.         with lvDirectX.items.add do begin
  753.           caption:=DirectPlay[i];
  754.           SubItems.Add('DirectPlay');
  755.           ImageIndex:=iiDirectX;
  756.         end;
  757.       lvDirectX.Items.endUpdate;
  758.     end else
  759.       lDirectX.caption:='Not installed.';
  760.   end;
  761. end;
  762.  
  763. procedure TfrmMSI_Overview.GetDriveInfo;
  764. var
  765.   i,j :integer;
  766.   s :string;
  767. begin
  768.   j:=0;
  769.   with SysInfo.Disk do begin
  770.     cbDrive.items.clear;
  771.     for i:=1 to length(AvailableDisks) do begin
  772.       s:=uppercase(copy(AvailableDisks,i,1));
  773.       cbDrive.items.add(s+':');
  774.       if s=uppercase(copy(SysInfo.OS.Folders.Values['Windows'],1,1)) then
  775.         j:=i-1;
  776.     end;
  777.     cbDrive.itemindex:=j;
  778.     cbDriveChange(nil);
  779.   end;
  780. end;
  781.  
  782. procedure TfrmMSI_Overview.GetInfo;
  783. begin
  784.   screen.cursor:=crhourglass;
  785.   try
  786.     if pgWksta in DisplayedPages then
  787.       GetWkstaInfo;
  788.     if pgOS in DisplayedPages then
  789.       GetOSInfo;
  790.     if pgCPU in DisplayedPages then
  791.       GetCPUInfo;
  792.     if pgMem in DisplayedPages then
  793.       GetMemoryInfo;
  794.     if pgDisplay in DisplayedPages then
  795.       GetDisplayInfo;
  796.     if pgAPM in DisplayedPages then
  797.       GetAPMInfo;
  798.     if pgMedia in DisplayedPages then
  799.       GetMediaInfo;
  800.     if pgNet in DisplayedPages then
  801.       GetNetInfo;
  802.     if pgDev in DisplayedPages then
  803.       GetDeviceInfo;
  804.     if pgEng in DisplayedPages then
  805.       GetEngInfo;
  806.     if pgDisk in DisplayedPages then
  807.       GetDriveInfo;
  808.     if pgTZ in DisplayedPages then
  809.       GetTZInfo;
  810.     if pgProcs in DisplayedPages then
  811.       GetProcInfo;
  812.     if pgPrn in DisplayedPages then
  813.       GetPrintInfo;
  814.     if pgStartup in DisplayedPages then
  815.       GetStartupInfo;
  816.     if pgSoftware in DisplayedPages then
  817.       GetSWInfo;
  818.   finally
  819.     screen.cursor:=crdefault;
  820.   end;
  821. end;
  822.  
  823. procedure TfrmMSI_Overview.FormCreate(Sender: TObject);
  824. begin
  825.   Report:=TStringList.Create;
  826.   DisplayedPages:=pgAll;
  827.   pc.activepage:=tsWksta;
  828.   pcCPU.ActivePage:=tsID;
  829.   lTitle.Caption:=cCompName;
  830.   lVer.Caption:='Version '+cVersion;
  831.   FooterPanel.Caption:=cCopyright;
  832. end;
  833.  
  834. procedure TfrmMSI_Overview.cmRefresh(Sender: TObject);
  835. begin
  836.   screen.cursor:=crhourglass;
  837.   try
  838.     SysInfo.Refresh;
  839.     GetInfo;
  840.   finally
  841.     screen.cursor:=crdefault;
  842.   end;
  843. end;
  844.  
  845. procedure TfrmMSI_Overview.cmClose(Sender: TObject);
  846. begin
  847.   close;
  848. end;
  849.  
  850. procedure TfrmMSI_Overview.cmEnvironment(Sender: TObject);
  851. var
  852.   i: integer;
  853. begin
  854.   with TdlgMSI_Detail.Create(Self) do begin
  855.     Notebook.pageindex:=3;
  856.     TitlePanel.Caption:='Environment';
  857.     for i:=0 to SysInfo.OS.Environment.Count-1 do
  858.       with lv.Items.Add do begin
  859.         Caption:=SysInfo.OS.Environment.Names[i];
  860.         SubItems.Add(SysInfo.OS.Environment.Values[SysInfo.OS.Environment.Names[i]]);
  861.       end;
  862.     showmodal;
  863.     free;
  864.   end;
  865. end;
  866.  
  867. procedure TfrmMSI_Overview.cmCaps(Sender: TObject);
  868. var
  869.   i :integer;
  870.   sl :TStringList;
  871. begin
  872.   with TdlgMSI_Detail.Create(self) do begin
  873.     Notebook.pageindex:=1;
  874.     sl:=TStringList.Create;
  875.     case TComponent(sender).tag of
  876.       0: begin
  877.         TitlePanel.Caption:='Curve Capabilities';
  878.         SysInfo.Display.Report_CurveCaps(sl);
  879.       end;
  880.       1: begin
  881.         TitlePanel.Caption:='Line Capabilities';
  882.         SysInfo.Display.Report_LineCaps(sl);
  883.       end;
  884.       2: begin
  885.         TitlePanel.Caption:='Polygonal Capabilities';
  886.         SysInfo.Display.Report_PolygonCaps(sl);
  887.       end;
  888.       3: begin
  889.         TitlePanel.Caption:='Raster Capabilities';
  890.         SysInfo.Display.Report_RasterCaps(sl);
  891.       end;
  892.       4: begin
  893.         TitlePanel.Caption:='Text Capabilities';
  894.         SysInfo.Display.Report_TextCaps(sl);
  895.       end;
  896.     end;
  897.     clb.items.clear;
  898.     for i:=1 to sl.count-1 do begin
  899.       clb.items.Add(sl.Names[i]);
  900.       clb.Checked[clb.items.count-1]:=Boolean(StrToInt(sl.Values[sl.Names[i]]));
  901.     end;
  902.     sl.free;
  903.     showmodal;
  904.     free;
  905.   end;
  906. end;
  907.  
  908. procedure TfrmMSI_Overview.cmPrintSetup(Sender: TObject);
  909. begin
  910.   psd.execute;
  911. end;
  912.  
  913.  
  914. procedure TfrmMSI_Overview.cbDriveChange(Sender: TObject);
  915. var
  916.   p,i :Word;
  917.   b :pchar;
  918.   sl :TStringList;
  919. begin
  920.   with SysInfo.Disk do begin
  921.     gdisk.progress:=0;
  922.     b:=stralloc(255);
  923.     p:=0;
  924.     Drive:=copy(cbDrive.text,1,2);
  925.     strpcopy(b,Drive+'\');
  926.     lDriveType.caption:=GetMediaTypeStr(MediaType)+' - '+FileSystem;
  927.     if MediaPresent then
  928.       imgDrive.picture.icon.handle:=extractassociatedicon(hinstance,b,p)
  929.     else
  930.       imgDrive.picture.icon.handle:=0;
  931.     strdispose(b);
  932.     eUNC.text:=expanduncfilename(Drive);
  933.     eDSN.text:=SerialNumber;
  934.     if pos('[',cbdrive.items[cbdrive.itemindex])=0 then begin
  935.       i:=cbdrive.itemindex;
  936.       cbdrive.items[i]:=cbdrive.items[i]+' ['+VolumeLabel+']';
  937.       cbdrive.itemindex:=i;
  938.     end;
  939.     {$IFDEF D4PLUS}
  940.     lCapacity.caption:=formatfloat('Capacity: #,#0 B',Capacity);
  941.     lFree.caption:=formatfloat('Free space: #,#0 B',FreeSpace);
  942.     try
  943.       gDisk.Progress:=round((Capacity-FreeSpace)/Capacity*100);
  944.     except
  945.     end;
  946.     {$ELSE}
  947.     lCapacity.caption:=formatfloat('Capacity: #,#0 B',Capacity.QuadPart);
  948.     lFree.caption:=formatfloat('Free space: #,#0 B',FreeSpace.QuadPart);
  949.     try
  950.       gDisk.Progress:=round((Capacity.QuadPart-FreeSpace.QuadPart)/Capacity.QuadPart*100);
  951.     except
  952.       gDisk.Progress:=0;
  953.     end;
  954.     {$ENDIF}
  955.     lBPS.caption:=formatfloat('Bytes/sector: 0',BytesPerSector);
  956.     lSPC.caption:=formatfloat('Sector/cluster: 0',SectorsPerCluster);
  957.     lFC.caption:=formatfloat('Free clusters: #,#0',FreeClusters);
  958.     lTC.caption:=formatfloat('Total clusters: #,#0',TotalClusters);
  959.     sl:=TStringList.Create;
  960.     Report_FileFlags(sl);
  961.     clbFlags.items.Clear;
  962.     for i:=1 to sl.count-1 do begin
  963.       clbFlags.items.Add(sl.Names[i]);
  964.       clbFlags.Checked[clbFlags.items.count-1]:=Boolean(StrToInt(sl.Values[sl.Names[i]]));
  965.     end;
  966.     sl.Free;
  967.   end;
  968. end;
  969.  
  970. procedure TfrmMSI_Overview.cmReportClick(Sender: TObject);
  971. var
  972.   p :tpoint;
  973. begin
  974.   p.y:=twincontrol(sender).top+twincontrol(sender).height;
  975.   p.x:=twincontrol(sender).left;
  976.   p:=twincontrol(sender).parent.clienttoscreen(p);
  977.   ReportMenu.Popup(p.x,p.y);
  978. end;
  979.  
  980. procedure TfrmMSI_Overview.cmReportAll(Sender: TObject);
  981. begin
  982.   Report.Clear;
  983.   sd.filename:='SystemInfo.txt';
  984.   if sd.execute then begin
  985.     SysInfo.Report(Report);
  986.     Report.savetofile(sd.filename);
  987.   end;
  988. end;
  989.  
  990. procedure TfrmMSI_Overview.cmReportCurrent(Sender: TObject);
  991. begin
  992.   Report.Clear;
  993.   sd.filename:=Trim(pc.ActivePage.Caption)+'.txt';
  994.   if sd.execute then begin
  995.     case pc.activepage.pageindex of
  996.       0: SysInfo.Machine.Report(Report);
  997.       1: SysInfo.OS.Report(Report);
  998.       2: SysInfo.CPU.Report(Report);
  999.       3: SysInfo.Memory.Report(Report);
  1000.       4: SysInfo.Display.Report(Report);
  1001.       5: SysInfo.APM.Report(Report);
  1002.       6: SysInfo.Media.Report(Report);
  1003.       7: SysInfo.Network.Report(Report);
  1004.       8: SysInfo.Devices.Report(Report);
  1005.       9: SysInfo.Printers.Report(Report);
  1006.       10: SysInfo.Engines.Report(Report);
  1007.       11: SysInfo.Disk.Report(Report);
  1008.       12: SysInfo.OS.TimeZone.Report(Report);
  1009.       13: SysInfo.Processes.Report(Report);
  1010.       14: SysInfo.Startup.Report(Report);
  1011.       15: SysInfo.Software.Report(Report);
  1012.     end;
  1013.     Report.savetofile(sd.filename);
  1014.   end;
  1015. end;
  1016.  
  1017. procedure TfrmMSI_Overview.clbClickCheck(Sender: TObject);
  1018. var
  1019.   OCC: TNotifyEvent;
  1020.   idx: integer;
  1021.   p: TPoint;
  1022. begin
  1023.   with TCheckListBox(Sender) do begin
  1024.     OCC:=OnClickCheck;
  1025.     OnClickCheck:=nil;
  1026.     GetCursorPos(p);
  1027.     p:=ScreenToClient(p);
  1028.     idx:=ItemAtPos(p,True);
  1029.     if idx>-1 then
  1030.       Checked[idx]:=not Checked[idx];
  1031.     OnClickCheck:=OCC;
  1032.   end;
  1033. end;
  1034.  
  1035. procedure TfrmMSI_Overview.SetPages(const Value: TPages);
  1036. var
  1037.   i: integer;
  1038. begin
  1039.   FPages:=Value;
  1040.   for i:=pc.PageCount-1 downto 0 do begin
  1041.     pc.Pages[i].TabVisible:=TPage(i) in DisplayedPages;
  1042.     if pc.Pages[i].TabVisible then
  1043.       pc.ActivePage:=pc.Pages[i];
  1044.   end;
  1045. end;
  1046.  
  1047. procedure TfrmMSI_Overview.SetShowRepBut(const Value: Boolean);
  1048. begin
  1049.   FShowRepBut:=Value;
  1050.   bReport.Visible:=FShowRepBut;
  1051. end;
  1052.  
  1053. procedure TfrmMSI_Overview.cmModes(Sender: TObject);
  1054. var
  1055.   i: integer;
  1056. begin
  1057.   with TdlgMSI_Detail.Create(self) do begin
  1058.     Notebook.pageindex:=1;
  1059.     clb.items.clear;
  1060.     clb.Items.AddStrings(SysInfo.Display.Modes);
  1061.     for i:=0 to clb.Items.Count-1 do
  1062.       clb.Checked[i]:=True;
  1063.     TitlePanel.Caption:='Supported Video Modes';
  1064.     showmodal;
  1065.     free;
  1066.   end;
  1067. end;
  1068.  
  1069. procedure TfrmMSI_Overview.GetTZInfo;
  1070. begin
  1071.   with SysInfo.OS.TimeZone do begin
  1072.     eTZ.Text:=DisplayName;
  1073.     gbStd.Caption:=' '+StandardName+' ';
  1074.     gbDay.Caption:=' '+DaylightName+' ';
  1075.     eStdStart.Text:=DateTimeToStr(StandardStart);
  1076.     eStdBias.Text:=IntToStr(StandardBias);
  1077.     eDayStart.Text:=DateTimeToStr(DaylightStart);
  1078.     eDayBias.Text:=IntToStr(DaylightBias);
  1079.   end;
  1080. end;
  1081.  
  1082. procedure TfrmMSI_Overview.cmProto(Sender: TObject);
  1083. var
  1084.   i: integer;
  1085. begin
  1086.   with TdlgMSI_Detail.Create(self) do begin
  1087.     Notebook.pageindex:=1;
  1088.     clb.items.clear;
  1089.     clb.Items.AddStrings(SysInfo.Network.Protocols);
  1090.     for i:=0 to clb.Items.Count-1 do
  1091.       clb.Checked[i]:=True;
  1092.     TitlePanel.Caption:='Protocols';
  1093.     showmodal;
  1094.     free;
  1095.   end;
  1096. end;
  1097.  
  1098. procedure TfrmMSI_Overview.cmServ(Sender: TObject);
  1099. var
  1100.   i: integer;
  1101. begin
  1102.   with TdlgMSI_Detail.Create(self) do begin
  1103.     Notebook.pageindex:=1;
  1104.     clb.items.clear;
  1105.     clb.Items.AddStrings(SysInfo.Network.Services);
  1106.     for i:=0 to clb.Items.Count-1 do
  1107.       clb.Checked[i]:=True;
  1108.     TitlePanel.Caption:='Services';
  1109.     showmodal;
  1110.     free;
  1111.   end;
  1112. end;
  1113.  
  1114. procedure TfrmMSI_Overview.cmCli(Sender: TObject);
  1115. var
  1116.   i: integer;
  1117. begin
  1118.   with TdlgMSI_Detail.Create(self) do begin
  1119.     Notebook.pageindex:=1;
  1120.     clb.items.clear;
  1121.     clb.Items.AddStrings(SysInfo.Network.Clients);
  1122.     for i:=0 to clb.Items.Count-1 do
  1123.       clb.Checked[i]:=True;
  1124.     TitlePanel.Caption:='Clients';
  1125.     showmodal;
  1126.     free;
  1127.   end;
  1128. end;
  1129.  
  1130. procedure TfrmMSI_Overview.SetCaptionText(const Value: string);
  1131. begin
  1132.   Caption:=Value;
  1133. end;
  1134.  
  1135. procedure TfrmMSI_Overview.FormClose(Sender: TObject; var Action: TCloseAction);
  1136. begin
  1137.   Action:=caFree;
  1138. end;
  1139.  
  1140. procedure TfrmMSI_Overview.TreeChange(Sender: TObject; Node: TTreeNode);
  1141. begin
  1142.   bProps.Enabled:=Assigned(Node) and (Node.Level=2);
  1143. end;
  1144.  
  1145. procedure TfrmMSI_Overview.cmProps(Sender: TObject);
  1146. var
  1147.   dr: TDevice;
  1148.   i: integer;
  1149. begin
  1150.   if Assigned(Tree.Selected) and (Tree.Selected.Level=2) then
  1151.     with TdlgMSI_Detail.Create(self) do begin
  1152.       Notebook.pageindex:=3;
  1153.       lv.items.clear;
  1154.       i:=PInteger(Tree.Selected.Data)^;
  1155.       dr:=SysInfo.Devices.Devices[i];
  1156.       with lv.Items.Add do begin
  1157.         Caption:='Device Name';
  1158.         Subitems.Add(Tree.Selected.Text);
  1159.       end;
  1160.       with lv.Items.Add do begin
  1161.         Caption:='Class Name';
  1162.         Subitems.Add(dr.ClassName);
  1163.       end;
  1164.       with lv.Items.Add do begin
  1165.         Caption:='Class Description';
  1166.         Subitems.Add(Tree.Selected.Parent.Text);
  1167.       end;
  1168.       with lv.Items.Add do begin
  1169.         Caption:='Class GUID';
  1170.         Subitems.Add(dr.GUID);
  1171.       end;
  1172.       with lv.Items.Add do begin
  1173.         Caption:='Manufacturer';
  1174.         Subitems.Add(dr.Manufacturer);
  1175.       end;
  1176.       with lv.Items.Add do begin
  1177.         Caption:='Location';
  1178.         SubItems.Add(dr.Location);
  1179.       end;
  1180.       with lv.Items.Add do begin
  1181.         Caption:='HardwareID';
  1182.         Subitems.Add(dr.HardwareID);
  1183.       end;
  1184.       with lv.Items.Add do begin
  1185.         Caption:='Driver Version';
  1186.         SubItems.Add(dr.DriverVersion);
  1187.       end;
  1188.       with lv.Items.Add do begin
  1189.         Caption:='Driver Date';
  1190.         SubItems.Add(dr.DriverDate);
  1191.       end;
  1192.       with lv.Items.Add do begin
  1193.         Caption:='Driver Provider';
  1194.         SubItems.Add(dr.DriverProvider);
  1195.       end;
  1196.       with lv.Items.Add do begin
  1197.         Caption:='Service Name';
  1198.         if dr.ServiceName='' then
  1199.           SubItems.Add(dr.Service)
  1200.         else
  1201.           SubItems.Add(dr.ServiceName);
  1202.       end;
  1203.       with lv.Items.Add do begin
  1204.         Caption:='Service Group';
  1205.         SubItems.Add(dr.ServiceGroup);
  1206.       end;
  1207.       TitlePanel.Caption:='Device Properties';
  1208.       showmodal;
  1209.       free;
  1210.     end;
  1211. end;
  1212.  
  1213. procedure TfrmMSI_Overview.cmMail(Sender: TObject);
  1214. begin
  1215.   ShellExecute(handle,'open',
  1216.                'mailto:michal.mutl@atlas.cz?subject='+cCompName,
  1217.                nil,nil,SW_NORMAL);
  1218. end;
  1219.  
  1220. procedure TfrmMSI_Overview.GetProcInfo;
  1221. var
  1222.   i,n :integer;
  1223.   pid: DWORD;
  1224. begin
  1225.   with SysInfo.Processes do begin
  1226.     lvProcs.Items.Clear;
  1227.     n:=ProcessCount-1;
  1228.     for i:=0 to n do
  1229.       with lvProcs.Items.Add do begin
  1230.         pid:=GetPIDFromProcessName(ProcessNames[i]);
  1231.         if IsNT then
  1232.           Caption:=Format('%d',[pid])
  1233.         else
  1234.           Caption:=Format('0x%x',[pid]);
  1235.         SubItems.Add(ExtractFilename(ProcessNames[i]));
  1236.         SubItems.Add(ExtractFilepath(ProcessNames[i]));
  1237.         ImageIndex:=iiProcess;
  1238.       end;
  1239.     ProcPanel.Caption:=Format('  %d processes',[ProcessCount]);
  1240.   end;
  1241. end;
  1242.  
  1243. procedure TfrmMSI_Overview.cmTerminate(Sender: TObject);
  1244. const
  1245.   SWARN = 'WARNING: Terminating a process can cause undesired '#13#10+
  1246.                     'results including loss of data and system instability. The '#13#10+
  1247.                     'process will not be given the chance to save its state or '#13#10+
  1248.                     'data before it is terminated. Are you sure you want to '#13#10+
  1249.                     'terminate the process?';
  1250.   SCannotTerm = 'Cannot terminate this process.';
  1251. var
  1252.   pid: DWORD;
  1253.   ph: THandle;
  1254. begin
  1255.   if Assigned(lvProcs.Selected) then begin
  1256.     if IsNT then
  1257.       pid:=StrToInt(lvProcs.Selected.Caption)
  1258.     else
  1259.       pid:=StrToInt('$'+Copy(lvProcs.Selected.Caption,3,255));
  1260.     if (MessageDlg(lvProcs.Selected.SubItems[0]+#13#10#13#10+SWARN,mtWarning,[mbYes,mbNo],0)=mryes) then begin
  1261.       ph:=OpenProcess(PROCESS_TERMINATE,False,pid);
  1262.       if ph<>0 then begin
  1263.         TerminateProcess(ph,0);
  1264.         CloseHandle(ph);
  1265.         lvProcs.Selected.Delete;
  1266.       end else
  1267.         MessageDlg(SCannotTerm,mtWarning,[mbOK],0);
  1268.     end;
  1269.   end;
  1270. end;
  1271.  
  1272. procedure TfrmMSI_Overview.cmProcProps(Sender: TObject);
  1273. begin
  1274.   if Assigned(lvProcs.Selected) and FileExists(lvProcs.Selected.SubItems[1]+lvProcs.Selected.SubItems[0]) then
  1275.     DisplayPropDialog(Handle,lvProcs.Selected.SubItems[1]+lvProcs.Selected.SubItems[0]);
  1276. end;
  1277.  
  1278. procedure TfrmMSI_Overview.GetPrintInfo;
  1279. var
  1280.   i: integer;
  1281. begin
  1282.   with SysInfo.Printers do begin
  1283.     lvPrinter.items.clear;
  1284.     for i:=0 to Names.count-1 do
  1285.       with lvPrinter.items.add do begin
  1286.         caption:=Names[i];
  1287.         SubItems.Add(Ports[i]);
  1288.         if Pos('\\',Ports[i])>0 then
  1289.           ImageIndex:=iiNetPrinter
  1290.         else
  1291.           ImageIndex:=iiPrinter;
  1292.         if i=DefaultIndex then
  1293.           ImageIndex:=ImageIndex+1;
  1294.       end;
  1295.   end;
  1296. end;
  1297.  
  1298. procedure TfrmMSI_Overview.tcStartupChange(Sender: TObject);
  1299. var
  1300.   i,n: integer;
  1301. begin
  1302.   with SysInfo.Startup, lvStartup, Items do begin
  1303.     BeginUpdate;
  1304.     Clear;
  1305.     case tcStartup.TabIndex of
  1306.       0: begin
  1307.         n:=User_Count-1;
  1308.         for i:=0 to n do
  1309.           with Add do begin
  1310.             Caption:=User_Runs[i];
  1311.             SubItems.Add(GetRunCommand(rtUser,i));
  1312.             ImageIndex:=iiProcess;
  1313.           end;
  1314.       end;
  1315.       1: begin
  1316.         n:=Common_Count-1;
  1317.         for i:=0 to n do
  1318.           with Add do begin
  1319.             Caption:=Common_Runs[i];
  1320.             SubItems.Add(GetRunCommand(rtCommon,i));
  1321.             ImageIndex:=iiProcess;
  1322.           end;
  1323.       end;
  1324.       2: begin
  1325.         n:=HKLM_Count-1;
  1326.         for i:=0 to n do
  1327.           with Add do begin
  1328.             Caption:=HKLM_Runs[i];
  1329.             SubItems.Add(GetRunCommand(rtHKLM,i));
  1330.             ImageIndex:=iiProcess;
  1331.           end;
  1332.       end;
  1333.       3: begin
  1334.         n:=HKCU_Count-1;
  1335.         for i:=0 to n do
  1336.           with Add do begin
  1337.             Caption:=HKCU_Runs[i];
  1338.             SubItems.Add(GetRunCommand(rtHKCU,i));
  1339.             ImageIndex:=iiProcess;
  1340.           end;
  1341.       end;
  1342.       4: begin
  1343.         n:=Once_Count-1;
  1344.         for i:=0 to n do
  1345.           with Add do begin
  1346.             Caption:=Once_Runs[i];
  1347.             SubItems.Add(GetRunCommand(rtOnce,i));
  1348.             ImageIndex:=iiProcess;
  1349.           end;
  1350.       end;
  1351.       5: begin
  1352.         n:=WININI_Count-1;
  1353.         for i:=0 to n do
  1354.           with Add do begin
  1355.             Caption:=WININI_Runs[i];
  1356.             SubItems.Add(GetRunCommand(rtWININI,i));
  1357.             ImageIndex:=iiProcess;
  1358.           end;
  1359.       end;
  1360.     end;
  1361.     EndUpdate;
  1362.   end;
  1363. end;
  1364.  
  1365. procedure TfrmMSI_Overview.GetStartupInfo;
  1366. begin
  1367.   tcStartupChange(tcStartup);
  1368. end;
  1369.  
  1370. procedure TfrmMSI_Overview.GetSWInfo;
  1371. var
  1372.   i: integer;
  1373. begin
  1374.   with SysInfo.Software, lvSW, Items do begin
  1375.     BeginUpdate;
  1376.     Clear;
  1377.     for i:=0 to Installed.Count-1 do
  1378.       with Add do begin
  1379.         Caption:=Installed[i];
  1380.         ImageIndex:=iiPackage;
  1381.       end;
  1382.     EndUpdate;
  1383.   end;
  1384. end;
  1385.  
  1386. procedure TfrmMSI_Overview.cmNTSpec(Sender: TObject);
  1387. var
  1388.   sl: TStringList;
  1389.   i: integer;
  1390. begin
  1391.   with TdlgMSI_Detail.Create(self) do begin
  1392.     Notebook.pageindex:=1;
  1393.     TitlePanel.Caption:='Installed Suites';
  1394.     clb.items.clear;
  1395.     sl:=TStringList.Create;
  1396.     SysInfo.OS.NTSpecific.Report_InstalledSuites(sl);
  1397.     for i:=0 to sl.count-1 do begin
  1398.       clb.items.Add(sl.Names[i]);
  1399.       clb.Checked[clb.items.count-1]:=Boolean(StrToInt(sl.Values[sl.Names[i]]));
  1400.     end;
  1401.     sl.Free;
  1402.     showmodal;
  1403.     free;
  1404.   end;
  1405. end;
  1406.  
  1407. end.
  1408.