I am using Visual Studio 2010 C# to write a program to check the state of a COM-to-USB device using a DeviceIoControl but this requires an open handle to the device. I issue a CreateFIle to get a handle. Under WinXP it returns a good handle and does not change the state of the USB device but under Win7 it resets/closes the device and returns a good handle. The device is a Prolific PL2303HXD COM-to-USB GPIO device. I have tried changing out the underlying device drivers and DLLs with no change. This appears to be a handle sharing problem that has a value set NULL since it is ignored in WinXP but in Win7 it wants to see another value in this location. Now this call causes the same action of the USB device turning off the electrical socket:
uint errorReturn = GetNamedSecurityInfo("\\\\.\\COM5", SE_OBJECT_TYPE.SE_FILE_OBJECT, SECURITY_INFORMATION.OWNER_SECURITY_INFORMATION, out pSid, out pZero, out pZero, out pZero, out psd); I am beginning to think this may be related to the device driver not being registered with a signature. I have read all of the material suggested in the Reply and the HID device does not pertain to my scenario and I have already read all of the suggested material before posting this question to the forum.
09/14/12 Worked with rep from Agilent using a USB 2.0/3.0 Analyzer and found that using WinXP had no errors but under Win7 the error light on Analyzer stayed on before I used my code and during. The execution trace with Win7 showed error packet after error packet. This now looks even more like a difference between WinXP and Win7 Microsoft supplied device drivers. The installed device drivers from the OEM are the same. Saw a similar anomaly occur between WinXP sp2 and sp3 related to USB telephony devices.
- Edited by John Hare Monday, September 17, 2012 4:26 PM Update with more info
Hi John Hare,
Here is a tutorial that is talking about how to get USB device and use CreateFile to asynchronously read and write into USB device. The name of article is Working with USB devices in .NET and C#.
orichisonic http://blog.csdn.net/orichisonic If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".
- Edited by orichisonic Monday, August 27, 2012 4:41 AM
- Proposed as answer by Jason Dot WangMicrosoft contingent staff, Moderator Monday, August 27, 2012 4:43 AM
- Marked as answer by Jason Dot WangMicrosoft contingent staff, Moderator Friday, August 31, 2012 8:02 AM
- Unmarked as answer by John Hare Monday, September 17, 2012 4:18 PM