| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| 2 |
<html lang="en"> |
| 3 |
<head> |
| 4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
| 6 |
<meta name="color-scheme" content="light dark"> |
| 7 |
<title>VPatch 3</title> |
| 8 |
<style type="text/css"> |
| 9 |
/*<![CDATA[*/ |
| 10 |
:root { color-scheme: light dark; } |
| 11 |
html, body { font-family: Verdana, Arial, Helvetica, sans-serif; color: #050505; background-color: #fefefe; } |
| 12 |
html { font-size: 0.84em; } |
| 13 |
body { font-size: 1em; font-size: 1rem; } |
| 14 |
pre, code { font-family: Courier New, Courier, monospace,serif; font-size: 100%; } |
| 15 |
h1 { font-size: 170%; } |
| 16 |
h2 { font-size: 150%; } |
| 17 |
h3 { font-size: 130%; } |
| 18 |
h4 { font-size: 120%; } |
| 19 |
h5 { font-size: 115%; } |
| 20 |
h6 { font-size: 110%; } |
| 21 |
|
| 22 |
body |
| 23 |
{ |
| 24 |
padding:1.5em 0; margin:0; |
| 25 |
font-family: Verdana, Arial, Helvetica, sans-serif; |
| 26 |
font-weight: normal; |
| 27 |
text-align: left; |
| 28 |
} |
| 29 |
|
| 30 |
p, li { font-size: 1em; } |
| 31 |
table |
| 32 |
{ |
| 33 |
margin: auto; |
| 34 |
font-size: 1em; |
| 35 |
} |
| 36 |
h1 |
| 37 |
{ |
| 38 |
font-size: 250%; |
| 39 |
color: #333333; |
| 40 |
font-weight: normal; |
| 41 |
text-align: center; |
| 42 |
} |
| 43 |
|
| 44 |
h2 |
| 45 |
{ |
| 46 |
font-size: 150%; |
| 47 |
color: #7A7272; |
| 48 |
font-weight: normal; |
| 49 |
} |
| 50 |
|
| 51 |
h3 |
| 52 |
{ |
| 53 |
font-size: 130%; |
| 54 |
font-weight: bold; |
| 55 |
color: #303030; |
| 56 |
} |
| 57 |
|
| 58 |
div |
| 59 |
{ |
| 60 |
margin: 1.5em; |
| 61 |
} |
| 62 |
|
| 63 |
a:link, a:visited, a:active { color: #294F75; text-decoration: none; } |
| 64 |
a:hover { color: #182634; text-decoration: underline; } |
| 65 |
|
| 66 |
.T tr:nth-child(odd) { background-color: #fafafa; } |
| 67 |
.T tr, .T td { border: 1px solid #f5f5f5; border-collapse: collapse; padding: 0.2em; } |
| 68 |
|
| 69 |
@media (prefers-color-scheme: dark) { |
| 70 |
html, body { color: #eeeeee; background-color: #161616; } |
| 71 |
h1, h2, h3, h4, h5, h5 { color: inherit; } |
| 72 |
a, a:link, a:visited, a:active { color: #4be; } a:hover { color: #6df; } |
| 73 |
.T tr:nth-child(odd) { background-color: #222222; } |
| 74 |
.T tr, .T td { border: 1px solid #202020; border-collapse: collapse; padding: 0.2em; } |
| 75 |
} |
| 76 |
|
| 77 |
/*]]>*/ |
| 78 |
</style> |
| 79 |
</head> |
| 80 |
<body> |
| 81 |
<h1>VPatch 3.1</h1> |
| 82 |
<div> |
| 83 |
<h2>Introduction</h2> |
| 84 |
<div> |
| 85 |
<p>VPatch allows to create a patch file to update previous versions |
| 86 |
of your software. The GenPat utility generates the patch file. |
| 87 |
The plug-in can use the patch to update a file. Using a patch, you can |
| 88 |
reduce the download size of your updates because only the differences |
| 89 |
between the files are included in the patch file.</p> |
| 90 |
</div> |
| 91 |
<h2>How to use</h2> |
| 92 |
<div> |
| 93 |
<h3>Generate the patch file</h3> |
| 94 |
<div> |
| 95 |
<p>Make sure you have the source file (original version) and the target |
| 96 |
file (version to update to). For example, DATA.DTA (currently on user |
| 97 |
system) and DATA_20.DTA (version 2.0 of this data file). Now call |
| 98 |
the command line tool GenPat.exe:</p> |
| 99 |
<pre>GENPAT oldfile.txt newfile.txt patch.pat</pre> |
| 100 |
<p>Now, the patch will be generated, this will take some time.</p> |
| 101 |
<p>Using the /B=(BlockSize) parameter of the GenPat utility (put it |
| 102 |
after the filenames), you can use a different block size. A smaller |
| 103 |
block size may result in a smaller patch, but the generation will |
| 104 |
take more time (the default blocksize is 64).</p> |
| 105 |
<p>If you have trouble using this command-line utility, you can download |
| 106 |
a GUI (graphical user interface) for VPatch from its own website: |
| 107 |
<a href="http://www.tibed.net/vpatch">http://www.tibed.net/vpatch</a>.</p> |
| 108 |
</div> |
| 109 |
<h3>Update the file during installation</h3> |
| 110 |
<div> |
| 111 |
<p>Use the VPatch plug-in to update a file using a patch file:</p> |
| 112 |
<pre>vpatch::vpatchfile "patch.pat" "oldfile.txt" "temporary_newfile.txt"</pre> |
| 113 |
<p>The result of the patch operating will be added to the stack and |
| 114 |
can be one of the following texts:</p> |
| 115 |
<ul> |
| 116 |
<li>OK</li> |
| 117 |
<li>OK, new version already installed</li> |
| 118 |
<li>An error occurred while patching</li> |
| 119 |
<li>Patch data is invalid or corrupt</li> |
| 120 |
<li>No suitable patches were found</li> |
| 121 |
</ul> |
| 122 |
<p>Check <a href="../../Examples/VPatch/example.nsi">example.nsi</a> for an example. |
| 123 |
You |
| 124 |
should check whether the stack string starts with "OK" |
| 125 |
because then the patch has succeeded and you can rename "temporary_newfile.txt" |
| 126 |
to "oldfile.txt" to replace the original, if you want.</p> |
| 127 |
</div> |
| 128 |
<h3>Multiple patches in one file</h3> |
| 129 |
<div> |
| 130 |
<p>GenPat appends a patch to the file you specified. If there is already |
| 131 |
a patch for the same original file, with the same CRC/MD5, in the patch file, |
| 132 |
|
| 133 |
the patch will be replaced. For example, if you want to be able to upgrade |
| 134 |
version 1 and 2 to version 3, |
| 135 |
you can put a 1 > 3 and 2 > 3 patch in |
| 136 |
one file.</p> |
| 137 |
<p>You can also put patches for different files in one patch file, for |
| 138 |
example, a patch from file A version 1 to file A version 2 and a patch |
| 139 |
from file B version 1 to file B version 2. Just call the plug-in multiple |
| 140 |
times with the same patch file. It will automatically select the right |
| 141 |
patch (based on the file CRC).</p> |
| 142 |
</div> |
| 143 |
<h3>Patch generator (GenPat) exit codes</h3> |
| 144 |
<div> |
| 145 |
<p>In version 3 the following exit codes (known as error levels in |
| 146 |
the DOS period) can be returned by GenPat. GenPat will return an |
| 147 |
exit code based on success of the patch generation. Here is a list |
| 148 |
of the possible exit codes:</p> |
| 149 |
<table border="0" cellspacing="0" cellpadding="0" class="T"> |
| 150 |
<tr> |
| 151 |
<td nowrap><b>Exit code</b></td> |
| 152 |
<td><b>Description</b></td> |
| 153 |
</tr> |
| 154 |
<tr> |
| 155 |
<td>0</td> |
| 156 |
<td>Success</td> |
| 157 |
</tr> |
| 158 |
<tr> |
| 159 |
<td>1</td> |
| 160 |
<td>Arguments missing</td> |
| 161 |
</tr> |
| 162 |
<tr> |
| 163 |
<td>2</td> |
| 164 |
<td>Other error</td> |
| 165 |
</tr> |
| 166 |
<tr> |
| 167 |
<td>3</td> |
| 168 |
<td>Source file already has a patch in specified patch file (ERROR), |
| 169 |
use /R switch to override</td> |
| 170 |
</tr> |
| 171 |
</table> |
| 172 |
<p>These exit codes can be useful when you generate patch files through |
| 173 |
a NSIS script.</p> |
| 174 |
</div> |
| 175 |
</div> |
| 176 |
</div> |
| 177 |
<div> |
| 178 |
<h2>Source code</h2> |
| 179 |
<div> |
| 180 |
<p>Source code is available in the original package and in the SVN repository of NSIS.</p> |
| 181 |
|
| 182 |
<h3>NSIS plug-in (C++)</h3> |
| 183 |
<div> |
| 184 |
<p>The source of the NSIS plug-in that applies patches can be found |
| 185 |
in the Source\Plugin folder.</p> |
| 186 |
</div> |
| 187 |
<h3>Patch Generator (C++)</h3> |
| 188 |
<div> |
| 189 |
<p>The most interesting part of VPatch, the actual patch generation |
| 190 |
algorithm, can be found in Source\GenPat\PatchGenerator.cpp. |
| 191 |
The |
| 192 |
header of that file contains a brief explanation of the algorithm as well. |
| 193 |
</p> |
| 194 |
</div> |
| 195 |
<h3>User interface (Delphi)</h3> |
| 196 |
<div> |
| 197 |
<p>A user interface is included as well, which you will have to build |
| 198 |
yourself because the GUI executable was too large to include. Besides |
| 199 |
Borland Delphi 6 or higher (you can use the freely available Personal |
| 200 |
edition), you will also need to install the <a href="http://www.delphi-gems.com">VirtualTreeView</a> component by Mike Lischke.</p> |
| 201 |
</div> |
| 202 |
</div> |
| 203 |
<h2>Version history</h2> |
| 204 |
<div> |
| 205 |
<ul> |
| 206 |
<li>3.1 |
| 207 |
<ul> |
| 208 |
<li>GenPat now compiles on POSIX platforms (MinGW/GCC), Visual |
| 209 |
C++ 6 and Borland C++.</li> |
| 210 |
<li>More test cases to verify functionality of GenPat.</li> |
| 211 |
</ul> |
| 212 |
</li> |
| 213 |
<li>3.0 |
| 214 |
<ul> |
| 215 |
<li><b>Final</b>: Updates to the GUI, installer</li> |
| 216 |
<li><b>RC8</b>: GenPat will now flag replacement of a patch (e.g. |
| 217 |
the source file has the same contents as a previous patch inside |
| 218 |
a patch file) as an error. You can specifically allow it using |
| 219 |
the /R switch. Added license to source files.</li> |
| 220 |
<li><b>RC7</b>: Fixed critical bug in GenPat with multiple patches |
| 221 |
in a single file. Fixed serious bug in stand-alone EXE runtime: |
| 222 |
process kept on running forever. Included case testing through |
| 223 |
a Python script to test common usage (and prevent bugs like |
| 224 |
the one in GenPat in the future).</li> |
| 225 |
<li><b>RC6</b>: Upgraded to non-beta compiler. Added /A switch |
| 226 |
to change block match limit and /O to deactivate the limit. |
| 227 |
Updated GUI to support the /O switch.</li> |
| 228 |
<li><b>RC4a to RC5a</b>: input block size is now checked for power |
| 229 |
of 2 and fixed if incorrect. When patch file does not yet exist, |
| 230 |
no longer forgets to create the header. No longer tries to allocate |
| 231 |
memory when there are no chunks. Fixed memory leaks.</li> |
| 232 |
<li>Target file date is now preserved inside a patch and restored |
| 233 |
on the user system.</li> |
| 234 |
<li>MD5 checksums are now used instead of CRC32 checksums, unless |
| 235 |
existing patches in a file already are in CRC32 mode.</li> |
| 236 |
<li>The patch generator, GenPat, has been completely rewritten |
| 237 |
in C++. It no longer needs to keep the entire files in memory, |
| 238 |
instead memory usage is a certain percentage of the source file |
| 239 |
size. The percentage is based on the block size, larger block |
| 240 |
sizes will reduce memory usage.</li> |
| 241 |
<li>All runtimes now share a common codebase, perform proper error |
| 242 |
checking and don't leave behind files if the input file was |
| 243 |
already up to date.</li> |
| 244 |
<li>Bug Fix: The patch generator algorithm no longer reduces to |
| 245 |
a quadratic runtime if there are many blocks with the same content |
| 246 |
in the files to patch.</li> |
| 247 |
<li>Bug Fix: The documentation of the command-line utilities was |
| 248 |
incorrect and no warnings would be given by the runtimes, causing |
| 249 |
the patch not to work (this does not apply to NSIS patches).</li> |
| 250 |
</ul> |
| 251 |
</li> |
| 252 |
<li>2.1 |
| 253 |
<ul> |
| 254 |
<li>Added argument checking and error handling to GenPat. Now |
| 255 |
returns exit codes as well to indicate success/failure (and |
| 256 |
the reason for failure). Only GenPat has changed in this version |
| 257 |
compared to 2.0 final.</li> |
| 258 |
<li>Bug Fix: GenPat no longer gives an Access Violation when attempting |
| 259 |
to patch a file smaller than 64 bytes into a file larger than |
| 260 |
64 bytes.</li> |
| 261 |
</ul> |
| 262 |
</li> |
| 263 |
<li>2.0 final |
| 264 |
<ul> |
| 265 |
<li>Cleaned up source code for the patch generator, which is now |
| 266 |
included (this code is written in Borland Delphi 6 and compiles |
| 267 |
with the freely available Personal edition).</li> |
| 268 |
</ul> |
| 269 |
</li> |
| 270 |
<li>2.0 beta 2 |
| 271 |
<ul> |
| 272 |
<li>All new algorithm used in the patch generator: much faster |
| 273 |
(up to 90%) while using smaller block sizes (higher compression)</li> |
| 274 |
<li>Created a NSIS 2 plugin</li> |
| 275 |
<li>Works with small files</li> |
| 276 |
<li>Replaces existing patch in file if original file CRC is identical</li> |
| 277 |
</ul> |
| 278 |
</li> |
| 279 |
</ul> |
| 280 |
</div> |
| 281 |
<h2>Credits</h2> |
| 282 |
<div> |
| 283 |
<p>Written by Koen van de Sande.<br> |
| 284 |
C plug-in initially by Edgewize, updated by Koen van de Sande.<br> |
| 285 |
New documentation and example by Joost Verburg and Koen van de Sande.</p> |
| 286 |
</div> |
| 287 |
<h2>License</h2> |
| 288 |
<div><pre> |
| 289 |
Copyright (C) 2001-2005 Koen van de Sande / Van de Sande Productions |
| 290 |
|
| 291 |
This software is provided 'as-is', without any express or implied |
| 292 |
warranty. In no event will the authors be held liable for any damages |
| 293 |
arising from the use of this software. |
| 294 |
|
| 295 |
Permission is granted to anyone to use this software for any purpose, |
| 296 |
including commercial applications, and to alter it and redistribute |
| 297 |
it freely, subject to the following restrictions: |
| 298 |
|
| 299 |
1. The origin of this software must not be misrepresented; |
| 300 |
you must not claim that you wrote the original software. |
| 301 |
If you use this software in a product, an acknowledgment in the |
| 302 |
product documentation would be appreciated but is not required. |
| 303 |
2. Altered versions must be plainly marked as such, |
| 304 |
and must not be misrepresented as being the original software. |
| 305 |
3. This notice may not be removed or altered from any distribution. |
| 306 |
</pre></div> |
| 307 |
</div> |
| 308 |
|
| 309 |
</body> |
| 310 |
</html> |