Readme.html 13 KB

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