Plugin API reference
The shared callback interface for custom native plugins.
DE Decompiler uses the shared VB Decompiler plugin ABI. Exported names retain the VBDecompilerPlugin prefix. Shared compiler identifiers and legacy VB/FRX command names are API identifiers; they do not define the input formats supported by the product. Check each operation against the data available in the current DE Decompiler project.
This documentation describes the plugin interface shared by VB Decompiler and DE Decompiler. The plugin system allows you to analyze, modify, or extend the decompiled code and internal structures of the application via a shared library (DLL).
1. Architecture Overview
The plugin system operates on a callback model:
- The host decompiler loads your DLL plugin.
- It calls your exported functions to retrieve the plugin name and author info.
- It calls VBDecompilerPluginLoad, passing a pointer to its internal Callback Engine.
- Your plugin interacts with the host by calling this Engine function using specific Action IDs (vlType constants).
2. Exported Functions
Your DLL must export the following stdcall functions:
VBDecompilerPluginName
Called by the host to retrieve the display name of your plugin.
void __stdcall VBDecompilerPluginName(
HWND VBDecompilerHWND, // Handle to main window
HWND RichTextBoxHWND, // Handle to the code editor window
char* Buffer, // Target buffer (100 bytes, ANSI)
int Reserved // Reserved
);
Usage: Copy a standard ASCII string (max 100 chars) with your plugin name into Buffer.
VBDecompilerPluginAuthor
Called to retrieve author contact information.
void __stdcall VBDecompilerPluginAuthor(
HWND VBDecompilerHWND,
HWND RichTextBoxHWND,
char* Buffer, // Target buffer (ANSI)
int Reserved
);
Usage: Copy a string like "Author Name, email@domain.com" into Buffer.
VBDecompilerPluginLoad
The main entry point where your plugin logic is executed.
void __stdcall VBDecompilerPluginLoad(
HWND VBDecompilerHWND,
HWND RichTextBoxHWND,
char* Buffer, // Reserved/Buffer
void* PluginEngine // <--- Pointer to the Callback Function
);
Usage: Store the PluginEngine pointer. You will use it to invoke GetValue / SetValue commands (see "Callback Engine" below).
3. The Callback Engine
Communication with the host is handled via a single callback function pointer provided in PluginEngine.
Function Signature:
typedef wchar_t* (__stdcall *TVBDPluginEngine)(
int vlType, // Command ID (Action)
int vlNumber, // Primary Index (Form/Module ID)
int vlFnNumber, // Secondary Index (Function ID)
char* vlNewValue // Value to set (ANSI string) or NULL for Get commands
);
Note: The engine accepts ANSI strings (char*) for inputs but returns Unicode strings (wchar_t*) for results.
4. Command Reference (vlType)
The following constants are used as the vlType argument to perform specific actions.
Global Project Commands
Operations related to the project file or global settings. vlNumber and vlFnNumber are usually 0.
| ID | Constant | Description |
|---|---|---|
| 1 | GetVBProject | Get the full text of the decompiled project file. |
| 2 | SetVBProject | Replace the project file content. |
| 3 | GetFileName | Get the full path of the file being analyzed. |
| 4 | IsNativeCompilation | Returns "1" if the target is compiled to Native Code, "0" for P-Code. |
| 5 | ClearAllBuffers | Clears internal decompiler structures. Use this if your plugin implements a full custom decompiler for a new language. |
| 6 | GetCompiler | Returns compiler type: 1=VB, 2=.NET, 3=Delphi, 4=Unknown. |
| 7 | IsPacked | Returns "1" if the file is packed/compressed, "0" otherwise. |
| 56 | GetVBDecompilerPath | Returns the path to the DE Decompiler executable. |
| 100 | UpdateAll | Commit changes and refresh the GUI. Required after setting values to ensure the user sees changes. |
| 64 | GetProductName | Optional loaded host identity, independent of the inspected compiler; see SDK 26.6 below. |
UI Control
Control elements of the DE Decompiler interface.
| ID | Constant | Description |
|---|---|---|
| 8 | SetStackCheckBoxValue | Set Parse stack parameters checkbox state. "1" = Checked, "0" = Unchecked. |
| 9 | SetAnalyzerCheckBoxValue | Set Procedure analyzer and optimizer checkbox state. "1" = Checked, "0" = Unchecked. |
| 50 | GetActiveText | Get text currently displayed in the active code window. |
| 51 | SetActiveText | Set text in the active code window. |
| 52 | GetActiveDisasmText | Get the raw disassembly text of the disassembler window. |
| 53 | SetActiveDisasmText | Set the raw disassembly text to the disassembler window. |
| 54 | SetActiveTextLine | Scroll or jump to a specific line number (passed as string in vlNewValue). |
| 55 | GetActiveModuleCoordinats | Get IDs of the active view. Validate the returned value before using it. |
| 58 | SetStatusBarText | Display a custom message in the application status bar. |
Forms
Operations on recovered forms. vlNumber: Form Index (0-based).
| ID | Constant | Description |
|---|---|---|
| 10 | GetVBFormName | Get the name of the form. |
| 11 | SetVBFormName | Rename the form. |
| 12 | GetVBForm | Get the decompiled properties of the form. |
| 13 | SetVBForm | Set the properties of the form. |
| 14 | GetVBFormCount | Returns total number of forms in the project. |
Modules
Operations on Standard Modules (.bas) or Class Modules (.cls). vlNumber: Module Index (0-based).
| ID | Constant | Description |
|---|---|---|
| 30 | GetModuleName | Get the name of the module. |
| 31 | SetModuleName | Rename the module. |
| 32 | GetModule | Get the decompiled declarations header of the module. |
| 33 | SetModule | Set the decompiled declarations header of the module. |
| 34 | GetModuleStringReferences | Get list of string references used in this module. |
| 35 | SetModuleStringReferences | Set string references. |
| 36 | GetModuleCount | Returns total number of modules. |
Procedures / Functions
Operations on specific functions within a module.
vlNumber: Module Index.
vlFnNumber: Function Index (0-based) within that module.
vlNumber: Module Index.
vlFnNumber: Function Index (0-based) within that module.
| ID | Constant | Description |
|---|---|---|
| 20 | GetSubMain | Get the code for the entry point (Sub Main). (Index args ignored). |
| 21 | SetSubMain | Set the code for the entry point. |
| 40 | GetModuleFunctionName | Get the name of a specific function. |
| 41 | SetModuleFunctionName | Rename the function. |
| 42 | GetModuleFunctionAddress | Get the memory address (VA) of the function. |
| 43 | SetModuleFunctionAddress | Set the function address. |
| 44 | GetModuleFunction | Get the decompiled code of the function. |
| 45 | SetModuleFunction | Set the code of the function. |
| 46 | GetModuleFunctionStrRef | Get string references specific to this function. |
| 47 | SetModuleFunctionStrRef | Set string references for this function. |
| 48 | GetModuleFunctionCount | Returns number of functions in the specified module. |
| 57 | GetModuleFunctionCode | Get function code in "Fast Decompilation" mode (if this function is not processed at this time). |
| 70 | GetModuleFunctionDisasm | Get the disassembly (ASM) of the function. |
| 71 | SetModuleFunctionDisasm | Set the disassembly of the function. |
Resources (FRX)
Access to binary form resources (icons/images). vlNumber: Icon Index.
| ID | Constant | Description |
|---|---|---|
| 60 | GetFrxIconCount | Number of registered original pictures (zero-based indexes), including native ImageList bitmap sheets. |
| 61 | GetFrxIconOffset | Legacy adjusted offset: actual picture offset minus 8. Add 8 before reading. |
| 62 | GetFrxIconSize | Legacy adjusted size: actual picture byte count plus 8. Subtract 8 before reading. |
| 63 | GetFrxImageListInfo | Optional IL1 metadata for a registered native DFM ImageList color bitmap; see SDK 26.6 below. |
5. Native images and optional SDK 26.6 commands
This shared SDK revision is implemented by VB Decompiler 26.6 and DE Decompiler 26.6. Commands 63 and 64 are optional, read-only getters. The callback signature, exported symbols and existing command numbers are unchanged. Invoke the callback on the host application's main thread.
Registered pictures: commands 60–62
Image indexes are zero-based.
GetFrxIconCount returns the number of registered original pictures, not the number of logical icons inside ImageLists. Read their original bytes from the executable or DLL returned by GetFileName (command 3).For an image at actual file offset
P with actual byte count N, command 61 returns P - 8 and command 62 returns N + 8. Add 8 to the returned offset and subtract 8 from the returned size:Offset := GetInteger(GetFrxIconOffset, ImageIndex); Size := GetInteger(GetFrxIconSize, ImageIndex); FileStream.Position := Offset + 8; ImageStream.CopyFrom(FileStream, Size - 8);
Validate the index, adjusted range and payload signature before reading. These legacy adjustments do not imply a physical FRX header in a Delphi executable. The resulting payload begins with its BMP, PNG, JPEG, GIF, ICO or CUR signature; DFM property prefixes and ImageList container headers are excluded.
DE Decompiler registers pictures while decoding binary DFM form values. Independently encoded collection pictures have separate entries. A native ImageList's original color bitmap and optional mask remain ordinary bitmap entries, so existing plugins can continue to display or export the complete sheets.
63 — GetFrxImageListInfo
Pass an existing picture index in
vlNumber; pass zero for vlFnNumber and a null input pointer. For a recognized native DFM ImageList color bitmap, the current response is:IL1;<Count>;<Width>;<Height>;<Flags>;<MaskOffset>;<MaskSize>
| Field | Meaning |
|---|---|
Count | Number of logical images, excluding spare capacity. |
Width, Height | Cell dimensions in pixels. |
Flags | Original ImageList flags. Bit 0 indicates a mask; color format $20 indicates ILC_COLOR32. |
MaskOffset | Actual file offset of the mask BMP signature. Do not add 8. |
MaskSize | Actual mask BMP byte count. Do not subtract 8. |
Numeric fields are decimal and separated by semicolons. Both mask fields are zero when no mask is present. Color data still uses commands 61–62 and their legacy adjustment. Command 63 returns metadata only: it does not change indexes, rasterize cells or duplicate picture data in the host.
The current
IL1 implementation recognizes native stream version $0101 with BMP sheets. An ordinary picture, unsupported stream or older host can return an empty string; invalid indexes return Error. Treat empty, Error, malformed and unknown-version replies as unsupported and retain whole-picture handling wherever the original picture entry is available.For a cell index
K, use logical top-left coordinates:Columns := ColorBitmap.Width div CellWidth; X := (K mod Columns) * CellWidth; Y := (K div Columns) * CellHeight;
Require
0 <= K < Count. Validate geometry and file ranges and account for bottom-up DIB scanlines. Apply the matching one-bit mask or premultiplied alpha. Older 32-bit lists can contain an entirely zero alpha channel, in which case the mask remains the fallback.The supplied
shared/PluginSDK.pas and shared/modFrxImageList.pas provide the getters, parser and ImageList reader used by the updated viewer. The following excerpt assumes that FileStream is open on the analyzed file:InfoText := GetString(GetFrxImageListInfo, ImageIndex);
if ParseFrxImageListInfo(InfoText, Info) then begin
ColorOffset := GetInteger(GetFrxIconOffset, ImageIndex) + 8;
ColorSize := GetInteger(GetFrxIconSize, ImageIndex) - 8;
Images := TFrxImageList.Create(FileStream, ColorOffset, ColorSize, Info);
try
Icon := Images.Icon(0);
try
Icon.SaveToFile('Image_0.ico');
finally
Icon.Free;
end;
finally
Images.Free;
end;
end;
The reader validates ranges and geometry and uses Windows common controls to decode a native list. Enumerate each recognized list once. Suppress its separate mask entry by comparing the mask's actual offset with each picture's adjusted offset plus 8. Exported cell ICO files are derived images with the list's masks/alpha; standalone pictures retain their original payloads.
64 — GetProductName
Pass zero for both indexes and a null input pointer. The result is
VB Decompiler or DE Decompiler, taken from the loaded host's identity independently of the inspected file's compiler.Copy every returned UTF-16 string immediately: the pointer belongs to the host and remains valid only until the next callback. The supplied
DecompilerProductName helper validates the response and falls back to VB Decompiler on older hosts. Keep historical SDK exports, registry paths and localization keys unchanged.Compatibility and downloads
- Existing plugins continue to use commands 60–62 without changes.
- The updated viewer retains whole-picture behavior with older hosts.
- Recognized native DFM lists use command 63 for individual cell previews and ICO export; independently encoded collection pictures remain ordinary entries.
- VB5/6 and .NET graphics retain their existing extraction paths.
- These new getters do not modify the input file, recovered code, forms or current selection.
Download the shared SDK, including the optional-command reference and Delphi helpers. Read the supplied SDK 26.6 additions. See FRX Image Viewer for the user workflow.