use crate::error::Result;
use crate::platform::windows::error::check_status;
windows_link::link!("dnsapi.dll" "system" fn DnsFlushResolverCache() -> u32);
pub(crate) fn flush() -> Result<()> {
let result = unsafe { DnsFlushResolverCache() };
check_status(result as i32, "DnsFlushResolverCache").map_err(|error| match error {
crate::error::Error::Platform { backend, message } => crate::error::Error::Platform {
backend,
message: format!("{message} (is the DNS Client service running?)"),
},
other => other,
})
}