0

I have decompiled an exe that was made over 10 years ago and I was wondering how to view the program in visual studio. It is saved as a .bas file and I want to convert it into the language it was written in (Visual Basic 6 I think). This is some of the code:

Object: frmNewCustomer
Private Sub Form_Unload(Cancel As Integer) '6CF5C0
  'Data Table: 42BA04
  loc_6CF584: On Error Resume Next
  loc_6CF589: LitNothing
  loc_6CF58B: CastAd
  loc_6CF58E: FStAdFuncNoPop
  loc_6CF591: FLdPr Me
  loc_6CF594: MemStAd
  loc_6CF598: FFree1Ad var_88
  loc_6CF59D: LitNothing
  loc_6CF59F: CastAd
  loc_6CF5A2: FStAdFuncNoPop
  loc_6CF5A5: FLdPr Me
  loc_6CF5A8: MemStAd
  loc_6CF5AC: FFree1Ad var_88
  loc_6CF5B1: LitNothing
  loc_6CF5B3: CastAd
  loc_6CF5B6: ImpAdStAdFunc MemVar_911008
  loc_6CF5BC: ExitProcHresult
End Sub

Private Sub txtCustomers_GotFocus(Index As Integer) '6CF72C
  'Data Table: 42BA04
  loc_6CF6F8: On Error Resume Next
  loc_6CF6FD: FLdRfVar var_8C
  loc_6CF700: ILdI2 Index
  loc_6CF703: FLdPrThis
  loc_6CF704: VCallAd txtCustomers
  loc_6CF707: FStAdFunc var_88
  loc_6CF70A: FLdPr var_88
  loc_6CF712: FLdZeroAd var_8C
  loc_6CF715: FStAdFunc var_90
  loc_6CF718: FLdRfVar var_90
  loc_6CF71B: ImpAdCallFPR4 Proc_10_19_6D164C()
  loc_6CF720: FFreeAd var_88 = "" = ""
  loc_6CF729: ExitProcHresult
End Sub
StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Joepowell567
  • 11
  • 2
  • 4
  • have you tried opening it in Microsoft Visual Basic 6 IDE? – Jan Paolo Go Dec 03 '17 at 03:07
  • What decompiler was used? Does it have any documentation regarding how to use the output files it produces? The code you posted is not directly executable VB6 code. – StayOnTarget Dec 04 '17 at 12:28
  • For information (not an exact duplicate): there is a question about [finding a VB6 decompiler](https://stackoverflow.com/questions/414068/is-there-a-visual-basic-6-decompiler) – MarkJ Dec 04 '17 at 12:33

1 Answers1

0

Yes, it looks like VB6 or earlier. There are lots of subroutine calls that you aren't showing us, though. They would have to be specified in the file.

To view your .bas file:

  1. Open Visual Basic in the Visual Studio 6.0 IDE.
  2. Start a new Standard EXE project.
  3. Remove the Form1 form that gets added by default.
  4. Add your .bas file to the project (select Project/Add Module, select the Existing tab, browse to your file).

You should be able to view it from there. If you want to run it:

  1. Make sure you have a Sub called Main().
  2. If there isn't one, create one, and call the top-level subroutine in your file.
  3. Make sure that Sub Main is selected as the startup object in the project properties (select Project/Properties, General tab, and find Sub Main in the Startup object dropdown).
BobRodes
  • 5,990
  • 2
  • 24
  • 26
  • Is the Visual Studio 6 IDE available in Visual Studio 201 or would I have to download the new IDE? – Joepowell567 Dec 03 '17 at 15:29
  • @Joepowell567 You would have to have a VB 6.0 IDE, which Microsoft no longer sells. You might want to try the VB6 Learning Edition, which you can find cheap on eBay. I've never used it, but from what I can see it has everything you need to view and edit your code. I believe that what it lacks is some of the controls and the native code compiler. [Here's](https://www.ebay.com/itm/Microsoft-Visual-Basic-6-0-Learning-Edition-IN-BOX-w-Visual-Studio-FREE-SHIP/282757812375?hash=item41d5add097:g:24oAAOSwv3FZxqU-) one for 50 bucks. The Pro and Enterprise editions run more, maybe $250. – BobRodes Dec 03 '17 at 20:24
  • Yeah, I found a copy online and downloaded it. When I add the file into the project, there is no main sub. When I try adding one it gives an error message "out of memory". Anything I can do? – Joepowell567 Dec 03 '17 at 20:53
  • Sub Main is the way to put it. Out of memory is often due to a recursive procedure call somewhere in the code, if you are saying that it happens when you try to run your code. If so, check the call stack. If you are saying (are you?) that you get an out of memory error as soon as you type "Sub Main" then that wouldn't be why. – BobRodes Dec 03 '17 at 21:28
  • Yeah, its whenever I try and type anything at the top of the code – Joepowell567 Dec 03 '17 at 22:06
  • @Joepowell567 send me an email, and I'll see if I can help. I'm robtrodes at aol. – BobRodes Dec 04 '17 at 02:04