Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Installation / Documentation > How to Decompile VB EXE


Reply
 
Thread Tools Display Modes
  #1  
Old 10-19-2003, 02:11 AM
JtheD's Avatar
JtheD JtheD is offline
Centurion
 
Join Date: Sep 2003
Posts: 142
Question How to Decompile VB EXE


Hello Everybody,

I need to know that is there a way to look inside a EXE file, i mean how to decompile a VB EXE file.

Thanking in advance


Sincerly
JtheD
Reply With Quote
  #2  
Old 10-19-2003, 02:17 AM
OnErr0r's Avatar
OnErr0r OnErr0r is offline
Obsessive OPtimizer

Administrator
* Guru *
 
Join Date: Jun 2002
Location: Debug Window
Posts: 13,727
Default

You don't.
Reply With Quote
  #3  
Old 10-19-2003, 05:54 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default

This is one of the most common myths in VB....the mysterious fantabulous decompiler!

The short answer is that there ain't no such beast. The long answer is a bit more complex.

Back around version 3 or 4, VB compiled to a kind of p-code rather than a true executable. This p-code contained a *lot* of redundant information about the source code. Things like variable names and comments for instance. Thus someone wrote a decompiler that could decompile a VB3 executable. Note that VB3 is a 16bit language, not 32 bit like VB6.

If you compile a program in VB6, the default is to compile to native machine code. As part of this process, the compiler strips variable names and comments from the code. It also optimizes your program as much as it can, depending on settings. Once it is done, you can never get back the original VB source since so much is lost. The best you can do is decompile to assembly code and from that, make guesses as to what the original code *might* have looked like.

If you change the compiler options and compile to p-code, like VB3 did, then *maybe* you can decompile it but since it's 32 bit, you probably can't use the old VB3 decompiler to do it. Also, it's likely that MS did away with that strange practice of keeping so much info in the p-code.

So there is no decompiler available unless you
a) program in VB3 OR
b) program in VB6 AND set your compiler options to p-code

If "a", then there is a decompiler, but I don't know where you can get it. If "b", then I don't know of one, I doubt one exists, but I can't deny the possibility that one may exist.
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
  #4  
Old 10-19-2003, 08:58 PM
Lord_Riff_Raff Lord_Riff_Raff is offline
Freshman
 
Join Date: Jul 2003
Posts: 29
Default

Ah good because I was about to ask the same question to check that no-one else could do this before I bothered obfursicating my code.

Then again it does mean we won't find the equivelent of the brilliant java decompilers that give better code out then code in.
Reply With Quote
  #5  
Old 10-20-2003, 12:48 AM
Ales Zigon's Avatar
Ales Zigon Ales Zigon is offline
Dead dog's ghost

Forum Leader
* Expert *
 
Join Date: Feb 2001
Location: Celje, Slovenia, Europe
Posts: 2,601
Default

Yep!
__________________
Yes, MSDN comes with VB! Yes, you must have at least 25 post to have an avatar! No, you cant write your OS in VB! and NO, YOU CAN NOT DECOMPILE IT!

I'm sure there are things that are more important than me - I just can't thing of any...
Reply With Quote
  #6  
Old 10-20-2003, 04:09 AM
BillSoo's Avatar
BillSoo BillSoo is offline
Code Meister

Retired Moderator
* Guru *
 
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
Default

The compilation process is "one way" and as such, is similar to many other processes. For instance, consider the simple parity check.

You start off with a number of bits (0 or 1). You count the number of "1" bits and if they are odd, you add a "1" and if they are even, you add a "0".

So:
10101010 + 0 = 101010100
11100110 + 1 = 111001101

The system is irreversible in that you cannot determine what the original number was if all you have is the parity bit. I mean, given a "1", the original number could have been
11100110 or 11110111 or 00000001
You *do* know that is isn't 00000000 or any other even parity, but that's about it.

When you disassemble the executable to assembler, you may see some kind of loop structure. Is it a Do-While or a For-Next Loop? You may be able to tell, or you might not. And in any case, the variable names, procedure names etc. are all lost. You would be better off rewriting the code from scratch (and take advantage of the opportunity to make it better too!).
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using C++ DLL to wrap a VB ActivexDLL (long) rlrichardson Miscellaneous Languages 12 09-03-2003 05:58 PM
QB to VB Conversion - By AIO BillSoo Tutors' Corner 0 08-06-2002 12:37 PM
why not use flash? wild wolf Game Programming 24 01-29-2002 12:04 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->