hmod 0.1.1

Reliably discovers the module handle of the current PE image
Documentation
[![crates.io](https://img.shields.io/crates/v/hmod)](https://crates.io/crates/hmod)
[![docs.rs](https://img.shields.io/docsrs/hmod)](https://docs.rs/hmod)
![msrv](https://img.shields.io/crates/msrv/hmod)
[![repository](https://img.shields.io/badge/repo-hmod-blue?logo=github&color=%234078c0)](https://github.com/tim-weis/hmod) <!-- see https://www.designpieces.com/palette/github-color-palette-hex-and-rgb/ -->
![platform support](https://img.shields.io/badge/platform-windows-blue?color=%23004fe1) <!-- see https://www.color-hex.com/color-palette/1023458 -->

# `hmod`

Know your `HMODULE`!

This library provides a straightforward way to retrieve the [`HMODULE` (or `HINSTANCE`)](https://devblogs.microsoft.com/oldnewthing/20040614-00/?p=38903) 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:

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

Load a cursor from the module's resources section:

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

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