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

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

More Info on Driver Writing and Debugging


The free OSR Learning Library has more than 50 articles on a wide variety of topics about writing and debugging device drivers and Minifilters. From introductory level to advanced. All the articles have been recently reviewed and updated, and are written using the clear and definitive style you've come to expect from OSR over the years.


Check out The OSR Learning Library at: https://www.osr.com/osr-learning-library/


Can kernel module name contain "-" ?

Pavel_APavel_A Member Posts: 2,708
The file name of my driver is mydriver-pci.sys, but the module name in
debugger (lm) is "mydriver_pci" ( - changed to _).
Because of this (?) delayed breakpoints are not hit.

I cannot find "mydriver_pci" anywhere in my sources or INF.
So who does this and why? Is the "-" char invalid in module names?

Thanks,
-- pa

Comments

  • Jeffrey_Tippet_[MSFT]Jeffrey_Tippet_[MSFT] Member - All Emails Posts: 573
    The debugger is renaming your module on-the-fly. The reason is because module names can be used in dbgeng-MASM expressions, and the '-' character is a valid expression operator. So the evaluation "? mydriver-pci" would actually tell you the distance between the base address of a module named "mydriver" and the base address of pci.sys. Rather than deal with all that mess, the debugger simply s/[^\w]/_/g.

    The debugger carefully distinguishes between the *image file* name (i.e., the actual name, as it is known to you and the kernel) and the *module* name, which is essentially a string used by the debugger to unambiguously refer to a module (or rather, its base address). Although the module name is usually reminiscent of the image file name, they differ if needed for character substitution, uniqueness, and truncation of the file extension. Use "lmf" to see a table mapping the module name to an image file name.

    How do you work around it? The path of least resistance is to play along with the debugger's charade and refer to your module as "mydriver_pci".

    -----Original Message-----
    From: [email protected] [mailto:[email protected]] On Behalf Of Pavel A
    Sent: Sunday, February 26, 2012 9:08 AM
    To: Kernel Debugging Interest List
    Subject: [windbg] Can kernel module name contain "-" ?

    The file name of my driver is mydriver-pci.sys, but the module name in debugger (lm) is "mydriver_pci" ( - changed to _).
    Because of this (?) delayed breakpoints are not hit.

    I cannot find "mydriver_pci" anywhere in my sources or INF.
    So who does this and why? Is the "-" char invalid in module names?

    Thanks,
    -- pa

    ---
    WINDBG is sponsored by OSR

    For our schedule of WDF, WDM, debugging and other seminars visit:
    http://www.osr.com/seminars

    To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
  • Pavel_APavel_A Member Posts: 2,708
    Thanks, Jeffrey.

    Taken the path of least resistance (renamed the file).

    - pa

    On 27-Feb-2012 00:02, Jeffrey Tippet wrote:
    > The debugger is renaming your module on-the-fly. The reason is because module names can be used in dbgeng-MASM expressions, and the '-' character is a valid expression operator. So the evaluation "? mydriver-pci" would actually tell you the distance between the base address of a module named "mydriver" and the base address of pci.sys. Rather than deal with all that mess, the debugger simply s/[^\w]/_/g.
    >
    > The debugger carefully distinguishes between the *image file* name (i.e., the actual name, as it is known to you and the kernel) and the *module* name, which is essentially a string used by the debugger to unambiguously refer to a module (or rather, its base address). Although the module name is usually reminiscent of the image file name, they differ if needed for character substitution, uniqueness, and truncation of the file extension. Use "lmf" to see a table mapping the module name to an image file name.
    >
    > How do you work around it? The path of least resistance is to play along with the debugger's charade and refer to your module as "mydriver_pci".
    >
    > -----Original Message-----
    > From: [email protected] [mailto:[email protected]] On Behalf Of Pavel A
    > Sent: Sunday, February 26, 2012 9:08 AM
    > To: Kernel Debugging Interest List
    > Subject: [windbg] Can kernel module name contain "-" ?
    >
    > The file name of my driver is mydriver-pci.sys, but the module name in debugger (lm) is "mydriver_pci" ( - changed to _).
    > Because of this (?) delayed breakpoints are not hit.
    >
    > I cannot find "mydriver_pci" anywhere in my sources or INF.
    > So who does this and why? Is the "-" char invalid in module names?
    >
    > Thanks,
    > -- pa
    >
    > ---
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!

Upcoming OSR Seminars
OSR has suspended in-person seminars due to the Covid-19 outbreak. But, don't miss your training! Attend via the internet instead!
Kernel Debugging 30 Mar 2020 OSR Seminar Space
Developing Minifilters 15 Jun 2020 LIVE ONLINE
Writing WDF Drivers 22 June 2020 LIVE ONLINE
Internals & Software Drivers 28 Sept 2020 Dulles, VA