#vb6 #parser #analyzer

vb6parse

vb6parse is a library for parsing and analyzing VB6 code, from projects, to controls, to modules, and forms

7 releases (4 breaking)

new 0.5.1 Apr 26, 2025
0.5.0 Apr 26, 2025
0.4.1 Sep 30, 2024
0.3.0 Sep 25, 2024
0.1.0 Sep 11, 2024

#814 in Parser implementations


Used in aspen

Custom license

460KB
10K SLoC

Goals:

VB6Parse aims to be a complete, end-to-end parser library for VB6. Including, but not limited to:

  • (*.vbp) VB6 project files.
  • (*.bas) VB6 module files.
  • (*.vbw) VB6 windows files for determining IDE editor windows and where they are opened.
  • (*.frm) VB6 Form files.
  • (*.frx) VB6 Form Resource files.
  • (*.dsx) VB6 Data Environment files.
  • (*.dsr) VB6 Data Environment Resource files.
  • (*.cls) VB6 Class files.
  • (*.ctl) VB6 User Control files.
  • (*.ctx) VB6 User Control Resource files.
  • (*.ttx) Crystal Report files.
  • (*.dob) User Document files.

Current support:

First work has focused on the (vbp) project files since is the method to discover all other files that should be linked/referenced within a project.

(*.vbp) VB6 Project file parser feature support:
  • Project Types
    • Exe
    • Control
    • OleExe
    • OleDll
  • References
  • Objects
  • Modules
  • Designers
  • Classes
  • Forms
  • UserControls
  • UserDocuments
  • ResFile32
  • IconForm
  • Startup
  • HelpFile
  • Title
  • ExeName32
  • Command32
  • Name
  • HelpContextID
  • CompatibleMode
  • NoControlUpgrade
  • MajorVer
  • MinorVer
  • RevisionVer
  • AutoIncrementVer
  • ServerSupportFiles
  • VersionCompanyName
  • VersionFileDescription
  • VersionLegalCopyright
  • VersionLegalTrademarks
  • VersionProductName
  • CondComp
  • CompilationType
  • OptimizationType
  • NoAliasing
  • CodeViewDebugInfo
  • FavorPentiumPro(tm) - Yes, this is exactly what this looks like inside the project file, '(tm)' and all.
  • BoundsCheck
  • OverflowCheck
  • FlPointCheck
  • FDIVCheck
  • UnroundedFP
  • StartMode
  • Unattended
  • Retained
  • ThreadPerObject
  • MaxNumberOfThreads
  • DebugStartOption
  • AutoRefresh
(*.cls) VB6 Class file parser feature support:
  • Header
  • VB6 Token stream tokenized.
  • VB6 Abstract Syntax Tree formed from Token Stream.
(*.bas) VB6 module file parser feature support:
  • Header
  • VB6 Token stream tokenized.
  • VB6 Abstract Syntax Tree formed from Token Stream.
(*.frm) VB6 form file parser feature support:
  • Header

    • Create Forms.
    • Create MDIForms.
    • Create Menu controls.
    • Create Frame controls.
    • Create CheckBox controls.
    • Create ComboBox controls.
    • Create CommandButton controls.
    • Create Data controls.
    • Create DirListBox controls.
    • Create DriveListBox controls.
    • Create FileListBox controls.
    • Create Image controls.
    • Create Label controls.
    • Create Line controls.
    • Create ListBox controls.
    • Create OLE controls.
    • Create OptionButton controls.
    • Create PictureBox controls.
    • Create HScrollBar controls.
    • Create VScrollBar controls.
    • Create Shape controls.
    • Create TextBox controls.
    • Create Timer controls.
    • Create UserControl controls.
    • Load form property resources from frx files.
  • VB6 Token Stream tokenized.

  • VB6 Abstract Syntax Tree formed from Token Stream.

note: The form currently loads resources from the frx file, but doesn't apply all of them to the correct property locations in all cases yet. Instead of creating a picture and assigning it to the Picture property, we only load the binary blob from the FRX file and assign it to the property parsing bag.

Further work is needed to correctly assign the binary resources to the their properties in the standard controls.

(*.frx) VB6 form resource file parser feature support:
  • Binary blobs.
  • List items.
  • Strings.

VB6Project API:

  • Unit Testing - Partially supported.
  • Integration/End-to-End Testing - Partially supported.
  • Benchmarking.
  • Top level API finalization.
  • Documentation - Partially supported.
  • Examples - Partially supported.

Test:

Be sure to use git submodule update --init --recursive to get all integration test submodule data if you plan to run cargo test.

Dependencies

~7.5MB
~143K SLoC