Old 16th October 2006, 09:50   #1
mstap
Junior Member
 
Join Date: Oct 2006
Posts: 2
Question 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
mstap is offline   Reply With Quote
Old 16th October 2006, 10:06   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
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.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 16th October 2006, 12:57   #3
mstap
Junior Member
 
Join Date: Oct 2006
Posts: 2
Hi kichik,

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

Thanks,
Michael
mstap is offline   Reply With Quote
Old 17th October 2006, 09:40   #4
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
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.

"Just do it"
onad is offline   Reply With Quote
Old 17th October 2006, 09:58   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
CRC is done on the resource section as well, including the version information.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 17th October 2006, 10:24   #6
onad
Senior Member
 
onad's Avatar
 
Join Date: Dec 2004
Location: Turkey
Posts: 447
Yes, CRC does, I forgot Since I do not use it. OK appending to the end is better sollution I see...

"Just do it"
onad is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump