Decompile Visual Basic.

Can anyone suggest a quick or easy was to decompile a Visual Basic EXE. It’s a regular 'ol windows program. However it needs updating and the author is AWOL, presumed gone.

I’ve tried some trial programs but they either create code that crashes Visual Basic Studio, or they decompile the forms and not the code.

Program available on request.

Unless it is is the debugging version of the program, there is no way to generate the source code . Because all the variable names have been trashed. So the decompiler just has to put int_01 or whatever in it. At least in the general case, VB may be different.

Brian

Compiling a program destroys the information that humans like to see like variable names, commenting, and other readable information. It just feeds the machine itself what it needs. At best, a decompiler can generate something like enhanced Assembly language or maybe really crappy C code with generic variable names and so forth. It would take a tremendous amount of work even to figure out how to enhance such a thing let alone pass it on so that other people can work on it in the future.

Do you know if the program was written in Visual Basic .Net? Or was it an earlier version (e.g., 6.0)?

If it’s .Net then it can at least be decompiled into MSIL, which is better than nothing.
LilShieste

If it is .NET, you can use the .NET Reflector program, along with the File Disassembler plugin, to generate some pretty decent source code. All you lose are comments and local variable names.

But if it was compiled directly to the WinAPI, you probably won’t have too much luck generating anything usable.

Looks like it’s version 6.
There’s notes inside the exe that mention version 6 and the reflector program doesn’t recognise it due to a lack of a ‘CLI Header’ but thanks for the suggestions

The decompilers I’ve found so far have had no trouble decompiling the forms (The layout of the windows, drop down menus and other such buttons)

I’m not too worried about variable names, because the addition i need to do should be nothing more than adding two more items to a drop down menu. My plan was to search the code for the existing entires in that menu and see what they referance.

As I didn’t code the thing I expect variable names of Int_01 etc will mean as much to me as the original ones would have anyway!

That’s an odd thing to say. It shouldn’t matter whether you coded it or not, good variable names are immensely helpful.

No, there really is nothing more you can do. Apparently, getting the forms out is pretty much all you can hope for.

Cite: Classic VB - How can I get the source code of a compiled VB file (.exe/.dll/..)?-VBForums

Being such a high level language, pretty much all the functions get compiled down so far that there really isn’t any connection to the VB language left in the executable.

Even if you found a perfect decompiler, my guess is that every single line of code would be an API call. (Mostly an assload of CopyMemory calls.)

I have been in a few similar boats before, and I can say without reservation that you will be time and money ahead in the long run (not necessarily the short run) to bite the bullet and re-write the application with good, well-documented code.