Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove StructSizeField from BLOB, BSTRBLOB #1978

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions generation/WinSDK/emitter.settings.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -1871,3 +1871,5 @@ StartServiceCtrlDispatcherA::lpServiceStartTable=[NativeArrayInfo]
StartServiceCtrlDispatcherW::lpServiceStartTable=[NativeArrayInfo]
PMPRADMINCONNECTIONHANGUPNOTIFICATION3::param3=RAS_CONNECTION_3*
DEVPROPKEY=[AlsoUsableFor("PROPERTYKEY")]
BLOB=[-StructSizeField]
BSTRBLOB=[-StructSizeField]
3 changes: 3 additions & 0 deletions scripts/ChangesSinceLastRelease.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2589,3 +2589,6 @@ Windows.Win32.System.Ioctl.Apis.DEVPKEY_Storage_Portable...Windows.Win32.Devices
Windows.Win32.System.Ioctl.Apis.DEVPKEY_Storage_Removable_Media...Windows.Win32.Devices.Properties.DEVPROPKEY => Windows.Win32.Foundation.DEVPROPKEY
Windows.Win32.System.Ioctl.Apis.DEVPKEY_Storage_System_Critical...Windows.Win32.Devices.Properties.DEVPROPKEY => Windows.Win32.Foundation.DEVPROPKEY
Windows.Win32.System.Power.Apis.PROCESSOR_NUMBER_PKEY...Windows.Win32.Devices.Properties.DEVPROPKEY => Windows.Win32.Foundation.DEVPROPKEY
# Remove StructSizeField from BLOB, BSTRBLOB
Windows.Win32.System.Com.BLOB : [Documentation(https://learn.microsoft.com/windows/win32/api/nspapi/ns-nspapi-blob),StructSizeField(cbSize)] => [Documentation(https://learn.microsoft.com/windows/win32/api/nspapi/ns-nspapi-blob)]
Windows.Win32.System.Com.StructuredStorage.BSTRBLOB : [StructSizeField(cbSize)] =>
30 changes: 15 additions & 15 deletions sources/ClangSharpSourceToWinmd/MetadataSyntaxTreeCleaner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,6 @@ public override SyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
node = node.AddAttributeLists(attributeList);
}

if (this.GetRemapInfo(fullName, node.AttributeLists, out var listAttributes, null, out _, out string newName))
{
node = (StructDeclarationSyntax)base.VisitStructDeclaration(node);
node = node.WithAttributeLists(FixRemappedAttributes(node.AttributeLists, listAttributes));

if (newName != null)
{
node = node.WithIdentifier(SyntaxFactory.Identifier(newName));
}
}
else
{
node = (StructDeclarationSyntax)base.VisitStructDeclaration(node);
}

foreach (var member in node.Members)
{
if (!(member is FieldDeclarationSyntax))
Expand All @@ -254,6 +239,21 @@ public override SyntaxNode VisitStructDeclaration(StructDeclarationSyntax node)
}
}

if (this.GetRemapInfo(fullName, node.AttributeLists, out var listAttributes, null, out _, out string newName))
{
node = (StructDeclarationSyntax)base.VisitStructDeclaration(node);
node = node.WithAttributeLists(FixRemappedAttributes(node.AttributeLists, listAttributes));

if (newName != null)
{
node = node.WithIdentifier(SyntaxFactory.Identifier(newName));
}
}
else
{
node = (StructDeclarationSyntax)base.VisitStructDeclaration(node);
}

return node;
}

Expand Down