Readme.html 13 KB

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