Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing drivers in ring0/kernel?

Just a question, I'm wondering if it's possible to hook in to Ring0/Kernel to display the list of loaded drivers running within the kernel? Would I need to write a driver to do so?

Similar to how you can list all the running processes quite easily.

Oh and this is in C++ / Windows.

like image 777
Samuel Nicholson Avatar asked Jul 25 '26 19:07

Samuel Nicholson


2 Answers

As I've commented, use the driverquery command.

driverquery
Display a list of all installed device drivers and their properties.

Syntax

driverquery  [/s Computer] [/u Domain\User /p Password]
         [/fo {TABLE|LIST|CSV}] [/nh] [/v] [/si]
example

Show all installed device drivers in Table output:
driverquery

Show all installed device drivers in a CSV format:
DriverQuery /fo csv

Without a header:
DriverQuery /nh

Drivers that are not signed:
DriverQuery /si | findstr FALSE

Find drivers that are currently Running:
Driverquery.exe /v |findstr Running

Show installed device drivers on a remote machine
driverquery /s ipaddress

Show installed device drivers on server64 and authenticate as a different user:
driverquery /s server64 /u ss64Ddom\user123 /p p@sswor3d /fo list

Export a verbose listing of drivers to a file
driverquery /v /fo csv > T:\driverlist.csv

When running DriverQuery within PowerShell, the CSV output format can be used to turn the output into objects. The PowerShell function below turns DriverQuery into a graphical tool that will list drivers from both local and remote systems (assuming you have the appropriate permissions.)

function Show-DriverDialog {
    param(
        $ComputerName = $env:computername
    )

    driverquery.exe /S $ComputerName /FO CSV  | 
      ConvertFrom-Csv | 
      Out-GridView -Title "Driver on \\$ComputerName"

Source: http://windows.commands.com/driverquery

Special attention to:

Find drivers that are currently Running:
Driverquery.exe /v | findstr Running
like image 196
pepper_chico Avatar answered Jul 28 '26 08:07

pepper_chico


If you REALLY want to write your own code for this, then here's a "Device Driver Information" page on Microsfts website.

From that, you should be able to pull together the pieces (it's pretty similar to listing the currently running processes).

like image 36
Mats Petersson Avatar answered Jul 28 '26 08:07

Mats Petersson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!