How do I open multiple devices?

Hi all

I am writing an IFS which needs to access multiple physical disks for each
read or write operation send into the IFS.

The best scheme I have come up with is to create blank partitions on all of
the disks that are part of this scheme and assign one of them a drive
letter (or mount point) in DiskManager. However, When windows attempts to
mount the first disk (which I call the master disk), I need a method to
enumerate all of the other partitions on the system in order to read a
header from each disk.

Once I have done this enumeration, I need to obtain Device Objects to
direct I/O to.

I would also be interested in any alternative schemes on how I might
acomplish mapping of several drives to a single volume. Unfortunately I
cannot use the standard FT driver, I need to access each device from the
IFS. I could make my own filter that works sort of like the FT driver, but
I would still need to solve the same problems.

Can anyone advise me on 1) How to enumerate these partitions and 2) how to
create these device objects.

Thanks much in advance

Don


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

Let’s assume you are not using dynamic disks. You can enumerate all the
partions by looking at the devices names:
\Device\HarddiskVolume1
\Device\HarddiskVolume2

I use the routine below to lookup a particular device–it throws a
STATUS_OBJECT_NAME_NOT_FOUND if the partition doesn’t exist (i.e. the end of
the enumeration.)

DEVICE_OBJECT* GetDeviceObject( UNICODE_STRING& deviceName )
{
NTSTATUS status;
DEVICE_OBJECT* deviceObject;
FILE_OBJECT* fileObject;

status = IoGetDeviceObjectPointer(
&deviceName, // case sensitive
FILE_ALL_ACCESS,
&fileObject,
&deviceObject );
CheckStatus( status ); // raise status if not success

// Increase reference count on the device object
status = ObReferenceObjectByPointer(
deviceObject,
FILE_ALL_ACCESS,
NULL,
KernelMode );
CheckStatus( status );

// Remove the reference count added to the FileObject by
// IoGetDeviceObjectPointer
ObDereferenceObject( fileObject );

return deviceObject;
}

wrote in message news:xxxxx@ntfsd…
>
> Hi all
>
> I am writing an IFS which needs to access multiple physical disks for each
> read or write operation send into the IFS.
>
> The best scheme I have come up with is to create blank partitions on all
of
> the disks that are part of this scheme and assign one of them a drive
> letter (or mount point) in DiskManager. However, When windows attempts to
> mount the first disk (which I call the master disk), I need a method to
> enumerate all of the other partitions on the system in order to read a
> header from each disk.
>
> Once I have done this enumeration, I need to obtain Device Objects to
> direct I/O to.
>
> I would also be interested in any alternative schemes on how I might
> acomplish mapping of several drives to a single volume. Unfortunately I
> cannot use the standard FT driver, I need to access each device from the
> IFS. I could make my own filter that works sort of like the FT driver, but
> I would still need to solve the same problems.
>
> Can anyone advise me on 1) How to enumerate these partitions and 2) how to
> create these device objects.
>
> Thanks much in advance
>
> Don
>
>
> —
> 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
>
>


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

OT: You do not need to assign drive letters to access your fake disks.
Use the full canonical name to your disk
(\device\myhardisk%d\masterdisk%d\path\filename.ext) or whatever you are
using for the fake disks.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Demyn Plantenberg
Sent: Thursday, December 06, 2001 2:31 PM
To: File Systems Developers
Subject: [ntfsd] Re: How do I open multiple devices?

Let’s assume you are not using dynamic disks. You can enumerate all the
partions by looking at the devices names:
\Device\HarddiskVolume1
\Device\HarddiskVolume2

I use the routine below to lookup a particular device–it throws a
STATUS_OBJECT_NAME_NOT_FOUND if the partition doesn’t exist (i.e. the
end of the enumeration.)

DEVICE_OBJECT* GetDeviceObject( UNICODE_STRING& deviceName )
{
NTSTATUS status;
DEVICE_OBJECT* deviceObject;
FILE_OBJECT* fileObject;

status = IoGetDeviceObjectPointer(
&deviceName, // case sensitive
FILE_ALL_ACCESS,
&fileObject,
&deviceObject );
CheckStatus( status ); // raise status if not success

// Increase reference count on the device object
status = ObReferenceObjectByPointer(
deviceObject,
FILE_ALL_ACCESS,
NULL,
KernelMode );
CheckStatus( status );

// Remove the reference count added to the FileObject by
// IoGetDeviceObjectPointer
ObDereferenceObject( fileObject );

return deviceObject;
}

wrote in message news:xxxxx@ntfsd…
>
> Hi all
>
> I am writing an IFS which needs to access multiple physical disks for
> each read or write operation send into the IFS.
>
> The best scheme I have come up with is to create blank partitions on
> all
of
> the disks that are part of this scheme and assign one of them a drive
> letter (or mount point) in DiskManager. However, When windows attempts

> to mount the first disk (which I call the master disk), I need a
> method to enumerate all of the other partitions on the system in order

> to read a header from each disk.
>
> Once I have done this enumeration, I need to obtain Device Objects to
> direct I/O to.
>
> I would also be interested in any alternative schemes on how I might
> acomplish mapping of several drives to a single volume. Unfortunately
> I cannot use the standard FT driver, I need to access each device from

> the IFS. I could make my own filter that works sort of like the FT
> driver, but I would still need to solve the same problems.
>
> Can anyone advise me on 1) How to enumerate these partitions and 2)
> how to create these device objects.
>
> Thanks much in advance
>
> Don
>
>
> —
> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com To
> unsubscribe send a blank email to
leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com
>
>


You are currently subscribed to ntfsd as: xxxxx@storagecraft.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 would also be interested in any alternative schemes on how I might

acomplish mapping of several drives to a single volume. Unfortunately I

Maybe write a w2k’s Volume Manager? This would be the proper solution.

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