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/
The (kernel mode) audio driver I've been working on has lots of clutter/complexity due to lack of any RAII class use. In order to ensure single-entry single-exit (SESE), there's copious use of preprocessor macros containing goto. The code is also filled with explicit calls to IUnknown->Release() and other pairs of allocate/deallocate type functions.
I've been itching to look into replacing all the
ISomeType pointers with
_com_ptr_t<ISomeType>, but having read through a really long thread here about C vs C++ in kernel mode drivers (among other threads), I looked at the _com_ptr_t type (as defined in the standard Windows header files) and confirmed that it does indeed use exceptions.
Then I ran across a Microsoft header-only C++ library called Windows Implementation Libraries (WIL):
The Windows Implementation Libraries (WIL) is a header-only C++ library created to make life easier for developers on Windows through readable type-safe C++ interfaces for common Windows coding patterns. Some things that WIL includes to whet your appetite: - Smart pointers and auto-releasing resource wrappers...
A quick glance at the
com_ptr_t type there seems to indicate that they don't use exceptions (unless you define a preprocessor symbol to indicate that you want them. WIL is clearly not designed exclusively for the kernel environment; e.g. it includes types to wrap window handles and other stuff that only applies to user mode.
Still, I'm wondering whether anyone has used (or looked into using) WIL types in kernel code?
Windows Developer since 1989
|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!|
|Writing WDF Drivers||7 Dec 2020||LIVE ONLINE|
|Internals & Software Drivers||25 Jan 2021||LIVE ONLINE|
|Developing Minifilters||8 March 2021||LIVE ONLINE|