Get motherboard BIOS information with Delphi

Source: Internet
Author: User
Tags hash printable characters

1, read the motherboard serial number

2, award BIOS password read

3. Read BIOS information

4. Get BIOS date information

=========================================

1, read the motherboard serial number

Uses SHA1, Base64;
function gethashedbiosinfo:string;
Var
Sha1context:tsha1context;
Sha1digest:tsha1digest;
Begin
Get the BIOS data
SetString (Result, Pchar (PTR ($F 0000)), $10000);
Hash the string
Sha1init (Sha1context);
Sha1update (Sha1context, Pchar (Result), Length (result));
Sha1final (Sha1context, sha1digest);
SetString (Result, Pchar (@SHA1Digest), sizeof (sha1digest));
Return to the hash string encoded in printable characters
Result: = B64encode (Result);
End
function getbiosinfoastext:string;
Var
P, Q:pchar;
Begin
Q: = nil;
P: = Pchar (Ptr ($FE 000));
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 password read (should be Jingtao article, but the ID is not recorded)

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 $B 0 > Passwordvalue Then
S[i]: = CHAR (Passwordvalue and $77)
else if $11d > Passwordvalue Then
S[i]: = CHAR ($ 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 ($ 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 ($ or (Passwordvalue and $));
Passwordvalue: = (Passwordvalue-byte (s[i])) SHR 2;
End
S[0]: = CHAR (I);
Passwordvalue: = I shr 1;
While Passwordvalue < I do
Begin {This are 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//Not 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:= ' Super User password is: ' +calcpossiblepassword (SUPERPW) + #13 + ' user password is: ' +calcpossiblepassword (USERPW);
Result:=s;
End
Else
result:= ' user system for NT, unable to get biso password! ';
End
End.
=========================

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.