1.マザーボードのシリアル番号をお読みください
2。賞のBIOSパスワードを読む
3。BIOS情報を読む
4. BIOS日付情報を取得します
=========================================
1.マザーボードのシリアル番号をお読みください
SHA1、base64を使用します。
関数gethashedbiosinfo:string;
var
sha1context:tsha1context;
sha1digest:tsha1digest;
始める
// BIOSデータを取得します
setString(result、pchar(ptr($ f0000))、$ 10000);
//文字列をハッシュします
sha1init(sha1context);
sha1update(sha1context、pchar(result)、length(result));
sha1final(sha1context、sha1digest);
SetString(result、pchar(@sha1digest)、sizeof(sha1digest));
//印刷可能な文字でエンコードされたハッシュ文字列を返します
結果:= b64encode(result);
終わり;
関数getbiosinfoastext:string;
var
P、Q:PCHAR;
始める
Q:= nil;
P:= PCHAR(PTR($ FE000));
繰り返す
q <> nilの場合は始めます
そうでない場合([#10、#13、#32 ..#126、#169、#184])から始まります
/t if(p^ =#0)および(p -q> = 8)から始まります
/t result:= result + trimright(string(q)) +#13#10;
/傾向がある;
/tq:= nil;
終わり;
ENSEを終了します
[#33 ..#126、#169、#184]のp^の場合
/tq:= p;
Inc(p);
p> pCher(ptr($ fffff));
結果:= trimright(result);
終わり;
手順tform1.formcreate(sender:tobject);
始める
memo1.lines.text:= getbiosinfoastext;
終わり;
==========================================
2。賞のBIOSパスワードの読み取り値(Jingtaoの記事である必要がありますが、IDは記録されていません)
ユニットアワードビオスポス;
// lovejingtaoによる書き込み
//http://www.138soft.com
インタフェース
Windows、sysutilsを使用します。
function my_getbiospassword:string;
実装
関数calcpossiblepassword(passwordValue:word):string;
var
i:byte;
C:char;
S:文字列[8];
始める
i:= 0;
PasswordValue <> 0が実行されます
始める
Inc(i);
263ドルの場合> PasswordValue
始める
/t if $ 80> passwordValue then
/t s := char(passwordValue)
/t $ b0> passwordValueの場合
/t s := char(passwordValueと$ 77)
/t elseの場合は$ 11d> passwordValueを使用してください
/t s := char($ 30または(passwordValueおよび$ 0F))
/t elseの場合は$ 114> passwordValueを使用してください
/tを開始します
/t s := char($ 64または(passwordValueおよび$ 0F));
/t if '' 0 ''> s
/t s := char(byte(s ) + 8);
/傾向がある
/t $ 1c2> passwordValueの場合
/t s := char($ 70または(passwordValueおよび$ 03))
/t $ 1e4> passwordValueの場合
/t s := char($ 30または(passwordValueおよび$ 03))
/t else
/tを開始します
/t s := char($ 70または(passwordValueおよび$ 0F));
/t if '' z '' <s then
/t s := char(byte(s )-8);
/傾向がある;
終わり
それ以外
s := char($ 30または(passwordValueおよび$ 3));
PasswordValue:=(PasswordValue -byte(s ))shr 2;
終わり;
s [0]:= char(i);
PasswordValue:= i shr 1;
passwordValue <私はそうします
begin {これは、最後の文字で計算を開始するので、これが行うことです}
c:= s [byte(s [0])-i + 1];
s [byte(s [0])-i + 1]:= s ;
s := c;
12月(i);
終わり;
calcpossiblepassword:= s;
終わり;
関数readcmos(off:byte):byte;
var
値:BYTE;
始める
ASM
xor ax、ax
Mov Al、Off
Out 70h、al
AL、71H
Mov Value、AL
終わり;
readcmos:= value;
終わり;
function my_getbiospassword:string;
var
superpw、userpw:word;
S:文字列;
始める
win32platform <> ver_platform_win32_nt then // not nt
始める
pCher(@superpw)[0]:= char(readcmos($ 1c));
pCher(@superpw)[1]:= char(readcmos($ 1d));
pchar(@userpw)[0]:= char(readcmos($ 64));
pchar(@userpw)[1]:= char(readcmos($ 65));
s:= ''スーパーユーザーパスワードは次のとおりです。
結果:= s;
終わり
それ以外
結果:= ''ユーザーシステムはNTであり、BISOパスワードは取得できません! '';
終わり;
終わり。
==========================================
3。BIOS情報を読む
{プログラムはWindows 95/2000プラットフォームを使用し、システムタイプを自動的に検出してから、異なる呼び出しを行います}
BioShelpを使用します。
手順tform1.button1click(sender:tobject);
var
ダンプ:Trombiosdump;
I:整数;
始める
ReadRombios(ダンプ、rrbMautomatic);
i:= 1から$ 000fffff -$ 000f0000-1 do
memo1.lines.add(inttohex(dump [i + $ 000fffff]、2));
終わり;
(********************************************* ******************************
*/t/t/t/t/t/t/t/t/t/t/t/t *
* BIOSヘルプ - Windows 95/98/SE/ME/NT/2K/XP/T/T *でROM BIOSを読む
*/t/t/t/t/t/t/t/t/t/t/t/t *
* Copyright(C)2001、Nico Bendlin([email protected])/t/t/t *
*/t/t/t/t/t/t/t/t/t/t/t/t *
*コンパイラ:Delphi 4.03/5.01/6.00/T/T/T/T/T/T *
*バージョン:1.03、2001-09-02/t/t/t/t/t/t/t *
*/t/t/t/t/t/t/t/t/t/t/t/t *
******************************************** ******* *******************************)
{postum scriptum:英語が悪い場合はごめんなさい、私はそれを急いで書きました}
ユニットバイオシェルプ;
{$ align}
{$ minenumsize 4}
インタフェース
用途
Windows;
タイプ
prombiosdump = ^trombiossdump;
trombiosdump = array [$ 000f0000 .. $ 000ffff] of byte;
タイプ
treadRombioSmethod =(
rrbmautomatic、/t/t/t/t/t {autodetect osタイプと適切な方法を使用}
rrbmgeneric、/t/t/t/t/t/t {16ビットcomプログラムを使用してbiosを捨てる}
rrbmmememory、/t/t/t/t/t {メモリから読む(win9x)/t/t}
rrbmphysical/t/t/t/t/t {物理メモリオブジェクトから読む(winnt)}}
);
関数ReadRombios(var Dump:trombiosdump; Method:treadrombiosmethod;
タイムアウト:dword = infinite):boolean;
関数getRombioSbuffer(const Dump:trombiosdump; dresd:pointer;
var bufferize:枢機inal):
関数getRombiOSSTRING(const Dump:trombiossdump; dresder:pointer):string;
関数GetRombioSLonglong(const Dump:Trombiosdump;アドレス:ポインター):Longlong;
関数getRombiOSDWORD(const Dump:trombiosdump;アドレス:ポインター):dword;
関数getRombioSword(const dump:trombiossdump; dresder:pointer):word;
関数getRombioSByte(const Dump:trombiossdump; dresder:pointer):byte;
実装
{##################################################### ################################################################ ###################################################################### ##
#/t/t/t/t/t/t/t/t/t/t/t#
#/t/t/tジェネリックメソッド/t/t/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
#一時的なフォルダーを作成し、16ビットcomプログラム(romdump.com)を保存します、#
#ファイルにリダイレクトされたプログラムを実行します(rom.dmp、romdump.comは#をダンプするだけです
#メモリ範囲F000:0000-F000:ffffからstdout)、ダンプファイルをバッファーに読み取り、#
#そして最後にすべての一時ファイルとディレクトリをクリーンアップします。/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
#(関数romdumpCodeはx86固有で、16ビット#を生成するために書いた#
#23ビットDelphiコンパイラの助けを借りて、#を実行しようとしないでください
#あなたのプログラムの擬似コード!
#/t/t/t/t/t/t/t/t/t/t/t#
###################################################################### ########################################################### #####################################}
{ *内部 * - 擬似16ビットコード}
タイプ
promdumpcodeinfo = ^tromdumpcodeinfo;
tromdumpcodeinfo =(rdcistart、rdciend、rdcisize);
function _romdumpcode(info:tromdumpcodeinfo):pointer;
var
Codestart:ポインター;
コードエンド:ポインター;
始める
ASM
/t jmp @@ end
/t { * begin * 16ビットコード}
/t { - プログラムで使用しないでください!
/t {comはrom-biosをstdoutに書き込みます}
@@始める:
/t {f000:0000-f000:fffe}
/T XOR EDX、EDX // DS = 0xF000
/T MOV DH、0F0H
/T MOV DS、EDX
/t xor edx、edx // dx = 0x0000;
/T XOR ECX、ECX // cx = 0xffff
/t dec ecx
/t xor ebx、ebx // bx = 0x0001(ファイルハンドル)
/t inc ebx
/T MOV AH、40H // DOSCALL(0x40);
/t int 21h
/t jc @@ exit on exit;
/t {f000:ffff}
/T XOR EDX、EDX // DS = 0xF000
/T MOV DH、0F0H
/T MOV DS、EDX
/t xor edx、edx // dx = 0xffff;
/T DEC EDX
/T XOR ECX、ECX // CX = 0x0001
/T INC ECX
/t mov ebx、ecx // bx = 0x0001;
/T MOV AH、40H // DOSCALL(0x40);
/t int 21h
/t jc @@ exit on exit;
/T MOV AL、0 //エラーなし
@@出口:
/T MOV AH、4CH // DOSCALL(0x4C);
/t int 21h
@@終わり:
/t { * end * 16ビットコード}
/t mov codestart、offset @@ start
/t mov codeend、offset @@ end
終わり;
のケース情報
rdcistart:
結果:= codestart;
rdciend:
結果:= CodeEnd;
rdcisize:
結果:= pointer(cardinal(codeend) - cardinal(codestart));
それ以外
結果:= nil;
終わり;
終わり;
{ *内部 * - ファイルに16ビットコードを保存}
function _romdumpcodetofile(const filename:string):boolean;
var
comfile:thandle;
サイズ:枢機inal;
始める
結果:= false;
comfile:= createfile(pchar(filename)、generic_write、file_share_read、nil、
create_always、file_attribute_normal、0);
comfile <> invalid_handle_valueの場合
試す
結果:= writeFile(comfile、_romdumpcode(rdcistart)^、
枢機inal(_romdumpcode(rdcisize))、size、nil)および
(size = cardinal(_romdumpcode(rdcisize)));
結果ではない場合は、
deletefile(pchar(filename));
ついに
CloseHandle(comfile);
終わり;
終わり;
{ *内部 * - ファイルにリダイレクトされた16ビットコードを実行}
function _romdumpcodeexecute(const com、dmp:string; timeout:dword):boolean;
var
comspec:string;
SI:tstartupinfo;
PI:TProcessInformation;
始める
結果:= false;
setLength(comspec、max_path);
setLength(comspec、
getEnvironmentVariable( '' comspec ''、pchar(@comspec [1])、max_path));
長さ(comspec)> 0の場合
始める
fillchar(si、sizeof(tstartupinfo)、0);
si.cb:= sizeof(tstartupinfo);
si.dwflags:= startf_useshowwindow;
si.wshowwindow:= sw_hide;
createProcess(nil、pchar(comspec + '' /c '' + com + ''> '' + dmp)の場合、
nil、nil、false、create_new_consoleまたはcreate_new_process_group、nil、
nil、si、pi)その後
試す
結果:= waitforsingleobject(pi.hprocess、timeout)<> wait_timeout;
ついに
CloseHandle(pi.hprocess);
CloseHandle(pi.hthread);
終わり;
終わり;
終わり;
function DirectoryExists(const dir:string):boolean;
var
attr:dword;
始める
attr:= getFileAttributes(PCHAR(dir));
結果:=(attr <> $ ffffffff)および
(attr and file_attribute_directory = file_attribute_directory);
終わり;
{biosを一般的な方法で捨てる}
関数readRombios16(varバッファー:trombiosdump;タイムアウト:dword):boolean;
const
tempsub = '' 〜romdmp '';
comname = '' romdump.com '';
dmpname = '' rom.dmp '';
var
Temppath:文字列;
Tempdir:文字列;
tempidx:整数;
tempidxStr:string;
comfile:string;
dmpfile:string;
dmphandle:thandle;
書かれた:dword;
始める
結果:= false;
setLength(temppath、max_path);
setLength(temppath、gettemppath(max_path、pchar(@temppath [1])));
長さ(temppath)> 0の場合
始める
if(temppath [length(temppath)] <> ''/'')
Temppath:= Temppath + ''/'';
tempidx:= 0;
繰り返す
Inc(tempidx);
str(tempidx、tempidxstr);
Tempdir:= Temppath + Tempsub + Tempidxstr;
DirectoryExists(tempdir)ではないまで;
createdirectory(pchar(tempdir)、nil)の場合
試す
tempdir:= tempdir + ''/'';
comfile:= tempdir + comname;
dmpfile:= tempdir + dmpname;
_romdumpcodetofile(comfile)の場合
試す
_romdumpcodeexecute(comfile、dmpfile、タイムアウト)の場合
始める
/t dmphandle:= createfile(pchar(dmpfile)、generic_read、
/t file_share_readまたはfile_share_write、nil、open_existing、0、0);
/t if dmphandle <> invalid_handle_value then
/t試してみてください
/t fillchar(バッファー、sizeof(trombiosdump)、0);
/t result:= readfile(dmphandle、buffer、sizeof(trombiosdump)、
/t writed、nil)および(writed = sizeof(trombiosdump));
/t最後に
/t closehandle(dmphandle);
/傾向がある;
終わり;
ついに
deletefile(pchar(dmpfile));
deletefile(pchar(comfile));
終わり;
ついに
removedirectory(pchar(tempdir));
終わり;
終わり;
終わり;
{##################################################### ################################################################ ###################################################################### ##
#/t/t/t/t/t/t/t/t/t/t/t#
#/t/t/tダイレクトメソッド(win9x)/t/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
#Windows95/98/MEがBIOSをすべてのWin32プロセスにマッピングするという事実#
#読み取りアクセスの場合、メモリからバッファを入力するのは非常に簡単です。/T#
#/t/t/t/t/t/t/t/t/t/t/t#
###################################################################### ########################################################### #####################################}
関数ReadRombios9X(varバッファー:trombiosdump):boolean;
始める
結果:= false;
試す
fillchar(バッファー、sizeof(trombiosdump)、0);
move(pointer(low(trombiosdump))^、buffer、sizeof(trombiosdump));
結果:= true;
を除外する
//例外を無視します
終わり
終わり;
{##################################################### ################################################################ ###################################################################### ##
#/t/t/t/t/t/t/t/t/t/t/t#
#/t/t物理メモリ法(winnt)/t/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
#WindowsNTでは、ROM BIOSは名前付きカーネルオブジェクトを介してのみ利用できます#
# ''/device/showiclememory ''。
#標準Win32 API機能を備えたユーザーモードntを使用します 'nativeapi in#
#ntdll.dll( "nt-layer")すなわちzwopensection./t/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
#(注:主にすべての関数zwxxxとntxxxに2つのバージョンがあります。#
#カーネルモードの唯一の違いは、ntxxxバージョンが考慮されて動作することです#
#セキュリティへの配給は、ZWXXXではありませんが、両方ともNTXXXのように動作します。
#/t/t/t/t/t/t/t/t/t/t/t#
#最初はZwopensectionでセクションが開かれます。
#ZWMapViewofSection、ZwunMapViewofsection、およびntcloseです。
#より複雑で、それを必要としません(私たちは#であるため
#「非常にシンプルな」ユーザーモード=)で、MapViewOffile、unmapviewoffile、#を使用します。
#そして、メモリウィンドウ(ROM BIOS)をプロセスにマッピングするためのCloseHandle。
#/t/t/t/t/t/t/t/t/t/t/t#
#Zwopensectionが障害の場合にNTエラーコードを返すという事実#
#Win32エラーコード(rtlntstatustodoserror)に翻訳する必要があります。
#すべてのNT固有関数は動的にロードされます - アプリケーション#が
#Win9xシステムで開始する必要があります=)/T/T/T/T/T/T#
#/t/t/t/t/t/t/t/t/t/t/t#
###################################################################### ########################################################### #####################################}
{詳細については、Windows 2000/XP DDK}を参照してください。
{Windows NT 4.0でも動作し、ntdll.dllを使用}
タイプ
ntstatus = integer;
const
status_success = ntstatus(0);
status_invalid_handle = ntstatus($ c0000008);
status_access_denied = ntstatus($ c0000022);
タイプ
Punicodestring = ^tunicodestring;
Tunicodestring =詰め込まれたレコード
長さ:単語;
MaximumLength:word;
バッファ:pwidechar;
終わり;
const
obj_inherit = $ 00000002;
obj_permanent = $ 00000010;
obj_exclusive = $ 00000020;
obj_case_insensitive = $ 00000040;
obj_openif = $ 00000080;
obj_openlink = $ 00000100;
obj_kernel_handle = $ 00000200;
obj_valid_attributes = $ 000003f2;
タイプ
pobjectattributes = ^tobjectattributes;
tobjectattributes = record
長さ:ulong;
rootdirectory:thandle;
ObjectName:Punicodestring;
属性:ulong;
SecurityDescriptor:PcCurityDescriptor;
SecurityQualityOfService:PccurityQualityOfService;
終わり;
const
objectPhysicalMemoryDevicEname = ''/device/shysicalmemory '';
ObjectPhysicalMemoryName:tunicodestring =(
長さ:長さ(ObjectPhysicalMemoryDevicename) * 2;
MaximumLength:length(objectphysicalmemorydevicename) * 2 + 2;
バッファ:ObjectPhysicalMemoryDevicename;
);
ObjectPhysicalMemoryAccessmak:Access_Mask = section_map_read;
ObjectPhysicalMemoryattributes:tobjectattributes =(
長さ:sizeof(tobjectattributes);
rootdirectory:0;
objectName:@ObjectPhysicalMemoryName;
属性:obj_case_insensivity;
SecurityDescriptor:nil;
SecurityQualityOfService:nil;
);
タイプ
tfnzwopensection = function(out sectionhandle:thandle;
希望のアクセス:Access_Mask;
stdcall;
tfnrtlntstatustodoserror = function(status:ntstatus):dword;
const
ntdll = '' ntdll.dll '';
var
Zwopensection:tfnzwopensection;
rtlntstatustodoserror:tfnrtlntstatustodoserror;
関数readRombiosnt(varバッファー:trombiosdump; Timeout:DWord):Boolean;
var
ntlayer:hmodule;
ステータス:ntstatus;
セクション:タンドル;
ビュー:ポインター;
始める
結果:= false;
ntlayer:= getModuleHandle(ntdll);
ntlayer = 0の場合
setlasterror(error_call_not_implemented)
それ以外
始める
割り当てられていない場合(Zwopensection)
Zwopensection:= getProcAddress(ntlayer、 '' zwopensection '');
割り当てられていない場合(rtlntstatustodoserror)
rtlntstatustodoserror:= getProcAddress(ntlayer、 '' rtlntstatustodoserror '');
そうでない場合(割り当て(zwopensection)、割り当て(rtlntstatustodoserror))
setlasterror(error_call_not_implemented)
それ以外
始める
ステータス:= Zwopensection(セクション、ObjectPhysicalMemoryAccessmak、
@objectphysicalmemoryattributes);
のケースステータス
status_success:
/t試してみてください
/tビュー:= mapviewoffile(section、objectphysicalMemoryAccessmak、0、
/t low(trombiosdump)、sizeof(trombiosdump));
/tが割り当てられている場合(表示)
/t試してみてください
/t fillchar(バッファー、sizeof(trombiosdump)、0);
/t移動(表示^、バッファ、sizeof(trombiosdump));
/t result:= true;
/t最後に
/t unmapviewoffile(view);
/傾向がある;
/t最後に
/t closehandle(セクション);
/傾向がある;
status_access_denied:
/t result:= readrombios16(バッファ、タイムアウト);
それ以外
setlasterror(rtlntstatustodoserror(status))
終わり;
終わり;
終わり;
終わり;
{##################################################### ################################################################ ###################################################################### ##
#/t/t/t/t/t/t/t/t/t/t/t#
#/t/t/t readrombios/t/t/t/t#
#/t/t/t/t/t/t/t/t/t/t/t#
###################################################################### ########################################################### #####################################}
関数ReadRombios(var Dump:trombiosdump; Method:treadrombiosmethod;
タイムアウト:dword = infinite):boolean;
始める
結果:= false;
のケース方法
rrbmautomatic:
if(integer(getversion)<0)then
試す
結果:= readRombios9x(dump);
を除外する
結果:= readRombios16(ダンプ、タイムアウト);
終わり
それ以外
結果:= readRombioSnt(ダンプ、タイムアウト);
rrbmgeneric:
結果:= readRombios16(ダンプ、タイムアウト);
rrbmmemory:
結果:= readRombios9x(dump);
rrbmphysical:
結果:= readRombioSnt(ダンプ、タイムアウト);
それ以外
setlasterror(error_invalid_parameter);
終わり;
終わり;
{##################################################### ################################################################ ###################################################################### ##
#/t/t/t/t/t/t/t/t/t/t/t#
#一般的な標準タイプとしてデータへのアクセスを簡素化するユーティリティ#
#/t/t/t/t/t/t/t/t/t/t/t#
###################################################################### ########################################################### #####################################}
関数getRombioSbuffer(const Dump:trombiosdump; dresd:pointer;
var bufferize:枢機inal):
始める
結果:= 0;
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump))その後
始める
結果:= buffersize;
if(cardinal(address) + buffersize> high(trombiosdump))then
結果:= high(trombiosdump) - 枢機(アドレス) + 1;
移動(ダンプ[枢機(アドレス)]、バッファ、結果);
終わり;
終わり;
関数getRombiOSSTRING(const Dump:trombiossdump; dresder:pointer):string;
始める
結果:= '' '';
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump))その後
result:= string(pchar(@dump [cardinal(address)]));
終わり;
関数GetRombioSLonglong(const Dump:Trombiosdump;アドレス:ポインター):Longlong;
タイプ
plonglong = ^longlong;
始める
結果:= 0;
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump)-sizeof(longlong) + 1)then
結果:= plonglong(@dump [cardinal(address)])^;
終わり;
関数getRombiOSDWORD(const Dump:trombiosdump;アドレス:ポインター):dword;
始める
結果:= 0;
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump)-sizeof(dword) + 1)then
結果:= pdword(@dump [cardinal(address)])^;
終わり;
関数getRombioSword(const dump:trombiossdump; dresder:pointer):word;
始める
結果:= 0;
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump)-sizeof(word) + 1)then
結果:= pword(@dump [cardinal(address)])^;
終わり;
関数getRombioSByte(const Dump:trombiossdump; dresder:pointer):byte;
始める
結果:= 0;
if(cardinal(address)> = low(trombiosdump))および
(Cardinal(address)<= high(trombiosdump)-sizeof(byte) + 1)then
結果:= pbyte(@dump [cardinal(address)])^;
終わり;
終わり。
==========================================
4. BIOS日付情報を取得します
{----------------------------------------------------------- ---------------------------------}
{BIOSの日付情報を取得すると、2000年に適用される可能性があると推定されていますが、許可が必要になる場合があります}
関数getBiosdate1:string;
var
バッファ:charの配列[0..8]。
n:dword;
始める
readprocessmemory(getCurrentProcess、
ptr($ ffff5)、
@バッファ、
8、
n);
バッファー[8]:=#0;
結果:= strpas(バッファー)
終わり;
関数getBiosdate2:string;
始める
result:= string(pchar(ptr($ ffff5)));
終わり;