Archived
1
0

Initial Revision

This commit is contained in:
mbirth 2004-12-08 09:47:52 +00:00
commit c9160d9591
9 changed files with 1253 additions and 0 deletions

38
Analyzer.cfg Normal file
View File

@ -0,0 +1,38 @@
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$Y+
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl"
-w-UNSAFE_TYPE
-w-UNSAFE_CODE
-w-UNSAFE_CAST

139
Analyzer.dof Normal file
View File

@ -0,0 +1,139 @@
[FileVersion]
Version=7.0
[Compiler]
A=8
B=0
C=1
D=1
E=0
F=0
G=1
H=1
I=1
J=0
K=0
L=1
M=0
N=1
O=1
P=1
Q=0
R=0
S=0
T=0
U=0
V=1
W=0
X=1
Y=2
Z=1
ShowHints=1
ShowWarnings=1
UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
NamespacePrefix=
SymbolDeprecated=1
SymbolLibrary=1
SymbolPlatform=1
UnitLibrary=1
UnitPlatform=1
UnitDeprecated=1
HResultCompat=1
HidingMember=1
HiddenVirtual=1
Garbage=1
BoundsError=1
ZeroNilCompat=1
StringConstTruncated=1
ForLoopVarVarPar=1
TypedConstVarPar=1
AsgToTypedConst=1
CaseLabelRange=1
ForVariable=1
ConstructingAbstract=1
ComparisonFalse=1
ComparisonTrue=1
ComparingSignedUnsigned=1
CombiningSignedUnsigned=1
UnsupportedConstruct=1
FileOpen=1
FileOpenUnitSrc=1
BadGlobalSymbol=1
DuplicateConstructorDestructor=1
InvalidDirective=1
PackageNoLink=1
PackageThreadVar=1
ImplicitImport=1
HPPEMITIgnored=1
NoRetVal=1
UseBeforeDef=1
ForLoopVarUndef=1
UnitNameMismatch=1
NoCFGFileFound=1
MessageDirective=1
ImplicitVariants=1
UnicodeToLocale=1
LocaleToUnicode=1
ImagebaseMultiple=1
SuspiciousTypecast=1
PrivatePropAccessor=1
UnsafeType=0
UnsafeCode=0
UnsafeCast=0
[Linker]
MapFile=0
OutputObjs=0
ConsoleApp=1
DebugInfo=0
RemoteSymbols=0
MinStackSize=16384
MaxStackSize=1048576
ImageBase=4194304
ExeDescription=SONY VAIO 0x57 Analyzer
[Directories]
OutputDir=
UnitOutputDir=
PackageDLLOutputDir=
PackageDCPOutputDir=
SearchPath=
Packages=vcl;dclOfficeXP;vcldb;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;vclactnband;dclusr;adortl
Conditionals=
DebugSourceDirs=
UsePackages=0
[Parameters]
RunParams=
HostApplication=
Launcher=
UseLauncher=0
DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=C:\Program Files\Borland\Delphi7\Bin\
[Version Info]
IncludeVerInfo=1
AutoIncBuild=1
MajorVer=1
MinorVer=0
Release=0
Build=2
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=1033
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=Parses SONY VAIO security eeprom dump and extracts some interesting information.
FileVersion=1.0.0.2
InternalName=Analyzer
LegalCopyright=
LegalTrademarks=
OriginalFilename=Analyzer.exe
ProductName=SONY VAIO 0x57 Analyzer
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlUnitAliases]
Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;

14
Analyzer.dpr Normal file
View File

@ -0,0 +1,14 @@
program Analyzer;
uses
Forms,
AnalyzerU in 'AnalyzerU.pas' {AForm};
{$R *.res}
begin
Application.Initialize;
Application.Title := 'SONY VAIO 0x57 Analyzer';
Application.CreateForm(TAForm, AForm);
Application.Run;
end.

558
AnalyzerU.dfm Normal file
View File

