hmod 0.1.1

Reliably discovers the module handle of the current PE image
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented2 out of 2 items with examples
  • Size
  • Source code size: 28.58 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 116.6 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tim-weis/hmod
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tim-weis

crates.io docs.rs msrv repository platform support

hmod

Know your HMODULE!

This library provides a straightforward way to retrieve the HMODULE (or HINSTANCE) identifying the module that contains the currently executing code. It reliably determines the module handle, whether linked into a DLL, an EXE, or an intermediate rlib.

Usage

Display the main module's load address:

fn main() {
    let load_addr = hmod::current();
    println!("Load address: {load_addr:#?}");
}

Load a cursor from the module's resources section:

use windows_sys::{w, Win32::UI::WindowsAndMessaging::LoadCursorW};

let cursor = unsafe { LoadCursorW(hmod::current(), w!("unicorn")) };