Skip to content

Remove enum assignments and add [AssociatedEnum] when the types don't align - #1572

Merged
Mike Battista (mikebattista) merged 8 commits into
mainfrom
mikebattista/enumsigns
May 22, 2023
Merged

Remove enum assignments and add [AssociatedEnum] when the types don't align#1572
Mike Battista (mikebattista) merged 8 commits into
mainfrom
mikebattista/enumsigns

Conversation

@mikebattista

Copy link
Copy Markdown
Contributor

Fixed #1502.
Fixed #1143.

The build will fail if an enum is assigned and the size or the sign don't match the original API.

Where the types of the enums could be changed to match the original API, I changed the type.

AssociatedEnum contains the name of the associated enum which must exist in the same namespace as the API. All failures where the enum lived in the same namespace have been decorated with this attribute. Exceptions are below.

I added an exception for functions that are remapped to return WIN32_ERROR but don't return uint. For scenarios where the associated enum lived in a different namespace than the API, this was the bulk of the APIs.

AppPolicyGetClrCompat::return=WIN32_ERROR
AppPolicyGetCreateFileAccess::return=WIN32_ERROR
AppPolicyGetLifecycleManagement::return=WIN32_ERROR
AppPolicyGetMediaFoundationCodecLoading::return=WIN32_ERROR
AppPolicyGetProcessTerminationMethod::return=WIN32_ERROR
AppPolicyGetShowDeveloperDiagnostic::return=WIN32_ERROR
AppPolicyGetThreadInitializationType::return=WIN32_ERROR
AppPolicyGetWindowingModel::return=WIN32_ERROR
ClosePackageInfo::return=WIN32_ERROR
FindPackagesByPackageFamily::return=WIN32_ERROR
FormatApplicationUserModelId::return=WIN32_ERROR
GetApplicationUserModelId::return=WIN32_ERROR
GetApplicationUserModelIdFromToken::return=WIN32_ERROR
GetCurrentApplicationUserModelId::return=WIN32_ERROR
GetCurrentPackageFamilyName::return=WIN32_ERROR
GetCurrentPackageFullName::return=WIN32_ERROR
GetCurrentPackageId::return=WIN32_ERROR
GetCurrentPackageInfo::return=WIN32_ERROR
GetCurrentPackageInfo2::return=WIN32_ERROR
GetCurrentPackagePath::return=WIN32_ERROR
GetCurrentPackagePath2::return=WIN32_ERROR
GetDisplayConfigBufferSizes::return=WIN32_ERROR
GetPackageApplicationIds::return=WIN32_ERROR
GetPackageFamilyName::return=WIN32_ERROR
GetPackageFamilyNameFromToken::return=WIN32_ERROR
GetPackageFullName::return=WIN32_ERROR
GetPackageFullNameFromToken::return=WIN32_ERROR
GetPackageId::return=WIN32_ERROR
GetPackageInfo::return=WIN32_ERROR
GetPackageInfo2::return=WIN32_ERROR
GetPackagePath::return=WIN32_ERROR
GetPackagePathByFullName::return=WIN32_ERROR
GetPackagePathByFullName2::return=WIN32_ERROR
GetPackagesByPackageFamily::return=WIN32_ERROR
GetStagedPackageOrigin::return=WIN32_ERROR
GetStagedPackagePathByFullName::return=WIN32_ERROR
GetStagedPackagePathByFullName2::return=WIN32_ERROR
OpenPackageInfoByFullName::return=WIN32_ERROR
OpenPackageInfoByFullNameForUser::return=WIN32_ERROR
PackageFamilyNameFromFullName::return=WIN32_ERROR
PackageFamilyNameFromId::return=WIN32_ERROR
PackageFullNameFromId::return=WIN32_ERROR
PackageIdFromFullName::return=WIN32_ERROR
PackageNameAndPublisherIdFromFamilyName::return=WIN32_ERROR
ParseApplicationUserModelId::return=WIN32_ERROR
QueryDisplayConfig::return=WIN32_ERROR
RegDisableReflectionKey::return=WIN32_ERROR
RegEnableReflectionKey::return=WIN32_ERROR
RegQueryReflectionKey::return=WIN32_ERROR
VerifyApplicationUserModelId::return=WIN32_ERROR
VerifyPackageFamilyName::return=WIN32_ERROR
VerifyPackageFullName::return=WIN32_ERROR
VerifyPackageId::return=WIN32_ERROR
VerifyPackageRelativeApplicationId::return=WIN32_ERROR

Below are the rest of the APIs where the enums did not live in the same namespace as the API. I left them without an associated enum for now.

Windows.Win32.System.Com.StructuredStorage.ILockBytes.LockRegion : dwLockType...LOCKTYPE => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Com.StructuredStorage.ILockBytes.Stat : grfStatFlag...STATFLAG => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Com.StructuredStorage.IStorage.Commit : grfCommitFlags...STGC => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Com.StructuredStorage.IStorage.Stat : grfStatFlag...STATFLAG => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Ole.IPropertyPage.Show : nCmdShow...SHOW_WINDOW_CMD => UInt32 # Windows.Win32.UI.WindowsAndMessaging
Windows.Win32.System.Ole.IRecordInfo.PutField : wFlags...INVOKEKIND => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Ole.IRecordInfo.PutFieldNoCopy : wFlags...INVOKEKIND => UInt32 # Windows.Win32.System.Com
Windows.Win32.System.Ole.IViewObject.SetAdvise : advf...ADVF => UInt32 # Windows.Win32.System.Com
Windows.Win32.UI.Controls.Apis.EnableScrollBar : wSBflags...SCROLLBAR_CONSTANTS => UInt32 # Windows.Win32.UI.WindowsAndMessaging
Windows.Win32.UI.Controls.RichEdit.ITextHost.TxEnableScrollBar : fuArrowflags...ENABLE_SCROLL_BAR_ARROWS => Int32 # Windows.Win32.UI.Controls
Windows.Win32.UI.Controls.RichEdit.ITextRange2.InsertImage : Type...TEXT_ALIGN_OPTIONS => Int32 # Windows.Win32.Graphics.Gdi
Windows.Win32.UI.Controls.RichEdit.RICHEDIT_IMAGE_PARAMETERS.Type(X64, Arm64)...Windows.Win32.Graphics.Gdi.TEXT_ALIGN_OPTIONS => System.Int32 # Windows.Win32.Graphics.Gdi
Windows.Win32.UI.Controls.RichEdit.RICHEDIT_IMAGE_PARAMETERS.Type(X86)...Windows.Win32.Graphics.Gdi.TEXT_ALIGN_OPTIONS => System.Int32 # Windows.Win32.Graphics.Gdi

…s 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.
@mikebattista
Mike Battista (mikebattista) deleted the mikebattista/enumsigns branch May 22, 2023 05:13
@timsneath

Copy link
Copy Markdown
Contributor

Awesome stuff! Thank you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: Flags are not being marked as unsigned Consider adding enum for PICTYPE_ constants for use on PICTDESC

2 participants