Verifier bug check 81 on XP RC1

My filter driver has (for the past 3 years) been using a few lines of code
taken from the Nagar book, in order to get a pointer to the data buffer for
the READ IRP:

void *SFsdGetCallersBuffer( PIRP PtrIrp)
{
void *ReturnedBuffer = NULL;

// If an MDL is supplied, use it.
if (PtrIrp->MdlAddress) {
ReturnedBuffer = MmGetSystemAddressForMdl(PtrIrp->MdlAddress);
} else {
ReturnedBuffer = PtrIrp->UserBuffer;
}

return(ReturnedBuffer);
}

I have had no problems with this before. Now, when I run XP RC1 with the
driver verifier, I (very occasionally) get a bug-check C4,81 - “Call to
MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
MmGetSystemAddressForMdl.

Any ideas anyone?

Brian


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Your suppose to use mmGetSystemAddressForMdlSafe.

Mark J. Cariddi
Consulting Associate
Open Systems Resources, Inc.
http://www.osr.com/

-----Original Message-----
From: xxxxx@iOra.com [mailto:xxxxx@iOra.com]
Sent: Thursday, August 09, 2001 6:23 AM
To: File Systems Developers
Subject: [ntfsd] Verifier bug check 81 on XP RC1

My filter driver has (for the past 3 years) been using a few lines of code
taken from the Nagar book, in order to get a pointer to the data buffer for
the READ IRP:

void *SFsdGetCallersBuffer( PIRP PtrIrp)
{
void *ReturnedBuffer = NULL;

// If an MDL is supplied, use it.
if (PtrIrp->MdlAddress) {
ReturnedBuffer =
MmGetSystemAddressForMdl(PtrIrp->MdlAddress);
} else {
ReturnedBuffer = PtrIrp->UserBuffer;
}

return(ReturnedBuffer);
}

I have had no problems with this before. Now, when I run XP RC1 with the
driver verifier, I (very occasionally) get a bug-check C4,81 - “Call to
MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
MmGetSystemAddressForMdl.

Any ideas anyone?

Brian


You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> I have had no problems with this before. Now, when I run XP RC1 with the

driver verifier, I (very occasionally) get a bug-check C4,81 - “Call to
MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
MmGetSystemAddressForMdl.

Use MmGetSystemAddressForMdlSafe.
MmGetSystemAddressForMdl is obsolete.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

On 08/09/01, ““Maxim S. Shatskih” ” wrote:
> > I have had no problems with this before. Now, when I run XP RC1 with the
> > driver verifier, I (very occasionally) get a bug-check C4,81 - “Call to
> > MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
> > MmGetSystemAddressForMdl.
>
> Use MmGetSystemAddressForMdlSafe.
> MmGetSystemAddressForMdl is obsolete.
>
> Max
>
>

I’m fairly sure I know what the answer to this question will be, but I want
to ask it explicitly.

Does this mean that my existing use of a single driver for NT4/W2K/XP is
not a good idea and a luxury I can’t afford to keep?? I.e. If
MmGetSystemAddressForMdl is deemed to be obsolete on W2K and later (and can
fail the verifier), but MmGetSystemAddressForMdlSafe is not available on
NT4, do I have to build two drivers and install the appropriate one? Is
there any “legacy” mechanism that would allow me to reliably use a single
driver across the platforms?

Hopefully, Brian


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

> Does this mean that my existing use of a single driver for NT4/W2K/XP is

*not a good idea* and a luxury I can’t afford to keep?? I.e. If
MmGetSystemAddressForMdl is deemed to be obsolete on W2K and later (and
can
fail the verifier), but MmGetSystemAddressForMdlSafe is not available on
NT4, do I have to build two drivers and install the appropriate one? Is
there any “legacy” mechanism that would allow me to reliably use a single
driver across the platforms?

For XP - looks like yes.
For NT4, MmGetSystemAddressForMdl was the only function.
For w2k, it was declared obsolete but still supported.
Looks like it no more supported on XP.

Max


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

