﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-vivily</title><link>http://www.cnitblog.com/vivily/</link><description>开发软件，关注硬件</description><language>zh-cn</language><lastBuildDate>Tue, 05 May 2026 00:10:00 GMT</lastBuildDate><pubDate>Tue, 05 May 2026 00:10:00 GMT</pubDate><ttl>60</ttl><item><title>c++builder函数解析（下）</title><link>http://www.cnitblog.com/vivily/archive/2005/05/22/189.html</link><dc:creator>软硬兼施</dc:creator><author>软硬兼施</author><pubDate>Sun, 22 May 2005 04:50:00 GMT</pubDate><guid>http://www.cnitblog.com/vivily/archive/2005/05/22/189.html</guid><wfw:comment>http://www.cnitblog.com/vivily/comments/189.html</wfw:comment><comments>http://www.cnitblog.com/vivily/archive/2005/05/22/189.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vivily/comments/commentRss/189.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vivily/services/trackbacks/189.html</trackback:ping><description><![CDATA[<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>RemoveDir</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>删除指定的目录,如果操作成功,返回真,否则返回假,函数原型如下:<BR>bool __fastcall RemoveDir(const AnsiString Dir);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>RenameFile</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>更改指定文件的名称,如果操作成功,则函数返回真,函数原型如下:<BR>bool __fastcall RenameFile(const AnsiString OldName, const AnsiString NewName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>SetCurrentDir</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>设置当前工作目录,如果操作成功,则返回真,函数原型如下:<BR>bool __fastcall SetCurrentDir(const AnsiString Dir);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrAlloc</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>为字符串分配指定字节的内存,并返回内存指针,函数原型如下:<BR>char * __fastcall StrAlloc(Cardinal Size);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrBufSize</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回*Str所指向内存的大小,函数原型如下:<BR>Cardinal __fastcall StrBufSize(const char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrCat</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>连接两个字符串,并返回目的字符串指针,函数原型如下:<BR>char * __fastcall StrCat(char * Dest, const char * Source);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrComp</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>两个字符串相到比较,返回比较的结果,函数原型如下:<BR>int __fastcall StrComp(const char * Str1, const char * Str2);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrCopy</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将源字符串拷贝到目的字符串中,函数原型如下:<BR>char * __fastcall StrCopy(char * Dest, const char * Source);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrECopy</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将源字符串拷贝到目的字符串中,并返回目的字符串结尾指针,函数原型如下:<BR>char * __fastcall StrECopy(char * Dest, const char * Source);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrEnd</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回字符串结尾指针,函数原型如下:<BR>char * __fastcall StrEnd(const char * Str);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrIComp</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>两个字符串相互比较(不论大小写),返回比较的结果,函数原型如下:<BR>int __fastcall StrIComp(const char * Str1, const char * Str2);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrLCat</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将指定数目的源字符串连接到目的字符串,并返回目的字符串指针,函数原型如下:<BR>char * __fastcall StrLCat(char * Dest, const char * Source, Cardinal MaxLen);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrLComp</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>对两个字符串指定数目的字符进行比较操作,函数原型如下:<BR>int __fastcall StrLComp(const char * Str1, const char * Str2, Cardinal MaxLen);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrLCopy</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将源字符串指定数目的字符拷贝到目的字符串中,并返回目的字符串指针,函数原型如下:<BR>char * __fastcall StrLCopy(char * Dest, const char * Source, Cardinal MaxLen);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrLen</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回字符串的长度,函数原型如下:<BR>Cardinal __fastcall StrLen(const char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrLower</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将字符串转换为小写形式,函数原型如下:<BR>char * __fastcall StrLower(char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrMove</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>从源字符串向目的字符串拷贝指定数目的字符,函数原型如下:<BR>char * __fastcall StrMove(char * Dest, const char * Source, Cardinal Count);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrNew</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在堆中为指定字符串分配空间,并将字符串拷贝到此空间中,函数原型如下:<BR>char * __fastcall StrNew(const char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrPas</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将指定的字符串转换为AnsiString类型字符串对象,函数原型如下:<BR>AnsiString __fastcall StrPas(const char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrPCopy</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将AnsiString类型的源字符串拷贝到目的字符串中,并返回目的字符串指针,函数原型如下:<BR>char * __fastcall StrPCopy(char * Dest, const AnsiString Source);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrPLCopy</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将源字符串(AnsiString类型)指定数目的字符拷贝到目的字符串中,并返回目的字符串指针,函数原型如下:<BR>char * __fastcall StrPLCopy(char * Dest, const AnsiString Source, Cardinal MaxLen);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrPos</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在Strl所指定的字符串中寻找Str2所指定的子字符串,并返回Str2在Str2中第一个子字符的指针,函数原型如下:<BR>char * __fastcall StrPos(const char * Str1, const char * Str2);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrRScan</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在指定的字符串中寻找特定的字符,并返回字符串中最后一个特定字符的指针,函数原型如下:<BR>char * __fastcall StrRScan(const char * Str, char Chr);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrScan</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在指定的字符串中寻找特定的字符,并返回字符串中第一个特定字符的指针,函数原型如下:<BR>char * __fastcall StrScan(const char * Str, char Chr);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToDate</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将字符串对象转换为年月日对象,函数原型如下:<BR>System::TDateTime __fastcall StrToDate(const AnsiString S);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToDateTime</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将字符串对象转换为年月日时间对象,函数原型如下:<BR>System::TDateTime __fastcall StrToDateTime(const AnsiString S);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToFloat</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将AnsiString字符串转换为一个浮点数值,函数原型如下:<BR>Extended __fastcall StrToFloat(const AnsiString S);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToInt</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将AnsiString字符串转换为整数值,如果不能进行转换,则产生EConvertError异常,函数原型如下:<BR>int __fastcall StrToInt(const AnsiString S);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToIntDef</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将AnsiString字符串转换为一个数值,函数原型如下:<BR>int __fastcall StrToIntDef(const System::AnsiString S,int Default);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrToTime</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将字符串对象转换时间对象,函数原型如下:<BR>System::TDateTime __fastcall StrToTime(const AnsiString S);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>StrUpper</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将字符串转换为大写形式,函数原型如下:<BR>char * __fastcall StrUpper(char * Str);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>SysFreeMem</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>释放所指定的内存块.函数原型如下:<BR>int __fastcall SysFreeMem(void * P);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>SysReallocMem</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>要求重新分配参数Size所指定的内存.函数原型如下:<BR>void * __fastcall SysReallocMem(void * P , int Size);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>SystemTimeToDateTime</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将操作系统时间转换为TDateTime对象,函数原型如下:<BR>System::TDateTime __fastcall SystemTimeToDateTime(const _SYSTEMTIME &amp;SystemTime);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>Time</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回TDateTime对象,包含当前的时间信息,函数原型如下:<BR>System::TDateTime __fastcall Time(void);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>TimeToStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将当前日期转换为字符串对象,函数原型如下:<BR>AnsiString __fastcall TimeToStr(System::TDateTime Time);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>UpperCase</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将指定的AnsiString字符串转换为大写形式,函数原型如下:<BR>AnsiString __fastcall UpperCase(const AnsiString S);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE><img src ="http://www.cnitblog.com/vivily/aggbug/189.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vivily/" target="_blank">软硬兼施</a> 2005-05-22 12:50 <a href="http://www.cnitblog.com/vivily/archive/2005/05/22/189.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>c++builder函数解析（上）</title><link>http://www.cnitblog.com/vivily/archive/2005/05/22/188.html</link><dc:creator>软硬兼施</dc:creator><author>软硬兼施</author><pubDate>Sun, 22 May 2005 04:48:00 GMT</pubDate><guid>http://www.cnitblog.com/vivily/archive/2005/05/22/188.html</guid><wfw:comment>http://www.cnitblog.com/vivily/comments/188.html</wfw:comment><comments>http://www.cnitblog.com/vivily/archive/2005/05/22/188.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vivily/comments/commentRss/188.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vivily/services/trackbacks/188.html</trackback:ping><description><![CDATA[<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>AllocMem</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在队中分配指定字节的内存块,并将分配的每一个字节初始化为 0.函数原型如下:<BR>void * __fastcall AllocMem(Cardinal Size);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ChangeFileExt</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>更改指定文件的扩展名,函数原型如下:<BR>AnsiString __fastcall ChangeFileExt(const AnsiString FileName,const AnsiString Extension);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>CompareStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>比较两个AnsiString字符串,函数原型如下:<BR>int __fastcall CompareStr(const AnsiString S1, const AnsiString S2);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>CompareText</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>比较两个AnsiString字符串,函数原型如下:<BR>int __fastcall CompareText(const AnsiString S1, const AnsiString S2);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>CreateDir</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>创建新的目录,如果操作成功,返回真,否则返回假,函数原型如下:<BR>bool __fastcall CreateDir(const AnsiString Dir);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>Date</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回TDateTime对象,包含当前的年月日信息,函数原型如下:<BR>System::TDateTime __fastcall Date(void);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DateTimetoStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将TDateTime对象转换为字符串对象,函数原型如下:<BR>AnsiString __fastcall DateTimeToStr(System::TDateTime DateTime);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DatetimeToString</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将TDateTime对象转换为指定格式的字符串对象,函数原型如下:<BR>void __fastcall DateTimeToString(AnsiString &amp;Result, const AnsiString Format,System::TDateTime DateTime);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DateTimeToSystemTime</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将TDateTime对象转换为操作系统时间,函数原型如下:<BR>void __fastcall DateTimeToSystemTime(System::TDateTime DateTime, _SYSTEMTIME &amp;SystemTime);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DateToStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将TDateTime对象(包含当前年月日信息)转换为字符串对象,函数原型如下:<BR>AnsiString __fastcall DateToStr(System::TDateTime Date);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DeleteFile</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在计算机磁盘中删除指定的文件,如果操作成功,则函数返回真,函数原型如下:<BR>bool __fastcall DeleteFile(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DiskFree</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定磁盘的剩余空间,如果操作成功,返回剩余磁盘空间,如果操作失败,则返回-1,函数原型如下:<BR>int __fastcall DiskFree(Byte Drive);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>DiskSize</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定磁盘的空间,如果操作成功,返回磁盘空间,如果操作失败,则返回-1,函数原型如下:<BR>int __fastcall DiskSize(Byte Drive);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ExtractFileDir</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的工作目录,函数原型如下:<BR>AnsiString __fastcall ExtractFileDir(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ExtractFileDrive</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的驱动器,函数原型如下:<BR>AnsiString __fastcall ExtractFileDrive(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ExtractFileExt</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的扩展名,函数原型如下:<BR>AnsiString __fastcall ExtractFileExt(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ExtractFileName</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的文件名及扩展名,函数原型如下:<BR>AnsiString __fastcall ExtractFileName(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>ExtractFilePath</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的工作路径,函数原型如下:<BR>AnsiString __fastcall ExtractFilePath(const AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileAge</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的时间标签,如果操作失败,则返回-1,函数原型如下:<BR>int __fastcall FileAge(const System::AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileClose</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>关闭指定的文件,函数原型如下:<BR>void __fastcall FileClose(int Handle);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileCreate</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>以指定的文件名称创建一个新的文件,如果返回为正数,表示操作成功,返回值为文件句柄,如果返回值为-1,表示操作失败.函数原型如下:<BR>int __fastcall FileCreate(const System ::AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileExists</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>用于测试指定的文件是否存在,如果存在返回真,否则返回假,函数原型如下:<BR>bool __fastcall FileExists(const System::AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileGetAttr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的属性,如果操作失败,则函数返回-1,函数原型如下; int __fastcall FileGetAttr(const System::AnsiString FileName);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileGetDate</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回指定文件的DOS时间标签,如果操作失败,则近回-1,函数原型如下:<BR>int __fastcall FileGetDate(int Handle);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileOpen</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>打开指定的文件,如果返回为正数,表示操作成功,返回值为文件句柄:如果返回值为-1,表示操作失败,函数原型如下:<BR>int __fastcall FileOpen(const System::AnsiString FileName,int Mode);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileRead</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>从文件中读取指定字节的数据到缓冲区中,函数返回实际读取的字节数,函数原型如下; int __fastcall FileRead(int Handle,void *Buffer,int Count);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileSeek</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>调整文件指针到新的位置,如果操作成功,则返回新的文件位置,如果操作失败,则函数返回-1,函数原型如下:<BR>int __fastcall FileSeek(int Handle,int Offset,int Origin);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileSetAttr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>更改指定文件的属性参数,如果操作成功,则返回0,函数原型如下; int __fastcall FileSetAttr(const System::AnsiString FileName,int Attr);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileSetDate</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>更改指定文件的DOS时间标签,如果操作成功,返回0,否则返回错误代码,函数原型如下:<BR>int __fastcall FileSetDate(int Handle,int Age);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FileWrite</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将缓冲区的数据写入到指定的文件的当前位置中去如果操作成功,函数返回实际写入的字节数,如果返回为-1,则表示操作产生错误,函数原型如下:<BR>int __fastcall FileWrite(int Handle,const void *Buffer,int Count);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="99%">
<TBODY>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FindClose</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>释放FindFirst操作所申请的内存资源,函数原型如下:<BR>void __fastcall FindClose(TSearchRec &amp;F);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FindFirst</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>在指定的文件目录内,搜寻符合特定属性参数的文件,如果成功地查找到符合条件的文件,则函数返回0,否则函数返回一个错误代码,函数原型如下:<BR>int __fastcall FindFirst(const System::AnsiString Path,int Attr,TSearchRec &amp;F);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FindNext</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>继续搜寻FindFirst所指定属性参数的文件,如果成功地查找到符合条件的文件,则函数返回0,否则函数返回一个错误代码,函数原型如下:<BR>int __fastcall FindNext(TSearchRec &amp;F);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FloatToStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将浮点数转换为AnsiString字符串,函数原型如下:<BR>AnsiString __fastcall FloatToStr(Extended Value);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>FloatToStrF</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将浮点数转换为指定格式的AnsiString字符串,函数原型如下:<BR>AnsiString __fastcall FloatToStrF(Extended Value, TFloatFormat Format,int Precision, int Digits);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>GetCurrentDir</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回当前工作目录,函数原型如下:<BR>AnsiString __fastcall GetCurrentDir();</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>IntToHex</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将整数转换为十六进制字符串,函数原型如下:<BR>AnsiString __fastcall IntToHex(int Value, int Digits);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>IntToStr</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将整数转换为AnsiString字符串,函数原型如下:<BR>AnsiString __fastcall IntToStr(int Value);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>LowerCase</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>将指定的AnsiString字符串转换为小写形式,函数原型如下:<BR>AnsiString __fastcall LowerCase(const AnsiString S);</TD></TR></TBODY></TABLE><BR></DIV></TD></TR>
<TR>
<TD vAlign=top>
<DIV align=right>
<TABLE style="BORDER-COLLAPSE: collapse" cellSpacing=0 borderColorDark=#999999 cellPadding=2 width="99%" bgColor=#e3e3e3 borderColorLight=#999999 border=1>
<TBODY>
<TR>
<TD align=middle width=61 height=17>函数名称</TD>
<TD align=left>Now</TD></TR>
<TR>
<TD align=middle width=60 height=21>函数说明</TD>
<TD>返回TDateTime对象,获取当前的日期和时间信息,函数原型如下:<BR>System::TDateTime __fastcall Now(void);</TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE><img src ="http://www.cnitblog.com/vivily/aggbug/188.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vivily/" target="_blank">软硬兼施</a> 2005-05-22 12:48 <a href="http://www.cnitblog.com/vivily/archive/2005/05/22/188.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Win9x/NT下获取硬盘物理序列号</title><link>http://www.cnitblog.com/vivily/archive/2005/05/22/187.html</link><dc:creator>软硬兼施</dc:creator><author>软硬兼施</author><pubDate>Sun, 22 May 2005 04:08:00 GMT</pubDate><guid>http://www.cnitblog.com/vivily/archive/2005/05/22/187.html</guid><wfw:comment>http://www.cnitblog.com/vivily/comments/187.html</wfw:comment><comments>http://www.cnitblog.com/vivily/archive/2005/05/22/187.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/vivily/comments/commentRss/187.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/vivily/services/trackbacks/187.html</trackback:ping><description><![CDATA[#include &lt;WinIOCtl.h&gt;<BR>#include &lt;stdio.h&gt;<BR><BR>#pragma inline<BR>//---------------------------------------------------------------------------<BR>// IDE NT/2000/XP专用变量<BR>#define GETVERSIONOUTPARAMS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GETVERSIONINPARAMS<BR>#define DFP_GET_VERSION&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SMART_GET_VERSION<BR>#define DFP_SEND_DRIVE_COMMAND&nbsp;&nbsp;SMART_SEND_DRIVE_COMMAND<BR>#define DFP_RCV_DRIVE_DATA&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SMART_RCV_DRIVE_DATA<BR><BR>const WORD IDE_ATAPI_IDENTIFY = 0xA1;&nbsp;&nbsp;&nbsp;// 读取ATAPI设备的命令<BR>const WORD IDE_ATA_IDENTIFY&nbsp;&nbsp;&nbsp;= 0xEC;&nbsp;&nbsp;&nbsp;// 读取ATA设备的命令<BR><BR>const int MAX_IDE_DRIVES = 4;<BR><BR>// SCSI专用变量<BR>const DWORD FILE_DEVICE_SCSI&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0x0000001B;<BR>const DWORD IOCTL_SCSI_MINIPORT_IDENTIFY = ((FILE_DEVICE_SCSI &lt;&lt; 16) + 0x0501);<BR>const DWORD IOCTL_SCSI_MINIPORT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0x0004D008; // see NTDDSCSI.H for definition<BR>const DWORD SENDIDLENGTH&nbsp;&nbsp;= sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE;<BR><BR>typedef struct _SRB_IO_CONTROL<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;ULONG HeaderLength;<BR>&nbsp;&nbsp;&nbsp;&nbsp;UCHAR Signature[8];<BR>&nbsp;&nbsp;&nbsp;&nbsp;ULONG Timeout;<BR>&nbsp;&nbsp;&nbsp;&nbsp;ULONG ControlCode;<BR>&nbsp;&nbsp;&nbsp;&nbsp;ULONG ReturnCode;<BR>&nbsp;&nbsp;&nbsp;&nbsp;ULONG Length;<BR>}SRB_IO_CONTROL, *PSRB_IO_CONTROL;<BR><BR>// 读取的主函数<BR>void __fastcall ReadPhysicalDrive(TStrings *pSerList, TStrings *pModeList);<BR><BR>// 辅助函数<BR>char *__fastcall ConvertToString(DWORD dwDiskData[256], int nFirstIndex, int nLastIndex);<BR>// NT/2000/XP函数<BR>void __fastcall ReadPhysicalDriveOnNT(TStrings *pSerList, TStrings *pModeList);<BR>bool __fastcall DoIdentify(HANDLE hPhysicalDriveIOCTL, PSENDCMDINPARAMS pSCIP,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PSENDCMDOUTPARAMS pSCOP, BYTE btIDCmd,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE btDriveNum, PDWORD lpcbBYTEsReturned);<BR>// Windows 9X函数<BR>void __fastcall ReadPhysicalDriveOnW9X(TStrings *pSerList, TStrings *pModeList);<BR>void __fastcall ReadPhysicalDriveOnW9X_Ring0(bool IsFirst, WORD BaseAddress,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE MoS, bool &amp;IsIDEExist, bool &amp;IsDiskExist, WORD *OutData);<BR><BR>// SCSI读取函数(for NT/2000/XP)<BR>String __fastcall ReadIDEDriveAsScsiDriveOnNT();<BR>//---------------------------------------------------------------------------<BR>// ReadPhysicalDrive<BR>void __fastcall ReadPhysicalDrive(TStrings *pSerList, TStrings *pModeList)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;switch(Win32Platform)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case VER_PLATFORM_WIN32_WINDOWS:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReadPhysicalDriveOnW9X(pSerList, pModeList);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case VER_PLATFORM_WIN32_NT:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReadPhysicalDriveOnNT(pSerList, pModeList);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR>//---------------------------------------------------------------------------<BR>// ConvertToString<BR>char *__fastcall ConvertToString(DWORD dwDiskData[256], int nFirstIndex, int nLastIndex)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;static char szResBuf[1024];<BR>&nbsp;&nbsp;&nbsp;&nbsp;int nIndex = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;int nPosition = 0;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Each integer has two characters stored in it backwards<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(nIndex = nFirstIndex; nIndex &lt;= nLastIndex; nIndex++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get high BYTE for 1st character<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;szResBuf[nPosition] = (char)(dwDiskData[nIndex] / 256);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nPosition++;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get low BYTE for 2nd character<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;szResBuf[nPosition] = (char)(dwDiskData[nIndex] % 256);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nPosition++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// End the string<BR>&nbsp;&nbsp;&nbsp;&nbsp;szResBuf[nPosition] = '\0';<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Cut off the trailing blanks<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(nIndex = nPosition - 1; nIndex &gt; 0 &amp;&amp; ' ' == szResBuf[nIndex]; nIndex--)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;szResBuf[nIndex] = '\0';<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return szResBuf;<BR>}<BR>//---------------------------------------------------------------------------<BR>// Winndows NT4/2000/XP 代码<BR>//---------------------------------------------------------------------------<BR>// ReadPhysicalDriveOnNT<BR>void __fastcall ReadPhysicalDriveOnNT(TStrings *pSerList, TStrings *pModeList)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 输出参数<BR>&nbsp;&nbsp;&nbsp;&nbsp;BYTE btIDOutCmd[sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;for(int nDrive=0; nDrive &lt; MAX_IDE_DRIVES; nDrive++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;HANDLE hPhysicalDriveIOCTL;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char szDriveName[32];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sprintf(szDriveName, "\\\\.\\PhysicalDrive%d", nDrive);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;hPhysicalDriveIOCTL = CreateFile(szDriveName,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GENERIC_READ | GENERIC_WRITE,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OPEN_EXISTING, 0, NULL);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(hPhysicalDriveIOCTL != INVALID_HANDLE_VALUE)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwBytesReturned = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;GETVERSIONOUTPARAMS gvopVersionParams;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the version, etc of PhysicalDrive IOCTL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(&amp;gvopVersionParams, sizeof(GETVERSIONOUTPARAMS));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(!DeviceIoControl(hPhysicalDriveIOCTL, DFP_GET_VERSION,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL, 0, &amp;gvopVersionParams, sizeof(gvopVersionParams),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;dwBytesReturned, NULL))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(gvopVersionParams.bIDEDeviceMap &gt; 0)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// IDE or ATAPI IDENTIFY cmd<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE btIDCmd = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SENDCMDINPARAMS InParams;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now, get the ID sector for all IDE devices in the system.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// If the device is ATAPI use the IDE_ATAPI_IDENTIFY command,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// otherwise use the IDE_ATA_IDENTIFY command<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 具体所得结果请参考头文件中的说明<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;btIDCmd = (gvopVersionParams.bIDEDeviceMap &gt;&gt; nDrive &amp; 0x10) ?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IDE_ATAPI_IDENTIFY : IDE_ATA_IDENTIFY;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(&amp;InParams, sizeof(SENDCMDINPARAMS));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(btIDOutCmd, sizeof(btIDOutCmd));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(DoIdentify(hPhysicalDriveIOCTL,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;InParams, (PSENDCMDOUTPARAMS)btIDOutCmd,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(BYTE)btIDCmd, (BYTE)nDrive, &amp;dwBytesReturned))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwDiskData[256];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;USHORT *pIDSector; // 对应结构IDSECTOR，见头文件<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char szSerialNumber[21];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char szModelNumber[41];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pIDSector = (USHORT*)((SENDCMDOUTPARAMS*)btIDOutCmd)-&gt;bBuffer;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int i=0; i &lt; 256; i++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwDiskData[i] = pIDSector[i];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 取系列号<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(szSerialNumber, sizeof(szSerialNumber));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcpy(szSerialNumber, ConvertToString(dwDiskData, 10, 19));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 取模型号<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(szModelNumber, sizeof(szModelNumber));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcpy(szModelNumber, ConvertToString(dwDiskData, 27, 46));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pSerList-&gt;Add(szSerialNumber);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pModeList-&gt;Add(szModelNumber);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CloseHandle (hPhysicalDriveIOCTL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR>//---------------------------------------------------------------------------<BR>// DoIdentify<BR>bool __fastcall DoIdentify(HANDLE hPhysicalDriveIOCTL, PSENDCMDINPARAMS pSCIP,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PSENDCMDOUTPARAMS pSCOP, BYTE btIDCmd, BYTE btDriveNum,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PDWORD pdwBytesReturned)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;// Set up data structures for IDENTIFY command.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;cBufferSize = IDENTIFY_BUFFER_SIZE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bFeaturesReg = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bSectorCountReg&nbsp;&nbsp;= 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bSectorNumberReg = 1;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bCylLowReg&nbsp;&nbsp;= 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bCylHighReg = 0;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// Compute the drive number.（主盘和从盘所对应的值是不一样的）<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bDriveHeadReg = (btDriveNum &amp; 1) ? 0xB0 : 0xA0;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// The command can either be IDE identify or ATAPI identify.<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;irDriveRegs.bCommandReg = btIDCmd;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;bDriveNumber = btDriveNum;<BR>&nbsp;&nbsp;&nbsp;&nbsp;pSCIP-&gt;cBufferSize = IDENTIFY_BUFFER_SIZE;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;return DeviceIoControl(hPhysicalDriveIOCTL, DFP_RCV_DRIVE_DATA,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(LPVOID)pSCIP,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sizeof(SENDCMDINPARAMS) - 1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(LPVOID)pSCOP,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;sizeof(SENDCMDOUTPARAMS) + IDENTIFY_BUFFER_SIZE - 1,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pdwBytesReturned, NULL);<BR>}<BR>//---------------------------------------------------------------------------<BR>// Windows 95/98/ME 代码<BR>//---------------------------------------------------------------------------<BR>// ReadPhysicalDriveOnW9X<BR>void __fastcall ReadPhysicalDriveOnW9X(TStrings *pSerList, TStrings *pModeList)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD wOutData[256];<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// 经过测试，发现第一次调用而且Drive &gt;= 2时会在Ring0代码中出现错误，导致蓝屏。<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 经过N（N &gt; 15）次的蓝屏后仍找不到原因：（，不得不在这里增加一段无用代码以<BR>&nbsp;&nbsp;&nbsp;&nbsp;// 避免蓝屏的出现。（期待高人能指出原因）<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(int nDrive = 0; nDrive &lt; 8; nDrive++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WORD dwBaseAddress;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE btMasterSlave;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Master Or Slave<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bool bIsIDEExist;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bool IsDiskExist;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(nDrive / 2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0: dwBaseAddress = 0x01F0; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1: dwBaseAddress = 0x0170; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2: dwBaseAddress = 0x01E8; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 3: dwBaseAddress = 0x0168; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;btMasterSlave = (BYTE)(((nDrive % 2) == 0) ? 0xA0 : 0xB0);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 进入Ring0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReadPhysicalDriveOnW9X_Ring0(true, dwBaseAddress, btMasterSlave,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsIDEExist, IsDiskExist, wOutData);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;// 开始读取<BR>&nbsp;&nbsp;&nbsp;&nbsp;for(int nDrive = 0; nDrive &lt; 8; nDrive++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WORD dwBaseAddress;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE btMasterSlave;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Master Or Slave<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bool bIsIDEExist;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bool bIsDiskExist;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;switch(nDrive / 2)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 0: dwBaseAddress = 0x01F0; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 1: dwBaseAddress = 0x0170; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 2: dwBaseAddress = 0x01E8; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;case 3: dwBaseAddress = 0x0168; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;btMasterSlave = (BYTE)(((nDrive % 2) == 0) ? 0xA0 : 0xB0);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 进入Ring0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsIDEExist&nbsp;&nbsp;= false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsDiskExist = false;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(wOutData, sizeof(wOutData));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ReadPhysicalDriveOnW9X_Ring0(false, dwBaseAddress, btMasterSlave,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsIDEExist, bIsDiskExist, wOutData);<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(bIsIDEExist &amp;&amp; bIsDiskExist)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwDiskData[256];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;&nbsp;szSerialNumber[21];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char&nbsp;&nbsp;szModelNumber[41];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for(int k=0; k &lt; 256; k++)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dwDiskData[k] = wOutData[k];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 取系列号<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(szSerialNumber, sizeof(szSerialNumber));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcpy(szSerialNumber, ConvertToString(dwDiskData, 10, 19));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 取模型号<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ZeroMemory(szModelNumber, sizeof(szModelNumber));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;strcpy(szModelNumber, ConvertToString(dwDiskData, 27, 46));<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pSerList-&gt;Add(szSerialNumber);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pModeList-&gt;Add(szModelNumber);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetPriorityClass(GetCurrentProcess(), NORMAL_PRIORITY_CLASS);<BR>}<BR>//---------------------------------------------------------------------------<BR>// 为防止不负责任的转载者，在此注明原出处信息，请见谅。<BR>// 资料收集整理：ccrun(老妖)，欢迎光临C++Builder研究: http://www.ccrun.com<BR>//---------------------------------------------------------------------------<BR>// ReadPhysicalDriveOnW9X_Ring0()<BR>//<BR>// dwBaseAddress = IDE(0,1,2,3) : 1F0h, 170h, 1E8h, 168h<BR>// btMasterSlave = Master(0xA0) Or Slave(0xB0)<BR>//---------------------------------------------------------------------------<BR>void __fastcall ReadPhysicalDriveOnW9X_Ring0(bool bIsFirst, WORD dwBaseAddress,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;BYTE btMasterSlave, bool &amp;bIsIDEExist, bool &amp;bIsDiskExist, WORD *pOutData)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;BYTE&nbsp;&nbsp;btIDTR1[6];<BR>&nbsp;&nbsp;&nbsp;&nbsp;DWORD dwOldExceptionHook;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const int nHookExceptionNo = 5;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;BYTE&nbsp;&nbsp;btIsIDEExist = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;BYTE&nbsp;&nbsp;btIsDiskExist = 0;<BR>&nbsp;&nbsp;&nbsp;&nbsp;WORD&nbsp;&nbsp;wOutDataBuf[256];<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;BYTE&nbsp;&nbsp;btIsFirst = (BYTE)bIsFirst;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btBit00 = 0x01;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// const BYTE btBit02 = 0x04;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btBit06 = 0x40;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btBit07 = 0x80;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// const BYTE btERR&nbsp;&nbsp;= btBit00;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btBusy = btBit07;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btAtaCmd&nbsp;&nbsp;&nbsp;= 0xEC;<BR>&nbsp;&nbsp;&nbsp;&nbsp;const BYTE btAtapiCmd = 0xA1;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;__asm<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 必须先执行这条语句<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JMP EnterRing0<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 定义过程<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 等待IDE设备直到其不为忙为止<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;WaitWhileBusy proc<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;EBX, 100000<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD&nbsp;&nbsp;DX, 7<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LoopWhileBusy:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DEC&nbsp;&nbsp;EBX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMP&nbsp;&nbsp;EBX, 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;&nbsp;Timeout<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;&nbsp;&nbsp;AL, DX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEST AL, btBusy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JNZ&nbsp;&nbsp;LoopWhileBusy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JMP&nbsp;&nbsp;DriveReady<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 超时，直接退出<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Timeout:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JMP&nbsp;&nbsp;LeaveRing0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DriveReady:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RET<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENDP&nbsp;&nbsp;&nbsp;// End of WaitWhileBusy Procedure<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 设置主盘和从盘标志<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SelectDevice proc<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD&nbsp;&nbsp;DX, 6<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;AL, btMasterSlave<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out&nbsp;&nbsp;DX, AL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RET<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENDP&nbsp;&nbsp;// End of SelectDevice Procedure<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 向IDE设备发送存取指令<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SendCmd proc<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD DX, 7<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV AL, BL // BL是主从盘标识，在过程外设置<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;out DX, AL<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RET<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ENDP&nbsp;&nbsp;// End of SendCmd Procedure<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Ring0代码<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Ring0Proc:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PUSHAD<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 查询IDE设备是否存在<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD DX, 7<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;&nbsp;AL,DX<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 当AL的值是0xFF或者0x7F时，IDE设备不存在，这时候直接返回<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMP AL,0xFF<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;LeaveRing0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMP AL, 0x7F<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;LeaveRing0<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 设置IDE设备存在标志<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV btIsIDEExist, 1<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 查询IDE设备上的驱动器是否存在（有IDE插槽在主板上，但是却不一定有硬盘插在上面）<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL SelectDevice<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 如果是第一次调用，则直接返回，否则执行下行语句时会出现蓝屏<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CMP&nbsp;&nbsp;btIsFirst, 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;&nbsp;LeaveRing0<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 第一次调用时，如果执行这行语句会导致蓝屏，Why？？？<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// AL的值等于cBit06时，不存在驱动器，直接返回<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEST AL, btBit06<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;&nbsp;LeaveRing0<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 设置驱动器存在标志<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;btIsDiskExist, 1<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 发送存取端口命令<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 无法像NT/2000/XP那样可以通过查询VERSION的值得到驱动器的类型，<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 所以只能一步一步地测试，如果不是ATA设备，再尝试使用ATAPI设备命令<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL SelectDevice&nbsp;&nbsp;&nbsp;&nbsp;// 设置主从盘标识<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;BL, btAtaCmd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 发送读取命令<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL SendCmd<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 检查是否出错<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD&nbsp;&nbsp;DX, 7<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;&nbsp;&nbsp;AL, DX<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEST AL, btBit00<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;&nbsp;RetrieveInfo&nbsp;&nbsp;&nbsp;// 没有错误时则读数据<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 如果出错，则进一步尝试使用ATAPI设备命令<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL SelectDevice<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;BL, btAtapiCmd<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL SendCmd<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CALL WaitWhileBusy<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 检查是否还出错<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD&nbsp;&nbsp;DX, 7<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;in&nbsp;&nbsp;&nbsp;AL, DX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TEST AL, btBit00<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JZ&nbsp;&nbsp;&nbsp;RetrieveInfo&nbsp;&nbsp;&nbsp;// 没有错误时则读数据<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;JMP&nbsp;&nbsp;LeaveRing0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 如果还是出错，直接返回<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 读取数据<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RetrieveInfo:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEA&nbsp;&nbsp;EDI, wOutDataBuf<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;ECX, 256<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV&nbsp;&nbsp;DX, dwBaseAddress<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLD<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REP&nbsp;&nbsp;INSW<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 退出Ring0代码<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LeaveRing0:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;POPAD<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;IRETD<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 激活Ring0代码<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;EnterRing0:<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 修改中断门<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SIDT FWORD PTR btIDTR1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV EAX, DWORD PTR btIDTR1 + 02h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ADD EAX, nHookExceptionNo * 08h + 04h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CLI<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 保存原异常处理例程入口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV ECX, DWORD PTR [EAX]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV CX, WORD PTR [EAX-04h]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV dwOldExceptionHook, ECX<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 指定新入口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEA EBX, Ring0Proc<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV WORD PTR [EAX-04h],BX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SHR EBX, 10h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV WORD PTR[EAX+02h], BX<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 激活Ring0代码<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;INT nHookExceptionNo<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// 复原入口<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV ECX,dwOldExceptionHook<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV WORD PTR[EAX-04h], CX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SHR ECX,10h<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MOV WORD PTR[EAX+02h], CX<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;STI<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>&nbsp;&nbsp;&nbsp;&nbsp;if(!bIsFirst)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsIDEExist&nbsp;&nbsp;= (bool)btIsIDEExist;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;bIsDiskExist = (bool)btIsDiskExist;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CopyMemory(pOutData, wOutDataBuf, sizeof(wOutDataBuf));<BR>&nbsp;&nbsp;&nbsp;&nbsp;}<BR>}<BR>//---------------------------------------------------------------------------<BR>// 调用方法：<BR>void __fastcall TForm1::Button1Click(TObject *Sender)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;ReadPhysicalDrive(Memo1-&gt;Lines, Memo2-&gt;Lines);<BR>}<BR><BR>＃全文完<img src ="http://www.cnitblog.com/vivily/aggbug/187.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/vivily/" target="_blank">软硬兼施</a> 2005-05-22 12:08 <a href="http://www.cnitblog.com/vivily/archive/2005/05/22/187.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>