Microsoft is Looking to Rust for Windows Driver Development Too

Steel Stacks in Bethlehem, PA

Microsoft’s embrace of the memory-safe Rust programming language continues, with the software giant taking the first steps down an all-new path: It is enabling the development of Windows hardware drivers in Rust so that developers can finally move off of the unsafe C and C++ languages.

“[We’re] working towards enabling Windows driver development in Rust,” Microsoft Technical Fellow and Azure CTO Mark Russinovich revealed on Twitter. He then linked to a GitHub repository created by Microsoft that enabled Windows driver development in Rust.

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday — and get free copies of Paul Thurrott's Windows 11 and Windows 10 Field Guides (normally $9.99) as a special welcome gift!

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

“This repo is a collection of Rust crates that enable developers to develop Windows drivers in Rust,” the repository’s readme notes. “It is [our] intention to support both WDM [Windows Driver Model] and [the higher-level] WDF [Windows Driver Frameworks] driver development models.”

Microsoft announced that it would rewrite key parts of the Windows kernel in Rust back in April, and then it followed up with the first live code in a Windows Insider Program build of the OS a month later. But the firm had been investigating this possibility for years, with an eye on replacing legacy C/C++ code with something more safe and secure. In 2022, for example, Mr. Russinovich declared that “it’s time to halt starting any new projects in C/C++ and use Rust for those scenarios where a non-GC [garbage-collected] language [like C# or Java] is required. For the sake of security and reliability, the industry should declare those languages as deprecated.”

Well, it looks like Microsoft is taking that advice seriously. And Rust is a great choice: As I wrote in Small Bytes: Rust (Premium), Microsoft is embracing the language for the same reasons that Linus Torvalds and the other maintainers of the Linux kernel are as well. Rust forces developers to write safe code that cannot improperly handle memory, a key avenue of attack for malicious hackers and the underlying cause of about two-thirds of all security vulnerabilities.

Of course, C/C++ code is so pervasive throughout the Internet that we’ll never get rid of it all—in Windows, most user-mode code is (or at least was) C++ while most kernel code is C, according to Microsoft’s Raymond Chen—but moving this code into maintenance mode makes sense. As does replacing it, where possible, with safer Rust code.

Tagged with

Share post

Please check our Community Guidelines before commenting

Windows Intelligence In Your Inbox

Sign up for our new free newsletter to get three time-saving tips each Friday

"*" indicates required fields

This field is for validation purposes and should be left unchanged.

Thurrott © 2024 Thurrott LLC