let &[handle, buf, n, written_ptr, overlapped] = check_arg_count(args)?;
this.read_scalar(overlapped)?.to_machine_usize(this)?; // this is a poiner, that we ignore
let handle = this.read_scalar(handle)?.to_machine_isize(this)?;
- let buf = this.read_scalar(buf)?.not_undef()?;
+ let buf = this.read_scalar(buf)?.check_init()?;
let n = this.read_scalar(n)?.to_u32()?;
let written_place = this.deref_operand(written_ptr)?;
// Spec says to always write `0` first.
let &[handle, flags, ptr] = check_arg_count(args)?;
this.read_scalar(handle)?.to_machine_isize(this)?;
this.read_scalar(flags)?.to_u32()?;
- let ptr = this.read_scalar(ptr)?.not_undef()?;
+ let ptr = this.read_scalar(ptr)?.check_init()?;
this.free(ptr, MiriMemoryKind::WinHeap)?;
this.write_scalar(Scalar::from_i32(1), dest)?;
}
let &[handle, flags, ptr, size] = check_arg_count(args)?;
this.read_scalar(handle)?.to_machine_isize(this)?;
this.read_scalar(flags)?.to_u32()?;
- let ptr = this.read_scalar(ptr)?.not_undef()?;
+ let ptr = this.read_scalar(ptr)?.check_init()?;
let size = this.read_scalar(size)?.to_machine_usize(this)?;
let res = this.realloc(ptr, size, MiriMemoryKind::WinHeap)?;
this.write_scalar(res, dest)?;
// errno
"SetLastError" => {
let &[error] = check_arg_count(args)?;
- let error = this.read_scalar(error)?.not_undef()?;
+ let error = this.read_scalar(error)?.check_init()?;
this.set_last_error(error)?;
}
"GetLastError" => {
let &[key, new_ptr] = check_arg_count(args)?;
let key = u128::from(this.read_scalar(key)?.to_u32()?);
let active_thread = this.get_active_thread();
- let new_ptr = this.read_scalar(new_ptr)?.not_undef()?;
+ let new_ptr = this.read_scalar(new_ptr)?.check_init()?;
this.machine.tls.store_tls(key, active_thread, this.test_null(new_ptr)?)?;
// Return success (`1`).
#[allow(non_snake_case)]
let &[hModule, lpProcName] = check_arg_count(args)?;
this.read_scalar(hModule)?.to_machine_isize(this)?;
- let name = this.memory.read_c_str(this.read_scalar(lpProcName)?.not_undef()?)?;
- if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target.target_os)? {
+ let name = this.memory.read_c_str(this.read_scalar(lpProcName)?.check_init()?)?;
+ if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target_os)? {
let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));
this.write_scalar(Scalar::from(ptr), dest)?;
} else {
"SystemFunction036" => {
// The actual name of 'RtlGenRandom'
let &[ptr, len] = check_arg_count(args)?;
- let ptr = this.read_scalar(ptr)?.not_undef()?;
+ let ptr = this.read_scalar(ptr)?.check_init()?;
let len = this.read_scalar(len)?.to_u32()?;
this.gen_random(ptr, len.into())?;
this.write_scalar(Scalar::from_bool(true), dest)?;
// Better error for attempts to create a thread
"CreateThread" => {
- throw_unsup_format!("Miri does not support threading");
+ throw_unsup_format!("Miri does not support concurrency on Windows");
}
// Incomplete shims that we "stub out" just to get pre-main initialization code to work.
if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_lpCriticalSection] = check_arg_count(args)?;
- assert_eq!(this.get_total_thread_count(), 1, "concurrency on Windows not supported");
+ assert_eq!(this.get_total_thread_count(), 1, "concurrency on Windows is not supported");
// Nothing to do, not even a return value.
// (Windows locks are reentrant, and we have only 1 thread,
// so not doing any futher checks here is at least not incorrect.)
if this.frame().instance.to_string().starts_with("std::sys::windows::") => {
#[allow(non_snake_case)]
let &[_lpCriticalSection] = check_arg_count(args)?;
- assert_eq!(this.get_total_thread_count(), 1, "concurrency on Windows not supported");
+ assert_eq!(this.get_total_thread_count(), 1, "concurrency on Windows is not supported");
// There is only one thread, so this always succeeds and returns TRUE.
this.write_scalar(Scalar::from_i32(1), dest)?;
}