not a full review, just some comments to enhance the tests: - the tests could check if the new protections are effective (IsBadReadPtr/IsBadWritePtr could be used here) - I don't see a test to check behavior when old_prot is NULL (some APIs crashes, some APIs check the pointer and return an error, some support the NULL pointer by not returning the old value) (if it's crashing on native, this can be marked with a comment in the test file) - the implementation will fail when eg PAGE_GUARD is passed, which is not what MSDN states. But an additional test is always better than believing MSDN which is not always very accurate. - is old_prot modified in case of failure? (eg. if PAGE_EXECUTE_READWRITE is passed, it could be that old_prot is still written to with current protection, or maybe it's not written to)
you should also update the merge request (and not close it and reopen a new one), so that we don't lose tracks of comments between updates
TIA