attaching to a partition on Win2K

I’m trying to port a filter driver from NT to Win2k. On the NT version the
driver creates its own device and attaches it to
\Device\HarddiskX\PartitionY. Using OSR’s DeviceTree I can see the driver’s
devices attached to the actual partitions.
This, however, does not work in Win2K. “\Device\HarddiskX\PartitionY” is now
a link to “\Device\HarddiskVolumeZ”. Using ZwQuerySymbolicLinkObject I get
the new device name (\Device\HarddiskVolumeZ) and attach the driver’s device
to it. It still does not work. Any flush on the particular partition hangs.
OSR’s DeviceTree does not show my driver’s device attached to the partition
device. Of course OSR’s DeviceTree shows the partition devices as
“\Device\HarddiskX\DP(Y)Offset-Length+Z”.
Is this the real partition device name that I should be attaching my
driver’s device? How do I get this device name for each partition?

Any help would be greatly appreciated.

Theodoros David
SteelEye Technology
xxxxx@steeleye.com
http://www.steeleye.com


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

Here’s some additional info on this problem for anyone who might knows
anything more and would like to give a hint.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Theodoros David
Sent: Friday, December 14, 2001 10:59 AM
To: NT Developers Interest List
Subject: [ntdev] attaching to a partition on Win2K

I’m trying to port a filter driver from NT to Win2k. On the NT version the
driver creates its own device and attaches it to
\Device\HarddiskX\PartitionY. Using OSR’s DeviceTree I can see
the driver’s
devices attached to the actual partitions.
This, however, does not work in Win2K.
“\Device\HarddiskX\PartitionY” is now
a link to “\Device\HarddiskVolumeZ”. Using ZwQuerySymbolicLinkObject I get
the new device name (\Device\HarddiskVolumeZ) and attach the
driver’s device
to it. It still does not work. Any flush on the particular
partition hangs.
OSR’s DeviceTree does not show my driver’s device attached to the
partition
device. Of course OSR’s DeviceTree shows the partition devices as
“\Device\HarddiskX\DP(Y)Offset-Length+Z”.
Is this the real partition device name that I should be attaching my
driver’s device? How do I get this device name for each partition?

Any help would be greatly appreciated.

Theodoros David
SteelEye Technology
xxxxx@steeleye.com
http://www.steeleye.com


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


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

Here’s some additional info on this problem for anyone who might know
anything more and would like to give a hint.

Creating new partitions on a disk also does not work
(IoGetDeviceObjectPointer returns 0xC0000034).

Here’s part of the attachment code:

