[go: up one dir, main page]

windows 0.36.1

Rust for Windows
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use super::*;
use bindings::*;

pub fn delay_load(library: &[u8], function: &[u8]) -> Result<RawPtr> {
    unsafe {
        let library = LoadLibraryA(PCSTR(library.as_ptr()))?;

        if let Some(address) = GetProcAddress(library, PCSTR(function.as_ptr())) {
            Ok(address as _)
        } else {
            FreeLibrary(library);
            Err(Error::from_win32())
        }
    }
}