Re: ntoskrnl.exe: Implement MmIsAddressValid (bug 11082)
"Detlef Riekenberg" <wine.dev(a)web.de> wrote:
+ len = VirtualQuery(VirtualAddress, &info, sizeof(MEMORY_BASIC_INFORMATION)); + + if ((len == sizeof(MEMORY_BASIC_INFORMATION)) && + (info.Protect & (PAGE_READWRITE || PAGE_EXECUTE_READWRITE)) && + ((info.Protect & PAGE_NOACCESS) == 0) && + (info.Type & MEM_COMMIT)) + { + return TRUE; + }
Besides the already pointed out '||' vs. '|' mismatch your code doesn't handle PAGE_READONLY and others implying read-only access. Probably checking for PAGE_NOACCESS and MEM_COMMIT should be enough. -- Dmitry.
On Di, 2008-03-18 at 09:09 +0800, Dmitry Timoshkov wrote:
"Detlef Riekenberg" <wine.dev(a)web.de> wrote:
+ len = VirtualQuery(VirtualAddress, &info, sizeof(MEMORY_BASIC_INFORMATION)); + + if ((len == sizeof(MEMORY_BASIC_INFORMATION)) && + (info.Protect & (PAGE_READWRITE || PAGE_EXECUTE_READWRITE)) && + ((info.Protect & PAGE_NOACCESS) == 0) && + (info.Type & MEM_COMMIT)) + { + return TRUE; + }
Besides the already pointed out '||' vs. '|' mismatch your code doesn't handle PAGE_READONLY and others implying read-only access. Probably checking for PAGE_NOACCESS and MEM_COMMIT should be enough.
This is not enough, since PAGE_READONLY will Pagefault on Write.
From OSR, the result is only TRUE, when the Address does not pagefault on read or write access: http://www.osronline.com/DDKx/kmarch/k106_3vle.htm
Thanks for your review. -- By by ... Detlef
participants (2)
-
Detlef Riekenberg -
Dmitry Timoshkov