aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_windows.h
diff options
context:
space:
mode:
authorSuraj K Suresh <kssuraj15@gmail.com>2020-09-28 14:48:39 +0530
committerDmitry Vyukov <dvyukov@google.com>2020-10-03 14:17:26 +0200
commitca27b3bc5783ce1dbda7f23883d0ddf3729902a8 (patch)
tree7a8b2516093aafd5c1ce9f89fc3aaf833cbdc163 /executor/common_windows.h
parent2653fa43f8cced3279808d74e5f712bf45ef7551 (diff)
executor: msvc support syz-executor
Diffstat (limited to 'executor/common_windows.h')
-rw-r--r--executor/common_windows.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/executor/common_windows.h b/executor/common_windows.h
index e9722a360..a29d437b8 100644
--- a/executor/common_windows.h
+++ b/executor/common_windows.h
@@ -3,20 +3,17 @@
// This file is shared between executor and csource package.
+#include <direct.h> // for _chdir
+#include <io.h> // for mktemp
#include <windows.h>
-#include "common.h"
-
#if SYZ_EXECUTOR || SYZ_HANDLE_SEGV
static void install_segv_handler()
{
}
-#define NONFAILING(...) \
- __try { \
- __VA_ARGS__; \
- } __except (EXCEPTION_EXECUTE_HANDLER) { \
- }
+#define NONFAILING(...) \
+ ([&]() { __try { __VA_ARGS__; } __except (EXCEPTION_EXECUTE_HANDLER) { return false; } return true; }())
#endif
#if SYZ_EXECUTOR || SYZ_THREADED || SYZ_REPEAT && SYZ_EXECUTOR_USES_FORK_SERVER
@@ -111,3 +108,12 @@ static int do_sandbox_none(void)
return 0;
}
#endif
+
+static void use_temporary_dir(void)
+{
+ char tmpdir_template[] = "./syzkaller.XXXXXX";
+ char* tmpdir = mktemp(tmpdir_template);
+
+ CreateDirectory(tmpdir, NULL);
+ _chdir(tmpdir);
+}