windows: Bump windows-rs version (#14719)

Release Notes:

- N/A
This commit is contained in:
张小白 2024-07-26 01:41:59 +08:00 committed by GitHub
parent 82d6ad4616
commit d2501e8886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 164 additions and 90 deletions

View file

@ -12,3 +12,7 @@ rustflags = ["-C", "link-arg=-fuse-ld=mold"]
[target.aarch64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-C", "link-arg=-fuse-ld=mold"]
# This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes
[target.'cfg(target_os = "windows")']
rustflags = ["--cfg", "windows_slim_errors"]

117
Cargo.lock generated
View file

@ -2142,7 +2142,7 @@ dependencies = [
"num-traits",
"serde",
"wasm-bindgen",
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
@ -2353,7 +2353,7 @@ dependencies = [
"tiny_http",
"url",
"util",
"windows 0.57.0",
"windows 0.58.0",
"worktree",
]
@ -4331,7 +4331,7 @@ dependencies = [
"text",
"time",
"util",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -4651,7 +4651,7 @@ dependencies = [
"unindent",
"url",
"util",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -4874,8 +4874,8 @@ dependencies = [
"wayland-cursor",
"wayland-protocols",
"wayland-protocols-plasma",
"windows 0.57.0",
"windows-core 0.57.0",
"windows 0.58.0",
"windows-core 0.58.0",
"x11-clipboard",
"x11rb",
"xim",
@ -6314,7 +6314,7 @@ dependencies = [
"serde_json",
"smol",
"util",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -6794,7 +6794,7 @@ dependencies = [
"tempfile",
"util",
"walkdir",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -10768,7 +10768,7 @@ dependencies = [
"theme",
"thiserror",
"util",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -11094,7 +11094,7 @@ dependencies = [
"ui",
"util",
"vcs_menu",
"windows 0.57.0",
"windows 0.58.0",
"workspace",
"zed_actions",
]
@ -11722,7 +11722,7 @@ dependencies = [
"story",
"strum",
"theme",
"windows 0.57.0",
"windows 0.58.0",
]
[[package]]
@ -12857,17 +12857,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core 0.52.0",
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
name = "windows"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143"
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core 0.57.0",
"windows-targets 0.52.5",
"windows-core 0.58.0",
"windows-targets 0.52.6",
]
[[package]]
@ -12876,26 +12876,27 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
dependencies = [
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-core"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d"
checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"
dependencies = [
"windows-implement",
"windows-interface",
"windows-result",
"windows-targets 0.52.5",
"windows-strings",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-implement"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7"
checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
dependencies = [
"proc-macro2",
"quote",
@ -12904,9 +12905,9 @@ dependencies = [
[[package]]
name = "windows-interface"
version = "0.57.0"
version = "0.58.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7"
checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
dependencies = [
"proc-macro2",
"quote",
@ -12915,11 +12916,21 @@ dependencies = [
[[package]]
name = "windows-result"
version = "0.1.1"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "749f0da9cc72d82e600d8d2e44cadd0b9eedb9038f71a1c58556ac1c5791813b"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
name = "windows-strings"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result",
"windows-targets 0.52.6",
]
[[package]]
@ -12946,7 +12957,7 @@ version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
"windows-targets 0.52.5",
"windows-targets 0.52.6",
]
[[package]]
@ -12981,18 +12992,18 @@ dependencies = [
[[package]]
name = "windows-targets"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
"windows_aarch64_gnullvm 0.52.5",
"windows_aarch64_msvc 0.52.5",
"windows_i686_gnu 0.52.5",
"windows_aarch64_gnullvm 0.52.6",
"windows_aarch64_msvc 0.52.6",
"windows_i686_gnu 0.52.6",
"windows_i686_gnullvm",
"windows_i686_msvc 0.52.5",
"windows_x86_64_gnu 0.52.5",
"windows_x86_64_gnullvm 0.52.5",
"windows_x86_64_msvc 0.52.5",
"windows_i686_msvc 0.52.6",
"windows_x86_64_gnu 0.52.6",
"windows_x86_64_gnullvm 0.52.6",
"windows_x86_64_msvc 0.52.6",
]
[[package]]
@ -13009,9 +13020,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
name = "windows_aarch64_msvc"
@ -13027,9 +13038,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
name = "windows_i686_gnu"
@ -13045,15 +13056,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
[[package]]
name = "windows_i686_gnu"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
[[package]]
name = "windows_i686_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
name = "windows_i686_msvc"
@ -13069,9 +13080,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
[[package]]
name = "windows_i686_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
name = "windows_x86_64_gnu"
@ -13087,9 +13098,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
name = "windows_x86_64_gnullvm"
@ -13105,9 +13116,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
name = "windows_x86_64_msvc"
@ -13123,9 +13134,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.5"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "winnow"

View file

@ -445,7 +445,7 @@ wit-component = "0.201"
sys-locale = "0.3.1"
[workspace.dependencies.windows]
version = "0.57"
version = "0.58"
features = [
"implement",
"Foundation_Numerics",

View file

@ -150,7 +150,7 @@ x11-clipboard = "0.9.2"
[target.'cfg(windows)'.dependencies]
windows.workspace = true
windows-core = "0.57"
windows-core = "0.58"
[[example]]
name = "hello_world"

View file

@ -6,6 +6,7 @@ mod platform;
mod system_settings;
mod util;
mod window;
mod wrapper;
pub(crate) use direct_write::*;
pub(crate) use dispatcher::*;
@ -15,5 +16,6 @@ pub(crate) use platform::*;
pub(crate) use system_settings::*;
pub(crate) use util::*;
pub(crate) use window::*;
pub(crate) use wrapper::*;
pub(crate) use windows::Win32::Foundation::HWND;

View file

@ -924,7 +924,7 @@ struct RendererContext<'t, 'a, 'b> {
}
#[allow(non_snake_case)]
impl IDWritePixelSnapping_Impl for TextRenderer {
impl IDWritePixelSnapping_Impl for TextRenderer_Impl {
fn IsPixelSnappingDisabled(
&self,
_clientdrawingcontext: *const ::core::ffi::c_void,
@ -959,7 +959,7 @@ impl IDWritePixelSnapping_Impl for TextRenderer {
}
#[allow(non_snake_case)]
impl IDWriteTextRenderer_Impl for TextRenderer {
impl IDWriteTextRenderer_Impl for TextRenderer_Impl {
fn DrawGlyphRun(
&self,
clientdrawingcontext: *const ::core::ffi::c_void,

View file

@ -27,6 +27,10 @@ pub(crate) struct WindowsDisplay {
uuid: Uuid,
}
// The `HMONITOR` is thread-safe.
unsafe impl Send for WindowsDisplay {}
unsafe impl Sync for WindowsDisplay {}
impl WindowsDisplay {
pub(crate) fn new(display_id: DisplayId) -> Option<Self> {
let screen = available_monitors().into_iter().nth(display_id.0 as _)?;

View file

@ -217,7 +217,7 @@ fn handle_destroy_msg(handle: HWND, state_ptr: Rc<WindowsWindowStatePtr>) -> Opt
callback();
}
unsafe {
PostMessageW(None, CLOSE_ONE_WINDOW, None, LPARAM(handle.0)).log_err();
PostMessageW(None, CLOSE_ONE_WINDOW, None, LPARAM(handle.0 as isize)).log_err();
}
Some(0)
}
@ -1040,7 +1040,7 @@ fn handle_nc_mouse_up_msg(
}
fn handle_cursor_changed(lparam: LPARAM, state_ptr: Rc<WindowsWindowStatePtr>) -> Option<isize> {
state_ptr.state.borrow_mut().current_cursor = HCURSOR(lparam.0);
state_ptr.state.borrow_mut().current_cursor = HCURSOR(lparam.0 as _);
Some(0)
}

View file

@ -191,7 +191,7 @@ impl Platform for WindowsPlatform {
match msg.message {
WM_QUIT => break 'a,
CLOSE_ONE_WINDOW => {
if self.close_one_window(HWND(msg.lParam.0)) {
if self.close_one_window(HWND(msg.lParam.0 as _)) {
break 'a;
}
}
@ -484,7 +484,7 @@ impl Platform for WindowsPlatform {
let hcursor = load_cursor(style);
let mut lock = self.state.borrow_mut();
if lock.current_cursor.0 != hcursor.0 {
self.post_message(CURSOR_STYLE_CHANGED, WPARAM(0), LPARAM(hcursor.0));
self.post_message(CURSOR_STYLE_CHANGED, WPARAM(0), LPARAM(hcursor.0 as isize));
lock.current_cursor = hcursor;
}
}
@ -595,7 +595,7 @@ fn open_target(target: &str) {
None,
SW_SHOWDEFAULT,
);
if ret.0 <= 32 {
if ret.0 as isize <= 32 {
log::error!("Unable to open target: {}", std::io::Error::last_os_error());
}
}
@ -611,7 +611,7 @@ fn open_target_in_explorer(target: &str) {
None,
SW_SHOWDEFAULT,
);
if ret.0 <= 32 {
if ret.0 as isize <= 32 {
log::error!(
"Unable to open target in explorer: {}",
std::io::Error::last_os_error()
@ -643,11 +643,12 @@ unsafe fn show_savefile_dialog(directory: PathBuf) -> Result<IFileSaveDialog> {
Ok(dialog)
}
fn begin_vsync(vsync_evnet: HANDLE) {
fn begin_vsync(vsync_event: HANDLE) {
let event: SafeHandle = vsync_event.into();
std::thread::spawn(move || unsafe {
loop {
windows::Win32::Graphics::Dwm::DwmFlush().log_err();
SetEvent(vsync_evnet).log_err();
SetEvent(*event).log_err();
}
});
}
@ -723,7 +724,7 @@ fn set_data_to_clipboard(data: &[u16], format: u32) -> Result<()> {
let handle = GlobalLock(global);
u_memcpy(handle as _, data.as_ptr(), data.len() as _);
let _ = GlobalUnlock(global);
SetClipboardData(format, HANDLE(global.0 as isize))?;
SetClipboardData(format, HANDLE(global.0))?;
}
Ok(())
}

View file

@ -85,13 +85,13 @@ pub(crate) fn windows_credentials_target_name(url: &str) -> String {
}
pub(crate) fn load_cursor(style: CursorStyle) -> HCURSOR {
static ARROW: OnceLock<HCURSOR> = OnceLock::new();
static IBEAM: OnceLock<HCURSOR> = OnceLock::new();
static CROSS: OnceLock<HCURSOR> = OnceLock::new();
static HAND: OnceLock<HCURSOR> = OnceLock::new();
static SIZEWE: OnceLock<HCURSOR> = OnceLock::new();
static SIZENS: OnceLock<HCURSOR> = OnceLock::new();
static NO: OnceLock<HCURSOR> = OnceLock::new();
static ARROW: OnceLock<SafeCursor> = OnceLock::new();
static IBEAM: OnceLock<SafeCursor> = OnceLock::new();
static CROSS: OnceLock<SafeCursor> = OnceLock::new();
static HAND: OnceLock<SafeCursor> = OnceLock::new();
static SIZEWE: OnceLock<SafeCursor> = OnceLock::new();
static SIZENS: OnceLock<SafeCursor> = OnceLock::new();
static NO: OnceLock<SafeCursor> = OnceLock::new();
let (lock, name) = match style {
CursorStyle::IBeam | CursorStyle::IBeamCursorForVerticalLayout => (&IBEAM, IDC_IBEAM),
CursorStyle::Crosshair => (&CROSS, IDC_CROSS),
@ -107,14 +107,15 @@ pub(crate) fn load_cursor(style: CursorStyle) -> HCURSOR {
CursorStyle::OperationNotAllowed => (&NO, IDC_NO),
_ => (&ARROW, IDC_ARROW),
};
*lock.get_or_init(|| {
*(*lock.get_or_init(|| {
HCURSOR(
unsafe { LoadImageW(None, name, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED) }
.log_err()
.unwrap_or_default()
.0,
)
})
.into()
}))
}
#[inline]

View file

@ -297,7 +297,7 @@ impl WindowsWindow {
current_cursor,
};
let lpparam = Some(&context as *const _ as *const _);
let raw_hwnd = unsafe {
let creation_result = unsafe {
CreateWindowExW(
dwexstyle,
classname,
@ -313,7 +313,10 @@ impl WindowsWindow {
lpparam,
)
};
// We should call `?` on state_ptr first, then call `?` on raw_hwnd.
// Or, we will lose the error info reported by `WindowsWindowState::new`
let state_ptr = context.inner.take().unwrap()?;
let raw_hwnd = creation_result?;
register_drag_drop(state_ptr.clone())?;
unsafe {
@ -343,9 +346,10 @@ impl WindowsWindow {
impl rwh::HasWindowHandle for WindowsWindow {
fn window_handle(&self) -> std::result::Result<rwh::WindowHandle<'_>, rwh::HandleError> {
let raw =
rwh::Win32WindowHandle::new(unsafe { NonZeroIsize::new_unchecked(self.0.hwnd.0) })
.into();
let raw = rwh::Win32WindowHandle::new(unsafe {
NonZeroIsize::new_unchecked(self.0.hwnd.0 as isize)
})
.into();
Ok(unsafe { rwh::WindowHandle::borrow_raw(raw) })
}
}
@ -509,8 +513,8 @@ impl PlatformWindow for WindowsWindow {
fn activate(&self) {
let hwnd = self.0.hwnd;
unsafe { SetActiveWindow(hwnd) };
unsafe { SetFocus(hwnd) };
unsafe { SetActiveWindow(hwnd).log_err() };
unsafe { SetFocus(hwnd).log_err() };
// todo(windows)
// crate `windows 0.56` reports true as Err
unsafe { SetForegroundWindow(hwnd).as_bool() };
@ -678,7 +682,7 @@ impl WindowsDragDropHandler {
}
#[allow(non_snake_case)]
impl IDropTarget_Impl for WindowsDragDropHandler {
impl IDropTarget_Impl for WindowsDragDropHandler_Impl {
fn DragEnter(
&self,
pdataobj: Option<&IDataObject>,
@ -956,7 +960,7 @@ unsafe extern "system" fn wnd_proc(
}
pub(crate) fn try_get_window_inner(hwnd: HWND) -> Option<Rc<WindowsWindowStatePtr>> {
if hwnd == HWND(0) {
if hwnd.is_invalid() {
return None;
}
@ -1058,7 +1062,7 @@ mod windows_renderer {
};
pub(super) fn windows_renderer(hwnd: HWND, transparent: bool) -> anyhow::Result<BladeRenderer> {
let raw = RawWindow { hwnd: hwnd.0 };
let raw = RawWindow { hwnd };
let gpu: Arc<gpu::Context> = Arc::new(
unsafe {
gpu::Context::init_windowed(
@ -1081,15 +1085,15 @@ mod windows_renderer {
}
struct RawWindow {
hwnd: isize,
hwnd: HWND,
}
impl rwh::HasWindowHandle for RawWindow {
fn window_handle(&self) -> Result<rwh::WindowHandle<'_>, rwh::HandleError> {
Ok(unsafe {
let hwnd = NonZeroIsize::new_unchecked(self.hwnd);
let hwnd = NonZeroIsize::new_unchecked(self.hwnd.0 as isize);
let mut handle = rwh::Win32WindowHandle::new(hwnd);
let hinstance = get_window_long(HWND(self.hwnd), GWLP_HINSTANCE);
let hinstance = get_window_long(self.hwnd, GWLP_HINSTANCE);
handle.hinstance = NonZeroIsize::new(hinstance);
rwh::WindowHandle::borrow_raw(handle.into())
})

View file

@ -0,0 +1,47 @@
use std::ops::Deref;
use windows::Win32::{Foundation::HANDLE, UI::WindowsAndMessaging::HCURSOR};
#[derive(Debug, Clone, Copy)]
pub(crate) struct SafeHandle {
raw: HANDLE,
}
unsafe impl Send for SafeHandle {}
unsafe impl Sync for SafeHandle {}
impl From<HANDLE> for SafeHandle {
fn from(value: HANDLE) -> Self {
SafeHandle { raw: value }
}
}
impl Deref for SafeHandle {
type Target = HANDLE;
fn deref(&self) -> &Self::Target {
&self.raw
}
}
#[derive(Debug, Clone, Copy)]
pub(crate) struct SafeCursor {
raw: HCURSOR,
}
unsafe impl Send for SafeCursor {}
unsafe impl Sync for SafeCursor {}
impl From<HCURSOR> for SafeCursor {
fn from(value: HCURSOR) -> Self {
SafeCursor { raw: value }
}
}
impl Deref for SafeCursor {
type Target = HCURSOR;
fn deref(&self) -> &Self::Target {
&self.raw
}
}

View file

@ -38,9 +38,9 @@ impl ProcessIdGetter {
fn new(pty: &Pty) -> ProcessIdGetter {
let child = pty.child_watcher();
let handle = child.raw_handle();
let fallback_pid = child
.pid()
.unwrap_or_else(|| unsafe { NonZeroU32::new_unchecked(GetProcessId(HANDLE(handle))) });
let fallback_pid = child.pid().unwrap_or_else(|| unsafe {
NonZeroU32::new_unchecked(GetProcessId(HANDLE(handle as _)))
});
ProcessIdGetter {
handle: handle as i32,