@ -0,0 +1,558 @@
object AForm: TAForm
Left = 192
Top = 107
Width = 517
Height = 407
Caption = 'SONY VAIO 0x57 Analyzer'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object LabelHeading: TLabel
Left = 8
Top = 8
Width = 321
Height = 29
Caption = 'SONY VAIO 0x57 Analyzer'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlue
Font.Height = -24
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold, fsItalic]
ParentFont = False
Transparent = True
end
object ButtonOpen: TButton
Left = 368
Top = 8
Width = 129
Height = 25
Caption = 'Open dump...'
TabOrder = 0
OnClick = ButtonOpenClick
end
object PageControl1: TPageControl
Left = 8
Top = 48
Width = 497
Height = 329
ActivePage = SheetSMBus
TabOrder = 1
object SheetParsed: TTabSheet
Caption = 'Parsed info'
object GroupBox1: TGroupBox
Left = 8
Top = 0
Width = 417
Height = 89
Caption = 'Password'
TabOrder = 0
object Label3: TLabel
Left = 9
Top = 28
Width = 79
Height = 13
Caption = 'Encrypted bytes:'
end
object Label4: TLabel
Left = 37
Top = 51
Width = 49
Height = 13
Caption = 'Password:'
end
object LabelPwdAsk: TLabel
Left = 8
Top = 72
Width = 401
Height = 13
Alignment = taCenter
AutoSize = False
Caption = 'Ask for password at startup'
Enabled = False
end
object LabelPwdSetM: TLabel
Left = 88
Top = 11
Width = 153
Height = 13
Alignment = taCenter
AutoSize = False
Caption = 'Machine password'
Enabled = False
end
object LabelPwdSetU: TLabel
Left = 256
Top = 11
Width = 153
Height = 13
Alignment = taCenter
AutoSize = False
Caption = 'User password'
Enabled = False
end
object EditPwdEncM: TEdit
Left = 88
Top = 24
Width = 153
Height = 22
Enabled = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 0
Text = '00 00 00 00 00 00 00'
end
object EditPwdM: TEdit
Left = 88
Top = 48
Width = 57
Height = 22
Enabled = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
ReadOnly = True
TabOrder = 1
Text = '.......'
end
object EditPwdEncU: TEdit
Left = 256
Top = 24
Width = 153
Height = 22
Enabled = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 2
Text = '00 00 00 00 00 00 00'
end
object EditPwdU: TEdit
Left = 256
Top = 48
Width = 57
Height = 22
Enabled = False
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = [fsBold]
ParentFont = False
ReadOnly = True
TabOrder = 3
Text = '.......'
end
end
object GroupBox2: TGroupBox
Left = 8
Top = 96
Width = 281
Height = 65
Caption = 'UUID'
TabOrder = 1
object Label5: TLabel
Left = 9
Top = 44
Width = 69
Height = 13
Caption = 'Ethernet MAC:'
end
object EditUUID: TEdit
Left = 8
Top = 16
Width = 265
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 0
Text = '........-....-....-....-............'
end
object EditMAC: TEdit
Left = 80
Top = 40
Width = 129
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 1
Text = '00:00:00:00:00:00'
end
end
object GroupBox3: TGroupBox
Left = 304
Top = 96
Width = 137
Height = 65
Caption = 'OEM Info'
TabOrder = 2
object LabelContinent: TLabel
Left = 8
Top = 40
Width = 121
Height = 13
Alignment = taCenter
AutoSize = False
Caption = '---'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object MemoOEM: TMemo
Left = 8
Top = 16
Width = 121
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
Lines.Strings = (
'................')
ParentFont = False
ReadOnly = True
TabOrder = 0
end
end
object GroupBox4: TGroupBox
Left = 8
Top = 168
Width = 337
Height = 121
Caption = 'Machine'
TabOrder = 3
object Label6: TLabel
Left = 8
Top = 24
Width = 73
Height = 13
Caption = 'Machine name:'
end
object Label7: TLabel
Left = 248
Top = 24
Width = 44
Height = 13
Caption = 'Revision:'
end
object Label8: TLabel
Left = 229
Top = 93
Width = 56
Height = 13
Caption = 'Code: PCG-'
end
object Label9: TLabel
Left = 10
Top = 68
Width = 67
Height = 13
Caption = 'Serial number:'
end
object Label10: TLabel
Left = 9
Top = 91
Width = 73
Height = 13
Caption = 'Date of manuf.:'
end
object LabelCountry: TLabel
Left = 84
Top = 24
Width = 157
Height = 13
Alignment = taRightJustify
AutoSize = False
Caption = '---'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object EditName: TEdit
Left = 8
Top = 40
Width = 233
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 0
Text = '................................'
end
object EditRev: TEdit
Left = 248
Top = 40
Width = 81
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 1
Text = '..........'
end
object Edit4char: TEdit
Left = 288
Top = 88
Width = 41
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 2
Text = '....'
end
object EditSerial: TEdit
Left = 88
Top = 64
Width = 241
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 3
Text = '00000000-0000000................'
end
object EditDateMan: TEdit
Left = 88
Top = 88
Width = 137
Height = 22
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ParentFont = False
ReadOnly = True
TabOrder = 4
Text = '..................'
end
end
end
object SheetRaw: TTabSheet
Caption = 'RAW view'
ImageIndex = 1
object ListRAW: TListBox
Left = 0
Top = 4
Width = 489
Height = 241
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Courier New'
Font.Style = []
ItemHeight = 14
ParentFont = False
TabOrder = 0
end
end
object SheetSMBus: TTabSheet
Caption = 'SMBus'
ImageIndex = 3
object Label1: TLabel
Left = 96
Top = 272
Width = 306
Height = 29
Caption = 'UNDER CONSTRUCTION'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -24
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
object GroupBox5: TGroupBox
Left = 0
Top = 0
Width = 489
Height = 41
Caption = 'PCI Information / SMBus Controller'
TabOrder = 0
object LabelStatus: TLabel
Left = 48
Top = 18
Width = 433
Height = 13
AutoSize = False
Caption = 'Push button to scan PCI bus for SMBus controller.'
end
object ButtonPCIScan: TButton
Left = 8
Top = 16
Width = 33
Height = 17
Caption = 'Scan'
TabOrder = 0
OnClick = ButtonPCIScanClick
end
end
object GroupSMBus: TGroupBox
Left = 0
Top = 56
Width = 489
Height = 105
Caption = 'SMBus'
Enabled = False
TabOrder = 1
object ButtonSMBScan: TButton
Left = 8
Top = 16
Width = 75
Height = 17
Caption = 'Enum SMBus'
Enabled = False
TabOrder = 0
OnClick = ButtonSMBScanClick
end
end
end
object SheetAbout: TTabSheet
Caption = 'About'
ImageIndex = 2
object Label2: TLabel
Left = 56
Top = 248
Width = 377
Height = 41
Alignment = taCenter
AutoSize = False
Caption =
'A BIG *THANKS* goes to Jean Delvare for his collected infos abou' +
't the SONY VAIO EEPROM.'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
WordWrap = True
end
object Label11: TLabel
Left = 80
Top = 280
Width = 327
Height = 13
Caption =
'check out http://www.ensicaen.ismra.fr/~delvare/ for his homepag' +
'e.'
end
object Label12: TLabel
Left = 88
Top = 224
Width = 312
Height = 13
Caption = 'This program was written by Markus Birth <mbirth@webwriters.de>'
Enabled = False
end
object MemoAbout: TMemo
Left = 88
Top = 8
Width = 313
Height = 209
Color = clMenu
Ctl3D = False
Lines.Strings = (
'This program was written after playing around with a SONY '
'VAIO notebook trying to find out the Power On Password.'
''
'After spending lots of hours searching the internet and trying '
'different tricks, I found Jean Delvare'#39's homepage[1] with infos '
'about the format of the data stored in the security eeprom. '
'Jean also wrote the eeprom-module[2] for lm-sensors[3] for '
'Linux. He mentioned that the eeprom is easily accessible via '
'the SMBus interface.'
''
'Since I didn'#39't want to hassle around with reading out the '
'SMBus, I - again - searched the internet and read that there '
'should be a utilty called GETSMBUS.EXE to read out SMBus '
'components included in the DOS-version of HWiNFO[4].'
''
'I downloaded the package, put the GETSMBUS.EXE onto a '
'FAT32-partition, booted from an old Win98-CD (press F5 at '
'CD-ROM-Support-Selection!) and ran GETSMBUS.EXE. It '
'created the 4 files SMBUS34.DAT, SMBUS54.DAT, SMBUS'
'57.DAT and SMBUS69.DAT. From Jean'#39's homepage I knew '
'the address of the security eeprom was 0x57 - so the file '
'SMBUS57.DAT was the one.'
''
'You can use this program to parse the file and extract the '
'interesting information. Also the password is decrypted, just in' +
' '
'case you forgot your machine password.'
''
'Have fun!'
''
''
'[1] http://www.ensicaen.ismra.fr/~delvare/'
'[2] http://www.ensicaen.ismra.fr/~delvare/vaio/'
'[3] http://www.lm-sensors.nu'
'[4] http://www.hwinfo.com')
ParentCtl3D = False
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 0
end
end
end
object OpenDialog1: TOpenDialog
Filter =
'Sony 0x57 dump|SMBUS57.DAT|Other dumps (SMBUS*.DAT)|SMBUS*.DAT|A' +
'll files (*.*)|*.*'
Options = [ofHideReadOnly, ofPathMustExist, ofFileMustExist, ofEnableSizing, ofDontAddToRecent]
Left = 336
Top = 8
end
end

