Skip to content

Commit 50c6f31

Browse files
committed
GetConsoleScreenBufferInfo, SetConsoleTextAttribute
1 parent cae6520 commit 50c6f31

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/fn_call.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,14 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
562562
},
563563

564564
// Windows API stubs
565+
"SetLastError" => {
566+
let err = this.read_scalar(args[0])?.to_u32()?;
567+
this.machine.last_error = err;
568+
}
569+
"GetLastError" => {
570+
this.write_scalar(Scalar::from_uint(this.machine.last_error, Size::from_bits(32)), dest)?;
571+
}
572+
565573
"AddVectoredExceptionHandler" => {
566574
// any non zero value works for the stdlib. This is just used for stackoverflows anyway
567575
this.write_scalar(Scalar::from_int(1, dest.layout.size), dest)?;
@@ -570,24 +578,17 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
570578
"EnterCriticalSection" |
571579
"LeaveCriticalSection" |
572580
"DeleteCriticalSection" => {
573-
this.machine.last_error = 120; // ERROR_CALL_NOT_IMPLEMENTED
581+
// Nothing to do, not even a return value
574582
},
575583
"GetModuleHandleW" |
576584
"GetProcAddress" |
577-
"TryEnterCriticalSection" => {
578-
this.machine.last_error = 120; // ERROR_CALL_NOT_IMPLEMENTED
585+
"TryEnterCriticalSection" |
586+
"GetConsoleScreenBufferInfo" |
587+
"SetConsoleTextAttribute" => {
579588
// pretend these do not exist/nothing happened, by returning zero
580589
this.write_null(dest)?;
581590
},
582591

583-
"SetLastError" => {
584-
let err = this.read_scalar(args[0])?.to_u32()?;
585-
this.machine.last_error = err;
586-
}
587-
"GetLastError" => {
588-
this.write_scalar(Scalar::from_uint(this.machine.last_error, Size::from_bits(32)), dest)?;
589-
}
590-
591592
"TlsAlloc" => {
592593
// This just creates a key; Windows does not natively support TLS dtors.
593594

0 commit comments

Comments
 (0)