2.2.5
latestP-Code Speed Improvements
This release is mostly about very large P-Code programs. One with 12,000 procedures ran for over 84 minutes without finishing and looked frozen; it now decompiles in about 20 minutes and writes its project in about 6. On the way, the P-Code decompiler learned Variant module variables, Split and Array, and arrays held in Variants, which took about 1,500 lines VB6 won't compile out of that one program. There's also a round of fixes to how forms are read, 48 more Windows API functions, and native programs decompile about 20% faster.
Very large P-Code programs
- Decompiling: a program with 12,000 procedures ran for over 84 minutes in the window and looked frozen on its last procedure. The time went into passes over the whole program after the last procedure, and into the decode loop itself. It now takes about 20 minutes.
- Status bar: after the last procedure, the status bar names each whole-program pass (
Whole-program pass: ...), so a long run no longer looks stuck. - Another program, with 11,000 procedures, sat on its last procedure for hours. It now finishes. A smaller P-Code program I test with went from 207 seconds to 61.
- File > Generate vbp:
- It decompiled every procedure a second time. It now writes the code the Code view already has, so the two always agree.
- In the window, it also wrote a status line for every event in the program, once per form: 3.7 million lines for this program. Only a form's own events get one now.
- That program's project went from more than 32 minutes, unfinished, to about 6.
Native code speed
- Native programs decompile about 20% faster: one I test with went from 289 seconds to 228.
P-Code accuracy
Most of these turned up in the same 12,000-procedure program. I read each one off the raw P-Code and reproduced it in a small VB6 project, which now decompiles to code VB6 compiles.
- Variant module variables: a Variant kept in a module and set from another module wasn't decoded. Each lost assignment left its value behind for the next call, which produced 1,485 lines like:
```vb
Fseleccion.Show vbModal, , 9000, "MPAISES", 1, " PAISES "
```
VB6 won't compile those. They're the assignments they were now.
- Module variable types: a variable set only from another module is declared with the type it's set as (String instead of Long).
- Return values: Variant Functions and Property Gets no longer lose their return value.
- Format$ no longer leaves a stray 1 in front of it: (1 & Format$(d, ...)).
- Form properties: Call frmConsole.Member_58(var_94) is now var_94 = frmConsole.hWnd, and the same for .Caption, .Visible and the rest.
- Split, Filter, GetAllSettings and Array are assigned to their array: strTemp() = Split(strData, vbCrLf, -1, 0) instead of Call Split(...), and x = Array(a, b).
- Arrays held in a Variant are read and set by index (v(i) = x) and stay declared As Variant.
- Indexed control properties keep their index: cmbFormat.ItemData(cmbFormat.NewIndex) = formats(i). Before, the index came out as the value.
- For loops over UBound: For i = 0 To UBound(x) no longer comes out as For Unknown = Unknown To Unknown.
- Late-bound indexed assignments such as Sheet.Rows(r).Cells(, 1) = rs("Codprod") are recovered.
- Event procedures with a Control or DataObject parameter are declared the way VB expects. Form_DragDrop(Source As Object, ...) stopped the project with "Procedure declaration does not match description of event".
- Code view and project agree: some procedures read differently depending on when they were decoded. The Code view and the generated files now match on every procedure.
Forms and controls
Each of these was an "Unknown OpCode" line in ErrorLog.txt or a property that came out wrong. I worked out each one by compiling small VB6 projects that change one setting at a time.
- Menus: a menu with
NegotiatePositionset lost the rest of its settings with an "Unknown OpCode" error. It's read completely now. - OLE containers: a form with an OLE container control lost every control after it. One form lost 20.
- Data controls:
Connect,DatabaseNameandRecordSourceare read correctly. An emptyDatabaseNameswallowed the next property, and aRecordSourcecame out as garbage. - Property pages and UserControls:
- no more "Unknown OpCode" errors for
ScaleMode,AutoRedraw,FontTransparent,DrawStyleandEditAtDesignTime; - a public property page is written as a property page (
.pag), not a UserDocument (.dob). - User scale: Forms and PictureBoxes with
ScaleMode = 0(User) get the rightScaleWidthandScaleHeight. One came out 28.94998 instead of the source's 95.855, another 1 x 1 instead of 2775 x 255. - ActiveX controls and DLLs: writing the
.vbphit an Overflow error, and its Startup line was empty. Both fixed.
Windows API declarations
- 48 more API functions are recognised, 2,497 in all:
- audio stream conversion (
acmStreamOpen,acmStreamConvert); - AVI file reading (
AVIFileInit,AVIStreamRead,AVIStreamGetFrame); SHGetFolderPathA,SetFilePointerEx,InternetGetConnectedStateandOleGetClipboard;- more Unicode calls (
LoadLibraryW,FormatMessageW,InternetOpenW); - GDI+ effects and image streams.
- They come with the record types they need:
WAVEFORMATEX,ACMSTREAMHEADERandAVISTREAMINFOA. - ANSI and Unicode together: a program that calls both
SHGetFolderPathAandSHGetFolderPathWgets a Declare for each, instead of one serving both. - Garbage Declares: references to another type library's interfaces were read as API functions. They showed up as unreadable lines in the API List and in
modCommon.bas, which couldn't compile (8 of them in one OCX). They're skipped now.
Other fixes
- Crash: one program crashed the decompiler with an access violation while its type libraries were read, leaving an empty output folder. It now decompiles.
- ErrorLog.txt: a run that logs no errors deletes the
ErrorLog.txtan earlier run left in the program's dump folder, so it no longer lists errors that are fixed. - User Guide: Help > User Guide covers everything up to this release.