Creating a Symbolic Link to a Unnamed Device Object

Hello,

I’m working on a Serial Port Driver, actually a Serial to USB driver.
Following the WDM recommendations i dont want (and dont need to) name my
PDO. So I use the IoRegisterDeviceInterface function call to create my
device interface instance with its associated symbolic link. Nevertheless,
to render this port accessible by most common Win32 applications, I need to
create the typical \DosDevices\COM symbolic links, which would normally
point to my named device object. But as my device object doesnt have a name
(except for an 8 digit number that i dont know where comes from) i dont see
how to create the symbolic link.

Thanks,
Nestor

By PDO, I assume you mean your FDO and not a PDO that you enumerate as a
bus driver. The way to do this is to create the symbolic link against
the PDO’s name (since all PDOs are required to have a name). To get the
name of the PDO call
IoGetDeviceProperty(DevicePropertyPhysicalDeviceObjectName) twice (the
first time to get the length, the 2nd for the actual name) and then use
the resuling PDO name as the target name in the call to
IoCreateSymbolicLink.

BTW, KMDF does this for you automatically if you call
WdfDeviceCreateSymbolicLink on an unnamed FDO.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nestor Lopez
Sent: Thursday, December 07, 2006 7:47 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Creating a Symbolic Link to a Unnamed Device Object

Hello,

I’m working on a Serial Port Driver, actually a Serial to USB driver.
Following the WDM recommendations i dont want (and dont need to) name my

PDO. So I use the IoRegisterDeviceInterface function call to create my
device interface instance with its associated symbolic link.
Nevertheless,
to render this port accessible by most common Win32 applications, I need
to
create the typical \DosDevices\COM symbolic links, which would
normally
point to my named device object. But as my device object doesnt have a
name
(except for an 8 digit number that i dont know where comes from) i dont
see
how to create the symbolic link.

Thanks,
Nestor


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’m working on a Serial Port Driver, actually a Serial to USB driver.

Following the WDM recommendations i dont want (and dont need to) name my
PDO. So I use the IoRegisterDeviceInterface function call to create my
device interface instance with its associated symbolic link. Nevertheless,
to render this port accessible by most common Win32 applications, I need to
create the typical \DosDevices\COM symbolic links, which would normally
> point to my named device object. But as my device object doesnt have a name
> (except for an 8 digit number that i dont know where comes from) i dont see
> how to create the symbolic link.

PDOs have an autogenerated name - some digits. You can query it by
ObQueryNameString, and then use as a target for IoCreateSymbolicLink. This is
what IoSetDeviceInterfaceState does internally.

Look at SERIAL sample on how to register these legacy names.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

No need to use ObQueryNameString, just use IoGetDeviceProperty (which
has been documented since win2k as the way to do this) :wink:

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Maxim S.
Shatskih
Sent: Friday, December 08, 2006 4:37 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Creating a Symbolic Link to a Unnamed Device Object

I’m working on a Serial Port Driver, actually a Serial to USB driver.
Following the WDM recommendations i dont want (and dont need to) name
my
PDO. So I use the IoRegisterDeviceInterface function call to create my
device interface instance with its associated symbolic link.
Nevertheless,
to render this port accessible by most common Win32 applications, I
need to
create the typical \DosDevices\COM symbolic links, which would
normally
> point to my named device object. But as my device object doesnt have a
name
> (except for an 8 digit number that i dont know where comes from) i
dont see
> how to create the symbolic link.

PDOs have an autogenerated name - some digits. You can query it by
ObQueryNameString, and then use as a target for IoCreateSymbolicLink.
This is
what IoSetDeviceInterfaceState does internally.

Look at SERIAL sample on how to register these legacy names.

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