Skip to content

Commit d2ebf4b

Browse files
committed
fix miri
1 parent 853254f commit d2ebf4b

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/shims/windows/foreign_items.rs

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,59 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
306306
this.write_scalar(Scalar::from_i32(1), dest)?;
307307
}
308308

309+
"CreateSymbolicLinkW" => {
310+
let &[_symlink_filename, _target_filename, _flags] = check_arg_count(args)?;
311+
// TODO: implement
312+
this.check_no_isolation("`GetFinalPathNameByHandleW`")?;
313+
this.write_scalar(Scalar::from_i32(0), dest)?;
314+
}
315+
316+
"GetFinalPathNameByHandleW" => {
317+
let &[_file_handle, _file_path, _file_path_len, _flags] = check_arg_count(args)?;
318+
this.check_no_isolation("`GetFinalPathNameByHandleW`")?;
319+
this.write_scalar(Scalar::from_u32(0), dest)?;
320+
}
321+
322+
"SetThreadStackGuarantee" => {
323+
let &[_stack_size_ptr] = check_arg_count(args)?;
324+
// We ignore the stack size parameter, and leave it unchanged.
325+
this.write_scalar(Scalar::from_i32(1), dest)?;
326+
}
327+
328+
"SetFileInformationByHandle" => {
329+
let &[_file_handle, _file_information_class, _file_information, _buffer_size] = check_arg_count(args)?;
330+
this.check_no_isolation("`SetFileInformationByHandle`")?;
331+
// TODO: implement
332+
this.write_scalar(Scalar::from_i32(0), dest)?;
333+
}
334+
335+
"SleepConditionVariableSRW" => {
336+
let &[_condvar, _srw_lock, _millis, _flags] = check_arg_count(args)?;
337+
// There is only one thread, so this always succeeds and returns TRUE.
338+
this.write_scalar(Scalar::from_i32(1), dest)?;
339+
}
340+
341+
"WakeConditionVariable" => {
342+
let &[_condvar] = check_arg_count(args)?;
343+
// There is only one thread, so this has no effect.
344+
}
345+
346+
"WakeAllConditionVariable" => {
347+
let &[_condvar] = check_arg_count(args)?;
348+
// There is only one thread, so this has no effect.
349+
}
350+
351+
"AcquireSRWLockExclusive" | "AcquireSRWLockShared" | "ReleaseSRWLockExclusive" | "ReleaseSRWLockShared" => {
352+
let &[_srwlock] = check_arg_count(args)?;
353+
// There is only one thread, so this has no effect.
354+
}
355+
356+
"TryAcquireSRWLockExclusive" | "TryAcquireSRWLockShared" => {
357+
let &[_srwlock] = check_arg_count(args)?;
358+
// There is only one thread, so this always succeeds.
359+
this.write_scalar(Scalar::from_u8(1), dest)?;
360+
}
361+
309362
_ => throw_unsup_format!("can't call foreign function: {}", link_name),
310363
}
311364

0 commit comments

Comments
 (0)