您正在使用一款已经过时的浏览器!部分功能不能正常使用。
请尝试升级或使用
其他浏览器。
【1000元】请高手写一个读写主板BIOS的小软件.(0分)
m8858
Unregistered / Unconfirmed
GUEST, unregistred user!
【1000元】请高手写一个读写主板BIOS的小软件.<br>具体请QQ谈,高手请加我QQ-108288538
japhe
Unregistered / Unconfirmed
GUEST, unregistred user!
获取主板BIOS的信息 <br>http://www.lihuasoft.net/article/show.php?id=2368 <br> 发表日期:2004-10-31 作者:[转贴] 出处: <br> <br> <br><br>获取主板BIOS的信息 <br>1、读取主板序列号<br>2、AWard Bios密码读取<br>3、读取BIOS信息<br>4、获取BIOS日期信息 <br><br>=========================================<br>1、读取主板序列号 <br><br>uses SHA1, Base64; <br><br> function GetHashedBiosInfo: string; <br> var <br> SHA1Context: TSHA1Context; <br> SHA1Digest: TSHA1Digest; <br> begin <br> // Get the BIOS data <br> SetString(Result, PChar(Ptr($F0000)), $10000); <br> // Hash the string <br> SHA1Init(SHA1Context); <br> SHA1Update(SHA1Context, PChar(Result), Length(Result)); <br> SHA1Final(SHA1Context, SHA1Digest); <br> SetString(Result, PChar(@SHA1Digest), sizeof(SHA1Digest)); <br> // Return the hash string encoded in printable characters <br> Result := B64Encode(Result); <br> end; <br><br><br> function GetBiosInfoAsText: string; <br> var <br> p, q: pchar; <br> begin <br> q := nil; <br> p := PChar(Ptr($FE000)); <br> repeat <br> if q <> nil then begin <br> if not (p^ in [#10, #13, #32..#126, #169, #184]) then begin <br> if (p^ = #0) and (p - q >= 8) then begin <br> Result := Result + TrimRight(String(q)) + #13#10; <br> end; <br> q := nil; <br> end; <br> end else <br> if p^ in [#33..#126, #169, #184] then <br> q := p; <br> inc(p); <br> until p > PChar(Ptr($FFFFF)); <br> Result := TrimRight(Result); <br> end; <br><br> procedure TForm1.FormCreate(Sender: TObject); <br> begin <br> Memo1.Lines.Text := GetBiosInfoAsText; <br> end; <br><br>==========================================<br>2、AWard Bios密码读取(应该是jingtao的文章,但是ID没有记录)<br>Unit AwardBiosPas;<br>//Write by lovejingtao<br>//http://www.138soft.com<br>interface<br>uses windows,SysUtils; <br><br>function My_GetBiosPassword:String;<br>implementation <br><br>function CalcPossiblePassword(PasswordValue: WORD): string;<br>var<br> I: BYTE;<br> C: CHAR;<br> S: string[8]; <br><br>begin<br> I := 0;<br> while PasswordValue <> 0 do<br> begin<br> Inc(I);<br> if $263 > PasswordValue then<br> begin<br> if $80 > PasswordValue then<br> S
:= CHAR(PasswordValue)<br> else if $B0 > PasswordValue then<br> S := CHAR(PasswordValue and $77)<br> else if $11D > PasswordValue then<br> S := CHAR($30 or (PasswordValue and $0F))<br> else if $114 > PasswordValue then<br> begin<br> S := CHAR($64 or (PasswordValue and $0F));<br> if '0' > S then<br> S := CHAR(BYTE(S) + 8);<br> end<br> else if $1C2 > PasswordValue then<br> S := CHAR($70 or (PasswordValue and $03))<br> else if $1E4 > PasswordValue then<br> S := CHAR($30 or (PasswordValue and $03))<br> else<br> begin<br> S := CHAR($70 or (PasswordValue and $0F));<br> if 'z' < S then<br> S := CHAR(BYTE(S) - 8);<br> end;<br> end<br> else<br> S := CHAR($30 or (PasswordValue and $3));<br> PasswordValue := (PasswordValue - BYTE(S)) shr 2;<br> end; <br><br> S[0] := CHAR(I);<br> PasswordValue := I shr 1;<br> while PasswordValue < I do<br> begin {this is to do because award starts calculating with the last letter} <br><br> C := S[BYTE(S[0]) - I + 1];<br> S[BYTE(S[0]) - I + 1] := S;<br> S := C;<br> Dec(I);<br> end;<br> CalcPossiblePassword := S;<br>end; <br><br>function readcmos(off: byte): byte;<br>var<br> value: byte;<br>begin<br> asm<br> xor ax, ax<br> mov al, off<br> out 70h, al<br> in al, 71h<br> mov value, al<br> end;<br> readcmos := value;<br>end;<br>function My_GetBiosPassword:String;<br>var<br> superpw, userpw: word;<br> S:String;<br>begin<br>if Win32Platform <> VER_PLATFORM_WIN32_NT then //不是NT<br>begin<br> pchar(@superpw)[0] := char(readcmos($1C));<br> pchar(@superpw)[1] := char(readcmos($1D));<br> pchar(@userpw)[0] := char(readcmos($64));<br> pchar(@userpw)[1] := char(readcmos($65));<br> S:='超级用户密码为:'+CalcPossiblePassword(superpw)+#13+'用户密码为:'+CalcPossiblePassword(userpw);<br> Result:=S;<br> end<br> else<br> Result:='用户系统为NT,无法获取BISO密码!';<br> end;<br>end. <br><br>==========================================<br>3、读取BIOS信息<br>{程序使用Windows 95/2000平台,自动检测系统类型,然后进行不同调用}<br>uses BiosHelp; <br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> Dump: TRomBiosDump;<br> i: Integer;<br>begin<br> ReadRomBios(Dump, rrbmAutomatic);<br> for i := 1 to $000FFFFF - $000F0000 - 1 do<br> Memo1.Lines.Add(IntToHex(Dump[i + $000FFFFF], 2));<br>end;<br>(*******************************************************************************<br>* *<br>* BIOS Help - read ROM BIOS on Windows 95/98/SE/ME/NT/2K/XP *<br>* *<br>* Copyright (C) 2001, Nico Bendlin (nico@bendlin.de) *<br>* *<br>* Compiler: Delphi 4.03/5.01/6.00 *<br>* Version: 1.03, 2001-09-02 *<br>* *<br>*******************************************************************************) <br><br>{ postum scriptum: sorry for the bad english, i wrote it in a hurry } <br><br>unit BiosHelp; <br><br>{$ALIGN ON}<br>{$MINENUMSIZE 4} <br><br>interface <br><br>uses<br> Windows; <br><br>type<br> PRomBiosDump = ^TRomBiosDump;<br> TRomBiosDump = array[$000F0000..$000FFFFF] of Byte; <br><br>type<br> TReadRomBiosMethod = (<br> rrbmAutomatic, { Autodetect OS type and use proper method }<br> rrbmGeneric, { Use 16-bit COM program to dump the BIOS }<br> rrbmMemory, { Read from memory (Win9x) }<br> rrbmPhysical { Read from physical memory object (WinNT) }<br> ); <br><br>function ReadRomBios(var Dump: TRomBiosDump; Method: TReadRomBiosMethod;<br> Timeout: DWORD = INFINITE): Boolean; <br><br>function GetRomBiosBuffer(const Dump: TRomBiosDump; Address: Pointer;<br> var Buffer; BufferSize: Cardinal): Cardinal;<br>function GetRomBiosString(const Dump: TRomBiosDump; Address: Pointer): string;<br>function GetRomBiosLongLong(const Dump: TRomBiosDump; Address: Pointer): LONGLONG;<br>function GetRomBiosDWord(const Dump: TRomBiosDump; Address: Pointer): DWORD;<br>function GetRomBiosWord(const Dump: TRomBiosDump; Address: Pointer): Word;<br>function GetRomBiosByte(const Dump: TRomBiosDump; Address: Pointer): Byte; <br><br>implementation <br><br>{###############################################################################<br># #<br># GENERIC METHOD #<br># #<br># Create an temporary folder, save an 16bit COM program (RomDump.com) into it, #<br># execute program redirected to an file (Rom.dmp, RomDump.com simply dumps the #<br># memory range F000:0000-F000:FFFF to STDOUT), read dump file into the buffer, #<br># and finally cleanup all temporary files and directories. #<br># #<br># (the function RomDumpCode is x86 specific, which i wrote to generate 16-bit #<br># code with the help of the 23-bit Delphi compiler, never try to execute the #<br># pseudo-code in your program! it will not work in 32-bit protected mode) #<br># #<br>###############################################################################} <br><br>{ *INTERNAL* - Pseudo 16-bit code } <br><br>type<br> PRomDumpCodeInfo = ^TRomDumpCodeInfo;<br> TRomDumpCodeInfo = (rdciStart, rdciEnd, rdciSize); <br><br>function _RomDumpCode(Info: TRomDumpCodeInfo): Pointer;<br>var<br> CodeStart: Pointer;<br> CodeEnd: Pointer;<br>begin<br> asm<br> JMP @@End <br><br> { *BEGIN* 16-bit code }<br> { -- never use it in your program! -- }<br> { COM which writes ROM-BIOS to StdOut }<br> @@Start:<br> { Dump F000:0000-F000:FFFE }<br> XOR eDX, eDX // DS = 0xF000 ; Data segment<br> MOV DH, 0F0h<br> MOV DS, eDX<br> XOR eDX, eDX // DX = 0x0000 ; Data offset<br> XOR eCX, eCX // CX = 0xFFFF ; Data length<br> DEC eCX<br> XOR eBX, eBX // BX = 0x0001 ; STDOUT (file handle)<br> INC eBX<br> MOV AH, 40h // DosCall(0x40) ; INT21, DOS_WRITE_TO_HANDLE<br> INT 21h<br> JC @@Exit // On error exit ; AL = Error code<br> { Dump F000:FFFF }<br> XOR eDX, eDX // DS = 0xF000 ; Data segment<br> MOV DH, 0F0h<br> MOV DS, eDX<br> XOR eDX, eDX // DX = 0xFFFF ; Data offset<br> DEC eDX<br> XOR eCX, eCX // CX = 0x0001 ; Data length<br> INC eCX<br> MOV eBX, eCX // BX = 0x0001 ; STDOUT (file handle)<br> MOV AH, 40h // DosCall(0x40) ; INT21, DOS_WRITE_TO_HANDLE<br> INT 21h<br> JC @@Exit // On error exit ; AL = Error code<br> MOV AL, 0 // no error ; AL = 0<br> @@Exit:<br> MOV AH, 4Ch // DosCall(0x4C) ; INT21, DOS_TERMINATE_EXE<br> INT 21h<br> @@End:<br> { *END* 16-bit code } <br><br> MOV CodeStart, OFFSET @@Start<br> MOV CodeEnd, OFFSET @@End<br> end;<br> case Info of<br> rdciStart:<br> Result := CodeStart;<br> rdciEnd:<br> Result := CodeEnd;<br> rdciSize:<br> Result := Pointer(Cardinal(CodeEnd) - Cardinal(CodeStart));<br> else<br> Result := nil;<br> end;<br>end; <br><br>{ *INTERNAL* - Save 16-bit code to file } <br><br>function _RomDumpCodeToFile(const Filename: string): Boolean;<br>var<br> ComFile: THandle;<br> Size: Cardinal;<br>begin<br> Result := False;<br> ComFile := CreateFile(PChar(Filename), GENERIC_WRITE, FILE_SHARE_READ, nil,<br> CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);<br> if ComFile <> INVALID_HANDLE_VALUE then<br> try<br> Result := WriteFile(ComFile, _RomDumpCode(rdciStart)^,<br> Cardinal(_RomDumpCode(rdciSize)), Size, nil) and<br> (Size = Cardinal(_RomDumpCode(rdciSize)));<br> if not Result then<br> DeleteFile(PChar(Filename));<br> finally<br> CloseHandle(ComFile);<br> end;<br>end; <br><br>{ *INTERNAL* - Execute 16-bit code redirected to file }<br>function _RomDumpCodeExecute(const Com, Dmp: string; Timeout: DWORD): Boolean;<br>var<br> ComSpec: string;<br> si: TStartupInfo;<br> pi: TProcessInformation;<br>begin<br> Result := False;<br> SetLength(ComSpec, MAX_PATH);<br> SetLength(ComSpec,<br> GetEnvironmentVariable('ComSpec', PChar(@ComSpec[1]), MAX_PATH));<br> if Length(ComSpec) > 0 then<br> begin<br> FillChar(si, SizeOf(TStartupInfo), 0);<br> si.cb := SizeOf(TStartupInfo);<br> si.dwFlags := STARTF_USESHOWWINDOW;<br> si.wShowWindow := SW_HIDE;<br> if CreateProcess(nil, PChar(ComSpec + ' /C ' + Com + ' > ' + Dmp),<br> nil, nil, False, CREATE_NEW_CONSOLE or CREATE_NEW_PROCESS_GROUP, nil,<br> nil, si, pi) then<br> try<br> Result := WaitForSingleObject(pi.hProcess, Timeout) <> WAIT_TIMEOUT;<br> finally<br> CloseHandle(pi.hProcess);<br> CloseHandle(pi.hThread);<br> end;<br> end;<br>end; <br><br>function DirectoryExists(const Dir: string): Boolean;<br>var<br> Attr: DWORD;<br>begin<br> Attr := GetFileAttributes(PChar(Dir));<br> Result := (Attr <> $FFFFFFFF) and<br> (Attr and FILE_ATTRIBUTE_DIRECTORY = FILE_ATTRIBUTE_DIRECTORY);<br>end; <br><br>{ Get BIOS dump the generic way }<br>function ReadRomBios16(var Buffer: TRomBiosDump; Timeout: DWORD): Boolean;<br>const<br> TempSub = '~RomDmp';<br> ComName = 'RomDump.com';<br> DmpName = 'Rom.dmp';<br>var<br> TempPath: string;<br> TempDir: string;<br> TempIdx: Integer;<br> TempIdxStr: string;<br> ComFile: string;<br> DmpFile: string;<br> DmpHandle: THandle;<br> Written: DWORD;<br>begin<br> Result := False;<br> SetLength(TempPath, MAX_PATH);<br> SetLength(TempPath, GetTempPath(MAX_PATH, PChar(@TempPath[1])));<br> if Length(TempPath) > 0 then<br> begin<br> if (TempPath[Length(TempPath)] <> '/') then<br> TempPath := TempPath + '/';<br> TempIdx := 0;<br> repeat<br> Inc(TempIdx);<br> Str(TempIdx, TempIdxStr);<br> TempDir := TempPath + TempSub + TempIdxStr;<br> until not DirectoryExists(TempDir);<br> if CreateDirectory(PChar(TempDir), nil) then<br> try<br> TempDir := TempDir + '/';<br> ComFile := TempDir + ComName;<br> DmpFile := TempDir + DmpName;<br> if _RomDumpCodeToFile(ComFile) then<br> try<br> if _RomDumpCodeExecute(ComFile, DmpFile, Timeout) then<br> begin<br> DmpHandle := CreateFile(PChar(DmpFile), GENERIC_READ,<br> FILE_SHARE_READ or FILE_SHARE_WRITE, nil, OPEN_EXISTING, 0, 0);<br> if DmpHandle <> INVALID_HANDLE_VALUE then<br> try<br> FillChar(Buffer, SizeOf(TRomBiosDump), 0);<br> Result := ReadFile(DmpHandle, Buffer, SizeOf(TRomBiosDump),<br> Written, nil) and (Written = SizeOf(TRomBiosDump));<br> finally<br> CloseHandle(DmpHandle);<br> end;<br> end;<br> finally<br> DeleteFile(PChar(DmpFile));<br> DeleteFile(PChar(ComFile));<br> end;<br> finally<br> RemoveDirectory(PChar(TempDir));<br> end;<br> end;<br>end; <br><br>{###############################################################################<br># #<br># DIRECT METHOD (Win9x) #<br># #<br># Due to the fact that Windows 95/98/ME maps the BIOS into every Win32 process #<br># for read access it is very simple to fill the buffer from memory. #<br># #<br>###############################################################################} <br><br>function ReadRomBios9x(var Buffer: TRomBiosDump): Boolean;<br>begin<br> Result := False;<br> try<br> FillChar(Buffer, SizeOf(TRomBiosDump), 0);<br> Move(Pointer(Low(TRomBiosDump))^, Buffer, SizeOf(TRomBiosDump));<br> Result := True;<br> except<br> // ignore exceptions<br> end<br>end; <br><br>{###############################################################################<br># #<br># PHYSICAL MEMORY METHOD (WinNT) #<br># #<br># On Windows NT the ROM BIOS is only available through the named kernel object #<br># '/Device/PhysicalMemory'. Because it is impossible to open kernel objects in #<br># user mode with standard Win32 API functions we make use of NT's nativeAPI in #<br># NtDll.dll ("NT-Layer" namely ZwOpenSection. #<br># #<br># (note: mostly there are two versions of every function ZwXxx and NtXxx. The #<br># only difference in kernel mode is that the NtXxx version works in conside- #<br># ration to security while ZwXxx not. But in user mode both work like NtXxx.) #<br># #<br># At first the section is opened with ZwOpenSection. Normally we would proceed #<br># ZwMapViewOfSection, ZwUnmapViewOfSection, and NtClose. But the functions are #<br># more complex and there is no needing for it. With the handle (because we are #<br># in the "very simple" user mode =) we now use MapViewOfFile, UnmapViewOfFile, #<br># and CloseHandle to map an memory window (the ROM BIOS) into our process. #<br># #<br># Due to the fact that ZwOpenSection returns NT error-codes in case of failure #<br># we have to translate it to an Win32 error-code (RtlNtStatusToDosError). #<br># All NT specific functions are dynamically loaded -- because the applications #<br># should start on Win9x systems =) #<br># #<br>###############################################################################} <br><br>{ For more information see Windows 2000/XP DDK }<br>{ It works on Windows NT 4.0 too, use NtDll.dll } <br><br>type<br> NTSTATUS = Integer; <br><br>const<br> STATUS_SUCCESS = NTSTATUS(0);<br> STATUS_INVALID_HANDLE = NTSTATUS($C0000008);<br> STATUS_ACCESS_DENIED = NTSTATUS($C0000022); <br><br>type<br> PUnicodeString = ^TUnicodeString;<br> TUnicodeString = packed record<br> Length: Word;<br> MaximumLength: Word;<br> Buffer: PWideChar;<br> end; <br><br>const<br> OBJ_INHERIT = $00000002;<br> OBJ_PERMANENT = $00000010;<br> OBJ_EXCLUSIVE = $00000020;<br> OBJ_CASE_INSENSITIVE = $00000040;<br> OBJ_OPENIF = $00000080;<br> OBJ_OPENLINK = $00000100;<br> OBJ_KERNEL_HANDLE = $00000200;<br> OBJ_VALID_ATTRIBUTES = $000003F2; <br><br>type<br> PObjectAttributes = ^TObjectAttributes;<br> TObjectAttributes = record<br> Length: ULONG;<br> RootDirectory: THandle;<br> ObjectName: PUnicodeString;<br> Attributes: ULONG;<br> SecurityDescriptor: PSecurityDescriptor;<br> SecurityQualityOfService: PSecurityQualityOfService;<br> end; <br><br>const<br> ObjectPhysicalMemoryDeviceName = '/Device/PhysicalMemory';<br> ObjectPhysicalMemoryName: TUnicodeString = (<br> Length: Length(ObjectPhysicalMemoryDeviceName) * 2;<br> MaximumLength: Length(ObjectPhysicalMemoryDeviceName) * 2 + 2;<br> Buffer: ObjectPhysicalMemoryDeviceName;<br> );<br> ObjectPhysicalMemoryAccessMask: ACCESS_MASK = SECTION_MAP_READ;<br> ObjectPhysicalMemoryAttributes: TObjectAttributes = (<br> Length: SizeOf(TObjectAttributes);<br> RootDirectory: 0;<br> ObjectName: @ObjectPhysicalMemoryName;<br> Attributes: OBJ_CASE_INSENSITIVE;<br> SecurityDescriptor: nil;<br> SecurityQualityOfService: nil;<br> ); <br><br>type<br> TFNZwOpenSection = function(out SectionHandle: THandle;<br> DesiredAccess: ACCESS_MASK; ObjectAttributes: PObjectAttributes): NTSTATUS;<br> stdcall;<br> TFNRtlNtStatusToDosError = function(Status: NTSTATUS): DWORD; stdcall; <br><br>const<br> ntdll = 'ntdll.dll'; <br><br>var<br> ZwOpenSection: TFNZwOpenSection;<br> RtlNtStatusToDosError: TFNRtlNtStatusToDosError; <br><br>function ReadRomBiosNt(var Buffer: TRomBiosDump; Timeout: DWORD): Boolean;<br>var<br> NtLayer: HMODULE;<br> Status: NTSTATUS;<br> Section: THandle;<br> View: Pointer;<br>begin<br> Result := False;<br> NtLayer := GetModuleHandle(ntdll);<br> if NtLayer = 0 then<br> SetLastError(ERROR_CALL_NOT_IMPLEMENTED)<br> else<br> begin<br> if not Assigned(ZwOpenSection) then<br> ZwOpenSection := GetProcAddress(NtLayer, 'ZwOpenSection');<br> if not Assigned(RtlNtStatusToDosError) then<br> RtlNtStatusToDosError := GetProcAddress(NtLayer, 'RtlNtStatusToDosError');<br> if not (Assigned(ZwOpenSection) and Assigned(RtlNtStatusToDosError)) then<br> SetLastError(ERROR_CALL_NOT_IMPLEMENTED)<br> else<br> begin<br> Status := ZwOpenSection(Section, ObjectPhysicalMemoryAccessMask,<br> @ObjectPhysicalMemoryAttributes);<br> case Status of<br> STATUS_SUCCESS:<br> try<br> View := MapViewOfFile(Section, ObjectPhysicalMemoryAccessMask, 0,<br> Low(TRomBiosDump), SizeOf(TRomBiosDump));<br> if Assigned(View) then<br> try<br> FillChar(Buffer, SizeOf(TRomBiosDump), 0);<br> Move(View^, Buffer, SizeOf(TRomBiosDump));<br> Result := True;<br> finally<br> UnmapViewOfFile(View);<br> end;<br> finally<br> CloseHandle(Section);<br> end;<br> STATUS_ACCESS_DENIED:<br> Result := ReadRomBios16(Buffer, Timeout);<br> else<br> SetLastError(RtlNtStatusToDosError(Status))<br> end;<br> end;<br> end;<br>end; <br><br>{###############################################################################<br># #<br># ReadRomBios #<br># #<br>###############################################################################} <br><br>function ReadRomBios(var Dump: TRomBiosDump; Method: TReadRomBiosMethod;<br> Timeout: DWORD = INFINITE): Boolean;<br>begin<br> Result := False;<br> case Method of<br> rrbmAutomatic:<br> if (Integer(GetVersion) < 0) then<br> try<br> Result := ReadRomBios9x(Dump);<br> except<br> Result := ReadRomBios16(Dump, Timeout);<br> end<br> else<br> Result := ReadRomBiosNt(Dump, Timeout);<br> rrbmGeneric:<br> Result := ReadRomBios16(Dump, Timeout);<br> rrbmMemory:<br> Result := ReadRomBios9x(Dump);<br> rrbmPhysical:<br> Result := ReadRomBiosNt(Dump, Timeout);<br> else<br> SetLastError(ERROR_INVALID_PARAMETER);<br> end;<br>end; <br><br>{###############################################################################<br># #<br># Utilities to simplify the access to data as generic standard types #<br># #<br>###############################################################################} <br><br>function GetRomBiosBuffer(const Dump: TRomBiosDump; Address: Pointer;<br> var Buffer; BufferSize: Cardinal): Cardinal;<br>begin<br> Result := 0;<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump)) then<br> begin<br> Result := BufferSize;<br> if (Cardinal(Address) + BufferSize > High(TRomBiosDump)) then<br> Result := High(TRomBiosDump) - Cardinal(Address) + 1;<br> Move(Dump[Cardinal(Address)], Buffer, Result);<br> end;<br>end; <br><br>function GetRomBiosString(const Dump: TRomBiosDump; Address: Pointer): string;<br>begin<br> Result := '';<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump)) then<br> Result := string(PChar(@Dump[Cardinal(Address)]));<br>end; <br><br>function GetRomBiosLongLong(const Dump: TRomBiosDump; Address: Pointer): LONGLONG;<br>type<br> PLongLong = ^LONGLONG;<br>begin<br> Result := 0;<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump) - SizeOf(LONGLONG) + 1) then<br> Result := PLongLong(@Dump[Cardinal(Address)])^;<br>end; <br><br>function GetRomBiosDWord(const Dump: TRomBiosDump; Address: Pointer): DWORD;<br>begin<br> Result := 0;<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump) - SizeOf(DWORD) + 1) then<br> Result := PDWORD(@Dump[Cardinal(Address)])^;<br>end; <br><br>function GetRomBiosWord(const Dump: TRomBiosDump; Address: Pointer): Word;<br>begin<br> Result := 0;<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump) - SizeOf(Word) + 1) then<br> Result := PWord(@Dump[Cardinal(Address)])^;<br>end; <br><br>function GetRomBiosByte(const Dump: TRomBiosDump; Address: Pointer): Byte;<br>begin<br> Result := 0;<br> if (Cardinal(Address) >= Low(TRomBiosDump)) and<br> (Cardinal(Address) <= High(TRomBiosDump) - SizeOf(Byte) + 1) then<br> Result := PByte(@Dump[Cardinal(Address)])^;<br>end; <br><br>end. <br><br>==========================================<br>4、获取BIOS日期信息 <br><br>{--------------------------------------------------------------------------}<br>{获取BIOS的日期信息,估计可能在2000下适用,但是可能需要获取权限}<br>function GetBiosDate1: String;<br>var<br> Buffer: Array[0..8] Of Char;<br> N: DWORD;<br>begin<br> ReadProcessMemory(GetCurrentProcess,<br> Ptr($FFFF5),<br> @Buffer,<br> 8,<br> N);<br> Buffer[8] := #0;<br> result := StrPas(Buffer)<br>end; <br><br>function GetBiosDate2: String;<br>begin<br> result := string(pchar(ptr($FFFF5)));<br>end;
zlkxzy
Unregistered / Unconfirmed
GUEST, unregistred user!
m8858
Unregistered / Unconfirmed
GUEST, unregistred user!