VPatch 2

Introduction

VPatch allows to create a patch file to update previous versions of your software. The GenPat utitily generates the patch file. The plug-in can use the patch to update a file. Using a patch, you can reduce the download size of your updates, because only the differences between the files are included in the patch file.

How to use

Generate the patch file

Make sure you have the source file (original version) and the target file (version to update to). For example, DATA.DTA (currently on user system) and DATA_20.DTA (version 2.0 of this data file). Now call the command line tool GenPat.exe:

GENPAT data.dta data_20.dta data.pat

Now, the patch will be generated, this will take some time.

Using the /B=(BlockSize) parameter of the GenPat utility (put it after the filenames), you can use a different block size. A smaller block size may result in a smaller patch, but the generation will take more time (the default blocksize is 64).

Update the file in your installer

Use the VPatch plug-in to update a file using a patch file:

vpatch::vpatchfile "pathfile.pat" "source.file" "new.file"

Check example.nsi for an example.

Multiple patches in one file

GenPat appends a patch to the file you specified. If there is already a patch for the same orginal file in the patch file, the patch will be replaced. For example, if you want to be able to upgrade version 1 and 2 to version 3, you can put a 1 > 3 and 2 > 3 patch in one file.

You can also put patches for different files in one patch file, for example, a patch from file A version 1 to file A version 2 and a patch from file B version 1 to file B version 2. Just call the plug-in multiple times with the same patch file. It will automatically select the right patch (based on the file CRC).

Version history

  • 2.0 beta 2
    • All new algorithm used in the patch generator: much faster (up to 90%) while using smaller block sizes (higher compression)
    • Created a NSIS 2 plugin
    • Works with small files
    • Replaces existing patch in file if original file CRC is identical

Credits

Written by Koen van de Sande
C plug-in by Edgewize
New documentation and example by Joost Verburg

License

Copyright (C) 2001-2002 Koen van de Sande

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute
it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; 
   you must not claim that you wrote the original software.
   If you use this software in a product, an acknowledgment in the
   product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such,
   and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

Please note that this version contains the plug-in source only,
not the source of the patch generator.