aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_windows.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2017-09-27 11:44:15 +0200
committerDmitry Vyukov <dvyukov@google.com>2017-09-27 18:59:50 +0200
commitbdffe2484cfffefd2f3321cb42890be70887cf44 (patch)
treed0479d4e02301160ddb11c09f154d115cc70d80f /executor/executor_windows.cc
parent11fc874fb5c0446e3eebe3a3ca4bad19c6407505 (diff)
executor: fix execution of windows syscalls
First, they must be called with stdcall convention. Second, wrap them in __try/__except because they can crash.
Diffstat (limited to 'executor/executor_windows.cc')
-rw-r--r--executor/executor_windows.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/executor/executor_windows.cc b/executor/executor_windows.cc
index 7b30e1a96..862621951 100644
--- a/executor/executor_windows.cc
+++ b/executor/executor_windows.cc
@@ -52,10 +52,11 @@ int main(int argc, char** argv)
long execute_syscall(call_t* c, long a0, long a1, long a2, long a3, long a4, long a5, long a6, long a7, long a8)
{
- debug("%s = %p\n", c->name, c->call);
- long res = c->call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- debug("%s = %ld\n", c->name, res);
- return res;
+ __try {
+ return c->call(a0, a1, a2, a3, a4, a5, a6, a7, a8);
+ } __except (EXCEPTION_EXECUTE_HANDLER) {
+ return -1;
+ }
}
void cover_open()
@@ -82,4 +83,4 @@ uint32_t* write_output(uint32_t v)
void write_completed(uint32_t completed)
{
-} \ No newline at end of file
+}