My WPF application checks for the presence of the necessary DLL files when it starts up, but I don't know how to check whether or not the USB driver has been installed. If the DLL is present, I can read the GetValue function with the PCAN_CHANNEL_VERSION parameter. But I should be able to check for the presence of the Device Driver without the DLL, although I realize this is probably more of a general Windows question.
I think the proper way would be to use System.Management.SelectQuery("Win32_SystemDriver"), what driver name do I query on though? PCAN_USB.sys?
Thanks in advance for any help!!!
Way to Detect Device Driver
Re: Way to Detect Device Driver
Hello,
yes, this is a possibility. Though, since you are asking for the driver name, you should use the string "PCAN_USB" instead.
yes, this is a possibility. Though, since you are asking for the driver name, you should use the string "PCAN_USB" instead.
Code: Select all
var searcher = new System.Management.ManagementObjectSearcher(
"root\\CIMV2",
"SELECT * FROM Win32_SystemDriver WHERE Name = \"PCAN_USB\"");
var isInstalled = (searcher.Get().Count > 0);
Best regards,
Keneth
Keneth
-
- Posts: 6
- Joined: Wed 19. Dec 2018, 03:29
Re: Way to Detect Device Driver
Thank you, Keneth, that worked perfectly!
Well, after I added the System.Management resource that is!
And just in case anyone else needs this feature, please note that the driver is NOT actually detected by simply installing the driver, but rather you also have to plug in the USB tool for the first time before the driver gets detected with this method. But I would consider that the last part of installing the driver.
Thanks again!
Well, after I added the System.Management resource that is!
And just in case anyone else needs this feature, please note that the driver is NOT actually detected by simply installing the driver, but rather you also have to plug in the USB tool for the first time before the driver gets detected with this method. But I would consider that the last part of installing the driver.
Thanks again!