简体   繁体   中英

How do I read the state of a device driver in Windows?

How do I read the state of a device driver? I know I can loop through drivers using EnumDeviceDrivers and reading their name with GetDeviceDriverFileName, but how do I find out if they are stopped, running, disabled etc?

DriverQuery.exe provides the info, but how do I read the info in my program without executing driverquery.exe ?

EnumDeviceDrivers Retrieves the load address for each device driver in the system. ie It enums already loaded device drivers. What you need is to investigate Service Control Manager (SCM) api, as soon as one of the ways to load driver is assign it to SCM (in that case it driver DOES HAVE A STATE).

Check out this: EnumServicesStatus (with dwServiceType = SERVICE_DRIVER) QueryServiceStatus

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM