Modern C++ SDK for developing Hiew External Modules (HEM).
Wraps the raw C SDK (v0.54) with idiomatic C++ abstractions.
- Windows only (Hiew is a Windows application)
- 32-bit only (Hiew is 32-bit)
- CMake 3.16+
- MSVC (Visual Studio 2019+)
git submodule add https://github.com/0xeb/hiew-sdk-cpp.git extern/hiew-sdk-cppCMakeLists.txt:
cmake_minimum_required(VERSION 3.16)
project(my_plugin LANGUAGES C CXX)
add_subdirectory(extern/hiew-sdk-cpp)
add_hem_module(my_plugin SOURCES src/my_plugin.cpp)my_plugin.cpp:
#include <hiew/hiew.hpp>
int plugin_main() {
auto d = hiew::data();
if (!d) return hiew::error;
hiew::message("Hello", "Plugin loaded!");
return hiew::ok;
}
HIEW_PLUGIN(
plugin_main,
"MyPlugin",
"My Hiew Plugin",
1, 0,
hiew::Flag::AllModes | hiew::Flag::AllFiles,
"", "", "")Build:
mkdir build && cd build
cmake -A Win32 ..
cmake --build . --config ReleaseCopy my_plugin.hem to Hiew's hem/ folder.
add_hem_module() creates a standard CMake target:
add_hem_module(my_plugin SOURCES src/my_plugin.cpp)
target_sources(my_plugin PRIVATE src/utils.cpp)
target_include_directories(my_plugin PRIVATE include/)
target_compile_definitions(my_plugin PRIVATE DEBUG_MODE=1)
target_link_libraries(my_plugin PRIVATE my_lib)A HEM plugin is a DLL (renamed to .hem) that exports a single function: Hem_Load. When Hiew loads the plugin, it calls this function and passes a HIEWINFO_TAG structure containing a HiewGate function pointer for calling Hiew APIs. The plugin returns a HEMINFO_TAG structure with its metadata and callback function pointers (EntryPoint, Unload, Hem2HemGate).
When the user activates the plugin, Hiew calls the EntryPoint callback. The plugin then uses HiewGate to interact with Hiew (show menus, read files, etc.).
The HIEW_PLUGIN macro handles all this boilerplate - it creates the Hem_Load export, stores the HiewGate pointer, and wires up your entry function as the EntryPoint callback.
auto d = hiew::data(); // Get file info (name, length, cursor)
hiew::message("Title", "Text"); // Show message box
auto s = hiew::get_string("Prompt", 64, "default"); // Input dialoghiew::return_offset(0x1000); // Jump to offset on exit
hiew::return_mode(hiew::ReturnMode::Hex); // Switch view modeauto [err, buf] = hiew::file_read(offset, 256);
hiew::file_write(offset, data); // Requires file_open_for_write()hiew::names::add_global(offset, "my_func");
hiew::names::add_local(local_offset, "label");
auto result = hiew::names::find("my_func");auto found = hiew::find(hiew::FindFlag::None, start, pattern);
hiew::mark_block(start, end);
hiew::color_marker(offset, length, 0x20); // Greenauto menu = hiew::ui::Menu::create("Title")
.items({"Option 1", "Option 2"})
.width(30);
auto [line, key] = menu.show();
auto window = hiew::ui::Window::create("Info")
.lines({"Line 1", "Line 2"})
.show();cmake -A Win32 -DHIEW_SDK_BUILD_EXAMPLES=ON ..
cmake --build . --config ReleaseMIT License. See LICENSE file.