Skip to content

Instantly share code, notes, and snippets.

@kennykerr
Created June 21, 2024 15:44
Show Gist options
  • Save kennykerr/1a3c01656a814a211d76ad3873962aa8 to your computer and use it in GitHub Desktop.
Save kennykerr/1a3c01656a814a211d76ad3873962aa8 to your computer and use it in GitHub Desktop.
D:\git\scratch10>type src\main.rs
use windows_sys::{core::*, Win32::System::LibraryLoader::*};
fn main() {
unsafe {
let module = LoadLibraryExW(
w!("api-ms-win-core-com-l1-1-3.dll"),
core::ptr::null_mut(),
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS,
);
if module.is_null() {
todo!("module not found");
}
let proc = GetProcAddress(module, s!("CoRevokeDeviceCatalog"));
if proc.is_none() {
todo!("function not found");
}
dbg!(module);
dbg!(proc);
}
}
D:\git\scratch10>cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.07s
Running `target\debug\scratch10.exe`
[src/main.rs:17:9] module = 0x00007ffc6e730000
[src/main.rs:18:9] proc = Some(
0x00007ffc6e81a6c0,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment