Tooling to generate metadata for Win32 APIs in the Windows SDK.
Перейти к файлу
Geoffrey Trousdale 938e429027 Initial commit to use 1ES pipeline template 2024-02-01 17:37:58 -05:00
.github Update CODEOWNERS (#1753) 2023-12-04 10:35:55 -08:00
.vscode * Fix several issues caused by the partitions change 2021-01-12 15:11:15 -08:00
BuildTools Update to latest Windows SDK 10.0.22621.2428. Fixed #1751. 2023-12-05 14:40:58 -08:00
apidocs Update tools to .NET 8. Fixed #1746. 2024-01-03 10:47:30 -08:00
buildTransitive Create msbuild ProjectionMetadataWinmd item in package import 2021-09-01 10:01:32 -06:00
docs ChangeServiceConfig dwServiceType not using ENUM_SERVICE_TYPE. Fixed #1629. 2023-08-22 10:39:23 -07:00
ext Updated sdk-api submodule. 2023-05-07 10:37:50 -07:00
generation/WinSDK `CLSID_DxcUtils` is not included in metadata. Fixed #1812. 2024-01-24 10:08:25 -08:00
images Updated screenshot. 2023-04-12 16:35:14 -07:00
licenses Use a license file instead of a URL (#1072) 2022-08-20 14:06:53 -07:00
scripts Updated to v59. 2024-01-24 15:36:58 -08:00
sources Updated to v59. 2024-01-24 15:36:58 -08:00
tests Added ConsoleControl for #1782. 2024-01-18 07:42:53 -08:00
.editorconfig Incremental build system (#670) 2021-09-23 21:38:28 -07:00
.gitattributes String constants need attribute indicating original encoding (#1309) 2022-10-11 11:02:07 -07:00
.gitignore Fixes #837 - Allow for the removal of attributes when emitting the winmd (#857) 2022-03-28 16:57:19 -07:00
.gitmodules Updated .gitmodules. 2023-05-07 01:48:21 -07:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2020-06-08 14:52:16 -07:00
CONTRIBUTING.md Minor casing change. 2023-12-18 10:19:46 -08:00
Directory.Build.props Updated to v59. 2024-01-24 15:36:58 -08:00
Directory.Build.targets Adding empty Directory.Build.props/targets to avoid picking up external ones 2021-01-30 09:34:05 -08:00
DoAll.ps1 Fix clean problem in doall (#1196) 2022-08-29 22:39:59 -07:00
LICENSE Added note about SDK headers. 2023-03-13 13:09:35 -07:00
README.md Update README.md (#1596) 2023-06-24 10:21:20 -05:00
SECURITY.md Initial SECURITY.md commit 2020-06-08 14:52:18 -07:00
azure-pipelines-apidocs.yml Include MicrosoftDocs/Win32 in the Win32Docs package (#1561) 2023-05-05 08:57:51 -07:00
azure-pipelines.yml Initial commit to use 1ES pipeline template 2024-02-01 17:37:58 -05:00
global.json Update tools to .NET 8. Fixed #1746. 2024-01-03 10:47:30 -08:00
nuget.config Build authoring cleanup (#630) 2021-09-02 20:36:15 -07:00
release-apidocs.yml Updated powershell command. 2023-05-05 12:49:18 -07:00
release.yml Renamed pipeline. 2023-05-03 16:50:12 -07:00
strongname.snk Add API Docs package build to pipeline 2021-06-24 11:52:46 -06:00
version.json Updated to v59. 2024-01-24 15:36:58 -08:00

README.md

Overview

Win32 APIs provide functionality that not all languages and frameworks support themselves. When developing for Windows, developers often call into Win32 APIs to access this functionality.

Historically, this has required manually redefining the APIs to make them accessible, which is fragile and error-prone. Community projects like https://github.com/dotnet/pinvoke (.NET) and https://github.com/retep998/winapi-rs (Rust) have taken on the burden of providing strongly-typed and validated API signatures for their frameworks, but the projects are manually maintained, which is hard to sustain and makes it challenging to provide thorough API coverage.

This project aims to provide metadata for Win32 APIs such that idiomatic projections and projects like the ones above can be generated for all languages and frameworks in a more automated way and with more complete API coverage.

To call Win32 APIs from the language of your choice based off of this metadata, use the following language projections:


Note: Community projects are listed here to help with discovery but are not officially validated by Microsoft.

See the roadmap and FAQ for more details.

If you'd like to browse the metadata to see what we're emitting, extract Windows.Win32.winmd from the Microsoft.Windows.SDK.Win32Metadata NuGet package and load Windows.Win32.winmd in ILSpy. Download the package and rename it to .zip to browse and extract its content.

ILSpy with winmd

Principles

Below are some principles that guide the metadata that we produce:

  • Provide the broadest API coverage possible
  • Keep the names of the original APIs, but express in metadata additional information that can make them easier to use.
  • Convert non-specific types like uint that use constants into explicit enums to improve usability and discoverability. Keep enum member names consistent with the original constant names to preserve SEO.
  • Express Win32 typedefs like HANDLE and GDI objects as strongly-typed structs. The definition of these structs include how to dispose of the resources (like CloseHandle or DeleteObject). It is up to language projections to make use of this information in a language-specific way. For example, a C# projection could use SafeHandle objects for HANDLE and GDI objects.

Architecture

See ARCHITECTURE.md.

Projections

See PROJECTIONS.md.

Contributing

See CONTRIBUTING.md.

Licensing

MIT

Windows SDK

  • All Windows headers (e.g. RecompiledIdlHeaders) and Interface Definition Language (IDL) files in this repository and in the aforementioned NuGet package.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.