Archive: Patching NSIS-Setups on-the-fly when downloading?


Patching NSIS-Setups on-the-fly when downloading?
Hello everyone,

I'm currently programming a software portal for our customers and I'd like to pre-patch the setup with their own serial number.

To realize that, I've put a long string into the according field in the INI-file, let's say "serial=4444444444444444444444". Also, I've turned compression off for this file to be able to recognize it again in my download-program. When downloading the file, the script searches for the string mentioned above and replaces it with the serial number (fully transparent of course, the customer thinks he's downloading a normal executable file - mod_rewrite rocks ;)).

That all works, but now comes the problem: the CRC-checksum does not match of course.

My question: Is there the possibility to disable CRC-checksums for only one file or is there a method to re-build the checksum on the fly (where is it located in the executable and what area is used to generate it?) or are there other methods for replacing parts of the installer (constants or defined or whatever you'd like to call it) automatically?

Thanks in advance,
Michael


Write the serial number to the end of the file. That part is ignored by the CRC check. To read it back, use GetModuleFileName, FileOpen, FileSeek, FileRead and FileClose.


Hi kichik,

Thanks for your tip. I found http://nsis.sourceforge.net/ReadCustomerData and it works perfectly :).

Thanks,
Michael


A better way is to add an extra field to Version resource information, because even if you sign your application with an MS authenticate certificate you still can modify a value on the fly without breaking the finished application.


CRC is done on the resource section as well, including the version information.


Yes, CRC does, I forgot :( Since I do not use it. OK appending to the end is better sollution I see...