diff --git a/Create_DLL/Cargo.toml b/Create_DLL/Cargo.toml new file mode 100644 index 0000000..99a7609 --- /dev/null +++ b/Create_DLL/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "Create_DLL" +version = "0.1.0" +edition = "2018" +author = "trickster0" +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +[dependencies] +winapi = { version = "0.3.9", features = ["minwindef","winuser"] } + +[lib] +crate-type = ["cdylib"] diff --git a/Create_DLL/src/main.rs b/Create_DLL/src/main.rs new file mode 100644 index 0000000..3e1e913 --- /dev/null +++ b/Create_DLL/src/main.rs @@ -0,0 +1,30 @@ +#![cfg(windows)] +use std::ptr::null_mut; +use winapi::um::winuser::MessageBoxA; + +#[no_mangle] +#[allow(non_snake_case, unused_variables)] + +pub extern "C" fn popit() { + unsafe {MessageBoxA(null_mut(),"Rust DLL Test\0".as_ptr() as *const i8,"Rust DLL Test\0".as_ptr() as *const i8,0x00004000);} +} + + +//#[no_mangle] +//#[allow(non_snake_case, unused_variables)] +// fn DllMain( +// dll_module: HINSTANCE, +// call_reason: DWORD, +// reserved: LPVOID) +// -> BOOL +// { +// const DLL_PROCESS_ATTACH: DWORD = 1; +// const DLL_PROCESS_DETACH: DWORD = 0; + +// match call_reason { +// DLL_PROCESS_ATTACH => popit(), +// DLL_PROCESS_DETACH => (), +// _ => () +// } +// TRUE +// }