1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-07 20:24:01 +00:00

convert printlns in autotype crate

This commit is contained in:
neuronull
2025-09-15 19:47:45 -06:00
parent 07127e73a9
commit 72ae6c0fe7
3 changed files with 4 additions and 1 deletions

View File

@@ -353,6 +353,7 @@ checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
name = "autotype"
version = "0.0.0"
dependencies = [
"tracing",
"windows 0.61.1",
"windows-core 0.61.0",
]

View File

@@ -6,6 +6,7 @@ edition.workspace = true
publish.workspace = true
[target.'cfg(windows)'.dependencies]
tracing.workspace = true
windows = { workspace = true, features = [
"Win32_UI_Input_KeyboardAndMouse",
"Win32_UI_WindowsAndMessaging",

View File

@@ -1,6 +1,7 @@
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;
use tracing::debug;
use windows::Win32::Foundation::{GetLastError, HWND};
use windows::Win32::UI::Input::KeyboardAndMouse::{
SendInput, INPUT, INPUT_0, INPUT_KEYBOARD, KEYBDINPUT, KEYEVENTF_KEYUP, KEYEVENTF_UNICODE,
@@ -187,7 +188,7 @@ fn send_input(inputs: Vec<INPUT>) -> Result<(), ()> {
let insert_count = unsafe { SendInput(&inputs, std::mem::size_of::<INPUT>() as i32) };
let e = unsafe { GetLastError().to_hresult().message() };
println!("type_input() called, GetLastError() is: {:?}", e);
debug!("type_input() called, GetLastError() is: {:?}", e);
if insert_count == 0 {
return Err(()); // input was blocked by another thread