Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results

Before Posting... Please check out the Community Guidelines in the
Announcements and Administration Category.

Enumerate devices of specified type

OSR_Community_UserOSR_Community_User Posts: 110,218
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?

Comments

  • Doron_HolanDoron_Holan Posts: 10,360
    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:

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

    To unsubscribe, visit the List Server section of OSR Online at
  • Tim_RobertsTim_Roberts Posts: 12,622
    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.

    Tim Roberts, [email protected]
    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.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!