status = IoGetDeviceObjectPointer( &uniNtDevName, FILE_READ_ATTRIBUTES,
&pNtFileObj, &pNtDevObj );
if((status == STATUS_SUCCESS) && (pNtDevObj))
{
if(pNtFileObj) ObDereferenceObject( pNtFileObj );

if((pNtDevObj != NULL) && (pNtDevObj->Vpb != NULL)
&& !(pNtDevObj->Vpb->Flags & VPB_MOUNTED))
{
status = IoCreateDevice(pDriverObj, sizeof( MY_VOLUME_EXTENSION ),
&uniMyDevName, FILE_DEVICE_DISK, 0, FALSE,
ppMyDevObj );
if(status == STATUS_SUCCESS)
{
if (!fBootup) (*ppEmDevObj)->Flags &= ~DO_DEVICE_INITIALIZING;

*ppTargetDevObj = IoAttachDeviceToDeviceStack( (*ppMyDevObj),
pNtDevObj );
if(*ppTargetDevObj)
{
(*ppMyDevObj)->Flags |= DO_DIRECT_IO;
(*ppMyDevObj)->AlignmentRequirement =
(*ppTargetDevObj)->AlignmentRequirement;
IoRegisterShutdownNotification( (*ppMyDevObj) );
}

Note:
uniNtDevName holds the “\Device\HarddiskX\PartitionY” name.
uniMyDevName holds our driver’s device name

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Theodoros David
Sent: Friday, December 14, 2001 10:59 AM
To: NT Developers Interest List
Subject: [ntdev] attaching to a partition on Win2K

I’m trying to port a filter driver from NT to Win2k. On the NT version the
driver creates its own device and attaches it to
\Device\HarddiskX\PartitionY. Using OSR’s DeviceTree I can see
the driver’s
devices attached to the actual partitions.
This, however, does not work in Win2K.
“\Device\HarddiskX\PartitionY” is now
a link to “\Device\HarddiskVolumeZ”. Using ZwQuerySymbolicLinkObject I get
the new device name (\Device\HarddiskVolumeZ) and attach the
driver’s device
to it. It still does not work. Any flush on the particular
partition hangs.
OSR’s DeviceTree does not show my driver’s device attached to the
partition
device. Of course OSR’s DeviceTree shows the partition devices as
“\Device\HarddiskX\DP(Y)Offset-Length+Z”.
Is this the real partition device name that I should be attaching my
driver’s device? How do I get this device name for each partition?

Any help would be greatly appreciated.

Theodoros David
SteelEye Technology
xxxxx@steeleye.com
http://www.steeleye.com


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


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

A nice, easy, fun, win2k way of filtering partitions is to add your driver
as an upper filter on the volume device class – you’ll get an add device
request for each partition – and don’t have to worry at all about trying
to find the partitions yourself.

The advantage filtering this way is that it works for both static and
dynamic disks and will work when new partitions are created.

The coinstaller code in the toaster sample has a couple of functions to add
/ remove the correct registry settings. If you have any questions on
accomplishing this, let me know.

-jordan

On 12/14/01, ““Theodoros David” ” wrote:
> Here’s some additional info on this problem for anyone who might know
> anything more and would like to give a hint.
>
> Creating new partitions on a disk also does not work
> (IoGetDeviceObjectPointer returns 0xC0000034).
>
> Here’s part of the attachment code:
> …
> status = IoGetDeviceObjectPointer( &uniNtDevName, FILE_READ_ATTRIBUTES,
> &pNtFileObj, &pNtDevObj );
> if((status == STATUS_SUCCESS) && (pNtDevObj))
> {
> if(pNtFileObj) ObDereferenceObject( pNtFileObj );
>
> if((pNtDevObj != NULL) && (pNtDevObj->Vpb != NULL)
> && !(pNtDevObj->Vpb->Flags & VPB_MOUNTED))
> {
> status = IoCreateDevice(pDriverObj, sizeof( MY_VOLUME_EXTENSION ),
> &uniMyDevName, FILE_DEVICE_DISK, 0, FALSE,
> ppMyDevObj );
> if(status == STATUS_SUCCESS)
> {
> if (!fBootup) (*ppEmDevObj)->Flags &= ~DO_DEVICE_INITIALIZING;
>
> *ppTargetDevObj = IoAttachDeviceToDeviceStack( (*ppMyDevObj),
> pNtDevObj );
> if(*ppTargetDevObj)
> {
> (*ppMyDevObj)->Flags |= DO_DIRECT_IO;
> (*ppMyDevObj)->AlignmentRequirement =
> (*ppTargetDevObj)->AlignmentRequirement;
> IoRegisterShutdownNotification( (*ppMyDevObj) );
> }
> …
>
> Note:
> uniNtDevName holds the “\Device\HarddiskX\PartitionY” name.
> uniMyDevName holds our driver’s device name
>
>
>
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com]On Behalf Of Theodoros David
> > Sent: Friday, December 14, 2001 10:59 AM
> > To: NT Developers Interest List
> > Subject: [ntdev] attaching to a partition on Win2K
> >
> >
> >
> > I’m trying to port a filter driver from NT to Win2k. On the NT version the
> > driver creates its own device and attaches it to
> > \Device\HarddiskX\PartitionY. Using OSR’s DeviceTree I can see
> > the driver’s
> > devices attached to the actual partitions.
> > This, however, does not work in Win2K.
> > “\Device\HarddiskX\PartitionY” is now
> > a link to “\Device\HarddiskVolumeZ”. Using ZwQuerySymbolicLinkObject I get
> > the new device name (\Device\HarddiskVolumeZ) and attach the
> > driver’s device
> > to it. It still does not work. Any flush on the particular
> > partition hangs.
> > OSR’s DeviceTree does not show my driver’s device attached to the
> > partition
> > device. Of course OSR’s DeviceTree shows the partition devices as
> > “\Device\HarddiskX\DP(Y)Offset-Length+Z”.
> > Is this the real partition device name that I should be attaching my
> > driver’s device? How do I get this device name for each partition?
> >
> > Any help would be greatly appreciated.
> >
> > Theodoros David
> > SteelEye Technology
> > xxxxx@steeleye.com
> > http://www.steeleye.com
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@steeleye.com
> > To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com
> >
>
>
> —
> You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
> To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com


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