Skip to content
Snippets Groups Projects
Commit 8e013f9b authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard
Browse files

VirtualProtect should return correct old protection flags.

parent 6044b985
No related branches found
No related tags found
No related merge requests found
......@@ -968,6 +968,7 @@ BOOL WINAPI VirtualProtect(
FILE_VIEW *view;
UINT base, i;
BYTE vprot, *p;
DWORD prot;
TRACE("%08x %08lx %08lx\n",
(UINT)addr, size, new_prot );
......@@ -987,6 +988,7 @@ BOOL WINAPI VirtualProtect(
/* Make sure all the pages are committed */
p = view->prot + ((base - view->base) >> page_shift);
VIRTUAL_GetWin32Prot( *p, &prot, NULL );
for (i = size >> page_shift; i; i--, p++)
{
if (!(*p & VPROT_COMMITTED))
......@@ -996,7 +998,7 @@ BOOL WINAPI VirtualProtect(
}
}
if (old_prot) VIRTUAL_GetWin32Prot( view->prot[0], old_prot, NULL );
if (old_prot) *old_prot = prot;
vprot = VIRTUAL_GetProt( new_prot ) | VPROT_COMMITTED;
return VIRTUAL_SetProt( view, base, size, vprot );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment