PAGE_READWRITE was a mistake there on my part, should be fixed now.
I added another test to show the difference to NtWriteVirtualMemory as well.
Concerning spanning multiple regions, it also behaves now the same as it does on Windows (first memory region determines if any changes to the protection are made), e.g.:
* Page 1 PAGE_READWRITE, Page 2 PAGE_READONLY: fails * Page 1 PAGE_READONLY, Page 2 PAGE_EXECUTE_READWRITE: fails * Page 1 PAGE_EXECUTE_READWRITE, Page 2 PAGE_READONLY: fails * Page 1 PAGE_EXECUTE_READ, Page 2 PAGE_READONLY: succeeds * Page 1 PAGE_EXECUTE_READWRITE, Page 2 PAGE_READWRITE: succeeds
Not too sure if it is also worth adding tests for some of these (and comparing them to NtWriteVirtualMemory as well).