Skip to content

Commit 4288ad3

Browse files
author
Rian Quinn
committed
fix windows bug
Signed-off-by: Rian Quinn <“rianquinn@gmail.com”>
1 parent 675b5b0 commit 4288ad3

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/src/Makefile.bf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ LIBRARY_PATHS+=%BUILD_ABS%/makefiles/bfm/bin/native/
6565

6666
WINDOWS_SOURCES+=
6767
WINDOWS_INCLUDE_PATHS+=
68-
WINDOWS_LIBS+=
68+
WINDOWS_LIBS+=setupapi
6969
WINDOWS_LIBRARY_PATHS+=
7070

7171
LINUX_SOURCES+=

app/src/hook.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@
2222
#include <ioctl.h>
2323
#include <guard_exceptions.h>
2424

25+
#if defined(_WIN32) || defined (__CYGWIN__)
26+
#include <windows.h>
27+
#else
2528
#include <sched.h>
2629
#include <iostream>
30+
#endif
2731

2832
void
2933
hello_world()
@@ -41,13 +45,15 @@ main(int argc, const char *argv[])
4145

4246
vmcall_registers_t regs;
4347

44-
// We need to make sure that we are running on the correct core. When we
45-
// perform the vmcall, its likely that this application will end up running
46-
// on core #0 anyways, but this make sure there are no issues regardless.
48+
#if defined(_WIN32) || defined (__CYGWIN__)
49+
SetProcessAffinityMask(GetCurrentProcess(), 1);
50+
#else
4751
cpu_set_t mask;
4852
CPU_ZERO(&mask);
4953
CPU_SET(0, &mask);
5054
sched_setaffinity(0, sizeof(mask), &mask);
55+
#endif
56+
5157

5258
guard_exceptions([&]
5359
{

0 commit comments

Comments
 (0)