Skip to content

Commit

Permalink
Merge branch 'main' into dxgi
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebattista authored May 6, 2024
2 parents 1340097 + 389a556 commit 372c4b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
4 changes: 4 additions & 0 deletions generation/WinSDK/autoTypes.json
Original file line number Diff line number Diff line change
Expand Up @@ -1365,6 +1365,7 @@
"Name": "SOCKET",
"ValueType": "UIntPtr",
"CloseApi": "closesocket",
"InvalidHandleValues": [ -1 ],
"NativeTypedef": true
},
{
Expand Down Expand Up @@ -2300,12 +2301,14 @@
"Name": "PTP_POOL",
"ValueType": "typedef struct _TP_POOL",
"CloseApi": "CloseThreadpool",
"InvalidHandleValues": [ 0 ],
"NativeTypedef": true
},
{
"Name": "PTP_CLEANUP_GROUP",
"ValueType": "typedef struct _TP_CLEANUP_GROUP",
"CloseApi": "CloseThreadpoolCleanupGroup",
"InvalidHandleValues": [ 0 ],
"NativeTypedef": true
},
{
Expand Down Expand Up @@ -2498,6 +2501,7 @@
"Name": "HIORING",
"ValueType": "DECLARE_HANDLE",
"CloseApi": "CloseIoRing",
"InvalidHandleValues": [ -1, 0 ],
"NativeTypedef": true
},
{
Expand Down
5 changes: 5 additions & 0 deletions scripts/ChangesSinceLastRelease.txt
Original file line number Diff line number Diff line change
Expand Up @@ -398,3 +398,8 @@ Windows.Win32.Graphics.Dxgi.IDXGISurface.GetDesc : pDesc : [Out] => [Out,RetVal]
Windows.Win32.Graphics.Dxgi.IDXGISwapChain.GetDesc : pDesc : [Out] => [Out,RetVal]
Windows.Win32.Graphics.Dxgi.IDXGISwapChain1.GetDesc1 : pDesc : [Out] => [Out,RetVal]
Windows.Win32.Graphics.Dxgi.IDXGISwapChain1.GetFullscreenDesc : pDesc : [Out] => [Out,RetVal]
# Add additional InvalidHandleValue metadata
Windows.Win32.Networking.WinSock.SOCKET : [NativeTypedef,RAIIFree(closesocket)] => [InvalidHandleValue(-1),NativeTypedef,RAIIFree(closesocket)]
Windows.Win32.Storage.FileSystem.HIORING : [NativeTypedef,RAIIFree(CloseIoRing)] => [InvalidHandleValue(-1),InvalidHandleValue(0),NativeTypedef,RAIIFree(CloseIoRing)]
Windows.Win32.System.Threading.PTP_CLEANUP_GROUP : [NativeTypedef,RAIIFree(CloseThreadpoolCleanupGroup)] => [InvalidHandleValue(0),NativeTypedef,RAIIFree(CloseThreadpoolCleanupGroup)]
Windows.Win32.System.Threading.PTP_POOL : [NativeTypedef,RAIIFree(CloseThreadpool)] => [InvalidHandleValue(0),NativeTypedef,RAIIFree(CloseThreadpool)]
26 changes: 6 additions & 20 deletions sources/ClangSharpSourceToWinmd/ClangSharpSourceWinmdGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,31 +144,17 @@ void InitModule(string assemblyName)

void InitReferences()
{
Version systemVersion = new Version(2, 1, 0, 0);
var netstandardAssembly = this.compilation.ReferencedAssemblyNames.ToList().Find(a => a.Name == SystemAssemblyName);
var systemAssemblyRef =
this.metadataBuilder.AddAssemblyReference(
this.metadataBuilder.GetOrAddString(netstandardAssembly.Name),
netstandardAssembly.Version,
default,
this.metadataBuilder.GetOrAddBlob(netstandardAssembly.PublicKeyToken),
default,
default);
this.assemblyNamesToRefHandles[SystemAssemblyName] = systemAssemblyRef;

var win32Assembly = this.compilation.ReferencedAssemblyNames.ToList().Find(a => a.Name == Win32MetadataAssemblyName);
if (win32Assembly != null)
foreach (var assembly in this.compilation.ReferencedAssemblyNames)
{
var win32MetadataAssemblyRef =
var assemblyRef =
this.metadataBuilder.AddAssemblyReference(
this.metadataBuilder.GetOrAddString(win32Assembly.Name),
win32Assembly.Version,
this.metadataBuilder.GetOrAddString(assembly.Name),
assembly.Version,
default,
this.metadataBuilder.GetOrAddBlob(win32Assembly.PublicKeyToken),
this.metadataBuilder.GetOrAddBlob(assembly.PublicKeyToken),
default,
default);

this.assemblyNamesToRefHandles[Win32MetadataAssemblyName] = win32MetadataAssemblyRef;
this.assemblyNamesToRefHandles[assembly.Name] = assemblyRef;
}
}
}
Expand Down

0 comments on commit 372c4b8

Please sign in to comment.