Windows System Software -- Consulting, Training, Development -- Unique Expertise, Guaranteed Results
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/
Hello,
I've run the code analysis on the usbip-win project.
I get the following warning:
driver\stub\stub_dev.c(130): warning C28175: The 'DriverName' member of _DRIVER_OBJECT should not be accessed by a driver: Access to this member may be permitted for certain classes of drivers. See the documentation for this warning for more information.
The source code follows as below:
static BOOLEAN is_usbip_stub_attached(PDEVICE_OBJECT pdo) { DEVICE_OBJECT *attached; attached = pdo->AttachedDevice; while (attached) { PDRIVER_OBJECT drvobj = attached->DriverObject; if (drvobj != NULL) { UNICODE_STRING name_uni; RtlInitUnicodeString(&name_uni, L"\\driver\\usbip_stub"); if (RtlEqualUnicodeString(&drvobj->DriverName, &name_uni, TRUE)) return TRUE; } attached = attached->AttachedDevice; } return FALSE; }
I've found that I can get the 'DriverName' member of _DRIVER_OBJECT using ObQueryNameString()
API via the following discussion:
Getting driver name from PDRIVER_OBJECT
I have checked the usage of the ObQueryNameString()
API, but I couldn't find the relevant example code.
I hope someone to let me know how to get the driver name of PDRIVER_OBJECT using ObQueryNameString()
API.
If there is another method to get the driver name, please let me know.
Thanks,
Andrey
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 | 13-17 May 2024 | Live, Online |
Developing Minifilters | 1-5 Apr 2024 | Live, Online |
Internals & Software Drivers | 11-15 Mar 2024 | Live, Online |
Writing WDF Drivers | 26 Feb - 1 Mar 2024 | Live, Online |