From: shakti on
Hi,

I'm trying to get the device object pointer for a volume in a driver
(kernel mode) by using IoGetDeviceObjectPointer.

If I use "/PhysicalDrive0", the call succeeds. But if i use "/Device/
Harddisk0" or "/Device/HarddiskVolume1" the call fails.

Actually I wanted to get a way to send IOCTL_PASS_THROUGH to a
specified drive, for eg. C:, which I can do easily from user mode by
opening a handle to the drive using CreateFile().

Can somebody please explain, why is it happening.

Thanks



From: Olof Lagerkvist on
shakti wrote:
> Hi,
>
> I'm trying to get the device object pointer for a volume in a driver
> (kernel mode) by using IoGetDeviceObjectPointer.
>
> If I use "/PhysicalDrive0", the call succeeds. But if i use "/Device/
> Harddisk0" or "/Device/HarddiskVolume1" the call fails.
>
> Actually I wanted to get a way to send IOCTL_PASS_THROUGH to a
> specified drive, for eg. C:, which I can do easily from user mode by
> opening a handle to the drive using CreateFile().
>
> Can somebody please explain, why is it happening.


You should use backslash '\', not forward slash '/' in kernel object paths.

--
Olof Lagerkvist
From: Alexander Grigoriev on
L"\\DosDevices\\C:"

"shakti" <shaktisinha(a)gmail.com> wrote in message
news:4688d708-f196-4284-b2f5-181a95a623a1(a)u1g2000pre.googlegroups.com...
> Hi,
>
> I'm trying to get the device object pointer for a volume in a driver
> (kernel mode) by using IoGetDeviceObjectPointer.
>
> If I use "/PhysicalDrive0", the call succeeds. But if i use "/Device/
> Harddisk0" or "/Device/HarddiskVolume1" the call fails.
>
> Actually I wanted to get a way to send IOCTL_PASS_THROUGH to a
> specified drive, for eg. C:, which I can do easily from user mode by
> opening a handle to the drive using CreateFile().
>
> Can somebody please explain, why is it happening.
>
> Thanks
>
>
>


From: shakti on
On Dec 15, 8:27 pm, "Alexander Grigoriev" <al...(a)earthlink.net> wrote:
> L"\\DosDevices\\C:"
>
> "shakti" <shaktisi...(a)gmail.com> wrote in message
>
> news:4688d708-f196-4284-b2f5-181a95a623a1(a)u1g2000pre.googlegroups.com...
>
>
>
> > Hi,
>
> > I'm trying to get the device object pointer for a volume in a driver
> > (kernel mode) by using IoGetDeviceObjectPointer.
>
> > If I use "/PhysicalDrive0", the call succeeds. But if i use "/Device/
> > Harddisk0" or "/Device/HarddiskVolume1" the call fails.
>
> > Actually I wanted to get a way to send IOCTL_PASS_THROUGH to a
> > specified drive, for eg. C:, which I can do easily from user mode by
> > opening a handle to the drive using CreateFile().
>
> > Can somebody please explain, why is it happening.
>
> > Thanks- Hide quoted text -
>
> - Show quoted text -

Thanks Alexander.

But if I use L"\\DosDevices\\C:" , the IoGetDeviceObjectPointer()
call is successful; but when I use the obtained pointer to do a
IoCallDriver(), I get a bug check 0x23 ( FAT_FILE_SYSTEM bug check ).

But the same code runs properly if I pass L"\\??\\PhysicalDrive1" to
get the device object pointer.

PhysicalDrive1 is a USB pen drive.

Thanks
From: Doron Holan [MSFT] on
I would use ZwCreateFile, not IoGetDeviceObjectPointer.
IoGetDeviceObjectPointer will close the handle which will send a
IRP_MJ_CLEANUP to the stack which is probably not what you want to happen

d

--

This posting is provided "AS IS" with no warranties, and confers no rights.


"shakti" <shaktisinha(a)gmail.com> wrote in message
news:36f6e5f2-ff1d-4b6c-9d48-08645b635031(a)m33g2000pri.googlegroups.com...
> On Dec 15, 8:27 pm, "Alexander Grigoriev" <al...(a)earthlink.net> wrote:
>> L"\\DosDevices\\C:"
>>
>> "shakti" <shaktisi...(a)gmail.com> wrote in message
>>
>> news:4688d708-f196-4284-b2f5-181a95a623a1(a)u1g2000pre.googlegroups.com...
>>
>>
>>
>> > Hi,
>>
>> > I'm trying to get the device object pointer for a volume in a driver
>> > (kernel mode) by using IoGetDeviceObjectPointer.
>>
>> > If I use "/PhysicalDrive0", the call succeeds. But if i use "/Device/
>> > Harddisk0" or "/Device/HarddiskVolume1" the call fails.
>>
>> > Actually I wanted to get a way to send IOCTL_PASS_THROUGH to a
>> > specified drive, for eg. C:, which I can do easily from user mode by
>> > opening a handle to the drive using CreateFile().
>>
>> > Can somebody please explain, why is it happening.
>>
>> > Thanks- Hide quoted text -
>>
>> - Show quoted text -
>
> Thanks Alexander.
>
> But if I use L"\\DosDevices\\C:" , the IoGetDeviceObjectPointer()
> call is successful; but when I use the obtained pointer to do a
> IoCallDriver(), I get a bug check 0x23 ( FAT_FILE_SYSTEM bug check ).
>
> But the same code runs properly if I pass L"\\??\\PhysicalDrive1" to
> get the device object pointer.
>
> PhysicalDrive1 is a USB pen drive.
>
> Thanks