Skip to content

Commit 1271c0a

Browse files
committed
Ignore proc_thread_attributes if the system doesn't support it
1 parent e1e1430 commit 1271c0a

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

library/std/src/sys/pal/windows/c.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,34 @@ mod wship6 {
606606
}
607607
}
608608
}
609+
610+
#[cfg(target_vendor = "rust9x")]
611+
compat_fn_with_fallback! {
612+
pub static KERNEL32: &CStr = c"kernel32" => { load: false, unicows: false };
613+
// >= Vista / Server 2008
614+
// https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-initializeprocthreadattributelist
615+
pub fn InitializeProcThreadAttributeList(
616+
lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST,
617+
dwattributecount: u32,
618+
dwflags: u32,
619+
lpsize: *mut usize
620+
) -> BOOL {
621+
rtabort!("unimplemented")
622+
}
623+
// >= Vista / Server 2008
624+
pub fn UpdateProcThreadAttribute(
625+
lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST,
626+
dwflags: u32,
627+
attribute: usize,
628+
lpvalue: *const core::ffi::c_void,
629+
cbsize: usize,
630+
lppreviousvalue: *mut core::ffi::c_void,
631+
lpreturnsize: *const usize
632+
) -> BOOL {
633+
rtabort!("unimplemented")
634+
}
635+
// >= Vista / Server 2008
636+
pub fn DeleteProcThreadAttributeList(lpattributelist: LPPROC_THREAD_ATTRIBUTE_LIST) {
637+
rtabort!("unimplemented")
638+
}
639+
}

library/std/src/sys/pal/windows/process.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,17 @@ impl Command {
353353

354354
let mut si_ex;
355355

356-
if let Some(proc_thread_attribute_list) = proc_thread_attribute_list {
356+
#[allow(unused)]
357+
let mut proc_thread_addributes_supported = true;
358+
#[cfg(target_vendor = "rust9x")]
359+
{
360+
proc_thread_addributes_supported =
361+
c::InitializeProcThreadAttributeList::available().is_some();
362+
}
363+
364+
if let Some(proc_thread_attribute_list) = proc_thread_attribute_list
365+
&& proc_thread_addributes_supported
366+
{
357367
si.cb = mem::size_of::<c::STARTUPINFOEXW>() as u32;
358368
flags |= c::EXTENDED_STARTUPINFO_PRESENT;
359369

0 commit comments

Comments
 (0)