# VBForums CodeBank > CodeBank - Visual Basic 6 and earlier >  VB6- Semi VB Decompiler

## vbgamer45

Semi VB Decompiler
This is the only open source example that allows you to look inside the file format of vb 6.0 native/pcode exe or ocx.
It uses COM to find out the opcodes for the grahpical components of the exe, which means less things need to be hardcoded.
Learn the important visual basic strutures in a vb exe , understand why COM is an important part of the visual basic system, and see what is going on behind the scenes in your program.  Enjoy.

Release 0.03
Added Ocx Support
Added P-Code procedure decompile to P-Code tokens.
Added Image Extraction
Added Better Handling of Control properties.
Added Form Patch Editor
Added Syntax Coloring.
Better support of User Controls/And MDI Forms.
Api's Recovered
Procedure Names recovered for Forms and classes.
Resizing of the windows added.
Numerous Bug fixes and other things added.
Begun work on a basic antidecompiler.
Features Advanced decompiling using COM via VB6.OLB
Using COM allows me not to have to hard code every single property
The only properties that need to be hardcoded is the size, font, and dataformat opcodes.
One day I hope to use msvbvm60.dll instead of vb6.olb so nothing will have to be hardcoded.

----------


## Keithuk

Great app, pity you didn't use *Option Explicit* in all Forms and Modules.   :wave:

----------


## DigiRev

Amazing...

It could have been made more object-orientated to make it more reusable, but it's still really nice...

Where did you learn how the EXE files are structured?

----------


## vbgamer45

Wow, first time somone responded in a long time.    Well Semi VB Decompiler is no longer open source and the current version is 0.06.   Been busy rewriting and adding new features all the time.  
http://www.visualbasiczone.com/produ...mivbdecompiler

Main things that I want to work on now is .Net support, right now my goal is a basic IL Dissassembler.  Right now it just processes some of metadata information and displays the streams and shows the clr header.  The other thing I want to add is full support for VB 2/3 decompiling.  Half way to my goal with my VB 1/2/3 binary form to text converter is almost complete, you can make these things a lot faster after the first time around.

Some of the internal structures that I used can be found at vb-decompiler.com a nice place to get you started on a P-Code decompiler.   That's where I started and within a couple months I now know a lot of information and how VB really works.  

Native decompiling I actually think it can be done, but I would have to write my own disassembly engine then I can at least process and translate certain vb api calls.  Very time consuming.

----------


## ngohongchi

Great App !!   :Thumb:

----------


## CVMichael

I just downloaded it, and tried on one of my VB exe projects, and I get an error:
See red line (Line number 510)

VB Code:
Sub OpenVBExe(FilePath As String, FileTitle As String)
....
....
....
        'Decide if to get Optional Info or not
        If ((gObject(loopC).ObjectType And &H80) = &H80) Then
            
            Get #f, , gOptionalObjectInfo
            'Dim testLink() As tEventLink
            Dim LinkPCode() As MethodLinkPCode
            Dim LinkNative() As MethodLinkNative
            
            'Resize the Arrays
            [COLOR=Red]ReDim LinkPCode(gOptionalObjectInfo.iEventCount - 1)[/COLOR]
            ReDim LinkNative(gOptionalObjectInfo.iEventCount - 1)
            
            'MsgBox gOptionalObjectInfo.iEventCount
            If gOptionalObjectInfo.aEventLinkArray <> 0 And gOptionalObjectInfo.aEventLinkArray <> -1 Then
The error is because gOptionalObjectInfo.iEventCount is = 0

----------


## Keithuk

I found another VB decompiler but just the same as VB RezQ you don't see any code and this one doesn't recognise ActiveX's either where as VB RezQ does.

http://www.softpedia.com/progDownloa...oad-34504.html

----------


## dreamvb

nise app, may be usfull for learning about the exe structure. shame someone can;t make a full VB-Decompiler for VB6 or at least get a group together and make one, I know there used to be a VB6 Decompiler been worked on some years ago duno what happened to the site tho.

as for Full Decompile support for VB2 and VB3 apps that should be quite easy as someone did release the sourcecode for a Full VB3 Decompiler some years I remmber seeing the code, you should have a google for it

nise code anyway.

----------


## Keithuk

> as for Full Decompile support for VB2 and VB3 apps that should be quite easy as someone did release the sourcecode for a Full VB3 Decompiler some years I remmber seeing the code


Yes this source code is on

PSC

He some how decompiled DiDo's. It doesn't work it was never completed, he was asking users to help him complete it.   :Wink:

----------


## Keithuk

> Half way to my goal with my VB 1/2/3 binary form to text converter is almost complete


I found a VB 1/2/3 binary Form to VB6 text Form converter, it work very well.  :Wink:  

http://www.gridlinx.com/vb3.htm

----------

