Skip to content

Commit

Permalink
Remove enum assignments and add [AssociatedEnum] when the types don…
Browse files Browse the repository at this point in the history
…'t align (#1572)

* Added test for enum size mismatches and started fixing reported issues or removing enum mappings for #1502.

The test seems to give up within a given family of issues after the first reported issue. Fixing issues will often reveal other related issues.

* Removed or corrected enums with mismatched sizes.

* Added AssociatedEnum attributes.

* Documented AssociatedEnum.

* Fixed bad merge.
  • Loading branch information
mikebattista committed May 22, 2023
1 parent 8b5756e commit 16a7e8e
Show file tree
Hide file tree
Showing 7 changed files with 1,348 additions and 1,170 deletions.
1 change: 1 addition & 0 deletions docs/projections.md
Expand Up @@ -56,6 +56,7 @@ DISCLAIMER: This list is a work in progress and is not yet comprehensive.
* Reserved parameters are decorated with the `[Reserved]` attribute. Since reserved parameters always expect a `NULL` value, projections can choose to abstract away these parameters to improve the developer experience.
* Pointer parameters that represent arrays are decorated with the `[NativeArrayInfo]` attribute that can contain the size of a fixed-length array (`CountConst`), the 0-based index of the parameter that defines the size of the array (`CountParamIndex`), or the struct field name (`CountFieldName`) that defines the size of the array
* Pointer parameters whose byte size must be specified in another parameter are decorated with the `[MemorySize]` attribute that will contain the 0-based index of the parameter that can be automatically populated with the size of the provided pointer parameter (`BytesParamIndex`) ([#284](https://github.com/microsoft/win32metadata/issues/284))
* Parameters that accept values from an enum but have conflicting types are decorated with the `[AssociatedEnum]` attribute indicating the enum that may be used with the parameter. The enum must exist in the same namespace as the API. This enables the metadata to preserve the original API definition while allowing projections to improve usability of the API with the enum if they choose. ([#1502](https://github.com/microsoft/win32metadata/issues/1502))
* Output parameters that must be closed with a specific function are decorated with the `[FreeWith]` attribute
* Handle parameters that should not be closed are decorated with the `[DoNotRelease]` attribute
* Handle parameters or return values decorated with `[ReturnsUnownedHandle]` are unowned ([#792](https://github.com/microsoft/win32metadata/issues/792))
Expand Down
349 changes: 245 additions & 104 deletions generation/WinSDK/emitter.settings.rsp

Large diffs are not rendered by default.

0 comments on commit 16a7e8e

Please sign in to comment.