全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:2475
推到 Plurk!
推到 Facebook!

請問在WINDOWS2000下怎樣讀取BIOS信息。

答題得分者是:deity
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-11-15 10:38:39 IP:61.233.xxx.xxx 未訂閱
請問在WINDOWS2000下怎樣讀取BIOS信息。
deity
尊榮會員


發表:90
回覆:876
積分:678
註冊:2003-05-09

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-11-15 15:42:46 IP:218.15.xxx.xxx 未訂閱
cxg 您好: 下面的不知是不是您所要的: http://www.lihuasoft.net/article/show.php?id=2368 参考看看 ——行径窄处,留一步与人行——
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-11-16 14:43:49 IP:61.233.xxx.xxx 未訂閱
引言: cxg 您好: 下面的不知是不是您所要的: http://www.lihuasoft.net/article/show.php?id=2368 参考看看 ——行径窄处,留一步与人行—— < face="Verdana, Arial, Helvetica"> 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; 請問以上的 TSHA1Context 和 TSHA1Digest是怎樣定義的?我沒有找到相關的定義。
deity
尊榮會員


發表:90
回覆:876
積分:678
註冊:2003-05-09

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-11-16 22:29:38 IP:219.129.xxx.xxx 未訂閱
cxg您好: 那是因为少了SHA1.pas, Base64.pas文件,加载进去就可以了,下面有个实例可供参考,试试看: http://www.pellesoft.se/communicate/tips/tips.aspx?tid=1442 http://www.latiumsoftware.com/download/p0020.zip ——行径窄处,留一步与人行——
cxg
中階會員


發表:116
回覆:192
積分:76
註冊:2004-02-12

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-11-17 13:14:15 IP:222.35.xxx.xxx 未訂閱
引言: cxg您好: 那是因为少了SHA1.pas, Base64.pas文件,加载进去就可以了,下面有个实例可供参考,试试看: http://www.pellesoft.se/communicate/tips/tips.aspx?tid=1442 http://www.latiumsoftware.com/download/p0020.zip ——行径窄处,留一步与人行——
此方法在WIN2000中还是不能运行,在WIN98中没问题。
deity
尊榮會員


發表:90
回覆:876
積分:678
註冊:2003-05-09

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-11-17 15:37:47 IP:218.15.xxx.xxx 未訂閱
cxg您好: 在WINDOWS2000下您可以通过读取注册表的信息进行获取BIOS信息: 参考下列,自己试试看 转: < class="code"> Question/Problem/Abstract: If you want to get BIOS date and version in Windows NT/2000/XP you've gonna have problems. Answer: Sometimes you might want to get BIOS date and version of the BIOS to use it to create some protection for your program. Under Windows 9X it is very easy to do that. Here's an example: procedure GetBiosInfo (var Name, Copyright, Info, Date: string); const BiosName = $FE061; BiosCopyright = $FE091; BiosInfo = $FEC71; BiosDate = $FFFF5; begin try Name := string (PChar (Ptr (BiosName))); except Name := ''; end; try Copyright := string (PChar (Ptr (BiosCopyright))); except Copyright := ''; end; try Info := string (PChar (Ptr (BiosInfo))); except Info := ''; end; try Date := string (PChar (Ptr (BiosDate))); except Date := ''; end; end; But under Windows NT/2000/XP you've gonna have problems with this procedure because the address space of the bios is protected by the OS an every time you try to access these addresses an exception will be thrown. Happily you can find BIOS date and vesion in the registry(this is valid for Win 9X/ME too but the registry key is different). It is easy to obtain date from the registry but you've gonna have some problems reading the version information because it is stored as multi-string value (something like multirow string) which is not supported by TRegistry class. You can still get it as binary value and with little effort convert it to string list. I've done it for you. Here's an example: //this is the method which gets multi-string values from the registry //and converts them to TStringlist function ReadMultirowKey(reg: TRegistry; Key: string): TStrings; const bufsize = 100; var i: integer; s1: string; sl: TStringList; bin: array[1..bufsize] of char; begin try result := nil; sl := nil; sl := TStringList.Create; if not Assigned(reg) then raise Exception.Create('TRegistry object not assigned.'); FillChar(bin,bufsize,#0); reg.ReadBinaryData(Key,bin,bufsize); i := 1; s1 := ''; while i < bufsize do begin if ord(bin[i]) >= 32 then s1 := s1 bin[i] else begin if Length(s1) > 0 then begin sl.Add(s1); s1 := ''; end; end; inc(i); end; result := sl; except sl.Free; raise; end; end; //this is an example of getting BIOS info from the registry //under Windows NT/2000/XP procedure TBIOSInfo.GetRegInfoWinNT; var Registryv : TRegistry; RegPath : string; sl : TStrings; begin Params.Clear; RegPath := '\HARDWARE\DESCRIPTION\System'; registryv:=tregistry.Create; registryv.rootkey:=HKEY_LOCAL_MACHINE; sl := nil; try registryv.Openkey(RegPath,false); ShowMessage('BIOS Date: ' RegistryV.ReadString('SystemBIOSDate')); sl := ReadMultirowKey(RegistryV,'SystemBIOSVersion'); ShowMessage('BIOS Version: ' sl.Text); except end; Registryv.Free; if Assigned(sl) then sl.Free; end; Now when you know how to get BIOS date and version under all kinds of windows you must only make a function which recognises the version of Windows currentry running and use one of the two methods to obtain these values. This could be easily done using JEDI Component Library's function IsWinNT or using the standard windows API funstion GetVersionEx. ——行径窄处,留一步与人行——
系統時間:2024-07-02 2:52:43
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!