Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


decompile to recover lost .bas module?

decompile to recover lost .bas module?

decompile to recover lost .bas module?

I cannot access and work on my source code because I inadvertently over-wrote the .bas module containing my record fields (type/end type) and my global variables.

Is there a decompiler that will get that back for me from the compiled exe file?  Any other ideas?

RE: decompile to recover lost .bas module?

No, no decompiler I'm afraid

RE: decompile to recover lost .bas module?

Yes there is one called Free VB Decompiler which is I think is about 5.39 MB. But the Program is slow but it does decompile most of the Files. You can also get a commercial one from the same author(s) which I have read somewhere is more accurate.

Just google it.

RE: decompile to recover lost .bas module?

I'll repeat: this is, I'm afraid, arrant nonsense. There has been no effective native code decompilers for Classic VB5 or VB6 (VB3 had a reasonably good decompiler, and VB4 had one or two that worked a bit, but both of those languages only compiled to p-code, so it was much, much easier to decompile). And if you investigate how the native code compilation works (in summary, an intermediate language version of your program is passed to the same highly efficient optimising compiler used by Microsoft's C/C++, languages) you'd understand why.

The "Free VB Decompiler" you mention is almost certainly limited to 'decompiling' p-code, which practically no-one has compiled to for about a decade, and even then has numerous limitations.

Most of the 'decompilers' on the market (free or otherwise) attempt to disassemble native code instead, which is not the same thing as decompilation at all, and given the nature of an optimising compiler, cannot properly recover even the structure of your original program, let alone individual lines of code

RE: decompile to recover lost .bas module?

I've already mentioned that the decompiler will surely not be accurate.


The download page has a description written about the program and
in the middle of the description is the line:

If a program was compiled into the native code, restoring full source code from machine instructions is not possible.

Which means it afterall may be helpful to someone by extracting some part of the real sourcecode, may be it'll help him recode the file faster.

Most of all, someone asked for a program which would help him extract and regain something he worked hard to make.
So, I mentioned what I knew and don't care whether it is pseudo code or not and I don't care about it's accuracy and limitations.

RE: decompile to recover lost .bas module?

>Which means it afterall may be helpful

And I'll repeat that, in relation to native code compilation, they are a waste of money and, frankly, a con. And often use carefully worded sentences to hide their limitations ...

> by extracting some part of the real sourcecode

No, they can't do this. Really (or at least not in any meaningful sense). The nature of the optimizing compiler is such that there is no one-to-one correspondence between the compiled code and the original source. At best they take a guess at what the source code may have been (and earlier versions of VB Decompiler were more honest about this and pretty much state as much in the documentation)

Here, for example, is the full code of a simple VB program:


Option Explicit

Private Sub Command1_Click()
    Text1.Text = "Hello World"
End Sub

and here is (part of) VB Decompiler 8.1's decompilation of that code (or rather, as previously stated, a disassembly):


Private Sub Command1_Click() '401AF0
  loc_00401AF0: push ebp
  loc_00401AF1: mov ebp, esp
  loc_00401AF3: sub esp, 0000000Ch
  loc_00401AF6: push 00401096h
  loc_00401AFB: mov eax, fs:[00h]
  loc_00401B01: push eax
  loc_00401B02: mov fs:[00000000h], esp
  loc_00401B09: sub esp, 00000014h
  loc_00401B0C: push ebx
  loc_00401B0D: push esi
  loc_00401B0E: push edi
  loc_00401B0F: mov var_C, esp
  loc_00401B12: mov var_8, 00401080h
  loc_00401B19: mov esi, arg_8
  loc_00401B1C: mov eax, esi
  loc_00401B1E: and eax, 00000001h
  loc_00401B21: mov var_4, eax
  loc_00401B24: and esi, FFFFFFFEh
  loc_00401B27: push esi
  loc_00401B28: mov arg_8, esi
  loc_00401B2B: mov ecx, [esi]
  loc_00401B2D: call [ecx+04h]
  loc_00401B30: mov edx, [esi]
  loc_00401B32: xor edi, edi
  loc_00401B34: push esi
  loc_00401B35: mov var_18, edi
  loc_00401B38: call [edx+00000300h]
  loc_00401B3E: push eax
  loc_00401B3F: lea eax, var_18
  loc_00401B42: push eax
  loc_00401B43: call [00401018h] [magenta]; Set (object)[/magenta]
  loc_00401B49: mov esi, eax
  loc_00401B4B: push 00401524h [/magenta]; "Hello World"[/magenta]
  loc_00401B50: push esi
  loc_00401B51: mov ecx, [esi]
  loc_00401B53: call [ecx+000000A4h]
  loc_00401B59: cmp eax, edi
  loc_00401B5B: fclex
  loc_00401B5D: jnl 401B71h
  loc_00401B5F: push 000000A4h
  loc_00401B64: push 0040153Ch
  loc_00401B69: push esi
  loc_00401B6A: push eax
  loc_00401B6B: call [00401010h]
  loc_00401B71: lea ecx, var_18
  loc_00401B74: call [00401078h]
  loc_00401B7A: mov var_4, edi
  loc_00401B7D: push 00401B8Fh
  loc_00401B82: jmp 401B8Eh
  loc_00401B84: lea ecx, var_18
  loc_00401B87: call [00401078h]
  loc_00401B8D: ret

Good luck in extracting your source from that ...

RE: decompile to recover lost .bas module?

OKAY I'm completely unfamilier with ASM and I'm just asking myself why I even posted the reply with the name of the program.

But, I repeat I DON'T CARE. Topic Closed for ME...


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close