Rolling your own IRPs, Shadow Devices and NTFS assert

Hi Tony,
I posted a comment today on this article on the website, but I
want to ask the same question here too:

“NTFS assertions!”
How do you avoid the following Ntfs assertion about the File object
created against the named device object (not attached to the volume
device stack) having a NULL Vpb, and not corresponding to the stack you
just switched to? I found that if you do set the FileObject’s device
object to be that for the volume you are switching to you fix the assert
raised by NTFS (assert is below). This means keeping the DeviceObject
ReferenceCount field correct though. (It is incremented on a CREATE and
decremented on CLOSE for the file object.)

The assert was raised on XP Sp2 checked. Do you not see it as you call
the API for this version of the OS and it is not on other checked
versions.
(Confession not verified it on all checked variants of the OS as yet.)

Thanks Steve

// *** Assertion failed: No correspondence btwn file and device in irp
((pIrpSp->FileObject->Vpb == NULL) && ((pIrpSp->FileObject->DeviceObject
!= NULL) && (pIrpSp->FileObject->DeviceObject->Vpb != NULL) &&
(pIrpSp->DeviceObject ==
pIrpSp->FileObject->DeviceObject->Vpb->DeviceObject))) ||
PA((pIrpSp->FileObject->Vpb != NULL) && (pIrpSp->DeviceObject ==
pIrpSp->FileObject->Vpb->DeviceObject)) // *** Source File:
d:\xpsprtm\base\fs\ntfs\strucsup.c, line 6621

Thanks
Steve

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Tony Mason
Sent: Thursday, September 16, 2004 7:01 PM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] Rolling your own IRPs

The article we wrote in The NT Insider on building this for Windows 2000
and the technique described there can be made to work on NT 4.0.

http://www.osronline.com/article.cfm?id=258

This is preferable to trying to build your own create IRPs because
long-term you will be able to phase out this code…

Regards,

Tony

Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Duane Souder
Sent: Thursday, September 16, 2004 12:10 PM
To: ntfsd redirect
Subject: Re: [ntfsd] Rolling your own IRPs

Thanks…I saw this API mentioned a month or so ago…but I need this

to work on
NT 4.0 SP6a, and all flavors of 2K-XP also. Further, we can’t be sure

that any
given customer will have this Windows fix installed on their machines
either.
So, has anyone been successful using existing fields of an IRP_MJ_CREATE

that just
arrived in your driver, such as the FileObject, in rolling your own
IRP_MJ_CREATE?
Thanks again !
Duane

Ladislav Zezula wrote:

> Rolling your own IRP_MJ_CREATE is *very* difficult. I’ve done it in
> a previous version of Windows (was it back in NT V4 or was it
> Win2K?? I can’t remember), and I would never like to either repeat
> the experience or depend on that code for general purpose use. As
> soon as I was able (because of some added support in Windows) I
> replaced the code and shredded my development notes.

I would like to add the the “added support” probably means the
IoCreateFileSpecifyDeviceObjectHint API, which is
the function you want. Although thi API is now available
on WinXP only, wait a month or two, Microsoft prepares a patch
which will make this API available on Win2000 too.

In the middletime, you can read an article at osronline.com
about this API (from last year’s NT Insider), it may
give you more hints about this API ana eventual
replace.

L.


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@cisco.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument:
‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com

This happens on W2K as well.

— Steve Goddard wrote:

> Hi Tony,
> I posted a comment today on this article on the
> website, but I
> want to ask the same question here too:
>
> “NTFS assertions!”
> How do you avoid the following Ntfs assertion about
> the File object
> created against the named device object (not
> attached to the volume
> device stack) having a NULL Vpb, and not
> corresponding to the stack you
> just switched to? I found that if you do set the
> FileObject’s device
> object to be that for the volume you are switching
> to you fix the assert
> raised by NTFS (assert is below). This means keeping
> the DeviceObject
> ReferenceCount field correct though. (It is
> incremented on a CREATE and
> decremented on CLOSE for the file object.)
>
> The assert was raised on XP Sp2 checked. Do you not
> see it as you call
> the API for this version of the OS and it is not on
> other checked
> versions.
> (Confession not verified it on all checked variants
> of the OS as yet.)
>
> Thanks Steve
>
> // Assertion failed: No correspondence btwn file
> and device in irp
> ((pIrpSp->FileObject->Vpb == NULL) &&
> ((pIrpSp->FileObject->DeviceObject
> != NULL) && (pIrpSp->FileObject->DeviceObject->Vpb
> != NULL) &&
> (pIrpSp->DeviceObject ==
>
pIrpSp->FileObject->DeviceObject->Vpb->DeviceObject)))
> ||
> PA((pIrpSp->FileObject->Vpb != NULL) &&
> (pIrpSp->DeviceObject ==
> pIrpSp->FileObject->Vpb->DeviceObject)) //

> Source File:
> d:\xpsprtm\base\fs\ntfs\strucsup.c, line 6621
>
> Thanks
> Steve
>

__________________________________
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail