Skip to content

Commit

Permalink
Improve error message when opening AFD device
Browse files Browse the repository at this point in the history
  • Loading branch information
Darksonn authored and Thomasdezeeuw committed Feb 22, 2021
1 parent 20b7298 commit 139f7c4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/sys/windows/afd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ cfg_io_source! {
0 as ULONG,
);
if status != STATUS_SUCCESS {
return Err(io::Error::from_raw_os_error(
let raw_err = io::Error::from_raw_os_error(
RtlNtStatusToDosError(status) as i32
));
);
let msg = format!("Failed to open \\Device\\Afd\\Mio: {}", raw_err);
return Err(io::Error::new(raw_err.kind(), msg));
}
let fd = File::from_raw_handle(afd_helper_handle as RawHandle);
// Increment by 2 to reserve space for other types of handles.
Expand Down

0 comments on commit 139f7c4

Please sign in to comment.