Skip to content

Commit

Permalink
shim some Windows functions
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jul 15, 2018
1 parent 06cf947 commit 88d9eba
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,22 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
}

// Windows API subs
"AddVectoredExceptionHandler" |
"SetThreadStackGuarantee" => {
let usize = self.tcx.types.usize;
"AddVectoredExceptionHandler" => {
// any non zero value works for the stdlib. This is just used for stackoverflows anyway
self.write_scalar(dest, Scalar::from_u128(1), usize)?;
self.write_scalar(dest, Scalar::from_u128(1), dest_ty)?;
},
"GetModuleHandleW" |
"GetProcAddress" |
"InitializeCriticalSection" |
"EnterCriticalSection" |
"LeaveCriticalSection" |
"SetLastError" => {
// pretend these do not exist/nothing happened, by returning zero
self.write_scalar(dest, Scalar::from_u128(0), dest_ty)?;
},
"GetLastError" => {
// this is c::ERROR_CALL_NOT_IMPLEMENTED
self.write_scalar(dest, Scalar::from_u128(120), dest_ty)?;
},

// We can't execute anything else
Expand Down

0 comments on commit 88d9eba

Please sign in to comment.