diff --git a/libs/scrap/src/dxgi/mag.rs b/libs/scrap/src/dxgi/mag.rs index 52404b3af..89ed44b9f 100644 --- a/libs/scrap/src/dxgi/mag.rs +++ b/libs/scrap/src/dxgi/mag.rs @@ -173,7 +173,10 @@ impl MagInterface { if FALSE == init_func() { return Err(Error::new( ErrorKind::Other, - format!("Failed to MagInitialize, error: {:?}", Error::last_os_error()), + format!( + "Failed to MagInitialize, error: {:?}", + Error::last_os_error() + ), )); } else { s.init_succeeded = true; @@ -315,7 +318,10 @@ impl CapturerMag { ) { return Err(Error::new( ErrorKind::Other, - format!("Failed to GetModuleHandleExA, error {:?}", Error::last_os_error()), + format!( + "Failed to GetModuleHandleExA, error {:?}", + Error::last_os_error() + ), )); } @@ -342,7 +348,10 @@ impl CapturerMag { if code != ERROR_CLASS_ALREADY_EXISTS { return Err(Error::new( ErrorKind::Other, - format!("Failed to RegisterClassExA, error: {}", code), + format!( + "Failed to RegisterClassExA, error {:?}", + Error::from_raw_os_error(code as _) + ), )); } } @@ -546,7 +555,10 @@ impl CapturerMag { if FALSE == set_window_source_func(self.magnifier_window, self.rect) { return Err(Error::new( ErrorKind::Other, - format!("Failed to MagSetWindowSource, error {:?}", Error::last_os_error()), + format!( + "Failed to MagSetWindowSource, error {:?}", + Error::last_os_error() + ), )); } } else { @@ -578,7 +590,10 @@ impl CapturerMag { unsafe { if FALSE == DestroyWindow(self.magnifier_window) { // - println!("Failed DestroyWindow magnifier window, error {:?}", Error::last_os_error()) + println!( + "Failed DestroyWindow magnifier window, error {:?}", + Error::last_os_error() + ) } } } @@ -588,7 +603,10 @@ impl CapturerMag { unsafe { if FALSE == DestroyWindow(self.host_window) { // - println!("Failed DestroyWindow host window, error {:?}", Error::last_os_error()) + println!( + "Failed DestroyWindow host window, error {:?}", + Error::last_os_error() + ) } } } diff --git a/src/platform/windows.rs b/src/platform/windows.rs index 34d85a6cd..c85c39d34 100644 --- a/src/platform/windows.rs +++ b/src/platform/windows.rs @@ -1738,11 +1738,11 @@ pub fn create_process_with_logon(user: &str, pwd: &str, exe: &str, arg: &str) -> { let last_error = GetLastError(); bail!( - "CreateProcessWithLogonW failed : \"{}\", errno={}", + "CreateProcessWithLogonW failed : \"{}\", error {:?}", last_error_table .get(&last_error) .unwrap_or(&"Unknown error"), - last_error + io::Error::from_raw_os_error(last_error as _) ); } }