Enumerating virtual serial ports under Device Manger

Hi,

I am newbie in windows device drivers.

we have a driver which is running as a service and creating two virtual
serial ports in system. this driver not have any .inf file and .cat files.
it has only the .sys files. which is running as service and creating
virtual serial ports in system. But this virtual ports are not
listed/shown/enumerated in the device manger.

similarly we have one Application developed in MFC, which is listing in the
virtual serial com ports, like what are com port numbers allocated to our
device (COM3, COM4). But these are not listing in device manager after
running the application also. By using this port number we are able to
communicate to device through the any application like hyper terminal or
tera term.

i have seen the driver is listed in “Non Plug and Play” section in device
manager but No virtual serial ports.

Now i want to enumerate/list these virtual serial ports inside the device
manager. For this i googled and found adding serenum.sys as a upper filter
driver for our drivers.

Based on that i written one .inf file which will install our driver as
well as serenum.sys as upper filter driver to our driver and created the
.cat file also.

but i was failed in installing the driver our device since ours in not a
“Plug and play” driver its 'Non- plug ans play" driver.

please guide me , am i going in the right way or else any other way is
there to enumerate the virtual serial ports under device manager.

Please guide me to do this.

Many thanks in advance.

Device manager shows pnp devices. A virtual serial port can be a pnp device, but it needs the inf which you are forgoing. Device manager does not really show non pnp devices in any effective way,over the years this part has been reduced as their is no real value in it as there are other ways to manage non pnp kernel services.

What bigger problem are you trying to solve!

Bent from my phone


From: xxxxx@lists.osr.com on behalf of johnny basha
Sent: Tuesday, January 3, 2017 5:22:22 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Enumerating virtual serial ports under Device Manger

Hi,

I am newbie in windows device drivers.

we have a driver which is running as a service and creating two virtual serial ports in system. this driver not have any .inf file and .cat files. it has only the .sys files. which is running as service and creating virtual serial ports in system. But this virtual ports are not listed/shown/enumerated in the device manger.

similarly we have one Application developed in MFC, which is listing in the virtual serial com ports, like what are com port numbers allocated to our device (COM3, COM4). But these are not listing in device manager after running the application also. By using this port number we are able to communicate to device through the any application like hyper terminal or tera term.

i have seen the driver is listed in “Non Plug and Play” section in device manager but No virtual serial ports.

Now i want to enumerate/list these virtual serial ports inside the device manager. For this i googled and found adding serenum.sys as a upper filter driver for our drivers.

Based on that i written one .inf file which will install our driver as well as serenum.sys as upper filter driver to our driver and created the .cat file also.

but i was failed in installing the driver our device since ours in not a “Plug and play” driver its 'Non- plug ans play" driver.

please guide me , am i going in the right way or else any other way is there to enumerate the virtual serial ports under device manager.

Please guide me to do this.

Many thanks in advance.

— NTDEV is sponsored by OSR Visit the list online at: MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers! Details at To unsubscribe, visit the List Server section of OSR Online at

Hi Doron thank u for reply.

we just want to show com ports numbers in device manager instead of seeing ports from the MFC application.

Till now we have not done any changes in driver source, do i need to do any changes in drivers sources in order to enumerate serial ports in device manager like adding Plug and Play functionality in driver sources.

i have only tried writing both .inf and .cat files and loading serenum.sys as upper filter drivers to our drivers based on googled information. but didn’t succeed.

even i tried adding serenum.sys as upper filters driver to our drivers with help of “filterman” utility from the OSR in window xp machine in order to confirm serial port enumeration under device manager can be done or not with the help serenum.sys. but didn’t succeed.

i am not getting am i going in a right way or not.since i am newbie in windows device drivers

what ever driver we are using now is written long back and running as service even in latest window OS’s.

now i want to show generated virtual serial ports into device manager. do we need to do any huge design changes in drivers sources or any other way is there to do this.

please let me know if any additional details required related to our device and driver.

please guide to me to achieve this.

Serenum by itself won’t make it show up, it is just a pnp filter that enumerates devices attached to the port. The inf itself won’t make it show up as the inf requires a pnp driver. If you want it to show up in device manager the driver itself needs to be pnp. This is no small task, at this point it is probably a 25-50% gutting of the source to convert it to kmdf. And for what? Showing a name in device manager? You are using a nuke to kill a fly, not worth it if your current software is stable and works. Why introduce such a huge change?

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Wednesday, January 4, 2017 4:26:49 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Enumerating virtual serial ports under Device Manger

Hi Doron thank u for reply.

we just want to show com ports numbers in device manager instead of seeing ports from the MFC application.

Till now we have not done any changes in driver source, do i need to do any changes in drivers sources in order to enumerate serial ports in device manager like adding Plug and Play functionality in driver sources.

i have only tried writing both .inf and .cat files and loading serenum.sys as upper filter drivers to our drivers based on googled information. but didn’t succeed.

even i tried adding serenum.sys as upper filters driver to our drivers with help of “filterman” utility from the OSR in window xp machine in order to confirm serial port enumeration under device manager can be done or not with the help serenum.sys. but didn’t succeed.

i am not getting am i going in a right way or not.since i am newbie in windows device drivers

what ever driver we are using now is written long back and running as service even in latest window OS’s.

now i want to show generated virtual serial ports into device manager. do we need to do any huge design changes in drivers sources or any other way is there to do this.

please let me know if any additional details required related to our device and driver.

please guide to me to achieve this.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

Hi Doron thank u for your reply.

But we have requirement from the client. they need to have virtual serial ports in device manager.

so we have to do changes in the drivers. please suggest me to do this.please do provide any example drivers to follow to achieve this. or is any there ant other way. like writing any kind of application which will show virtual ports in device manager.

i am thinking like changing this to PNP drivers by adding some AddDevice routine and PNP handling to this drivers sources. is that is the right way? or else is any other way there?

today i have gone through the MFC application Sources and found it is communicating with driver with help of openservice and start service and some other API’s. because of our driver is running as service.

if we do change the driver as PNP driver, then we need to do changes in the Application also. is it right?, since old driver is running as service.

please suggest me how to processed further.

thank u

When you say the old driver is running as a service, do you mean a user or kernel mode service?

Let’s be clear, moving to pnp will be a mostly gut and rewrite of large portions of your code. If you want a sample, look at the serial sample in the WDK. You would take it as a template, rip out all of the hw access routines and then replace them with whatever virtual serial port logic you have today. It is not as simple as adding AddDevice and supporting some pnp requests. You want to use KMDF here, otherwise this lengthy project will be 3x as long and 3x less correct

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Thursday, January 5, 2017 8:29 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Enumerating virtual serial ports under Device Manger

Hi Doron thank u for your reply.

But we have requirement from the client. they need to have virtual serial ports in device manager.

so we have to do changes in the drivers. please suggest me to do this.please do provide any example drivers to follow to achieve this. or is any there ant other way. like writing any kind of application which will show virtual ports in device manager.

i am thinking like changing this to PNP drivers by adding some AddDevice routine and PNP handling to this drivers sources. is that is the right way? or else is any other way there?

today i have gone through the MFC application Sources and found it is communicating with driver with help of openservice and start service and some other API’s. because of our driver is running as service.

if we do change the driver as PNP driver, then we need to do changes in the Application also. is it right?, since old driver is running as service.

please suggest me how to processed further.

thank u


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

Hi Doron thank u for tour inputs.

our old driver is running as the kernel mode service only.
I have started looking into serial port source.

Similarly i have some more doubts about our device and driver architecture.
i will let u know once i got clarity on that.

once again thank u very much Doron.

here are the some more details about our device.

Our Device is like the remote network connected Terminal Servers which is having serial ports.
we have a set of utilities in order connect to the network device, which consists of one MFC application to configure the device and one more application converting protocol data and one driver(which i have discussed in above) which is running as kernel mode service and creating serial ports in windows in order to communicate that serial ports from the pc serial ports.

as i discussed above we want to enumerate this serial ports under device manager since in old driver we are able to see only from the MFC application.

what i am expecting to do is(final output) i want to simulate my remote ports on network connected Terminal Servers to be used like local system serial ports from the device manager serial ports.

as our old drivers setup(including application) already doing same form the MFC application and other components.
now we want to do same from the device manager also. i am newbie in windows drivers and new to this kind of drivers models.
i have doubts like writing PNP driver is going solve my problem, if its PNP driver then how to install the drivers and how the system is going to found the new hardware got connected since our device is connected in the network. please to provide some inputs.

it seems to be more architectural changes need to do for solution. i am not getting how to proceed further in this project.

please do suggest some approach and some examples to develop this.
please forgive me if ask any silly things
many thanks in advance

Does the number of virtual ports change dynamically? Or is it always a fixed number? Do you always have the app running? Do you only want the ports “present” when the app is running?

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Monday, January 23, 2017 6:03:57 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Enumerating virtual serial ports under Device Manger

here are the some more details about our device.

