Skip to content

Commit

Permalink
get_wintun_bin_pattern_path issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Nov 9, 2024
1 parent fe3a0a7 commit 2570303
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
5 changes: 4 additions & 1 deletion examples/basic-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ static RUNNING: AtomicBool = AtomicBool::new(true);
async fn main() -> Result<(), BoxError> {
dotenvy::dotenv().ok();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();
let dll_path = get_wintun_bin_pattern_path()?;
let mut dll_path = get_wintun_bin_pattern_path()?;
if !std::fs::exists(&dll_path)? {
dll_path = "wintun.dll".into();
}
let wintun = unsafe { load_from_path(dll_path)? };

let version = get_running_driver_version(&wintun);
Expand Down
5 changes: 4 additions & 1 deletion examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ static RUNNING: AtomicBool = AtomicBool::new(true);
fn main() -> Result<(), wintun_bindings::BoxError> {
dotenvy::dotenv().ok();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();
let dll_path = wintun_bindings::get_wintun_bin_pattern_path()?;
let mut dll_path = wintun_bindings::get_wintun_bin_pattern_path()?;
if !std::fs::exists(&dll_path)? {
dll_path = "wintun.dll".into();
}
let wintun = unsafe { wintun_bindings::load_from_path(dll_path)? };

let version = wintun_bindings::get_running_driver_version(&wintun);
Expand Down
5 changes: 4 additions & 1 deletion examples/udp-echo-async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ async fn main() -> Result<(), BoxError> {
dotenvy::dotenv().ok();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();
// Loading wintun
let dll_path = get_wintun_bin_pattern_path()?;
let mut dll_path = get_wintun_bin_pattern_path()?;
if !std::fs::exists(&dll_path)? {
dll_path = "wintun.dll".into();
}
let wintun = unsafe { load_from_path(dll_path)? };

let version = get_running_driver_version(&wintun);
Expand Down
5 changes: 4 additions & 1 deletion examples/udp-echo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,10 @@ fn main() -> Result<(), BoxError> {
dotenvy::dotenv().ok();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();
// Loading wintun
let dll_path = get_wintun_bin_pattern_path()?;
let mut dll_path = get_wintun_bin_pattern_path()?;
if !std::fs::exists(&dll_path)? {
dll_path = "wintun.dll".into();
}
let wintun = unsafe { load_from_path(dll_path)? };

let version = get_running_driver_version(&wintun);
Expand Down
5 changes: 4 additions & 1 deletion examples/wireshark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ fn main() -> Result<(), BoxError> {
dotenvy::dotenv().ok();
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("trace")).init();

let dll_path = get_wintun_bin_pattern_path()?;
let mut dll_path = get_wintun_bin_pattern_path()?;
if !std::fs::exists(&dll_path)? {
dll_path = "wintun.dll".into();
}
let wintun = unsafe { wintun_bindings::load_from_path(dll_path)? };

let adapter = match wintun_bindings::Adapter::open(&wintun, "Demo") {
Expand Down
2 changes: 1 addition & 1 deletion src/fn_holder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ macro_rules! define_fn_dynamic_load {
// usage
use windows_sys::Win32::Foundation::BOOL;
define_fn_dynamic_load!(
ProcessPrngDeclear,
ProcessPrngDeclare,
unsafe extern "system" fn(pbdata: *mut u8, cbdata: usize) -> BOOL,
PROCESS_PRNG,
ProcessPrng,
Expand Down

0 comments on commit 2570303

Please sign in to comment.