用delphi获取主板BIOS信息2009-01-301、读取主板序列号2、AWard Bios密码读取3、读取BIOS信息4、获取BIOS日期信息=========================================1、读取主板序列号uses SHA1, Base64; function GetHashedBiosInfo: string; var SHA1Context: TSHA1Context; SHA1Digest: TSHA1Digest; begin // Get the BIOS data SetString(Result, PChar(Ptr($F0000)), $10000); // Hash the string SHA1Init(SHA1Context); SHA1Update(SHA1Context, PChar(Result), Length(Result)); SHA1Final(SHA1Context, SHA1Digest); SetString(Result, PChar(@SHA1Digest), sizeof(SHA1Digest)); // Return the hash string encoded in printable characters Result := B64Encode(Result); end; function GetBiosInfoAsText: string; var p, q: pchar; begin q := nil; p := PChar(Ptr($FE000)); repeat if q <> nil then begin if not (p^ in [#10, #13, #32..#126, #169, #184]) then begin if (p^ = #0) and (p - q >= 8) then begin Result := Result + TrimRight(String(q)) + #13#10; end; q := nil; end; end else if p^ in [#33..#126, #169, #184] then q := p; inc(p); until p > PChar(Ptr($FFFFF)); Result := TrimRight(Result); end; procedure TForm1.FormCreate(Sender: TObject); begin Memo1.Lines.Text := GetBiosInfoAsText; end; ======================== 2、AWard Bios密码读取(应该是jingtao的文章,但是ID没有记录)Unit AwardBiosPas; //Write by lovejingtao //http://www.138soft.com interface uses windows,SysUtils; function My_GetBiosPassword:String; implementation function CalcPossiblePassword(PasswordValue: WORD): string; var I: BYTE; C: CHAR; S: string[8]; begin I := 0; while PasswordValue <> 0 do begin Inc(I); if $263 > PasswordValue then begin if $80 > PasswordValue then S[I] := CHAR(PasswordValue) else if $B0 > PasswordValue then S[I] := CHAR(PasswordValue and $77) else if $11D > PasswordValue then S[I] := CHAR($30 or (PasswordValue and $0F)) else if $114 > PasswordValue then begin S[I] := CHAR($64 or (PasswordValue and $0F)); if "0" > S[I] then S[I] := CHAR(BYTE(S[I]) + 8); end else if $1C2 > PasswordValue then S[I] := CHAR($70 or (PasswordValue and $03)) else if $1E4 > PasswordValue then S[I] := CHAR($30 or (PasswordValue and $03)) else begin S[I] := CHAR($70 or (PasswordValue and $0F)); if "z" < S[I] then S[I] := CHAR(BYTE(S[I]) - 8); end; end else S[I] := CHAR($30 or (PasswordValue and $3)); PasswordValue := (PasswordValue - BYTE(S[I])) shr 2; end; S[0] := CHAR(I); PasswordValue := I shr 1; while PasswordValue < I do begin {this is to do because award starts calculating with the last letter} C := S[BYTE(S[0]) - I + 1]; S[BYTE(S[0]) - I + 1] := S[I]; S[I] := C; Dec(I); end; CalcPossiblePassword := S; end; function readcmos(off: byte): byte; var value: byte; begin asm xor ax, ax mov al, off out 70h, al in al, 71h mov value, al end; readcmos := value; end; function My_GetBiosPassword:String; var superpw, userpw: word; S:String; begin if Win32Platform <> VER_PLATFORM_WIN32_NT then //不是NT begin pchar(@superpw)[0] := char(readcmos($1C)); pchar(@superpw)[1] := char(readcmos($1D)); pchar(@userpw)[0] := char(readcmos($64)); pchar(@userpw)[1] := char(readcmos($65)); S:="超级用户密码为:"+CalcPossiblePassword(superpw)+#13+"用户密码为:"+CalcPossiblePassword(userpw); Result:=S; end else Result:="用户系统为NT,无法获取BISO密码!"; end; end. =========================