If you want to have a single binary for NT/2k/XP, then you could add code to
detect the operating system that you are running on and call the appropriate
function(s) for that OS. The HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion key contains a CurrentVersion REG_SZ. An NT4 box says
“4.0” and a Win2k box says “5.0”. I’d guess that XP says “6.0”.

I haven’t used this mechanism, others can probably comment on its
reliability. I did find some information indicating that the SOFTWARE hive
of the registry is loaded late, after kernel initialization, so it may not
be available when your driver needs this information.

Otherwise you could use the same code base with a few #defines or some
conditional compilation, but the end result will be a different binary for
different OSes, which I think you are trying to avoid.

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
xxxxx@iOra.com
Sent: Friday, August 10, 2001 12:00 AM
To: File Systems Developers
Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1

On 08/09/01, ““Maxim S. Shatskih” ” wrote:
> > > I have had no problems with this before. Now, when I run XP
> RC1 with the
> > > driver verifier, I (very occasionally) get a bug-check C4,81
> - “Call to
> > > MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
> > > MmGetSystemAddressForMdl.
> >
> > Use MmGetSystemAddressForMdlSafe.
> > MmGetSystemAddressForMdl is obsolete.
> >
> > Max
> >
> >
>
> I’m fairly sure I know what the answer to this question will be,
> but I want
> to ask it explicitly.
>
> Does this mean that my existing use of a single driver for NT4/W2K/XP is
> not a good idea and a luxury I can’t afford to keep?? I.e. If
> MmGetSystemAddressForMdl is deemed to be obsolete on W2K and
> later (and can
> fail the verifier), but MmGetSystemAddressForMdlSafe is not available on
> NT4, do I have to build two drivers and install the appropriate one? Is
> there any “legacy” mechanism that would allow me to reliably use a single
> driver across the platforms?
>
> Hopefully, Brian


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Here is how I am handling it:

//
// Inline function for backward comapatbility with Windows NT 4.0.
//
#ifndef MmGetSystemAddressForMdlSafe
#define MmGetSystemAddressForMdlSafe(MDL, PRIORITY)
ZosGetSystemAddressForMdlSafe(MDL)

INLINE
PVOID
ZosGetSystemAddressForMdlSafe(PMDL Mdl)
{
PVOID Address;
CSHORT MdlCanFailFlag;

MdlCanFailFlag = (Mdl->MdlFlags & MDL_MAPPING_CAN_FAIL);

Mdl->MdlFlags |= MDL_MAPPING_CAN_FAIL;

Address = MmGetSystemAddressForMdl(Mdl);

if (!MdlCanFailFlag)
Mdl->MdlFlags &= ~MDL_MAPPING_CAN_FAIL;

return Address;
}
#endif

Best regards,
Bruce Engle

-----Original Message-----
From: Brad Sahr [mailto:xxxxx@macromedia.com]
Sent: Saturday, August 11, 2001 9:26 PM
To: File Systems Developers
Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1

If you want to have a single binary for NT/2k/XP, then you could add code to
detect the operating system that you are running on and call the appropriate
function(s) for that OS. The HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion key contains a CurrentVersion REG_SZ. An NT4 box says
“4.0” and a Win2k box says “5.0”. I’d guess that XP says “6.0”.

I haven’t used this mechanism, others can probably comment on its
reliability. I did find some information indicating that the SOFTWARE hive
of the registry is loaded late, after kernel initialization, so it may not
be available when your driver needs this information.

Otherwise you could use the same code base with a few #defines or some
conditional compilation, but the end result will be a different binary for
different OSes, which I think you are trying to avoid.

Brad

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of
xxxxx@iOra.com
Sent: Friday, August 10, 2001 12:00 AM
To: File Systems Developers
Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1

