Brummelchen
28th April 2006 15:30 UTC
another (external) patcher for work with nsis -> aPatch (instead vpatch)
geez i was looking these days for a script or patcher for nsis
(in general - a patcher with simple byte replacing at fix address)
the most patchers are search&replace in all combinations.
but that wasnt wanted, moreover they need a source/target file.
(vpatch wasnt uselful same way)
so i found aPatch
http://www.ibsensoftware.com/
this patcher works with a script which can be written from nsis.
easy way:
start
open <file>
search <old_word>
write <new_word>
quit
end
(word can be text or hexstrings)
(use fileopen/filewrite/filewritebyte0D0A/fileclose)
the the script must be compiled
"apatch.exe script.aps"
(apatch.exe need to be included in nsis-package /pluginsdir)
(File /oname=$PLUGINSDIR\apatch.exe "apatch.exe")
it generates a simple patch.exe.
unfortunaltely it has a GUI with a textfiled and two
buttons: "Patch" and "Quit"
but is is the only me known one:
1) freeware
2) script-based
3) very easy (hand full of commands)
In my case easy as simple
- in nsis: get word, get file (io)
- write apatch-script
- compile with apatch
- start patch (execwait)
- remove all temp-files
- done
part of my script:
start
open <file>
size 1227776
onerror goto error
backup on
offset 933125
write <new_text>
print "Success"
goto done
error:
print "Failed"
done:
quit
end
(open file, check filesize, goto offset, write text/hexstrings, quit)Use NSIS to write the filename, old_text, new_text, custom
errormessages aso.
aPatch is recognized from PEid, so it contains specific
bytes as a exe-packer - and "patch.exe" is packed with this
method - so you cant disassemble it to get rid of the GUI.
feel free to post other soulutions this way - if you have
one without GUI - write it here pls.
btw, i tried "fileseek #", but then i got 933125 00-bytes
and then my text. so nsis can only work on textfiles !?
galil
28th April 2006 17:57 UTC
btw, i tried "fileseek #", but then i got 933125 00-bytes and then my text. so nsis can only work on textfiles !?
If you open file in "w" mode that is what you're supposed to get.
Read NSIS manual about differences between r/w/a
moreover they need a source/target file.
(vpatch wasnt uselful same way)
Why doesn't that fit your needs?
If you need fixed offset patch, automatic compare of original/patched files that is offered by all these kind of patch creators just make it easier for you. Why input all the offsets and byte values by hand when you can have it done automatically.
(apatch.exe need to be included in nsis-package /pluginsdir)
Why do you need the patcher to be compiled on the user's system?
Normally you compile patcher on your system and distribute it.
Brummelchen
28th April 2006 18:16 UTC
hmm, i needed filewrite /a ?
idd i used /w...
vpatch needs a source and target file to compare,
like all others i know. there was no one with a simple
replace like apatch.
The source file isnt fixed, that was the main problem,
so specific code changes from time to time the patcher is used.
it just modifies a printed line which is given at a fixed address.
so search/replace isnt my friend you see!?
i need to compile at runtime but user has no apatch on its system ;)
Afrow UK
28th April 2006 18:20 UTC
Using w will delete the contents of the file.
Using a will not delete the contents of the file and so using FileSeek will allow you to move the write pointer to the end of the file for continuous writing.
-Stu
Brummelchen
28th April 2006 18:34 UTC
well i think youre right, i did it now with /a and it works, thx so much.
galil
28th April 2006 18:44 UTC
Originally posted by Brummelchen
it just modifies a printed line which is given at a fixed address.
So you could simply use NSIS built-in functions FileSeek and FileWrite (and maybe also FileWriteByte if you need to null-terminate that string), file opened in "a" mode of course...