Delphi 判断ISO文件,ISO文件头, ISO FileHead

type
TISOFileHead = record
iFlagBegin: Byte;
Name: array[0..4]of Char;
iFlagEnd : Byte;
DataEnd : Byte;
sSystemName : array[0..31]of Char;
sVolumnName: array[0..31]of Char;
end;
function IsISOFile(sFileName:string):BOOL;
var
FileStream: TFileStream;
ISOFileHead: TISOFileHead;
begin
Result := False;
try
if not FileExists(sFileName) then Exit;
//ISO光盘镜像文件从$8000位置开始 数据为 01 43 44 30 30 31 01 // .CD001.
FileStream:=TFileStream.Create(sFileName, fmOpenRead or fmShareDenyNone);
try
if FileStream.Size<$8000 then Exit;
FileStream.Position:=$8000;
if FileStream.Read(ISOFileHead, SizeOf(TISOFileHead))>0 then
begin
Result := (ISOFileHead.iFlagBegin = 01) and
  (string(ISOFileHead.Name)= 'CD001') and  //这里不同版本的标准可能有所不同,但这个应该是最通用的,其他版本没去看是什么
(ISOFileHead.iFlagEnd = 01 ) and
(ISOFileHead.DataEnd = 0);
end;
finally
FileStream.Destroy;
end;
except
end;
end;

 

posted on 2011-07-19 18:06  峋山隐修会  阅读(459)  评论(0编辑  收藏  举报

导航