WIP: SV_DLL_WIN #17

Closed
julien.misiak wants to merge 4 commits from SV_DLL_WIN into main
2 changed files with 13 additions and 5 deletions
Showing only changes of commit 16341eca8c - Show all commits

View File

@ -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");

View File

@ -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);
}