Modifying a dot net exe directly?

  • Thread starter Thread starter PseudoBill
  • Start date Start date
P

PseudoBill

I have an app (single exe) in which I want to modify a few strings
depending on the type of user. I know I can set up an automatic
build process to take care of this (I actually have done this), but
it would be faster to use a little utility to directly modify a
template exe (i.e, only creating a new exe when the source code
changes). This would take about 1 second to directly modify an exe
vs a couple of minutes to build a new exe with a build utility.

The question is: how do you directly modify an exe? I can find the
strings I want to modify with no problem, but when I edit in a text
editor the exe is no longer runnable. Is there a special utility I
should be using for this? Is there some sort of checksum going on in
the exe which breaks when I modify a string?
 
I wanted to do this by modifying the exe and not use any other files.
I don't want it easily changed after being distributed.
 
I kind of figured that. If you can't find out how to modify the exe, you
*could* encrypt the text in the application config files.
 
Andy Gaskell said:
I kind of figured that. If you can't find out how to modify the exe, you
*could* encrypt the text in the application config files.

That'd probably be best, even with something as simple as ROT13. All you are
really doing is boosting the barrier to entry, anyone who can figure out
your encryption key\scheme will probably know enough to modify the strings
themselves or to find a utility to do it.

Most, if not all, of the libraries that you would need exist, simplist
solution might be just to modify the string in the string heap with a hex
editor(if the string is shorter), but you could load all hte metadata and
redump it as well, if you wanted to.
I would look into things like SharpAssembly and the tool developers docs.
 
Back
Top