#AdditionalJar: pecoff4j
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
ParseResource("C:\Program Files (x86)\Anywhere Software\B4J\B4J.exe")
End Sub
Sub ParseResource(Path As String)
Dim PEParser As JavaObject
Dim PE As JavaObject = PEParser.InitializeStatic("org.boris.pecoff4j.io.PEParser").RunMethod("parse", Array(Path))
Dim rd As JavaObject = PE.RunMethodJO("getImageData", Null).RunMethod("getResourceTable", Null)
Dim ResourceType, ResouceHelper, ResourceParser As JavaObject
ResourceType.InitializeStatic("org.boris.pecoff4j.constant.ResourceType")
ResouceHelper.InitializeStatic("org.boris.pecoff4j.util.ResourceHelper")
ResourceParser.InitializeStatic("org.boris.pecoff4j.io.ResourceParser")
Dim entries() As Object = ResouceHelper.RunMethod("findResources", Array(rd, ResourceType.GetField("VERSION_INFO")))
For Each entry As JavaObject In entries
Dim version As JavaObject = ResourceParser.RunMethod("readVersionInfo", Array(entry.RunMethod("getData", Null)))
Dim strings As JavaObject = version.RunMethod("getStringFileInfo", Null)
Dim table As JavaObject = strings.RunMethod("getTable", Array(0))
For j = 0 To table.RunMethod("getCount", Null) - 1
Dim key As String = table.RunMethodJO("getString", Array(j)).RunMethod("getKey", Null)
Dim value As String = table.RunMethodJO("getString", Array(j)).RunMethod("getValue", Null)
Log($"${key}: ${value}"$)
Next
Next
End Sub