开发者

How to edit a hardcoded string in compiled DLL?

开发者 https://www.devze.com 2023-04-08 04:21 出处:网络
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开发者_Go百科 one single hardcoded string in it (it\'s a fil

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开发者_Go百科 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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号