Skip to content

Commit e6e0e8f

Browse files
committed
shim more Windows functions
1 parent 9802549 commit e6e0e8f

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/fn_call.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,23 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
622622
self.write_ptr(dest, addr, dest_ty)?;
623623
}
624624

625+
// Windows ABI
626+
"AddVectoredExceptionHandler" => {
627+
// any non zero value works for the stdlib. This is just used for stackoverflows anyway
628+
self.write_scalar(dest, Scalar::from_u128(1), dest_ty)?;
629+
},
630+
"GetModuleHandleW" |
631+
"GetProcAddress" |
632+
"InitializeCriticalSection" |
633+
"SetLastError" => {
634+
// pretend these do not exist/nothing happened, by returning zero
635+
self.write_scalar(dest, Scalar::from_u128(0), dest_ty)?;
636+
},
637+
"GetLastError" => {
638+
// this is c::ERROR_CALL_NOT_IMPLEMENTED
639+
self.write_scalar(dest, Scalar::from_u128(120), dest_ty)?;
640+
},
641+
625642
_ => {
626643
return err!(Unimplemented(
627644
format!("can't call C ABI function: {}", link_name),
@@ -728,6 +745,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
728745
let bool = self.tcx.types.bool;
729746
self.write_scalar(dest, Scalar::from_bool(false), bool)?;
730747
}
748+
731749
_ => return err!(NoMirFor(path)),
732750
}
733751

0 commit comments

Comments
 (0)