From 18498cb0150023acf8e9c4b6817d7f04cac058fe Mon Sep 17 00:00:00 2001 From: Kenny Kerr Date: Mon, 22 Apr 2024 12:09:53 -0500 Subject: [PATCH] Use generated `E_POINTER` constant in `windows-core` (#3008) --- crates/libs/core/src/imp/com_bindings.rs | 1 + crates/libs/core/src/imp/weak_ref_count.rs | 4 ++-- crates/libs/core/tests/com_bindings.txt | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/libs/core/src/imp/com_bindings.rs b/crates/libs/core/src/imp/com_bindings.rs index 382757438b..07889c1c64 100644 --- a/crates/libs/core/src/imp/com_bindings.rs +++ b/crates/libs/core/src/imp/com_bindings.rs @@ -62,6 +62,7 @@ impl Default for DateTime { pub const E_BOUNDS: windows_core::HRESULT = windows_core::HRESULT(0x8000000B_u32 as _); pub const E_NOINTERFACE: windows_core::HRESULT = windows_core::HRESULT(0x80004002_u32 as _); pub const E_OUTOFMEMORY: windows_core::HRESULT = windows_core::HRESULT(0x8007000E_u32 as _); +pub const E_POINTER: windows_core::HRESULT = windows_core::HRESULT(0x80004003_u32 as _); windows_core::imp::define_interface!(IAgileObject, IAgileObject_Vtbl, 0x94ea2b94_e9cc_49e0_c0ff_ee64ca8f5b90); impl std::ops::Deref for IAgileObject { type Target = windows_core::IUnknown; diff --git a/crates/libs/core/src/imp/weak_ref_count.rs b/crates/libs/core/src/imp/weak_ref_count.rs index 11ca1bb047..92a4150735 100644 --- a/crates/libs/core/src/imp/weak_ref_count.rs +++ b/crates/libs/core/src/imp/weak_ref_count.rs @@ -127,7 +127,7 @@ impl TearOff { let this = Self::from_strong_ptr(ptr); if iid.is_null() || interface.is_null() { - return windows_core::HRESULT(-2147467261); // E_POINTER + return E_POINTER; } // Only directly respond to queries for the the tear-off's strong interface. This is @@ -147,7 +147,7 @@ impl TearOff { let this = Self::from_weak_ptr(ptr); if iid.is_null() || interface.is_null() { - return windows_core::HRESULT(-2147467261); // E_POINTER + return E_POINTER; } // While the weak vtable is packed into the same allocation as the strong vtable and diff --git a/crates/libs/core/tests/com_bindings.txt b/crates/libs/core/tests/com_bindings.txt index ad4d881461..d20b3d353a 100644 --- a/crates/libs/core/tests/com_bindings.txt +++ b/crates/libs/core/tests/com_bindings.txt @@ -11,6 +11,7 @@ Windows.Win32.Foundation.E_BOUNDS Windows.Win32.Foundation.E_NOINTERFACE Windows.Win32.Foundation.E_OUTOFMEMORY + Windows.Win32.Foundation.E_POINTER Windows.Win32.Foundation.JSCRIPT_E_CANTEXECUTE Windows.Win32.Foundation.RPC_E_DISCONNECTED Windows.Win32.Foundation.TYPE_E_TYPEMISMATCH