Skip to content

Commit

Permalink
Pass a pointer lpThreadId to CreateThread instead of a null pointer
Browse files Browse the repository at this point in the history
This parameter must not be null on 9X/ME.
  • Loading branch information
seritools committed Dec 29, 2023
1 parent 2eca161 commit e3f6ad0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/std/src/sys/windows/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,17 @@ impl Thread {
// PTHREAD_STACK_MIN bytes big. Windows has no such lower limit, it's
// just that below a certain threshold you can't do anything useful.
// That threshold is application and architecture-specific, however.

// this is needed on 9X/ME - passing null_mut() is not allowed
let mut thread_id = 0;

let ret = c::CreateThread(
ptr::null_mut(),
stack,
Some(thread_start),
p as *mut _,
c::STACK_SIZE_PARAM_IS_A_RESERVATION,
ptr::null_mut(),
&mut thread_id,
);
let ret = HandleOrNull::from_raw_handle(ret);
return if let Ok(handle) = ret.try_into() {
Expand Down

0 comments on commit e3f6ad0

Please sign in to comment.