windows 0.52 -> 0.54 (#855)
This commit is contained in:
parent
f894781e7e
commit
4502781298
4 changed files with 17 additions and 21 deletions
|
|
@ -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 ()>,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue