Skip to content

Commit daaa627

Browse files
committed
chore: upgrade to windows-rs@0.28
1 parent 79fda26 commit daaa627

File tree

11 files changed

+54
-45
lines changed

11 files changed

+54
-45
lines changed

rust/Cargo.lock

Lines changed: 32 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/composition_processor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ruststringrange = { path = "../ruststringrange" }
1616
numberkey_windows = { path = "../numberkey_windows" }
1717

1818
[dependencies.windows]
19-
version = "0.26.0"
19+
version = "0.28.0"
2020
features = [
2121
"Win32_Foundation",
2222
"Win32_System_LibraryLoader",

rust/globals/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ name = "globals"
1111
crate-type = ["rlib", "staticlib"]
1212

1313
[dependencies]
14-
windows = "0.26.0"
14+
windows = "0.28.0"

rust/globals/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use windows::runtime::GUID;
1+
use windows::core::GUID;
22

33
//---------------------------------------------------------------------
44
// SampleIME CLSID

rust/ime/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ globals = { path = "../globals" }
1414
winreg = "0.10.1"
1515

1616
[dependencies.windows]
17-
version = "0.26.0"
17+
version = "0.28.0"
1818
features = [
1919
"Win32_System_Com",
2020
"Win32_System_SystemServices",

rust/ime/src/com.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use windows::runtime::{Interface, Result, GUID};
1+
use windows::core::{Interface, Result, GUID};
22
use windows::Win32::System::Com::{CoCreateInstance, CLSCTX_INPROC_SERVER};
33

44
pub fn create_instance_inproc<T: Interface>(clsid: &GUID) -> Result<T> {

rust/ime/src/dll.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use windows::runtime::HRESULT;
1+
use windows::core::HRESULT;
22
use windows::Win32::Foundation::{E_FAIL, HINSTANCE, S_OK};
33

44
use crate::registry;
@@ -10,9 +10,9 @@ pub static mut DLL_INSTANCE: HINSTANCE = HINSTANCE { 0: 0 };
1010
#[allow(non_snake_case)]
1111
#[doc(hidden)]
1212
pub unsafe extern "system" fn DllRegisterServer() -> HRESULT {
13-
unsafe fn register() -> windows::runtime::Result<()> {
13+
unsafe fn register() -> windows::core::Result<()> {
1414
registry::register_server(DLL_INSTANCE).map_err(|_| {
15-
windows::runtime::Error::new(E_FAIL, "Failed to register server".into())
15+
windows::core::Error::new(E_FAIL, "Failed to register server".into())
1616
})?;
1717
registry::register_profile(DLL_INSTANCE)?;
1818
registry::register_categories()?;

rust/ime/src/registry.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use globals::{SAMPLEIME_CLSID, SAMPLEIME_GUID_PROFILE};
2-
use windows::runtime::GUID;
2+
use windows::core::GUID;
33
use winreg::{enums::HKEY_CLASSES_ROOT, RegKey};
44

55
use crate::com::create_instance_inproc;
@@ -31,7 +31,7 @@ fn get_module_file_name(dll_instance_handle: HINSTANCE) -> String {
3131
}
3232
}
3333

34-
pub fn register_profile(dll_instance_handle: HINSTANCE) -> windows::runtime::Result<()> {
34+
pub fn register_profile(dll_instance_handle: HINSTANCE) -> windows::core::Result<()> {
3535
let profile_manager: ITfInputProcessorProfileMgr =
3636
create_instance_inproc(&CLSID_TF_InputProcessorProfiles)?;
3737

@@ -61,7 +61,7 @@ pub fn register_profile(dll_instance_handle: HINSTANCE) -> windows::runtime::Res
6161
Ok(())
6262
}
6363

64-
pub fn unregister_profile() -> Result<(), windows::runtime::Error> {
64+
pub fn unregister_profile() -> Result<(), windows::core::Error> {
6565
let profile_manager: ITfInputProcessorProfileMgr =
6666
create_instance_inproc(&CLSID_TF_InputProcessorProfiles)?;
6767

@@ -88,7 +88,7 @@ static SUPPORT_CATEGORIES: [GUID; 8] = [
8888
GUID_TFCAT_TIPCAP_SYSTRAYSUPPORT,
8989
];
9090

91-
pub fn register_categories() -> windows::runtime::Result<()> {
91+
pub fn register_categories() -> windows::core::Result<()> {
9292
let category_manager: ITfCategoryMgr = create_instance_inproc(&CLSID_TF_CategoryMgr)?;
9393

9494
for guid in SUPPORT_CATEGORIES {
@@ -100,7 +100,7 @@ pub fn register_categories() -> windows::runtime::Result<()> {
100100
Ok(())
101101
}
102102

103-
pub fn unregister_categories() -> windows::runtime::Result<()> {
103+
pub fn unregister_categories() -> windows::core::Result<()> {
104104
let category_manager: ITfCategoryMgr = create_instance_inproc(&CLSID_TF_CategoryMgr)?;
105105

106106
for guid in SUPPORT_CATEGORIES {

rust/itf_components/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ crate-type = ["staticlib"]
1313
globals = { path = "../globals" }
1414

1515
[dependencies.windows]
16-
version = "0.26.0"
16+
version = "0.28.0"
1717
features = [
1818
"build",
1919
"std",

rust/itf_components/src/compartment.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use std::ffi::c_void;
44

5-
use windows::runtime::{IUnknown, Interface, GUID, HRESULT};
5+
use windows::core::{IUnknown, Interface, GUID, HRESULT};
66
use windows::Win32::System::Com::VARIANT;
77
use windows::Win32::System::Ole::VT_I4;
88
use windows::Win32::UI::TextServices::{
@@ -28,7 +28,7 @@ impl Compartment {
2828
Box::from_raw(engine as *mut Compartment)
2929
}
3030

31-
fn get_compartment(&self) -> windows::runtime::Result<ITfCompartment> {
31+
fn get_compartment(&self) -> windows::core::Result<ITfCompartment> {
3232
let mut manager: Option<ITfCompartmentMgr> = None;
3333
unsafe {
3434
self.manager
@@ -38,17 +38,17 @@ impl Compartment {
3838
}
3939
}
4040

41-
pub fn get_bool(&self) -> windows::runtime::Result<bool> {
41+
pub fn get_bool(&self) -> windows::core::Result<bool> {
4242
// VT_BOOL also exists and maybe preferrable for better strictness
4343
// The Microsoft demo was using VT_I4 here, so this just follows that.
4444
Ok(self.get_u32()? != 0)
4545
}
4646

47-
pub fn set_bool(&self, flag: bool) -> windows::runtime::Result<()> {
47+
pub fn set_bool(&self, flag: bool) -> windows::core::Result<()> {
4848
self.set_u32(if flag { 1 } else { 0 })
4949
}
5050

51-
pub fn get_u32(&self) -> windows::runtime::Result<u32> {
51+
pub fn get_u32(&self) -> windows::core::Result<u32> {
5252
unsafe {
5353
let variant = self.get_compartment()?.GetValue()?;
5454
if variant.Anonymous.Anonymous.vt != VT_I4.0 as u16 {
@@ -58,7 +58,7 @@ impl Compartment {
5858
}
5959
}
6060

61-
pub fn set_u32(&self, data: u32) -> windows::runtime::Result<()> {
61+
pub fn set_u32(&self, data: u32) -> windows::core::Result<()> {
6262
let mut variant = VARIANT::default();
6363
unsafe {
6464
(*variant.Anonymous.Anonymous).vt = VT_I4.0 as u16;
@@ -68,7 +68,7 @@ impl Compartment {
6868
}
6969
}
7070

71-
pub fn clear(&self) -> windows::runtime::Result<()> {
71+
pub fn clear(&self) -> windows::core::Result<()> {
7272
if self.guid == GUID_COMPARTMENT_KEYBOARD_OPENCLOSE {
7373
return Ok(());
7474
}

0 commit comments

Comments
 (0)