windows 0.52 -> 0.54 (#855)
This commit is contained in:
parent
f894781e7e
commit
4502781298
4 changed files with 17 additions and 21 deletions
|
|
@ -26,7 +26,7 @@ clap = { version = "4.0", features = ["derive"] }
|
|||
ndk-glue = "0.7"
|
||||
|
||||
[target.'cfg(target_os = "windows")'.dependencies]
|
||||
windows = { version = "0.52.0", features = [
|
||||
windows = { version = "0.54.0", features = [
|
||||
"Win32_Media_Audio",
|
||||
"Win32_Foundation",
|
||||
"Win32_Devices_Properties",
|
||||
|
|
|
|||
|
|
@ -15,18 +15,17 @@ thread_local!(static COM_INITIALIZED: ComInitialized = {
|
|||
// That's OK though since COM ensures thread-safety/compatibility through marshalling when
|
||||
// necessary.
|
||||
let result = CoInitializeEx(None, COINIT_APARTMENTTHREADED);
|
||||
match result.clone().map_err(|e| e.code()) {
|
||||
Ok(_) |
|
||||
Err(RPC_E_CHANGED_MODE) => {
|
||||
ComInitialized {
|
||||
result,
|
||||
_ptr: PhantomData,
|
||||
}
|
||||
},
|
||||
Err(e) => {
|
||||
// COM initialization failed in another way, something is really wrong.
|
||||
panic!("Failed to initialize COM: {}", IoError::from_raw_os_error(e.0));
|
||||
if result.is_ok() || result == RPC_E_CHANGED_MODE {
|
||||
ComInitialized {
|
||||
result,
|
||||
_ptr: PhantomData,
|
||||
}
|
||||
} else {
|
||||
// COM initialization failed in another way, something is really wrong.
|
||||
panic!(
|
||||
"Failed to initialize COM: {}",
|
||||
IoError::from_raw_os_error(result.0)
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -36,7 +35,7 @@ thread_local!(static COM_INITIALIZED: ComInitialized = {
|
|||
// We store a raw pointer because it's the only way at the moment to remove `Send`/`Sync` from the
|
||||
// object.
|
||||
struct ComInitialized {
|
||||
result: windows::core::Result<()>,
|
||||
result: windows::core::HRESULT,
|
||||
_ptr: PhantomData<*mut ()>,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use std::time::Duration;
|
|||
|
||||
use super::com;
|
||||
use super::{windows_err_to_cpal_err, windows_err_to_cpal_err_message};
|
||||
use windows::core::ComInterface;
|
||||
use windows::core::Interface;
|
||||
use windows::core::GUID;
|
||||
use windows::Win32::Devices::Properties;
|
||||
use windows::Win32::Foundation;
|
||||
|
|
@ -297,10 +297,10 @@ impl Device {
|
|||
DeviceNameError::from(err)
|
||||
})?;
|
||||
|
||||
let prop_variant = &property_value.Anonymous.Anonymous;
|
||||
let prop_variant = &property_value.as_raw().Anonymous.Anonymous;
|
||||
|
||||
// Read the friendly-name from the union data field, expecting a *const u16.
|
||||
if prop_variant.vt != VT_LPWSTR {
|
||||
if prop_variant.vt != VT_LPWSTR.0 {
|
||||
let description = format!(
|
||||
"property store produced invalid data: {:?}",
|
||||
prop_variant.vt
|
||||
|
|
|
|||
|
|
@ -243,11 +243,8 @@ fn wait_for_handle_signal(handles: &[Foundation::HANDLE]) -> Result<usize, Backe
|
|||
)
|
||||
};
|
||||
if result == Foundation::WAIT_FAILED {
|
||||
let err = match unsafe { Foundation::GetLastError() } {
|
||||
Ok(()) => windows::core::Error::OK,
|
||||
Err(err) => err,
|
||||
};
|
||||
let description = format!("`WaitForMultipleObjectsEx failed: {}", err);
|
||||
let err = unsafe { Foundation::GetLastError() };
|
||||
let description = format!("`WaitForMultipleObjectsEx failed: {:?}", err);
|
||||
let err = BackendSpecificError { description };
|
||||
return Err(err);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue