in reply to Change Binary File
Aside from the info you've already received from the other residents of the monastery, here's what I do.
I used to occasionally have to ship executables with a serial number and licensee name in it. I'd never compile it in, as that would be a nuisance. Also, you never know how many (unintentional) cases of the string appear that you want to change.
So, what I used to do is to:
(a) precede the block of strings to patch with a preamble, and
(b) set each string to a known value, and
(c) provide plenty of expansion room in strings with variable length.
So if my fellow brethren will forgive me, here's the kind of code I'd use in C to hold my strings:
Then, in my patcher program (written in Perl!), I'd scan for the location of the $$variable_name.$$ strings found between the markers, and then replace them with the appropriate values (not to exceed the boundaries of the $$..$$.).const char z_patchable_start[]="Start of patchable area"; const char serial_number[]="$$serial_number.....$$"; const char licensee[]="$$licensee..............................." "........................................." ".......................................$$"; const char z_patchable_end[]="End of patchable area";
Hope this helps...
|
|---|