Skip to content

Commit

Permalink
chore: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Feb 29, 2024
1 parent 8798344 commit 42c1ec8
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 61 deletions.
111 changes: 59 additions & 52 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ edition = "2021"

[dependencies]
anyhow = "1"
indexmap = "2.2.0"
indexmap = "2.2.3"
log = "0.4.20"
once_cell = "1.18.0"
rust-ini = "0.20.0"
simple-logging = "2.0.2"
xml = "0.8.10"

[dependencies.windows]
version = "0.52.0"
version = "0.54.0"
features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl App {
let ret = unsafe { GetMessageW(&mut message, HWND(0), 0, 0) };
match ret.0 {
-1 => {
unsafe { GetLastError() }?;
unsafe { GetLastError() }.ok()?;
}
0 => break,
_ => unsafe {
Expand Down
12 changes: 9 additions & 3 deletions src/startup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ impl Startup {
let path = get_exe_path();
let path_u8 = unsafe { path.align_to::<u8>().1 };
unsafe { RegSetValueExW(key.hkey, HKEY_NAME, 0, REG_SZ, Some(path_u8)) }
.ok()
.map_err(|err| anyhow!("Fail to write reg value, {:?}", err))?;
Ok(())
}

fn disable() -> Result<()> {
let key = get_key()?;
unsafe { RegDeleteValueW(key.hkey, HKEY_NAME) }
.ok()
.map_err(|err| anyhow!("Failed to delete reg value, {:?}", err))?;
Ok(())
}
Expand All @@ -83,6 +85,7 @@ fn get_key() -> Result<WrapHKey> {
&mut hkey as *mut _,
)
}
.ok()
.map_err(|err| anyhow!("Fail to open reg key, {:?}", err))?;
Ok(WrapHKey { hkey })
}
Expand All @@ -102,11 +105,14 @@ fn get_value(hkey: &HKEY) -> Result<Option<Vec<u16>>> {
Some(&mut size),
)
};
if let Err(err) = ret {
if err.code() == ERROR_FILE_NOT_FOUND.to_hresult() {
if ret.is_err() {
if ret == ERROR_FILE_NOT_FOUND {
return Ok(None);
}
bail!("Fail to get reg value, {:?}", err);
bail!(
"Fail to get reg value, {:?}",
windows::core::Error::from(ret)
);
}
let len = (size as usize - 1) / 2;
Ok(Some(buffer[..len].to_vec()))
Expand Down
2 changes: 1 addition & 1 deletion src/utils/check_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ where
SetLastError(ERROR_SUCCESS);
let result = f();
let error = Error::from_win32();
if error == Error::OK {
if error == Error::empty() {
Ok(result)
} else {
Err(error)
Expand Down
4 changes: 2 additions & 2 deletions tools/inspect-windows/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ edition = "2021"

[dependencies]
anyhow = "1"
indexmap = "2.0.0"
indexmap = "2.2.3"
window-switcher = { path = "../.."}

[dependencies.windows]
version = "0.52.0"
version = "0.54.0"
features = [
"Win32_Foundation",
"Win32_UI_WindowsAndMessaging",
Expand Down

0 comments on commit 42c1ec8

Please sign in to comment.