From 50c6f31a61eb90ba99f16ae8c1f1e062b9669f65 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 19 Dec 2018 13:40:43 +0100 Subject: [PATCH] GetConsoleScreenBufferInfo, SetConsoleTextAttribute --- src/fn_call.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/fn_call.rs b/src/fn_call.rs index 0333ac5720..5ee094bbf8 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -562,6 +562,14 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a, }, // Windows API stubs + "SetLastError" => { + let err = this.read_scalar(args[0])?.to_u32()?; + this.machine.last_error = err; + } + "GetLastError" => { + this.write_scalar(Scalar::from_uint(this.machine.last_error, Size::from_bits(32)), dest)?; + } + "AddVectoredExceptionHandler" => { // any non zero value works for the stdlib. This is just used for stackoverflows anyway 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, "EnterCriticalSection" | "LeaveCriticalSection" | "DeleteCriticalSection" => { - this.machine.last_error = 120; // ERROR_CALL_NOT_IMPLEMENTED + // Nothing to do, not even a return value }, "GetModuleHandleW" | "GetProcAddress" | - "TryEnterCriticalSection" => { - this.machine.last_error = 120; // ERROR_CALL_NOT_IMPLEMENTED + "TryEnterCriticalSection" | + "GetConsoleScreenBufferInfo" | + "SetConsoleTextAttribute" => { // pretend these do not exist/nothing happened, by returning zero this.write_null(dest)?; }, - "SetLastError" => { - let err = this.read_scalar(args[0])?.to_u32()?; - this.machine.last_error = err; - } - "GetLastError" => { - this.write_scalar(Scalar::from_uint(this.machine.last_error, Size::from_bits(32)), dest)?; - } - "TlsAlloc" => { // This just creates a key; Windows does not natively support TLS dtors.