On 08/09/01, ““Maxim S. Shatskih” ” wrote:
> > > I have had no problems with this before. Now, when I run XP
> RC1 with the
> > > driver verifier, I (very occasionally) get a bug-check C4,81
> - “Call to
> > > MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
> > > MmGetSystemAddressForMdl.
> >
> > Use MmGetSystemAddressForMdlSafe.
> > MmGetSystemAddressForMdl is obsolete.
> >
> > Max
> >
> >
>
> I’m fairly sure I know what the answer to this question will be,
> but I want
> to ask it explicitly.
>
> Does this mean that my existing use of a single driver for NT4/W2K/XP is
> not a good idea and a luxury I can’t afford to keep?? I.e. If
> MmGetSystemAddressForMdl is deemed to be obsolete on W2K and
> later (and can
> fail the verifier), but MmGetSystemAddressForMdlSafe is not available on
> NT4, do I have to build two drivers and install the appropriate one? Is
> there any “legacy” mechanism that would allow me to reliably use a single
> driver across the platforms?
>
> Hopefully, Brian


You are currently subscribed to ntfsd as: xxxxx@SERENA.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. Any unauthorized review, use, disclosure or distribution
is prohibited. If you are not the intended recipient, please contact
the sender by reply e-mail and destroy all copies of the original
message.



You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Dmitri Lehman wrote an article in which is he made his own LoadLibrary
and GetProcAddress function for kernelmode - which is essentially what
you need to be able to use the same binaries across NT4 -> XP.

http://www.wdj.com/archive/1104/feature.html

Best regards,
Anders Fogh

Saturday, August 11, 2001, 9:26:19 PM, you wrote:

BS> If you want to have a single binary for NT/2k/XP, then you could add code to
BS> detect the operating system that you are running on and call the appropriate
BS> function(s) for that OS. The HKLM\SOFTWARE\Microsoft\Windows
BS> NT\CurrentVersion key contains a CurrentVersion REG_SZ. An NT4 box says
BS> “4.0” and a Win2k box says “5.0”. I’d guess that XP says “6.0”.

BS> I haven’t used this mechanism, others can probably comment on its
BS> reliability. I did find some information indicating that the SOFTWARE hive
BS> of the registry is loaded late, after kernel initialization, so it may not
BS> be available when your driver needs this information.

BS> Otherwise you could use the same code base with a few #defines or some
BS> conditional compilation, but the end result will be a different binary for
BS> different OSes, which I think you are trying to avoid.

BS> Brad

> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com]On Behalf Of
> xxxxx@iOra.com
> Sent: Friday, August 10, 2001 12:00 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1
>
>
> On 08/09/01, ““Maxim S. Shatskih” ” wrote:
>> > > I have had no problems with this before. Now, when I run XP
>> RC1 with the
>> > > driver verifier, I (very occasionally) get a bug-check C4,81
>> - “Call to
>> > > MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
>> > > MmGetSystemAddressForMdl.
>> >
>> > Use MmGetSystemAddressForMdlSafe.
>> > MmGetSystemAddressForMdl is obsolete.
>> >
>> > Max
>> >
>> >
>>
>> I’m fairly sure I know what the answer to this question will be,
>> but I want
>> to ask it explicitly.
>>
>> Does this mean that my existing use of a single driver for NT4/W2K/XP is
>> not a good idea and a luxury I can’t afford to keep?? I.e. If
>> MmGetSystemAddressForMdl is deemed to be obsolete on W2K and
>> later (and can
>> fail the verifier), but MmGetSystemAddressForMdlSafe is not available on
>> NT4, do I have to build two drivers and install the appropriate one? Is
>> there any “legacy” mechanism that would allow me to reliably use a single
>> driver across the platforms?
>>
>> Hopefully, Brian

BS> —
BS> You are currently subscribed to ntfsd as: xxxxx@flaffer.com
BS> To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


Best regards,
Anders mailto:xxxxx@flaffer.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Here’s an updated link to the article that Anders refers to if you are
interested:

http://www.wdj.com/articles/2000/0004/0004b/0004b.htm?topic=articles

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Anders Fogh
Sent: Monday, August 13, 2001 10:33 PM
To: File Systems Developers
Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1

