Skip to content

Commit 91f5c15

Browse files
authored
Merge pull request #1063 from microsoft/win32metadataUpdate
Bump win32metadata to 55.0.45
2 parents dd815b2 + 048cb29 commit 91f5c15

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

Directory.Packages.props

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<PropertyGroup>
44
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
55
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
6-
<MetadataVersion>54.0.44-preview</MetadataVersion>
7-
<WDKMetadataVersion>0.7.3-experimental</WDKMetadataVersion>
6+
<MetadataVersion>55.0.45-preview</MetadataVersion>
7+
<WDKMetadataVersion>0.9.9-experimental</WDKMetadataVersion>
88
<!-- <DiaMetadataVersion>0.2.185-preview-g7e1e6a442c</DiaMetadataVersion> -->
99
<ApiDocsVersion>0.1.42-alpha</ApiDocsVersion>
1010
<CodeAnalysisVersion>4.6.0</CodeAnalysisVersion>

src/Microsoft.Windows.CsWin32/Generator.Struct.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private StructDeclarationSyntax DeclareStruct(TypeDefinitionHandle typeDefHandle
8686
// get => (EnumType)this._fieldName;
8787
// set => this._fieldName = (UnderlyingType)value;
8888
// }
89-
this.RequestInteropType(this.Reader.GetString(typeDef.Namespace), propertyType.Identifier.ValueText, context);
89+
this.RequestInteropType(this.GetNamespaceForPossiblyNestedType(typeDef), propertyType.Identifier.ValueText, context);
9090
ExpressionSyntax fieldAccess = MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, ThisExpression(), IdentifierName(fieldDeclarator.Identifier));
9191
property = PropertyDeclaration(propertyType.WithTrailingTrivia(Space), Identifier(fieldName).WithTrailingTrivia(LineFeed))
9292
.AddModifiers(TokenWithSpace(this.Visibility))

src/Microsoft.Windows.CsWin32/Generator.cs

+12
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,18 @@ private string GetNormalizedModuleName(MethodImport import)
13291329
return moduleName;
13301330
}
13311331

1332+
private string GetNamespaceForPossiblyNestedType(TypeDefinition nestedTypeDef)
1333+
{
1334+
if (nestedTypeDef.IsNested)
1335+
{
1336+
return this.GetNamespaceForPossiblyNestedType(this.Reader.GetTypeDefinition(nestedTypeDef.GetDeclaringType()));
1337+
}
1338+
else
1339+
{
1340+
return this.Reader.GetString(nestedTypeDef.Namespace);
1341+
}
1342+
}
1343+
13321344
private ParameterListSyntax CreateParameterList(MethodDefinition methodDefinition, MethodSignature<TypeHandleInfo> signature, TypeSyntaxSettings typeSettings)
13331345
=> FixTrivia(ParameterList().AddParameters(methodDefinition.GetParameters().Select(this.Reader.GetParameter).Where(p => !p.Name.IsNil).Select(p => this.CreateParameter(signature.ParameterTypes[p.SequenceNumber - 1], p, typeSettings)).ToArray()));
13341346

test/Microsoft.Windows.CsWin32.Tests/StructTests.cs

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ public void InterestingStructs(
177177
"DRIVER_OBJECT", // has an inline array of delegates
178178
"DEVICE_RELATIONS", // ends with an inline "flexible" array
179179
"D3DHAL_CONTEXTCREATEDATA", // contains a field that is a pointer to a struct that is normally managed
180+
"MIB_TCPTABLE", // a struct that references another struct with a nested anonymous type, that loosely references an enum in the same namespace (by way of an attribute).
180181
"WSD_EVENT")] // has a pointer field to a managed struct
181182
string name,
182183
bool allowMarshaling)

0 commit comments

Comments
 (0)