Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![crate_type = "dylib"]
- #![feature(libc)]
- extern crate libc;
- extern crate user32;
- use std::ffi::CString;
- #[no_mangle]
- #[allow(unused, non_snake_case)]
- pub extern "C" fn GetAdaptersInfo(pAdapterInfo: *mut libc::c_void, pOutBufLen: *mut libc::c_ulong) -> libc::c_ulong {
- 0
- }
- #[no_mangle]
- #[allow(unused, non_snake_case)]
- pub extern "stdcall" fn DllMain(module: u32, reason_for_call: u32, reserved: *mut libc::c_void) {
- match reason_for_call {
- 0 => { // DLL_PROCESS_DETACH
- ()
- },
- 1 => { // DLL_PROCESS_ATTACH
- let message = CString::new("Hello!").unwrap();
- unsafe {
- user32::MessageBoxA(std::ptr::null_mut(), message.as_ptr(), message.as_ptr(), 0);
- }
- },
- 2 => { // DLL_THREAD_ATTACH
- ()
- },
- 3 => { // DLL_THREAD_DETACH
- ()
- },
- _ => () // who gives a shit
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement