Enumerate devices of specified type

Is this possible to enumerate devices of specified type in kernel mode? Like enumerate all storage devices, all network cards etc.

Also is there some kind of notification available when driver loads or service starts?

A device interface represents a specific type of device. You enumerate the current device interface instances with IoGetDeviceInterfaces. You can be told of new instances with IoRegisterPlugPlayNotification

d

Bent from my phone


From: xxxxx@lists.osr.com on behalf of xxxxx@gmx.com
Sent: Monday, January 8, 2018 1:43:04 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] Enumerate devices of specified type

Is this possible to enumerate devices of specified type in kernel mode? Like enumerate all storage devices, all network cards etc.

Also is there some kind of notification available when driver loads or service starts?


NTDEV is sponsored by OSR

Visit the list online at: https:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at https:

To unsubscribe, visit the List Server section of OSR Online at https:</https:></https:></https:>

xxxxx@gmx.com wrote:

Is this possible to enumerate devices of specified type in kernel mode? Like enumerate all storage devices, all network cards etc.

Also is there some kind of notification available when driver loads or service starts?

Allow me to state what SHOULD be one of the ten commandments of driver
writing:

    NEVER do anything in kernel mode that cannot be handled just as well
in user mode.

Enumerating and traversing the device tree has traditionally been a
user-mode task.  Doron mentioned that you can connect to “device
interfaces” at a kernel level; that assumes the devices you want all
expose a single device interface.  Some device classes do that
religiously, some do not.

What are you actually trying to do?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I recommend that you have a Windows Service setup, and then communicate with it from within your device driver. The Windows Service can handle the operation and then provide the results back to the device driver if deemed necessary.

This will not only be a lot more stable but also allows you to take advantage of documented user-mode APIs, and will also ease future updates for maintaining the feature within your product should changes be required at a later date.