fix switch to primary display but can't see UAC (#8527)

How to reproduce: elevate at primary display->switch to another
display->
trigger UAC->switch to primary display->can't see UAC

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-06-29 17:14:09 +08:00 committed by GitHub
parent d67afa49b4
commit f9b0a88213
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -186,9 +186,10 @@ mod utils {
let rptr = counter.add(size_of::<i32>());
let iw = ptr_to_i32(counter);
let ir = ptr_to_i32(counter);
let v = i32_to_vec(iw + 1);
let iw_plus1 = if iw == i32::MAX { 0 } else { iw + 1 };
let v = i32_to_vec(iw_plus1);
std::ptr::copy_nonoverlapping(v.as_ptr(), wptr, size_of::<i32>());
if ir == iw + 1 {
if ir == iw_plus1 {
let v = i32_to_vec(iw);
std::ptr::copy_nonoverlapping(v.as_ptr(), rptr, size_of::<i32>());
}
@ -404,15 +405,15 @@ pub mod server {
}
},
Some(Err(e)) => {
if crate::platform::windows::desktop_changed() {
crate::platform::try_change_desktop();
c = None;
std::thread::sleep(spf);
continue;
}
if e.kind() != std::io::ErrorKind::WouldBlock {
// DXGI_ERROR_INVALID_CALL after each success on Microsoft GPU driver
// log::error!("capture frame failed: {:?}", e);
if crate::platform::windows::desktop_changed() {
crate::platform::try_change_desktop();
c = None;
std::thread::sleep(spf);
continue;
}
if c.as_ref().map(|c| c.is_gdi()) == Some(false) {
// nog gdi
dxgi_failed_times += 1;