|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Plug & Play event detection in windows xpthrough all possilble (statically known) enumeration modes. My approach is as follows: 1. Use WMI to pull a collection of all currently attached USB devices and scan for specific vendor and product id combinations (this tells me the current mode the device is in). 2. Run arbitrary code while in each specific mode. 3. Force re-enumeration (device side, Windows just sees a disconnect and then a reconnect of a different device) 4. Watch for the PnP event generated when Windows sees a new device attached 5. Capture event before it gets to the "Found New Hardware Wizard" 6. Install the device 7. Repeat to 2 I am having trouble with steps #4 - #6. Currently, Windows always asks me to direct it to the drivers it should use to install. I want to make this program completely automated, with the only user interaction coming from plugging the device in initially and executing a binary. Can someone point me in the direction I should look for a) what events I need to catch and b) how to properly catch them? How about how to manually install the device? I have some ideas on how to accomplish this. The first is to have a static folder with the inf files needed for installation, and pre-pending this path to the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath so Windows PnP will immediately find the required driver and will automagically install it for me. The 2nd I find rather nasty, and involves hooking into the "Found New Hardware Wizard" window, then generating user input to go through the dialouge. There has to be a cleaner way that is less likely to break things or otherwise make assumptions about a user's system. -- lucas |
|||||||||||||||||||||||