In regards to my fixer which would change some bytes in MY code.
I would like my code to make a copy of itself with a different name.
That would make the program smaller since I would not have to store an .exe in my code.
Then the my program c - o=u l 'd change the string in it since it would not be running.
What do you think about that idea ?
Andy
it may depend on the OS
we all know that you cannot write to an EXE while it is running
but, you may be able to read it
try it out - then get someone to test it on windows 7/8 :t
you may need to play with the sharing flags a little (start with FILE_SHARE_READ)
probably use OPEN_EXISTING :P
The OS has no objections (at least XP hasn't). Here is a testpiece. Apologies if it looks a bit basic :bgrin:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://masm32.com/board/index.php?topic=94.0)
Init
Let esi="Hello, this is string #"
xor ecx, ecx
.Repeat
inc ecx
Print esi, Str$("%i\n", ecx)
Delay 100
.Until ecx>=10
Let edi=FileRead$("SendStringsToConsole.exe") ; <<<<<<< that's myself!!
xor ecx, ecx
.Repeat
push esi
mov edx, ecx
.Repeat
movzx ebx, byte ptr [edi+edx] ; we are looking for "Hello..."
inc edx
lodsb
.Until al!=[edi+edx] || !al
pop esi
.Break .if !al
inc ecx
.Until ecx>=LastFileSize
.if !al
Inkey CrLf$, "[", esi, Str$("] is at position %i", ecx), Str$(" of %i bytes.\nRelaunch clone (y)?\n", LastFileSize)
.if eax=="y"
Open "O", #1, "SendStringsToConsoleClone.exe"
mov byte ptr [edi+ecx+19], "o" ; look out for "strong"
PrintBuffer #1, edi, LastFileSize
Close
Launch "SendStringsToConsoleClone.exe"
.endif
.else
Inkey "[", esi, "] not found"
.endif
Exit
end start
I don't you understood my post.
Andy
I think Dave and me understood that you want to change a string in your exe and write a modified copy to disk. If that is wrong, explain "Then the my program c - o=u l 'd change the string in it" ;-)
Quote from: Magnum on December 13, 2012, 01:07:24 PM
I don't you understood my post.
Andy
that one, i don't :P
SuperDave,
I am a perfectionist.
I put your response through the "Sloppy Language Translator."
Input: "that one, i don't" Output: I do not understand your post. :icon14:
Andy
i figured you were just sleepy, Andy (http://l.yimg.com/us.yimg.com/i/mesg/emoticons7/28.gif)