The API that will not die: Microsoft opens crypt to unleash Win32 on Rust

Going low-level with C# and more

The Win32 API is being opened up to more languages by Microsoft via the win32metadata project.

The Windows API exposes large chunks of the Windows operating system to programmers. If you code in C or C++, the API calls are "readily accessible," according to Microsoft.

Anything else usually requires some sort of wrapper. An example of this is P/Invoke, which is intended to service C# developers (although it now points users to "a new, preferred approach for Win32" – Microsoft's win32metadata project.)

Microsoft's aim, as custodian of the Windows SDK, is to "make achieving broad and sustainable API coverage across languages a reality." In other words, it wants a one-stop shop for these API calls using whatever language a developer cares to bring to the table. Eventually.

As one would expect, the first language projection is C#/Win32, built with the assistance of Andrew Arnott of the P/Invoke project.

Interestingly, a Rust language projection is also in progress, allowing users to hit the Windows API directly from the metadata "as if they were just another Rust module."

On top of this, Microsoft is working on a modern C++ projection, and a look at the roadmap has the Win32 metadata packaged published to for the latest Windows SDK version in time for the company's Build 2021 event in May this year.

The Windows API itself (both in Win16 and Win32 guise) has long been a fixture for those targeting the Windows operating system. A dog-eared and decades-old copy of Dan Appleman's Visual Basic Programmers Guide to Win32 API likely decorates more than a few bookshelves, bookended by an additional tome or two by Charles Petzold. Works by Petzold, if you have some extra reading time, really drive home the potential horrors that await a careless coder seeking to prod the weirder corners of the operating system.

At the last Build, back in May 2020, Microsoft kicked off Project Reunion, a recognition that despite multiple attempts to replace the Win32 API with something fresher (WinRT and UWP spring to mind), Windows developers still needed those low-level calls.

The win32metadata project remains in a preview state at the moment. The publishing of the Win32 metadata package with all supported Windows SDK versions, as well as the publication of C#, C++, and Rust projections, is planned for the end of 2021. Other languages will follow in 2022 "based on demand." ®

Similar topics

Other stories you might like

  • Stolen university credentials up for sale by Russian crooks, FBI warns
    Forget dark-web souks, thousands of these are already being traded on public bazaars

    Russian crooks are selling network credentials and virtual private network access for a "multitude" of US universities and colleges on criminal marketplaces, according to the FBI.

    According to a warning issued on Thursday, these stolen credentials sell for thousands of dollars on both dark web and public internet forums, and could lead to subsequent cyberattacks against individual employees or the schools themselves.

    "The exposure of usernames and passwords can lead to brute force credential stuffing computer network attacks, whereby attackers attempt logins across various internet sites or exploit them for subsequent cyber attacks as criminal actors take advantage of users recycling the same credentials across multiple accounts, internet sites, and services," the Feds' alert [PDF] said.

    Continue reading
  • Big Tech loves talking up privacy – while trying to kill privacy legislation
    Study claims Amazon, Apple, Google, Meta, Microsoft work to derail data rules

    Amazon, Apple, Google, Meta, and Microsoft often support privacy in public statements, but behind the scenes they've been working through some common organizations to weaken or kill privacy legislation in US states.

    That's according to a report this week from news non-profit The Markup, which said the corporations hire lobbyists from the same few groups and law firms to defang or drown state privacy bills.

    The report examined 31 states when state legislatures were considering privacy legislation and identified 445 lobbyists and lobbying firms working on behalf of Amazon, Apple, Google, Meta, and Microsoft, along with industry groups like TechNet and the State Privacy and Security Coalition.

    Continue reading
  • SEC probes Musk for not properly disclosing Twitter stake
    Meanwhile, social network's board rejects resignation of one its directors

    America's financial watchdog is investigating whether Elon Musk adequately disclosed his purchase of Twitter shares last month, just as his bid to take over the social media company hangs in the balance. 

    A letter [PDF] from the SEC addressed to the tech billionaire said he "[did] not appear" to have filed the proper form detailing his 9.2 percent stake in Twitter "required 10 days from the date of acquisition," and asked him to provide more information. Musk's shares made him one of Twitter's largest shareholders. The letter is dated April 4, and was shared this week by the regulator.

    Musk quickly moved to try and buy the whole company outright in a deal initially worth over $44 billion. Musk sold a chunk of his shares in Tesla worth $8.4 billion and bagged another $7.14 billion from investors to help finance the $21 billion he promised to put forward for the deal. The remaining $25.5 billion bill was secured via debt financing by Morgan Stanley, Bank of America, Barclays, and others. But the takeover is not going smoothly.

    Continue reading

Biting the hand that feeds IT © 1998–2022