The Hex Workshop plug-in framework allows developers to perform various operations within Hex Workshop by interacting with documents, structures, bookmarks, checksums, and the caret position and selection.
Developers can:
Plug-ins must be complied using Microsoft Visual Studio .NET 2005 or later and must be compiled using the Unicode Character Set (_UNICODE). The plug-in must link with "hwapi100_32.lib" (32-bit) or "hwapi100_64.lib" (64-bit).
The DLL must be placed in the user's Hex Workshop Plug-in directory and must export the following entrypoints:
HWAPIEP BOOL HWPLUGIN_Identify(LPTSTR, size_t) HWAPIEP DWORD HWPLUGIN_RequestCapabilities(LPCTSTR) HWAPIEP BOOL HWPLUGIN_Execute(LPCTSTR, HWSESSION, HWDOCUMENT)The plug-in may optionally export the following entrypoint:
HWAPIEP BOOL HWPLUGIN_RequestFileAutoexecExtensions(LPCTSTR, LPTSTR, size_t)
When Hex Workshop is launched, it automatically searches the User's Plug-in directory and loads each DLL found. Each DLL is checked for the HWPLUGIN_Identify, HWPLUGIN_RequestCapabilities, and HWPLUGIN_Execute entrypoints.
If all entrypoints are defined, Hex Workshop calls the HWPLUGIN_Identify entrypoint to obtain a list of commands (delimited by semicolons). For each command, Hex Workshop then calls HWPLUGIN_RequestCapabilities to obtains capabilities and requirements. Each command is then added to the plug-in menu within Hex Workshop. The menu items are enabled/disabled based on the capabilities returned by HWPLUGIN_RequestCapabilities.
If HWPLUGIN_RequestCapabilities returns HWPLUGIN_CAP_FILE_AUTOEXEC, Hex Workshop will invoke the HWPLUGIN_RequestRequestFileAutoexecExtensions entrypoint for the command. The list of file extensions are stored within Hex Workshop and the plug-in command is automatically executed whenever a user opens a file with a matching file extension.
Plug-ins are never unloaded.
When the user selects a plug-in command from the Hex Workshop menu or Hex Workshop automatically executes a plug-in command based on file extension, the HWPLUGIN_Execute entrypoint is called with the command name, a session handle (HWSESSION), and a document handle (HWDOCUMENT). A session handle is always provided, however, a document handle is only provided if a document is active within the editor.
The plug-in must act synchronously. Once the HWPLUGIN_Execute entrypoint returns, Hex Workshop frees all plug-in session and document resources Plug-ins should not use or reference any handles after their execute entrypoint returns.