[PATCH] ntoskrnl: Have MmIsAddressValid use IsBadReadPtr.

Derek Lesho dereklesho52 at gmail.com
Tue Jun 5 10:35:05 CDT 2018


Side note, while this change does not follow the MSDN, it appears that the
MSDN incorrectly documents the function.

This blog post from 2006 explains more:
https://blogs.msdn.microsoft.com/doronh/2006/03/09/beware-the-shiny-light-that-is-mmisaddressvalid/

On Tue, Jun 5, 2018 at 11:14 AM, Derek Lesho <dereklesho52 at gmail.com> wrote:

> Fixes an error inside EasyAntiCheat.sys, which uses MmIsAddressValid on
> ntoskrnl.exe, to find its base address.  Wine will always return FALSE,
> because it checks for write access to ntoskrnl, when all the driver
> needs is read access
>
> Tested on Arch Linux
>
> Signed-off-by: Derek Lesho <dereklesho52 at Gmail.com>
> ---
>  dlls/ntoskrnl.exe/ntoskrnl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
> index 55027c5..e4c1c35 100644
> --- a/dlls/ntoskrnl.exe/ntoskrnl.c
> +++ b/dlls/ntoskrnl.exe/ntoskrnl.c
> @@ -2164,7 +2164,7 @@ void WINAPI MmFreeNonCachedMemory( void *addr,
> SIZE_T size )
>  BOOLEAN WINAPI MmIsAddressValid(PVOID VirtualAddress)
>  {
>      TRACE("(%p)\n", VirtualAddress);
> -    return !IsBadWritePtr(VirtualAddress, 1);
> +    return !IsBadReadPtr(VirtualAddress, 1);
>  }
>
>  /***********************************************************************
> --
> 2.7.4
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20180605/19cc260f/attachment.html>


More information about the wine-devel mailing list