Besides using the WM_DEVICECHANGE to detect a USB device insert/remove,
I tried to use scan registry information ""HARDWARE\\DEVICEMAP\\SERIALCOMM"
to check, and using CreateFile() to open USB com port right after I find a
new-coming device.
So far, the method works fine in single-core PC while in dual-core PC, I
found that if I invoke CreateFile() right after I find the device from
registry, the operation will return error code 2 (implying that "The system
cannot find the file specified.").
If I delay to invoke CreateFile() by sleep(1), for example, the error will
not occur again.
Thus, I am wondering how the initialization process of underlying driver
actually work.
Is registry update operation finished before the the device driver is ready?
Thanks!