266
AnalyzerU.pas Normal file
View File

@ -0,0 +1,266 @@
unit AnalyzerU;
interface
uses
SysUtils, StdCtrls, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls;
type
TAForm = class(TForm)
LabelHeading: TLabel;
OpenDialog1: TOpenDialog;
ButtonOpen: TButton;
PageControl1: TPageControl;
SheetParsed: TTabSheet;
SheetRaw: TTabSheet;
ListRAW: TListBox;
SheetAbout: TTabSheet;
Label2: TLabel;
GroupBox1: TGroupBox;
EditPwdEncM: TEdit;
Label3: TLabel;
EditPwdM: TEdit;
Label4: TLabel;
LabelPwdAsk: TLabel;
GroupBox2: TGroupBox;
EditUUID: TEdit;
EditMAC: TEdit;
Label5: TLabel;
GroupBox3: TGroupBox;
MemoOEM: TMemo;
LabelContinent: TLabel;
GroupBox4: TGroupBox;
EditName: TEdit;
Label6: TLabel;
EditRev: TEdit;
Edit4char: TEdit;
Label7: TLabel;
Label8: TLabel;
EditSerial: TEdit;
Label9: TLabel;
EditDateMan: TEdit;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
MemoAbout: TMemo;
LabelCountry: TLabel;
EditPwdEncU: TEdit;
EditPwdU: TEdit;
LabelPwdSetM: TLabel;
LabelPwdSetU: TLabel;
SheetSMBus: TTabSheet;
GroupBox5: TGroupBox;
ButtonPCIScan: TButton;
LabelStatus: TLabel;
GroupSMBus: TGroupBox;
ButtonSMBScan: TButton;
Label1: TLabel;
procedure ButtonOpenClick(Sender: TObject);
procedure ButtonPCIScanClick(Sender: TObject);
procedure ButtonSMBScanClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
AForm: TAForm;
implementation
uses SMBus;
var
MyPCI: PCI_Info;
{$R *.dfm}
procedure ShowRAW(x: array of byte);
var i: integer;
tmph, tmpb: string;
begin
tmph := '';
tmpb := '';
for i:=0 to 255 do begin
tmph := tmph + ' ' + IntToHex(x[i], 2);
if (x[i] IN [$20..$FF]) then tmpb := tmpb + Chr(x[i]) else tmpb := tmpb + '.';
if ((i+1) MOD 16 = 0) then begin
AForm.ListRAW.Items.Add(Trim(tmph)+' '+Trim(tmpb));
tmph := '';
tmpb := '';
end;
end;
end;
procedure EDL(o: TLabel; state: boolean);
// Enable/Disable Label
begin
if state then begin
o.Enabled := true;
o.Font.Style := [fsBold];
o.Font.Color := clGreen;
end else begin
o.Enabled := false;
o.Font.Style := [];
o.Font.Color := clBlack;
end;
end;
function GetText(x: array of byte; pf, pt: integer): string;
var i: integer;
begin
Result := '';
for i:=pf to pt do if (x[i]>0) then Result := Result + Chr(x[i]) else Break;
end;
function GetHex(x: array of byte; pf, pt: integer; sep: boolean = true): string;
var i: integer;
begin
Result := '';
for i:=pf to pt do if sep then Result := Result + ' ' + IntToHex(x[i],2) else Result := Result + IntToHex(x[i],2);
Result := Trim(Result);
end;
procedure CheckPwd(x: array of byte);
var i: integer;
tmph: string;
isset: boolean;
begin
// Machine password
isset := false;
tmph := '';
for i:=$00 to $06 do begin
if (x[i]>0) then isset := true;
tmph := tmph + ' ' + IntToHex(x[i], 2);
end;
AForm.EditPwdEncM.Text := Trim(tmph);
AForm.EditPwdEncM.Enabled := isset;
EDL(AForm.LabelPwdSetM, isset);
if isset then begin
tmph := '';
for i:=$00 to $06 do begin
tmph := tmph + Chr((x[i] DIV 2));
end;
AForm.EditPwdM.Text := tmph;
end else AForm.EditPwdM.Text := '.......';
AForm.EditPwdM.Enabled := isset;
// User password
isset := false;
tmph := '';
for i:=$07 to $0d do begin
if (x[i]>0) then isset := true;
tmph := tmph + ' ' + IntToHex(x[i], 2);
end;
AForm.EditPwdEncU.Text := Trim(tmph);
AForm.EditPwdEncU.Enabled := isset;
EDL(AForm.LabelPwdSetU, isset);
if isset then begin
tmph := '';
for i:=$07 to $0d do begin
tmph := tmph + Chr((x[i] DIV 2));
end;
AForm.EditPwdU.Text := tmph;
end else AForm.EditPwdU.Text := '.......';
AForm.EditPwdU.Enabled := isset;
if (x[$0f]=$4E) OR (x[$0f]=$FF) then EDL(AForm.LabelPwdAsk, true) else EDL(AForm.LabelPwdAsk, false);
end;
procedure CheckUUID(x: array of byte);
var i: integer;
tu, tm: string;
begin
tu := GetHex(x, $10, $1f, false);
tm := GetHex(x, $1a, $1f);
tu := Copy(tu,1,8)+'-'+Copy(tu,9,4)+'-'+Copy(tu,13,4)+'-'+Copy(tu,17,4)+'-'+Copy(tu,21,12);
for i:=1 to Length(tm) do if tm[i]=' ' then tm[i]:=':';
AForm.EditUUID.Text := tu;
AForm.EditMAC.Text := tm;
end;
procedure CheckOEM(x: array of byte);
var toem: string;
begin
toem := GetText(x, $20, $2f);
AForm.MemoOEM.Text := toem;
toem := Copy(toem,1,2);
if (toem = 'EU') then AForm.LabelContinent.Caption := 'Europe'
else if (toem = 'UC') then AForm.LabelContinent.Caption := 'North America'
else if (toem = 'JP') then AForm.LabelContinent.Caption := 'Japan'
else AForm.LabelContinent.Caption := '---';
end;
procedure CheckMachine(x: array of byte);
var i: integer;
mn, cc: string;
isin: boolean;
begin
mn := GetText(x, $80, $9f);
AForm.EditName.Text := mn;
AForm.EditRev.Text := GetText(x, $a0, $a9);
AForm.Edit4char.Text := GetText(x, $aa, $ad);
AForm.EditSerial.Text := GetText(x, $c0, $df);
AForm.EditDateMan.Text := GetText(x, $e0, $f2);
cc := '';
isin := false;
for i:=1 to Length(mn) do begin
if (mn[i]=')') then break;
if isin then cc := cc + mn[i];
if (mn[i]='(') then isin := true;
end;
if (cc = 'FR') then AForm.LabelCountry.Caption := 'France'
else if (cc = 'GB') then AForm.LabelCountry.Caption := 'Great Britain'
else if (cc = 'DE') then AForm.LabelCountry.Caption := 'Germany'
else if (cc = 'UC') then AForm.LabelCountry.Caption := 'United States of America'
else if (cc = 'J') then AForm.LabelCountry.Caption := 'Japan'
else AForm.LabelCountry.Caption := '---';
end;
procedure TAForm.ButtonOpenClick(Sender: TObject);
var f: file of byte;
d: array[0..255] of byte;
i: integer;
begin
if OpenDialog1.Execute then begin
AssignFile(f, OpenDialog1.FileName);
Reset(f);
for i:=0 to 255 do Read(f,d[i]);
CloseFile(f);
ShowRAW(d);
CheckPwd(d);
CheckUUID(d);
CheckOEM(d);
CheckMachine(d);
PageControl1.ActivePageIndex := 0;
end;
end;
procedure EnableGroup(grp: TGroupBox; new: boolean);
var i: integer;
begin
for i:=0 to grp.ControlCount-1 do grp.Controls[i].Enabled := new;
grp.Enabled := new;
end;
procedure TAForm.ButtonPCIScanClick(Sender: TObject);
begin
Screen.Cursor := crHourGlass;
MyPCI := Scan_PCI(Application, AForm.LabelStatus);
Screen.Cursor := crDefault;
if (MyPCI.SMB_Address <> 0) AND (MyPCI.Vendor_Name <> '') then begin
AForm.LabelStatus.Caption := 'SMBus-Controller: '+MyPCI.Vendor_Name+' '+MyPCI.Device_Name+' Rev '+IntToStr(MyPCI.Rev)+' at addr 0x'+IntToHex(MyPCI.SMB_Address,4);
EnableGroup(AForm.GroupSMBus, true);
end;
end;
procedure TAForm.ButtonSMBScanClick(Sender: TObject);
begin
//asd
end;
end.

