DragonNest/Extern/UnRAR/Documentation/RARCallback.htm
2024-12-19 09:48:26 +08:00

122 lines
3.8 KiB
HTML

<!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</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 zero or positive value to retry or return -1 value to
terminate operation. The function may also specify a new volume
name, placing it to the address specified by P1 parameter.</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 zero or positive value to continue or -1 to
terminate operation.</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 zero or a positive value to continue process 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</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 zero or a positive value 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.</p>
<p><b>P2</b> contains the size of password buffer.</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 zero
or positive value continues processing. But please also read event
descriptions above just in case we'll add some exceptions from this rule.</p>
<h3>Notes</h3>
<blockquote>
Other UnRAR.dll functions must not be called from the callback function.
</blockquote>
</body>
</html>