Reputation: 53
I write program which installs usb device driver by means of dpinst.exe. At program start I want to check if Windows is busy by searching/installing/updating some driver. (Main scenario I want to avoid is launch of dpinst.exe while Windows is searching driver for plugged device.) How can I check that?
Upvotes: 2
Views: 774
Reputation: 53
Solution is to use CMP_WaitNoPendingInstallEvents function. Example here.
Upvotes: 3
Reputation: 23793
You can use Process to look if another instance of dpinst is already running.
Process[] processlist = Process.GetProcesses();
foreach(Process p in processlist){
if (p.ProcessName.StartsWith("dpinst"))
...
}
I would bet that this is unnecessary : the scenario you are trying to avoid is already being managed by dpinst/Windows itself.
Upvotes: 1