Previously, these constants were manually added as top-level constants. However, with #819, it's no longer feasible to expose all Win32 enumerations this way due to name conflicts. Therefore, to solve this problem, all Win32 enumerations need to be placed under a namespace. Win32 enumerations are also defined this way in the metadata.
For example:
I think extension types are a great choice for organizing the enumerations. They act as a namespace and incur zero-cost. I also have plans to update the parameter types of Win32 functions that accept enumerations to use the corresponding extension type. This adjustment will give users clarity on the acceptable values they can pass, as opposed to the current generic int representation.
To facilitate this transition, this PR introduces Win32 enums as extension types based on int while also deprecating top-level constants. Additionally, this PR includes data-driven fixes to automate the migration process. Tests for deprecated constants have also been added to ensure their values are the same as newly added constants. Thanks to these tests, I also fixed some constants that had incorrect values.
Part of #819
Previously, these constants were manually added as top-level constants. However, with #819, it's no longer feasible to expose all Win32 enumerations this way due to name conflicts. Therefore, to solve this problem, all Win32 enumerations need to be placed under a namespace. Win32 enumerations are also defined this way in the metadata.
For example:
I think extension types are a great choice for organizing the enumerations. They act as a namespace and incur zero-cost. I also have plans to update the parameter types of Win32 functions that accept enumerations to use the corresponding extension type. This adjustment will give users clarity on the acceptable values they can pass, as opposed to the current generic
int
representation.To facilitate this transition, this PR introduces Win32 enums as extension types based on
int
while also deprecating top-level constants. Additionally, this PR includes data-driven fixes to automate the migration process. Tests for deprecated constants have also been added to ensure their values are the same as newly added constants. Thanks to these tests, I also fixed some constants that had incorrect values.