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/
Hey Guys,
I am hearing that WDF drivers can be written in C++. I have been doing this in C all the time. I have not seen any C++ samples as well.
Any opinions on this?? Is this documented somewhere?
Thanks
-Aj
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! | ||
Internals & Software Drivers | 19-23 June 2023 | Live, Online |
Writing WDF Drivers | 10-14 July 2023 | Live, Online |
Kernel Debugging | 16-20 October 2023 | Live, Online |
Developing Minifilters | 13-17 November 2023 | Live, Online |
Comments
This just means you haven't been paying attention, for quite a long time. Surely it's time for this question to die. Multimedia drivers (audio and video) have been written in C++ for 25 years. There's nothing special about KMDF in this regard. It's just a library. Remember, KMDF itself is all written in C++.
I'm waiting for drivers to be written in Rust. I think that language has great potential.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
OP: Search the archives. We’ve discussed this at great length and we’re not going to rehash it here.
Rust: If you are sufficiently motivated, you can write Windows drivers in Rust today, because C interfaces are directly Rust callable. I’ve “done” it, if you can call issuing a DbgPrint from DriverEntry having “written a Windows driver in Rust.” ;-)
As enthused as I am about the concept of having a modern language for system software programming, I did not enjoy my time using Rust even a little bit. And, yes, I did quite a bit more than just “writing that driver.” I found the language enormously cumbersome and frustrating. What was worse, was I found the state of Rust development chaotic… with randomly contributed, supported, discontinued, added and deprecated features and “crates.” It made me insane.
My point is, I was all excited about writing drivers in Rust as well… until I actually spent a few weeks working in the language. Now, not so much.
I still miss “System C#”….
Peter
Peter Viscarola
OSR
@OSRDrivers
@Tim_Roberts : Yes you are right that I have not been paying attention on this. I have written AVSTREAM drivers in C++ about 14 years back and I know it use to work. At that time it was not advisable to write other drivers in C++. I have not been writing windows drivers since then. So yes, my knowledge is not as up to date as it should be.
Thanks for the information guys. Really appreciate it.
Frustration is not always a bad thing. Rust, like Pascal, puts the focus on a terribly picky compiler. If you can express your solution in a way that satisfies the compiler, then the odds of successful execution are much improved. We C advocates are spoiled because the compiler allows almost any random sequence of characters to compile to something, and it's up to us to refine that at runtime.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
That seems like a false note. Making a more fussy or less fussy compiler happy seems like addressing 'single line' issues. These are real problems, but usually of the least significant kind.
Being frustrated enough to spend the effort to figure out the answers to big problems never seems like a bad thing though
I understand that this is the intention. And I agree it's a valuable thing to do. And I really wanted to like it.
Doing it in Rust, however... I just found it hard to grasp fully, and entirely no fun. I offer the following simple illustration of the basic precepts of std::result and matching from rust-lang.org:
I really find that unnecessarily annoying.
Peter Viscarola
OSR
@OSRDrivers
Ick. This reminds me of Lisp, or from even earlier APL ...
I think I'll let Rust remain the thing I scrape off my grill every summer ...
LOL... LOL... APL. No, no, APL is really much worse:
avg←{+/⍵÷⍴⍵}
Peter Viscarola
OSR
@OSRDrivers
mm
Sent from my iPhone
Oh, WOULD that I did.
Peter Viscarola
OSR
@OSRDrivers
Yep, although the 5100 that it went with has long since been retired ... let a user program both in Basic and APL, still look back fondly at the "quote quad" for printing output ... just didn't get simpler than that, and the matrix math calculations were simple to set up. There are some versions of APL which are out there still for Linux ... sigh ...
Iverson a bit. He rode the train with him when Ken was an adjunct or
something (not entirely sure) at Wharton and my father was a student. My
father said clearly brilliant, not entirely a practical sort.
mm
I remember that the APL "terminal" I used was one of those IBM typewriters with a "ball" element. Ah, here, and a better picture here. Yup, it was connected to an IBM 360.
I remember being able to write the code to perform a multiple regression analysis in, like, 4 lines or something. Because matrix invert and transpose were native symbols.
Oh, MUCH better than that. You can try it online: https://tryapl.org/
And that would describe APL, as well.
Well, we certainly have sucked this thread off into a different universe, haven't we?
Peter
Peter Viscarola
OSR
@OSRDrivers
My fault, sorry. It's a bad habit of mine.
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
No, no, no... not at all. It's been almost entirely me.
Well, at least we know the mods won't yell at us ;-)
P
Peter Viscarola
OSR
@OSRDrivers
Wow, I am glad that we like to have some fun as well.