diff --git a/src/raw/windows.rs b/src/raw/windows.rs index 084d91c..02eed61 100644 --- a/src/raw/windows.rs +++ b/src/raw/windows.rs @@ -129,7 +129,10 @@ pub unsafe fn get_sym(handle: Handle, name: &CStr) -> Result<*mut (), Error> { #[inline] pub unsafe fn open_lib(name: &OsStr) -> Result { let wide_name: Vec = name.encode_wide().chain(Some(0)).collect(); - let _guard = ErrorModeGuard::new()?; + let _guard = match ErrorModeGuard::new() { + Ok(val) => val, + Err(err) => return Error::OpeningLibraryError(err), + }; let handle = kernel32::LoadLibraryW(wide_name.as_ptr()); if handle.is_null() { Err(Error::OpeningLibraryError(get_win_error()))