@@ -562,6 +562,14 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
562
562
} ,
563
563
564
564
// 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
+
565
573
"AddVectoredExceptionHandler" => {
566
574
// any non zero value works for the stdlib. This is just used for stackoverflows anyway
567
575
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,
570
578
"EnterCriticalSection" |
571
579
"LeaveCriticalSection" |
572
580
"DeleteCriticalSection" => {
573
- this . machine . last_error = 120 ; // ERROR_CALL_NOT_IMPLEMENTED
581
+ // Nothing to do, not even a return value
574
582
} ,
575
583
"GetModuleHandleW" |
576
584
"GetProcAddress" |
577
- "TryEnterCriticalSection" => {
578
- this. machine . last_error = 120 ; // ERROR_CALL_NOT_IMPLEMENTED
585
+ "TryEnterCriticalSection" |
586
+ "GetConsoleScreenBufferInfo" |
587
+ "SetConsoleTextAttribute" => {
579
588
// pretend these do not exist/nothing happened, by returning zero
580
589
this. write_null ( dest) ?;
581
590
} ,
582
591
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
-
591
592
"TlsAlloc" => {
592
593
// This just creates a key; Windows does not natively support TLS dtors.
593
594
0 commit comments