开发者

Recompiling a VB.NET application

So I have this VB.Net Application. It uses SQL Server database, for which it "hard-codes" the IP Address of the database inside its compiled code.

The server IP has changed and I can't start the software anymore. Also, I can't change the IP Address of the server (another server is using the same IP and it can't be changed).

It is just 2 EXE files with no external DLLs or anything else. So I opened both of them in HEX Editor, tried to search for the ascii of my IP address, but couldn't find it, tried also a HEX search but with no result.

Then I used .NET REFLECTOR (http://www.red-gate.com/products/reflector/), and exported the code. I could see where th开发者_StackOverflow社区e IP address is located: in Form2 a string variable named "strMyConnectionString". However, recompiling from the files exported by Reflector didn't work for me: I got 100 error and alot of warnings; obviously, the forms were missing but only their codes where decompiled. It has like 100 forms, and it is hard to redesign them (if that is even a considered a solution - not sure).

How do you suggest solving this? I need to change the IP as I can't use the software anymore!

Thanks!


If you have a .NET exe that you don't have the source code for, you're going to need to brush up on Ildasm and Ilasm. Use Ildasm to covert the .EXE into Microsoft's Intermediate Language. Change the code there - it'll be in a text format, but the IL code will look more like assembly language than a 3GL. Once you've changed the IL, you can recompile to an .EXE with Ilasm. Yucky, but functional and probably your best choice without the original source.


You could try editing your local DNS settings. Open C:\WINDOWS\system32\drivers\etc\hosts and specify a redirect from the old IP to the new one.

You could also try contacting the original author and requesting a new build.

If you authored it you should definitely not hard code changeable variables such as IP addresses and domain names :)


Instead of reflector, try ildasm

http://www.mactech.com/articles/mactech/Vol.19/19.12/NETbinaries/index.html

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