NSIS Uninstaller: Checking for file changes using md5

Introduction

MPDN is a really powerful player that provides its extension through GitHub. In fact, those extension are what make this player so great, since it contains most of the Render Script made to improve the upscaling/downscaling of your video. Those script are using different Shader that can be easily modified by the end-user. To help people install the extension without the need to clone the repository, we created with Zach an installer.

Problem

By default the installer was removing the whole Extensions folder containing the Extension for the Player. This was perfectly fine if the user didn’t make any change to the shader. However on the forum some super-user started to complain about the deletion of their modification after an update of the Extension. They wanted the installer to keep their change with the possibility to update the core of the Extensions.

Solution

Since we were already using NSIS as installer creator, I went on the old winamp forum to find a solution for this. After a lot of searching I found a small script that generate an executable to generate the installer code.

Steps

  1. Compile the unLister
  2. Give the unLister the correct parameter, it will browser the wanted folder (what you want to install)
  3. It will generate the list of instructions for the uninstaller using comparison of timestamp of the file
  4. Include the generated file in the Uninstaller section

Good Start

But not enough, the first version of the script was only taking into account the timestamp, which can be quite unreliable since some program can easily change it by accessing the file even if no change were made. I continued my search for an improvement and found an md5dll plugin that generate an hash for a string or a file. This was perfect, and easy way to check if the file was modified.

Modification

You can find here the modification of the unLister script that use MD5 hash. I’m also attaching a zip containing the script and the md5 plugin needed for it to work.

Download

unLister for NSIS

This is the zip archive containing the unLister script (compiled version also) and it’s md5 plugin. Feel free to recompile it with NSIS.

Disclaimer

Antoine Aflalo is furnishing this item “as is”. Antoine Aflalo does not provide any warranty of the item whatsoever, whether express, implied, or statutory, including, but not limited to, any warranty of merchantability or fitness for a particular purpose or any warranty that the contents of the item will be error-free.
In no respect shall Antoine Aflalo incur any liability for any damages, including, but limited to, direct, indirect, special, or consequential damages arising out of, resulting from, or any way connected to the use of the item, whether or not based upon warranty, contract, tort, or otherwise; whether or not injury was sustained by persons or property or otherwise; and whether or not loss was sustained from, or arose out of, the results of, the item, or any services that may be provided by Antoine Aflalo.

 

Antoine Aflalo Written by:

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *