Thank you Doron for your help. I have resolved this issue now.
Thanks,
Phillip
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: 2006年5月25日 13:24
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Serial Communication through Virtual COM Port
If you need to reboot to get the device usable after reboot, there is a bug in your driver. What you need to do is destroy the symbolic link in IRP_MN_SURPRISE_REMOVAL. Also, when you create the device, you must iterate over device names (like \Device\MySerial1,2,3…) until you don’t get a name conflict.
What is happening is that your device object is stuck in the surprise removed state until the last handle to the device is closed. While that first device is in the surprise removed state, another instance of the device can be enumerated. That means that you must destroy all device specific symbolic links and device interfaces that might be created on surprise remove processing so that the new instance can reuse these links.
d
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Phillip Shentu
Sent: Wednesday, May 24, 2006 9:39 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Serial Communication through Virtual COM Port
I have developed a WDM driver for usb-to-serial device. I will create a flag in pdx, like pdx->opened. When the application open the com port handle, I will set pdx->opened = TRUE in IRP_MJ_CREATE dispatch routine. Then, when in the application we regularly close the handle, I will clear the flag in IRP_MJ_CLOSE dispatch routine. The drivers may always work like this.
So, if you plug out the device without having closed the device handle, you may encountered some problems. The device can’t be opened again until you reboot your windows. Of course, we can do something in driver to avoid this kind of issues, if you can modify the driver and rebuild it.
Thanks,
Phillip
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