Way to Detect Device Driver

This forum covers issues concerning multiple software products.

Way to Detect Device Driver

Postby sabinhagen » Wed 16. Jan 2019, 02:16

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!!!
sabinhagen
 
Posts: 6
Joined: Wed 19. Dec 2018, 03:29

Re: Way to Detect Device Driver

Postby K.Wagner » Wed 16. Jan 2019, 10:54

Hello,

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
K.Wagner
Software Development
Software Development
 
Posts: 645
Joined: Wed 22. Sep 2010, 12:36
Location: Darmstadt, Germany

Re: Way to Detect Device Driver

Postby sabinhagen » Fri 18. Jan 2019, 02:16

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!
sabinhagen
 
Posts: 6
Joined: Wed 19. Dec 2018, 03:29


Return to Software



This website uses cookies for analytics, for logins to the online shop and the forum, and for the handling of an order. By browsing this website you agree to the use of cookies. Detailed information on their use can be found in our privacy policy.

OKPrivacy Policy