From 16341eca8c09553b0ac0da8c99c06bdac4eeca66 Mon Sep 17 00:00:00 2001 From: lienjukaisim <154924955+lienjukaisim@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:30:48 +0200 Subject: [PATCH] test appel --- clego/src/SV_DLL_Win.rs | 6 +++--- clego/src/main.rs | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/clego/src/SV_DLL_Win.rs b/clego/src/SV_DLL_Win.rs index ab96560..f0e0d33 100644 --- a/clego/src/SV_DLL_Win.rs +++ b/clego/src/SV_DLL_Win.rs @@ -8,7 +8,7 @@ use std::ffi::{CString , c_void}; //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"); unsafe { 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 -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") let symbol_name = CString::new("SSV_InitLIB2").expect("Nom de symbole invalide"); unsafe { @@ -36,7 +36,7 @@ result }} //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{ // Résolution d'une fonction exportée ("SSV_LireCartePS") let symbol_name = CString::new("SSV_LireCartePS").expect("Nom de symbole invalide"); diff --git a/clego/src/main.rs b/clego/src/main.rs index 1224355..c6814b2 100644 --- a/clego/src/main.rs +++ b/clego/src/main.rs @@ -1,5 +1,13 @@ mod SV_DLL_Win; 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); +} \ No newline at end of file