From - Wed Oct 29 11:07:19 1997
Path: news.mitre.org!blanket.mitre.org!agate!howland.erols.net!usc!newshub.cts.com!newsfeed.cts.com!cmkrnl!jeh
From: jeh@cmkrnl.com (Jamie Hanrahan)
Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode
Subject: Re: MmProbeAndLockPages
Message-ID: <1997Oct28.220050.8280@cmkrnl>
Date: 28 Oct 97 22:00:50 PST
References: <ctcEIsDFD.2Fo@netcom.com>
Organization: Kernel Mode Systems, San Diego, CA
Lines: 20

In article <ctcEIsDFD.2Fo@netcom.com>, ctc@netcom.com (ARTHUR HSIAO) writes:
> Can somebody explain that when should KernelMode or UserMode be used in
> MmProbeAndLockPages?  

I asked one of the MS developers this very question at a conference 
awhile ago.  His answer:  Pass the value of Irp->RequestorMode .

> And why?

MmP&LP checks to be sure that the buffer is accessible *in the access 
mode of the requestor*.  Ie if a rogue app passes a kernel-space 
address to an IO call, you want the buffer probed for access in user 
mode; it doesn't do any good to probe it for access in kernel mode.

	--- Jamie Hanrahan, Kernel Mode Systems, San Diego CA
        Internet: jeh@cmkrnl.com (JH645)  CompuServe: 74140,2055  
drivers, internals, networks, applications, and training for VMS and Windows NT
NT driver FAQ, links, and other information:  http://www.cmkrnl.com/

If you post a reply in news, please don't e-mail it too.