Dmitri Lehman wrote an article in which is he made his own LoadLibrary
and GetProcAddress function for kernelmode - which is essentially what
you need to be able to use the same binaries across NT4 -> XP.

http://www.wdj.com/archive/1104/feature.html

Best regards,
Anders Fogh

Saturday, August 11, 2001, 9:26:19 PM, you wrote:

BS> If you want to have a single binary for NT/2k/XP, then you
could add code to
BS> detect the operating system that you are running on and call
the appropriate
BS> function(s) for that OS. The HKLM\SOFTWARE\Microsoft\Windows
BS> NT\CurrentVersion key contains a CurrentVersion REG_SZ. An
NT4 box says
BS> “4.0” and a Win2k box says “5.0”. I’d guess that XP says “6.0”.

BS> I haven’t used this mechanism, others can probably comment on its
BS> reliability. I did find some information indicating that the
SOFTWARE hive
BS> of the registry is loaded late, after kernel initialization,
so it may not
BS> be available when your driver needs this information.

BS> Otherwise you could use the same code base with a few #defines or some
BS> conditional compilation, but the end result will be a
different binary for
BS> different OSes, which I think you are trying to avoid.

BS> Brad

>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com]On Behalf Of
>> xxxxx@iOra.com
>> Sent: Friday, August 10, 2001 12:00 AM
>> To: File Systems Developers
>> Subject: [ntfsd] Re: Verifier bug check 81 on XP RC1
>>
>>
>> On 08/09/01, ““Maxim S. Shatskih” ” wrote:
> >> > > I have had no problems with this before. Now, when I run XP
> >> RC1 with the
> >> > > driver verifier, I (very occasionally) get a bug-check C4,81
> >> - “Call to
> >> > > MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
> >> > > MmGetSystemAddressForMdl.
> >> >
> >> > Use MmGetSystemAddressForMdlSafe.
> >> > MmGetSystemAddressForMdl is obsolete.
> >> >
> >> > Max
> >> >
> >> >
> >>
> >> I’m fairly sure I know what the answer to this question will be,
> >> but I want
> >> to ask it explicitly.
> >>
> >> Does this mean that my existing use of a single driver for
> NT4/W2K/XP is
> >> not a good idea and a luxury I can’t afford to keep?? I.e. If
> >> MmGetSystemAddressForMdl is deemed to be obsolete on W2K and
> >> later (and can
> >> fail the verifier), but MmGetSystemAddressForMdlSafe is not
> available on
> >> NT4, do I have to build two drivers and install the appropriate one? Is
> >> there any “legacy” mechanism that would allow me to reliably
> use a single
> >> driver across the platforms?
> >>
> >> Hopefully, Brian


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Brian,
Use MmGetSystemAddressForMdlSafe instead of MmGetSystemAddressForMdl. -
Eric

-----Original Message-----
From: xxxxx@iOra.com [mailto:xxxxx@iOra.com]
Sent: Thursday, August 09, 2001 3:23 AM
To: File Systems Developers
Subject: [ntfsd] Verifier bug check 81 on XP RC1

My filter driver has (for the past 3 years) been using a few lines of
code
taken from the Nagar book, in order to get a pointer to the data buffer
for
the READ IRP:

void *SFsdGetCallersBuffer( PIRP PtrIrp)
{
void *ReturnedBuffer = NULL;

// If an MDL is supplied, use it.
if (PtrIrp->MdlAddress) {
ReturnedBuffer =
MmGetSystemAddressForMdl(PtrIrp->MdlAddress);
} else {
ReturnedBuffer = PtrIrp->UserBuffer;
}

return(ReturnedBuffer);
}

I have had no problems with this before. Now, when I run XP RC1 with the

driver verifier, I (very occasionally) get a bug-check C4,81 - “Call to
MmMapLockedPages without MDL_MAPPING_CAN_FAIL” from the
MmGetSystemAddressForMdl.

Any ideas anyone?

Brian


You are currently subscribed to ntfsd as: xxxxx@MICROSOFT.com To
unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com