#![no_std]
#[cfg(target_os = "windows")]
use windows::core::s;
#[cfg(target_os = "windows")]
use windows::Win32::System::LibraryLoader::{GetModuleHandleA, GetProcAddress};
#[cfg(not(any(target_os = "windows", doc)))]
pub fn is_wine() -> bool {
return false;
}
#[cfg(all(target_os = "windows", not(doc)))]
pub fn is_wine() -> bool {
unsafe {
let Ok(handle) = GetModuleHandleA(s!("ntdll.dll")) else {
return false;
};
return GetProcAddress(handle, s!("wine_get_version")).is_some();
}
}
#[cfg(doc)]
pub fn is_wine() -> bool {
unimplemented!("This function only exists for documentation purposes");
}