use Total Commander Plugins(PAK) in PB, scan ISO-Files
Posted: Thu Sep 04, 2008 12:03 pm
Hi,
another present for the weekend from your
personal forum comedian.
here is Source to load and execute a Total Commander-Plugin.
There are 3 types of total commander plugins available, this
is the implemetation for packer plugins.
Download a plugin from the totalcommandersite,
for example here is the iso one.
For testing, also check the path of the ISO-file
another present for the weekend from your
personal forum comedian.
here is Source to load and execute a Total Commander-Plugin.
There are 3 types of total commander plugins available, this
is the implemetation for packer plugins.
Download a plugin from the totalcommandersite,
for example here is the iso one.
For testing, also check the path of the ISO-file
Code: Select all
; load and use Total Commander plugin's
; here the PACKER implementation
; Written by Siegfried Rings 4.september,2008 in 1 hour
; (C) by Siegfried Rings
; USE THE SOURCE, luke
#Lib=1
dllname.s="d:\isotest\iso.wcx" ;This is the total commanderplugin (A std DLL file)
isofile.s="d:\isotest\test.iso"
Structure tHeaderData ;=packed record
ArcName.s{260};:array [0..259] of char;
FileName.s{260};:array [0..259] of char;
Flags.l
PackSize.l
UnpSize.l
HostOS.l
FileCRC.l
FileTime.l
UnpVer.l
Method.l
FileAttr.l;:longint;
CmtBuf.l;:pchar;
CmtBufSize.l
CmtSize.l
CmtState.l;:longint;
EndStructure
Structure tOpenArchiveData
ArcName.l;char*
OpenMode.l;int
OpenResult.l;int
CmtBuf.l;char*
CmtBufSize.l;int
CmtSize.l;int
CmtState.l;int
EndStructure
;These are the results of a operation
#E_NO_ERROR = 0;
#E_END_ARCHIVE= 10; {No more files in archive}
#E_NO_MEMORY= 11; {Not enough memory}
#E_BAD_DATA= 12; {Data is bad}
#E_BAD_ARCHIVE= 13; {CRC error in archive data}
#E_UNKNOWN_FORMAT= 14; {Archive format unknown}
#E_EOPEN= 15; {Cannot open existing file}
#E_ECREATE= 16; {Cannot create file}
#E_ECLOSE= 17; {Error closing file}
#E_EREAD= 18; {Error reading from file}
#E_EWRITE= 19; {Error writing to file}
#E_SMALL_BUF= 20; {Buffer too small}
#E_EABORTED= 21; {Function aborted by user}
#E_NO_FILES= 22; {No files found}
#E_TOO_MANY_FILES= 23; {Too many files to pack}
#E_NOT_SUPPORTED= 24; {Function not supported}
;{Unpacking flags}
#PK_OM_LIST= 0;
#PK_OM_EXTRACT= 1;
;{Flags For ProcessFile}
#PK_SKIP= 0; {Skip file (no unpacking)}
#PK_TEST= 1; {Test file integrity}
#PK_EXTRACT= 2; {Extract file to disk}
;{Flags passed through ChangeVolProc}
#PK_VOL_ASK= 0; {Ask user for location of next volume}
#PK_VOL_NOTIFY= 1; {Notify app that next volume will be unpacked}
;{Packing flags}
;{For PackFiles}
#PK_PACK_MOVE_FILES= 1; {Delete original after packing}
#PK_PACK_SAVE_PATHS= 2; {Save path names of files}
;{Returned by GetPackCaps}
#PK_CAPS_NEW= 1; {Can create new archives}
#PK_CAPS_MODIFY= 2; {Can modify exisiting archives}
#PK_CAPS_MULTIPLE= 4; {Archive can contain multiple files}
#PK_CAPS_DELETE= 8; {Can delete files}
#PK_CAPS_OPTIONS= 16; {Supports the options dialogbox}
#PK_CAPS_MEMPACK= 32; {Supports packing in memory}
#PK_CAPS_BY_CONTENT= 64; {Detect archive type by content}
#PK_CAPS_SEARCHTEXT= 128; {Allow searching for text in archives
; { created With this plugin}
#PK_CAPS_HIDE= 256; { Show as normal files (hide packer icon) }
; { open With Ctrl+PgDn, Not Enter }
;{Flags For packing in memory}
#MEM_OPTIONS_WANTHEADERS=1; {Return archive headers with packed data}
;{Errors returned by PackToMem}
#MEMPACK_OK= 0; {Function call finished OK, but there is more data}
#MEMPACK_DONE= 1; {Function call finished OK, there is no more data}
ISOLib=OpenLibrary(#Lib,dllname.s)
If IsoLib
GetPackerCaps=GetFunction(#Lib, "GetPackerCaps")
CanYouHandleThisFile=GetFunction(#Lib, "CanYouHandleThisFile")
SetChangeVolProc=GetFunction(#Lib, "SetChangeVolProc")
SetProcessDataProc=GetFunction(#Lib, "SetProcessDataProc")
;Prototypes are so nice :)
Prototype.l Proto_OpenArchive(OpenArchiveData.l);.tOpenArchiveData)
OpenArchive.Proto_OpenArchive=GetFunction(#Lib, "OpenArchive")
Prototype.l Proto_CloseArchive(Handle.l)
CloseArchive.Proto_CloseArchive=GetFunction(#Lib, "CloseArchive")
Prototype.l Proto_ReadHeader(HANDLEhArcData.l, tHeaderData.l )
ReadHeader.Proto_ReadHeader=GetFunction(#Lib, "ReadHeader")
Prototype.l Proto_ProcessFile(HANDLEhArcData.l, operation.l ,Destpath.s,Destname.s)
ProcessFile.Proto_ProcessFile=GetFunction(#Lib, "ProcessFile")
OpenArchiveData.tOpenArchiveData
OpenArchiveData\ArcName=@isofile
OpenArchiveData\OpenMode=#PK_OM_LIST
OpenArchiveData\OpenResult=0
Buffer.s=Space(260)
OpenArchiveData\CmtBuf=@buffer;
OpenArchiveData\CmtBufSize=260
; CmtSize,
; CmtState:longint;
IsoHandle.l=OpenArchive(OpenArchiveData)
;Debug Isohandle
HeaderData.tHeaderData
HeaderData\CmtBuf=@Buffer
HeaderData\CmtBufsize=Len(Buffer)
Repeat
result=ReadHeader(IsoHandle,HeaderData)
;Debug PeekS(@HeaderData\ArcName,260)
Debug PeekS(@HeaderData\FileName,260)
;Debug HeaderDataFileCRC
Filetype.s=""
;Debug Hex(HeaderData\FileAttr)
If HeaderData\FileAttr & 1:Filetype +"Readonly ":EndIf
If HeaderData\FileAttr & 2:Filetype +"Hidden ":EndIf
If HeaderData\FileAttr & 4:Filetype +"System ":EndIf
If HeaderData\FileAttr & 8:Filetype +"Volume ID ":EndIf
If HeaderData\FileAttr & $10:Filetype +"Directory ":EndIf
If HeaderData\FileAttr & $20:Filetype +"Archive ":EndIf
;If HeaderData\FileAttr & $3F:Filetype +"Any File":EndIf
Debug Filetype
res=ProcessFile(IsoHandle,#PK_SKIP,"","")
Until Result<>#E_NO_ERROR
CloseArchive(IsoHandle)
CloseLibrary(#Lib)
EndIf