Skip to content

Commit

Permalink
E_POINTER
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed May 24, 2024
1 parent 40d35fa commit e3c7224
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/libs/core/src/inspectable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ impl RuntimeName for IInspectable {}
impl IInspectable_Vtbl {
pub const fn new<Identity: IUnknownImpl, Name: RuntimeName, const OFFSET: isize>() -> Self {
unsafe extern "system" fn GetIids(_: *mut c_void, count: *mut u32, values: *mut *mut GUID) -> HRESULT {
if count.is_null() || values.is_null() {
return imp::E_POINTER;
}
// Note: even if we end up implementing this in future, it still doesn't need a this pointer
// since the data to be returned is type- not instance-specific so can be shared for all
// interfaces.
Expand All @@ -64,11 +67,17 @@ impl IInspectable_Vtbl {
HRESULT(0)
}
unsafe extern "system" fn GetRuntimeClassName<T: RuntimeName>(_: *mut c_void, value: *mut *mut c_void) -> HRESULT {
if value.is_null() {
return imp::E_POINTER;
}
let h: HSTRING = T::NAME.into(); // TODO: should be try_into
*value = transmute::<HSTRING, *mut c_void>(h);
HRESULT(0)
}
unsafe extern "system" fn GetTrustLevel<T: IUnknownImpl, const OFFSET: isize>(this: *mut c_void, value: *mut i32) -> HRESULT {
if value.is_null() {
return imp::E_POINTER;
}
let this = (this as *mut *mut c_void).offset(OFFSET) as *mut T;
(*this).GetTrustLevel(value)
}
Expand Down

0 comments on commit e3c7224

Please sign in to comment.