This might be a naive question. I need to get the target device name based
on the symbolic link name. I found there are IoCreateSymbolicLink and
IoDeleteSymbolicLink functions, but there is no function to get the target
device name from a given symbolic link name. What would be the way to
achieve this in a kernel driver? Thanks in advance.
There isn’t a supported way to do this. Why can’t you just use the
symbolic link name?
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
Sent: Friday, June 23, 2006 9:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLink
This might be a naive question. I need to get the target device name
based on the symbolic link name. I found there are IoCreateSymbolicLink
and IoDeleteSymbolicLink functions, but there is no function to get the
target device name from a given symbolic link name. What would be the
way to achieve this in a kernel driver? Thanks in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Thanks for your reply. Actually I am trying to get the device object of
disk device \Device\Harddiskx\DRy, which is pointed to by
\Device\Harddiskx\Partition0. Here the disk number x is given. When I
tried to get an object using IoGetDeviceObjectPointer with an object name
of “\Device\Harddiskx\Partition0”, I actually got the
RAW File system’s device object, not the object for \Device\Harddiskx\DRy.
So I think first I need to get the device name from the symbolic link,
then call IoGetDeviceObjectPointer to get the right object. Thanks.
Yingping
On Fri, 23 Jun 2006, Peter Wieland wrote:
There isn’t a supported way to do this. Why can’t you just use the
symbolic link name?-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
Sent: Friday, June 23, 2006 9:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLinkThis might be a naive question. I need to get the target device name
based on the symbolic link name. I found there are IoCreateSymbolicLink
and IoDeleteSymbolicLink functions, but there is no function to get the
target device name from a given symbolic link name. What would be the
way to achieve this in a kernel driver? Thanks in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
I think I can get the disk device’s object by calling
IoGetDiskDeviceObject with the RAW Filesystem object I got from previous
call as an input. However, this method is only supported on Windows XP and
later. So it would be best first to get the device name from the symbolic
link name and then call IoGetDeviceObjectPointer directly. Thanks.
Yingping
On Fri, 23 Jun 2006, Yingping Lu wrote:
Thanks for your reply. Actually I am trying to get the device object of
disk device \Device\Harddiskx\DRy, which is pointed to by
\Device\Harddiskx\Partition0. Here the disk number x is given. When I
tried to get an object using IoGetDeviceObjectPointer with an object name
of “\Device\Harddiskx\Partition0”, I actually got the
RAW File system’s device object, not the object for \Device\Harddiskx\DRy.
So I think first I need to get the device name from the symbolic link,
then call IoGetDeviceObjectPointer to get the right object. Thanks.Yingping
On Fri, 23 Jun 2006, Peter Wieland wrote:
> There isn’t a supported way to do this. Why can’t you just use the
> symbolic link name?
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
> Sent: Friday, June 23, 2006 9:05 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to get the symbolic link created by
> IoCreateSymbolicLink
>
> This might be a naive question. I need to get the target device name
> based on the symbolic link name. I found there are IoCreateSymbolicLink
> and IoDeleteSymbolicLink functions, but there is no function to get the
> target device name from a given symbolic link name. What would be the
> way to achieve this in a kernel driver? Thanks in advance.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
It won’t matter. Opening the root partition will cause a raw filesystem
mount, unless you open the device for no access.
What’s wrong with getting the file system object? Are you trying to
attach a filter?
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
Sent: Friday, June 23, 2006 9:32 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLink
Thanks for your reply. Actually I am trying to get the device object of
disk device \Device\Harddiskx\DRy, which is pointed to by
\Device\Harddiskx\Partition0. Here the disk number x is given. When I
tried to get an object using IoGetDeviceObjectPointer with an object
name of “\Device\Harddiskx\Partition0”, I actually got the RAW File
system’s device object, not the object for \Device\Harddiskx\DRy.
So I think first I need to get the device name from the symbolic link,
then call IoGetDeviceObjectPointer to get the right object. Thanks.
Yingping
On Fri, 23 Jun 2006, Peter Wieland wrote:
There isn’t a supported way to do this. Why can’t you just use the
symbolic link name?-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
Sent: Friday, June 23, 2006 9:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLinkThis might be a naive question. I need to get the target device name
based on the symbolic link name. I found there are
IoCreateSymbolicLink and IoDeleteSymbolicLink functions, but there is
no function to get the target device name from a given symbolic link
name. What would be the way to achieve this in a kernel driver? Thanks
in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
“need to get” or “have to get”? The latter implies an external force
making you use the symbolic name. Had I a choice, I would use
GUID_DEVINTERFACE_DISK (???) and register for PNP notification. Your call
back will be called for every disk in the system with the proper name for
the disc. You can then query as you get the callbacks until you get the
one you want.
Gary G. Little
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of lu@cs.umn.edu
Sent: Friday, June 23, 2006 11:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLink
This might be a naive question. I need to get the target device name based
on the symbolic link name. I found there are IoCreateSymbolicLink and
IoDeleteSymbolicLink functions, but there is no function to get the target
device name from a given symbolic link name. What would be the way to
achieve this in a kernel driver? Thanks in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
I want to check the characteristics of the device.
Yingping
On Fri, 23 Jun 2006, Peter Wieland wrote:
It won’t matter. Opening the root partition will cause a raw filesystem
mount, unless you open the device for no access.What’s wrong with getting the file system object? Are you trying to
attach a filter?-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
Sent: Friday, June 23, 2006 9:32 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLinkThanks for your reply. Actually I am trying to get the device object of
disk device \Device\Harddiskx\DRy, which is pointed to by
\Device\Harddiskx\Partition0. Here the disk number x is given. When I
tried to get an object using IoGetDeviceObjectPointer with an object
name of “\Device\Harddiskx\Partition0”, I actually got the RAW File
system’s device object, not the object for \Device\Harddiskx\DRy.
So I think first I need to get the device name from the symbolic link,
then call IoGetDeviceObjectPointer to get the right object. Thanks.Yingping
On Fri, 23 Jun 2006, Peter Wieland wrote:
> There isn’t a supported way to do this. Why can’t you just use the
> symbolic link name?
>
> -p
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of Yingping Lu
> Sent: Friday, June 23, 2006 9:05 AM
> To: Windows System Software Devs Interest List
> Subject: [ntdev] How to get the symbolic link created by
> IoCreateSymbolicLink
>
> This might be a naive question. I need to get the target device name
> based on the symbolic link name. I found there are
> IoCreateSymbolicLink and IoDeleteSymbolicLink functions, but there is
> no function to get the target device name from a given symbolic link
> name. What would be the way to achieve this in a kernel driver? Thanks
in advance.
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
Thanks for your reply.
Not necessarily “have to get”. Basically my driver needs to check the
existing disks’ characteristics. To do that, I first call
IoGetConfigurationInformation to get the total number of disks, then I
construct the disk device name \Device\Harddiskx\Partition0 and call
IoGetDeviceObjectPointer to get the disk device’s object. However, this
returns to me the RAW filesystem object. Instead, I should use
\Device\Harddiskx\DRy (x, y are numbers, and x may not be the same as
y, this is pointed to by the \Device\Harddiskx\Partition0) to get the
disk’s object and then its characteristics. So I think I
should somehow derive the device name from its symbolic link name.
Since this driver is loaded (start=3) after all devices are loaded, should
I still get PnP notification for those existing disk devices?
Thanks,
Yingping
On Fri, 23 Jun 2006 xxxxx@seagate.com wrote:
“need to get” or “have to get”? The latter implies an external force
making you use the symbolic name. Had I a choice, I would use
GUID_DEVINTERFACE_DISK (???) and register for PNP notification. Your call
back will be called for every disk in the system with the proper name for
the disc. You can then query as you get the callbacks until you get the
one you want.Gary G. Little
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of lu@cs.umn.edu
Sent: Friday, June 23, 2006 11:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLinkThis might be a naive question. I need to get the target device name based
on the symbolic link name. I found there are IoCreateSymbolicLink and
IoDeleteSymbolicLink functions, but there is no function to get the target
device name from a given symbolic link name. What would be the way to
achieve this in a kernel driver? Thanks in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
IoRegisterPlugPlayNotification will hit your callback depending how what
you register. You won’t need to build, construct, or fart around with
anything. Simply pass the symbolic name contained in the notification
structure to the appropriate attach, or get, device object call. Your
callback will get very busy upon first registration as existing devices
are enumerated for you.
Using the DO returned, I have then passed TFR’s to an ATA disc using ATA
passh through. Note, however, that the use of ATA pass through in such a
manner only works on XP SP2 or Server 2003. 2000 and XP SP1 have a
“throttled” pass through that limits it’s functionality.
Gary G. Little
-----Original Message-----
From: lu@cs.umn.edu [mailto:lu@cs.umn.edu]
Sent: Friday, June 23, 2006 1:40 PM
To: Gary G Little
Cc: xxxxx@lists.osr.com
Subject: RE: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLink
Thanks for your reply.
Not necessarily “have to get”. Basically my driver needs to check the
existing disks’ characteristics. To do that, I first call
IoGetConfigurationInformation to get the total number of disks, then I
construct the disk device name \Device\Harddiskx\Partition0 and call
IoGetDeviceObjectPointer to get the disk device’s object. However, this
returns to me the RAW filesystem object. Instead, I should use
\Device\Harddiskx\DRy (x, y are numbers, and x may not be the same as
y, this is pointed to by the \Device\Harddiskx\Partition0) to get the
disk’s object and then its characteristics. So I think I
should somehow derive the device name from its symbolic link name.
Since this driver is loaded (start=3) after all devices are loaded, should
I still get PnP notification for those existing disk devices?
Thanks,
Yingping
On Fri, 23 Jun 2006 xxxxx@seagate.com wrote:
“need to get” or “have to get”? The latter implies an external force
making you use the symbolic name. Had I a choice, I would use
GUID_DEVINTERFACE_DISK (???) and register for PNP notification. Your
call
back will be called for every disk in the system with the proper name
for
the disc. You can then query as you get the callbacks until you get the
one you want.Gary G. Little
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of lu@cs.umn.edu
Sent: Friday, June 23, 2006 11:05 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLinkThis might be a naive question. I need to get the target device name
based
on the symbolic link name. I found there are IoCreateSymbolicLink and
IoDeleteSymbolicLink functions, but there is no function to get the
target
device name from a given symbolic link name. What would be the way to
achieve this in a kernel driver? Thanks in advance.
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
> tried to get an object using IoGetDeviceObjectPointer with an object name
of “\Device\Harddiskx\Partition0”, I actually got the
RAW File system’s device object, not the object for \Device\Harddiskx\DRy.
Use ZwCreateFile with DesiredAccess == FILE_READ_ATTRIBUTES on
\Device\Harddiskx\Partition0. Then use ObReferenceObjectByHandle, ZwClose and
IoGetRelatedDeviceObject.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
>It won’t matter. Opening the root partition will cause a raw filesystem
mount, unless you open the device for no access.
Not so for opens with DesiredAccess == FILE_READ_ATTRIBUTES, they do not
trigger mounts (even raw).
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
> existing disks’ characteristics. To do that, I first call
IoGetConfigurationInformation to get the total number of disks, then I
construct the disk device name \Device\Harddiskx\Partition0 and call
This is ancient NT4 way, use the device interface enumeration instead.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
You’re right - FILE_READ_ATTRIBUTES is the right flag.
Of course you don’t have read or write access so it’s more or less
equivalent to NO_ACCESS ![]()
-p
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S. Shatskih
Sent: Sunday, June 25, 2006 9:42 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] How to get the symbolic link created by
IoCreateSymbolicLink
It won’t matter. Opening the root partition will cause a raw
filesystem mount, unless you open the device for no access.
Not so for opens with DesiredAccess == FILE_READ_ATTRIBUTES, they do not
trigger mounts (even raw).
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
Thanks for your help. Sorry, I switched to some other work and didn’t
follow up promptly.
I did some tests using Maxim’s suggested approach: ZwCreateFile followed
by ObReferenceObjectByHandle and then IoGetRelatedDeviceObject. It’s
getting close and still problematic. The device object I got from
IoGetRelatedDeviceObject was actually the topmost device object, i.e. my
filter object. In order to get the corresponding disk device object, I
have to use something like IoGetLowerDeviceObject, unfortunately, this
function is supported on XP and later OS. So I get stucked.
I think I’ll follow Gary’s approach, even though that means much more
work.
Thanks again,
Yingping
On Mon, 26 Jun 2006, Peter Wieland wrote:
You’re right - FILE_READ_ATTRIBUTES is the right flag.
Of course you don’t have read or write access so it’s more or less
equivalent to NO_ACCESS-p