ntdll: Fix handling of page fault if a guard page and write watch is triggered at the same time.

This commit is contained in:
Michael Müller 2014-10-04 02:48:16 +02:00 committed by Alexandre Julliard
parent 53611dfbab
commit 9e69715900
2 changed files with 5 additions and 6 deletions

View File

@ -1728,7 +1728,6 @@ static void test_guard_page(void)
num_guard_page_calls = 0;
*value = 1;
*(value + 1) = 2;
todo_wine
ok( num_guard_page_calls == 1, "expected one callback of guard page handler, got %d calls\n", num_guard_page_calls );
pNtCurrentTeb()->Tib.ExceptionList = frame.Prev;

View File

@ -1522,11 +1522,6 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err )
{
void *page = ROUND_ADDR( addr, page_mask );
BYTE *vprot = &view->prot[((const char *)page - (const char *)view->base) >> page_shift];
if (*vprot & VPROT_GUARD)
{
VIRTUAL_SetProt( view, page, page_size, *vprot & ~VPROT_GUARD );
ret = STATUS_GUARD_PAGE_VIOLATION;
}
if ((err & EXCEPTION_WRITE_FAULT) && (view->protect & VPROT_WRITEWATCH))
{
if (*vprot & VPROT_WRITEWATCH)
@ -1537,6 +1532,11 @@ NTSTATUS virtual_handle_fault( LPCVOID addr, DWORD err )
/* ignore fault if page is writable now */
if (VIRTUAL_GetUnixProt( *vprot ) & PROT_WRITE) ret = STATUS_SUCCESS;
}
if (*vprot & VPROT_GUARD)
{
VIRTUAL_SetProt( view, page, page_size, *vprot & ~VPROT_GUARD );
ret = STATUS_GUARD_PAGE_VIOLATION;
}
}
server_leave_uninterrupted_section( &csVirtual, &sigset );
return ret;