mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: UnRar plugin
This commit is contained in:
parent
923d167966
commit
8dcaf3bd18
5 changed files with 281 additions and 0 deletions
|
|
@ -12,11 +12,13 @@ del /Q plugins\cpio\bin\*.*
|
|||
del /Q plugins\rpm\bin\*.*
|
||||
del /Q plugins\zip\bin\*.*
|
||||
del /Q plugins\unbz2\bin\*.*
|
||||
del /Q plugins\unrar\bin\*.*
|
||||
|
||||
del /Q plugins\cpio\*.bak
|
||||
del /Q plugins\rpm\*.bak
|
||||
del /Q plugins\zip\*.bak
|
||||
del /Q plugins\unbz2\*.bak
|
||||
del /Q plugins\unrar\*.bak
|
||||
|
||||
del /Q plugins\zip\*.or
|
||||
del /Q plugins\unbz2\*.or
|
||||
|
|
@ -25,6 +27,7 @@ del /Q plugins\cpio\*.*~
|
|||
del /Q plugins\rpm\*.*~
|
||||
del /Q plugins\zip\*.*~
|
||||
del /Q plugins\unbz2\*.*~
|
||||
del /Q plugins\unrar\*.*~
|
||||
|
||||
del /Q components\KASToolBar\lib\i386-win32\*.*
|
||||
del /Q components\viewer\lib\i386-win32\*.*
|
||||
3
plugins/unrar/readme.txt
Normal file
3
plugins/unrar/readme.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
This is plugin only for Windows now.
|
||||
Don't working then compiling under Lazarus (why?). Under Delphi working.
|
||||
Copy unrar.dll in unrar plugin directory.
|
||||
20
plugins/unrar/unrar.dpr
Normal file
20
plugins/unrar/unrar.dpr
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
library unrar;
|
||||
|
||||
uses
|
||||
unrardll;
|
||||
|
||||
{$E wcx}
|
||||
|
||||
exports
|
||||
{mandatory}
|
||||
OpenArchive,
|
||||
ReadHeader,
|
||||
ProcessFile,
|
||||
CloseArchive,
|
||||
SetChangeVolProc,
|
||||
SetProcessDataProc;
|
||||
{optional}
|
||||
//ReadHeaderEx;
|
||||
|
||||
begin
|
||||
end.
|
||||
92
plugins/unrar/unrar.lpi
Normal file
92
plugins/unrar/unrar.lpi
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<PathDelim Value="\"/>
|
||||
<Version Value="5"/>
|
||||
<General>
|
||||
<MainUnit Value="0"/>
|
||||
<IconPath Value="./"/>
|
||||
<TargetFileExt Value=".exe"/>
|
||||
<ActiveEditorIndexAtStart Value="1"/>
|
||||
</General>
|
||||
<VersionInfo>
|
||||
<ProjectVersion Value=""/>
|
||||
<Language Value=""/>
|
||||
<CharSet Value=""/>
|
||||
</VersionInfo>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||
<ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<local>
|
||||
<FormatVersion Value="1"/>
|
||||
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="unrar.dpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<CursorPos X="1" Y="7"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="0"/>
|
||||
<UsageCount Value="20"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="unrardll.pas"/>
|
||||
<UnitName Value="UnRARDLL"/>
|
||||
<CursorPos X="1" Y="1"/>
|
||||
<TopLine Value="1"/>
|
||||
<EditorIndex Value="1"/>
|
||||
<UsageCount Value="10"/>
|
||||
<Loaded Value="True"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
<JumpHistory Count="1" HistoryIndex="0">
|
||||
<Position1>
|
||||
<Filename Value="unrardll.pas"/>
|
||||
<Caret Line="152" Column="3" TopLine="133"/>
|
||||
</Position1>
|
||||
</JumpHistory>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="bin"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<DelphiCompat Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="2"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Options>
|
||||
<ExecutableType Value="Library"/>
|
||||
</Options>
|
||||
</Linking>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="2">
|
||||
<Item1>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item2>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
||||
163
plugins/unrar/unrardll.pas
Normal file
163
plugins/unrar/unrardll.pas
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
{
|
||||
Double commander
|
||||
-------------------------------------------------------------------------
|
||||
WCX plugin for extract *.rar archives
|
||||
This is only wrapper for unrar.dll
|
||||
|
||||
Copyright (C) 2007 Koblov Alexander (Alexx2000@mail.ru)
|
||||
}
|
||||
// Delphi interface unit for UnRAR.dll
|
||||
// Translated from unrar.h
|
||||
// Use Delphi 2.0 and higher to compile this module
|
||||
//
|
||||
// Ported to Delphi by Eugene Kotlyarov, fidonet: 2:5058/26.9 ek@oris.ru
|
||||
// Fixed version by Alexey Torgashin <alextp@mail.ru>, 2:5020/604.24@fidonet
|
||||
//
|
||||
// Revisions:
|
||||
// Aug 2001 - changed call convention for TChangeVolProc and TProcessDataProc
|
||||
// - added RARGetDllVersion function, see comment below
|
||||
//
|
||||
// Jan 2002 - Added RARSetCallback // eugene
|
||||
//
|
||||
// Oct 2002 - Added RARHeaderDataEx, RAROpenArchiveDataEx // eugene
|
||||
|
||||
unit UnRARDLL;
|
||||
|
||||
interface
|
||||
|
||||
uses Windows;
|
||||
|
||||
const
|
||||
RAR_DLL_VERSION = 3;
|
||||
|
||||
UCM_CHANGEVOLUME = 0;
|
||||
UCM_PROCESSDATA = 1;
|
||||
UCM_NEEDPASSWORD = 2;
|
||||
|
||||
type
|
||||
RARHeaderData = packed record
|
||||
ArcName: packed array[0..Pred(260)] of Char;
|
||||
FileName: packed array[0..Pred(260)] of Char;
|
||||
Flags: UINT;
|
||||
PackSize: UINT;
|
||||
UnpSize: UINT;
|
||||
HostOS: UINT;
|
||||
FileCRC: UINT;
|
||||
FileTime: UINT;
|
||||
UnpVer: UINT;
|
||||
Method: UINT;
|
||||
FileAttr: UINT;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
end;
|
||||
|
||||
RARHeaderDataEx = packed record
|
||||
ArcName: packed array [0..1023] of char;
|
||||
ArcNameW: packed array [0..1023] of WideChar;
|
||||
FileName: packed array [0..1023] of char;
|
||||
FileNameW: packed array [0..1023] of WideChar;
|
||||
Flags: UINT;
|
||||
PackSize: UINT;
|
||||
PackSizeHigh: UINT;
|
||||
UnpSize: UINT;
|
||||
UnpSizeHigh: UINT;
|
||||
HostOS: UINT;
|
||||
FileCRC: UINT;
|
||||
FileTime: UINT;
|
||||
UnpVer: UINT;
|
||||
Method: UINT;
|
||||
FileAttr: UINT;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
Reserved: packed array [0..1023] of UINT;
|
||||
end;
|
||||
|
||||
RAROpenArchiveData = packed record
|
||||
ArcName: PChar;
|
||||
OpenMode: UINT;
|
||||
OpenResult: UINT;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
end;
|
||||
|
||||
RAROpenArchiveDataEx = packed record
|
||||
ArcName: PChar;
|
||||
ArcNameW: PWideChar;
|
||||
OpenMode: UINT;
|
||||
OpenResult: UINT;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
Flags: UINT;
|
||||
Reserved: packed array [0..31] of UINT;
|
||||
end;
|
||||
|
||||
TUnrarCallback = function (Msg: UINT; UserData, P1, P2: Integer) :Integer; stdcall;
|
||||
|
||||
const
|
||||
_unrar = 'unrar.dll';
|
||||
|
||||
function OpenArchive(var ArchiveData: RAROpenArchiveData): THandle;
|
||||
stdcall; external _unrar name 'RAROpenArchive';
|
||||
function OpenArchiveEx(var ArchiveData: RAROpenArchiveDataEx): THandle;
|
||||
stdcall; external _unrar name 'RAROpenArchiveEx';
|
||||
function CloseArchive(hArcData: THandle): Integer;
|
||||
stdcall; external _unrar name 'RARCloseArchive';
|
||||
function ReadHeader(hArcData: THandle; var HeaderData: RARHeaderData): Integer;
|
||||
stdcall; external _unrar name 'RARReadHeader';
|
||||
function ReadHeaderEx(hArcData: THandle; var HeaderData: RARHeaderDataEx): Integer;
|
||||
stdcall; external _unrar name 'RARReadHeaderEx';
|
||||
function ProcessFile(hArcData: THandle; Operation: Integer; DestPath, DestName: PChar): Integer;
|
||||
stdcall; external _unrar name 'RARProcessFile';
|
||||
|
||||
|
||||
procedure RARSetCallback(hArcData: THandle; UnrarCallback: TUnrarCallback; UserData: Integer);
|
||||
stdcall; external _unrar;
|
||||
procedure RARSetPassword(hArcData: THandle; Password: PChar);
|
||||
stdcall; external _unrar;
|
||||
|
||||
// Wrapper for DLL's function - old unrar.dll doesn't export RARGetDllVersion
|
||||
// Returns: -1 = DLL not found; 0 = old ver. (C-style callbacks); >0 = new ver.
|
||||
function RARGetDllVersion: integer;
|
||||
|
||||
// obsolete functions
|
||||
type
|
||||
TChangeVolProc = function(ArcName: PChar; Mode: Integer): Integer; stdcall;
|
||||
TProcessDataProc = function(Addr: PUChar; Size: Integer): Integer; stdcall;
|
||||
|
||||
procedure SetChangeVolProc(hArcData: THandle; ChangeVolProc: TChangeVolProc);
|
||||
stdcall; external _unrar name 'RARSetChangeVolProc';
|
||||
procedure SetProcessDataProc(hArcData: THandle; ProcessDataProc: TProcessDataProc);
|
||||
stdcall; external _unrar name 'RARSetProcessDataProc';
|
||||
|
||||
implementation
|
||||
|
||||
type
|
||||
TRARGetDllVersion = function: integer; stdcall;
|
||||
|
||||
function RARGetDllVersion: integer;
|
||||
var
|
||||
h: THandle;
|
||||
f: TRARGetDllVersion;
|
||||
begin
|
||||
h := LoadLibrary(_unrar);
|
||||
if h = 0 then begin
|
||||
Result := -1;
|
||||
Exit
|
||||
end;
|
||||
f := GetProcAddress(h, 'RARGetDllVersion');
|
||||
if @f = nil then
|
||||
Result := 0
|
||||
else
|
||||
Result := f;
|
||||
FreeLibrary(h);
|
||||
end;
|
||||
|
||||
end.
|
||||
Loading…
Add table
Add a link
Reference in a new issue