ADD: CanYouHandleThisFile function to unbz2 plugin

This commit is contained in:
Alexander Koblov 2008-02-15 10:57:19 +00:00
commit 1392879394
2 changed files with 21 additions and 8 deletions

View file

@ -31,18 +31,18 @@ unit bz2func;
interface
uses uWCXhead;
{Mandatory functions}
{ Mandatory functions }
function OpenArchive (var ArchiveData : tOpenArchiveData) : THandle;stdcall;
function ReadHeader (hArcData : THandle; var HeaderData : THeaderData) : Integer;stdcall;
function ProcessFile (hArcData : THandle; Operation : Integer; DestPath, DestName : PChar) : Integer;stdcall;
function CloseArchive (hArcData : THandle) : Integer;stdcall;
procedure SetChangeVolProc (hArcData : THandle; pChangeVolProc : TChangeVolProc);stdcall;
procedure SetProcessDataProc (hArcData : THandle; pProcessDataProc : TProcessDataProc);stdcall;
{Optional functions}
{ Optional functions }
function CanYouHandleThisFile(FileName: PChar): Boolean;stdcall;
implementation
uses bzip2, SysUtils, objects;
uses bzip2, SysUtils, Objects;
var
sArcName : String;
@ -195,5 +195,18 @@ begin
ProcessDataProc := nil;
end;
function CanYouHandleThisFile(FileName: PChar): Boolean;stdcall;
var
bz2bs : TBufStream;
Buffer : array[1..5] of Char;
begin
try
bz2bs.Init(FileName, stOpenRead, SizeOf(Buffer));
bz2bs.Read(Buffer, SizeOf(Buffer));
finally
bz2bs.Done;
end;
Result := (Buffer = 'BZh91');
end;
end.

View file

@ -9,15 +9,15 @@ uses
{$R *.res}
exports
{mandatory}
{ Mandatory }
OpenArchive,
ReadHeader,
ProcessFile,
CloseArchive,
SetChangeVolProc,
SetProcessDataProc;
{optional}
SetProcessDataProc,
{ Optional }
CanYouHandleThisFile;
begin
{$IFNDEF WIN32}