Closed neclepsio closed 9 years ago
I think we can just call the underlying VirtualProtect on Windows. It's a single call, and is very close to what we do anyway. Do you want to give it a try? Don't worry about making it nice.. if you can just hack the code to replace mprotect by VirtualProtect and see whether it works, it'd already be a good help.
You can see how the arguments map in the mman-win32 project you referenced:
https://code.google.com/p/mman-win32/source/browse/trunk/mman.c#139
This is compilation log:
In file included from ..\gopkg.in\qml.v1\all.cpp:11:0: ..\gopkg.in\qml.v1\cpp/mmemwin.cpp: In function 'int mprotect(void*, size_t, int)': ..\gopkg.in\qml.v1\cpp/mmemwin.cpp:15:11: error: 'PAGE_READ' was not declared in this scope wprot = PAGE_READ;
I suppose you want to use PAGE_READONLY.
Sorry for the silly mistake. I haven't had a chance to test it in a Windows machine.
Can you please try again?
It works.
\o/
sys/mman.h, which is required by SetupTesting, is not available under Windows using mingw. Maybe this project can help. The header is required by testing.go in v1-dev branch.