Стартовый пул
This commit is contained in:
35
unrar/Documentation/Introduction.htm
Normal file
35
unrar/Documentation/Introduction.htm
Normal file
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<p>UnRAR.dll is Windows dynamic-link library, which provides file extraction.
|
||||
from RAR archives. It is available both as 32-bit (unrar.dll) and 64-bit x64
|
||||
(unrar64.dll) versions.</p>
|
||||
|
||||
<p>You can find samples of UnRAR.dll use in "Examples" folder.
|
||||
All samples except C sample (UnRDLL.c) are contributed by unrar.dll users.
|
||||
We at rarlab.com created and tested only UnRDLL.c sample.</p>
|
||||
|
||||
<p>Brief scenario of unrar.dll use includes the call of
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> to open an archive,
|
||||
<a href="RARReadHeaderEx.htm">RARReadHeaderEx</a> to read archive headers,
|
||||
<a href="RARProcessFileW.htm">RARProcessFileW</a> to process read header
|
||||
and <a href="RARCloseArchive.htm">RARCloseArchive</a> to close the archive
|
||||
and free all previously allocated objects.<p>
|
||||
|
||||
<p>If you use this library in Unix, you may need to call
|
||||
setlocale(LC_CTYPE, "") in your application, so Unicode conversion functions
|
||||
work properly.
|
||||
|
||||
<p>Please read <a href="index.htm#functions">the functions description</a>
|
||||
and look into source code in "Examples" folder for more details.</p>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
136
unrar/Documentation/RARCallback.htm
Normal file
136
unrar/Documentation/RARCallback.htm
Normal file
@@ -0,0 +1,136 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>User defined callback function</h3>
|
||||
|
||||
int CALLBACK CallbackProc(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>This function is called by UnRAR.dll library to process different
|
||||
UnRAR events listed below. You can specify the address of this function
|
||||
either in <a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> (preferable)
|
||||
or in <a href="RARSetCallback.htm">RARSetCallback</a> (obsolete)</p>
|
||||
|
||||
<h3>Function parameters</h3>
|
||||
|
||||
<p>The function will be passed four parameters:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<a name="msg"></a>
|
||||
<i>msg</i>
|
||||
<blockquote>
|
||||
<p>Event type. Possible values:</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b>UCM_CHANGEVOLUME<br>
|
||||
UCM_CHANGEVOLUMEW</b>
|
||||
<blockquote>
|
||||
<p>Process volume change.</p>
|
||||
|
||||
<p><b>P1</b> points to the zero terminated name of the next volume.</p>
|
||||
|
||||
<p><b>P2</b> defines the function call mode.</p>
|
||||
<table border=1><tr>
|
||||
<td>RAR_VOL_ASK</td>
|
||||
<td>Required volume is absent. The function should prompt user
|
||||
and return 1 to retry or return -1 value to terminate operation.
|
||||
The function may also set a new volume name, placing up to
|
||||
1024 characters to the address specified by P1 parameter.<br><br>
|
||||
Volume name uses single byte ANSI encoding for UCM_CHANGEVOLUME
|
||||
and Unicode for UCM_CHANGEVOLUMEW. If application provides
|
||||
a new volume name in UCM_CHANGEVOLUMEW, UCM_CHANGEVOLUME
|
||||
is not sent.
|
||||
</td>
|
||||
</tr><tr>
|
||||
<td>RAR_VOL_NOTIFY</td>
|
||||
<td>Required volume is successfully opened. This is a notification
|
||||
call and volume name modification is not allowed. The function
|
||||
should return 1 to continue or -1 to terminate operation.
|
||||
Volume name uses single byte ANSI encoding for UCM_CHANGEVOLUME
|
||||
and Unicode for UCM_CHANGEVOLUMEW.
|
||||
</td>
|
||||
</tr></table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<b>UCM_PROCESSDATA</b>
|
||||
<blockquote>
|
||||
<p>Process unpacked data. It can be used to read a file from memory,
|
||||
while it is being extracted or tested. If you use this event
|
||||
while testing a file, then it makes possible to read file data
|
||||
without extracting file to disk.</p>
|
||||
|
||||
<p>Return 1 to continue processing or -1 to cancel the archive
|
||||
operation.</p>
|
||||
|
||||
<p><b>P1</b> contains the address pointing to the unpacked data.
|
||||
Callback function can read the data but must not modify it.</p>
|
||||
|
||||
<p><b>P2</b> contains the size of the unpacked data. It is guaranteed
|
||||
that this size will not exceed the maximum dictionary size
|
||||
(4 MB in RAR 3.0).</p>
|
||||
</blockquote>
|
||||
<li>
|
||||
<b>UCM_NEEDPASSWORD<br>
|
||||
UCM_NEEDPASSWORDW</b>
|
||||
<blockquote>
|
||||
<p>DLL needs a password to process archive. This message must be
|
||||
processed if you wish to be able to handle encrypted archives.</p>
|
||||
|
||||
<p>Return 1 to continue process or -1 to cancel the archive
|
||||
operation.</p>
|
||||
|
||||
<p><b>P1</b> contains the address pointing to the buffer for
|
||||
a password in single byte encoding. You need to copy a password
|
||||
here. Password uses single byte ANSI encoding for UCM_NEEDPASSWORD
|
||||
and Unicode for UCM_NEEDPASSWORDW. If application provides
|
||||
a password in UCM_NEEDPASSWORDW, UCM_NEEDPASSWORD is not sent.</p>
|
||||
|
||||
<p><b>P2</b> contains the size of password buffer in characters.</p>
|
||||
</blockquote>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UserData</i>
|
||||
<blockquote>
|
||||
<p>User defined value passed to RARSetCallback. You can specify it,
|
||||
when defining the callback function in
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a>
|
||||
or <a href="RARSetCallback.htm">RARSetCallback</a></p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<li>
|
||||
<i>P1</i><br>
|
||||
<i>P2</i>
|
||||
<blockquote>
|
||||
<p>Event dependent parameters. Read <a href="#msg"><i>msg</i> description</a>
|
||||
above for detailed information.<p>
|
||||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<p>In general returning -1 means canceling the operation and returning
|
||||
1 continues processing. Please also read event descriptions above
|
||||
in case we'll add some exceptions from this rule.
|
||||
Return 0 for those event types which you do not process including
|
||||
unknown event types.
|
||||
</p>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<blockquote>
|
||||
Other UnRAR.dll functions must not be called from the callback function.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
42
unrar/Documentation/RARCloseArchive.htm
Normal file
42
unrar/Documentation/RARCloseArchive.htm
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>int PASCAL RARCloseArchive(HANDLE hArcData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>
|
||||
Close RAR archive and release allocated memory. It must be called when
|
||||
archive processing is finished, even if the archive processing was stopped
|
||||
due to an error.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>Success</td></tr>
|
||||
<tr><td>ERAR_ECLOSE</td><td>Archive close error</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
36
unrar/Documentation/RARGetDllVersion.htm
Normal file
36
unrar/Documentation/RARGetDllVersion.htm
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>int PASCAL RARGetDllVersion()</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
Returns API version.
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
None.
|
||||
|
||||
<h3>Return values</h3>
|
||||
<p>Returns an integer value denoting UnRAR.dll API version, which is also
|
||||
defined in unrar.h as RAR_DLL_VERSION. API version number is incremented
|
||||
only in case of noticeable changes in UnRAR.dll API. Do not confuse it
|
||||
with version of UnRAR.dll stored in DLL resources, which is incremented
|
||||
with every DLL rebuild.</p>
|
||||
|
||||
<p>If RARGetDllVersion() returns a value lower than UnRAR.dll, which your
|
||||
application was designed for, it may indicate that DLL version is too old
|
||||
and it may fail to provide all necessary functions to your application.</p>
|
||||
|
||||
<p>This function is missing in very old versions of UnRAR.dll,
|
||||
so it is safer to use LoadLibrary and GetProcAddress to access it.</p>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
183
unrar/Documentation/RARHeaderData.htm
Normal file
183
unrar/Documentation/RARHeaderData.htm
Normal file
@@ -0,0 +1,183 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>RARHeaderData structure</h3>
|
||||
|
||||
<pre>
|
||||
struct RARHeaderData
|
||||
{
|
||||
char ArcName[260];
|
||||
char FileName[260];
|
||||
unsigned int Flags;
|
||||
unsigned int PackSize;
|
||||
unsigned int UnpSize;
|
||||
unsigned int HostOS;
|
||||
unsigned int FileCRC;
|
||||
unsigned int FileTime;
|
||||
unsigned int UnpVer;
|
||||
unsigned int Method;
|
||||
unsigned int FileAttr;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>This structure is used by <a href="RARReadHeader.htm">RARReadHeader</a>
|
||||
function.</p>
|
||||
|
||||
<h3>Structure fields</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<i>ArcName</i>
|
||||
<blockquote>
|
||||
Output parameter which contains a zero terminated string of the
|
||||
current archive name. May be used to determine the current volume name.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileName</i>
|
||||
<blockquote>
|
||||
Output parameter which contains a zero terminated string of the
|
||||
file name in OEM (DOS) encoding.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Flags</i>
|
||||
<blockquote>
|
||||
<p>Output parameter which contains file flags:</p>
|
||||
<table border="1">
|
||||
<tr><td>RHDF_SPLITBEFORE</td><td>0x01</td><td>File continued from previous volume</td></tr>
|
||||
<tr><td>RHDF_SPLITAFTER</td><td>0x02</td><td>File continued on next volume</td></tr>
|
||||
<tr><td>RHDF_ENCRYPTED</td><td>0x04</td><td>File encrypted with password</td></tr>
|
||||
<tr><td></td><td>0x08</td><td>Reserved</td></tr>
|
||||
<tr><td>RHDF_SOLID</td><td>0x10</td><td>Previous files data is used (solid flag)</td></tr>
|
||||
<tr><td>RHDF_DIRECTORY</td><td>0x20</td><td>Directory entry</td></tr>
|
||||
</table>
|
||||
<p>Other bits are reserved.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>PackSize</i>
|
||||
<blockquote>
|
||||
Output parameter. Packed file size or size of file part if file
|
||||
was split between volumes.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UnpSize</i>
|
||||
<blockquote>
|
||||
Output parameter. Unpacked file size.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>HostOS</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Operating system used to create the archive.</p>
|
||||
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>MS DOS</td></tr>
|
||||
<tr><td>1</td><td>OS/2</td></tr>
|
||||
<tr><td>2</td><td>Windows</td></tr>
|
||||
<tr><td>3</td><td>Unix</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileCRC</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains unpacked file CRC32. In case of file
|
||||
parts split between volumes only the last part contains the correct
|
||||
CRC and it is accessible only in RAR_OM_LIST_INCSPLIT listing mode.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileTime</i>
|
||||
<blockquote>
|
||||
Output parameter. Contains the file modification date and time in standard
|
||||
MS DOS format.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UnpVer</i>
|
||||
<blockquote>
|
||||
Output parameter. RAR version needed to extract file.
|
||||
It is encoded as 10 * Major version + minor version.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Method</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Packing method.</p>
|
||||
|
||||
<table border="1">
|
||||
<tr><td>0x30</td><td>Storing</td></tr>
|
||||
<tr><td>0x31</td><td>Fastest compression</td></tr>
|
||||
<tr><td>0x32</td><td>Fast compression</td></tr>
|
||||
<tr><td>0x33</td><td>Normal compression</td></tr>
|
||||
<tr><td>0x34</td><td>Good compression</td></tr>
|
||||
<tr><td>0x35</td><td>Best compression</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileAttr</i>
|
||||
<blockquote>
|
||||
Output parameter. File attributes.
|
||||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<li>
|
||||
<i>CmtBuf</i>
|
||||
<blockquote>
|
||||
<p>Input parameter. Points to the buffer for file comment.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.
|
||||
Appropriate parameters are preserved only for compatibility
|
||||
with older versions.</p>
|
||||
<p>Set this field to NULL.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBufSize</i>
|
||||
<blockquote>
|
||||
<p>Input parameter. Size of buffer for file comments.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Set this field to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtSize</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Size of file comment read into buffer.<p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Always equal to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtState</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. State of file comment.<p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Always equal to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARReadHeader.htm">RARReadHeader</a> function.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
292
unrar/Documentation/RARHeaderDataEx.htm
Normal file
292
unrar/Documentation/RARHeaderDataEx.htm
Normal file
@@ -0,0 +1,292 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>RARHeaderDataEx structure</h3>
|
||||
|
||||
<pre>
|
||||
struct RARHeaderDataEx
|
||||
{
|
||||
char ArcName[1024];
|
||||
wchar_t ArcNameW[1024];
|
||||
char FileName[1024];
|
||||
wchar_t FileNameW[1024];
|
||||
unsigned int Flags;
|
||||
unsigned int PackSize;
|
||||
unsigned int PackSizeHigh;
|
||||
unsigned int UnpSize;
|
||||
unsigned int UnpSizeHigh;
|
||||
unsigned int HostOS;
|
||||
unsigned int FileCRC;
|
||||
unsigned int FileTime;
|
||||
unsigned int UnpVer;
|
||||
unsigned int Method;
|
||||
unsigned int FileAttr;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
unsigned int DictSize;
|
||||
unsigned int HashType;
|
||||
char Hash[32];
|
||||
unsigned int RedirType;
|
||||
wchar_t *RedirName;
|
||||
unsigned int RedirNameSize;
|
||||
unsigned int DirTarget;
|
||||
unsigned int Reserved[994];
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>This structure is used by <a href="RARReadHeaderEx.htm">RARReadHeaderEx</a>
|
||||
function. Please fill either the entire structure or at least its Reserved
|
||||
field with zeroes before passing to RARReadHeaderEx.</p>
|
||||
|
||||
<h3>Structure fields</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<i>ArcName</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains a zero terminated string of the current
|
||||
archive name. May be used to determine the current volume name.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>ArcNameW</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains a zero terminated string of the current
|
||||
archive name in Unicode. May be used to determine the current volume name.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileName</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains a zero terminated string of the file name
|
||||
in OEM (DOS) encoding.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileNameW</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains a zero terminated string of the file name
|
||||
in Unicode.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Flags</i>
|
||||
<blockquote>
|
||||
<p>Output parameter which contains file flags:</p>
|
||||
<table border="1">
|
||||
<tr><td>RHDF_SPLITBEFORE</td><td>0x01</td><td>File continued from previous volume</td></tr>
|
||||
<tr><td>RHDF_SPLITAFTER</td><td>0x02</td><td>File continued on next volume</td></tr>
|
||||
<tr><td>RHDF_ENCRYPTED</td><td>0x04</td><td>File encrypted with password</td></tr>
|
||||
<tr><td></td><td>0x08</td><td>Reserved</td></tr>
|
||||
<tr><td>RHDF_SOLID</td><td>0x10</td><td>Previous files data is used (solid flag)</td></tr>
|
||||
<tr><td>RHDF_DIRECTORY</td><td>0x20</td><td>Directory entry</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>PackSize</i>
|
||||
<blockquote>
|
||||
Output parameter. Lower 32 bits of packed file size. If file is split
|
||||
between volumes, it contains the lower 32 bits of file part size.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>PackSizeHigh</i>
|
||||
<blockquote>
|
||||
Output parameter. Higher 32 bits of packed file size. If file is split
|
||||
between volumes, it contains the higher 32 bits of file part size.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UnpSize</i>
|
||||
<blockquote>
|
||||
Output parameter. Lower 32 bits of unpacked file size.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UnpSizeHigh</i>
|
||||
<blockquote>
|
||||
Output parameter. Higher 32 bits of unpacked file size.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>HostOS</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Operating system used to create the archive.</p>
|
||||
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>MS DOS</td></tr>
|
||||
<tr><td>1</td><td>OS/2</td></tr>
|
||||
<tr><td>2</td><td>Windows</td></tr>
|
||||
<tr><td>3</td><td>Unix</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileCRC</i>
|
||||
<blockquote>
|
||||
Output parameter, which contains unpacked file CRC32. In case of file
|
||||
parts split between volumes only the last part contains the correct
|
||||
CRC and it is accessible only in RAR_OM_LIST_INCSPLIT listing mode.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileTime</i>
|
||||
<blockquote>
|
||||
Output parameter. Contains the file modification date and time in standard
|
||||
MS DOS format.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UnpVer</i>
|
||||
<blockquote>
|
||||
Output parameter. RAR version needed to extract file.
|
||||
It is encoded as 10 * Major version + minor version.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Method</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Packing method.</p>
|
||||
|
||||
<table border="1">
|
||||
<tr><td>0x30</td><td>Storing</td></tr>
|
||||
<tr><td>0x31</td><td>Fastest compression</td></tr>
|
||||
<tr><td>0x32</td><td>Fast compression</td></tr>
|
||||
<tr><td>0x33</td><td>Normal compression</td></tr>
|
||||
<tr><td>0x34</td><td>Good compression</td></tr>
|
||||
<tr><td>0x35</td><td>Best compression</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>FileAttr</i>
|
||||
<blockquote>
|
||||
Output parameter. File attributes.
|
||||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<li>
|
||||
<i>CmtBuf</i>
|
||||
<blockquote>
|
||||
<p>Input parameter. Points to the buffer for file comment.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.
|
||||
Appropriate parameters are preserved only for compatibility
|
||||
with older versions.</p>
|
||||
<p>Set this field to NULL.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBufSize</i>
|
||||
<blockquote>
|
||||
<p>Input parameter. Size of buffer for file comments.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Set this field to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtSize</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Size of file comment read into buffer.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Always equal to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtState</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. State of file comment.</p>
|
||||
<p>File comment support is not implemented in current unrar.dll version.</p>
|
||||
<p>Always equal to 0.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>DictSize</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Size of file compression dictionary in kilobytes.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>HashType</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Type of hash function used to protect file data
|
||||
integrity. Can be RAR_HASH_NONE (no checksum or unknown hash function type),
|
||||
RAR_HASH_CRC32 (CRC32) or RAR_HASH_BLAKE2 (BLAKE2sp)</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Hash</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. If HashType is equal to RAR_HASH_BLAKE2, this array
|
||||
contains 32 bytes of file data BLAKE2sp hash.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>RedirType</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Type of file system redirection.</p>
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>No redirection, usual file.</td></tr>
|
||||
<tr><td>1</td><td>Unix symbolic link</td></tr>
|
||||
<tr><td>2</td><td>Windows symbolic link</td></tr>
|
||||
<tr><td>3</td><td>Windows junction</td></tr>
|
||||
<tr><td>4</td><td>Hard link</td></tr>
|
||||
<tr><td>5</td><td>File reference saved with -oi switch</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>RedirName</i>
|
||||
<blockquote>
|
||||
<p>Input/output parameter. Pointer to buffer to receive file system
|
||||
redirection target name, such as target of symbolic link or file reference.
|
||||
It is returned as stored in archive and its value might be not immediately
|
||||
applicable for further use. For example, you may need to remove \??\
|
||||
or UNC\ prefixes for Windows junctions or prepend the extraction
|
||||
destination path.</p>
|
||||
<p>If you set RedirName to NULL, it is ignored and nothing is returned
|
||||
here.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>RedirNameSize</i>
|
||||
<blockquote>
|
||||
<p>Input parameter. Size of buffer specified in RedirName. Ignored if
|
||||
RedirName is NULL.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>DirTarget</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Non-zero if RedirType is symbolic link
|
||||
and RedirName points to directory.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Reserved</i>
|
||||
<blockquote>
|
||||
Reserved for future use. The entire array must be filled with zeroes
|
||||
before passing RARHeaderDataEx structure to RARReadHeaderEx.
|
||||
</blockquote>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARReadHeaderEx.htm">RARReadHeaderEx</a> function.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
38
unrar/Documentation/RAROpenArchive.htm
Normal file
38
unrar/Documentation/RAROpenArchive.htm
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>Open RAR archive and allocate memory structures.</p>
|
||||
<p>This function is obsolete. It does not support Unicode names
|
||||
and does not allow to specify the callback function. It is recommended
|
||||
to use <a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> instead.<p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>ArchiveData</i>
|
||||
<blockquote>
|
||||
Points to <a href="RAROpenArchiveData.htm">RAROpenArchiveData structure</a>.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
Archive handle or NULL in case of error.
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchiveData.htm">RAROpenArchiveData</a> structure.
|
||||
</blockquote>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
137
unrar/Documentation/RAROpenArchiveData.htm
Normal file
137
unrar/Documentation/RAROpenArchiveData.htm
Normal file
@@ -0,0 +1,137 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>RAROpenArchiveData structure</h3>
|
||||
|
||||
<pre>
|
||||
struct RAROpenArchiveData
|
||||
{
|
||||
char *ArcName;
|
||||
UINT OpenMode;
|
||||
UINT OpenResult;
|
||||
char *CmtBuf;
|
||||
UINT CmtBufSize;
|
||||
UINT CmtSize;
|
||||
UINT CmtState;
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>This structure is used by <a href="RAROpenArchive.htm">RAROpenArchive</a>
|
||||
function.</p>
|
||||
|
||||
<h3>Structure fields</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<i>ArcName</i>
|
||||
<blockquote>
|
||||
Input parameter which should point to zero terminated string
|
||||
containing the archive name.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>OpenMode</i>
|
||||
<blockquote>
|
||||
<p>Input parameter.</p>
|
||||
|
||||
<p>Possible values</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b>RAR_OM_LIST</b>
|
||||
<p>Open archive for reading file headers only.</p>
|
||||
|
||||
<li>
|
||||
<b>RAR_OM_EXTRACT</b>
|
||||
<p>Open archive for testing and extracting files.</p>
|
||||
|
||||
<li>
|
||||
<b>RAR_OM_LIST_INCSPLIT</b>
|
||||
<p>Open archive for reading file headers only. If you open an archive
|
||||
in such mode, RARReadHeader[Ex] will return all file headers,
|
||||
including those with "file continued from previous volume" flag.
|
||||
In case of RAR_OM_LIST such headers are automatically skipped.
|
||||
So if you process RAR volumes in RAR_OM_LIST_INCSPLIT mode, you will
|
||||
get several file header records for same file if file is split between
|
||||
volumes. For such files only the last file header record will contain
|
||||
the correct file CRC and if you wish to get the correct packed size,
|
||||
you need to sum up packed sizes of all parts.</p>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>OpenResult</i>
|
||||
<blockquote>
|
||||
<p>Output parameter.</p>
|
||||
|
||||
<p>Possible values:</p>
|
||||
|
||||
<table border=1>
|
||||
<tr><td> 0 </td><td> Success</td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory to initialize data structures</td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> Archive header broken</td></tr>
|
||||
<tr><td> ERAR_UNKNOWN_FORMAT </td><td> Unknown encryption used for archive headers </td></tr>
|
||||
<tr><td> ERAR_EOPEN </td><td> File open error</td></tr>
|
||||
<tr><td> ERAR_BAD_PASSWORD </td>
|
||||
<td>Entered password is invalid. This code is returned only for archives
|
||||
in RAR 5.0 format</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBuf</i>
|
||||
<blockquote>
|
||||
Input parameter which should point to the buffer for archive
|
||||
comments. Maximum comment size is limited to 64Kb. Comment text is
|
||||
zero terminated. If the comment text is larger than the buffer
|
||||
size, the comment text will be truncated. If CmtBuf is set to
|
||||
NULL, comments will not be read.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBufSize</i>
|
||||
<blockquote>
|
||||
Input parameter which should contain size of buffer for archive
|
||||
comments.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtSize</i>
|
||||
<blockquote>
|
||||
Output parameter containing size of comments actually read into the
|
||||
buffer, cannot exceed CmtBufSize.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtState</i>
|
||||
<blockquote>
|
||||
<p>Output parameter.</p>
|
||||
|
||||
<p>Possible values:</p>
|
||||
|
||||
<table border=1>
|
||||
<tr><td> 0 </td><td> Comments are not present</td></tr>
|
||||
<tr><td> 1 </td><td> Comments are read completely</td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory to extract comments</td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> Broken comment</td></tr>
|
||||
<tr><td> ERAR_SMALL_BUF </td><td> Buffer is too small, comments are not read completely.</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
</ul>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> function.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
194
unrar/Documentation/RAROpenArchiveDataEx.htm
Normal file
194
unrar/Documentation/RAROpenArchiveDataEx.htm
Normal file
@@ -0,0 +1,194 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>RAROpenArchiveDataEx structure</h3>
|
||||
|
||||
<pre>
|
||||
struct RAROpenArchiveDataEx
|
||||
{
|
||||
char *ArcName;
|
||||
wchar_t *ArcNameW;
|
||||
unsigned int OpenMode;
|
||||
unsigned int OpenResult;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
unsigned int Flags;
|
||||
UNRARCALLBACK Callback;
|
||||
LPARAM UserData;
|
||||
unsigned int Reserved[28];
|
||||
};
|
||||
</pre>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>This structure is used by <a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a>
|
||||
function.</p>
|
||||
|
||||
<h3>Structure fields</h3>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<i>ArcName</i>
|
||||
<blockquote>
|
||||
Input parameter which should point to zero terminated string
|
||||
containing the archive name or NULL if only Unicode name is specified.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>ArcNameW</i>
|
||||
<blockquote>
|
||||
Input parameter which should point to zero terminated Unicode string
|
||||
containing the archive name or NULL if Unicode name is not specified.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>OpenMode</i>
|
||||
<blockquote>
|
||||
<p>Input parameter.</p>
|
||||
|
||||
<p>Possible values</p>
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
<b>RAR_OM_LIST</b>
|
||||
<p>Open archive for reading file headers only.</p>
|
||||
|
||||
<li>
|
||||
<b>RAR_OM_EXTRACT</b>
|
||||
<p>Open archive for testing and extracting files.</p>
|
||||
|
||||
<li>
|
||||
<b>RAR_OM_LIST_INCSPLIT</b>
|
||||
<p>Open archive for reading file headers only. If you open an archive
|
||||
in such mode, RARReadHeader[Ex] will return all file headers,
|
||||
including those with "file continued from previous volume" flag.
|
||||
In case of RAR_OM_LIST such headers are automatically skipped.
|
||||
So if you process RAR volumes in RAR_OM_LIST_INCSPLIT mode, you will
|
||||
get several file header records for same file if file is split between
|
||||
volumes. For such files only the last file header record will contain
|
||||
the correct file CRC and if you wish to get the correct packed size,
|
||||
you need to sum up packed sizes of all parts.</p>
|
||||
</ul>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>OpenResult</i>
|
||||
<blockquote>
|
||||
<p>Output parameter.</p>
|
||||
|
||||
<p>Possible values:</p>
|
||||
|
||||
<table border=1>
|
||||
<tr><td> 0 </td><td> Success</td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory to initialize data structures</td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> Archive header broken</td></tr>
|
||||
<tr><td> ERAR_UNKNOWN_FORMAT </td><td> Unknown encryption used for archive headers </td></tr>
|
||||
<tr><td> ERAR_EOPEN </td><td> File open error</td></tr>
|
||||
<tr><td> ERAR_BAD_PASSWORD </td>
|
||||
<td>Entered password is invalid. This code is returned only for archives
|
||||
in RAR 5.0 format</td></tr>
|
||||
</table>
|
||||
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBuf</i>
|
||||
<blockquote>
|
||||
Input parameter which should point to the buffer for archive
|
||||
comments. Maximum comment size is limited to 64Kb. Comment text is
|
||||
zero terminated. If the comment text is larger than the buffer
|
||||
size, the comment text will be truncated. If CmtBuf is set to
|
||||
NULL, comments will not be read.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtBufSize</i>
|
||||
<blockquote>
|
||||
Input parameter which should contain size of buffer for archive
|
||||
comments.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtSize</i>
|
||||
<blockquote>
|
||||
Output parameter containing size of comments actually read into the
|
||||
buffer, cannot exceed CmtBufSize.
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>CmtState</i>
|
||||
<blockquote>
|
||||
<p>Output parameter.</p>
|
||||
|
||||
<p>Possible values:</p>
|
||||
|
||||
<table border=1>
|
||||
<tr><td> 0 </td><td> Comments are not present</td></tr>
|
||||
<tr><td> 1 </td><td> Comments are read completely</td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory to extract comments</td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> Broken comment</td></tr>
|
||||
<tr><td> ERAR_SMALL_BUF </td><td> Buffer is too small, comments are not read completely.</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Flags</i>
|
||||
<blockquote>
|
||||
<p>Output parameter. Combination of bit flags..</p>
|
||||
|
||||
<p>Possible values:</p>
|
||||
|
||||
<table border=1>
|
||||
<tr><td> 0x0001 </td><td> Volume attribute (archive volume)</td></tr>
|
||||
<tr><td> 0x0002 </td><td> Archive comment present</td></tr>
|
||||
<tr><td> 0x0004 </td><td> Archive lock attribute</td></tr>
|
||||
<tr><td> 0x0008 </td><td> Solid attribute (solid archive)</td></tr>
|
||||
<tr><td> 0x0010 </td><td> New volume naming scheme ('volname.partN.rar')</td></tr>
|
||||
<tr><td> 0x0020 </td><td> Authenticity information present</td></tr>
|
||||
<tr><td> 0x0040 </td><td> Recovery record present</td></tr>
|
||||
<tr><td> 0x0080 </td><td> Block headers are encrypted</td></tr>
|
||||
<tr><td> 0x0100 </td><td> First volume (set only by RAR 3.0 and later)</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Callback</i>
|
||||
<blockquote>
|
||||
<p>Address of <a href="RARCallback.htm">user defined callback function</a>
|
||||
to process UnRAR events.</p>
|
||||
<p>Set it to NULL if you do not want to define the callback function.
|
||||
Callback function is required to process multivolume and encrypted
|
||||
archives properly.</p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>UserData</i>
|
||||
<blockquote>
|
||||
<p>User defined value, which will be passed to
|
||||
<a href="RARCallback.htm">callback function.</a></p>
|
||||
</blockquote>
|
||||
|
||||
<li>
|
||||
<i>Reserved[28]</i>
|
||||
<blockquote>
|
||||
<p>Reserved for future use. Must be zero.</p>
|
||||
</blockquote>
|
||||
|
||||
</ul>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchive.htm">RAROpenArchiveEx</a> function.<br>
|
||||
<a href="RARCallback.htm">User defined callback function</a>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
38
unrar/Documentation/RAROpenArchiveEx.htm
Normal file
38
unrar/Documentation/RAROpenArchiveEx.htm
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>Open RAR archive and allocate memory structures. Replaces the obsolete
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> providing more options
|
||||
and Unicode names support.
|
||||
</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>ArchiveData</i>
|
||||
<blockquote>
|
||||
Points to <a href="RAROpenArchiveDataEx.htm">RAROpenArchiveDataEx structure</a>.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
Archive handle or NULL in case of error.
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchiveDataEx.htm">RAROpenArchiveDataEx</a> structure.
|
||||
</blockquote>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
118
unrar/Documentation/RARProcessFile.htm
Normal file
118
unrar/Documentation/RARProcessFile.htm
Normal file
@@ -0,0 +1,118 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>
|
||||
int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Performs the user defined action and moves the current position
|
||||
in the archive to the next file.</p>
|
||||
|
||||
<p>If archive is opened in RAR_OM_EXTRACT mode, this function extracts
|
||||
or tests the current file and sets the archive position to the next file.</p>
|
||||
|
||||
<p>If open mode is RAR_OM_LIST, then a call to this function will skip
|
||||
the current file and set the archive position to the next file.</p>
|
||||
|
||||
<p>It is recommended to use <a href="RARProcessFileW.htm">RARProcessFileW</a>
|
||||
insted of this function, because RARProcessFileW supports Unicode.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>Operation</i>
|
||||
<blockquote>
|
||||
<p>File operation.</p>
|
||||
|
||||
<p>Possible values</p>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>RAR_SKIP</td>
|
||||
<td>Move to the next file in the archive. If archive is solid
|
||||
and RAR_OM_EXTRACT mode was set when the archive was opened,
|
||||
the current file is analyzed and operation is performed slower
|
||||
than a simple seek.</td>
|
||||
</tr><tr>
|
||||
<td>RAR_TEST</td>
|
||||
<td>Test the current file and move to the next file in the archive.
|
||||
If the archive was opened in RAR_OM_LIST mode, the operation
|
||||
is equal to RAR_SKIP.</td>
|
||||
</tr><tr>
|
||||
<td>RAR_EXTRACT</td>
|
||||
<td>Extract the current file and move to the next file in the archive.
|
||||
If the archive was opened with RAR_OM_LIST mode, the operation
|
||||
is equal to RAR_SKIP.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<i>DestPath</i>
|
||||
<blockquote>
|
||||
<p>This parameter should point to a zero terminated string, containing
|
||||
the destination directory to place the extracted files to. If DestPath
|
||||
is equal to NULL, it means extracting to the current directory.
|
||||
This parameter has meaning only if DestName is NULL.</p>
|
||||
|
||||
<p>This parameter must be in OEM encoding. If necessary, use CharToOem
|
||||
to convert text to OEM before passing it as DestPath.</p>
|
||||
</blockquote>
|
||||
|
||||
<i>DestName</i>
|
||||
<blockquote>
|
||||
<p>This parameter should point to a zero terminated string, containing
|
||||
the full path and name to assign to extracted file or it can be NULL
|
||||
to use the default name. If DestName is defined (not NULL),
|
||||
it overrides both the original file name stored in the archive
|
||||
and path specified in DestPath setting.</p>
|
||||
|
||||
<p>This parameter must be in OEM encoding. If necessary, use CharToOem
|
||||
to convert text to OEM before passing it as DestName.</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
<table border="1">
|
||||
<tr><td> 0 </td><td> Success </td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> File CRC error </td></tr>
|
||||
<tr><td> ERAR_UNKNOWN_FORMAT </td><td> Unknown archive format </td></tr>
|
||||
<tr><td> ERAR_EOPEN </td><td> Volume open error </td></tr>
|
||||
<tr><td> ERAR_ECREATE </td><td> File create error </td></tr>
|
||||
<tr><td> ERAR_ECLOSE </td><td> File close error </td></tr>
|
||||
<tr><td> ERAR_EREAD </td><td> Read error </td></tr>
|
||||
<tr><td> ERAR_EWRITE </td><td> Write error </td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory</td></tr>
|
||||
<tr><td> ERAR_EREFERENCE </td>
|
||||
<td>When attempting to unpack a reference record (see RAR -oi switch),
|
||||
source file for this reference was not found. Entire archive needs to be
|
||||
unpacked to properly create file references. This error is returned when
|
||||
attempting to unpack the reference record without its source file.</td></tr>
|
||||
<tr><td> ERAR_BAD_PASSWORD </td>
|
||||
<td>Entered password is invalid. This code is returned only for archives
|
||||
in RAR 5.0 format</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<blockquote>
|
||||
If you wish to cancel extraction, return -1 when processing UCM_PROCESSDATA
|
||||
message in <a href="RARCallback.htm">user defined callback function</a>.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
109
unrar/Documentation/RARProcessFileW.htm
Normal file
109
unrar/Documentation/RARProcessFileW.htm
Normal file
@@ -0,0 +1,109 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Performs the user defined action and moves the current position
|
||||
in the archive to the next file.</p>
|
||||
|
||||
<p>If archive is opened in RAR_OM_EXTRACT mode, this function extracts
|
||||
or tests the current file and sets the archive position to the next file.</p>
|
||||
|
||||
<p>If open mode is RAR_OM_LIST, then a call to this function will skip
|
||||
the current file and set the archive position to the next file.</p>
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>Operation</i>
|
||||
<blockquote>
|
||||
<p>File operation.</p>
|
||||
|
||||
<p>Possible values</p>
|
||||
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td>RAR_SKIP</td>
|
||||
<td>Move to the next file in the archive. If archive is solid
|
||||
and RAR_OM_EXTRACT mode was set when the archive was opened,
|
||||
the current file is analyzed and operation is performed slower
|
||||
than a simple seek.</td>
|
||||
</tr><tr>
|
||||
<td>RAR_TEST</td>
|
||||
<td>Test the current file and move to the next file in the archive.
|
||||
If the archive was opened in RAR_OM_LIST mode, the operation
|
||||
is equal to RAR_SKIP.</td>
|
||||
</tr><tr>
|
||||
<td>RAR_EXTRACT</td>
|
||||
<td>Extract the current file and move to the next file in the archive.
|
||||
If the archive was opened with RAR_OM_LIST mode, the operation
|
||||
is equal to RAR_SKIP.</td>
|
||||
</tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<i>DestPath</i>
|
||||
<blockquote>
|
||||
<p>This parameter should point to a zero terminated Unicode string,
|
||||
containing the destination directory to place the extracted files to.
|
||||
If DestPath is equal to NULL, it means extracting to the current directory.
|
||||
This parameter has meaning only if DestName is NULL.</p>
|
||||
</blockquote>
|
||||
|
||||
<i>DestName</i>
|
||||
<blockquote>
|
||||
<p>This parameter should point to a zero terminated Unicode string,
|
||||
containing the full path and name to assign to extracted file
|
||||
or it can be NULL to use the default name. If DestName is defined
|
||||
(not NULL), it overrides both the original file name stored
|
||||
in the archive and path specified in DestPath setting.</p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
<table border="1">
|
||||
<tr><td> 0 </td><td> Success </td></tr>
|
||||
<tr><td> ERAR_BAD_DATA </td><td> File CRC error </td></tr>
|
||||
<tr><td> ERAR_UNKNOWN_FORMAT </td><td> Unknown archive format </td></tr>
|
||||
<tr><td> ERAR_EOPEN </td><td> Volume open error </td></tr>
|
||||
<tr><td> ERAR_ECREATE </td><td> File create error </td></tr>
|
||||
<tr><td> ERAR_ECLOSE </td><td> File close error </td></tr>
|
||||
<tr><td> ERAR_EREAD </td><td> Read error </td></tr>
|
||||
<tr><td> ERAR_EWRITE </td><td> Write error </td></tr>
|
||||
<tr><td> ERAR_NO_MEMORY </td><td> Not enough memory</td></tr>
|
||||
<tr><td> ERAR_EREFERENCE </td>
|
||||
<td>When attempting to unpack a reference record (see RAR -oi switch),
|
||||
source file for this reference was not found. Entire archive needs to be
|
||||
unpacked to properly create file references. This error is returned when
|
||||
attempting to unpack the reference record without its source file.</td></tr>
|
||||
<tr><td> ERAR_BAD_PASSWORD </td>
|
||||
<td>Entered password is invalid. This code is returned only for archives
|
||||
in RAR 5.0 format</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<h3>Notes</h3>
|
||||
<blockquote>
|
||||
If you wish to cancel extraction, return -1 when processing UCM_PROCESSDATA
|
||||
message in <a href="RARCallback.htm">user defined callback function</a>.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
51
unrar/Documentation/RARReadHeader.htm
Normal file
51
unrar/Documentation/RARReadHeader.htm
Normal file
@@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>Read a file header from archive.</p>
|
||||
<p>This function is obsolete. It does not support Unicode names
|
||||
and 64 bit file sizes. It is recommended to use
|
||||
<a href="RARReadHeaderEx.htm">RARReadHeaderEx</a> instead.<p>
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>HeaderData</i>
|
||||
<blockquote>
|
||||
Points to <a href="RARHeaderData.htm">RARHeaderData structure</a>.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>Success</td></tr>
|
||||
<tr><td>ERAR_END_ARCHIVE</td><td>End of archive</td></tr>
|
||||
<tr><td>ERAR_BAD_DATA</td><td>File header broken</td></tr>
|
||||
<tr><td>ERAR_MISSING_PASSWORD</td><td>Password was not provided
|
||||
for encrypted file header</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARHeaderData.htm">RARHeaderData</a> structure.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
48
unrar/Documentation/RARReadHeaderEx.htm
Normal file
48
unrar/Documentation/RARReadHeaderEx.htm
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
<p>Read a file header from archive.</p>
|
||||
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>HeaderData</i>
|
||||
<blockquote>
|
||||
Points to <a href="RARHeaderDataEx.htm">RARHeaderDataEx structure</a>.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
<table border="1">
|
||||
<tr><td>0</td><td>Success</td></tr>
|
||||
<tr><td>ERAR_END_ARCHIVE</td><td>End of archive</td></tr>
|
||||
<tr><td>ERAR_BAD_DATA</td><td>File header broken</td></tr>
|
||||
<tr><td>ERAR_MISSING_PASSWORD</td><td>Password was not provided
|
||||
for encrypted file header</td></tr>
|
||||
</table>
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARHeaderDataEx.htm">RARHeaderDataEx</a> structure.
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
64
unrar/Documentation/RARSetCallback.htm
Normal file
64
unrar/Documentation/RARSetCallback.htm
Normal file
@@ -0,0 +1,64 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>void PASCAL RARSetCallback(HANDLE hArcData,
|
||||
int PASCAL (*Callback)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2),
|
||||
LPARAM UserData)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Set a <a href="RARCallback.htm">user defined callback function</a>
|
||||
to process UnRAR events.</p>
|
||||
|
||||
<p>RARSetCallback is obsolete and less preferable way to specify the callback
|
||||
function. Recommended approach is to set <i>Callback</i> and <i>UserData</i>
|
||||
fields in <a href="RAROpenArchiveDataEx.htm">RAROpenArchiveDataEx</a>
|
||||
structure, when calling <a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a>.
|
||||
If you use RARSetCallback, you will not be able to read the archive comment
|
||||
in archives with encrypted headers. If you do not need the archive comment,
|
||||
you can continue to use RARSetCallback.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>Callback</i>
|
||||
<blockquote>
|
||||
<p>Address of <a href="RARCallback.htm">user defined callback function</a>
|
||||
to process UnRAR events.</p>
|
||||
<p>Set it to NULL if you do not want to define the callback function.
|
||||
Callback function is required to process multivolume and encrypted
|
||||
archives properly.</p>
|
||||
</blockquote>
|
||||
|
||||
<i>UserData</i>
|
||||
<blockquote>
|
||||
<p>User defined value, which will be passed to
|
||||
<a href="RARCallback.htm">callback function.</a></p>
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
None.
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARCallback.htm">User defined callback function</a>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
21
unrar/Documentation/RARSetChangeVolProc.htm
Normal file
21
unrar/Documentation/RARSetChangeVolProc.htm
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>
|
||||
void PASCAL RARSetChangeVolProc(HANDLE hArcData,
|
||||
int PASCAL (*ChangeVolProc)(char *ArcName,int Mode))
|
||||
</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
Obsolete. Use <a href="RARCallback.htm">the callback function</a> instead.
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
49
unrar/Documentation/RARSetPassword.htm
Normal file
49
unrar/Documentation/RARSetPassword.htm
Normal file
@@ -0,0 +1,49 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>void PASCAL RARSetPassword(HANDLE hArcData,char *Password)</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
<p>Set a password to decrypt files.</p>
|
||||
|
||||
<p>This function does not allow to process archives with encrypted headers.
|
||||
It can be used only for archives with encrypted file data and unencrypted
|
||||
headers. So the recommended way to set a password is UCM_NEEDPASSWORDW
|
||||
message in <a href="RARCallback.htm">user defined callback function</a>.
|
||||
Unlike RARSetPassword, UCM_NEEDPASSWORDW can be used for all types of
|
||||
encrypted RAR archives.</p>
|
||||
|
||||
<h3>Parameters</h3>
|
||||
|
||||
<i>hArcData</i>
|
||||
<blockquote>
|
||||
This parameter should contain the archive handle obtained from
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a> or
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a> function call.
|
||||
</blockquote>
|
||||
|
||||
<i>Password</i>
|
||||
<blockquote>
|
||||
Zero terminated string containing a password.
|
||||
</blockquote>
|
||||
|
||||
<h3>Return values</h3>
|
||||
<blockquote>
|
||||
None.
|
||||
</blockquote>
|
||||
|
||||
<h3>See also</h3>
|
||||
<blockquote>
|
||||
<a href="RARCallback.htm">User defined callback function</a>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
21
unrar/Documentation/RARSetProcessDataProc.htm
Normal file
21
unrar/Documentation/RARSetProcessDataProc.htm
Normal file
@@ -0,0 +1,21 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h3>
|
||||
void PASCAL RARSetProcessDataProc(HANDLE hArcData,
|
||||
int PASCAL (*ProcessDataProc)(unsigned char *Addr,int Size))
|
||||
</h3>
|
||||
|
||||
<h3>Description</h3>
|
||||
|
||||
Obsolete. Use <a href="RARCallback.htm">the callback function</a> instead.
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
40
unrar/Documentation/index.htm
Normal file
40
unrar/Documentation/index.htm
Normal file
@@ -0,0 +1,40 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>UnRAR.dll Manual</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<h2>UnRAR.dll decompression library</h2>
|
||||
|
||||
<b><p><a href="Introduction.htm">Introduction</a><p></b>
|
||||
|
||||
<a name="functions"></a>
|
||||
<h3>Functions</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchive.htm">RAROpenArchive</a><br>
|
||||
<a href="RAROpenArchiveEx.htm">RAROpenArchiveEx</a><br>
|
||||
<a href="RARCloseArchive.htm">RARCloseArchive</a><br>
|
||||
<a href="RARReadHeader.htm">RARReadHeader</a><br>
|
||||
<a href="RARReadHeaderEx.htm">RARReadHeaderEx</a><br>
|
||||
<a href="RARProcessFile.htm">RARProcessFile</a><br>
|
||||
<a href="RARProcessFileW.htm">RARProcessFileW</a><br>
|
||||
<a href="RARSetCallback.htm">RARSetCallback</a><br>
|
||||
<a href="RARSetChangeVolProc.htm">RARSetChangeVolProc</a><br>
|
||||
<a href="RARSetProcessDataProc.htm">RARSetProcessDataProc</a><br>
|
||||
<a href="RARSetPassword.htm">RARSetPassword</a><br>
|
||||
<a href="RARGetDllVersion.htm">RARGetDllVersion</a><br>
|
||||
</blockquote>
|
||||
|
||||
<h3>Structures</h3>
|
||||
<blockquote>
|
||||
<a href="RAROpenArchiveData.htm">RAROpenArchiveData</a><br>
|
||||
<a href="RAROpenArchiveDataEx.htm">RAROpenArchiveDataEx</a><br>
|
||||
<a href="RARHeaderData.htm">RARHeaderData</a><br>
|
||||
<a href="RARHeaderDataEx.htm">RARHeaderDataEx</a><br>
|
||||
</blockquote>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
58
unrar/Examples/C#/AssemblyInfo.cs
Normal file
58
unrar/Examples/C#/AssemblyInfo.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
//
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
//
|
||||
[assembly: AssemblyTitle("Unrar Tester")]
|
||||
[assembly: AssemblyDescription("Unrar DLL Example Project")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Schematrix")]
|
||||
[assembly: AssemblyProduct("UnrarTester")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
//
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
|
||||
//
|
||||
// In order to sign your assembly you must specify a key to use. Refer to the
|
||||
// Microsoft .NET Framework documentation for more information on assembly signing.
|
||||
//
|
||||
// Use the attributes below to control which key is used for signing.
|
||||
//
|
||||
// Notes:
|
||||
// (*) If no key is specified, the assembly is not signed.
|
||||
// (*) KeyName refers to a key that has been installed in the Crypto Service
|
||||
// Provider (CSP) on your machine. KeyFile refers to a file which contains
|
||||
// a key.
|
||||
// (*) If the KeyFile and the KeyName values are both specified, the
|
||||
// following processing occurs:
|
||||
// (1) If the KeyName can be found in the CSP, that key is used.
|
||||
// (2) If the KeyName does not exist and the KeyFile does exist, the key
|
||||
// in the KeyFile is installed into the CSP and used.
|
||||
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
|
||||
// When specifying the KeyFile, the location of the KeyFile should be
|
||||
// relative to the project output directory which is
|
||||
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
|
||||
// located in the project directory, you would specify the AssemblyKeyFile
|
||||
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
|
||||
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
|
||||
// documentation for more information on this.
|
||||
//
|
||||
[assembly: AssemblyDelaySign(false)]
|
||||
[assembly: AssemblyKeyFile("")]
|
||||
[assembly: AssemblyKeyName("")]
|
186
unrar/Examples/C#/TextInputDialog.cs
Normal file
186
unrar/Examples/C#/TextInputDialog.cs
Normal file
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Schematrix
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for TextInputDialog.
|
||||
/// </summary>
|
||||
public class TextInputDialog : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.TextBox InputValue;
|
||||
private System.Windows.Forms.Button OKButton;
|
||||
private System.Windows.Forms.Button ResetButton;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
private System.Windows.Forms.Button CanxButton;
|
||||
private string defaultValue=string.Empty;
|
||||
|
||||
public TextInputDialog()
|
||||
{
|
||||
//
|
||||
// Required for Windows Form Designer support
|
||||
//
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return(InputValue.Text);
|
||||
}
|
||||
set
|
||||
{
|
||||
if(value!=InputValue.Text)
|
||||
{
|
||||
InputValue.Text=value;
|
||||
InputValue.SelectionStart=value.Length;
|
||||
InputValue.SelectionLength=0;
|
||||
defaultValue=value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Prompt
|
||||
{
|
||||
get
|
||||
{
|
||||
return(this.Text);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.Text=value;
|
||||
}
|
||||
}
|
||||
|
||||
public char PasswordChar
|
||||
{
|
||||
get
|
||||
{
|
||||
return InputValue.PasswordChar;
|
||||
}
|
||||
set
|
||||
{
|
||||
InputValue.PasswordChar=value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SelectAll()
|
||||
{
|
||||
InputValue.SelectAll();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.InputValue = new System.Windows.Forms.TextBox();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.CanxButton = new System.Windows.Forms.Button();
|
||||
this.ResetButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// InputValue
|
||||
//
|
||||
this.InputValue.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.InputValue.Location = new System.Drawing.Point(0, 0);
|
||||
this.InputValue.Name = "InputValue";
|
||||
this.InputValue.Size = new System.Drawing.Size(304, 20);
|
||||
this.InputValue.TabIndex = 1;
|
||||
this.InputValue.Text = "";
|
||||
//
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.OKButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.OKButton.Location = new System.Drawing.Point(40, 26);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(64, 24);
|
||||
this.OKButton.TabIndex = 2;
|
||||
this.OKButton.Text = "OK";
|
||||
//
|
||||
// CanxButton
|
||||
//
|
||||
this.CanxButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.CanxButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CanxButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.CanxButton.Location = new System.Drawing.Point(184, 26);
|
||||
this.CanxButton.Name = "CanxButton";
|
||||
this.CanxButton.Size = new System.Drawing.Size(64, 24);
|
||||
this.CanxButton.TabIndex = 3;
|
||||
this.CanxButton.Text = "Cancel";
|
||||
//
|
||||
// ResetButton
|
||||
//
|
||||
this.ResetButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.ResetButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.ResetButton.Location = new System.Drawing.Point(112, 26);
|
||||
this.ResetButton.Name = "ResetButton";
|
||||
this.ResetButton.Size = new System.Drawing.Size(64, 24);
|
||||
this.ResetButton.TabIndex = 4;
|
||||
this.ResetButton.Text = "Reset";
|
||||
this.ResetButton.Click += new System.EventHandler(this.ResetButton_Click);
|
||||
//
|
||||
// TextInputDialog
|
||||
//
|
||||
this.AcceptButton = this.OKButton;
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(304, 54);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.ResetButton);
|
||||
this.Controls.Add(this.CanxButton);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.Controls.Add(this.InputValue);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.KeyPreview = true;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "TextInputDialog";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
|
||||
this.Text = "TextInputDialog";
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextInputDialog_KeyDown);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void ResetButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
InputValue.Text=defaultValue;
|
||||
}
|
||||
|
||||
private void TextInputDialog_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
|
||||
{
|
||||
if(e.KeyCode==Keys.Escape)
|
||||
this.DialogResult=DialogResult.Cancel;
|
||||
}
|
||||
}
|
||||
}
|
166
unrar/Examples/C#/TextInputDialog.resx
Normal file
166
unrar/Examples/C#/TextInputDialog.resx
Normal file
@@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="InputValue.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="InputValue.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="InputValue.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="OKButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="OKButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="OKButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="CanxButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="CanxButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="CanxButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="ResetButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="ResetButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="ResetButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>2, 2</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>TextInputDialog</value>
|
||||
</data>
|
||||
</root>
|
969
unrar/Examples/C#/Unrar.cs
Normal file
969
unrar/Examples/C#/Unrar.cs
Normal file
@@ -0,0 +1,969 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
|
||||
|
||||
/* Author: Michael A. McCloskey
|
||||
* Company: Schematrix
|
||||
* Version: 20040714
|
||||
*
|
||||
* Personal Comments:
|
||||
* I created this unrar wrapper class for personal use
|
||||
* after running into a number of issues trying to use
|
||||
* another COM unrar product via COM interop. I hope it
|
||||
* proves as useful to you as it has to me and saves you
|
||||
* some time in building your own products.
|
||||
*/
|
||||
|
||||
namespace Schematrix
|
||||
{
|
||||
#region Event Delegate Definitions
|
||||
|
||||
/// <summary>
|
||||
/// Represents the method that will handle data available events
|
||||
/// </summary>
|
||||
public delegate void DataAvailableHandler(object sender, DataAvailableEventArgs e);
|
||||
/// <summary>
|
||||
/// Represents the method that will handle extraction progress events
|
||||
/// </summary>
|
||||
public delegate void ExtractionProgressHandler(object sender, ExtractionProgressEventArgs e);
|
||||
/// <summary>
|
||||
/// Represents the method that will handle missing archive volume events
|
||||
/// </summary>
|
||||
public delegate void MissingVolumeHandler(object sender, MissingVolumeEventArgs e);
|
||||
/// <summary>
|
||||
/// Represents the method that will handle new volume events
|
||||
/// </summary>
|
||||
public delegate void NewVolumeHandler(object sender, NewVolumeEventArgs e);
|
||||
/// <summary>
|
||||
/// Represents the method that will handle new file notifications
|
||||
/// </summary>
|
||||
public delegate void NewFileHandler(object sender, NewFileEventArgs e);
|
||||
/// <summary>
|
||||
/// Represents the method that will handle password required events
|
||||
/// </summary>
|
||||
public delegate void PasswordRequiredHandler(object sender, PasswordRequiredEventArgs e);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper class for unrar DLL supplied by RARSoft.
|
||||
/// Calls unrar DLL via platform invocation services (pinvoke).
|
||||
/// DLL is available at http://www.rarlab.com/rar/UnRARDLL.exe
|
||||
/// </summary>
|
||||
public class Unrar : IDisposable
|
||||
{
|
||||
#region Unrar DLL enumerations
|
||||
|
||||
/// <summary>
|
||||
/// Mode in which archive is to be opened for processing.
|
||||
/// </summary>
|
||||
public enum OpenMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Open archive for listing contents only
|
||||
/// </summary>
|
||||
List=0,
|
||||
/// <summary>
|
||||
/// Open archive for testing or extracting contents
|
||||
/// </summary>
|
||||
Extract=1
|
||||
}
|
||||
|
||||
private enum RarError : uint
|
||||
{
|
||||
EndOfArchive=10,
|
||||
InsufficientMemory=11,
|
||||
BadData=12,
|
||||
BadArchive=13,
|
||||
UnknownFormat=14,
|
||||
OpenError=15,
|
||||
CreateError=16,
|
||||
CloseError=17,
|
||||
ReadError=18,
|
||||
WriteError=19,
|
||||
BufferTooSmall=20,
|
||||
UnknownError=21
|
||||
}
|
||||
|
||||
private enum Operation : uint
|
||||
{
|
||||
Skip=0,
|
||||
Test=1,
|
||||
Extract=2
|
||||
}
|
||||
|
||||
private enum VolumeMessage : uint
|
||||
{
|
||||
Ask=0,
|
||||
Notify=1
|
||||
}
|
||||
|
||||
[Flags]
|
||||
private enum ArchiveFlags : uint
|
||||
{
|
||||
Volume=0x1, // Volume attribute (archive volume)
|
||||
CommentPresent=0x2, // Archive comment present
|
||||
Lock=0x4, // Archive lock attribute
|
||||
SolidArchive=0x8, // Solid attribute (solid archive)
|
||||
NewNamingScheme=0x10, // New volume naming scheme ('volname.partN.rar')
|
||||
AuthenticityPresent=0x20, // Authenticity information present
|
||||
RecoveryRecordPresent=0x40, // Recovery record present
|
||||
EncryptedHeaders=0x80, // Block headers are encrypted
|
||||
FirstVolume=0x100 // 0x0100 - First volume (set only by RAR 3.0 and later)
|
||||
}
|
||||
|
||||
private enum CallbackMessages : uint
|
||||
{
|
||||
VolumeChange=0,
|
||||
ProcessData=1,
|
||||
NeedPassword=2
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unrar DLL structure definitions
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
|
||||
private struct RARHeaderData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
|
||||
public string ArcName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
|
||||
public string FileName;
|
||||
public uint Flags;
|
||||
public uint PackSize;
|
||||
public uint UnpSize;
|
||||
public uint HostOS;
|
||||
public uint FileCRC;
|
||||
public uint FileTime;
|
||||
public uint UnpVer;
|
||||
public uint Method;
|
||||
public uint FileAttr;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string CmtBuf;
|
||||
public uint CmtBufSize;
|
||||
public uint CmtSize;
|
||||
public uint CmtState;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.CmtBuf=new string((char)0, 65536);
|
||||
this.CmtBufSize=65536;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
|
||||
public struct RARHeaderDataEx
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=512)]
|
||||
public string ArcName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)]
|
||||
public string ArcNameW;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=512)]
|
||||
public string FileName;
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=1024)]
|
||||
public string FileNameW;
|
||||
public uint Flags;
|
||||
public uint PackSize;
|
||||
public uint PackSizeHigh;
|
||||
public uint UnpSize;
|
||||
public uint UnpSizeHigh;
|
||||
public uint HostOS;
|
||||
public uint FileCRC;
|
||||
public uint FileTime;
|
||||
public uint UnpVer;
|
||||
public uint Method;
|
||||
public uint FileAttr;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string CmtBuf;
|
||||
public uint CmtBufSize;
|
||||
public uint CmtSize;
|
||||
public uint CmtState;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=1024)]
|
||||
public uint[] Reserved;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.CmtBuf=new string((char)0, 65536);
|
||||
this.CmtBufSize=65536;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet=CharSet.Ansi)]
|
||||
public struct RAROpenArchiveData
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
|
||||
public string ArcName;
|
||||
public uint OpenMode;
|
||||
public uint OpenResult;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string CmtBuf;
|
||||
public uint CmtBufSize;
|
||||
public uint CmtSize;
|
||||
public uint CmtState;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.CmtBuf=new string((char)0,65536);
|
||||
this.CmtBufSize=65536;
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct RAROpenArchiveDataEx
|
||||
{
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string ArcName;
|
||||
[MarshalAs(UnmanagedType.LPWStr)]
|
||||
public string ArcNameW;
|
||||
public uint OpenMode;
|
||||
public uint OpenResult;
|
||||
[MarshalAs(UnmanagedType.LPStr)]
|
||||
public string CmtBuf;
|
||||
public uint CmtBufSize;
|
||||
public uint CmtSize;
|
||||
public uint CmtState;
|
||||
public uint Flags;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst=32)]
|
||||
public uint[] Reserved;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
this.CmtBuf=new string((char)0,65536);
|
||||
this.CmtBufSize=65536;
|
||||
this.Reserved=new uint[32];
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unrar function declarations
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern IntPtr RAROpenArchive(ref RAROpenArchiveData archiveData);
|
||||
|
||||
[DllImport("UNRAR.DLL")]
|
||||
private static extern IntPtr RAROpenArchiveEx(ref RAROpenArchiveDataEx archiveData);
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern int RARCloseArchive(IntPtr hArcData);
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern int RARReadHeader(IntPtr hArcData, ref RARHeaderData headerData);
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern int RARReadHeaderEx(IntPtr hArcData, ref RARHeaderDataEx headerData);
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern int RARProcessFile(IntPtr hArcData, int operation,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string destPath,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string destName );
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern void RARSetCallback(IntPtr hArcData, UNRARCallback callback, int userData);
|
||||
|
||||
[DllImport("unrar.dll")]
|
||||
private static extern void RARSetPassword(IntPtr hArcData,
|
||||
[MarshalAs(UnmanagedType.LPStr)] string password);
|
||||
|
||||
// Unrar callback delegate signature
|
||||
private delegate int UNRARCallback(uint msg, int UserData, IntPtr p1, int p2);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public event declarations
|
||||
|
||||
/// <summary>
|
||||
/// Event that is raised when a new chunk of data has been extracted
|
||||
/// </summary>
|
||||
public event DataAvailableHandler DataAvailable;
|
||||
/// <summary>
|
||||
/// Event that is raised to indicate extraction progress
|
||||
/// </summary>
|
||||
public event ExtractionProgressHandler ExtractionProgress;
|
||||
/// <summary>
|
||||
/// Event that is raised when a required archive volume is missing
|
||||
/// </summary>
|
||||
public event MissingVolumeHandler MissingVolume;
|
||||
/// <summary>
|
||||
/// Event that is raised when a new file is encountered during processing
|
||||
/// </summary>
|
||||
public event NewFileHandler NewFile;
|
||||
/// <summary>
|
||||
/// Event that is raised when a new archive volume is opened for processing
|
||||
/// </summary>
|
||||
public event NewVolumeHandler NewVolume;
|
||||
/// <summary>
|
||||
/// Event that is raised when a password is required before continuing
|
||||
/// </summary>
|
||||
public event PasswordRequiredHandler PasswordRequired;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private fields
|
||||
|
||||
private string archivePathName=string.Empty;
|
||||
private IntPtr archiveHandle=new IntPtr(0);
|
||||
private bool retrieveComment=true;
|
||||
private string password=string.Empty;
|
||||
private string comment=string.Empty;
|
||||
private ArchiveFlags archiveFlags=0;
|
||||
private RARHeaderDataEx header=new RARHeaderDataEx();
|
||||
private string destinationPath=string.Empty;
|
||||
private RARFileInfo currentFile=null;
|
||||
private UNRARCallback callback=null;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Object lifetime procedures
|
||||
|
||||
public Unrar()
|
||||
{
|
||||
this.callback=new UNRARCallback(RARCallback);
|
||||
}
|
||||
|
||||
public Unrar(string archivePathName) : this()
|
||||
{
|
||||
this.archivePathName=archivePathName;
|
||||
}
|
||||
|
||||
~Unrar()
|
||||
{
|
||||
if(this.archiveHandle!=IntPtr.Zero)
|
||||
{
|
||||
Unrar.RARCloseArchive(this.archiveHandle);
|
||||
this.archiveHandle=IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if(this.archiveHandle!=IntPtr.Zero)
|
||||
{
|
||||
Unrar.RARCloseArchive(this.archiveHandle);
|
||||
this.archiveHandle=IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Path and name of RAR archive to open
|
||||
/// </summary>
|
||||
public string ArchivePathName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.archivePathName;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.archivePathName=value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Archive comment
|
||||
/// </summary>
|
||||
public string Comment
|
||||
{
|
||||
get
|
||||
{
|
||||
return(this.comment);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Current file being processed
|
||||
/// </summary>
|
||||
public RARFileInfo CurrentFile
|
||||
{
|
||||
get
|
||||
{
|
||||
return(this.currentFile);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default destination path for extraction
|
||||
/// </summary>
|
||||
public string DestinationPath
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.destinationPath;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.destinationPath=value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Password for opening encrypted archive
|
||||
/// </summary>
|
||||
public string Password
|
||||
{
|
||||
get
|
||||
{
|
||||
return(this.password);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.password=value;
|
||||
if(this.archiveHandle!=IntPtr.Zero)
|
||||
RARSetPassword(this.archiveHandle, value);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Close the currently open archive
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Close()
|
||||
{
|
||||
// Exit without exception if no archive is open
|
||||
if(this.archiveHandle==IntPtr.Zero)
|
||||
return;
|
||||
|
||||
// Close archive
|
||||
int result=Unrar.RARCloseArchive(this.archiveHandle);
|
||||
|
||||
// Check result
|
||||
if(result!=0)
|
||||
{
|
||||
ProcessFileError(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.archiveHandle=IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens archive specified by the ArchivePathName property for testing or extraction
|
||||
/// </summary>
|
||||
public void Open()
|
||||
{
|
||||
if(this.ArchivePathName.Length==0)
|
||||
throw new IOException("Archive name has not been set.");
|
||||
this.Open(this.ArchivePathName, OpenMode.Extract);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens archive specified by the ArchivePathName property with a specified mode
|
||||
/// </summary>
|
||||
/// <param name="openMode">Mode in which archive should be opened</param>
|
||||
public void Open(OpenMode openMode)
|
||||
{
|
||||
if(this.ArchivePathName.Length==0)
|
||||
throw new IOException("Archive name has not been set.");
|
||||
this.Open(this.ArchivePathName, openMode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens specified archive using the specified mode.
|
||||
/// </summary>
|
||||
/// <param name="archivePathName">Path of archive to open</param>
|
||||
/// <param name="openMode">Mode in which to open archive</param>
|
||||
public void Open(string archivePathName, OpenMode openMode)
|
||||
{
|
||||
IntPtr handle=IntPtr.Zero;
|
||||
|
||||
// Close any previously open archives
|
||||
if(this.archiveHandle!=IntPtr.Zero)
|
||||
this.Close();
|
||||
|
||||
// Prepare extended open archive struct
|
||||
this.ArchivePathName=archivePathName;
|
||||
RAROpenArchiveDataEx openStruct=new RAROpenArchiveDataEx();
|
||||
openStruct.Initialize();
|
||||
openStruct.ArcName=this.archivePathName+"\0";
|
||||
openStruct.ArcNameW=this.archivePathName+"\0";
|
||||
openStruct.OpenMode=(uint)openMode;
|
||||
if(this.retrieveComment)
|
||||
{
|
||||
openStruct.CmtBuf=new string((char)0,65536);
|
||||
openStruct.CmtBufSize=65536;
|
||||
}
|
||||
else
|
||||
{
|
||||
openStruct.CmtBuf=null;
|
||||
openStruct.CmtBufSize=0;
|
||||
}
|
||||
|
||||
// Open archive
|
||||
handle=Unrar.RAROpenArchiveEx(ref openStruct);
|
||||
|
||||
// Check for success
|
||||
if(openStruct.OpenResult!=0)
|
||||
{
|
||||
switch((RarError)openStruct.OpenResult)
|
||||
{
|
||||
case RarError.InsufficientMemory:
|
||||
throw new OutOfMemoryException("Insufficient memory to perform operation.");
|
||||
|
||||
case RarError.BadData:
|
||||
throw new IOException("Archive header broken");
|
||||
|
||||
case RarError.BadArchive:
|
||||
throw new IOException("File is not a valid archive.");
|
||||
|
||||
case RarError.OpenError:
|
||||
throw new IOException("File could not be opened.");
|
||||
}
|
||||
}
|
||||
|
||||
// Save handle and flags
|
||||
this.archiveHandle=handle;
|
||||
this.archiveFlags=(ArchiveFlags)openStruct.Flags;
|
||||
|
||||
// Set callback
|
||||
Unrar.RARSetCallback(this.archiveHandle, this.callback, this.GetHashCode());
|
||||
|
||||
// If comment retrieved, save it
|
||||
if(openStruct.CmtState==1)
|
||||
this.comment=openStruct.CmtBuf.ToString();
|
||||
|
||||
// If password supplied, set it
|
||||
if(this.password.Length!=0)
|
||||
Unrar.RARSetPassword(this.archiveHandle, this.password);
|
||||
|
||||
// Fire NewVolume event for first volume
|
||||
this.OnNewVolume(this.archivePathName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads the next archive header and populates CurrentFile property data
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool ReadHeader()
|
||||
{
|
||||
// Throw exception if archive not open
|
||||
if(this.archiveHandle==IntPtr.Zero)
|
||||
throw new IOException("Archive is not open.");
|
||||
|
||||
// Initialize header struct
|
||||
this.header=new RARHeaderDataEx();
|
||||
header.Initialize();
|
||||
|
||||
// Read next entry
|
||||
currentFile=null;
|
||||
int result=Unrar.RARReadHeaderEx(this.archiveHandle, ref this.header);
|
||||
|
||||
// Check for error or end of archive
|
||||
if((RarError)result==RarError.EndOfArchive)
|
||||
return false;
|
||||
else if((RarError)result==RarError.BadData)
|
||||
throw new IOException("Archive data is corrupt.");
|
||||
|
||||
// Determine if new file
|
||||
if(((header.Flags & 0x01) != 0) && currentFile!=null)
|
||||
currentFile.ContinuedFromPrevious=true;
|
||||
else
|
||||
{
|
||||
// New file, prepare header
|
||||
currentFile=new RARFileInfo();
|
||||
currentFile.FileName=header.FileNameW.ToString();
|
||||
if((header.Flags & 0x02) != 0)
|
||||
currentFile.ContinuedOnNext=true;
|
||||
if(header.PackSizeHigh != 0)
|
||||
currentFile.PackedSize=(header.PackSizeHigh * 0x100000000) + header.PackSize;
|
||||
else
|
||||
currentFile.PackedSize=header.PackSize;
|
||||
if(header.UnpSizeHigh != 0)
|
||||
currentFile.UnpackedSize=(header.UnpSizeHigh * 0x100000000) + header.UnpSize;
|
||||
else
|
||||
currentFile.UnpackedSize=header.UnpSize;
|
||||
currentFile.HostOS=(int)header.HostOS;
|
||||
currentFile.FileCRC=header.FileCRC;
|
||||
currentFile.FileTime=FromMSDOSTime(header.FileTime);
|
||||
currentFile.VersionToUnpack=(int)header.UnpVer;
|
||||
currentFile.Method=(int)header.Method;
|
||||
currentFile.FileAttributes=(int)header.FileAttr;
|
||||
currentFile.BytesExtracted=0;
|
||||
if((header.Flags & 0x20) == 0x20)
|
||||
currentFile.IsDirectory=true;
|
||||
this.OnNewFile();
|
||||
}
|
||||
|
||||
// Return success
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns array of file names contained in archive
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string[] ListFiles()
|
||||
{
|
||||
ArrayList fileNames=new ArrayList();
|
||||
while(this.ReadHeader())
|
||||
{
|
||||
if(!currentFile.IsDirectory)
|
||||
fileNames.Add(currentFile.FileName);
|
||||
this.Skip();
|
||||
}
|
||||
string[] files=new string[fileNames.Count];
|
||||
fileNames.CopyTo(files);
|
||||
return files;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves the current archive position to the next available header
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Skip()
|
||||
{
|
||||
int result=Unrar.RARProcessFile(this.archiveHandle, (int)Operation.Skip, string.Empty, string.Empty);
|
||||
|
||||
// Check result
|
||||
if(result!=0)
|
||||
{
|
||||
ProcessFileError(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the ability to extract the current file without saving extracted data to disk
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Test()
|
||||
{
|
||||
int result=Unrar.RARProcessFile(this.archiveHandle, (int)Operation.Test, string.Empty, string.Empty);
|
||||
|
||||
// Check result
|
||||
if(result!=0)
|
||||
{
|
||||
ProcessFileError(result);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the current file to the default destination path
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public void Extract()
|
||||
{
|
||||
this.Extract(this.destinationPath, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the current file to a specified destination path and filename
|
||||
/// </summary>
|
||||
/// <param name="destinationName">Path and name of extracted file</param>
|
||||
/// <returns></returns>
|
||||
public void Extract(string destinationName)
|
||||
{
|
||||
this.Extract(string.Empty, destinationName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the current file to a specified directory without renaming file
|
||||
/// </summary>
|
||||
/// <param name="destinationPath"></param>
|
||||
/// <returns></returns>
|
||||
public void ExtractToDirectory(string destinationPath)
|
||||
{
|
||||
this.Extract(destinationPath, string.Empty);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void Extract(string destinationPath, string destinationName)
|
||||
{
|
||||
int result=Unrar.RARProcessFile(this.archiveHandle, (int)Operation.Extract, destinationPath, destinationName);
|
||||
|
||||
// Check result
|
||||
if(result!=0)
|
||||
{
|
||||
ProcessFileError(result);
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime FromMSDOSTime(uint dosTime)
|
||||
{
|
||||
int day=0;
|
||||
int month=0;
|
||||
int year=0;
|
||||
int second=0;
|
||||
int hour=0;
|
||||
int minute=0;
|
||||
ushort hiWord;
|
||||
ushort loWord;
|
||||
hiWord=(ushort)((dosTime & 0xFFFF0000) >> 16);
|
||||
loWord=(ushort)(dosTime & 0xFFFF);
|
||||
year=((hiWord & 0xFE00) >> 9)+1980;
|
||||
month=(hiWord & 0x01E0) >> 5;
|
||||
day=hiWord & 0x1F;
|
||||
hour=(loWord & 0xF800) >> 11;
|
||||
minute=(loWord & 0x07E0) >> 5;
|
||||
second=(loWord & 0x1F) << 1;
|
||||
return new DateTime(year, month, day, hour, minute, second);
|
||||
}
|
||||
|
||||
private void ProcessFileError(int result)
|
||||
{
|
||||
switch((RarError)result)
|
||||
{
|
||||
case RarError.UnknownFormat:
|
||||
throw new OutOfMemoryException("Unknown archive format.");
|
||||
|
||||
case RarError.BadData:
|
||||
throw new IOException("File CRC Error");
|
||||
|
||||
case RarError.BadArchive:
|
||||
throw new IOException("File is not a valid archive.");
|
||||
|
||||
case RarError.OpenError:
|
||||
throw new IOException("File could not be opened.");
|
||||
|
||||
case RarError.CreateError:
|
||||
throw new IOException("File could not be created.");
|
||||
|
||||
case RarError.CloseError:
|
||||
throw new IOException("File close error.");
|
||||
|
||||
case RarError.ReadError:
|
||||
throw new IOException("File read error.");
|
||||
|
||||
case RarError.WriteError:
|
||||
throw new IOException("File write error.");
|
||||
}
|
||||
}
|
||||
|
||||
private int RARCallback(uint msg, int UserData, IntPtr p1, int p2)
|
||||
{
|
||||
string volume=string.Empty;
|
||||
string newVolume=string.Empty;
|
||||
int result=-1;
|
||||
|
||||
switch((CallbackMessages)msg)
|
||||
{
|
||||
case CallbackMessages.VolumeChange:
|
||||
volume=Marshal.PtrToStringAnsi(p1);
|
||||
if((VolumeMessage)p2==VolumeMessage.Notify)
|
||||
result=OnNewVolume(volume);
|
||||
else if((VolumeMessage)p2==VolumeMessage.Ask)
|
||||
{
|
||||
newVolume=OnMissingVolume(volume);
|
||||
if(newVolume.Length==0)
|
||||
result=-1;
|
||||
else
|
||||
{
|
||||
if(newVolume!=volume)
|
||||
{
|
||||
for(int i=0; i<newVolume.Length; i++)
|
||||
{
|
||||
Marshal.WriteByte(p1, i, (byte)newVolume[i]);
|
||||
}
|
||||
Marshal.WriteByte(p1, newVolume.Length, (byte)0);
|
||||
}
|
||||
result=1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case CallbackMessages.ProcessData:
|
||||
result=OnDataAvailable(p1, p2);
|
||||
break;
|
||||
|
||||
case CallbackMessages.NeedPassword:
|
||||
result=OnPasswordRequired(p1, p2);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Virtual (Overridable) Methods
|
||||
|
||||
protected virtual void OnNewFile()
|
||||
{
|
||||
if(this.NewFile!=null)
|
||||
{
|
||||
NewFileEventArgs e = new NewFileEventArgs(this.currentFile);
|
||||
this.NewFile(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual int OnPasswordRequired(IntPtr p1, int p2)
|
||||
{
|
||||
int result=-1;
|
||||
if(this.PasswordRequired!=null)
|
||||
{
|
||||
PasswordRequiredEventArgs e=new PasswordRequiredEventArgs();
|
||||
this.PasswordRequired(this, e);
|
||||
if(e.ContinueOperation && e.Password.Length>0)
|
||||
{
|
||||
for(int i=0; (i<e.Password.Length) && (i<p2); i++)
|
||||
Marshal.WriteByte(p1, i, (byte)e.Password[i]);
|
||||
Marshal.WriteByte(p1, e.Password.Length, (byte)0);
|
||||
result=1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new IOException("Password is required for extraction.");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual int OnDataAvailable(IntPtr p1, int p2)
|
||||
{
|
||||
int result=1;
|
||||
if(this.currentFile!=null)
|
||||
this.currentFile.BytesExtracted+=p2;
|
||||
if(this.DataAvailable!=null)
|
||||
{
|
||||
byte[] data=new byte[p2];
|
||||
Marshal.Copy(p1, data, 0, p2);
|
||||
DataAvailableEventArgs e=new DataAvailableEventArgs(data);
|
||||
this.DataAvailable(this, e);
|
||||
if(!e.ContinueOperation)
|
||||
result=-1;
|
||||
}
|
||||
if((this.ExtractionProgress!=null) && (this.currentFile!=null))
|
||||
{
|
||||
ExtractionProgressEventArgs e = new ExtractionProgressEventArgs();
|
||||
e.FileName=this.currentFile.FileName;
|
||||
e.FileSize=this.currentFile.UnpackedSize;
|
||||
e.BytesExtracted=this.currentFile.BytesExtracted;
|
||||
e.PercentComplete=this.currentFile.PercentComplete;
|
||||
this.ExtractionProgress(this, e);
|
||||
if(!e.ContinueOperation)
|
||||
result=-1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual int OnNewVolume(string volume)
|
||||
{
|
||||
int result=1;
|
||||
if(this.NewVolume!=null)
|
||||
{
|
||||
NewVolumeEventArgs e=new NewVolumeEventArgs(volume);
|
||||
this.NewVolume(this, e);
|
||||
if(!e.ContinueOperation)
|
||||
result=-1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual string OnMissingVolume(string volume)
|
||||
{
|
||||
string result=string.Empty;
|
||||
if(this.MissingVolume!=null)
|
||||
{
|
||||
MissingVolumeEventArgs e=new MissingVolumeEventArgs(volume);
|
||||
this.MissingVolume(this, e);
|
||||
if(e.ContinueOperation)
|
||||
result=e.VolumeName;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region Event Argument Classes
|
||||
|
||||
public class NewVolumeEventArgs
|
||||
{
|
||||
public string VolumeName;
|
||||
public bool ContinueOperation=true;
|
||||
|
||||
public NewVolumeEventArgs(string volumeName)
|
||||
{
|
||||
this.VolumeName=volumeName;
|
||||
}
|
||||
}
|
||||
|
||||
public class MissingVolumeEventArgs
|
||||
{
|
||||
public string VolumeName;
|
||||
public bool ContinueOperation=false;
|
||||
|
||||
public MissingVolumeEventArgs(string volumeName)
|
||||
{
|
||||
this.VolumeName=volumeName;
|
||||
}
|
||||
}
|
||||
|
||||
public class DataAvailableEventArgs
|
||||
{
|
||||
public readonly byte[] Data;
|
||||
public bool ContinueOperation=true;
|
||||
|
||||
public DataAvailableEventArgs(byte[] data)
|
||||
{
|
||||
this.Data=data;
|
||||
}
|
||||
}
|
||||
|
||||
public class PasswordRequiredEventArgs
|
||||
{
|
||||
public string Password=string.Empty;
|
||||
public bool ContinueOperation=true;
|
||||
}
|
||||
|
||||
public class NewFileEventArgs
|
||||
{
|
||||
public RARFileInfo fileInfo;
|
||||
public NewFileEventArgs(RARFileInfo fileInfo)
|
||||
{
|
||||
this.fileInfo=fileInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public class ExtractionProgressEventArgs
|
||||
{
|
||||
public string FileName;
|
||||
public long FileSize;
|
||||
public long BytesExtracted;
|
||||
public double PercentComplete;
|
||||
public bool ContinueOperation=true;
|
||||
}
|
||||
|
||||
public class RARFileInfo
|
||||
{
|
||||
public string FileName;
|
||||
public bool ContinuedFromPrevious=false;
|
||||
public bool ContinuedOnNext=false;
|
||||
public bool IsDirectory=false;
|
||||
public long PackedSize=0;
|
||||
public long UnpackedSize=0;
|
||||
public int HostOS=0;
|
||||
public long FileCRC=0;
|
||||
public DateTime FileTime;
|
||||
public int VersionToUnpack=0;
|
||||
public int Method=0;
|
||||
public int FileAttributes=0;
|
||||
public long BytesExtracted=0;
|
||||
|
||||
public double PercentComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
if(this.UnpackedSize!=0)
|
||||
return(((double)this.BytesExtracted/(double)this.UnpackedSize) * (double)100.0);
|
||||
else
|
||||
return (double)0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
130
unrar/Examples/C#/Unrar.csproj
Normal file
130
unrar/Examples/C#/Unrar.csproj
Normal file
@@ -0,0 +1,130 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{2F343733-20A0-4AD0-88B2-762977614D67}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "Unrar"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "WinExe"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "Schematrix"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = "bin\Debug\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Data"
|
||||
AssemblyName = "System.Data"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.XML"
|
||||
AssemblyName = "System.Xml"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Drawing"
|
||||
AssemblyName = "System.Drawing"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Drawing.dll"
|
||||
/>
|
||||
<Reference
|
||||
Name = "System.Windows.Forms"
|
||||
AssemblyName = "System.Windows.Forms"
|
||||
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Windows.Forms.dll"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "TextInputDialog.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "TextInputDialog.resx"
|
||||
DependentUpon = "TextInputDialog.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Unrar.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "UnrarTest.cs"
|
||||
SubType = "Form"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "UnrarTest.resx"
|
||||
DependentUpon = "UnrarTest.cs"
|
||||
BuildAction = "EmbeddedResource"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
48
unrar/Examples/C#/Unrar.csproj.user
Normal file
48
unrar/Examples/C#/Unrar.csproj.user
Normal file
@@ -0,0 +1,48 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP LastOpenVersion = "7.10.3077" >
|
||||
<Build>
|
||||
<Settings ReferencePath = "" >
|
||||
<Config
|
||||
Name = "Debug"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "true"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
EnableASPDebugging = "false"
|
||||
EnableASPXDebugging = "false"
|
||||
EnableUnmanagedDebugging = "false"
|
||||
EnableSQLServerDebugging = "false"
|
||||
RemoteDebugEnabled = "false"
|
||||
RemoteDebugMachine = ""
|
||||
StartAction = "Project"
|
||||
StartArguments = ""
|
||||
StartPage = ""
|
||||
StartProgram = ""
|
||||
StartURL = ""
|
||||
StartWorkingDirectory = ""
|
||||
StartWithIE = "true"
|
||||
/>
|
||||
</Settings>
|
||||
</Build>
|
||||
<OtherProjectSettings
|
||||
CopyProjectDestinationFolder = ""
|
||||
CopyProjectUncPath = ""
|
||||
CopyProjectOption = "0"
|
||||
ProjectView = "ProjectFiles"
|
||||
ProjectTrust = "0"
|
||||
/>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
21
unrar/Examples/C#/Unrar.sln
Normal file
21
unrar/Examples/C#/Unrar.sln
Normal file
@@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unrar", "Unrar.csproj", "{2F343733-20A0-4AD0-88B2-762977614D67}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{2F343733-20A0-4AD0-88B2-762977614D67}.Debug.ActiveCfg = Debug|.NET
|
||||
{2F343733-20A0-4AD0-88B2-762977614D67}.Debug.Build.0 = Debug|.NET
|
||||
{2F343733-20A0-4AD0-88B2-762977614D67}.Release.ActiveCfg = Release|.NET
|
||||
{2F343733-20A0-4AD0-88B2-762977614D67}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
438
unrar/Examples/C#/UnrarTest.cs
Normal file
438
unrar/Examples/C#/UnrarTest.cs
Normal file
@@ -0,0 +1,438 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using System.Collections;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Schematrix
|
||||
{
|
||||
/// <summary>
|
||||
/// Test driver form for unrar class
|
||||
/// </summary>
|
||||
public class UnrarTest : System.Windows.Forms.Form
|
||||
{
|
||||
private System.Windows.Forms.TextBox rarFileName;
|
||||
private System.Windows.Forms.Button selectFile;
|
||||
private System.Windows.Forms.Label rarFileNameLabel;
|
||||
private System.Windows.Forms.ListView fileList;
|
||||
private System.Windows.Forms.Button testButton;
|
||||
private System.Windows.Forms.StatusBar statusBar;
|
||||
private System.Windows.Forms.Button extractButton;
|
||||
private System.Windows.Forms.ProgressBar progressBar;
|
||||
private System.Windows.Forms.FolderBrowserDialog folderBrowser;
|
||||
private System.Windows.Forms.OpenFileDialog openFile;
|
||||
private System.Windows.Forms.ColumnHeader fileNameColumnHeader;
|
||||
private System.Windows.Forms.ColumnHeader unpackedSizeColumnHeader;
|
||||
private System.Windows.Forms.ColumnHeader packedSizeColumnHeader;
|
||||
private System.Windows.Forms.ColumnHeader fileTimestampColumnHeader;
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.Container components = null;
|
||||
|
||||
private Unrar unrar;
|
||||
|
||||
public UnrarTest()
|
||||
{
|
||||
//
|
||||
// Required for Windows Form Designer support
|
||||
//
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
protected override void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing )
|
||||
{
|
||||
if(components != null)
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
}
|
||||
base.Dispose( disposing );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.Run(new UnrarTest());
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.rarFileName = new System.Windows.Forms.TextBox();
|
||||
this.selectFile = new System.Windows.Forms.Button();
|
||||
this.rarFileNameLabel = new System.Windows.Forms.Label();
|
||||
this.fileList = new System.Windows.Forms.ListView();
|
||||
this.fileNameColumnHeader = new System.Windows.Forms.ColumnHeader();
|
||||
this.unpackedSizeColumnHeader = new System.Windows.Forms.ColumnHeader();
|
||||
this.packedSizeColumnHeader = new System.Windows.Forms.ColumnHeader();
|
||||
this.fileTimestampColumnHeader = new System.Windows.Forms.ColumnHeader();
|
||||
this.testButton = new System.Windows.Forms.Button();
|
||||
this.statusBar = new System.Windows.Forms.StatusBar();
|
||||
this.extractButton = new System.Windows.Forms.Button();
|
||||
this.progressBar = new System.Windows.Forms.ProgressBar();
|
||||
this.folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
|
||||
this.openFile = new System.Windows.Forms.OpenFileDialog();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// rarFileName
|
||||
//
|
||||
this.rarFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.rarFileName.Location = new System.Drawing.Point(6, 26);
|
||||
this.rarFileName.Name = "rarFileName";
|
||||
this.rarFileName.ReadOnly = true;
|
||||
this.rarFileName.Size = new System.Drawing.Size(590, 20);
|
||||
this.rarFileName.TabIndex = 0;
|
||||
this.rarFileName.Text = "";
|
||||
//
|
||||
// selectFile
|
||||
//
|
||||
this.selectFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectFile.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.selectFile.Location = new System.Drawing.Point(603, 26);
|
||||
this.selectFile.Name = "selectFile";
|
||||
this.selectFile.Size = new System.Drawing.Size(28, 20);
|
||||
this.selectFile.TabIndex = 1;
|
||||
this.selectFile.Text = "...";
|
||||
this.selectFile.Click += new System.EventHandler(this.selectFile_Click);
|
||||
//
|
||||
// rarFileNameLabel
|
||||
//
|
||||
this.rarFileNameLabel.Location = new System.Drawing.Point(6, 8);
|
||||
this.rarFileNameLabel.Name = "rarFileNameLabel";
|
||||
this.rarFileNameLabel.Size = new System.Drawing.Size(208, 23);
|
||||
this.rarFileNameLabel.TabIndex = 2;
|
||||
this.rarFileNameLabel.Text = "RAR File Name";
|
||||
//
|
||||
// fileList
|
||||
//
|
||||
this.fileList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.fileList.CheckBoxes = true;
|
||||
this.fileList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.fileNameColumnHeader,
|
||||
this.unpackedSizeColumnHeader,
|
||||
this.packedSizeColumnHeader,
|
||||
this.fileTimestampColumnHeader});
|
||||
this.fileList.Location = new System.Drawing.Point(6, 52);
|
||||
this.fileList.Name = "fileList";
|
||||
this.fileList.Size = new System.Drawing.Size(626, 304);
|
||||
this.fileList.TabIndex = 3;
|
||||
this.fileList.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// fileNameColumnHeader
|
||||
//
|
||||
this.fileNameColumnHeader.Text = "File Name";
|
||||
this.fileNameColumnHeader.Width = 250;
|
||||
//
|
||||
// unpackedSizeColumnHeader
|
||||
//
|
||||
this.unpackedSizeColumnHeader.Text = "Unpacked Size";
|
||||
this.unpackedSizeColumnHeader.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.unpackedSizeColumnHeader.Width = 100;
|
||||
//
|
||||
// packedSizeColumnHeader
|
||||
//
|
||||
this.packedSizeColumnHeader.Text = "Packed Size";
|
||||
this.packedSizeColumnHeader.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
|
||||
this.packedSizeColumnHeader.Width = 100;
|
||||
//
|
||||
// fileTimestampColumnHeader
|
||||
//
|
||||
this.fileTimestampColumnHeader.Text = "File Timestamp";
|
||||
this.fileTimestampColumnHeader.Width = 150;
|
||||
//
|
||||
// testButton
|
||||
//
|
||||
this.testButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.testButton.Enabled = false;
|
||||
this.testButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.testButton.Location = new System.Drawing.Point(12, 364);
|
||||
this.testButton.Name = "testButton";
|
||||
this.testButton.Size = new System.Drawing.Size(66, 26);
|
||||
this.testButton.TabIndex = 4;
|
||||
this.testButton.Text = "Test";
|
||||
this.testButton.Click += new System.EventHandler(this.testButton_Click);
|
||||
//
|
||||
// statusBar
|
||||
//
|
||||
this.statusBar.Location = new System.Drawing.Point(0, 398);
|
||||
this.statusBar.Name = "statusBar";
|
||||
this.statusBar.Size = new System.Drawing.Size(640, 22);
|
||||
this.statusBar.TabIndex = 5;
|
||||
this.statusBar.Text = "Ready";
|
||||
//
|
||||
// extractButton
|
||||
//
|
||||
this.extractButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.extractButton.Enabled = false;
|
||||
this.extractButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
|
||||
this.extractButton.Location = new System.Drawing.Point(87, 365);
|
||||
this.extractButton.Name = "extractButton";
|
||||
this.extractButton.Size = new System.Drawing.Size(66, 26);
|
||||
this.extractButton.TabIndex = 6;
|
||||
this.extractButton.Text = "Extract";
|
||||
this.extractButton.Click += new System.EventHandler(this.extractButton_Click);
|
||||
//
|
||||
// progressBar
|
||||
//
|
||||
this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.progressBar.Location = new System.Drawing.Point(162, 370);
|
||||
this.progressBar.Name = "progressBar";
|
||||
this.progressBar.Size = new System.Drawing.Size(470, 16);
|
||||
this.progressBar.TabIndex = 7;
|
||||
//
|
||||
// folderBrowser
|
||||
//
|
||||
this.folderBrowser.Description = "Please select a destination folder for the extracted files.";
|
||||
//
|
||||
// openFile
|
||||
//
|
||||
this.openFile.DefaultExt = "rar";
|
||||
this.openFile.Filter = "RAR Files (*.rar)|*.rar|All Files (*.*)|*.*";
|
||||
this.openFile.Title = "Select RAR File";
|
||||
//
|
||||
// UnrarTest
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
||||
this.ClientSize = new System.Drawing.Size(640, 420);
|
||||
this.Controls.Add(this.progressBar);
|
||||
this.Controls.Add(this.extractButton);
|
||||
this.Controls.Add(this.statusBar);
|
||||
this.Controls.Add(this.testButton);
|
||||
this.Controls.Add(this.fileList);
|
||||
this.Controls.Add(this.selectFile);
|
||||
this.Controls.Add(this.rarFileName);
|
||||
this.Controls.Add(this.rarFileNameLabel);
|
||||
this.Name = "UnrarTest";
|
||||
this.Text = "Unrar Class Tester";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
private void selectFile_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
if(openFile.ShowDialog()==DialogResult.OK)
|
||||
{
|
||||
rarFileName.Text = openFile.FileName;
|
||||
OpenRarFile(rarFileName.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void OpenRarFile(string fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Cursor=Cursors.WaitCursor;
|
||||
testButton.Enabled=false;
|
||||
extractButton.Enabled=false;
|
||||
fileList.BeginUpdate();
|
||||
fileList.Items.Clear();
|
||||
|
||||
// Create new unrar class and open archive for listing files
|
||||
unrar=new Unrar();
|
||||
unrar.Open(fileName, Unrar.OpenMode.List);
|
||||
|
||||
// Read each header, skipping directory entries
|
||||
while(unrar.ReadHeader())
|
||||
{
|
||||
if(!unrar.CurrentFile.IsDirectory)
|
||||
{
|
||||
ListViewItem item=new ListViewItem(unrar.CurrentFile.FileName);
|
||||
item.SubItems.Add(unrar.CurrentFile.UnpackedSize.ToString());
|
||||
item.SubItems.Add(unrar.CurrentFile.PackedSize.ToString());
|
||||
item.SubItems.Add(unrar.CurrentFile.FileTime.ToString());
|
||||
item.Checked=true;
|
||||
fileList.Items.Add(item);
|
||||
}
|
||||
unrar.Skip();
|
||||
}
|
||||
|
||||
// Cleanup and enable buttons if no exception was thrown
|
||||
unrar.Close();
|
||||
this.unrar=null;
|
||||
testButton.Enabled=true;
|
||||
extractButton.Enabled=true;
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
testButton.Enabled=false;
|
||||
extractButton.Enabled=false;
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Cursor=Cursors.Default;
|
||||
fileList.EndUpdate();
|
||||
if(this.unrar!=null)
|
||||
unrar.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private Hashtable GetSelectedFiles()
|
||||
{
|
||||
// Build hashtable of selected entries
|
||||
Hashtable ht=new Hashtable(fileList.CheckedItems.Count);
|
||||
foreach(ListViewItem item in fileList.CheckedItems)
|
||||
ht.Add(item.Text, item);
|
||||
return ht;
|
||||
}
|
||||
|
||||
private void testButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
// Get hashtable of selected files
|
||||
Hashtable selectedFiles=GetSelectedFiles();
|
||||
try
|
||||
{
|
||||
this.Cursor=Cursors.WaitCursor;
|
||||
|
||||
// Create new unrar class and attach event handlers for
|
||||
// progress, missing volumes, and password
|
||||
unrar=new Unrar();
|
||||
AttachHandlers(unrar);
|
||||
|
||||
// Open archive for extraction
|
||||
unrar.Open(rarFileName.Text, Unrar.OpenMode.Extract);
|
||||
|
||||
// Test each file found in hashtable
|
||||
while(unrar.ReadHeader())
|
||||
{
|
||||
if(selectedFiles.ContainsKey(unrar.CurrentFile.FileName))
|
||||
{
|
||||
this.progressBar.Value=0;
|
||||
unrar.Test();
|
||||
}
|
||||
else
|
||||
{
|
||||
unrar.Skip();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Cursor=Cursors.Default;
|
||||
this.statusBar.Text = "Ready";
|
||||
this.progressBar.Value=0;
|
||||
if(this.unrar!=null)
|
||||
unrar.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void extractButton_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
// Get hashtable of selected files
|
||||
Hashtable selectedFiles=GetSelectedFiles();
|
||||
try
|
||||
{
|
||||
// Get destination from user
|
||||
string directory=Path.GetDirectoryName(rarFileName.Text);
|
||||
if(Directory.Exists(directory))
|
||||
folderBrowser.SelectedPath=directory;
|
||||
if(folderBrowser.ShowDialog()==DialogResult.OK)
|
||||
{
|
||||
this.Cursor=Cursors.WaitCursor;
|
||||
|
||||
// Create new unrar class and attach event handlers for
|
||||
// progress, missing volumes, and password
|
||||
unrar=new Unrar();
|
||||
AttachHandlers(unrar);
|
||||
|
||||
// Set destination path for all files
|
||||
unrar.DestinationPath=folderBrowser.SelectedPath;
|
||||
|
||||
// Open archive for extraction
|
||||
unrar.Open(rarFileName.Text, Unrar.OpenMode.Extract);
|
||||
|
||||
// Extract each file found in hashtable
|
||||
while(unrar.ReadHeader())
|
||||
{
|
||||
if(selectedFiles.ContainsKey(unrar.CurrentFile.FileName))
|
||||
{
|
||||
this.progressBar.Value=0;
|
||||
unrar.Extract();
|
||||
}
|
||||
else
|
||||
{
|
||||
unrar.Skip();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Cursor=Cursors.Default;
|
||||
this.statusBar.Text = "Ready";
|
||||
this.progressBar.Value=0;
|
||||
if(this.unrar!=null)
|
||||
unrar.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private void AttachHandlers(Unrar unrar)
|
||||
{
|
||||
unrar.ExtractionProgress+=new ExtractionProgressHandler(unrar_ExtractionProgress);
|
||||
unrar.MissingVolume+=new MissingVolumeHandler(unrar_MissingVolume);
|
||||
unrar.PasswordRequired+=new PasswordRequiredHandler(unrar_PasswordRequired);
|
||||
}
|
||||
|
||||
private void unrar_ExtractionProgress(object sender, ExtractionProgressEventArgs e)
|
||||
{
|
||||
statusBar.Text = "Testing " + e.FileName;
|
||||
progressBar.Value=(int)e.PercentComplete;
|
||||
}
|
||||
|
||||
private void unrar_MissingVolume(object sender, MissingVolumeEventArgs e)
|
||||
{
|
||||
TextInputDialog dialog=new TextInputDialog();
|
||||
dialog.Value=e.VolumeName;
|
||||
dialog.Prompt=string.Format("Volume is missing. Correct or cancel.");
|
||||
if(dialog.ShowDialog()==DialogResult.OK)
|
||||
{
|
||||
e.VolumeName=dialog.Value;
|
||||
e.ContinueOperation=true;
|
||||
}
|
||||
else
|
||||
e.ContinueOperation=false;
|
||||
}
|
||||
|
||||
private void unrar_PasswordRequired(object sender, PasswordRequiredEventArgs e)
|
||||
{
|
||||
TextInputDialog dialog=new TextInputDialog();
|
||||
dialog.Prompt=string.Format("Password is required for extraction.");
|
||||
dialog.PasswordChar='*';
|
||||
if(dialog.ShowDialog()==DialogResult.OK)
|
||||
{
|
||||
e.Password=dialog.Value;
|
||||
e.ContinueOperation=true;
|
||||
}
|
||||
else
|
||||
e.ContinueOperation=false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
244
unrar/Examples/C#/UnrarTest.resx
Normal file
244
unrar/Examples/C#/UnrarTest.resx
Normal file
@@ -0,0 +1,244 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="rarFileName.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="rarFileName.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="rarFileName.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="selectFile.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="selectFile.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="selectFile.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="rarFileNameLabel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="rarFileNameLabel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="rarFileNameLabel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileList.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="fileList.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileList.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileNameColumnHeader.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileNameColumnHeader.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="unpackedSizeColumnHeader.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="unpackedSizeColumnHeader.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="packedSizeColumnHeader.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="packedSizeColumnHeader.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileTimestampColumnHeader.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="fileTimestampColumnHeader.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="testButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="testButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="testButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="statusBar.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="statusBar.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="statusBar.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="extractButton.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="extractButton.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="extractButton.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="progressBar.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="progressBar.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="progressBar.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="folderBrowser.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="folderBrowser.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</data>
|
||||
<data name="folderBrowser.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="openFile.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="openFile.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
<data name="openFile.Location" type="System.Drawing.Point, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>137, 17</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>2, 2</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>UnrarTest</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Private</value>
|
||||
</data>
|
||||
</root>
|
4
unrar/Examples/C/ReadMe.Txt
Normal file
4
unrar/Examples/C/ReadMe.Txt
Normal file
@@ -0,0 +1,4 @@
|
||||
C sample of the UNRAR.DLL library usage.
|
||||
|
||||
To build UNRDLL.EXE you need to compile UNRDLL.C as Windows console
|
||||
application. Do not forget to put UNRAR.H to the current directory.
|
13
unrar/Examples/C/UnRDLL.Def
Normal file
13
unrar/Examples/C/UnRDLL.Def
Normal file
@@ -0,0 +1,13 @@
|
||||
IMPORTS
|
||||
unrar.RAROpenArchive
|
||||
unrar.RAROpenArchiveEx
|
||||
unrar.RARCloseArchive
|
||||
unrar.RARReadHeader
|
||||
unrar.RARReadHeaderEx
|
||||
unrar.RARProcessFile
|
||||
unrar.RARProcessFileW
|
||||
unrar.RARSetChangeVolProc
|
||||
unrar.RARSetProcessDataProc
|
||||
unrar.RARSetCallback
|
||||
unrar.RARSetPassword
|
||||
|
318
unrar/Examples/C/UnRDLL.c
Normal file
318
unrar/Examples/C/UnRDLL.c
Normal file
@@ -0,0 +1,318 @@
|
||||
#define STRICT
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <locale.h>
|
||||
#include "unrar.h"
|
||||
|
||||
enum { EXTRACT, TEST, PRINT, LIST };
|
||||
|
||||
void ExtractArchive(char *ArcName,int Mode);
|
||||
void ListArchive(char *ArcName);
|
||||
void ShowComment(char *CmtBuf);
|
||||
void OutHelp(void);
|
||||
|
||||
enum ERR_TYPE {ERR_OPEN, ERR_READ, ERR_PROCESS};
|
||||
void OutError(int Error,char *ArcName,int ErrType);
|
||||
|
||||
void ShowArcInfo(unsigned int Flags,char *ArcName);
|
||||
void OutProcessFileError(int Error);
|
||||
int CALLBACK CallbackProc(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
|
||||
|
||||
main(int Argc, char *Argv[])
|
||||
{
|
||||
setlocale(LC_ALL, NULL);
|
||||
|
||||
if (Argc!=3)
|
||||
{
|
||||
OutHelp();
|
||||
return(0);
|
||||
}
|
||||
|
||||
switch(toupper(Argv[1][0]))
|
||||
{
|
||||
case 'X':
|
||||
ExtractArchive(Argv[2],EXTRACT);
|
||||
break;
|
||||
case 'T':
|
||||
ExtractArchive(Argv[2],TEST);
|
||||
break;
|
||||
case 'P':
|
||||
ExtractArchive(Argv[2],PRINT);
|
||||
break;
|
||||
case 'L':
|
||||
ListArchive(Argv[2]);
|
||||
break;
|
||||
default:
|
||||
OutHelp();
|
||||
return(0);
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
void ExtractArchive(char *ArcName,int Mode)
|
||||
{
|
||||
HANDLE hArcData;
|
||||
int RHCode,PFCode;
|
||||
char CmtBuf[16384];
|
||||
struct RARHeaderData HeaderData;
|
||||
struct RAROpenArchiveDataEx OpenArchiveData;
|
||||
|
||||
memset(&HeaderData,0,sizeof(HeaderData));
|
||||
memset(&OpenArchiveData,0,sizeof(OpenArchiveData));
|
||||
|
||||
OpenArchiveData.ArcName=ArcName;
|
||||
OpenArchiveData.CmtBuf=CmtBuf;
|
||||
OpenArchiveData.CmtBufSize=sizeof(CmtBuf);
|
||||
OpenArchiveData.OpenMode=RAR_OM_EXTRACT;
|
||||
OpenArchiveData.Callback=CallbackProc;
|
||||
OpenArchiveData.UserData=Mode;
|
||||
hArcData=RAROpenArchiveEx(&OpenArchiveData);
|
||||
|
||||
if (OpenArchiveData.OpenResult!=0)
|
||||
{
|
||||
OutError(OpenArchiveData.OpenResult,ArcName,ERR_OPEN);
|
||||
return;
|
||||
}
|
||||
|
||||
ShowArcInfo(OpenArchiveData.Flags,ArcName);
|
||||
|
||||
if (OpenArchiveData.CmtState==1)
|
||||
ShowComment(CmtBuf);
|
||||
|
||||
while ((RHCode=RARReadHeader(hArcData,&HeaderData))==0)
|
||||
{
|
||||
switch(Mode)
|
||||
{
|
||||
case EXTRACT:
|
||||
printf("\nExtracting %-45s",HeaderData.FileName);
|
||||
break;
|
||||
case TEST:
|
||||
printf("\nTesting %-45s",HeaderData.FileName);
|
||||
break;
|
||||
case PRINT:
|
||||
printf("\nPrinting %-45s\n",HeaderData.FileName);
|
||||
break;
|
||||
}
|
||||
PFCode=RARProcessFile(hArcData,(Mode==EXTRACT) ? RAR_EXTRACT:RAR_TEST,
|
||||
NULL,NULL);
|
||||
if (PFCode==0)
|
||||
printf(" OK");
|
||||
else
|
||||
{
|
||||
OutError(PFCode,ArcName,ERR_PROCESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OutError(RHCode,ArcName,ERR_READ);
|
||||
|
||||
RARCloseArchive(hArcData);
|
||||
}
|
||||
|
||||
|
||||
void ListArchive(char *ArcName)
|
||||
{
|
||||
HANDLE hArcData;
|
||||
int RHCode,PFCode;
|
||||
char CmtBuf[16384];
|
||||
struct RARHeaderDataEx HeaderData;
|
||||
struct RAROpenArchiveDataEx OpenArchiveData;
|
||||
wchar_t RedirName[1024];
|
||||
|
||||
memset(&HeaderData,0,sizeof(HeaderData));
|
||||
memset(&OpenArchiveData,0,sizeof(OpenArchiveData));
|
||||
OpenArchiveData.ArcName=ArcName;
|
||||
OpenArchiveData.CmtBuf=CmtBuf;
|
||||
OpenArchiveData.CmtBufSize=sizeof(CmtBuf);
|
||||
OpenArchiveData.OpenMode=RAR_OM_LIST;
|
||||
OpenArchiveData.Callback=CallbackProc;
|
||||
OpenArchiveData.UserData=LIST;
|
||||
hArcData=RAROpenArchiveEx(&OpenArchiveData);
|
||||
|
||||
if (OpenArchiveData.OpenResult!=0)
|
||||
{
|
||||
OutError(OpenArchiveData.OpenResult,ArcName,ERR_OPEN);
|
||||
return;
|
||||
}
|
||||
|
||||
ShowArcInfo(OpenArchiveData.Flags,ArcName);
|
||||
|
||||
if (OpenArchiveData.CmtState==1)
|
||||
ShowComment(CmtBuf);
|
||||
|
||||
printf("\nFile Size");
|
||||
printf("\n-------------------------------");
|
||||
HeaderData.RedirName=RedirName;
|
||||
HeaderData.RedirNameSize=sizeof(RedirName)/sizeof(RedirName[0]);
|
||||
while ((RHCode=RARReadHeaderEx(hArcData,&HeaderData))==0)
|
||||
{
|
||||
__int64 UnpSize=HeaderData.UnpSize+(((__int64)HeaderData.UnpSizeHigh)<<32);
|
||||
printf("\n%-20s %10Ld ",HeaderData.FileName,UnpSize);
|
||||
if (HeaderData.RedirType!=0)
|
||||
printf("\n\tlink type %d, target %ls",HeaderData.RedirType,HeaderData.RedirName);
|
||||
if ((PFCode=RARProcessFile(hArcData,RAR_SKIP,NULL,NULL))!=0)
|
||||
{
|
||||
OutError(PFCode,ArcName,ERR_PROCESS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
OutError(RHCode,ArcName,ERR_READ);
|
||||
|
||||
RARCloseArchive(hArcData);
|
||||
}
|
||||
|
||||
|
||||
void ShowComment(char *CmtBuf)
|
||||
{
|
||||
printf("\nComment:\n%s\n",CmtBuf);
|
||||
}
|
||||
|
||||
|
||||
void OutHelp(void)
|
||||
{
|
||||
printf("\nUNRDLL. This is a simple example of UNRAR.DLL usage\n");
|
||||
printf("\nSyntax:\n");
|
||||
printf("\nUNRDLL X <Archive> extract archive contents");
|
||||
printf("\nUNRDLL T <Archive> test archive contents");
|
||||
printf("\nUNRDLL P <Archive> print archive contents to stdout");
|
||||
printf("\nUNRDLL L <Archive> view archive contents\n");
|
||||
}
|
||||
|
||||
|
||||
void OutError(int Error,char *ArcName,int ErrType)
|
||||
{
|
||||
switch(Error)
|
||||
{
|
||||
case ERAR_NO_MEMORY:
|
||||
printf("\nNot enough memory");
|
||||
break;
|
||||
case ERAR_BAD_DATA:
|
||||
printf("\n%s: archive header or data are damaged",ArcName);
|
||||
break;
|
||||
case ERAR_BAD_ARCHIVE:
|
||||
printf("\n%s is not RAR archive",ArcName);
|
||||
break;
|
||||
case ERAR_UNKNOWN_FORMAT:
|
||||
printf("Unknown archive format");
|
||||
break;
|
||||
case ERAR_EOPEN:
|
||||
if (ErrType==ERR_PROCESS) // Returned by RARProcessFile.
|
||||
printf("Volume open error");
|
||||
else
|
||||
printf("\nCannot open %s",ArcName);
|
||||
break;
|
||||
case ERAR_ECREATE:
|
||||
printf("File create error");
|
||||
break;
|
||||
case ERAR_ECLOSE:
|
||||
printf("File close error");
|
||||
break;
|
||||
case ERAR_EREAD:
|
||||
printf("Read error");
|
||||
break;
|
||||
case ERAR_EWRITE:
|
||||
printf("Write error");
|
||||
break;
|
||||
case ERAR_SMALL_BUF:
|
||||
printf("Buffer for archive comment is too small, comment truncated");
|
||||
break;
|
||||
case ERAR_UNKNOWN:
|
||||
printf("Unknown error");
|
||||
break;
|
||||
case ERAR_MISSING_PASSWORD:
|
||||
printf("Password for encrypted file or header is not specified");
|
||||
break;
|
||||
case ERAR_EREFERENCE:
|
||||
printf("Cannot open file source for reference record");
|
||||
break;
|
||||
case ERAR_BAD_PASSWORD:
|
||||
printf("Wrong password is specified");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ShowArcInfo(unsigned int Flags,char *ArcName)
|
||||
{
|
||||
printf("\nArchive %s\n",ArcName);
|
||||
printf("\nVolume:\t\t%s",(Flags & 1) ? "yes":"no");
|
||||
printf("\nComment:\t%s",(Flags & 2) ? "yes":"no");
|
||||
printf("\nLocked:\t\t%s",(Flags & 4) ? "yes":"no");
|
||||
printf("\nSolid:\t\t%s",(Flags & 8) ? "yes":"no");
|
||||
printf("\nNew naming:\t%s",(Flags & 16) ? "yes":"no");
|
||||
printf("\nRecovery:\t%s",(Flags & 64) ? "yes":"no");
|
||||
printf("\nEncr.headers:\t%s",(Flags & 128) ? "yes":"no");
|
||||
printf("\nFirst volume:\t%s",(Flags & 256) ? "yes":"no or older than 3.0");
|
||||
printf("\n---------------------------\n");
|
||||
}
|
||||
|
||||
|
||||
int CALLBACK CallbackProc(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2)
|
||||
{
|
||||
switch(msg)
|
||||
{
|
||||
case UCM_CHANGEVOLUMEW:
|
||||
if (P2==RAR_VOL_ASK)
|
||||
{
|
||||
printf("\n\nVolume %S is required\nPossible options:\n",(wchar_t *)P1);
|
||||
printf("\nEnter - try again");
|
||||
printf("\n'R' - specify a new volume name");
|
||||
printf("\n'Q' - quit");
|
||||
printf("\nEnter your choice: ");
|
||||
switch(toupper(getchar()))
|
||||
{
|
||||
case 'Q':
|
||||
return(-1);
|
||||
case 'R':
|
||||
{
|
||||
wchar_t *eol;
|
||||
printf("\nEnter new name: ");
|
||||
fflush(stdin);
|
||||
|
||||
// fgetws may fail to read non-English characters from stdin
|
||||
// in some compilers. In this case use something more
|
||||
// appropriate for Unicode input.
|
||||
fgetws((wchar_t *)P1,MAX_PATH,stdin);
|
||||
|
||||
eol=wcspbrk((wchar_t *)P1,L"\r\n");
|
||||
if (eol!=NULL)
|
||||
*eol=0;
|
||||
}
|
||||
return(1);
|
||||
default:
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
if (P2==RAR_VOL_NOTIFY)
|
||||
printf("\n ... volume %S\n",(wchar_t *)P1);
|
||||
return(1);
|
||||
case UCM_PROCESSDATA:
|
||||
if (UserData==PRINT)
|
||||
{
|
||||
fflush(stdout);
|
||||
fwrite((char *)P1,1,P2,stdout);
|
||||
fflush(stdout);
|
||||
}
|
||||
return(1);
|
||||
case UCM_NEEDPASSWORDW:
|
||||
{
|
||||
wchar_t *eol;
|
||||
printf("\nPassword required: ");
|
||||
|
||||
// fgetws may fail to read non-English characters from stdin
|
||||
// in some compilers. In this case use something more appropriate
|
||||
// for Unicode input.
|
||||
fgetws((wchar_t *)P1,P2,stdin);
|
||||
|
||||
eol=wcspbrk((wchar_t *)P1,L"\r\n");
|
||||
if (eol!=NULL)
|
||||
*eol=0;
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
176
unrar/Examples/Delphi/UnRAR.pas
Normal file
176
unrar/Examples/Delphi/UnRAR.pas
Normal file
@@ -0,0 +1,176 @@
|
||||
// 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 UnRAR;
|
||||
|
||||
interface
|
||||
|
||||
uses Windows;
|
||||
|
||||
const
|
||||
ERAR_END_ARCHIVE = 10;
|
||||
ERAR_NO_MEMORY = 11;
|
||||
ERAR_BAD_DATA = 12;
|
||||
ERAR_BAD_ARCHIVE = 13;
|
||||
ERAR_UNKNOWN_FORMAT = 14;
|
||||
ERAR_EOPEN = 15;
|
||||
ERAR_ECREATE = 16;
|
||||
ERAR_ECLOSE = 17;
|
||||
ERAR_EREAD = 18;
|
||||
ERAR_EWRITE = 19;
|
||||
ERAR_SMALL_BUF = 20;
|
||||
ERAR_UNKNOWN = 21;
|
||||
|
||||
RAR_OM_LIST = 0;
|
||||
RAR_OM_EXTRACT = 1;
|
||||
|
||||
RAR_SKIP = 0;
|
||||
RAR_TEST = 1;
|
||||
RAR_EXTRACT = 2;
|
||||
|
||||
RAR_VOL_ASK = 0;
|
||||
RAR_VOL_NOTIFY = 1;
|
||||
|
||||
RAR_DLL_VERSION = 3;
|
||||
|
||||
UCM_CHANGEVOLUME = 0;
|
||||
UCM_PROCESSDATA = 1;
|
||||
UCM_NEEDPASSWORD = 2;
|
||||
|
||||
type
|
||||
RARHeaderData = packed record
|
||||
ArcName: packed array[0..Pred(260)] of AnsiChar;
|
||||
FileName: packed array[0..Pred(260)] of AnsiChar;
|
||||
Flags: UINT;
|
||||
PackSize: UINT;
|
||||
UnpSize: UINT;
|
||||
HostOS: UINT;
|
||||
FileCRC: UINT;
|
||||
FileTime: UINT;
|
||||
UnpVer: UINT;
|
||||
Method: UINT;
|
||||
FileAttr: UINT;
|
||||
CmtBuf: PAnsiChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
end;
|
||||
|
||||
RARHeaderDataEx = packed record
|
||||
ArcName: packed array [0..1023] of AnsiChar;
|
||||
ArcNameW: packed array [0..1023] of WideChar;
|
||||
FileName: packed array [0..1023] of AnsiChar;
|
||||
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: PAnsiChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
Reserved: packed array [0..1023] of UINT;
|
||||
end;
|
||||
|
||||
RAROpenArchiveData = packed record
|
||||
ArcName: PAnsiChar;
|
||||
OpenMode: UINT;
|
||||
OpenResult: UINT;
|
||||
CmtBuf: PAnsiChar;
|
||||
CmtBufSize: UINT;
|
||||
CmtSize: UINT;
|
||||
CmtState: UINT;
|
||||
end;
|
||||
|
||||
RAROpenArchiveDataEx = packed record
|
||||
ArcName: PAnsiChar;
|
||||
ArcNameW: PWideChar;
|
||||
OpenMode: UINT;
|
||||
OpenResult: UINT;
|
||||
CmtBuf: PAnsiChar;
|
||||
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 RAROpenArchive(var ArchiveData: RAROpenArchiveData): THandle;
|
||||
stdcall; external _unrar;
|
||||
function RAROpenArchiveEx(var ArchiveData: RAROpenArchiveDataEx): THandle;
|
||||
stdcall; external _unrar;
|
||||
function RARCloseArchive(hArcData: THandle): Integer;
|
||||
stdcall; external _unrar;
|
||||
function RARReadHeader(hArcData: THandle; var HeaderData: RARHeaderData): Integer;
|
||||
stdcall; external _unrar;
|
||||
function RARReadHeaderEx(hArcData: THandle; var HeaderData: RARHeaderDataEx): Integer;
|
||||
stdcall; external _unrar;
|
||||
function RARProcessFile(hArcData: THandle; Operation: Integer; DestPath, DestName: PChar): Integer;
|
||||
stdcall; external _unrar;
|
||||
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: PAnsiChar; Mode: Integer): Integer; stdcall;
|
||||
TProcessDataProc = function(Addr: PUChar; Size: Integer): Integer; stdcall;
|
||||
|
||||
procedure RARSetChangeVolProc(hArcData: THandle; ChangeVolProc: TChangeVolProc);
|
||||
stdcall; external _unrar;
|
||||
procedure RARSetProcessDataProc(hArcData: THandle; ProcessDataProc: TProcessDataProc);
|
||||
stdcall; external _unrar;
|
||||
|
||||
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.
|
266
unrar/Examples/Delphi/UnRDLL.dpr
Normal file
266
unrar/Examples/Delphi/UnRDLL.dpr
Normal file
@@ -0,0 +1,266 @@
|
||||
// UnRDLL - simple example of UnRAR.dll usage
|
||||
// Translated from UnRDLL.c
|
||||
// Use Delphi 2.0 or 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
|
||||
|
||||
program UnRDLL;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
{$H+}
|
||||
|
||||
uses AnsiStrings, Windows, UnRAR, SysUtils;
|
||||
|
||||
const
|
||||
EXTRACT = 0;
|
||||
TEST = 1;
|
||||
PRINT = 2;
|
||||
|
||||
procedure ShowComment(CmtBuf: PAnsiChar); forward;
|
||||
procedure OutHelp; forward;
|
||||
procedure OutOpenArchiveError(Error: Integer; ArcName: PAnsiChar); forward;
|
||||
procedure OutProcessFileError(Error: Integer); forward;
|
||||
procedure ShowArcInfo(Flags: UINT; ArcName: PAnsiChar); forward;
|
||||
|
||||
const
|
||||
CR = #13#10;
|
||||
|
||||
function SFmt(const S: AnsiString; Width: Byte): AnsiString;
|
||||
begin
|
||||
if Length(S) < Width then
|
||||
Result := S + StringOfChar(AnsiChar(' '), Width - Length(S))
|
||||
else
|
||||
Result := Copy(S, 1, Width);
|
||||
end;
|
||||
|
||||
function CallbackProc(msg: UINT; UserData, P1, P2: integer) :integer; stdcall;
|
||||
var
|
||||
Ch: AnsiChar;
|
||||
I: Integer;
|
||||
C: PAnsiChar;
|
||||
S: AnsiString;
|
||||
begin
|
||||
Result := 0;
|
||||
case msg of
|
||||
UCM_CHANGEVOLUME:
|
||||
if (P2 = RAR_VOL_ASK) then begin
|
||||
Write(CR, 'Insert disk with ', PAnsiChar(P1), ' and press ''Enter'' or enter ''Q'' to exit ');
|
||||
Readln(Ch);
|
||||
if (UpCase (Ch) = 'Q') then
|
||||
Result := -1;
|
||||
end;
|
||||
UCM_NEEDPASSWORD:
|
||||
begin
|
||||
Write(CR, 'Please enter the password for this archive: ');
|
||||
Readln(S);
|
||||
C := PAnsiChar(S);
|
||||
Move(pointer(C)^, pointer(p1)^, AnsiStrings.StrLen(C) + 1);
|
||||
//+1 to copy the zero
|
||||
end;
|
||||
UCM_PROCESSDATA: begin
|
||||
if (UserData <> 0) and (PINT (UserData)^ = PRINT) then begin
|
||||
Flush (Output);
|
||||
// Windows.WriteFile fails on big data
|
||||
for I := 0 to P2 - 1 do
|
||||
Write(PAnsiChar(P1 + I)^);
|
||||
Flush (Output);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ExtractArchive(ArcName: PAnsiChar; Mode: Integer);
|
||||
var
|
||||
hArcData: THandle;
|
||||
RHCode, PFCode: Integer;
|
||||
CmtBuf: array[0..Pred(16384)] of AnsiChar;
|
||||
HeaderData: RARHeaderData;
|
||||
OpenArchiveData: RAROpenArchiveDataEx;
|
||||
Operation: Integer;
|
||||
begin
|
||||
OpenArchiveData.ArcName := ArcName;
|
||||
OpenArchiveData.CmtBuf := @CmtBuf;
|
||||
OpenArchiveData.CmtBufSize := SizeOf(CmtBuf);
|
||||
OpenArchiveData.OpenMode := RAR_OM_EXTRACT;
|
||||
hArcData := RAROpenArchiveEx(OpenArchiveData);
|
||||
|
||||
if (OpenArchiveData.OpenResult <> 0) then
|
||||
begin
|
||||
OutOpenArchiveError(OpenArchiveData.OpenResult, ArcName);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ShowArcInfo(OpenArchiveData.Flags, ArcName);
|
||||
|
||||
if (OpenArchiveData.CmtState = 1) then
|
||||
ShowComment(CmtBuf);
|
||||
|
||||
RARSetCallback (hArcData, CallbackProc, Integer (@Mode));
|
||||
|
||||
HeaderData.CmtBuf := nil;
|
||||
|
||||
repeat
|
||||
RHCode := RARReadHeader(hArcData, HeaderData);
|
||||
if RHCode <> 0 then
|
||||
Break;
|
||||
|
||||
case Mode of
|
||||
EXTRACT: Write(CR, 'Extracting ', SFmt(HeaderData.FileName, 45));
|
||||
TEST: Write(CR, 'Testing ', SFmt(HeaderData.FileName, 45));
|
||||
PRINT: Write(CR, 'Printing ', SFmt(HeaderData.FileName, 45), CR);
|
||||
end;
|
||||
|
||||
if Mode = EXTRACT then
|
||||
Operation := RAR_EXTRACT
|
||||
else
|
||||
Operation := RAR_TEST;
|
||||
PFCode := RARProcessFile(hArcData, Operation, nil, nil);
|
||||
|
||||
if (PFCode = 0) then
|
||||
Write(' Ok')
|
||||
else begin
|
||||
OutProcessFileError(PFCode);
|
||||
Break;
|
||||
end;
|
||||
until False;
|
||||
|
||||
if (RHCode = ERAR_BAD_DATA) then
|
||||
Write(CR, 'File header broken');
|
||||
|
||||
RARCloseArchive(hArcData);
|
||||
end;
|
||||
|
||||
procedure ListArchive(ArcName: PAnsiChar);
|
||||
var
|
||||
hArcData: THandle;
|
||||
RHCode, PFCode: Integer;
|
||||
CmtBuf: array[0..Pred(16384)] of AnsiChar;
|
||||
HeaderData: RARHeaderDataEx;
|
||||
OpenArchiveData: RAROpenArchiveDataEx;
|
||||
begin
|
||||
OpenArchiveData.ArcName := ArcName;
|
||||
OpenArchiveData.CmtBuf := @CmtBuf;
|
||||
OpenArchiveData.CmtBufSize := SizeOf(CmtBuf);
|
||||
OpenArchiveData.OpenMode := RAR_OM_LIST;
|
||||
hArcData := RAROpenArchiveEx(OpenArchiveData);
|
||||
|
||||
if (OpenArchiveData.OpenResult <> 0) then
|
||||
begin
|
||||
OutOpenArchiveError(OpenArchiveData.OpenResult, ArcName);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
ShowArcInfo(OpenArchiveData.Flags, ArcName);
|
||||
|
||||
if (OpenArchiveData.CmtState = 1) then
|
||||
ShowComment(CmtBuf);
|
||||
|
||||
RARSetCallback (hArcData, CallbackProc, 0);
|
||||
|
||||
HeaderData.CmtBuf := @CmtBuf;
|
||||
HeaderData.CmtBufSize := SizeOf(CmtBuf);
|
||||
|
||||
Write(CR, 'File', StringOfChar(' ',42),'Size');
|
||||
Write(CR, StringOfChar('-', 50));
|
||||
repeat
|
||||
RHCode := RARReadHeaderEx(hArcData, HeaderData);
|
||||
if RHCode <> 0 then
|
||||
Break;
|
||||
Write(CR, SFmt(HeaderData.FileName, 39), ' ',
|
||||
(HeaderData.UnpSize + HeaderData.UnpSizeHigh * 4294967296.0):10:0);
|
||||
if (HeaderData.CmtState = 1) then
|
||||
ShowComment(CmtBuf);
|
||||
PFCode:= RARProcessFile(hArcData, RAR_SKIP, nil, nil);
|
||||
if (PFCode <> 0) then
|
||||
begin
|
||||
OutProcessFileError(PFCode);
|
||||
Break;
|
||||
end;
|
||||
until False;
|
||||
|
||||
if (RHCode = ERAR_BAD_DATA) then
|
||||
Write(CR, 'File header broken');
|
||||
|
||||
RARCloseArchive(hArcData);
|
||||
end;
|
||||
|
||||
procedure ShowComment(CmtBuf: PAnsiChar);
|
||||
begin
|
||||
Write(CR, 'Comment:', CR, CmtBuf, CR);
|
||||
end;
|
||||
|
||||
procedure ShowArcInfo(Flags: UINT; ArcName: PAnsiChar);
|
||||
function CheckFlag(S: AnsiString; FlagBit: UINT): AnsiString;
|
||||
begin
|
||||
if (Flags and FlagBit) > 0 then result := 'yes' else result := 'no';
|
||||
Write(CR, Format('%-16s %s',[S, Result]));
|
||||
end;
|
||||
begin
|
||||
Writeln(CR, 'Archive ', ArcName);
|
||||
CheckFlag('Volume:', 1);
|
||||
CheckFlag('Comment:', 2);
|
||||
CheckFlag('Locked:', 4);
|
||||
CheckFlag('Solid:', 8);
|
||||
CheckFlag('New naming:', 16);
|
||||
CheckFlag('Authenticity:', 32);
|
||||
CheckFlag('Recovery:', 64);
|
||||
CheckFlag('Encr.headers:', 128);
|
||||
CheckFlag('First volume:', 256);
|
||||
Writeln(CR, '---------------------------');
|
||||
end;
|
||||
|
||||
procedure OutHelp;
|
||||
begin
|
||||
Write(CR, 'UNRDLL. This is a simple example of UNRAR.DLL usage', CR);
|
||||
Write(CR, 'Syntax:', CR);
|
||||
Write(CR, 'UNRDLL X <Archive> extract archive contents');
|
||||
Write(CR, 'UNRDLL T <Archive> test archive contents');
|
||||
Write(CR, 'UNRDLL P <Archive> print archive contents to stdout');
|
||||
Write(CR, 'UNRDLL L <Archive> view archive contents', CR);
|
||||
end;
|
||||
|
||||
procedure OutOpenArchiveError(Error: Integer; ArcName: PAnsiChar);
|
||||
begin
|
||||
case Error of
|
||||
ERAR_NO_MEMORY: Write(CR, 'Not enough memory');
|
||||
ERAR_EOPEN: Write(CR, 'Cannot open ', ArcName);
|
||||
ERAR_BAD_ARCHIVE: Write(CR, ArcName, ' is not RAR archive');
|
||||
ERAR_BAD_DATA: Write(CR, ArcName, ': archive header broken');
|
||||
ERAR_UNKNOWN: Write(CR, 'Unknown error');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure OutProcessFileError(Error: Integer);
|
||||
begin
|
||||
case Error of
|
||||
ERAR_UNKNOWN_FORMAT: Write('Unknown archive format');
|
||||
ERAR_BAD_ARCHIVE: Write('Bad volume');
|
||||
ERAR_ECREATE: Write('File create error');
|
||||
ERAR_EOPEN: Write('Volume open error');
|
||||
ERAR_ECLOSE: Write('File close error');
|
||||
ERAR_EREAD: Write('Read error');
|
||||
ERAR_EWRITE: Write('Write error');
|
||||
ERAR_BAD_DATA: Write('CRC error');
|
||||
ERAR_UNKNOWN: Write('Unknown error');
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
if ParamCount <> 2 then
|
||||
begin
|
||||
OutHelp;
|
||||
Halt(0);
|
||||
end;
|
||||
|
||||
case UpCase(ParamStr(1)[1]) of
|
||||
'X': ExtractArchive(PAnsiChar(AnsiString(ParamStr(2))), EXTRACT);
|
||||
'T': ExtractArchive(PAnsiChar(AnsiString(ParamStr(2))), TEST);
|
||||
'P': ExtractArchive(PAnsiChar(AnsiString(ParamStr(2))), PRINT);
|
||||
'L': ListArchive(PAnsiChar(AnsiString(ParamStr(2))));
|
||||
else
|
||||
OutHelp;
|
||||
end;
|
||||
|
||||
Halt(0);
|
||||
end.
|
162
unrar/Examples/Free Pascal/UnRAR.pp
Normal file
162
unrar/Examples/Free Pascal/UnRAR.pp
Normal file
@@ -0,0 +1,162 @@
|
||||
// Free Pascal interface unit for UnRAR.dll
|
||||
//
|
||||
// Ported to Free Pascal by Alexey Fayans, fidonet: 2:5030/1997, e-mail: shad@shad.pp.ru
|
||||
|
||||
{$IFNDEF NO_SMART_LINK}
|
||||
{$SMARTLINK ON}
|
||||
{$ENDIF}
|
||||
{$MODE objfpc}
|
||||
{$CALLING stdcall}
|
||||
{$PACKRECORDS C}
|
||||
|
||||
unit UnRAR;
|
||||
|
||||
interface
|
||||
|
||||
uses Windows;
|
||||
|
||||
const
|
||||
ERAR_END_ARCHIVE = 10;
|
||||
ERAR_NO_MEMORY = 11;
|
||||
ERAR_BAD_DATA = 12;
|
||||
ERAR_BAD_ARCHIVE = 13;
|
||||
ERAR_UNKNOWN_FORMAT = 14;
|
||||
ERAR_EOPEN = 15;
|
||||
ERAR_ECREATE = 16;
|
||||
ERAR_ECLOSE = 17;
|
||||
ERAR_EREAD = 18;
|
||||
ERAR_EWRITE = 19;
|
||||
ERAR_SMALL_BUF = 20;
|
||||
ERAR_UNKNOWN = 21;
|
||||
|
||||
RAR_OM_LIST = 0;
|
||||
RAR_OM_EXTRACT = 1;
|
||||
|
||||
RAR_SKIP = 0;
|
||||
RAR_TEST = 1;
|
||||
RAR_EXTRACT = 2;
|
||||
|
||||
RAR_VOL_ASK = 0;
|
||||
RAR_VOL_NOTIFY = 1;
|
||||
|
||||
RAR_DLL_VERSION = 3;
|
||||
|
||||
UCM_CHANGEVOLUME = 0;
|
||||
UCM_PROCESSDATA = 1;
|
||||
UCM_NEEDPASSWORD = 2;
|
||||
|
||||
type
|
||||
PRARHeaderData = ^TRARHeaderData;
|
||||
TRARHeaderData = record
|
||||
ArcName: array[0..259] of Char;
|
||||
FileName: array[0..259] 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;
|
||||
|
||||
PRARHeaderDataEx = ^TRARHeaderDataEx;
|
||||
TRARHeaderDataEx = record
|
||||
ArcName: array [0..1023] of Char;
|
||||
ArcNameW: array [0..1023] of WideChar;
|
||||
FileName: array [0..1023] of Char;
|
||||
FileNameW: 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: array [0..1023] of UInt;
|
||||
end;
|
||||
|
||||
PRAROpenArchiveData = ^TRAROpenArchiveData;
|
||||
TRAROpenArchiveData = record
|
||||
ArcName: PChar;
|
||||
OpenMode: UInt;
|
||||
OpenResult: UInt;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UInt;
|
||||
CmtSize: UInt;
|
||||
CmtState: UInt;
|
||||
end;
|
||||
|
||||
PRAROpenArchiveDataEx = ^TRAROpenArchiveDataEx;
|
||||
TRAROpenArchiveDataEx = record
|
||||
ArcName: PChar;
|
||||
ArcNameW: PWideChar;
|
||||
OpenMode: UInt;
|
||||
OpenResult: UInt;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UInt;
|
||||
CmtSize: UInt;
|
||||
CmtState: UInt;
|
||||
Flags: UInt;
|
||||
Reserved: array [0..31] of UInt;
|
||||
end;
|
||||
|
||||
TUnrarCallback = function(Msg: UInt; UserData, P1, P2: Longint): Integer;
|
||||
|
||||
function RAROpenArchive(ArchiveData: PRAROpenArchiveData): THandle;
|
||||
function RAROpenArchiveEx(ArchiveData: PRAROpenArchiveDataEx): THandle;
|
||||
function RARCloseArchive(hArcData: THandle): Integer;
|
||||
function RARReadHeader(hArcData: THandle; HeaderData: PRARHeaderData): Integer;
|
||||
function RARReadHeaderEx(hArcData: THandle; HeaderData: PRARHeaderDataEx): Integer;
|
||||
function RARProcessFile(hArcData: THandle; Operation: Integer; DestPath, DestName: PChar): Integer;
|
||||
function RARProcessFileW(hArcData: THandle; Operation: Integer; DestPath, DestName: PWideChar): Integer;
|
||||
procedure RARSetCallback(hArcData: THandle; UnrarCallback: TUnrarCallback; UserData: Longint);
|
||||
procedure RARSetPassword(hArcData: THandle; Password: PChar);
|
||||
|
||||
// obsolete functions
|
||||
type
|
||||
TChangeVolProc = function(ArcName: PChar; Mode: Integer): Integer;
|
||||
TProcessDataProc = function(Addr: PUChar; Size: Integer): Integer;
|
||||
|
||||
procedure RARSetChangeVolProc(hArcData: THandle; ChangeVolProc: TChangeVolProc);
|
||||
procedure RARSetProcessDataProc(hArcData: THandle; ProcessDataProc: TProcessDataProc);
|
||||
|
||||
implementation
|
||||
|
||||
function RAROpenArchive(ArchiveData: PRAROpenArchiveData): THandle;
|
||||
external 'unrar.dll' name 'RAROpenArchive';
|
||||
function RAROpenArchiveEx(ArchiveData: PRAROpenArchiveDataEx): THandle;
|
||||
external 'unrar.dll' name 'RAROpenArchiveEx';
|
||||
function RARCloseArchive(hArcData: THandle): Integer;
|
||||
external 'unrar.dll' name 'RARCloseArchive';
|
||||
function RARReadHeader(hArcData: THandle; HeaderData: PRARHeaderData): Integer;
|
||||
external 'unrar.dll' name 'RARReadHeader';
|
||||
function RARReadHeaderEx(hArcData: THandle; HeaderData: PRARHeaderDataEx): Integer;
|
||||
external 'unrar.dll' name 'RARReadHeaderEx';
|
||||
function RARProcessFile(hArcData: THandle; Operation: Integer; DestPath, DestName: PChar): Integer;
|
||||
external 'unrar.dll' name 'RARProcessFile';
|
||||
function RARProcessFileW(hArcData: THandle; Operation: Integer; DestPath, DestName: PWideChar): Integer;
|
||||
external 'unrar.dll' name 'RARProcessFileW';
|
||||
procedure RARSetCallback(hArcData: THandle; UnrarCallback: TUnrarCallback; UserData: Longint);
|
||||
external 'unrar.dll' name 'RARSetCallback';
|
||||
procedure RARSetPassword(hArcData: THandle; Password: PChar);
|
||||
external 'unrar.dll' name 'RARSetPassword';
|
||||
procedure RARSetChangeVolProc(hArcData: THandle; ChangeVolProc: TChangeVolProc);
|
||||
external 'unrar.dll' name 'RARSetChangeVolProc';
|
||||
procedure RARSetProcessDataProc(hArcData: THandle; ProcessDataProc: TProcessDataProc);
|
||||
external 'unrar.dll' name 'RARSetProcessDataProc';
|
||||
|
||||
end.
|
BIN
unrar/Examples/MASM/mainicon.ico
Normal file
BIN
unrar/Examples/MASM/mainicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 766 B |
14
unrar/Examples/MASM/readme.txt
Normal file
14
unrar/Examples/MASM/readme.txt
Normal file
@@ -0,0 +1,14 @@
|
||||
Win32ASM unrar.dll example
|
||||
==========================
|
||||
Created using RadASM (www.radasm.com) IDE and MASM32(http://movsd.com).
|
||||
|
||||
Copy unrar.lib to directory for compilation.
|
||||
|
||||
The compiled unrar.exe file uses the first .rar file it finds.
|
||||
-------------------------------------------------------------------------------
|
||||
Get a full UNRAR (De)Installation System here: http://flo.mueckeimnetz.de/eis
|
||||
|
||||
Please drop a line if you find the samples or the include file useful - I'd be
|
||||
glad to hear about.
|
||||
|
||||
-Florian Muecke (devATmueckeimnetz.de)
|
34
unrar/Examples/MASM/rsrc.rc
Normal file
34
unrar/Examples/MASM/rsrc.rc
Normal file
@@ -0,0 +1,34 @@
|
||||
#include "\masm32\include\resource.h"
|
||||
#define ICON_1 500
|
||||
|
||||
#define IDD_DIALOG1 200
|
||||
#define IDC_PROGRESS1 1001
|
||||
#define IDC_PROGRESS2 1002
|
||||
#define IDC_STATIC -1
|
||||
#define IDC_file 301
|
||||
#define IDC_volume 302
|
||||
#define IDC_filebytes 303
|
||||
#define IDC_totalbytes 304
|
||||
|
||||
ICON_1 ICON "mainicon.ico"
|
||||
|
||||
IDD_DIALOG1 DIALOGEX 0, 0, 292, 132
|
||||
STYLE DS_ABSALIGN | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
|
||||
CAPTION "Win32ASM UnRAR Example - by F.M<>cke"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
PUSHBUTTON "Start",IDOK,7,113,50,14,//BS_FLAT
|
||||
PUSHBUTTON "Quit",IDCANCEL,235,113,50,14,//BS_FLAT
|
||||
GROUPBOX "Current File",IDC_STATIC,7,7,278,45
|
||||
GROUPBOX "Overall Progress",IDC_STATIC,7,60,278,45
|
||||
CONTROL "",IDC_file,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,13,16,266,9
|
||||
CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER,14,27,262,10 //PBS_SMOOTH|
|
||||
CONTROL "Progress1",IDC_PROGRESS2,"msctls_progress32",WS_BORDER,14,80,262,10 //PBS_SMOOTH|
|
||||
CONTROL "",IDC_filebytes,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,13,38,266,9
|
||||
CONTROL "",IDC_totalbytes,"Static",SS_LEFTNOWORDWRAP | SS_CENTERIMAGE | WS_GROUP,13,91,266,9
|
||||
LTEXT "Current Volume:",IDC_STATIC,14,69,52,9,SS_CENTERIMAGE
|
||||
LTEXT "",IDC_volume,70,69,200,9,SS_CENTERIMAGE
|
||||
END
|
||||
|
||||
|
BIN
unrar/Examples/MASM/test.rar
Normal file
BIN
unrar/Examples/MASM/test.rar
Normal file
Binary file not shown.
236
unrar/Examples/MASM/unrar.asm
Normal file
236
unrar/Examples/MASM/unrar.asm
Normal file
@@ -0,0 +1,236 @@
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
;
|
||||
; Win32ASM (MASM32) UnRAR Example
|
||||
;
|
||||
; Author: Florian M<>cke
|
||||
; Version: 2, 11.09.05 (complete re-do)
|
||||
;
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
.586
|
||||
.model flat, stdcall
|
||||
option casemap :none ;case sensitive
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
include windows.inc
|
||||
include user32.inc
|
||||
include kernel32.inc
|
||||
include comctl32.inc
|
||||
include unrar.inc
|
||||
|
||||
includelib comctl32.lib
|
||||
includelib user32.lib
|
||||
includelib kernel32.lib
|
||||
includelib unrar.lib
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
WndProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||||
ThreadProc PROTO :DWORD
|
||||
RARCallbackProc PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||||
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
.data
|
||||
hInstance dd 0
|
||||
hWnd dd 0
|
||||
hIcon dd 0
|
||||
hArchive dd 0
|
||||
ArcName db "test.rar",0
|
||||
DestPath db "EXTRACTED_DATA",0
|
||||
caption db "W32ASM UNRAR example",0
|
||||
ArcOpenErr db "archive open error",0
|
||||
NextVolQuery db "next volume not found",0
|
||||
; NextVolOk db "next volume successfully opened",0
|
||||
ArchiveData RAROpenArchiveData <>
|
||||
HeaderData RARHeaderData <>
|
||||
buffer db 260 dup (0)
|
||||
unpSize dd 0
|
||||
FormatStr db "%lu of %lu bytes",0
|
||||
bExtracted dd 0
|
||||
fbExtracted dd 0
|
||||
dummy_dd dd 0
|
||||
FileCRC dd 0
|
||||
IDC_PROGRESS equ 1
|
||||
ThreadID dd 0
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
.code
|
||||
|
||||
start:
|
||||
invoke GetModuleHandle, NULL
|
||||
mov hInstance, eax
|
||||
invoke InitCommonControls
|
||||
|
||||
mov ArchiveData.lpArcName, OFFSET ArcName
|
||||
mov ArchiveData.OpenMode, RAR_OM_LIST
|
||||
invoke RAROpenArchive, ADDR ArchiveData
|
||||
mov hArchive, eax
|
||||
.if eax == 0
|
||||
invoke MessageBox, NULL, ADDR ArcOpenErr, ADDR caption, MB_OK
|
||||
jmp the_end
|
||||
.endif
|
||||
;get unpacked filesize
|
||||
invoke RARReadHeader, hArchive, ADDR HeaderData
|
||||
getunpsize:
|
||||
invoke RARProcessFile, hArchive,RAR_SKIP,0,0
|
||||
mov eax, HeaderData.UnpSize
|
||||
add unpSize, eax
|
||||
invoke RARReadHeader, hArchive, ADDR HeaderData
|
||||
.if eax != ERAR_END_ARCHIVE
|
||||
jmp getunpsize
|
||||
.endif
|
||||
invoke RARCloseArchive, hArchive
|
||||
|
||||
invoke DialogBoxParam,hInstance,200,0,ADDR WndProc,0
|
||||
|
||||
the_end:
|
||||
invoke ExitProcess, 0
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
WndProc proc hWin :DWORD,
|
||||
uMsg :DWORD,
|
||||
wParam :DWORD,
|
||||
lParam :DWORD
|
||||
|
||||
.if uMsg == WM_INITDIALOG
|
||||
push hWin
|
||||
pop hWnd
|
||||
invoke LoadIcon,hInstance,500
|
||||
mov hIcon, eax
|
||||
invoke SendMessage,hWin,WM_SETICON,1,hIcon
|
||||
;mov eax, 1000
|
||||
;shl eax,16 ;create a high and low word
|
||||
;invoke SendDlgItemMessage, hWin, 1001, PBM_SETRANGE,0,eax
|
||||
|
||||
.elseif uMsg == WM_COMMAND
|
||||
mov eax, wParam
|
||||
|
||||
.if eax == IDOK ;LAUNCH
|
||||
invoke CreateThread,NULL,NULL,ADDR ThreadProc,NULL,NORMAL_PRIORITY_CLASS,ADDR ThreadID
|
||||
|
||||
.elseif eax == IDCANCEL ;QUIT
|
||||
invoke EndDialog,hWin,0
|
||||
|
||||
.endif
|
||||
|
||||
.elseif uMsg == WM_CLOSE
|
||||
invoke EndDialog,hWin,0
|
||||
|
||||
.endif
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
WndProc endp
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
ThreadProc PROC RetVal:DWORD
|
||||
invoke SendDlgItemMessage, hWnd, 1002, PBM_SETPOS,eax,0
|
||||
mov ArchiveData.lpArcName, OFFSET ArcName
|
||||
mov ArchiveData.OpenMode, RAR_OM_EXTRACT
|
||||
invoke RAROpenArchive, ADDR ArchiveData
|
||||
mov hArchive, eax
|
||||
|
||||
invoke RARSetCallback, hArchive, offset RARCallbackProc, 0
|
||||
_extract:
|
||||
invoke RARReadHeader, hArchive, ADDR HeaderData
|
||||
.if eax == ERAR_END_ARCHIVE
|
||||
jmp extract_
|
||||
.endif
|
||||
invoke SendDlgItemMessage, hWnd, 302, WM_SETTEXT,0, ADDR HeaderData.ArcName
|
||||
invoke RARProcessFile, hArchive, RAR_EXTRACT, ADDR DestPath, NULL
|
||||
jmp _extract
|
||||
extract_:
|
||||
invoke RARCloseArchive, hArchive
|
||||
ret
|
||||
ThreadProc endp
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
RARCallbackProc PROC msg:DWORD, userData:DWORD, p1:DWORD, p2:DWORD
|
||||
; RAR callback proc for data/volume processing
|
||||
|
||||
.if msg == UCM_CHANGEVOLUME
|
||||
.if p2 == RAR_VOL_NOTIFY
|
||||
invoke SendDlgItemMessage, hWnd, 302, WM_SETTEXT,0, p1
|
||||
mov eax, 1
|
||||
ret
|
||||
.elseif p2 == RAR_VOL_ASK
|
||||
invoke MessageBox,0, ADDR NextVolQuery, addr caption, MB_OK
|
||||
mov eax, -1
|
||||
ret
|
||||
.endif
|
||||
|
||||
.elseif msg == UCM_PROCESSDATA
|
||||
;; .if abort_thread == 1 ;has thread been aborted?
|
||||
;; return -1
|
||||
;; .endif
|
||||
;check if processing file has changed
|
||||
mov eax, FileCRC
|
||||
.if HeaderData.FileCRC != eax ;new file
|
||||
mov eax, p2 ;n of extracted bytes
|
||||
mov bExtracted, eax
|
||||
mov eax, HeaderData.FileCRC
|
||||
mov FileCRC, eax
|
||||
invoke SendDlgItemMessage, hWnd, 301, WM_SETTEXT,0, ADDR HeaderData.FileName
|
||||
.else ;still on the same file
|
||||
mov eax, p2
|
||||
add bExtracted,eax
|
||||
.endif
|
||||
|
||||
.if HeaderData.UnpSize > eax
|
||||
;get percent of current extraction
|
||||
finit ;init fpu
|
||||
fild bExtracted ;load nBytesExtracted on TOS
|
||||
mov dummy_dd, 100
|
||||
fimul dummy_dd
|
||||
fidiv HeaderData.UnpSize ;divides both
|
||||
fistp dummy_dd ;get integer from TOS
|
||||
;--same without floating point--
|
||||
;mov eax, nBytesExtracted
|
||||
;mov ebx, 100
|
||||
;mul ebx ;result in edx:eax
|
||||
;div HeaderData.UnpSize ;source=edx:eax, result in eax
|
||||
;mov dummy_dd,eax
|
||||
;----------------------------
|
||||
.else
|
||||
mov eax,100
|
||||
mov dummy_dd,eax
|
||||
.endif
|
||||
invoke SendDlgItemMessage, hWnd, 1001, PBM_SETPOS,dummy_dd,0
|
||||
invoke wsprintf, ADDR buffer, ADDR FormatStr, bExtracted, HeaderData.UnpSize
|
||||
invoke SendDlgItemMessage, hWnd, 303, WM_SETTEXT,0, ADDR buffer
|
||||
|
||||
;get overall progress percentage
|
||||
mov eax, fbExtracted
|
||||
add eax, p2 ;add n of extracted bytes
|
||||
mov fbExtracted,eax
|
||||
finit ;init fpu
|
||||
fld fbExtracted ;load again
|
||||
mov dummy_dd,100
|
||||
fimul dummy_dd ;mul tos by 100
|
||||
fld unpSize ;load max extracted size
|
||||
fdivp ST(1),ST(0) ;divide to get percentage
|
||||
fistp dummy_dd ;save value
|
||||
invoke SendDlgItemMessage, hWnd, 1002, PBM_SETPOS,dummy_dd,0
|
||||
invoke wsprintf, ADDR buffer, ADDR FormatStr, fbExtracted, unpSize
|
||||
invoke SendDlgItemMessage, hWnd, 304, WM_SETTEXT,0, ADDR buffer
|
||||
mov eax, 1
|
||||
ret
|
||||
|
||||
.elseif msg == UCM_NEEDPASSWORD
|
||||
;; invoke lstrcpy,p1,addr pass
|
||||
.endif
|
||||
xor eax,eax
|
||||
ret
|
||||
|
||||
RARCallbackProc ENDP
|
||||
|
||||
; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
||||
|
||||
end start
|
128
unrar/Examples/MASM/unrar.inc
Normal file
128
unrar/Examples/MASM/unrar.inc
Normal file
@@ -0,0 +1,128 @@
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
;
|
||||
; include file for unrar.dll (version 30.Aug.02)
|
||||
; recreated from unrar.h by F.Muecke
|
||||
;
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
; constants
|
||||
; ~~~~~~~~~
|
||||
ERAR_END_ARCHIVE equ 10
|
||||
ERAR_NO_MEMORY equ 11
|
||||
ERAR_BAD_DATA equ 12
|
||||
ERAR_BAD_ARCHIVE equ 13
|
||||
ERAR_UNKNOWN_FORMAT equ 14
|
||||
ERAR_EOPEN equ 15
|
||||
ERAR_ECREATE equ 16
|
||||
ERAR_ECLOSE equ 17
|
||||
ERAR_EREAD equ 18
|
||||
ERAR_EWRITE equ 19
|
||||
ERAR_SMALL_BUF equ 20
|
||||
ERAR_UNKNOWN equ 21
|
||||
|
||||
RAR_OM_LIST equ 0
|
||||
RAR_OM_EXTRACT equ 1
|
||||
|
||||
RAR_SKIP equ 0
|
||||
RAR_TEST equ 1
|
||||
RAR_EXTRACT equ 2
|
||||
|
||||
RAR_VOL_ASK equ 0
|
||||
RAR_VOL_NOTIFY equ 1
|
||||
|
||||
RAR_DLL_VERSION equ 3
|
||||
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
; structures
|
||||
; ~~~~~~~~~~
|
||||
RARHeaderData STRUC
|
||||
ArcName db 260 dup (0)
|
||||
FileName db 260 dup (0)
|
||||
Flags dd 0
|
||||
PackSize dd 0
|
||||
UnpSize dd 0
|
||||
HostOS dd 0
|
||||
FileCRC dd 0
|
||||
FileTime dd 0
|
||||
UnpVer dd 0
|
||||
Method dd 0
|
||||
FileAttr dd 0
|
||||
lpCmtBuf dd 0
|
||||
CmtBufSize dd 0
|
||||
CmtSize dd 0
|
||||
CmtState dd 0
|
||||
RARHeaderData ENDS
|
||||
|
||||
RARHeaderDataEx STRUC
|
||||
ArcName db 1024 dup (0)
|
||||
ArcNameW db 1024 dup (0)
|
||||
FileName db 1024 dup (0)
|
||||
FileNameW db 1024 dup (0)
|
||||
Flags dd 0
|
||||
PackSize dd 0
|
||||
PackSizeHigh dd 0
|
||||
UnpSize dd 0
|
||||
UnpSizeHigh dd 0
|
||||
HostOS dd 0
|
||||
FileCRC dd 0
|
||||
FileTime dd 0
|
||||
UnpVer dd 0
|
||||
Method dd 0
|
||||
FileAttr dd 0
|
||||
lpCmtBuf dd 0
|
||||
CmtBufSize dd 0
|
||||
CmtSize dd 0
|
||||
CmtState dd 0
|
||||
Reserved dd 1024 dup (0)
|
||||
RARHeaderDataEx ENDS
|
||||
|
||||
RAROpenArchiveData STRUC
|
||||
lpArcName dd 0
|
||||
OpenMode dd 0
|
||||
OpenResult dd 0
|
||||
lpCmtBuf dd 0
|
||||
CmtBufSize dd 0
|
||||
CmtSize dd 0
|
||||
CmtState dd 0
|
||||
RAROpenArchiveData ENDS
|
||||
|
||||
RAROpenArchiveDataEx STRUC
|
||||
lpArcName dd 0
|
||||
lpArcNameW dd 0
|
||||
OpenMode dd 0
|
||||
OpenResult dd 0
|
||||
lpCmtBuf dd 0
|
||||
CmtBufSize dd 0
|
||||
CmtSize dd 0
|
||||
CmtState dd 0
|
||||
Flags dd 0
|
||||
Reserved dd 32 dup (0)
|
||||
RAROpenArchiveDataEx ENDS
|
||||
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
; UNRARCALLBACK_MESSAGES enumeration
|
||||
UCM_CHANGEVOLUME equ 0
|
||||
UCM_PROCESSDATA equ 1
|
||||
UCM_NEEDPASSWORD equ 2
|
||||
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
; Processes
|
||||
; ~~~~~~~~~
|
||||
UnRARCallback PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||||
ChangeVolProc PROTO :DWORD,:DWORD ;C calling convention ??
|
||||
ProcessDataProc PROTO :DWORD,:DWORD ;C calling convention ??
|
||||
RAROpenArchive PROTO :DWORD
|
||||
RAROpenArchiveEx PROTO :DWORD
|
||||
RARCloseArchive PROTO :DWORD
|
||||
RARReadHeader PROTO :DWORD,:DWORD
|
||||
RARReadHeaderEx PROTO :DWORD,:DWORD
|
||||
RARProcessFile PROTO :DWORD,:DWORD,:DWORD,:DWORD
|
||||
RARSetCallback PROTO :DWORD,:DWORD,:DWORD
|
||||
RARSetChangeVolProc PROTO :DWORD,:DWORD
|
||||
RARSetProcessDataProc PROTO :DWORD,:DWORD
|
||||
RARSetPassword PROTO :DWORD,:DWORD
|
||||
RARGetDllVersion PROTO
|
||||
|
||||
; =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=
|
||||
; that's it
|
114
unrar/Examples/MASM/unrar.rap
Normal file
114
unrar/Examples/MASM/unrar.rap
Normal file
@@ -0,0 +1,114 @@
|
||||
[Project]
|
||||
Assembler=masm
|
||||
Type=Win32 App
|
||||
Description=Win32ASM UnRAR example
|
||||
Backup=$P\Bak\
|
||||
Group=1
|
||||
GroupExpand=1
|
||||
Res.rc=1
|
||||
[Files]
|
||||
1=unrar.Asm
|
||||
2=unrar.Inc
|
||||
3=
|
||||
4=rsrc.RC
|
||||
5=
|
||||
[MakeFiles]
|
||||
0=unrar.rap
|
||||
1=rsrc.rc
|
||||
2=unrar.asm
|
||||
3=unrar.obj
|
||||
4=rsrc.res
|
||||
5=unrar.exe
|
||||
6=unrar.def
|
||||
7=unrar.dll
|
||||
8=unrar.txt
|
||||
9=unrar.lib
|
||||
10=unrar.mak
|
||||
11=unrar.hla
|
||||
[MakeDef]
|
||||
Menu=1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0
|
||||
1=4,O,$B\RC.EXE /v,1
|
||||
2=3,O,$B\ML.EXE /c /coff /Cp /nologo /I"$I",2
|
||||
3=5,O,$B\LINK.EXE /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /LIBPATH:"$L",3,4
|
||||
4=0,0,,5
|
||||
5=rsrc.obj,O,$B\CVTRES.EXE,rsrc.res
|
||||
6=*.obj,O,$B\ML.EXE /c /coff /Cp /nologo /I"$I",*.asm
|
||||
7=0,0,\OllyDbg\OllyDbg,5
|
||||
[Group]
|
||||
Group=Added files,Assembly,Resources,Misc,Modules
|
||||
1=2
|
||||
2=2
|
||||
3=
|
||||
4=1
|
||||
5=
|
||||
[Size]
|
||||
2=0,0,0,0,3180
|
||||
1=0,0,1095,875,4
|
||||
4=0,0,0,0,291
|
||||
3=
|
||||
5=
|
||||
[Resource]
|
||||
[Colref]
|
||||
0=00FFFFFF
|
||||
1=00FFFFFF
|
||||
2=00FFFFFF
|
||||
3=00FFFFFF
|
||||
4=00FFFFFF
|
||||
5=00FFFFFF
|
||||
6=00FFFFFF
|
||||
7=00FFFFFF
|
||||
[Version-Inc]
|
||||
Options=52
|
||||
[BookMark]
|
||||
0=
|
||||
1=
|
||||
2=
|
||||
3=
|
||||
4=
|
||||
5=
|
||||
6=
|
||||
7=
|
||||
8=
|
||||
9=
|
||||
[BreakPoint]
|
||||
0=
|
||||
[VersionControl]
|
||||
Settings=1246
|
||||
Milestones=129
|
||||
MilestoneEvery=10
|
||||
MilestoneEveryCurrent=0
|
||||
MilestoneOnBuild=0.0.0.0
|
||||
MilestoneOnTime=2
|
||||
MilestoneOnDate=0
|
||||
MilestoneOnDateWhen=1
|
||||
MilestoneOnDateStatus=0
|
||||
MilestoneOnDateDate=11
|
||||
MilestoneOnDateTimeYear=2005
|
||||
MilestoneOnDateTimeMonth=9
|
||||
MilestoneOnDateTimeDate=10
|
||||
MilestoneOnDateTimeHour=22
|
||||
MilestoneOnDateTimeMin=17
|
||||
MilestoneOnDateTimeSec=43
|
||||
MilestoneOnDateTimeStatus=0
|
||||
BackupLocation=C:\masm32\RadASM\Masm\Projects\VCBackups\
|
||||
CompressionLevel=0
|
||||
DefaultComment=Project $N, $Z, Backup Created On $D At $T.
|
||||
ExcludeExt1=\
|
||||
ExcludeExt2=\
|
||||
ExcludeExt3=\
|
||||
ExcludeExt4=\
|
||||
FileVerLength=4
|
||||
FileVer2Range=0
|
||||
FileVer3Range=0
|
||||
FileVer4Range=0
|
||||
ProductVerLength=4
|
||||
ProductVer2Range=0
|
||||
ProductVer3Range=0
|
||||
ProductVer4Range=0
|
||||
[Collapse]
|
||||
1=
|
||||
4=
|
||||
2=
|
||||
[Find]
|
||||
1="bExtracted"
|
||||
2="unpSize"
|
3
unrar/Examples/Perl/readme.txt
Normal file
3
unrar/Examples/Perl/readme.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
For an open source application written in Perl which uses unrar.dll, visit:
|
||||
http://unrarextractrec.sourceforge.net/
|
||||
http://sourceforge.net/projects/unrarextractrec/
|
173
unrar/Examples/Perl/unrar.pl
Normal file
173
unrar/Examples/Perl/unrar.pl
Normal file
@@ -0,0 +1,173 @@
|
||||
#Author : Nikos Vaggalis
|
||||
#Website : http://perlingresprogramming.blogspot.com/
|
||||
#Email : nikos.vaggalis@gmail.com
|
||||
#Version Date: 16-11-2008
|
||||
#To do for next version : better error description instead of just 'dying' plus more informative messages
|
||||
# add support for using script on files not in script's directory
|
||||
# comment code
|
||||
#Wrapper for unrar.dll in Perl.Interacts with dll using the Win32::API module
|
||||
#For feedback/comments/suggestions please use above email address
|
||||
|
||||
use Win32::API;
|
||||
use Cwd;
|
||||
|
||||
sub declare_win32_functions {
|
||||
$RAROpenArchiveEx=new Win32::API('unrar.dll','RAROpenArchiveEx','P','N');
|
||||
$RARCloseArchive=new Win32::API('unrar.dll','RARCloseArchive','N','N');
|
||||
$RAROpenArchive=new Win32::API('unrar.dll','RAROpenArchive','P','N');
|
||||
$RARReadHeader=new Win32::API('unrar.dll','RARReadHeader','NP','N');
|
||||
$RARReadHeaderEx=new Win32::API('unrar.dll','RARReadHeaderEx','NP','N');
|
||||
$RARProcessFile=new Win32::API('unrar.dll','RARProcessFile','NNPP','N');
|
||||
$RARSetPassword=new Win32::API('unrar.dll','RARSetPassword','NP','N');
|
||||
}
|
||||
|
||||
|
||||
sub extract_headers {
|
||||
my $file=@_[0];
|
||||
my $CmtBuf = pack('x16384');
|
||||
|
||||
my $RAROpenArchiveDataEx=pack('ppLLPLLLLx32',$file,undef,2,0,$CmtBuf,16384,0,0,0);
|
||||
my $RAROpenArchiveData=pack('pLLpLLL',$file,2,0,undef,0,0,0);
|
||||
my $RARHeaderData=pack('x260x260LLLLLLLLLLpLL',0,0,0,0,0,0,0,0,0,0,0,undef,0,0);
|
||||
|
||||
my $handle = $RAROpenArchiveEx->Call($RAROpenArchiveDataEx)||die "RAROpenArchiveEx failed";
|
||||
|
||||
my ($arcname,undef,undef,undef,$CmtBuf1,undef,$CmtSize,$CmtState,$flagsEX)=unpack('ppLLP16384LLLLL',$RAROpenArchiveDataEx);
|
||||
|
||||
|
||||
!$RARCloseArchive->Call($handle)||die "RARCloseArchive failed";
|
||||
|
||||
my $handle = $RAROpenArchive->Call($RAROpenArchiveData)||die "RAROpenArchive failed";
|
||||
|
||||
$flagsEX & 128 || !$RARReadHeader->Call($handle,$RARHeaderData) || die "RARCloseArchive failed";
|
||||
#!$RARReadHeader->Call($handle,$RARHeaderData)||die "RARReadHeader failed";
|
||||
|
||||
|
||||
my ($arcname,$filename,$flags,$packsize)=unpack('A260A260LL',$RARHeaderData);
|
||||
|
||||
|
||||
|
||||
if ($CmtBuf1) {
|
||||
$CmtBuf1=unpack('A'.$CmtSize,$CmtBuf1);
|
||||
}
|
||||
|
||||
|
||||
printf("\nArchive %s\n",$arcname);
|
||||
printf("\nVolume:\t\t%s",($flagsEX & 1) ? "yes":"no");
|
||||
printf("\nComment:\t%s",($flagsEX & 2) ? "yes":"no");
|
||||
printf("\nLocked:\t\t%s",($flagsEX & 4) ? "yes":"no");
|
||||
printf("\nSolid:\t\t%s",($flagsEX & 8) ? "yes":"no");
|
||||
printf("\nNew naming:\t%s",($flagsEX & 16) ? "yes":"no");
|
||||
printf("\nAuthenticity:\t%s",($flagsEX & 32) ? "yes":"no");
|
||||
printf("\nRecovery:\t%s",($flagsEX & 64) ? "yes":"no");
|
||||
printf("\nEncr.headers:\t%s",($flagsEX & 128) ? "yes":"no");
|
||||
printf("\nFirst volume:\t%s",($flagsEX & 256) ? "yes":"no or older than 3.0");
|
||||
printf("\n\nComments :\n%s",$CmtBuf1) if ($CmtBuf1);
|
||||
print "\n\n";
|
||||
|
||||
!$RARCloseArchive->Call($handle);
|
||||
return ($flagsEX & 128,$flags & 4);
|
||||
|
||||
}
|
||||
|
||||
sub list_files_in_archive {
|
||||
my $file =@_[0];
|
||||
my ($blockencrypted,$locked) = extract_headers($file);
|
||||
|
||||
my $password;
|
||||
|
||||
my $RAROpenArchiveDataEx_for_extracting=pack('ppLLpLLLLx32',$file,undef,2,0,undef,0,0,0,0);
|
||||
my $handle = $RAROpenArchiveEx->Call($RAROpenArchiveDataEx_for_extracting)||die "RAROpenArchiveEx failed";
|
||||
my $RARHeaderData=pack('x260x260LLLLLLLLLLpLL',0,0,0,0,0,0,0,0,0,0,0,undef,0,0,0);
|
||||
|
||||
if ($blockencrypted){
|
||||
print ("Encrypted headers,enter password: "),chomp ($password=<STDIN>);
|
||||
|
||||
if ($password) {
|
||||
$RARSetPassword->Call($handle,$password);
|
||||
}
|
||||
else {
|
||||
die "\nshould had entered password!!exiting....\n";
|
||||
}
|
||||
}
|
||||
|
||||
while (($RARReadHeader->Call($handle,$RARHeaderData))==0) {
|
||||
my $processresult=$RARProcessFile->Call($handle,0,undef,undef);
|
||||
if ($processresult!=0) {
|
||||
last;
|
||||
}
|
||||
else {
|
||||
my @files=unpack('A260A260LLLLLLLLLLpLL',$RARHeaderData);
|
||||
print "File\t\t\t\t\tSize\n";
|
||||
print "-------------------------------------------\n";
|
||||
print "$files[0]\\$files[1]\t\t$files[4]\n\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
!$RARCloseArchive->Call($handle)||die "$RARCloseArchive failed";
|
||||
}
|
||||
|
||||
sub process_file {
|
||||
my $file=@_[0];
|
||||
my ($blockencrypted,$locked) = extract_headers($file);
|
||||
|
||||
my $errorstatus;
|
||||
my $password;
|
||||
|
||||
my $RAROpenArchiveDataEx_for_extracting=pack('ppLLpLLLLx32',$file,undef,1,0,undef,0,0,0,0);
|
||||
my $RARHeaderData=pack('x260x260LLLLLLLLLLpLL',0,0,0,0,0,0,0,0,0,0,0,undef,0,0);
|
||||
|
||||
my $handle = $RAROpenArchiveEx->Call($RAROpenArchiveDataEx_for_extracting)||die "RAROpenArchiveEx failed";
|
||||
|
||||
if ($blockencrypted || $locked){
|
||||
print ("Enter password: "),chomp ($password=<STDIN>);
|
||||
|
||||
if ($password) {
|
||||
$RARSetPassword->Call($handle,$password);
|
||||
}
|
||||
else {
|
||||
die "\nshould had entered password!!exiting....\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
while (($RARReadHeader->Call($handle,$RARHeaderData))==0) {
|
||||
my $processresult=$RARProcessFile->Call($handle,2,undef,undef);
|
||||
if ($processresult!=0) {
|
||||
$errorstatus=$processresult;
|
||||
last;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
print "Errorstatus : $errorstatus " if $errorstatus;
|
||||
!$RARCloseArchive->Call($handle)||die "RRARCloseArchive failed";
|
||||
}
|
||||
|
||||
declare_win32_functions();
|
||||
|
||||
my $file;
|
||||
if (!defined @ARGV) {
|
||||
print "Usage : perl unrar.pl [option] filename\n";
|
||||
print "where [option] is either X or L. (X=extract,L=List file contents)\n";
|
||||
print "\nThe script and the file to be processed should be in the same directory\n";
|
||||
print "\nExample usage: \nperl unrar.pl L myfile.rar\n";
|
||||
}
|
||||
elsif (!defined $ARGV[0] || $ARGV[0] ne "L" && $ARGV[0] ne "X") {
|
||||
print "Enter mode L or X\n";
|
||||
}
|
||||
elsif (!defined $ARGV[1]) {
|
||||
print ("No filename!") && exit;
|
||||
}
|
||||
else {
|
||||
$file=$ARGV[1];
|
||||
if ($ARGV[0] eq "L") {
|
||||
list_files_in_archive($file);
|
||||
}
|
||||
elsif ($ARGV[0] eq "X") {
|
||||
process_file($file);
|
||||
}
|
||||
}
|
||||
|
32
unrar/Examples/VB.NET/TestRAR/AssemblyInfo.vb
Normal file
32
unrar/Examples/VB.NET/TestRAR/AssemblyInfo.vb
Normal file
@@ -0,0 +1,32 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: CLSCompliant(True)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("57DCF4D1-FF97-4B4F-B065-03458A03DF4C")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
211
unrar/Examples/VB.NET/TestRAR/Form1.resx
Normal file
211
unrar/Examples/VB.NET/TestRAR/Form1.resx
Normal file
@@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="btnOpen.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnOpen.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnOpen.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="lv.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="lv.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="lv.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnClose.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnClose.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnClose.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnUnpackAll.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnUnpackAll.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnUnpackAll.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnUnpack.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnUnpack.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnUnpack.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnComment.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnComment.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnComment.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="StatusBar1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="StatusBar1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="StatusBar1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="mainPanel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="mainPanel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="datepanel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="datepanel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="progressPanel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="progressPanel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>Form1</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
</root>
|
300
unrar/Examples/VB.NET/TestRAR/Form1.vb
Normal file
300
unrar/Examples/VB.NET/TestRAR/Form1.vb
Normal file
@@ -0,0 +1,300 @@
|
||||
'**************************************************************************************
|
||||
'
|
||||
' Trivial example using the Wrapper class for unrar.dll
|
||||
' If anyone finds any problems, I'd appreciate an email.
|
||||
'
|
||||
' marcel_madonna@ajmsoft.com
|
||||
'
|
||||
' This code is meant as an example only. It is not robust and does not handle
|
||||
' many potential error conditions. This is not production ready code.
|
||||
'
|
||||
'**************************************************************************************
|
||||
|
||||
Imports RARNET
|
||||
|
||||
Public Class Form1
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
#Region " Windows Form Designer generated code "
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Windows Form Designer.
|
||||
InitializeComponent()
|
||||
|
||||
'Add any initialization after the InitializeComponent() call
|
||||
|
||||
End Sub
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing Then
|
||||
If Not (components Is Nothing) Then
|
||||
components.Dispose()
|
||||
End If
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
Friend WithEvents lv As System.Windows.Forms.ListView
|
||||
Friend WithEvents btnOpen As System.Windows.Forms.Button
|
||||
Friend WithEvents btnClose As System.Windows.Forms.Button
|
||||
Friend WithEvents btnUnpackAll As System.Windows.Forms.Button
|
||||
Friend WithEvents btnUnpack As System.Windows.Forms.Button
|
||||
Friend WithEvents btnComment As System.Windows.Forms.Button
|
||||
Friend WithEvents StatusBar1 As System.Windows.Forms.StatusBar
|
||||
Friend WithEvents mainPanel As System.Windows.Forms.StatusBarPanel
|
||||
Friend WithEvents datepanel As System.Windows.Forms.StatusBarPanel
|
||||
Friend WithEvents progressPanel As System.Windows.Forms.StatusBarPanel
|
||||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||||
Me.btnOpen = New System.Windows.Forms.Button
|
||||
Me.lv = New System.Windows.Forms.ListView
|
||||
Me.btnClose = New System.Windows.Forms.Button
|
||||
Me.btnUnpackAll = New System.Windows.Forms.Button
|
||||
Me.btnUnpack = New System.Windows.Forms.Button
|
||||
Me.btnComment = New System.Windows.Forms.Button
|
||||
Me.StatusBar1 = New System.Windows.Forms.StatusBar
|
||||
Me.mainPanel = New System.Windows.Forms.StatusBarPanel
|
||||
Me.datepanel = New System.Windows.Forms.StatusBarPanel
|
||||
Me.progressPanel = New System.Windows.Forms.StatusBarPanel
|
||||
CType(Me.mainPanel, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.datepanel, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
CType(Me.progressPanel, System.ComponentModel.ISupportInitialize).BeginInit()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'btnOpen
|
||||
'
|
||||
Me.btnOpen.Location = New System.Drawing.Point(336, 224)
|
||||
Me.btnOpen.Name = "btnOpen"
|
||||
Me.btnOpen.Size = New System.Drawing.Size(64, 24)
|
||||
Me.btnOpen.TabIndex = 0
|
||||
Me.btnOpen.Text = "Open"
|
||||
'
|
||||
'lv
|
||||
'
|
||||
Me.lv.Location = New System.Drawing.Point(8, 16)
|
||||
Me.lv.Name = "lv"
|
||||
Me.lv.Size = New System.Drawing.Size(608, 200)
|
||||
Me.lv.TabIndex = 1
|
||||
'
|
||||
'btnClose
|
||||
'
|
||||
Me.btnClose.Location = New System.Drawing.Point(552, 224)
|
||||
Me.btnClose.Name = "btnClose"
|
||||
Me.btnClose.Size = New System.Drawing.Size(64, 24)
|
||||
Me.btnClose.TabIndex = 2
|
||||
Me.btnClose.Text = "Close"
|
||||
'
|
||||
'btnUnpackAll
|
||||
'
|
||||
Me.btnUnpackAll.Location = New System.Drawing.Point(480, 224)
|
||||
Me.btnUnpackAll.Name = "btnUnpackAll"
|
||||
Me.btnUnpackAll.Size = New System.Drawing.Size(64, 24)
|
||||
Me.btnUnpackAll.TabIndex = 3
|
||||
Me.btnUnpackAll.Text = "Unp All"
|
||||
'
|
||||
'btnUnpack
|
||||
'
|
||||
Me.btnUnpack.Location = New System.Drawing.Point(408, 224)
|
||||
Me.btnUnpack.Name = "btnUnpack"
|
||||
Me.btnUnpack.Size = New System.Drawing.Size(64, 24)
|
||||
Me.btnUnpack.TabIndex = 4
|
||||
Me.btnUnpack.Text = "Unpack"
|
||||
'
|
||||
'btnComment
|
||||
'
|
||||
Me.btnComment.Location = New System.Drawing.Point(8, 224)
|
||||
Me.btnComment.Name = "btnComment"
|
||||
Me.btnComment.Size = New System.Drawing.Size(64, 24)
|
||||
Me.btnComment.TabIndex = 5
|
||||
Me.btnComment.Text = "Comment"
|
||||
'
|
||||
'StatusBar1
|
||||
'
|
||||
Me.StatusBar1.Location = New System.Drawing.Point(0, 256)
|
||||
Me.StatusBar1.Name = "StatusBar1"
|
||||
Me.StatusBar1.Panels.AddRange(New System.Windows.Forms.StatusBarPanel() {Me.mainPanel, Me.progressPanel, Me.datepanel})
|
||||
Me.StatusBar1.ShowPanels = True
|
||||
Me.StatusBar1.Size = New System.Drawing.Size(624, 16)
|
||||
Me.StatusBar1.TabIndex = 6
|
||||
'
|
||||
'mainPanel
|
||||
'
|
||||
Me.mainPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring
|
||||
Me.mainPanel.Text = "StatusBarPanel1"
|
||||
Me.mainPanel.Width = 499
|
||||
'
|
||||
'datepanel
|
||||
'
|
||||
Me.datepanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents
|
||||
Me.datepanel.Text = "StatusBarPanel1"
|
||||
Me.datepanel.Width = 99
|
||||
'
|
||||
'progressPanel
|
||||
'
|
||||
Me.progressPanel.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Contents
|
||||
Me.progressPanel.Width = 10
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
||||
Me.ClientSize = New System.Drawing.Size(624, 272)
|
||||
Me.Controls.Add(Me.StatusBar1)
|
||||
Me.Controls.Add(Me.btnComment)
|
||||
Me.Controls.Add(Me.btnUnpack)
|
||||
Me.Controls.Add(Me.btnUnpackAll)
|
||||
Me.Controls.Add(Me.btnClose)
|
||||
Me.Controls.Add(Me.lv)
|
||||
Me.Controls.Add(Me.btnOpen)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Trivial UnRAR Sample"
|
||||
CType(Me.mainPanel, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.datepanel, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
CType(Me.progressPanel, System.ComponentModel.ISupportInitialize).EndInit()
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Dim d As Decompressor
|
||||
|
||||
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
lv.View = View.Details
|
||||
lv.GridLines = True
|
||||
' Create some columns
|
||||
lv.Columns.Add("File", 200, HorizontalAlignment.Left)
|
||||
lv.Columns.Add("Attr", 30, HorizontalAlignment.Left)
|
||||
lv.Columns.Add("Packed Size", 100, HorizontalAlignment.Left)
|
||||
lv.Columns.Add("Unpacked Size", 100, HorizontalAlignment.Center)
|
||||
lv.Columns.Add("CRC", 120, HorizontalAlignment.Center)
|
||||
|
||||
'Initialize the status bar
|
||||
StatusBar1.Panels.Item(0).Text = ""
|
||||
StatusBar1.Panels.Item(2).Text = Now.ToShortDateString.ToString
|
||||
End Sub
|
||||
|
||||
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
|
||||
|
||||
Dim szFile As String = GetFile
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
lv.Items.Clear()
|
||||
Try
|
||||
d = New Decompressor(szFile)
|
||||
AddHandler d.OnUnpack, AddressOf Unpacked
|
||||
AddHandler Decompressor.Unpacking, AddressOf InProgress
|
||||
|
||||
For Each r As Decompressor.RAREntry In d.RARFiles
|
||||
Dim lvitem As New ListViewItem(r.FileName)
|
||||
' Place a check mark next to the item.
|
||||
lvitem.SubItems.Add(r.FileAttr)
|
||||
lvitem.SubItems.Add(r.PackSize)
|
||||
lvitem.SubItems.Add(r.UnpSize)
|
||||
lvitem.SubItems.Add(r.FileCRC)
|
||||
lv.Items.Add(lvitem)
|
||||
Next
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
d = Nothing
|
||||
Exit Sub
|
||||
Finally
|
||||
Me.Cursor = Cursors.Default
|
||||
End Try
|
||||
StatusBar1.Panels.Item(2).Text = d.TotalArchiveSize.ToString
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
|
||||
Me.Close()
|
||||
End Sub
|
||||
|
||||
Private Sub btnComment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnComment.Click
|
||||
If d Is Nothing Then Exit Sub
|
||||
MsgBox("Comment: " & d.RARHeader.CmtBuf)
|
||||
End Sub
|
||||
|
||||
Private Sub btnUnpack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnpack.Click
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
StatusBar1.Panels.Item(0).Text = "Working..."
|
||||
Try
|
||||
Select Case lv.SelectedItems.Count
|
||||
Case 0
|
||||
Me.Cursor = Cursors.Default
|
||||
MsgBox("Select a file to unpack")
|
||||
Case 1
|
||||
d.UnPack(lv.SelectedItems(0).Text, GetPath())
|
||||
Case Else
|
||||
Dim szFiles(lv.SelectedItems.Count - 1) As String
|
||||
For i As Integer = 0 To lv.SelectedItems.Count - 1
|
||||
szFiles(i) = lv.SelectedItems(i).Text
|
||||
Next
|
||||
d.UnPack(szFiles, GetPath())
|
||||
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
StatusBar1.Panels.Item(0).Text = "Done"
|
||||
Me.Cursor = Cursors.Default
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnUnpackAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUnpackAll.Click
|
||||
Me.Cursor = Cursors.WaitCursor
|
||||
StatusBar1.Panels.Item(0).Text = "Working..."
|
||||
Try
|
||||
d.UnPackAll(GetPath())
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
Finally
|
||||
StatusBar1.Panels.Item(0).Text = "Done"
|
||||
Me.Cursor = Cursors.Default
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Function GetFile() As String
|
||||
|
||||
Dim f As New OpenFileDialog
|
||||
f.Title = "Unpack RAR Archive"
|
||||
f.CheckFileExists = True
|
||||
f.DefaultExt = "RAR"
|
||||
f.Filter = "RAR files (*.rar)|*.rar|All files (*.*)|*.*"
|
||||
f.RestoreDirectory = True
|
||||
If f.ShowDialog() = DialogResult.OK Then
|
||||
Return f.FileName
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Private Function GetPath() As String
|
||||
Dim f As New FolderBrowserDialog
|
||||
f.Description = "Unpack RAR Archive"
|
||||
f.ShowNewFolderButton = True
|
||||
If f.ShowDialog() = DialogResult.OK Then
|
||||
Return f.SelectedPath
|
||||
End If
|
||||
Return ""
|
||||
End Function
|
||||
|
||||
Public Sub Unpacked(ByVal r As Decompressor.RAREntry)
|
||||
StatusBar1.Panels.Item(0).Text = r.FileName & " Unpacked"
|
||||
End Sub
|
||||
|
||||
'Public Sub InProgress(ByVal TotalFileSize As Long, ByVal CurrentFileSize As Long, ByRef bDisposition As Decompressor.RarDisposition)
|
||||
Public Sub InProgress(ByVal TotalFileSize As Long, ByVal CurrentFileSize As Long, ByRef bDisposition As Decompressor.RarDisposition)
|
||||
If TotalFileSize = 0 Then Exit Sub
|
||||
StatusBar1.Panels.Item(1).Text = Format(CurrentFileSize / TotalFileSize, "percent")
|
||||
Application.DoEvents()
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
20
unrar/Examples/VB.NET/TestRAR/TestRAR.sln
Normal file
20
unrar/Examples/VB.NET/TestRAR/TestRAR.sln
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestRAR", "TestRAR.vbproj", "{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
157
unrar/Examples/VB.NET/TestRAR/TestRAR.vbproj
Normal file
157
unrar/Examples/VB.NET/TestRAR/TestRAR.vbproj
Normal file
@@ -0,0 +1,157 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>9.0.21022</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>TestRAR</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<RootNamespace>TestRAR</RootNamespace>
|
||||
<StartupObject>TestRAR.Form1</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<MyType>WindowsFormsWithCustomSubMain</MyType>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
<PublishUrl>http://localhost/TestRAR/</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>TestRAR.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>TestRAR.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\UnRARNET\UnRARNET.vbproj">
|
||||
<Project>{7B86181F-5232-473D-BAFE-477F0DA1DD52}</Project>
|
||||
<Name>UnRARNET</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 2.0 %28x86%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.0 %28x86%29</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
69
unrar/Examples/VB.NET/TestRAR/TestRAR.vbproj.user
Normal file
69
unrar/Examples/VB.NET/TestRAR/TestRAR.vbproj.user
Normal file
@@ -0,0 +1,69 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastOpenVersion>7.10.3077</LastOpenVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>E:\MyProjects\UtilitiesCSharp\UnRARNET\bin\Debug\;E:\MyProjects\Utilities\UnRARNET\bin\</ReferencePath>
|
||||
<CopyProjectDestinationFolder>
|
||||
</CopyProjectDestinationFolder>
|
||||
<CopyProjectUncPath>
|
||||
</CopyProjectUncPath>
|
||||
<CopyProjectOption>0</CopyProjectOption>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
<PublishUrlHistory>
|
||||
</PublishUrlHistory>
|
||||
<InstallUrlHistory>
|
||||
</InstallUrlHistory>
|
||||
<SupportUrlHistory>
|
||||
</SupportUrlHistory>
|
||||
<UpdateUrlHistory>
|
||||
</UpdateUrlHistory>
|
||||
<BootstrapperUrlHistory>
|
||||
</BootstrapperUrlHistory>
|
||||
<FallbackCulture>en-US</FallbackCulture>
|
||||
<VerifyUploadedFiles>true</VerifyUploadedFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
</Project>
|
26
unrar/Examples/VB.NET/UnRARNET.sln
Normal file
26
unrar/Examples/VB.NET/UnRARNET.sln
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "UnRARNET", "unRARNET\UnRARNET.vbproj", "{7B86181F-5232-473D-BAFE-477F0DA1DD52}"
|
||||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestRAR", "TestRAR\TestRAR.vbproj", "{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7B86181F-5232-473D-BAFE-477F0DA1DD52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7B86181F-5232-473D-BAFE-477F0DA1DD52}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7B86181F-5232-473D-BAFE-477F0DA1DD52}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7B86181F-5232-473D-BAFE-477F0DA1DD52}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C50ED4D3-58A8-4B70-ACF1-A2DFA0AB0FE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
16
unrar/Examples/VB.NET/readme.txt
Normal file
16
unrar/Examples/VB.NET/readme.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Unpack and open UnRARNET.sln - includes a wrapper for UnRAR.dll and a test program.
|
||||
|
||||
Modifued in June 2010 to operate with both 32 and 64-bit versions of UnRAR.
|
||||
|
||||
Requires:
|
||||
|
||||
- Visual Studio 2008
|
||||
- .NET 2.0
|
||||
|
||||
I have included version of unrar.dll and unrar64.all. Check the RARLabs website for
|
||||
a more current version. They are located in the bin directories for TestRAR and
|
||||
unRARNET
|
||||
|
||||
If you find any problems, I'd appreciate an email.
|
||||
|
||||
marcel_madonna@ajmsoft.com
|
34
unrar/Examples/VB.NET/unRARNET/AssemblyInfo.vb
Normal file
34
unrar/Examples/VB.NET/unRARNET/AssemblyInfo.vb
Normal file
@@ -0,0 +1,34 @@
|
||||
Imports System
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("UnRARNET")>
|
||||
<Assembly: AssemblyDescription("UnRAR Wrapper Class")>
|
||||
<Assembly: AssemblyCompany("ajm Software")>
|
||||
<Assembly: AssemblyProduct("UnRAR")>
|
||||
<Assembly: AssemblyCopyright("Copyright <20> 2004 ajm Software L.L.C. All rights reserved.")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: CLSCompliant(True)>
|
||||
'<Assembly: AssemblyKeyFileAttribute("E:\MyProjects\ajmsoft.snk")>
|
||||
'<Assembly: AssemblyDelaySign(True)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("EF0469C5-BEB1-4FC6-B460-511B0826B8DB")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
677
unrar/Examples/VB.NET/unRARNET/Decompressor.vb
Normal file
677
unrar/Examples/VB.NET/unRARNET/Decompressor.vb
Normal file
@@ -0,0 +1,677 @@
|
||||
'**************************************************************************************
|
||||
'
|
||||
' Wrapper class for unrar.dll
|
||||
' If anyone finds any problems, I'd appreciate an email.
|
||||
'
|
||||
' marcel_madonna@ajmsoft.com
|
||||
'
|
||||
' If you make changes, remember that GC tends to interfere with callbacks from
|
||||
' unmanaged code. Test very very larges archives (1GB+), archives with many
|
||||
' files (5000+), archives on separate volumes and password protected archives
|
||||
'
|
||||
' CHANGE HISTORY
|
||||
'
|
||||
' 06/01/2010
|
||||
' Added logic to load 64-bit version of unrar (unrar64.dll) when running on
|
||||
' a 64-bit OS.
|
||||
'
|
||||
'
|
||||
' Added another parameter to the Unpacking EVENT to allow Cancel
|
||||
' Added an error code for cancel
|
||||
' Changed Error code to a public enum
|
||||
' Enabled progress tracking when unpacking by file
|
||||
'
|
||||
'**************************************************************************************
|
||||
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Text
|
||||
|
||||
Public Class Decompressor
|
||||
|
||||
'generate an event after each file is unpacked
|
||||
Public Event OnUnpack(ByVal r As RAREntry)
|
||||
Public Shared Event Unpacking(ByVal fTotalSize As Long, ByVal fUnpackedSize As Long, ByRef Disposition As RarDisposition)
|
||||
|
||||
Public Enum RarErrors
|
||||
ERAR_END_ARCHIVE = 10
|
||||
ERAR_NO_MEMORY = 11
|
||||
ERAR_BAD_DATA = 12
|
||||
ERAR_BAD_ARCHIVE = 13
|
||||
ERAR_UNKNOWN_FORMAT = 14
|
||||
ERAR_EOPEN = 15
|
||||
ERAR_ECREATE = 16
|
||||
ERAR_ECLOSE = 17
|
||||
ERAR_EREAD = 18
|
||||
ERAR_EWRITE = 19
|
||||
ERAR_SMALL_BUF = 20
|
||||
ERAR_CANCELLED = 21
|
||||
end enum
|
||||
|
||||
Const RAR_OM_LIST As Integer = 0
|
||||
Const RAR_OM_EXTRACT As Integer = 1
|
||||
|
||||
Const RAR_SKIP As Integer = 0
|
||||
Const RAR_TEST As Integer = 1
|
||||
Const RAR_EXTRACT As Integer = 2
|
||||
|
||||
Const UCM_CHANGEVOLUME As Integer = 0
|
||||
Const UCM_PROCESSDATA As Integer = 1
|
||||
Const UCM_NEEDPASSWORD As Integer = 2
|
||||
|
||||
Const RAR_VOL_ASK As Integer = 0
|
||||
Const RAR_VOL_NOTIFY As Integer = 1
|
||||
|
||||
Public Enum RarOperations
|
||||
OP_EXTRACT = 0
|
||||
OP_TEST = 1
|
||||
OP_LIST = 2
|
||||
End Enum
|
||||
|
||||
Public Enum RarDisposition
|
||||
OP_CANCEL = -1
|
||||
OP_CONTINUE = +1
|
||||
End Enum
|
||||
|
||||
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
|
||||
Public Structure RARHeaderData 'mdm 06/01/2010 made Public
|
||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
|
||||
Public ArcName As String
|
||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=260)> _
|
||||
Public FileName As String
|
||||
Public Flags As Integer
|
||||
Public PackSize As Integer
|
||||
Public UnpSize As Integer
|
||||
Public HostOS As Integer
|
||||
Public FileCRC As Integer
|
||||
Public FileTime As Integer
|
||||
Public UnpVer As Integer
|
||||
Public Method As Integer
|
||||
Public FileAttr As Integer
|
||||
Public CmtBuf As String
|
||||
Public CmtBufSize As Integer
|
||||
Public CmtSize As Integer
|
||||
Public CmtState As Integer
|
||||
End Structure
|
||||
|
||||
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi)> _
|
||||
Public Structure RARHeaderDataEx 'mdm 06/01/2010 made Public
|
||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1024)> _
|
||||
Public ArcName As String
|
||||
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2048)> _
|
||||
Public ArcNameW As Byte()
|
||||
<MarshalAs(UnmanagedType.ByValTStr, SizeConst:=1024)> _
|
||||
Public FileName As String
|
||||
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2048)> _
|
||||
Public FileNameW As Byte()
|
||||
Public Flags As Integer
|
||||
Public PackSize As Integer
|
||||
Public PackSizeHigh As Integer
|
||||
Public UnpSize As Integer
|
||||
Public UnpSizeHigh As Integer
|
||||
Public HostOS As Integer
|
||||
Public FileCRC As Integer
|
||||
Public FileTime As Integer
|
||||
Public UnpVer As Integer
|
||||
Public Method As Integer
|
||||
Public FileAttr As Integer
|
||||
Public CmtBuf As String
|
||||
Public CmtBufSize As Integer
|
||||
Public CmtSize As Integer
|
||||
Public CmtState As Integer
|
||||
<VBFixedArray(1024)> Public Reserved As Byte
|
||||
End Structure
|
||||
|
||||
<StructLayout(LayoutKind.Sequential)> Public Structure RAROpenArchiveData
|
||||
<VBFixedString(260)> Public ArcName As String
|
||||
Public OpenMode As Integer
|
||||
Public OpenResult As Integer
|
||||
Public CmtBuf As String
|
||||
Public CmtBufSize As Integer
|
||||
Public CmtSize As Integer
|
||||
Public CmtState As Integer
|
||||
End Structure
|
||||
|
||||
<StructLayout(LayoutKind.Sequential)> Public Structure RAROpenArchiveDataEx
|
||||
<VBFixedString(1024)> Public ArcName As String
|
||||
<VBFixedArray(2048)> Public ArcNameW As Byte()
|
||||
Public OpenMode As Integer
|
||||
Public OpenResult As Integer
|
||||
Public CmtBuf As String
|
||||
Public CmtBufSize As Integer
|
||||
Public CmtSize As Integer
|
||||
Public CmtState As Integer
|
||||
Public Flags As Integer
|
||||
<VBFixedArray(32)> Public Reserved As Byte
|
||||
End Structure
|
||||
|
||||
'mdm 06/01/2010
|
||||
' Add vectors for each routine in Unrar
|
||||
Private _delRARReadHeader As dRARReadHeader
|
||||
Private _delRARReadHeaderEx As dRARReadHeaderEx
|
||||
Private _delRAROpenArchive As dRAROpenArchive
|
||||
Private _delRAROpenArchiveEx As dRAROpenArchiveEx
|
||||
Private _delRARCloseArchive As dRARCloseArchive
|
||||
Private _delRARProcessFile As dRARProcessFile
|
||||
Private _delRARSetPassword As dRARSetPassword
|
||||
Private _delRARGetDllVersion As dRARGetDllVersion
|
||||
Private _delRARSetCallBack As dRARSetCallBack
|
||||
|
||||
Const KERNEL As String = "kernel32.dll" 'mdm 06/01/2010
|
||||
|
||||
'mdm 06/01/2010
|
||||
' Add definitions for needed kernel routines
|
||||
<DllImport(KERNEL)> _
|
||||
Private Shared Function LoadLibraryEx(ByVal dllFilePath As String, ByVal hFile As IntPtr, ByVal dwFlags As Integer) As IntPtr
|
||||
End Function
|
||||
|
||||
<DllImport(KERNEL)> _
|
||||
Private Shared Function FreeLibrary(ByVal dllPointer As IntPtr) As Boolean
|
||||
End Function
|
||||
|
||||
<DllImport(KERNEL, CharSet:=CharSet.Ansi)> _
|
||||
Private Shared Function GetProcAddress(ByVal dllPointer As IntPtr, ByVal functionName As String) As IntPtr
|
||||
End Function
|
||||
|
||||
' mdm 06/01/2010
|
||||
' Redefined all Function declarations to use delegates to allow
|
||||
' dynamic load of the unrar library and avoid static calls
|
||||
'
|
||||
'Const MYLIB As String = "E:\MyProjects\Utilities\UnRAR\debug\unrar.dll"
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RARReadHeader(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderData) As Integer
|
||||
'End Function
|
||||
<UnmanagedFunctionPointer(CallingConvention.StdCall)> _
|
||||
Public Delegate Function dRARReadHeader(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderData) As Integer
|
||||
Private Function RARReadHeader(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderData) As Integer
|
||||
Return _delRARReadHeader.Invoke(hArcData, HeaderData)
|
||||
End Function
|
||||
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RARReadHeaderEx(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderDataEx) As Integer
|
||||
'End Function
|
||||
Public Delegate Function dRARReadHeaderEx(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderDataEx) As Integer
|
||||
Private Function RARReadHeaderEx(ByVal hArcData As IntPtr, ByRef HeaderData As RARHeaderDataEx) As Integer
|
||||
Return _delRARReadHeaderEx.Invoke(hArcData, HeaderData)
|
||||
End Function
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RAROpenArchive(ByRef ArchiveData As RAROpenArchiveData) As IntPtr
|
||||
'End Function
|
||||
Public Delegate Function dRAROpenArchive(ByRef ArchiveData As RAROpenArchiveData) As IntPtr
|
||||
Private Function RARRAROpenArchive(ByRef ArchiveData As RAROpenArchiveData) As Integer
|
||||
Return _delRAROpenArchive.Invoke(archiveData)
|
||||
End Function
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RAROpenArchiveEx(ByRef ArchiveData As RAROpenArchiveDataEx) As IntPtr
|
||||
'End Function
|
||||
Private Delegate Function dRAROpenArchiveEx(ByRef ArchiveData As RAROpenArchiveDataEx) As IntPtr
|
||||
Private Function RAROpenArchiveEx(ByRef ArchiveData As RAROpenArchiveDataEx) As IntPtr
|
||||
Return _delRAROpenArchiveEx.Invoke(ArchiveData)
|
||||
End Function
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RARCloseArchive(ByVal hArcData As IntPtr) As Integer
|
||||
'End Function
|
||||
Private Delegate Function dRARCloseArchive(ByVal hArcData As IntPtr) As Integer
|
||||
Private Function RARCloseArchive(ByVal hArcData As IntPtr) As Integer
|
||||
Return _delRARCloseArchive.Invoke(hArcData)
|
||||
End Function
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Function RARProcessFile(ByVal hArcData As IntPtr, ByVal Operation As Integer, ByVal DestPath As String, ByVal DestName As String) As Integer
|
||||
'End Function
|
||||
Private Delegate Function dRARProcessFile(ByVal hArcData As IntPtr, ByVal Operation As Integer, ByVal DestPath As String, ByVal DestName As String) As Integer
|
||||
Private Function RARProcessFile(ByVal hArcData As IntPtr, ByVal Operation As Integer, ByVal DestPath As String, ByVal DestName As String) As Integer
|
||||
Return _delRARProcessFile.Invoke(hArcData, Operation, DestPath, DestName)
|
||||
End Function
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Sub RARSetPassword(ByVal hArcData As IntPtr, ByVal Password As String)
|
||||
'End Sub
|
||||
Private Delegate Sub dRARSetPassword(ByVal hArcData As IntPtr, ByVal Password As String)
|
||||
Private Sub RARSetPassword(ByVal hArcData As IntPtr, ByVal Password As String)
|
||||
_delRARSetPassword.Invoke(hArcData, Password)
|
||||
End Sub
|
||||
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
' Private Shared Function RARGetDllVersion() As Integer
|
||||
'End Function
|
||||
Private Delegate Function dRARGetDllVersion() As Integer
|
||||
Private Function RARGetDllVersion() As Integer
|
||||
Return _delRARGetDllVersion.Invoke()
|
||||
End Function
|
||||
|
||||
'Public Delegate Function RARCallBack(ByVal msg As Integer, ByVal userdata As Integer, ByVal P1 As IntPtr, ByVal P2 As Integer) As Integer
|
||||
'<DllImport(MYLIB, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.StdCall)> _
|
||||
'Private Shared Sub RARSetCallback(ByVal hArcData As IntPtr, ByVal EP As RARCallBack, ByVal UserData As Long)
|
||||
'End Sub
|
||||
Public Delegate Function RARCallBack(ByVal msg As Integer, ByVal userdata As Integer, ByVal P1 As IntPtr, ByVal P2 As Integer) As Integer
|
||||
Public Delegate Sub dRARSetCallBack(ByVal hArcData As IntPtr, ByVal EP As RARCallBack, ByVal UserData As Long)
|
||||
Private Sub RARSetCallback(ByVal hArcData As IntPtr, ByVal EP As RARCallBack, ByVal UserData As Long)
|
||||
_delRARSetCallBack(hArcData, EP, UserData)
|
||||
End Sub
|
||||
|
||||
Public Structure RARHead
|
||||
Public ArcName As String
|
||||
Public ArcNameW As String
|
||||
Public CmtBuf As String
|
||||
Public CmtBufSize As Integer
|
||||
Public CmtSize As Integer
|
||||
Public CmtState As Integer
|
||||
End Structure
|
||||
|
||||
Public Structure RAREntry
|
||||
Public FileName As String
|
||||
Public FileNameW As String
|
||||
Public Flags As Integer
|
||||
Public PackSize As Long
|
||||
Public UnpSize As Long
|
||||
Public HostOS As Integer
|
||||
Public FileCRC As Integer
|
||||
Public FileTime As Integer
|
||||
Public UnpVer As Integer
|
||||
Public Method As Integer
|
||||
Public FileAttr As Integer
|
||||
End Structure
|
||||
|
||||
' Local Variables
|
||||
Private mDllVersion As Integer
|
||||
Private mRARFiles As Collection
|
||||
Private mheader As RARHead
|
||||
Private mRARFile As String
|
||||
Private mPassword As String
|
||||
Private mTotalArchiveSize As Long
|
||||
Private mTotalPackedSize As Long
|
||||
Private mRARHandle As IntPtr
|
||||
|
||||
'List of files in the archive
|
||||
ReadOnly Property RARFiles() As Collection
|
||||
Get
|
||||
Return mRARFiles
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Archive header
|
||||
ReadOnly Property RARHeader() As RARHead
|
||||
Get
|
||||
Return mheader
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Total Files
|
||||
ReadOnly Property RARTotalFiles() As Integer
|
||||
Get
|
||||
Return mRARFiles.Count
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'Total File Size
|
||||
ReadOnly Property TotalArchiveSize() As Long
|
||||
Get
|
||||
Return mTotalArchiveSize
|
||||
End Get
|
||||
End Property
|
||||
|
||||
|
||||
Private uRAREx As RAROpenArchiveDataEx
|
||||
Private uHeaderEx As RARHeaderDataEx
|
||||
|
||||
Public Sub New(ByVal RARFile As String)
|
||||
mRARFile = RARFile
|
||||
Init()
|
||||
End Sub
|
||||
|
||||
Public Sub New(ByVal RARFile As String, ByVal Password As String)
|
||||
mRARFile = RARFile
|
||||
mPassword = Password
|
||||
Init()
|
||||
End Sub
|
||||
|
||||
Public Function UnPack(ByVal fName As String, ByVal fDest As String) As Boolean
|
||||
Dim sz(0) As String
|
||||
sz(0) = fName
|
||||
Return ExtractFile(sz, fDest)
|
||||
End Function
|
||||
|
||||
Public Function UnPack(ByVal fName As String(), ByVal fDest As String) As Boolean
|
||||
Return ExtractFile(fName, fDest)
|
||||
End Function
|
||||
|
||||
Public Function UnPackAll(ByVal fDest As String) As Boolean
|
||||
Return ExtractAll(fDest)
|
||||
End Function
|
||||
|
||||
Public Function TestArchive(ByVal fName As String) As Boolean
|
||||
Dim sz(0) As String
|
||||
sz(0) = fName
|
||||
Return TestFile(sz)
|
||||
End Function
|
||||
|
||||
Public Function TestArchive(ByVal fName As String()) As Boolean
|
||||
Return TestFile(fName)
|
||||
End Function
|
||||
|
||||
Public Function TestAll() As Boolean
|
||||
Return TestAllFiles()
|
||||
End Function
|
||||
|
||||
Private Sub Init()
|
||||
|
||||
'mdm 06/01/2010
|
||||
' Load the appropriate version of unrar.dll the routine
|
||||
' will throw an exception if it's not found
|
||||
Try
|
||||
LoadLibrary()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message)
|
||||
mDllVersion = -1 'indicate error
|
||||
End Try
|
||||
|
||||
Try
|
||||
mDllVersion = RARGetDllVersion()
|
||||
Catch ex As Exception
|
||||
mDllVersion = -1 'most likely entry point not found
|
||||
End Try
|
||||
|
||||
uRAREx.CmtBuf = Space(16384)
|
||||
uRAREx.CmtBufSize = 16384
|
||||
uRAREx.ArcName = mRARFile
|
||||
|
||||
uHeaderEx.CmtBuf = Space(16384)
|
||||
|
||||
mRARFiles = New Collection
|
||||
LoadFileList()
|
||||
mTotalArchiveSize = 0
|
||||
For Each r As RAREntry In mRARFiles
|
||||
mTotalArchiveSize += r.UnpSize
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LoadFileList()
|
||||
|
||||
Dim iStatus As Integer
|
||||
Dim Ret As Integer
|
||||
|
||||
uRAREx.OpenMode = RAR_OM_LIST
|
||||
|
||||
mRARHandle = RAROpenArchiveEx(uRAREx)
|
||||
If uRAREx.OpenResult <> 0 Then OpenError(uRAREx.OpenResult, mRARFile)
|
||||
If mPassword <> "" Then RARSetPassword(mRARHandle, mPassword)
|
||||
Dim hr As New RARCallBack(AddressOf RARCB)
|
||||
Call RARSetCallback(mRARHandle, hr, 0)
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
mheader.ArcName = uHeaderEx.ArcName
|
||||
mheader.ArcNameW = Encoding.Unicode.GetString(uHeaderEx.ArcNameW)
|
||||
mheader.CmtBuf = uRAREx.CmtBuf
|
||||
mheader.CmtBufSize = uRAREx.CmtBufSize
|
||||
mheader.CmtSize = uRAREx.CmtSize
|
||||
mheader.CmtState = uRAREx.CmtState
|
||||
|
||||
Do Until iStatus <> 0
|
||||
Dim RARE As RAREntry = FormatFileEntry()
|
||||
mRARFiles.Add(RARE)
|
||||
Ret = RARProcessFile(mRARHandle, RAR_SKIP, "", "")
|
||||
If Ret <> 0 Then ProcessError(Ret)
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
Loop
|
||||
RARCloseArchive(mRARHandle)
|
||||
GC.KeepAlive(hr)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function FormatFileEntry() As RAREntry
|
||||
Dim RARE As RAREntry
|
||||
RARE.FileName = uHeaderEx.FileName
|
||||
RARE.FileNameW = Encoding.Unicode.GetString(uHeaderEx.FileNameW)
|
||||
RARE.Flags = uHeaderEx.Flags
|
||||
RARE.PackSize = MakeLong(uHeaderEx.PackSize, uHeaderEx.PackSizeHigh)
|
||||
RARE.UnpSize = MakeLong(uHeaderEx.UnpSize, uHeaderEx.UnpSizeHigh)
|
||||
RARE.HostOS = uHeaderEx.HostOS
|
||||
RARE.FileCRC = uHeaderEx.FileCRC
|
||||
RARE.FileTime = uHeaderEx.FileTime
|
||||
RARE.UnpVer = uHeaderEx.UnpVer
|
||||
RARE.Method = uHeaderEx.Method
|
||||
RARE.FileAttr = uHeaderEx.FileAttr
|
||||
Return RARE
|
||||
|
||||
End Function
|
||||
|
||||
Private Function MakeLong(ByVal iLow As Integer, ByVal iHigh As Integer) As Long
|
||||
Return IIf(iLow >= 0, iLow, iLow + 4294967296) + (CLng(iHigh) << 32)
|
||||
End Function
|
||||
|
||||
Private Function ExtractFile(ByVal szFile As String(), ByVal szDest As String) As Boolean
|
||||
Return ProcessFile(szFile, szDest, RAR_EXTRACT)
|
||||
End Function
|
||||
|
||||
Private Function TestFile(ByVal szFile As String()) As Boolean
|
||||
Return ProcessFile(szFile, "", RAR_TEST)
|
||||
End Function
|
||||
|
||||
Private Function ProcessFile(ByVal szFile As String(), ByVal szDest As String, ByVal RARMode As Integer) As Boolean
|
||||
Dim iStatus As Integer
|
||||
Dim Ret As Integer
|
||||
|
||||
uRAREx.OpenMode = RAR_OM_EXTRACT
|
||||
|
||||
mRARHandle = RAROpenArchiveEx(uRAREx)
|
||||
If uRAREx.OpenResult <> 0 Then OpenError(uRAREx.OpenResult, mRARFile)
|
||||
If mPassword <> "" Then RARSetPassword(mRARHandle, mPassword)
|
||||
Dim hr As New RARCallBack(AddressOf RARCB)
|
||||
Call RARSetCallback(mRARHandle, hr, 0)
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
Dim UnpackCount As Integer = 0
|
||||
Do Until iStatus <> 0 Or UnpackCount = szFile.Length
|
||||
Do
|
||||
For i As Integer = 0 To szFile.Length - 1
|
||||
If uHeaderEx.FileName.Trim = szFile(i) Then
|
||||
Dim RARE As RAREntry = FormatFileEntry()
|
||||
fTotalSize = RARE.UnpSize
|
||||
fUnpackedSize = 0
|
||||
Ret = RARProcessFile(mRARHandle, RARMode, szDest, "")
|
||||
If Ret <> 0 Then ProcessError(Ret)
|
||||
UnpackCount += 1
|
||||
RaiseEvent OnUnpack(RARE) 'Signal file has been unpacked
|
||||
Exit Do
|
||||
End If
|
||||
Next
|
||||
Ret = RARProcessFile(mRARHandle, RAR_SKIP, "", "")
|
||||
If Ret <> 0 Then ProcessError(Ret)
|
||||
Exit Do
|
||||
Loop
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
Loop
|
||||
RARCloseArchive(mRARHandle)
|
||||
GC.KeepAlive(hr)
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
Private Function ExtractAll(ByVal szDest As String) As Boolean
|
||||
Return ProcessAll(szDest, RAR_EXTRACT)
|
||||
End Function
|
||||
|
||||
Private Function TestAllFiles() As Boolean
|
||||
Return ProcessAll("", RAR_TEST)
|
||||
End Function
|
||||
|
||||
Private Function ProcessAll(ByVal szDest As String, ByVal RARMMode As Integer) As Boolean
|
||||
Dim iStatus As Integer
|
||||
Dim Ret As Integer
|
||||
|
||||
uRAREx.OpenMode = RAR_OM_EXTRACT
|
||||
mRARHandle = RAROpenArchiveEx(uRAREx)
|
||||
If uRAREx.OpenResult <> 0 Then OpenError(uRAREx.OpenResult, mRARFile)
|
||||
If mPassword <> "" Then RARSetPassword(mRARHandle, mPassword)
|
||||
Dim hr As New RARCallBack(AddressOf RARCB)
|
||||
Call RARSetCallback(mRARHandle, hr, 0)
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
Do Until iStatus <> 0
|
||||
Dim RARE As RAREntry = FormatFileEntry()
|
||||
fTotalSize = RARE.UnpSize
|
||||
fUnpackedSize = 0
|
||||
Ret = RARProcessFile(mRARHandle, RAR_EXTRACT, szDest, "")
|
||||
If Ret <> 0 Then ProcessError(Ret)
|
||||
RaiseEvent OnUnpack(RARE) 'Signal file has been unpacked
|
||||
iStatus = RARReadHeaderEx(mRARHandle, uHeaderEx)
|
||||
Loop
|
||||
RARCloseArchive(mRARHandle)
|
||||
GC.KeepAlive(hr)
|
||||
Return True
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub OpenArc(ByRef mH As IntPtr, ByRef h As RAROpenArchiveDataEx)
|
||||
'
|
||||
' Open the archive and establish the callback
|
||||
mH = RAROpenArchiveEx(h)
|
||||
If uRAREx.OpenResult <> 0 Then OpenError(h.OpenResult, mRARFile)
|
||||
If mPassword <> "" Then RARSetPassword(mH, mPassword)
|
||||
Dim hr As New RARCallBack(AddressOf RARCB)
|
||||
GC.KeepAlive(hr)
|
||||
Call RARSetCallback(mH, hr, 0)
|
||||
End Sub
|
||||
|
||||
Shared fUnpackedSize As Long 'Total Bytes Unpacked so Far for current File
|
||||
Shared fTotalSize As Long 'Total File Size
|
||||
|
||||
Public Shared Function RARCB(ByVal msg As Integer, ByVal userdata As Integer, ByVal P1 As IntPtr, ByVal P2 As Integer) As Integer
|
||||
|
||||
Select Case msg
|
||||
Case UCM_CHANGEVOLUME
|
||||
Select Case P2
|
||||
Case RAR_VOL_ASK
|
||||
'need a new volume - for production use, add a dialog to allow new drive
|
||||
'name and pass it back as a null-terminated string in address pointed at
|
||||
'by P1 (See Password example below)
|
||||
Dim szVol As String = Marshal.PtrToStringAnsi(P1)
|
||||
If MsgBox("Load Volume: " & szVol, MsgBoxStyle.OkCancel, "UnRAR") <> MsgBoxResult.Ok Then Return -1
|
||||
Return +1 '
|
||||
Case RAR_VOL_NOTIFY
|
||||
Return +1
|
||||
End Select
|
||||
|
||||
Case UCM_PROCESSDATA
|
||||
'I can peek at data here or make a progress bar
|
||||
Dim Disposition As RarDisposition = RarDisposition.OP_CONTINUE
|
||||
fUnpackedSize += P2
|
||||
RaiseEvent Unpacking(fTotalSize, fUnpackedSize, Disposition)
|
||||
Select Case Disposition
|
||||
Case RarDisposition.OP_CANCEL
|
||||
Return -1
|
||||
Case Else
|
||||
Return +1
|
||||
End Select
|
||||
Case UCM_NEEDPASSWORD
|
||||
'I need a password
|
||||
Dim f As New pwDlg
|
||||
f.ShowDialog()
|
||||
Dim pwB As Byte() = Encoding.ASCII.GetBytes(f.pw & Chr(0))
|
||||
P2 = f.pw.Length
|
||||
f.Close()
|
||||
Marshal.Copy(pwB, 0, P1, pwB.Length)
|
||||
Return +1 '??
|
||||
Case Else
|
||||
MsgBox("Oops!!, I don't know what I doing here")
|
||||
End Select
|
||||
|
||||
End Function
|
||||
|
||||
Private Sub OpenError(ByVal ErroNum As RarErrors, ByVal ArcName As String)
|
||||
Dim szMsg As String = ""
|
||||
Select Case ErroNum
|
||||
Case RarErrors.ERAR_NO_MEMORY
|
||||
szMsg = "Not enough memory"
|
||||
Case RarErrors.ERAR_EOPEN
|
||||
szMsg = "Cannot open " & ArcName
|
||||
Case RarErrors.ERAR_BAD_ARCHIVE
|
||||
szMsg = ArcName & " is not RAR archive"
|
||||
Case RarErrors.ERAR_BAD_DATA
|
||||
szMsg = ArcName & ": archive header broken"
|
||||
End Select
|
||||
RaiseError(ErroNum, szMsg)
|
||||
End Sub
|
||||
|
||||
Private Sub ProcessError(ByVal ErroNum As RarErrors)
|
||||
Dim szMsg As String
|
||||
Select Case ErroNum
|
||||
Case RarErrors.ERAR_UNKNOWN_FORMAT
|
||||
szMsg = "Unknown archive format"
|
||||
Case RarErrors.ERAR_BAD_ARCHIVE
|
||||
szMsg = "Bad volume"
|
||||
Case RarErrors.ERAR_ECREATE
|
||||
szMsg = "File create error"
|
||||
Case RarErrors.ERAR_EOPEN
|
||||
szMsg = "Volume open error"
|
||||
Case RarErrors.ERAR_ECLOSE
|
||||
szMsg = "File close error"
|
||||
Case RarErrors.ERAR_EREAD
|
||||
szMsg = "Read error"
|
||||
Case RarErrors.ERAR_EWRITE
|
||||
szMsg = "Write error"
|
||||
Case RarErrors.ERAR_BAD_DATA
|
||||
szMsg = "CRC error" 'looks like bad password comes here as well
|
||||
Case RarErrors.ERAR_CANCELLED
|
||||
szMsg = "Extract Cancelled"
|
||||
Case Else
|
||||
szMsg = "Error " & ErroNum
|
||||
End Select
|
||||
RaiseError(ErroNum, szMsg)
|
||||
End Sub
|
||||
|
||||
Private Sub RaiseError(ByVal errnum As Integer, ByVal msg As String)
|
||||
Try
|
||||
'RARCloseArchive(mRARHandle)
|
||||
Catch ex As Exception
|
||||
'just in case
|
||||
End Try
|
||||
Err.Raise(errnum + vbObjectError, , msg)
|
||||
End Sub
|
||||
|
||||
'mdm 06/01/2010
|
||||
' This routine will dynamically load unrar.dll or unrar64.dll
|
||||
' depending on the OS
|
||||
Private Sub LoadLibrary()
|
||||
|
||||
Dim szLibrary As String = "unrar.dll"
|
||||
If System.Runtime.InteropServices.Marshal.SizeOf(New IntPtr) = 8 Then szLibrary = "unrar64.dll"
|
||||
|
||||
Dim pUnrar As IntPtr
|
||||
pUnrar = LoadLibraryEx(szLibrary, IntPtr.Zero, 0)
|
||||
If pUnrar = IntPtr.Zero Then
|
||||
Dim errorCode As Integer = Marshal.GetLastWin32Error()
|
||||
Throw New ApplicationException(String.Format("DLL Load error: {0}, error - {1}", szLibrary, errorCode))
|
||||
End If
|
||||
|
||||
' Let's load all the vectors at one time.
|
||||
' This routine assumes all routines are available in unrar. If
|
||||
' you're using a really old version or if names change in a future
|
||||
' version, we'll add a test to insure we have a compatible version
|
||||
' of unrar.
|
||||
Dim pAddr As IntPtr
|
||||
|
||||
pAddr = GetProcAddress(pUnrar, "RARReadHeader")
|
||||
_delRARReadHeader = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARReadHeader)), dRARReadHeader)
|
||||
pAddr = GetProcAddress(pUnrar, "RARReadHeaderEx")
|
||||
_delRARReadHeaderEx = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARReadHeaderEx)), dRARReadHeaderEx)
|
||||
pAddr = GetProcAddress(pUnrar, "RAROpenArchive")
|
||||
_delRAROpenArchive = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRAROpenArchive)), dRAROpenArchive)
|
||||
pAddr = GetProcAddress(pUnrar, "RAROpenArchiveEx")
|
||||
_delRAROpenArchiveEx = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRAROpenArchiveEx)), dRAROpenArchiveEx)
|
||||
pAddr = GetProcAddress(pUnrar, "RARCloseArchive")
|
||||
_delRARCloseArchive = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARCloseArchive)), dRARCloseArchive)
|
||||
pAddr = GetProcAddress(pUnrar, "RARProcessFile")
|
||||
_delRARProcessFile = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARProcessFile)), dRARProcessFile)
|
||||
pAddr = GetProcAddress(pUnrar, "RARSetPassword")
|
||||
_delRARSetPassword = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARSetPassword)), dRARSetPassword)
|
||||
pAddr = GetProcAddress(pUnrar, "RARGetDllVersion")
|
||||
_delRARGetDllVersion = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARGetDllVersion)), dRARGetDllVersion)
|
||||
pAddr = GetProcAddress(pUnrar, "RARSetCallback")
|
||||
_delRARSetCallBack = DirectCast(Marshal.GetDelegateForFunctionPointer(pAddr, GetType(dRARSetCallBack)), dRARSetCallBack)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
120
unrar/Examples/VB.NET/unRARNET/UnRARNET.vbproj
Normal file
120
unrar/Examples/VB.NET/unRARNET/UnRARNET.vbproj
Normal file
@@ -0,0 +1,120 @@
|
||||
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7B86181F-5232-473D-BAFE-477F0DA1DD52}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>UnRARNET</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<RootNamespace>RARNET</RootNamespace>
|
||||
<StartupObject>RARNET.%28None%29</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<MyType>Windows</MyType>
|
||||
<OldToolsVersion>0.0</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>UnRARNET.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>UnRARNET.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Decompressor.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="pwDlg.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="pwDlg.resx">
|
||||
<DependentUpon>pwDlg.vb</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
58
unrar/Examples/VB.NET/unRARNET/UnRARNET.vbproj.user
Normal file
58
unrar/Examples/VB.NET/unRARNET/UnRARNET.vbproj.user
Normal file
@@ -0,0 +1,58 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastOpenVersion>7.10.3077</LastOpenVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>
|
||||
</ReferencePath>
|
||||
<CopyProjectDestinationFolder>
|
||||
</CopyProjectDestinationFolder>
|
||||
<CopyProjectUncPath>
|
||||
</CopyProjectUncPath>
|
||||
<CopyProjectOption>0</CopyProjectOption>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>true</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>true</StartWithIE>
|
||||
</PropertyGroup>
|
||||
</Project>
|
157
unrar/Examples/VB.NET/unRARNET/pwDlg.resx
Normal file
157
unrar/Examples/VB.NET/unRARNET/pwDlg.resx
Normal file
@@ -0,0 +1,157 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="Label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="Label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="Label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="txtPW.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="txtPW.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="txtPW.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnOK.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnOK.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnOK.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>pwDlg</value>
|
||||
</data>
|
||||
</root>
|
87
unrar/Examples/VB.NET/unRARNET/pwDlg.vb
Normal file
87
unrar/Examples/VB.NET/unRARNET/pwDlg.vb
Normal file
@@ -0,0 +1,87 @@
|
||||
Public Class pwDlg
|
||||
Inherits System.Windows.Forms.Form
|
||||
|
||||
#Region " Windows Form Designer generated code "
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Windows Form Designer.
|
||||
InitializeComponent()
|
||||
|
||||
'Add any initialization after the InitializeComponent() call
|
||||
|
||||
End Sub
|
||||
|
||||
'Form overrides dispose to clean up the component list.
|
||||
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing Then
|
||||
If Not (components Is Nothing) Then
|
||||
components.Dispose()
|
||||
End If
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
'Required by the Windows Form Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Windows Form Designer
|
||||
'It can be modified using the Windows Form Designer.
|
||||
'Do not modify it using the code editor.
|
||||
Friend WithEvents Label1 As System.Windows.Forms.Label
|
||||
Friend WithEvents txtPW As System.Windows.Forms.TextBox
|
||||
Friend WithEvents btnOK As System.Windows.Forms.Button
|
||||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||||
Me.Label1 = New System.Windows.Forms.Label
|
||||
Me.txtPW = New System.Windows.Forms.TextBox
|
||||
Me.btnOK = New System.Windows.Forms.Button
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Label1
|
||||
'
|
||||
Me.Label1.Location = New System.Drawing.Point(16, 24)
|
||||
Me.Label1.Name = "Label1"
|
||||
Me.Label1.Size = New System.Drawing.Size(64, 16)
|
||||
Me.Label1.TabIndex = 0
|
||||
Me.Label1.Text = "Password:"
|
||||
'
|
||||
'txtPW
|
||||
'
|
||||
Me.txtPW.Location = New System.Drawing.Point(72, 24)
|
||||
Me.txtPW.Name = "txtPW"
|
||||
Me.txtPW.PasswordChar = Microsoft.VisualBasic.ChrW(42)
|
||||
Me.txtPW.Size = New System.Drawing.Size(160, 20)
|
||||
Me.txtPW.TabIndex = 1
|
||||
Me.txtPW.Text = ""
|
||||
'
|
||||
'btnOK
|
||||
'
|
||||
Me.btnOK.Location = New System.Drawing.Point(192, 56)
|
||||
Me.btnOK.Name = "btnOK"
|
||||
Me.btnOK.Size = New System.Drawing.Size(40, 24)
|
||||
Me.btnOK.TabIndex = 2
|
||||
Me.btnOK.Text = "OK"
|
||||
'
|
||||
'pwDlg
|
||||
'
|
||||
Me.AcceptButton = Me.btnOK
|
||||
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
||||
Me.ClientSize = New System.Drawing.Size(242, 88)
|
||||
Me.Controls.Add(Me.btnOK)
|
||||
Me.Controls.Add(Me.txtPW)
|
||||
Me.Controls.Add(Me.Label1)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
|
||||
Me.Name = "pwDlg"
|
||||
Me.Text = "Enter Password"
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
Public pw As String
|
||||
Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
|
||||
pw = Me.txtPW.Text
|
||||
Me.Hide()
|
||||
End Sub
|
||||
End Class
|
242
unrar/Examples/VBasic Sample 1/Form1.frm
Normal file
242
unrar/Examples/VBasic Sample 1/Form1.frm
Normal file
@@ -0,0 +1,242 @@
|
||||
VERSION 5.00
|
||||
Begin VB.Form Form1
|
||||
BorderStyle = 3 'Fixed Dialog
|
||||
Caption = "UnRAR.dll Visual Basic Example"
|
||||
ClientHeight = 5325
|
||||
ClientLeft = 45
|
||||
ClientTop = 345
|
||||
ClientWidth = 6990
|
||||
ControlBox = 0 'False
|
||||
LinkTopic = "Form1"
|
||||
MaxButton = 0 'False
|
||||
MinButton = 0 'False
|
||||
ScaleHeight = 5325
|
||||
ScaleWidth = 6990
|
||||
StartUpPosition = 2 'CenterScreen
|
||||
Begin VB.CommandButton Command5
|
||||
Cancel = -1 'True
|
||||
Caption = "&Exit"
|
||||
Default = -1 'True
|
||||
Enabled = 0 'False
|
||||
Height = 375
|
||||
Left = 120
|
||||
TabIndex = 1
|
||||
Top = 4920
|
||||
Width = 6735
|
||||
End
|
||||
Begin VB.ListBox List1
|
||||
Height = 4740
|
||||
Left = 120
|
||||
TabIndex = 0
|
||||
Top = 120
|
||||
Width = 6735
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "Form1"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
'******************************************************************
|
||||
'
|
||||
' Ported to Visual Basic by Pedro Lamas
|
||||
'
|
||||
'E-mail: sniper@hotpop.com
|
||||
'HomePage (dedicated to VB): www.terravista.pt/portosanto/3723/
|
||||
'
|
||||
'******************************************************************
|
||||
|
||||
Const ERAR_END_ARCHIVE = 10
|
||||
Const ERAR_NO_MEMORY = 11
|
||||
Const ERAR_BAD_DATA = 12
|
||||
Const ERAR_BAD_ARCHIVE = 13
|
||||
Const ERAR_UNKNOWN_FORMAT = 14
|
||||
Const ERAR_EOPEN = 15
|
||||
Const ERAR_ECREATE = 16
|
||||
Const ERAR_ECLOSE = 17
|
||||
Const ERAR_EREAD = 18
|
||||
Const ERAR_EWRITE = 19
|
||||
Const ERAR_SMALL_BUF = 20
|
||||
|
||||
Const RAR_OM_LIST = 0
|
||||
Const RAR_OM_EXTRACT = 1
|
||||
|
||||
Const RAR_SKIP = 0
|
||||
Const RAR_TEST = 1
|
||||
Const RAR_EXTRACT = 2
|
||||
|
||||
Const RAR_VOL_ASK = 0
|
||||
Const RAR_VOL_NOTIFY = 1
|
||||
|
||||
Enum RarOperations
|
||||
OP_EXTRACT = 0
|
||||
OP_TEST = 1
|
||||
OP_LIST = 2
|
||||
End Enum
|
||||
|
||||
Private Type RARHeaderData
|
||||
ArcName As String * 260
|
||||
FileName As String * 260
|
||||
Flags As Long
|
||||
PackSize As Long
|
||||
UnpSize As Long
|
||||
HostOS As Long
|
||||
FileCRC As Long
|
||||
FileTime As Long
|
||||
UnpVer As Long
|
||||
Method As Long
|
||||
FileAttr As Long
|
||||
CmtBuf As String
|
||||
CmtBufSize As Long
|
||||
CmtSize As Long
|
||||
CmtState As Long
|
||||
End Type
|
||||
|
||||
Private Type RAROpenArchiveData
|
||||
ArcName As String
|
||||
OpenMode As Long
|
||||
OpenResult As Long
|
||||
CmtBuf As String
|
||||
CmtBufSize As Long
|
||||
CmtSize As Long
|
||||
CmtState As Long
|
||||
End Type
|
||||
|
||||
Private Declare Function RAROpenArchive Lib "unrar.dll" (ByRef ArchiveData As RAROpenArchiveData) As Long
|
||||
Private Declare Function RARCloseArchive Lib "unrar.dll" (ByVal hArcData As Long) As Long
|
||||
Private Declare Function RARReadHeader Lib "unrar.dll" (ByVal hArcData As Long, ByRef HeaderData As RARHeaderData) As Long
|
||||
Private Declare Function RARProcessFile Lib "unrar.dll" (ByVal hArcData As Long, ByVal Operation As Long, ByVal DestPath As String, ByVal DestName As String) As Long
|
||||
Private Declare Sub RARSetChangeVolProc Lib "unrar.dll" (ByVal hArcData As Long, ByVal Mode As Long)
|
||||
Private Declare Sub RARSetPassword Lib "unrar.dll" (ByVal hArcData As Long, ByVal Password As String)
|
||||
|
||||
Private Sub Command5_Click()
|
||||
End
|
||||
End Sub
|
||||
|
||||
Private Sub RARExecute(Mode As RarOperations, RarFile As String, Optional Password As String)
|
||||
' Description:-
|
||||
' Extract file(s) from RAR archive.
|
||||
' Parameters:-
|
||||
' Mode = Operation to perform on RAR Archive
|
||||
' RARFile = RAR Archive filename
|
||||
' sPassword = Password (Optional)
|
||||
Dim lHandle As Long
|
||||
Dim iStatus As Integer
|
||||
Dim uRAR As RAROpenArchiveData
|
||||
Dim uHeader As RARHeaderData
|
||||
Dim sStat As String, Ret As Long
|
||||
|
||||
uRAR.ArcName = RarFile
|
||||
uRAR.CmtBuf = Space(16384)
|
||||
uRAR.CmtBufSize = 16384
|
||||
|
||||
If Mode = OP_LIST Then
|
||||
uRAR.OpenMode = RAR_OM_LIST
|
||||
Else
|
||||
uRAR.OpenMode = RAR_OM_EXTRACT
|
||||
End If
|
||||
|
||||
lHandle = RAROpenArchive(uRAR)
|
||||
If uRAR.OpenResult <> 0 Then OpenError uRAR.OpenResult, RarFile
|
||||
|
||||
If Password <> "" Then RARSetPassword lHandle, Password
|
||||
|
||||
If (uRAR.CmtState = 1) Then MsgBox uRAR.CmtBuf, vbApplicationModal + vbInformation, "Comment"
|
||||
|
||||
iStatus = RARReadHeader(lHandle, uHeader)
|
||||
Show
|
||||
Do Until iStatus <> 0
|
||||
sStat = Left(uHeader.FileName, InStr(1, uHeader.FileName, vbNullChar) - 1)
|
||||
Select Case Mode
|
||||
Case RarOperations.OP_EXTRACT
|
||||
List1.AddItem "Extracting " & sStat
|
||||
Ret = RARProcessFile(lHandle, RAR_EXTRACT, "", uHeader.FileName)
|
||||
Case RarOperations.OP_TEST
|
||||
List1.AddItem "Testing " & sStat
|
||||
Ret = RARProcessFile(lHandle, RAR_TEST, "", uHeader.FileName)
|
||||
Case RarOperations.OP_LIST
|
||||
List1.AddItem "File: " & sStat & vbTab & vbTab & vbTab & "Size: " & uHeader.UnpSize
|
||||
Ret = RARProcessFile(lHandle, RAR_SKIP, "", "")
|
||||
End Select
|
||||
|
||||
If Ret = 0 Then
|
||||
List1.List(List1.ListCount - 1) = List1.List(List1.ListCount - 1) & vbTab & vbTab & "OK"
|
||||
Else
|
||||
ProcessError Ret
|
||||
End If
|
||||
|
||||
iStatus = RARReadHeader(lHandle, uHeader)
|
||||
Refresh
|
||||
Loop
|
||||
|
||||
If iStatus = ERAR_BAD_DATA Then Erro ("File header broken")
|
||||
|
||||
RARCloseArchive lHandle
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Load()
|
||||
Dim Vals() As String, Msg As String
|
||||
If Command = "" Then
|
||||
Msg = "VBUNRAR.EXE. This is a simple example of UNRAR.DLL usage" & vbCrLf & vbCrLf
|
||||
Msg = Msg & "Syntax:" & vbCrLf
|
||||
Msg = Msg & "VBUNRAR X <Archive> <Password> extract archive contents" & vbCrLf
|
||||
Msg = Msg & "VBUNRAR T <Archive> <Password> test archive contents" & vbCrLf
|
||||
Msg = Msg & "VBUNRAR L <Archive> <Password> view archive contents"
|
||||
MsgBox Msg, vbApplicationModal + vbInformation, "VBUnRAR"
|
||||
End
|
||||
End If
|
||||
Vals = Split(Command, " ")
|
||||
|
||||
ReDim Preserve Vals(2)
|
||||
If Vals(0) = "" Or Vals(1) = "" Then Erro ("Missing arguments!")
|
||||
Select Case UCase(Vals(0))
|
||||
Case "X"
|
||||
RARExecute OP_EXTRACT, Vals(1), Vals(2)
|
||||
Case "T"
|
||||
RARExecute OP_TEST, Vals(1), Vals(2)
|
||||
Case "L"
|
||||
RARExecute OP_LIST, Vals(1), Vals(2)
|
||||
Case Else
|
||||
Erro "Invalid Arguments!"
|
||||
End Select
|
||||
Command5.Enabled = True
|
||||
End Sub
|
||||
|
||||
Private Sub OpenError(ErroNum As Long, ArcName As String)
|
||||
Select Case ErroNum
|
||||
Case ERAR_NO_MEMORY
|
||||
Erro "Not enough memory"
|
||||
Case ERAR_EOPEN:
|
||||
Erro "Cannot open " & ArcName
|
||||
Case ERAR_BAD_ARCHIVE:
|
||||
Erro ArcName & " is not RAR archive"
|
||||
Case ERAR_BAD_DATA:
|
||||
Erro ArcName & ": archive header broken"
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub ProcessError(ErroNum As Long)
|
||||
Select Case ErroNum
|
||||
Case ERAR_UNKNOWN_FORMAT
|
||||
Erro "Unknown archive format"
|
||||
Case ERAR_BAD_ARCHIVE:
|
||||
Erro "Bad volume"
|
||||
Case ERAR_ECREATE:
|
||||
Erro "File create error"
|
||||
Case ERAR_EOPEN:
|
||||
Erro "Volume open error"
|
||||
Case ERAR_ECLOSE:
|
||||
Erro "File close error"
|
||||
Case ERAR_EREAD:
|
||||
Erro "Read error"
|
||||
Case ERAR_EWRITE:
|
||||
Erro "Write error"
|
||||
Case ERAR_BAD_DATA:
|
||||
Erro "CRC error"
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
Private Sub Erro(Msg As String)
|
||||
MsgBox Msg, vbApplicationModal + vbExclamation, "Error"
|
||||
End
|
||||
End Sub
|
36
unrar/Examples/VBasic Sample 1/VBUnRAR.vbp
Normal file
36
unrar/Examples/VBasic Sample 1/VBUnRAR.vbp
Normal file
@@ -0,0 +1,36 @@
|
||||
Type=Exe
|
||||
Form=Form1.frm
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\SYSTEM\Stdole2.tlb#OLE Automation
|
||||
IconForm="Form1"
|
||||
Startup="Form1"
|
||||
HelpFile=""
|
||||
Title="UnRAR.dll Visual Basic Example"
|
||||
ExeName32="VBUnRAR.exe"
|
||||
Command32="x c:\lamas\ascii.rar 0"
|
||||
Name="Project1"
|
||||
HelpContextID="0"
|
||||
Description="UnRAR.dll Visual Basic Example"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionComments="Ported to Visual Basic by Pedro Lamas E-mail: sniper@hotpop.com "
|
||||
VersionFileDescription="UnRAR.dll Visual Basic Example"
|
||||
VersionProductName="UnRAR.dll Visual Basic Example"
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
1
unrar/Examples/VBasic Sample 1/VBUnRAR.vbw
Normal file
1
unrar/Examples/VBasic Sample 1/VBUnRAR.vbw
Normal file
@@ -0,0 +1 @@
|
||||
Form1 = 44, 44, 417, 388, C, 22, 22, 395, 366, C
|
321
unrar/Examples/VBasic Sample 2/CTKUnrar.cls
Normal file
321
unrar/Examples/VBasic Sample 2/CTKUnrar.cls
Normal file
@@ -0,0 +1,321 @@
|
||||
VERSION 1.0 CLASS
|
||||
BEGIN
|
||||
MultiUse = -1 'True
|
||||
Persistable = 0 'NotPersistable
|
||||
DataBindingBehavior = 0 'vbNone
|
||||
DataSourceBehavior = 0 'vbNone
|
||||
MTSTransactionMode = 0 'NotAnMTSObject
|
||||
END
|
||||
Attribute VB_Name = "CTKUnrar"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = True
|
||||
Attribute VB_PredeclaredId = False
|
||||
Attribute VB_Exposed = True
|
||||
Option Explicit
|
||||
|
||||
'// ADDED
|
||||
'// Converts strings from Unicode to OEM encoding to make sure
|
||||
'// certain characters in paths are handled properly by RARProcessFile
|
||||
Private Declare Sub CharToOem Lib "user32" Alias "CharToOemA" _
|
||||
(ByVal StrFrom As String, ByVal StrTo As String)
|
||||
|
||||
'// ADDED
|
||||
'// For use by LongToUnsigned
|
||||
Private Const OFFSET_4 = 4294967296#
|
||||
|
||||
Event OpenError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Event ProcessError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Event CommentError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Event CommentFound(strFilename As String, strComment As String)
|
||||
Event ProcessingFile(strFilename As String, dblFileSize As Double, datFileTime As Date, intMajorVer As Integer, intMinorVer As Integer, lngPackingMethod As Long, lngFileAttr As Long)
|
||||
Event NextVolumne(strFilename As String, ByRef blnContinue As Boolean)
|
||||
Event MissingFile(strFilename As String, ByRef strNewFilename As String)
|
||||
Event MissingPassword(ByRef strNewPassword As String)
|
||||
Event Progress(dblFileSize As Double, dblExtracted As Double)
|
||||
|
||||
' Private variables
|
||||
Private m_dblLastFileSize As Double
|
||||
Private m_dblLastFileUnpacked As Double
|
||||
Private m_intLastPercentStep As Integer
|
||||
Private m_blnPasswordProtected As Boolean
|
||||
' Properties
|
||||
Private m_intProgressSteps As Integer
|
||||
Private m_strLastErrorMsg As String
|
||||
|
||||
Public Function LongToUnsigned(Value As Long) As Double
|
||||
'// ADDED
|
||||
'// This functions makes sure the unsigned integers
|
||||
'// that unrar.dll returns are handled properly as
|
||||
'// VB does not support unsigned integers natively
|
||||
'// See KB article 189323 for more info
|
||||
'// http://support.microsoft.com/?kbid=189323
|
||||
'
|
||||
'The function takes an unsigned Long from an API and
|
||||
'converts it to a Double for display or arithmetic purposes
|
||||
'
|
||||
If Value < 0 Then
|
||||
LongToUnsigned = Value + OFFSET_4
|
||||
Else
|
||||
LongToUnsigned = Value
|
||||
End If
|
||||
'
|
||||
End Function
|
||||
Private Sub Class_Initialize()
|
||||
m_intProgressSteps = 4
|
||||
m_strLastErrorMsg = ""
|
||||
m_blnPasswordProtected = False
|
||||
End Sub
|
||||
|
||||
Private Sub Class_Terminate()
|
||||
'
|
||||
End Sub
|
||||
|
||||
Public Function ListRarFiles(strRarFile As String, arrstrFilenames() As String, Optional strPassword As String = "") As Boolean
|
||||
ListRarFiles = HandleRarFiles(strRarFile, OP_LIST, arrstrFilenames, , strPassword)
|
||||
End Function
|
||||
|
||||
Public Function TestRarFiles(strRarFile As String, Optional strPassword As String = "") As Boolean
|
||||
TestRarFiles = HandleRarFiles(strRarFile, OP_TEST, , , strPassword)
|
||||
End Function
|
||||
|
||||
Public Function ExtractRarFiles(strRarFile As String, strDestPath As String, Optional strPassword As String = "") As Boolean
|
||||
ExtractRarFiles = HandleRarFiles(strRarFile, OP_EXTRACT, , strDestPath, strPassword)
|
||||
End Function
|
||||
|
||||
Private Function HandleRarFiles(strRarFile As String, opMode As RarOperations, Optional arrstrFilenames As Variant, Optional strDestPath As String = "", Optional strPassword As String = "") As Boolean
|
||||
Dim uRAR As RAROpenArchiveData
|
||||
Dim uHeaderEx As RARHeaderDataEx
|
||||
Dim lngRarHandle As Long
|
||||
Dim intStatus As Integer
|
||||
Dim intReturn As Integer
|
||||
Dim strCurrentFilename As String
|
||||
Dim strLastFilename As String
|
||||
Dim lngpFilenames As Long
|
||||
Dim strTmp As String
|
||||
|
||||
HandleRarFiles = False
|
||||
|
||||
'// ADDED
|
||||
'// See API declaration
|
||||
CharToOem strDestPath, strDestPath
|
||||
|
||||
' Fill the rar header structure
|
||||
uRAR.ArcName = strRarFile
|
||||
uRAR.CmtBuf = Space(16384)
|
||||
uRAR.CmtBufSize = 16384
|
||||
If opMode = OP_LIST Then
|
||||
uRAR.OpenMode = RAR_OM_LIST
|
||||
ElseIf opMode = OP_TEST Or opMode = OP_EXTRACT Then
|
||||
uRAR.OpenMode = RAR_OM_EXTRACT
|
||||
Else
|
||||
RaiseEvent ProcessError(ERAR_UNKNOWN_ERROR, "Unknown extracion mode", strRarFile)
|
||||
m_strLastErrorMsg = "Unknown extracion mode"
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
If opMode = OP_LIST Then
|
||||
lngpFilenames = 0
|
||||
If UBound(arrstrFilenames) = 0 Then
|
||||
RaiseEvent ProcessError(ERAR_DEST_ARR_TO_SMALL, "Supplied array to small to fit all files", strCurrentFilename)
|
||||
m_strLastErrorMsg = "Supplied array to small to fit all files"
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
|
||||
' Open the archive
|
||||
lngRarHandle = RAROpenArchive(uRAR)
|
||||
If uRAR.OpenResult <> 0 Then
|
||||
' Something went wrong
|
||||
Call OpenError(uRAR.OpenResult, strRarFile)
|
||||
Else
|
||||
' Set the callback
|
||||
Call RARSetCallback(lngRarHandle, AddressOf MyCallBack, ObjPtr(Me))
|
||||
' If the user supplied a password, set it
|
||||
If Len(strPassword) > 0 Then
|
||||
Call RARSetPassword(lngRarHandle, strPassword)
|
||||
m_blnPasswordProtected = True
|
||||
End If
|
||||
If uRAR.CmtState = 0 Then
|
||||
' No comment
|
||||
ElseIf uRAR.CmtState = 1 Then
|
||||
' Comment
|
||||
RaiseEvent CommentFound(strRarFile, uRAR.CmtBuf)
|
||||
Else
|
||||
Call CommentError(uRAR.CmtState, strRarFile)
|
||||
End If
|
||||
|
||||
strLastFilename = ""
|
||||
m_dblLastFileSize = 0
|
||||
m_dblLastFileUnpacked = 0
|
||||
m_intLastPercentStep = 0
|
||||
' Start processing the files
|
||||
intStatus = RARReadHeaderEx(lngRarHandle, uHeaderEx)
|
||||
strTmp = Left(uHeaderEx.ArcName, InStr(1, uHeaderEx.ArcName, vbNullChar) - 1)
|
||||
Call NextVolume(strTmp)
|
||||
Do Until intStatus <> 0
|
||||
' Get the current filename
|
||||
strCurrentFilename = Left(uHeaderEx.FileName, InStr(1, uHeaderEx.FileName, vbNullChar) - 1)
|
||||
|
||||
'// ADDED
|
||||
'// Makes sure unsigned ints are handled properly
|
||||
'// see function LongToUnsigned for more info
|
||||
UnpSizeHighEx = LongToUnsigned(uHeaderEx.UnpSizeHigh)
|
||||
UnpSizeEx = LongToUnsigned(uHeaderEx.UnpSize)
|
||||
|
||||
If strLastFilename <> strCurrentFilename Then
|
||||
m_dblLastFileSize = MakeDouble(uHeaderEx.UnpSizeHigh, uHeaderEx.UnpSize)
|
||||
m_dblLastFileUnpacked = 0
|
||||
m_intLastPercentStep = 0
|
||||
RaiseEvent ProcessingFile(strCurrentFilename, m_dblLastFileSize, Now(), uHeaderEx.UnpVer / 10, uHeaderEx.UnpVer Mod 10, uHeaderEx.Method, uHeaderEx.FileAttr)
|
||||
strLastFilename = strCurrentFilename
|
||||
If opMode = OP_LIST Then
|
||||
If lngpFilenames > UBound(arrstrFilenames) Then
|
||||
RaiseEvent ProcessError(ERAR_DEST_ARR_TO_SMALL, "Supplied array to small to fit all files", strCurrentFilename)
|
||||
m_strLastErrorMsg = "Supplied array to small to fit all files"
|
||||
HandleRarFiles = False
|
||||
Exit Do
|
||||
End If
|
||||
arrstrFilenames(lngpFilenames) = strCurrentFilename
|
||||
lngpFilenames = lngpFilenames + 1
|
||||
End If
|
||||
End If
|
||||
intReturn = ERAR_UNKNOWN_ERROR
|
||||
If opMode = OP_LIST Then
|
||||
intReturn = RARProcessFile(lngRarHandle, RAR_SKIP, "", "")
|
||||
ElseIf opMode = OP_TEST Then
|
||||
intReturn = RARProcessFile(lngRarHandle, RAR_TEST, "", "")
|
||||
ElseIf opMode = OP_EXTRACT Then
|
||||
intReturn = RARProcessFile(lngRarHandle, RAR_EXTRACT, strDestPath, "")
|
||||
End If
|
||||
If intReturn = 0 Then
|
||||
HandleRarFiles = True
|
||||
Else
|
||||
' Handle error and quit
|
||||
Call ProcessError(CLng(intReturn), strCurrentFilename)
|
||||
HandleRarFiles = False
|
||||
Exit Do
|
||||
End If
|
||||
' Handle next file
|
||||
intStatus = RARReadHeaderEx(lngRarHandle, uHeaderEx)
|
||||
Loop
|
||||
' RaiseEvent Progress(m_dblLastFileUnpacked, m_dblLastFileUnpacked)
|
||||
Call RARCloseArchive(lngRarHandle)
|
||||
End If
|
||||
End Function
|
||||
|
||||
Friend Sub ProcessingLength(lngBufferSize As Long)
|
||||
' Keep control of how much data we have extracted
|
||||
m_dblLastFileUnpacked = m_dblLastFileUnpacked + lngBufferSize
|
||||
If m_dblLastFileSize <> 0 Then
|
||||
' Send an event to the listener whenever we reach the next progress step (0%, x%, 2x%, 3x% etc)
|
||||
If CInt(m_dblLastFileUnpacked / m_dblLastFileSize * 100) > m_intLastPercentStep + m_intProgressSteps Then
|
||||
RaiseEvent Progress(m_dblLastFileSize, m_dblLastFileUnpacked)
|
||||
' Keep track of last percentage step
|
||||
m_intLastPercentStep = m_intLastPercentStep + m_intProgressSteps
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Friend Function NextVolume(strFilename As String) As Boolean
|
||||
Dim blnContinue As Boolean
|
||||
|
||||
RaiseEvent NextVolumne(strFilename, blnContinue)
|
||||
NextVolume = blnContinue
|
||||
End Function
|
||||
|
||||
Friend Function FindMissingFile(strFilename As String) As String
|
||||
Dim strNewFile As String
|
||||
|
||||
RaiseEvent MissingFile(strFilename, strNewFile)
|
||||
FindMissingFile = strNewFile
|
||||
End Function
|
||||
|
||||
Friend Function MissingPassword() As String
|
||||
Dim strNewPassword As String
|
||||
|
||||
m_blnPasswordProtected = True
|
||||
RaiseEvent MissingPassword(strNewPassword)
|
||||
MissingPassword = strNewPassword
|
||||
End Function
|
||||
|
||||
Private Sub CommentError(lngErrorNum As Long, strRarName As String)
|
||||
Dim strErrorMsg As String
|
||||
|
||||
Select Case lngErrorNum
|
||||
Case ERAR_NO_MEMORY
|
||||
strErrorMsg = "Not enough memory"
|
||||
Case ERAR_BAD_DATA:
|
||||
strErrorMsg = "Broken comment"
|
||||
Case ERAR_UNKNOWN_FORMAT:
|
||||
strErrorMsg = "Unknown comment format"
|
||||
Case ERAR_SMALL_BUF:
|
||||
strErrorMsg = "Buffer too small, comments not completely read"
|
||||
Case Else
|
||||
strErrorMsg = "Unknown error"
|
||||
End Select
|
||||
m_strLastErrorMsg = strErrorMsg
|
||||
RaiseEvent CommentError(lngErrorNum, strErrorMsg, strRarName)
|
||||
End Sub
|
||||
|
||||
Private Sub OpenError(lngErrorNum As Long, strRarName As String)
|
||||
Dim strErrorMsg As String
|
||||
|
||||
Select Case lngErrorNum
|
||||
Case ERAR_NO_MEMORY
|
||||
strErrorMsg = "Not enough memory"
|
||||
Case ERAR_EOPEN:
|
||||
strErrorMsg = "Cannot open file"
|
||||
Case ERAR_BAD_ARCHIVE:
|
||||
strErrorMsg = "File is not RAR archive"
|
||||
Case ERAR_BAD_DATA:
|
||||
strErrorMsg = "Archive header broken"
|
||||
Case Else
|
||||
strErrorMsg = "Unknown error"
|
||||
End Select
|
||||
m_strLastErrorMsg = strErrorMsg
|
||||
RaiseEvent OpenError(lngErrorNum, strErrorMsg, strRarName)
|
||||
End Sub
|
||||
|
||||
Private Sub ProcessError(lngErrorNum As Long, strRarName As String)
|
||||
Dim strErrorMsg As String
|
||||
|
||||
Select Case lngErrorNum
|
||||
Case ERAR_UNKNOWN_FORMAT
|
||||
strErrorMsg = "Unknown archive format"
|
||||
Case ERAR_BAD_ARCHIVE:
|
||||
strErrorMsg = "Bad volume"
|
||||
Case ERAR_ECREATE:
|
||||
strErrorMsg = "File create error"
|
||||
Case ERAR_EOPEN:
|
||||
strErrorMsg = "Volume open error"
|
||||
Case ERAR_ECLOSE:
|
||||
strErrorMsg = "File close error"
|
||||
Case ERAR_EREAD:
|
||||
strErrorMsg = "Read error"
|
||||
Case ERAR_EWRITE:
|
||||
strErrorMsg = "Write error"
|
||||
Case ERAR_BAD_DATA:
|
||||
If m_blnPasswordProtected Then
|
||||
strErrorMsg = "CRC error - Wrong password?"
|
||||
Else
|
||||
strErrorMsg = "CRC error"
|
||||
End If
|
||||
Case Else
|
||||
strErrorMsg = "Unknown error"
|
||||
End Select
|
||||
m_strLastErrorMsg = strErrorMsg
|
||||
RaiseEvent ProcessError(lngErrorNum, strErrorMsg, strRarName)
|
||||
End Sub
|
||||
|
||||
' The intProgressSteps property
|
||||
Property Get intProgressSteps() As Integer
|
||||
intProgressSteps = m_intProgressSteps
|
||||
End Property
|
||||
Property Let intProgressSteps(ByVal newValue As Integer)
|
||||
m_intProgressSteps = newValue
|
||||
End Property
|
||||
|
||||
' The strLastErrorMsg property
|
||||
Property Get strLastErrorMsg() As String
|
||||
strLastErrorMsg = m_strLastErrorMsg
|
||||
End Property
|
3
unrar/Examples/VBasic Sample 2/Group1.vbg
Normal file
3
unrar/Examples/VBasic Sample 2/Group1.vbg
Normal file
@@ -0,0 +1,3 @@
|
||||
VBGROUP 5.0
|
||||
Project=TKUnrar.vbp
|
||||
StartupProject=demo\Project1.vbp
|
277
unrar/Examples/VBasic Sample 2/MTKUnrar.bas
Normal file
277
unrar/Examples/VBasic Sample 2/MTKUnrar.bas
Normal file
@@ -0,0 +1,277 @@
|
||||
Attribute VB_Name = "MTKUnrar"
|
||||
Option Explicit
|
||||
|
||||
Const RAR_DLL_VERSION As Integer = 2
|
||||
Const RAR_CONTINUE As Integer = 1
|
||||
Const RAR_ABORT As Integer = -1
|
||||
|
||||
Public Enum ERAR
|
||||
ERAR_END_ARCHIVE = 10
|
||||
ERAR_NO_MEMORY
|
||||
ERAR_BAD_DATA
|
||||
ERAR_BAD_ARCHIVE
|
||||
ERAR_UNKNOWN_FORMAT
|
||||
ERAR_EOPEN
|
||||
ERAR_ECREATE
|
||||
ERAR_ECLOSE
|
||||
ERAR_EREAD
|
||||
ERAR_EWRITE
|
||||
ERAR_SMALL_BUF
|
||||
' Private error definitions
|
||||
ERAR_DEST_ARR_TO_SMALL = 5000
|
||||
ERAR_UNKNOWN_DESTINATION
|
||||
ERAR_UNKNOWN_ERROR
|
||||
End Enum
|
||||
|
||||
Public Enum RAR_OM
|
||||
RAR_OM_LIST = 0
|
||||
RAR_OM_EXTRACT
|
||||
End Enum
|
||||
|
||||
Public Enum RAR
|
||||
RAR_SKIP = 0
|
||||
RAR_TEST
|
||||
RAR_EXTRACT
|
||||
End Enum
|
||||
|
||||
Public Enum UCM
|
||||
UCM_CHANGEVOLUME = 0
|
||||
UCM_PROCESSDATA
|
||||
UCM_NEEDPASSWORD
|
||||
End Enum
|
||||
|
||||
Public Enum RAR_VOL
|
||||
RAR_VOL_ASK = 0
|
||||
RAR_VOL_NOTIFY
|
||||
End Enum
|
||||
|
||||
Public Enum RarOperations
|
||||
OP_EXTRACT = 0
|
||||
OP_TEST
|
||||
OP_LIST
|
||||
End Enum
|
||||
|
||||
Public Type RARHeaderData
|
||||
ArcName As String * 260
|
||||
FileName As String * 260
|
||||
flags As Long
|
||||
PackSize As Long
|
||||
UnpSize As Long
|
||||
HostOS As Long
|
||||
FileCRC As Long
|
||||
FileTime As Long
|
||||
UnpVer As Long
|
||||
Method As Long
|
||||
FileAttr As Long
|
||||
CmtBuf As String
|
||||
CmtBufSize As Long
|
||||
CmtSize As Long
|
||||
CmtState As Long
|
||||
End Type
|
||||
|
||||
Public Type RARHeaderDataEx
|
||||
ArcName As String * 1024
|
||||
ArcNameW As String * 2048
|
||||
FileName As String * 1024
|
||||
FileNameW As String * 2048
|
||||
flags As Long
|
||||
PackSize As Long
|
||||
PackSizeHigh As Long
|
||||
UnpSize As Long
|
||||
UnpSizeHigh As Long
|
||||
HostOS As Long
|
||||
FileCRC As Long
|
||||
FileTime As Long
|
||||
UnpVer As Long
|
||||
Method As Long
|
||||
FileAttr As Long
|
||||
CmtBuf As String
|
||||
CmtBufSize As Long
|
||||
CmtSize As Long
|
||||
CmtState As Long
|
||||
Reserved(1024) As Integer
|
||||
End Type
|
||||
|
||||
Public Type RAROpenArchiveData
|
||||
ArcName As String
|
||||
OpenMode As Long
|
||||
OpenResult As Long
|
||||
CmtBuf As String
|
||||
CmtBufSize As Long
|
||||
CmtSize As Long
|
||||
CmtState As Long
|
||||
End Type
|
||||
|
||||
Public Declare Function RAROpenArchive Lib "unrar.dll" (ByRef ArchiveData As RAROpenArchiveData) As Long
|
||||
Public Declare Function RARCloseArchive Lib "unrar.dll" (ByVal hArcData As Long) As Long
|
||||
Public Declare Function RARReadHeader Lib "unrar.dll" (ByVal hArcData As Long, ByRef HeaderData As RARHeaderData) As Long
|
||||
Public Declare Function RARReadHeaderEx Lib "unrar.dll" (ByVal hArcData As Long, ByRef HeaderData As RARHeaderDataEx) As Long
|
||||
Public Declare Function RARProcessFile Lib "unrar.dll" (ByVal hArcData As Long, ByVal Operation As Long, ByVal DestPath As String, ByVal DestName As String) As Long
|
||||
Public Declare Sub RARSetCallback Lib "unrar.dll" (ByVal hArcData As Long, ByVal CallbackProc As Long, ByVal UserData As Long)
|
||||
Public Declare Sub RARSetPassword Lib "unrar.dll" (ByVal hArcData As Long, ByVal Password As String)
|
||||
Public Declare Function RARGetDllVersion Lib "unrar.dll" () As Long
|
||||
|
||||
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (lpDest As Any, lpSource As Any, ByVal cBytes As Long)
|
||||
Private Declare Function lstrlenW Lib "kernel32" (ByVal lpString As Long) As Long
|
||||
Private Declare Function lstrlenA Lib "kernel32" (ByVal lpString As Long) As Long
|
||||
'
|
||||
|
||||
Public Function MakeDouble(ByVal HiWord As Long, ByVal LoWord As Long) As Double
|
||||
MakeDouble = CDbl(LoWord) + CDbl(HiWord) * 4294967296#
|
||||
End Function
|
||||
|
||||
Public Function MyCallBack(ByVal msg As Long, ByVal UserData As Long, ByVal P1 As Long, ByVal P2 As Long) As Integer
|
||||
Dim strPassword As String
|
||||
Dim strNewVolume As String
|
||||
|
||||
If msg = UCM_CHANGEVOLUME Then
|
||||
If P2 = RAR_VOL_ASK Then
|
||||
strNewVolume = CallFunctionFromUserdata(UserData).FindMissingFile(PointerToStringA(P1)) & Chr(0)
|
||||
If Len(strNewVolume) > 1 Then
|
||||
CopyMemory ByVal P1, ByVal StrPtr(StrConv(strNewVolume, vbFromUnicode)), Len(strNewVolume)
|
||||
MyCallBack = RAR_CONTINUE
|
||||
Else
|
||||
MyCallBack = RAR_ABORT
|
||||
End If
|
||||
ElseIf P2 = RAR_VOL_NOTIFY Then
|
||||
If CallFunctionFromUserdata(UserData).NextVolume(PointerToStringA(P1)) Then
|
||||
MyCallBack = RAR_CONTINUE
|
||||
Else
|
||||
MyCallBack = RAR_ABORT
|
||||
End If
|
||||
End If
|
||||
|
||||
ElseIf msg = UCM_PROCESSDATA Then
|
||||
Call CallFunctionFromUserdata(UserData).ProcessingLength(P2)
|
||||
' Debug.Print "Size of data = " & P2
|
||||
' Debug.Print HexDump(P1, P2)
|
||||
MyCallBack = RAR_CONTINUE
|
||||
|
||||
ElseIf msg = UCM_NEEDPASSWORD Then
|
||||
strPassword = CallFunctionFromUserdata(UserData).MissingPassword() & Chr(0)
|
||||
If Len(strPassword) = 1 Then
|
||||
' If the user supplies an empty password, we have to generate a fake one, else we
|
||||
' won't receieve a CRC error message from RARProcessFile. Bug?
|
||||
strPassword = "CTKUnrar" & Now() & Chr(0)
|
||||
End If
|
||||
CopyMemory ByVal P1, ByVal StrPtr(StrConv(strPassword, vbFromUnicode)), IIf(Len(strPassword) > P2, P2, Len(strPassword))
|
||||
Else
|
||||
Debug.Print "Unknown msg"
|
||||
End If
|
||||
End Function
|
||||
|
||||
' resolve the passed object pointer into an object reference.
|
||||
' DO NOT PRESS THE "STOP" BUTTON WHILE IN THIS PROCEDURE!
|
||||
Private Function CallFunctionFromUserdata(ByVal UserData As Long) As CTKUnrar
|
||||
Dim CwdEx As CTKUnrar
|
||||
|
||||
CopyMemory CwdEx, UserData, 4&
|
||||
Set CallFunctionFromUserdata = CwdEx
|
||||
CopyMemory CwdEx, 0&, 4&
|
||||
End Function
|
||||
|
||||
Public Function PointerToStringW(ByVal lpString As Long) As String
|
||||
Dim sText As String
|
||||
Dim lLength As Long
|
||||
|
||||
If lpString Then
|
||||
lLength = lstrlenW(lpString)
|
||||
If lLength Then
|
||||
sText = Space$(lLength)
|
||||
CopyMemory ByVal StrPtr(sText), ByVal lpString, lLength * 2
|
||||
End If
|
||||
End If
|
||||
PointerToStringW = sText
|
||||
End Function
|
||||
|
||||
Public Function IsUnicode(s As String) As Boolean
|
||||
IsUnicode = Not (Len(s) = LenB(s))
|
||||
End Function
|
||||
|
||||
Public Function PointerToStringA(lpStringA As Long) As String
|
||||
Dim Buffer() As Byte
|
||||
Dim nLen As Long
|
||||
|
||||
If lpStringA Then
|
||||
nLen = lstrlenA(ByVal lpStringA)
|
||||
If nLen Then
|
||||
ReDim Buffer(0 To (nLen - 1)) As Byte
|
||||
CopyMemory Buffer(0), ByVal lpStringA, nLen
|
||||
PointerToStringA = StrConv(Buffer, vbUnicode)
|
||||
End If
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function PointerToDWord(ByVal lpDWord As Long) As Long
|
||||
Dim nRet As Long
|
||||
If lpDWord Then
|
||||
CopyMemory nRet, ByVal lpDWord, 4
|
||||
PointerToDWord = nRet
|
||||
End If
|
||||
End Function
|
||||
|
||||
Private Function HexDump(ByVal lpBuffer As Long, ByVal nBytes As Long) As String
|
||||
Dim i As Long, j As Long
|
||||
Dim ba() As Byte
|
||||
Dim sRet As String
|
||||
Dim dBytes As Long
|
||||
|
||||
' Size recieving buffer as requested,
|
||||
' then sling memory block to buffer.
|
||||
ReDim ba(0 To nBytes - 1) As Byte
|
||||
Call CopyMemory(ba(0), ByVal lpBuffer, nBytes)
|
||||
sRet = String(81, "=") & vbCrLf & _
|
||||
"lpBuffer = &h" & Hex$(lpBuffer) & _
|
||||
" nBytes = " & nBytes
|
||||
|
||||
' Buffer may well not be even multiple of 16.
|
||||
' If not, we need to round up.
|
||||
If nBytes Mod 16 = 0 Then
|
||||
dBytes = nBytes
|
||||
Else
|
||||
dBytes = ((nBytes \ 16) + 1) * 16
|
||||
End If
|
||||
|
||||
' Loop through buffer, displaying 16 bytes per
|
||||
' row. Preface with offset, trail with ASCII.
|
||||
For i = 0 To (dBytes - 1)
|
||||
' Add address and offset from beginning
|
||||
' if at the start of new row.
|
||||
If (i Mod 16) = 0 Then
|
||||
sRet = sRet & vbCrLf & Right$("00000000" _
|
||||
& Hex$(lpBuffer + i), 8) & " " & _
|
||||
Right$("0000" & Hex$(i), 4) & " "
|
||||
End If
|
||||
|
||||
' Append this byte.
|
||||
If i < nBytes Then
|
||||
sRet = sRet & Right$("0" & Hex(ba(i)), 2)
|
||||
Else
|
||||
sRet = sRet & " "
|
||||
End If
|
||||
|
||||
' Special handling...
|
||||
If (i Mod 16) = 15 Then
|
||||
' Display last 16 characters in
|
||||
' ASCII if at end of row.
|
||||
sRet = sRet & " "
|
||||
For j = (i - 15) To i
|
||||
If j < nBytes Then
|
||||
If ba(j) >= 32 And ba(j) <= 126 Then
|
||||
sRet = sRet & Chr$(ba(j))
|
||||
Else
|
||||
sRet = sRet & "."
|
||||
End If
|
||||
End If
|
||||
Next j
|
||||
ElseIf (i Mod 8) = 7 Then
|
||||
' Insert hyphen between 8th and
|
||||
' 9th bytes of hex display.
|
||||
sRet = sRet & "-"
|
||||
Else
|
||||
' Insert space between other bytes.
|
||||
sRet = sRet & " "
|
||||
End If
|
||||
Next i
|
||||
HexDump = sRet & vbCrLf & String(81, "=") & vbCrLf
|
||||
End Function
|
39
unrar/Examples/VBasic Sample 2/TKUnrar.vbp
Normal file
39
unrar/Examples/VBasic Sample 2/TKUnrar.vbp
Normal file
@@ -0,0 +1,39 @@
|
||||
Type=OleDll
|
||||
Class=CTKUnrar; CTKUnrar.cls
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#D:\WINNT\System32\stdole2.tlb#OLE Automation
|
||||
Module=MTKUnrar; MTKUnrar.bas
|
||||
Startup="(None)"
|
||||
HelpFile=""
|
||||
ExeName32="TKUnrar.dll"
|
||||
Path32="..\..\MyProjects\TKUnrar"
|
||||
Command32=""
|
||||
Name="TKUnrar"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="1"
|
||||
CompatibleEXE32="..\..\MyProjects\TKUnrar\TKUnrar.dll"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionCompanyName="."
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=1
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
ThreadingModel=1
|
||||
DebugStartupOption=0
|
||||
|
||||
[MS Transaction Server]
|
||||
AutoRefresh=1
|
93
unrar/Examples/VBasic Sample 2/demo/Form1.frm
Normal file
93
unrar/Examples/VBasic Sample 2/demo/Form1.frm
Normal file
@@ -0,0 +1,93 @@
|
||||
VERSION 5.00
|
||||
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
|
||||
Begin VB.Form Form1
|
||||
Caption = "Form1"
|
||||
ClientHeight = 4110
|
||||
ClientLeft = 60
|
||||
ClientTop = 345
|
||||
ClientWidth = 11025
|
||||
LinkTopic = "Form1"
|
||||
ScaleHeight = 4110
|
||||
ScaleWidth = 11025
|
||||
StartUpPosition = 3 'Windows Default
|
||||
Begin VB.CommandButton Command1
|
||||
Caption = "Command1"
|
||||
Height = 615
|
||||
Left = 2640
|
||||
TabIndex = 1
|
||||
Top = 1200
|
||||
Width = 3135
|
||||
End
|
||||
Begin MSComctlLib.ProgressBar ProgressBar1
|
||||
Height = 495
|
||||
Left = 840
|
||||
TabIndex = 0
|
||||
Top = 2640
|
||||
Width = 9735
|
||||
_ExtentX = 17171
|
||||
_ExtentY = 873
|
||||
_Version = 393216
|
||||
Appearance = 1
|
||||
End
|
||||
End
|
||||
Attribute VB_Name = "Form1"
|
||||
Attribute VB_GlobalNameSpace = False
|
||||
Attribute VB_Creatable = False
|
||||
Attribute VB_PredeclaredId = True
|
||||
Attribute VB_Exposed = False
|
||||
Option Explicit
|
||||
|
||||
Dim WithEvents objTKUnrar As TKUnrar.CTKUnrar
|
||||
Attribute objTKUnrar.VB_VarHelpID = -1
|
||||
'
|
||||
|
||||
Private Sub Command1_Click()
|
||||
Debug.Print objTKUnrar.TestRarFiles("m:\test.rar")
|
||||
End Sub
|
||||
|
||||
Private Sub Form_Load()
|
||||
Dim arrstrFilenames(100) As String
|
||||
|
||||
Set objTKUnrar = New TKUnrar.CTKUnrar
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_CommentError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Debug.Print "CommentError: " & strFilename & " - " & strErrorMsg
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_MissingFile(strFilename As String, strNewFilename As String)
|
||||
Debug.Print "MissingFile: " & strFilename
|
||||
strNewFilename = ""
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_MissingPassword(strNewPassword As String)
|
||||
Debug.Print "MissingPassword"
|
||||
strNewPassword = ""
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_NextVolumne(strFilename As String, blnContinue As Boolean)
|
||||
Debug.Print "NextVolumne: " & strFilename
|
||||
blnContinue = True
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_OpenError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Debug.Print "OpenError: " & strFilename & " - " & strErrorMsg
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_ProcessError(lngErrorNo As Long, strErrorMsg As String, strFilename As String)
|
||||
Debug.Print "ProcessError: " & strFilename & " - " & strErrorMsg
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_CommentFound(strFilename As String, strComment As String)
|
||||
Debug.Print "CommentFound: " & strFilename & "-" & strComment
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_ProcessingFile(strFilename As String, dblFileSize As Double, datFileTime As Date, intMajorVer As Integer, intMinorVer As Integer, lngPackingMethod As Long, lngFileAttr As Long)
|
||||
Debug.Print "ProcessingFile: " & strFilename & " " & dblFileSize & " bytes"
|
||||
ProgressBar1.Value = 0
|
||||
End Sub
|
||||
|
||||
Private Sub objTKUnrar_Progress(dblFileSize As Double, dblExtracted As Double)
|
||||
Debug.Print dblFileSize, dblExtracted, dblExtracted / dblFileSize * 100
|
||||
ProgressBar1.Value = dblExtracted / dblFileSize * 100
|
||||
End Sub
|
34
unrar/Examples/VBasic Sample 2/demo/Project1.vbp
Normal file
34
unrar/Examples/VBasic Sample 2/demo/Project1.vbp
Normal file
@@ -0,0 +1,34 @@
|
||||
Type=Exe
|
||||
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#D:\WINNT\System32\stdole2.tlb#OLE Automation
|
||||
Reference=*\G{3BE86BA9-337C-4087-B2AC-4DD21A4547B2}#1.0#0#..\..\..\MyProjects\TKUnrar\TKUnrar.dll#
|
||||
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
|
||||
Form=Form1.frm
|
||||
Startup="Form1"
|
||||
Command32=""
|
||||
Name="Project1"
|
||||
HelpContextID="0"
|
||||
CompatibleMode="0"
|
||||
MajorVer=1
|
||||
MinorVer=0
|
||||
RevisionVer=0
|
||||
AutoIncrementVer=0
|
||||
ServerSupportFiles=0
|
||||
VersionCompanyName="."
|
||||
CompilationType=0
|
||||
OptimizationType=0
|
||||
FavorPentiumPro(tm)=0
|
||||
CodeViewDebugInfo=0
|
||||
NoAliasing=0
|
||||
BoundsCheck=0
|
||||
OverflowCheck=0
|
||||
FlPointCheck=0
|
||||
FDIVCheck=0
|
||||
UnroundedFP=0
|
||||
StartMode=0
|
||||
Unattended=0
|
||||
Retained=0
|
||||
ThreadPerObject=0
|
||||
MaxNumberOfThreads=1
|
||||
|
||||
[MS Transaction Server]
|
||||
AutoRefresh=1
|
1
unrar/Examples/VBasic Sample 2/demo/Project1.vbw
Normal file
1
unrar/Examples/VBasic Sample 2/demo/Project1.vbw
Normal file
@@ -0,0 +1 @@
|
||||
Form1 = 110, 110, 878, 754, Z, 88, 88, 856, 732, C
|
12
unrar/Examples/Virtual Pascal/UnRAR.def
Normal file
12
unrar/Examples/Virtual Pascal/UnRAR.def
Normal file
@@ -0,0 +1,12 @@
|
||||
IMPORTS
|
||||
RAROpenArchive = "unrar.dll".RAROpenArchive
|
||||
RAROpenArchiveEx = "unrar.dll".RAROpenArchiveEx
|
||||
RARCloseArchive = "unrar.dll".RARCloseArchive
|
||||
RARReadHeader = "unrar.dll".RARReadHeader
|
||||
RARReadHeaderEx = "unrar.dll".RARReadHeaderEx
|
||||
RARProcessFile = "unrar.dll".RARProcessFile
|
||||
RARProcessFileW = "unrar.dll".RARProcessFileW
|
||||
RARSetCallback = "unrar.dll".RARSetCallback
|
||||
RARSetPassword = "unrar.dll".RARSetPassword
|
||||
RARSetChangeVolProc = "unrar.dll".RARSetChangeVolProc
|
||||
RARSetProcessDataProc = "unrar.dll".RARSetProcessDataProc
|
154
unrar/Examples/Virtual Pascal/UnRAR.pas
Normal file
154
unrar/Examples/Virtual Pascal/UnRAR.pas
Normal file
@@ -0,0 +1,154 @@
|
||||
// Virtual Pascal interface unit for UnRAR.dll
|
||||
//
|
||||
// Ported to Virtual Pascal by Alexey Fayans, fidonet: 2:5030/1997, e-mail: shad@shad.pp.ru
|
||||
|
||||
{$IFDEF Open32}
|
||||
{&cdecl+}
|
||||
{$ELSE}
|
||||
{&StdCall+}
|
||||
{$ENDIF Open32}
|
||||
{&AlignRec+,SmartLink+,OrgName+,X+,Z+,Use32-}
|
||||
|
||||
unit UnRAR;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows;
|
||||
|
||||
const
|
||||
ERAR_END_ARCHIVE = 10;
|
||||
ERAR_NO_MEMORY = 11;
|
||||
ERAR_BAD_DATA = 12;
|
||||
ERAR_BAD_ARCHIVE = 13;
|
||||
ERAR_UNKNOWN_FORMAT = 14;
|
||||
ERAR_EOPEN = 15;
|
||||
ERAR_ECREATE = 16;
|
||||
ERAR_ECLOSE = 17;
|
||||
ERAR_EREAD = 18;
|
||||
ERAR_EWRITE = 19;
|
||||
ERAR_SMALL_BUF = 20;
|
||||
ERAR_UNKNOWN = 21;
|
||||
|
||||
RAR_OM_LIST = 0;
|
||||
RAR_OM_EXTRACT = 1;
|
||||
|
||||
RAR_SKIP = 0;
|
||||
RAR_TEST = 1;
|
||||
RAR_EXTRACT = 2;
|
||||
|
||||
RAR_VOL_ASK = 0;
|
||||
RAR_VOL_NOTIFY = 1;
|
||||
|
||||
RAR_DLL_VERSION = 3;
|
||||
|
||||
UCM_CHANGEVOLUME = 0;
|
||||
UCM_PROCESSDATA = 1;
|
||||
UCM_NEEDPASSWORD = 2;
|
||||
|
||||
type
|
||||
PRARHeaderData = ^TRARHeaderData;
|
||||
TRARHeaderData = packed record
|
||||
ArcName: packed array[0..259] of Char;
|
||||
FileName: packed array[0..259] 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;
|
||||
|
||||
PRARHeaderDataEx = ^TRARHeaderDataEx;
|
||||
TRARHeaderDataEx = packed record
|
||||
ArcName: packed array [0..1023] of Char;
|
||||
ArcNameW: packed array [0..2047] of Char;
|
||||
FileName: packed array [0..1023] of Char;
|
||||
FileNameW: packed array [0..2047] of Char;
|
||||
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;
|
||||
|
||||
PRAROpenArchiveData = ^TRAROpenArchiveData;
|
||||
TRAROpenArchiveData = packed record
|
||||
ArcName: PChar;
|
||||
OpenMode: UInt;
|
||||
OpenResult: UInt;
|
||||
CmtBuf: PChar;
|
||||
CmtBufSize: UInt;
|
||||
CmtSize: UInt;
|
||||
CmtState: UInt;
|
||||
end;
|
||||
|
||||
PRAROpenArchiveDataEx = ^TRAROpenArchiveDataEx;
|
||||
TRAROpenArchiveDataEx = 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: Longint): Int;
|
||||
|
||||
function RAROpenArchive(ArchiveData: PRAROpenArchiveData): THandle;
|
||||
function RAROpenArchiveEx(ArchiveData: PRAROpenArchiveDataEx): THandle;
|
||||
function RARCloseArchive(hArcData: THandle): Int;
|
||||
function RARReadHeader(hArcData: THandle; HeaderData: PRARHeaderData): Int;
|
||||
function RARReadHeaderEx(hArcData: THandle; HeaderData: PRARHeaderDataEx): Int;
|
||||
function RARProcessFile(hArcData: THandle; Operation: Int; DestPath, DestName: PChar): Int;
|
||||
function RARProcessFileW(hArcData: THandle; Operation: Int; DestPath, DestName: PWideChar): Int;
|
||||
procedure RARSetCallback(hArcData: THandle; UnrarCallback: TUnrarCallback; UserData: Longint);
|
||||
procedure RARSetPassword(hArcData: THandle; Password: PChar);
|
||||
|
||||
// obsolete functions
|
||||
type
|
||||
TChangeVolProc = function(ArcName: PChar; Mode: Int): Int;
|
||||
TProcessDataProc = function(Addr: PUChar; Size: Int): Int;
|
||||
|
||||
procedure RARSetChangeVolProc(hArcData: THandle; ChangeVolProc: TChangeVolProc);
|
||||
procedure RARSetProcessDataProc(hArcData: THandle; ProcessDataProc: TProcessDataProc);
|
||||
|
||||
implementation
|
||||
|
||||
{$L UnRAR.LIB}
|
||||
|
||||
function RAROpenArchive; external;
|
||||
function RAROpenArchiveEx; external;
|
||||
function RARCloseArchive; external;
|
||||
function RARReadHeader; external;
|
||||
function RARReadHeaderEx; external;
|
||||
function RARProcessFile; external;
|
||||
function RARProcessFileW; external;
|
||||
procedure RARSetCallback; external;
|
||||
procedure RARSetPassword; external;
|
||||
procedure RARSetChangeVolProc; external;
|
||||
procedure RARSetProcessDataProc; external;
|
||||
|
||||
end.
|
6
unrar/Examples/readme.txt
Normal file
6
unrar/Examples/readme.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
All samples except C sample (UnRDLL.c) are contributed by unrar.dll users.
|
||||
Many of them are obsolete and can be incompatible with latest unrar.dll API.
|
||||
|
||||
We at rarlab.com created and tested only UnRDLL.c sample.
|
||||
It is modified according to all API changes.
|
||||
|
10
unrar/NoCrypt/readme.txt
Normal file
10
unrar/NoCrypt/readme.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
This directory contains the version of unrar.dll built without
|
||||
decryption code, authenticity verification code and RARSetPassword
|
||||
function. It is intended for use in applictions where presence
|
||||
of encryption or decryption code is not allowed because of legal
|
||||
restrictions.
|
||||
|
||||
This DLL can be distinguished from usual unrar.dll by missing
|
||||
RARSetPassword exported function. It sends UCM_NEEDPASSWORD notification,
|
||||
but returns CRC error for encrypted files regardless of password
|
||||
provided by application.
|
18
unrar/license.txt
Normal file
18
unrar/license.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
The unrar.dll library is freeware. This means:
|
||||
|
||||
1. All copyrights to RAR and the unrar.dll are exclusively
|
||||
owned by the author - Alexander Roshal.
|
||||
|
||||
2. The unrar.dll library may be used in any software to handle
|
||||
RAR archives without limitations free of charge.
|
||||
|
||||
3. THE RAR ARCHIVER AND THE UNRAR.DLL LIBRARY ARE DISTRIBUTED "AS IS".
|
||||
NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED. YOU USE AT
|
||||
YOUR OWN RISK. THE AUTHOR WILL NOT BE LIABLE FOR DATA LOSS,
|
||||
DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING
|
||||
OR MISUSING THIS SOFTWARE.
|
||||
|
||||
Thank you for your interest in RAR and unrar.dll.
|
||||
|
||||
|
||||
Alexander L. Roshal
|
169
unrar/unrar.h
Normal file
169
unrar/unrar.h
Normal file
@@ -0,0 +1,169 @@
|
||||
#ifndef _UNRAR_DLL_
|
||||
#define _UNRAR_DLL_
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
#define ERAR_SUCCESS 0
|
||||
#define ERAR_END_ARCHIVE 10
|
||||
#define ERAR_NO_MEMORY 11
|
||||
#define ERAR_BAD_DATA 12
|
||||
#define ERAR_BAD_ARCHIVE 13
|
||||
#define ERAR_UNKNOWN_FORMAT 14
|
||||
#define ERAR_EOPEN 15
|
||||
#define ERAR_ECREATE 16
|
||||
#define ERAR_ECLOSE 17
|
||||
#define ERAR_EREAD 18
|
||||
#define ERAR_EWRITE 19
|
||||
#define ERAR_SMALL_BUF 20
|
||||
#define ERAR_UNKNOWN 21
|
||||
#define ERAR_MISSING_PASSWORD 22
|
||||
#define ERAR_EREFERENCE 23
|
||||
#define ERAR_BAD_PASSWORD 24
|
||||
|
||||
#define RAR_OM_LIST 0
|
||||
#define RAR_OM_EXTRACT 1
|
||||
#define RAR_OM_LIST_INCSPLIT 2
|
||||
|
||||
#define RAR_SKIP 0
|
||||
#define RAR_TEST 1
|
||||
#define RAR_EXTRACT 2
|
||||
|
||||
#define RAR_VOL_ASK 0
|
||||
#define RAR_VOL_NOTIFY 1
|
||||
|
||||
#define RAR_DLL_VERSION 7
|
||||
|
||||
#define RAR_HASH_NONE 0
|
||||
#define RAR_HASH_CRC32 1
|
||||
#define RAR_HASH_BLAKE2 2
|
||||
|
||||
|
||||
#ifdef _UNIX
|
||||
#define CALLBACK
|
||||
#define PASCAL
|
||||
#define LONG long
|
||||
#define HANDLE void *
|
||||
#define LPARAM long
|
||||
#define UINT unsigned int
|
||||
#endif
|
||||
|
||||
#define RHDF_SPLITBEFORE 0x01
|
||||
#define RHDF_SPLITAFTER 0x02
|
||||
#define RHDF_ENCRYPTED 0x04
|
||||
#define RHDF_SOLID 0x10
|
||||
#define RHDF_DIRECTORY 0x20
|
||||
|
||||
|
||||
struct RARHeaderData
|
||||
{
|
||||
char ArcName[260];
|
||||
char FileName[260];
|
||||
unsigned int Flags;
|
||||
unsigned int PackSize;
|
||||
unsigned int UnpSize;
|
||||
unsigned int HostOS;
|
||||
unsigned int FileCRC;
|
||||
unsigned int FileTime;
|
||||
unsigned int UnpVer;
|
||||
unsigned int Method;
|
||||
unsigned int FileAttr;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
};
|
||||
|
||||
|
||||
struct RARHeaderDataEx
|
||||
{
|
||||
char ArcName[1024];
|
||||
wchar_t ArcNameW[1024];
|
||||
char FileName[1024];
|
||||
wchar_t FileNameW[1024];
|
||||
unsigned int Flags;
|
||||
unsigned int PackSize;
|
||||
unsigned int PackSizeHigh;
|
||||
unsigned int UnpSize;
|
||||
unsigned int UnpSizeHigh;
|
||||
unsigned int HostOS;
|
||||
unsigned int FileCRC;
|
||||
unsigned int FileTime;
|
||||
unsigned int UnpVer;
|
||||
unsigned int Method;
|
||||
unsigned int FileAttr;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
unsigned int DictSize;
|
||||
unsigned int HashType;
|
||||
char Hash[32];
|
||||
unsigned int RedirType;
|
||||
wchar_t *RedirName;
|
||||
unsigned int RedirNameSize;
|
||||
unsigned int DirTarget;
|
||||
unsigned int Reserved[994];
|
||||
};
|
||||
|
||||
|
||||
struct RAROpenArchiveData
|
||||
{
|
||||
char *ArcName;
|
||||
unsigned int OpenMode;
|
||||
unsigned int OpenResult;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
};
|
||||
|
||||
typedef int (CALLBACK *UNRARCALLBACK)(UINT msg,LPARAM UserData,LPARAM P1,LPARAM P2);
|
||||
|
||||
struct RAROpenArchiveDataEx
|
||||
{
|
||||
char *ArcName;
|
||||
wchar_t *ArcNameW;
|
||||
unsigned int OpenMode;
|
||||
unsigned int OpenResult;
|
||||
char *CmtBuf;
|
||||
unsigned int CmtBufSize;
|
||||
unsigned int CmtSize;
|
||||
unsigned int CmtState;
|
||||
unsigned int Flags;
|
||||
UNRARCALLBACK Callback;
|
||||
LPARAM UserData;
|
||||
unsigned int Reserved[28];
|
||||
};
|
||||
|
||||
enum UNRARCALLBACK_MESSAGES {
|
||||
UCM_CHANGEVOLUME,UCM_PROCESSDATA,UCM_NEEDPASSWORD,UCM_CHANGEVOLUMEW,
|
||||
UCM_NEEDPASSWORDW
|
||||
};
|
||||
|
||||
typedef int (PASCAL *CHANGEVOLPROC)(char *ArcName,int Mode);
|
||||
typedef int (PASCAL *PROCESSDATAPROC)(unsigned char *Addr,int Size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
HANDLE PASCAL RAROpenArchive(struct RAROpenArchiveData *ArchiveData);
|
||||
HANDLE PASCAL RAROpenArchiveEx(struct RAROpenArchiveDataEx *ArchiveData);
|
||||
int PASCAL RARCloseArchive(HANDLE hArcData);
|
||||
int PASCAL RARReadHeader(HANDLE hArcData,struct RARHeaderData *HeaderData);
|
||||
int PASCAL RARReadHeaderEx(HANDLE hArcData,struct RARHeaderDataEx *HeaderData);
|
||||
int PASCAL RARProcessFile(HANDLE hArcData,int Operation,char *DestPath,char *DestName);
|
||||
int PASCAL RARProcessFileW(HANDLE hArcData,int Operation,wchar_t *DestPath,wchar_t *DestName);
|
||||
void PASCAL RARSetCallback(HANDLE hArcData,UNRARCALLBACK Callback,LPARAM UserData);
|
||||
void PASCAL RARSetChangeVolProc(HANDLE hArcData,CHANGEVOLPROC ChangeVolProc);
|
||||
void PASCAL RARSetProcessDataProc(HANDLE hArcData,PROCESSDATAPROC ProcessDataProc);
|
||||
void PASCAL RARSetPassword(HANDLE hArcData,char *Password);
|
||||
int PASCAL RARGetDllVersion();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma pack()
|
||||
|
||||
#endif
|
181
unrar/whatsnew.txt
Normal file
181
unrar/whatsnew.txt
Normal file
@@ -0,0 +1,181 @@
|
||||
List of unrar.dll API changes. We do not include performance and reliability
|
||||
improvements into this list, but this library and RAR/UnRAR tools share
|
||||
the same source code. So the latest version of unrar.dll usually contains
|
||||
same decompression algorithm changes as the latest UnRAR version.
|
||||
============================================================================
|
||||
|
||||
-- 6 July 2015
|
||||
|
||||
New RedirType, RedirName, RedirNameSize, DirTarget fields of RARHeaderDataEx
|
||||
structure provide information about file system redirection headers.
|
||||
|
||||
Please be sure to fill either the entire RARHeaderDataEx structure
|
||||
or at least its Reserved field with zeroes before passing to RARReadHeaderEx.
|
||||
|
||||
RAR_DLL_VERSION is incremented to 7.
|
||||
|
||||
|
||||
-- 5 November 2013
|
||||
|
||||
OpenResult field of RAROpenArchiveData and RAROpenArchiveDataEx
|
||||
structures can return the new ERAR_BAD_PASSWORD error code.
|
||||
This code can be returned only for archives with encrypted headers
|
||||
in RAR 5.0 format.
|
||||
|
||||
|
||||
-- 29 October 2013
|
||||
|
||||
RARProcessFile and RARProcessFileW can return the new ERAR_BAD_PASSWORD
|
||||
error code. This code can be returned only for archives in RAR 5.0 format.
|
||||
|
||||
|
||||
-- 10 September 2013
|
||||
|
||||
RARProcessFile and RARProcessFileW can return two additional error codes:
|
||||
ERAR_NO_MEMORY and ERAR_EREFERENCE. See appropriate help topics for details.
|
||||
|
||||
|
||||
-- 24 December 2012
|
||||
|
||||
1) Stricter requirements for return value of callback function.
|
||||
You need to return -1 to cancel the operation, 1 if you processed an event
|
||||
and want to continue and 0 for those events which you do not need to process
|
||||
or do not know how to process including unknown event types.
|
||||
|
||||
Earlier versions of documentation told about "zero or positive value" to
|
||||
continue, but it was too broad and did not allow unrar.dll to detect
|
||||
if application actually processed the event.
|
||||
|
||||
2) RARHeaderDataEx structure stores the compression dictionary size
|
||||
in kilobytes in DictSize field instead of Flags. RAR 5.0 dictionary
|
||||
maximum size is too big to fit into previously used Flags bits.
|
||||
|
||||
Old RARHeaderData structure does not provide the dictionary size at all.
|
||||
|
||||
3) RARHeaderDataEx structure contains new fields HashType and Hash fields,
|
||||
which can be used to detect the type of file checksum and obtain BLAKE2
|
||||
checksum for RAR_HASH_BLAKE2 HashType.
|
||||
|
||||
4) new RHDF_DIRECTORY (0x20) flag in RARHeaderData and RARHeaderDataEx
|
||||
structures indicates the directory entry.
|
||||
|
||||
|
||||
-- 26 April 2012
|
||||
|
||||
New callback events UCM_CHANGEVOLUMEW and UCM_NEEDPASSWORDW are added.
|
||||
You can use them to set Unicode name of next volume and Unicode password.
|
||||
|
||||
Also now it is recommended to return 0 in callback function for those event
|
||||
types which you do not process including unknown event types.
|
||||
|
||||
Minimum supported Windows version is Windows XP.
|
||||
|
||||
|
||||
-- 1 March 2011
|
||||
|
||||
Minimum supported Windows version is Windows 2000.
|
||||
|
||||
|
||||
-- 24 November 2010
|
||||
|
||||
Fields Callback and UserData are added to RAROpenArchiveDataEx structure.
|
||||
You can set them instead of calling RARSetCallback to define your callback
|
||||
function.
|
||||
|
||||
Using these two new fields, you can specify the callback function
|
||||
at the same time as opening an archive and not after that, as it was in case
|
||||
of RARSetCallback. It allows RAROpenArchiveEx to read the archive comment
|
||||
in archive with encrypted headers. It could not be done in case of
|
||||
RARSetCallback call, because a password was not available yet at the moment
|
||||
of reading the comment. So specifying the callback function
|
||||
in RAROpenArchiveDataEx is more preferable solution than RARSetCallback,
|
||||
though RARSetCallback is supported by library too.
|
||||
|
||||
Space for these two new structure members was taken from Reserved array.
|
||||
So it should not affect the compatibility provided that Reserved array
|
||||
in RAROpenArchiveDataEx was set to zero as suggested in documentation.
|
||||
|
||||
Added the information in user manual that Reserved array in RARHeaderDataEx
|
||||
structure must be filled with zeroes. While it is not important
|
||||
in the current unrar.dll version, it may become important in the future.
|
||||
|
||||
Value returned by RARGetDllVersion and RAR_DLL_VERSION in unrar.h
|
||||
are incremented to 5.
|
||||
|
||||
UnRAR.dll manual converted to HTML format and moved to Documentation folder.
|
||||
|
||||
|
||||
-- 18 January 2008
|
||||
|
||||
All LONG parameters of CallbackProc function were changed
|
||||
to LPARAM type for 64 bit mode compatibility.
|
||||
|
||||
|
||||
-- 12 December 2007
|
||||
|
||||
Added new RAR_OM_LIST_INCSPLIT open mode for function RAROpenArchive.
|
||||
|
||||
|
||||
-- 14 August 2007
|
||||
|
||||
Added NoCrypt\unrar_nocrypt.dll without decryption code for those
|
||||
applications where presence of encryption or decryption code is not
|
||||
allowed because of legal restrictions.
|
||||
|
||||
|
||||
-- 14 December 2006
|
||||
|
||||
Added ERAR_MISSING_PASSWORD error type. This error is returned
|
||||
if empty password is specified for encrypted file.
|
||||
|
||||
|
||||
-- 12 June 2003
|
||||
|
||||
Added RARProcessFileW function, Unicode version of RARProcessFile
|
||||
|
||||
|
||||
-- 9 August 2002
|
||||
|
||||
Added RAROpenArchiveEx function allowing to specify Unicode archive
|
||||
name and get archive flags.
|
||||
|
||||
|
||||
-- 24 January 2002
|
||||
|
||||
Added RARReadHeaderEx function allowing to read Unicode file names
|
||||
and 64 bit file sizes.
|
||||
|
||||
|
||||
-- 23 January 2002
|
||||
|
||||
Added ERAR_UNKNOWN error type (it is used for all errors which
|
||||
do not have special ERAR code yet) and UCM_NEEDPASSWORD callback
|
||||
message.
|
||||
|
||||
Unrar.dll automatically opens all next volumes not only when extracting,
|
||||
but also in RAR_OM_LIST mode.
|
||||
|
||||
|
||||
-- 27 November 2001
|
||||
|
||||
RARSetChangeVolProc and RARSetProcessDataProc are replaced by
|
||||
the single callback function installed with RARSetCallback.
|
||||
Unlike old style callbacks, the new function accepts the user defined
|
||||
parameter. Unrar.dll still supports RARSetChangeVolProc and
|
||||
RARSetProcessDataProc for compatibility purposes, but if you write
|
||||
a new application, better use RARSetCallback.
|
||||
|
||||
File comments support is not implemented in the new DLL version yet.
|
||||
Now CmtState is always 0.
|
||||
|
||||
|
||||
-- 13 August 2001
|
||||
|
||||
Added RARGetDllVersion function, so you may distinguish old unrar.dll,
|
||||
which used C style callback functions and the new one with PASCAL callbacks.
|
||||
|
||||
|
||||
-- 10 May 2001
|
||||
|
||||
Callback functions in RARSetChangeVolProc and RARSetProcessDataProc
|
||||
use PASCAL style call convention now.
|
10
unrar/x64/NoCrypt/readme.txt
Normal file
10
unrar/x64/NoCrypt/readme.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
This directory contains the x64 version of unrar.dll built without
|
||||
decryption code, authenticity verification code and RARSetPassword
|
||||
function. It is intended for use in applictions where presence
|
||||
of encryption or decryption code is not allowed because of legal
|
||||
restrictions.
|
||||
|
||||
This DLL can be distinguished from usual unrar.dll by missing
|
||||
RARSetPassword exported function. It sends UCM_NEEDPASSWORD notification,
|
||||
but returns CRC error for encrypted files regardless of password
|
||||
provided by application.
|
1
unrar/x64/readme.txt
Normal file
1
unrar/x64/readme.txt
Normal file
@@ -0,0 +1 @@
|
||||
This is x64 version of unrar.dll.
|
Reference in New Issue
Block a user