Found New Hardware

sm625

Diamond Member
May 6, 2011
8,172
137
106
You've seen the message

jiminstall.jpg


I need to find a way to know that windows is doing this, because if you try to talk to a usb HID device before it finishes installing the plug and play driver, it will pop up an even more annoying message:

CTX132721-1.gif


And I definitely do not want that box popping up! So, is there a way to find out if windows is installing new hardware, maybe some process I can scan for?

edit: SOLVED. I used WINAPI CreateToolhelp32Snapshot to determine if (and how many instances of) the rundll32.exe process was running. I then searched each one for setupapi.dll.
 
Last edited:

Ketchup

Elite Member
Sep 1, 2002
14,559
248
106
You've seen the message

jiminstall.jpg


... is there a way to find out if windows is installing new hardware, maybe some process I can scan for?

I am not entirely sure of what you are asking, but if you click on that popup, Windows will tell you what it is installing.

If you put the same USB device in the same USB port every time, you should, at most, see the first message only.
 

postmortemIA

Diamond Member
Jul 11, 2006
7,721
40
91
it is probably Plug and Play service. But you probably don't want to touch this. It is too risky, might end up with system that does not respond to kb and mouse.
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
I dont want to mess with it, I just need a way to programmatically tell that it is installing new hardware, so I can tell my software to wait before it talks to the hardware. As long as I wait, I will not get that box saying it needs to restart. I just dont want to make it wait unless absolutely necessary.
 

Ketchup

Elite Member
Sep 1, 2002
14,559
248
106
I dont want to mess with it, I just need a way to programmatically tell that it is installing new hardware, so I can tell my software to wait before it talks to the hardware. As long as I wait, I will not get that box saying it needs to restart. I just dont want to make it wait unless absolutely necessary.

What software are you referring to?
 

sm625

Diamond Member
May 6, 2011
8,172
137
106
It's my software. It uses a HID driver to talk to a HID device. I can make it wait before attempting to talk to the device, if I knew windows was doing its found new hardware routine.

I've narrowed it down to rundll32.exe and setupapi.dll. Now I just need a way to tell if that process is running, and if it has that dll loaded. I have used "EnumProcesses" in the past, so that might lead to a solution.
 
Last edited:

postmortemIA

Diamond Member
Jul 11, 2006
7,721
40
91
Microsoft has free driver development kit, it might have some libraries that can help you.