I have a single compiled dll which i need to change a little. It was written by me half a year ago, but I've lost the source code. There's one single hardcoded string in it (it's a filename)
I need to change it from TestPage.html
to TestPage1.html
(it's not much longer)
How to do that? The string is anonymous, the corresponding piece of code is:
... + folder + "TestPage.html"
There's no variable it's assigned to.
Thanks in advance.
EDIT: I do not want to recompile c# code after extracting it with Reflector-like tools!
You can use reflector. However, I didn't mention it as it may be illegal to modify the source code, depending on the licensing terms. Also, if the original creator obfuscated the assembly, that's going to create problems with what the final source code looks like.
You can easily open a DLL file in Visual Studio the same way you would any other file. To do so, click File in the menu bar at the top, followed by Open. Then click File and select the DLL file you want to open and click Open. This will open the DLL file in a new Resource Editor window.
You could use CFF Explorer, which provides a very raw view on .NET assemblies. It also provides the possibility to view and even modify the UserString-stream (find it under .NET Directory > MetaData Streams > #US
).
The UserString-stream stores string literals as the one you described. You should be able to find your particular string with the find-function and modify it. However, there is a limitation: You cannot use a string with a different length (shorter or longer). This would mess up the indices of all strings that would follow later on in the UserString-stream and all the offsets of the other sections. So, unfortunately I think changing it to TestPage1.html
will not work, as it is one character longer.
Use Reflector (or other similar tool) to decompile IL into C# (or another CLR language), and then - edit and compile it again.
You can use the free tool ILSpy to decompile the code and ressources from a .NET-dll file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With