Our Device is like the remote network connected Terminal Servers which is having serial ports.
we have a set of utilities in order connect to the network device, which consists of one MFC application to configure the device and one more application converting protocol data and one driver(which i have discussed in above) which is running as kernel mode service and creating serial ports in windows in order to communicate that serial ports from the pc serial ports.

as i discussed above we want to enumerate this serial ports under device manager since in old driver we are able to see only from the MFC application.

what i am expecting to do is(final output) i want to simulate my remote ports on network connected Terminal Servers to be used like local system serial ports from the device manager serial ports.

as our old drivers setup(including application) already doing same form the MFC application and other components.
now we want to do same from the device manager also. i am newbie in windows drivers and new to this kind of drivers models.
i have doubts like writing PNP driver is going solve my problem, if its PNP driver then how to install the drivers and how the system is going to found the new hardware got connected since our device is connected in the network. please to provide some inputs.

it seems to be more architectural changes need to do for solution. i am not getting how to proceed further in this project.

please do suggest some approach and some examples to develop this.
please forgive me if ask any silly things
many thanks in advance


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

Many thanks Doron for promt reply

the numbers of virtual ports are fixed for a device(but we have boards with different number of virtual ports, if board which is connected in the network is changed then number virtual ports are also be chage).and one application which is kind of socket application running alway.

One more MFC application showing the virtual serial ports when we open and the configuring the device.

now i too want the virtual ports in device manger when i configure from the MFC application and need to remove from device manager when we remove from the MFC application.

Your app that adds/removes ports will need to run as admin. You can create virtual pnp devices (also called root enumerated devices). The devcon sample shows how to do this in the “devcon install” path. It also shows how to remove the device. You will need to create a fake hardware id (a GUID as a strong guaranteed no collisions) and an inf to match against. You should use the serial sample as a guide on how to incorporate wdf into your driver

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmail.com
Sent: Monday, January 23, 2017 6:44:44 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Enumerating virtual serial ports under Device Manger

Many thanks Doron for promt reply

the numbers of virtual ports are fixed for a device(but we have boards with different number of virtual ports, if board which is connected in the network is changed then number virtual ports are also be chage).and one application which is kind of socket application running alway.

One more MFC application showing the virtual serial ports when we open and the configuring the device.

now i too want the virtual ports in device manger when i configure from the MFC application and need to remove from device manager when we remove from the MFC application.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

Hi doron many thanks for your guidance ,
i have written inf with fake hardwareId with ports class and class guid. tried in installing the existing driver(old driver) with small changes like adddevice routine. one serial port got enumerated in device manger but not functional. i have used devcon install xxx.inf “hardwareid” .i will look into this more later related to functionality.

now you are suggesting that i need to do same from application when the add/remove functionalities in app. is is right?

i have gone through the devcon sources “install” cmd and now we need to integrate this in our app sources and need to invoke while doing add/ remove functionality from the app is it right?

and finally from the driver side we need to have driver which is capable of creating virtual serial ports with plug and play functionality. is it right?

please correct me if i understood any thing wrongly.

and also if posible suggest me sample driver which will create virtual serial ports in WDM Architecture. i am not much aware of WDF architecture and our existing driver also there in WDM architecture.

These are all right except for sticking with WDM. Pnp and power are not a copy/paste or bolt on exercise on top of your existing driver. If you stuck with WDM you have MAN YEARS to get it correct and functional. And it still won’t be near 100% correct.

With WDF you have a correct implementation from the start. There are tutorials on converting a WDM driver to WDF on MSDN. There is a sample WDF serial driver. While you may not be familiar with WDF and have to take the time to understand it, it is far cheaper to understand WDF than continue with WDM for your driver

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Tuesday, January 24, 2017 5:17 AM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Enumerating virtual serial ports under Device Manger

Hi doron many thanks for your guidance ,
i have written inf with fake hardwareId with ports class and class guid. tried in installing the existing driver(old driver) with small changes like adddevice routine. one serial port got enumerated in device manger but not functional. i have used devcon install xxx.inf “hardwareid” .i will look into this more later related to functionality.

now you are suggesting that i need to do same from application when the add/remove functionalities in app. is is right?

i have gone through the devcon sources “install” cmd and now we need to integrate this in our app sources and need to invoke while doing add/ remove functionality from the app is it right?

and finally from the driver side we need to have driver which is capable of creating virtual serial ports with plug and play functionality. is it right?

please correct me if i understood any thing wrongly.

and also if posible suggest me sample driver which will create virtual serial ports in WDM Architecture. i am not much aware of WDF architecture and our existing driver also there in WDM architecture.


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>