Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

Open Executable, Modify Text, Save It [C#]

I am currently doing this:
  • Opening .EXE file with notepad++
  • Changing text in that executable file
  • Saving it

In C#, I'm doing this:

[Image: beQaNT.png]

In terms of saving the exe, it works, but it doesn't modify the text inside using the regex. It's the same EXE as the one I import.

I've checked "newContents" and the string itself has replaced the old text.

Thanks!  🤝
readalltext > replace > writealltext
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Feb 23, 2019 03:00 PM)HFDone Wrote:  readalltext > replace > writealltext

Tried this at the start but this doesn't work.

It makes the file size x2 and corrupts the exe.
It's because of your encoding conversion going on behind the scenes. Here's a solution:

[Image: Syr3DlV.png]
you cant replace the text with larger string
b4 you compile it put string length that you need to replace
delete the file b4 you save the replaced file
[Image: bitcoin.png] Be Nice For Once 15hVUVz7xA4kazHdk2BuErENGCskVwjYXP
(Feb 23, 2019 03:34 PM)gigajew Wrote:  It's because of your encoding conversion going on behind the scenes. Here's a solution:


Cheers mate.

Sent you $15 🤝

[Image: cs3yuj.png]
Thanks that's very much appreciated
[Image: Syr3DlV.png]
(Feb 23, 2019 05:13 PM)FarosMoloko Wrote:  Cheers mate.

Sent you $15  🤝

That was really good of you, man. I am glad you got a solution too.
Resident Writer for MyGamer.Com and Horrify.Net
Here's a more reliable method of checking the encoding of the file (using it's BOM header if it has one)
[Image: Syr3DlV.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by zlg43647Oct 28, 2022 07:06 AM 2 240 Oct 28, 2022 07:06 AM
Last Post: zlg43647
[C#] by mayar2021Mar 14, 2021 03:44 PM 7 292 Mar 14, 2021 03:44 PM
Last Post: sniper coder
[.NET] by mayar2021Mar 14, 2021 10:21 AM 4 199 Mar 14, 2021 10:21 AM
Last Post: HFDone