thisKai / rust-windows-dll

Macro for dynamically loading windows dll functions
MIT License
19 stars 6 forks source link

Loadlibraryex args #2

Closed roblabla closed 3 years ago

roblabla commented 4 years ago

Allows passing arguments to the underlying LoadLibraryEx function.

This can be used to, for instance, limit the library search to certain folders (e.g. LOAD_LIBRARY_SEARCH_SYSTEM32), or to ensure the loaded library has a valid signature (e.g. LOAD_LIBRARY_REQUIRE_SIGNED_TARGET).

The list of flags that can be passed can be found at https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw .

Example:

#[dll("ntdll.dll", LOAD_LIBRARY_SEARCH_SYSTEM32)]
extern "system" {
    #[link_name = "RtlGetVersion"]
    fn rtl_get_version(lp_version_information: *mut OSVERSIONINFOW) -> NTSTATUS;
}
thisKai commented 3 years ago

Thanks, there's a tiny conflict in this one but I'm fixing it now, I'll release a new version after I've tweaked a couple of other things