test appel

This commit is contained in:
lienjukaisim 2024-07-07 22:30:48 +02:00
parent 7694f5f102
commit 16341eca8c
2 changed files with 13 additions and 5 deletions

View File

@ -8,7 +8,7 @@ use std::ffi::{CString , c_void};
//récupérer le handle sur la library //récupérer le handle sur la library
fn load_library(dll_path: &str)->*mut winapi::shared::minwindef::HINSTANCE__ { pub fn load_library(dll_path: &str)->*mut winapi::shared::minwindef::HINSTANCE__ {
let dll_path_c = CString::new(dll_path).expect("Chemin de DLL invalide"); let dll_path_c = CString::new(dll_path).expect("Chemin de DLL invalide");
unsafe { unsafe {
let h_module = LoadLibraryA(dll_path_c.as_ptr()); let h_module = LoadLibraryA(dll_path_c.as_ptr());
@ -17,7 +17,7 @@ fn load_library(dll_path: &str)->*mut winapi::shared::minwindef::HINSTANCE__ {
} }
//SSV_INITLIB2 //SSV_INITLIB2
fn ssv_initlib2(dll_handle:*mut winapi::shared::minwindef::HINSTANCE__ , sesamini_path :String)->i32{ pub fn ssv_initlib2(dll_handle:*mut winapi::shared::minwindef::HINSTANCE__ , sesamini_path :&str)->i32{
// Résolution d'une fonction exportée ("SSV_InitLIB2") // Résolution d'une fonction exportée ("SSV_InitLIB2")
let symbol_name = CString::new("SSV_InitLIB2").expect("Nom de symbole invalide"); let symbol_name = CString::new("SSV_InitLIB2").expect("Nom de symbole invalide");
unsafe { unsafe {
@ -36,7 +36,7 @@ result
}} }}
//SSV_LireCartePS //SSV_LireCartePS
fn ssv_lirecarteps(dll_handle:*mut winapi::shared::minwindef::HINSTANCE__ , NomRessourcePS :String , NomRessourceLecteur :String , CodePorteurPS :String, pub fn ssv_lirecarteps(dll_handle:*mut winapi::shared::minwindef::HINSTANCE__ , NomRessourcePS :String , NomRessourceLecteur :String , CodePorteurPS :String,
mut ZDonneesSortie: *mut c_void , mut TTailleDonneesSortie: usize)->i32{ mut ZDonneesSortie: *mut c_void , mut TTailleDonneesSortie: usize)->i32{
// Résolution d'une fonction exportée ("SSV_LireCartePS") // Résolution d'une fonction exportée ("SSV_LireCartePS")
let symbol_name = CString::new("SSV_LireCartePS").expect("Nom de symbole invalide"); let symbol_name = CString::new("SSV_LireCartePS").expect("Nom de symbole invalide");

View File

@ -1,5 +1,13 @@
mod SV_DLL_Win; mod SV_DLL_Win;
fn main() { fn main() {
println!("Hello, world!"); let my_handle:*mut winapi::shared::minwindef::HINSTANCE__ ;
} my_handle = SV_DLL_Win::load_library("C:/Program Files/santesocial/fsv/1.40.14/lib/ssvw64.dll");
if my_handle.is_null() {
panic!("Échec du chargement de la DLL");
}
let result_ssv_initlib2=SV_DLL_Win::ssv_initlib2(my_handle,"C:/CLEGO_Files/SanteSociale/sesam.ini");
println!("Résultat SSV_InitLIB2 : {}", result_ssv_initlib2);
}