BIN
DLPORTIO.dll Normal file

Binary file not shown.

BIN
DLPORTIO.sys Normal file

Binary file not shown.

209
SMBus.pas Normal file
View File

@ -0,0 +1,209 @@
unit SMBus;
interface
uses Forms, StdCtrls;
type
PCI_Info = record
Vendor_ID: word;
Vendor_Name: string;
Device_ID: word;
Device_Name: string;
Rev: byte;
Bus: byte;
Dev: byte;
Fun: byte;
SMB_Address: word;
end;
function Scan_PCI(Application: TApplication; Status: TLabel): PCI_Info;
implementation
uses SysUtils;
const
RW_WRITE = 0;
RW_READ = 1;
function DlPortReadPortUchar(Port: cardinal): cardinal; stdcall; external'dlportio.dll';
function DlPortReadPortUlong(Port: cardinal): cardinal; stdcall; external'dlportio.dll';
procedure DlPortWritePortUchar(Port: cardinal; Value: cardinal); stdcall; external'dlportio.dll';
procedure DlPortWritePortUlong(Port: cardinal; Value: cardinal); stdcall; external'dlportio.dll';
// http://www.tsgroup.it/smbus/index.htm
function Get_PCI_Reg(Bus: cardinal;Dev: cardinal;Fun: cardinal;Reg: cardinal): cardinal;
var
cc, t: cardinal;
begin
cc := $80000000;
cc := cc or ((Bus and $FF) shl 16);//Bus
cc := cc or ((Dev and $1F) shl 11);//Dev
cc := cc or ((Fun and $07) shl 8);//func
cc := cc or ((Reg and $FC));//Reg
t := DlPortReadPortUlong($CF8);
DlPortWritePortUlong($CF8, cc);
Result := DlPortReadPortUlong($CFC);
DlPortWritePortUlong($CF8, t);
end;
// http://www.tsgroup.it/smbus/index.htm
function Get_Info(Data: Longword; Bus: cardinal; Dev: cardinal; Fun: cardinal): PCI_Info;
var PCI_Structure: PCI_Info;
begin
PCI_Structure.Vendor_ID := Data and $FFFF;
PCI_Structure.Device_ID := (Data shr 16) and $FFFF;
PCI_Structure.Bus := Bus;
PCI_Structure.Dev := Dev;
PCI_Structure.Fun := Fun;
case Data of
$71138086:
begin
PCI_Structure.SMB_Address := Get_PCI_Reg(Bus, Dev, Fun, $90) and $FFF0;
PCI_Structure.Rev := Get_PCI_Reg(Bus, Dev, Fun, 8) and $FF;
PCI_Structure.Vendor_Name := 'Intel®';
PCI_Structure.Device_Name := '82371AB/EB (PIIX4)';
end;
$24138086:
begin
PCI_Structure.SMB_Address := Get_PCI_Reg(Bus, Dev, Fun, $20) and $FFF0;
PCI_Structure.Rev := Get_PCI_Reg(Bus, Dev, Fun, 8) and $FF;
PCI_Structure.Vendor_Name := 'Intel®';
PCI_Structure.Device_Name := '82801AA/ICH';
end;
$24238086:
begin
PCI_Structure.SMB_Address := Get_PCI_Reg(Bus, Dev, Fun, $20) and $FFF0;
PCI_Structure.Rev := Get_PCI_Reg(Bus, Dev, Fun, 8) and $FF;
PCI_Structure.Vendor_Name := 'Intel®';
PCI_Structure.Device_Name := '82801AB/ICH0';
end;
$24438086:
begin
PCI_Structure.SMB_Address := Get_PCI_Reg(Bus, Dev, Fun, $20) and $FFF0;
PCI_Structure.Rev := Get_PCI_Reg(Bus, Dev, Fun, 8) and $FF;
PCI_Structure.Vendor_Name := 'Intel®';
PCI_Structure.Device_Name := '82801BA/ICH2';
end;
else
PCI_Structure.SMB_Address := 0;
PCI_Structure.Rev := 0;
PCI_Structure.Vendor_Name := '';
PCI_Structure.Device_Name := '';
end;
Result := PCI_Structure;
end;
// http://www.tsgroup.it/smbus/index.htm
function Scan_PCI(Application: TApplication; Status: TLabel): PCI_Info;
var Bus, Dev, Fun: integer;
Info: PCI_Info;
Data: Longword;
loopdone: boolean;
begin
for Bus := 0 to $FF do begin
Status.Caption := 'Now scanning Bus 0x'+IntToHex(Bus,2)+' ...';
Application.ProcessMessages;
for Dev := 0 to $1F do begin
for Fun := 0 to $07 do begin
loopdone := false;
Data := Get_PCI_Reg(Bus, Dev, Fun, 0); {In Data abbiamo il nostro codice di identificazione oppure nulla (0x0 or 0xFFFFFFFF). Da questo punto si salta alla routine di decodifica del CHIP. }
if (Data <> $FFFFFFFF) and (Data <> 0) then begin
Info := Get_Info(Data, Bus, Dev, Fun);
if Info.Vendor_Name <> '' then Break;
end;
loopdone := true;
end;
if Info.Vendor_Name <> '' then Break;
end;
if Info.Vendor_Name <> '' then Break;
end;
if (Info.SMB_Address <> 0) AND (Info.Vendor_Name<>'') AND (NOT loopdone) then begin
Status.Caption := 'SMBus-Controller found at Bus 0x'+IntToHex(Bus,2)+', Dev 0x'+IntToHex(Dev,2);
end else begin
Status.Caption := 'No compatible SMBus-Controller found!';
end;
Result := Info;
end;
(******************************************************************************
******* SMBus routines follow *******
******************************************************************************)
procedure smbWaitForFree(BaseAddr: word);
var
Status: byte;
begin
Status := DlPortReadPortUchar(BaseAddr);
while (Status and 1) <> 0 do begin
Application.ProcessMessages;
Status := DlPortReadPortUchar(BaseAddr);
end;
if (Status and $1e) <> 0 then
DlPortWritePortUchar(BaseAddr, Status);
end;
procedure smbWaitForEnd(BaseAddr: word);
var
Status: byte;
begin
Status := DlPortReadPortUchar(BaseAddr);
while (Status and 1) = 1 do begin
Application.ProcessMessages;
Status := DlPortReadPortUchar(BaseAddr);
end;
end;
function smbCallBus(BaseAddr: word; CMD: byte; Slave: byte; RW: byte): cardinal;
var
Dump1: word;
begin
smbWaitForFree(BaseAddr);
DlPortWritePortUchar(BaseAddr + 3, CMD);
DlPortWritePortUchar(BaseAddr + 4, (Slave shl 1) or RW);
DlPortWritePortUchar(BaseAddr + 2, $48);
sleep(1);
Application.ProcessMessages;
smbWaitForEnd(BaseAddr);
Dump1 := ( DlPortReadPortUchar(BaseAddr + 6) shl 8);
Dump1 := Dump1 or DlPortReadPortUchar(BaseAddr + 5);
Result := Dump1;
end;
function smbGetReg(BaseAddr: word; Reg: byte; Slave: byte): word;
var
Data: cardinal;
begin
smbWaitForFree(BaseAddr);
DlPortWritePortUchar(BaseAddr + 5, 0);
DlPortWritePortUchar(BaseAddr + 6, 0);
Data := smbCallBus(BaseAddr, Reg, Slave, RW_READ);
Result := (Data and $ff);
end;
function smbGetAddress(BaseAddr: word): string;
var
Data: word;
Cheque: string;
idx: integer;
begin
Cheque := '';
for idx := $20 to $4F do begin
smbWaitForFree(BaseAddr);
DlPortWritePortUchar(BaseAddr + 5, 0);
DlPortWritePortUchar(BaseAddr + 6, 0);
Data := smbCallBus(BaseAddr, 0, idx, RW_READ);
if (Data and $FF) <> 0 then begin
Cheque := Cheque + IntToHex(idx,2);
end;
end;
Result := Cheque;
end;
begin
end.

29
memmap.txt Normal file
View File

@ -0,0 +1,29 @@
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: PP PP PP PP PP PP PP pp pp pp pp pp pp pp ?? SS
10: UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU UU
20: OO OO OO OO OO OO OO OO OO OO OO OO OO OO OO OO
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
80: MM MM MM MM MM MM MM MM MM MM MM MM MM MM MM MM
90: MM MM MM MM MM MM MM MM MM MM MM MM MM MM MM MM
a0: RR RR RR RR RR RR RR RR RR RR NN NN NN NN ?? ??
b0: ?? ?? ?? ?? ?? ?? 0? ?? ?? ?? ?? ?? 0? 0? ?5 ??
c0: ss ss ss ss ss ss ss ss ss ss ss ss ss ss ss ss
d0: ss ss ss ss ss ss ss ss ss ss ss ss ss ss ss ss
e0: tt tt tt tt tt tt tt tt tt tt tt tt tt tt tt tt
f0: tt tt ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
PP - Machine password
pp - User password
SS - Security setting (FF/4E: ask at startup; FE/00: don't ask)
UU - UUID
OO - OEM Info
MM - Machine name
RR - Revision
NN - Model Name (4-character!)
ss - Serial number
tt - Timestamp