From 21393c3c8eaa14e6e57a473115238d2999e5c013 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Tue, 2 Sep 2025 13:55:42 -0400 Subject: [PATCH 01/13] Add CMake directions for the WinSDK overlay Add CMake scripting/etc. for the WinSDK cross-import overlay. --- Sources/Overlays/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/Overlays/CMakeLists.txt b/Sources/Overlays/CMakeLists.txt index 5629e8229..d4a0e75f2 100644 --- a/Sources/Overlays/CMakeLists.txt +++ b/Sources/Overlays/CMakeLists.txt @@ -11,3 +11,4 @@ add_subdirectory(_Testing_CoreGraphics) add_subdirectory(_Testing_CoreImage) add_subdirectory(_Testing_Foundation) add_subdirectory(_Testing_UIKit) +add_subdirectory(_Testing_WinSDK) From 9647c066ce1d4b642a7a02aa28ba7d6a4c73b1df Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Tue, 2 Sep 2025 15:29:12 -0400 Subject: [PATCH 02/13] Sigh --- .../Overlays/_Testing_WinSDK/CMakeLists.txt | 29 +++++++++++++++++++ .../WinSDK.swiftoverlay | 3 ++ 2 files changed, 32 insertions(+) create mode 100644 Sources/Overlays/_Testing_WinSDK/CMakeLists.txt create mode 100644 Sources/Testing/Testing.swiftcrossimport/WinSDK.swiftoverlay diff --git a/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt new file mode 100644 index 000000000..c9e4dd6e4 --- /dev/null +++ b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt @@ -0,0 +1,29 @@ +# This source file is part of the Swift.org open source project +# +# Copyright (c) 2024–2025 Apple Inc. and the Swift project authors +# Licensed under Apache License v2.0 with Runtime Library Exception +# +# See http://swift.org/LICENSE.txt for license information +# See http://swift.org/CONTRIBUTORS.txt for Swift project authors + +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") + add_library(_Testing_WinSDK + Attachments/_AttachableImageWrapper+AttachableWrapper.swift + Attachments/AttachableAsIWICBitmapSource.swift + Attachments/AttachableImageFormat+CLSID.swift + Attachments/Attachment+AttachableAsIWICBitmapSource.swift + Attachments/HBITMAP+AttachableAsIWICBitmapSource.swift + Attachments/HICON+AttachableAsIWICBitmapSource.swift + Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift + Attachments/UnsafeMutablePointer+AttachableAsIWICBitmapSource.swift + ReexportTesting.swift) + + target_link_libraries(_Testing_WinSDK PUBLIC + Testing) + + target_compile_options(_Testing_WinSDK PRIVATE + -enable-library-evolution + -emit-module-interface -emit-module-interface-path $/_Testing_WinSDK.swiftinterface) + + _swift_testing_install_target(_Testing_WinSDK) +endif() \ No newline at end of file diff --git a/Sources/Testing/Testing.swiftcrossimport/WinSDK.swiftoverlay b/Sources/Testing/Testing.swiftcrossimport/WinSDK.swiftoverlay new file mode 100644 index 000000000..fdaa23701 --- /dev/null +++ b/Sources/Testing/Testing.swiftcrossimport/WinSDK.swiftoverlay @@ -0,0 +1,3 @@ +version: 1 +modules: +- name: _Testing_WinSDK From e8cc3c8e34ba030349acf9f7345e3cd589554a47 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 09:02:56 -0400 Subject: [PATCH 03/13] Add missing files to CMakeLists.txt --- Sources/Overlays/_Testing_WinSDK/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt index c9e4dd6e4..4dcbc706e 100644 --- a/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt +++ b/Sources/Overlays/_Testing_WinSDK/CMakeLists.txt @@ -16,6 +16,9 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") Attachments/HICON+AttachableAsIWICBitmapSource.swift Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift Attachments/UnsafeMutablePointer+AttachableAsIWICBitmapSource.swift + Support/Additions/GUIDAdditions.swift + Support/Additions/IPropertyBag2Additions.swift + Support/Additions/IWICImagingFactoryAdditions.swift ReexportTesting.swift) target_link_libraries(_Testing_WinSDK PUBLIC @@ -26,4 +29,4 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") -emit-module-interface -emit-module-interface-path $/_Testing_WinSDK.swiftinterface) _swift_testing_install_target(_Testing_WinSDK) -endif() \ No newline at end of file +endif() From f3a236413aa62e787897fbc14fc7d306bed56022 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 11:49:18 -0400 Subject: [PATCH 04/13] HRESULT and DWORD vary on 32-bit Windows --- ..._AttachableImageWrapper+AttachableWrapper.swift | 2 +- .../Attachments/Images/ImageAttachmentError.swift | 14 ++++++++------ Sources/Testing/Support/CError.swift | 8 ++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift index d80c2eb01..5252a919d 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift @@ -93,7 +93,7 @@ extension _AttachableImageWrapper: Attachable, AttachableWrapper where Image: At guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } - rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(bitPattern: STGC_DEFAULT.rawValue)) + rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(STGC_DEFAULT.rawValue)) guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index de421bfd9..01ee07e46 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -8,7 +8,9 @@ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors // -private import _TestingInternals +#if os(Windows) +package import _TestingInternals // for HRESULT +#endif /// A type representing an error that can occur when attaching an image. package enum ImageAttachmentError: Error { @@ -23,19 +25,19 @@ package enum ImageAttachmentError: Error { case couldNotConvertImage #elseif os(Windows) /// A call to `QueryInterface()` failed. - case queryInterfaceFailed(Any.Type, Int32) + case queryInterfaceFailed(Any.Type, HRESULT) /// The testing library failed to create a COM object. - case comObjectCreationFailed(Any.Type, Int32) + case comObjectCreationFailed(Any.Type, HRESULT) /// An image could not be written. - case imageWritingFailed(Int32) + case imageWritingFailed(HRESULT) /// The testing library failed to get an in-memory stream's underlying buffer. - case globalFromStreamFailed(Int32) + case globalFromStreamFailed(HRESULT) /// A property could not be written to a property bag. - case propertyBagWritingFailed(String, Int32) + case propertyBagWritingFailed(String, HRESULT) #endif } diff --git a/Sources/Testing/Support/CError.swift b/Sources/Testing/Support/CError.swift index b392191d1..21ba8ae47 100644 --- a/Sources/Testing/Support/CError.swift +++ b/Sources/Testing/Support/CError.swift @@ -8,7 +8,11 @@ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors // +#if os(Windows) +package import _TestingInternals // for DWORD +#else internal import _TestingInternals +#endif /// A type representing an error from a C function such as `fopen()`. /// @@ -28,9 +32,9 @@ struct CError: Error, RawRepresentable { /// /// This type is not part of the public interface of the testing library. package struct Win32Error: Error, RawRepresentable { - package var rawValue: CUnsignedLong + package var rawValue: DWORD - package init(rawValue: CUnsignedLong) { + package init(rawValue: DWORD) { self.rawValue = rawValue } } From 9015dd032d01c674dc807acb707dcb9401a4f6e2 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 11:51:05 -0400 Subject: [PATCH 05/13] Exclude CMakeLists.txt --- Package.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Package.swift b/Package.swift index 35331296f..5206b268e 100644 --- a/Package.swift +++ b/Package.swift @@ -269,6 +269,7 @@ let package = Package( "Testing", ], path: "Sources/Overlays/_Testing_WinSDK", + exclude: ["CMakeLists.txt"], swiftSettings: .packageSettings + .enableLibraryEvolution() ), From add41b5d0447a6a1a5b2d77a1154932ad015875b Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 12:12:24 -0400 Subject: [PATCH 06/13] Oh right Linux --- Sources/Testing/Attachments/Images/ImageAttachmentError.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index 01ee07e46..a7b74198a 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -10,6 +10,8 @@ #if os(Windows) package import _TestingInternals // for HRESULT +#else +private import _TestingInternals #endif /// A type representing an error that can occur when attaching an image. From 33847e6551c84bc51efacf791cda61e61db19596 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 14:30:50 -0400 Subject: [PATCH 07/13] Revert "Oh right Linux" This reverts commit add41b5d0447a6a1a5b2d77a1154932ad015875b. --- Sources/Testing/Attachments/Images/ImageAttachmentError.swift | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index a7b74198a..01ee07e46 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -10,8 +10,6 @@ #if os(Windows) package import _TestingInternals // for HRESULT -#else -private import _TestingInternals #endif /// A type representing an error that can occur when attaching an image. From 87d96837cfe09ed44b57c39505307263cfb898ab Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 14:30:51 -0400 Subject: [PATCH 08/13] Revert "HRESULT and DWORD vary on 32-bit Windows" This reverts commit f3a236413aa62e787897fbc14fc7d306bed56022. --- ..._AttachableImageWrapper+AttachableWrapper.swift | 2 +- .../Attachments/Images/ImageAttachmentError.swift | 14 ++++++-------- Sources/Testing/Support/CError.swift | 8 ++------ 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift index 5252a919d..d80c2eb01 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift @@ -93,7 +93,7 @@ extension _AttachableImageWrapper: Attachable, AttachableWrapper where Image: At guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } - rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(STGC_DEFAULT.rawValue)) + rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(bitPattern: STGC_DEFAULT.rawValue)) guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index 01ee07e46..de421bfd9 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -8,9 +8,7 @@ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors // -#if os(Windows) -package import _TestingInternals // for HRESULT -#endif +private import _TestingInternals /// A type representing an error that can occur when attaching an image. package enum ImageAttachmentError: Error { @@ -25,19 +23,19 @@ package enum ImageAttachmentError: Error { case couldNotConvertImage #elseif os(Windows) /// A call to `QueryInterface()` failed. - case queryInterfaceFailed(Any.Type, HRESULT) + case queryInterfaceFailed(Any.Type, Int32) /// The testing library failed to create a COM object. - case comObjectCreationFailed(Any.Type, HRESULT) + case comObjectCreationFailed(Any.Type, Int32) /// An image could not be written. - case imageWritingFailed(HRESULT) + case imageWritingFailed(Int32) /// The testing library failed to get an in-memory stream's underlying buffer. - case globalFromStreamFailed(HRESULT) + case globalFromStreamFailed(Int32) /// A property could not be written to a property bag. - case propertyBagWritingFailed(String, HRESULT) + case propertyBagWritingFailed(String, Int32) #endif } diff --git a/Sources/Testing/Support/CError.swift b/Sources/Testing/Support/CError.swift index 21ba8ae47..b392191d1 100644 --- a/Sources/Testing/Support/CError.swift +++ b/Sources/Testing/Support/CError.swift @@ -8,11 +8,7 @@ // See https://swift.org/CONTRIBUTORS.txt for Swift project authors // -#if os(Windows) -package import _TestingInternals // for DWORD -#else internal import _TestingInternals -#endif /// A type representing an error from a C function such as `fopen()`. /// @@ -32,9 +28,9 @@ struct CError: Error, RawRepresentable { /// /// This type is not part of the public interface of the testing library. package struct Win32Error: Error, RawRepresentable { - package var rawValue: DWORD + package var rawValue: CUnsignedLong - package init(rawValue: DWORD) { + package init(rawValue: CUnsignedLong) { self.rawValue = rawValue } } From 9ebc67a2798a6b37f80e1a905ef4a2739547c1bb Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 3 Sep 2025 14:33:26 -0400 Subject: [PATCH 09/13] Try again with HRESULT and whatnot --- ...tachableImageWrapper+AttachableWrapper.swift | 2 +- .../Images/ImageAttachmentError.swift | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift index d80c2eb01..5252a919d 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift @@ -93,7 +93,7 @@ extension _AttachableImageWrapper: Attachable, AttachableWrapper where Image: At guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } - rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(bitPattern: STGC_DEFAULT.rawValue)) + rCommit = stream.pointee.lpVtbl.pointee.Commit(stream, DWORD(STGC_DEFAULT.rawValue)) guard rCommit == S_OK else { throw ImageAttachmentError.imageWritingFailed(rCommit) } diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index de421bfd9..34da0530b 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -22,20 +22,27 @@ package enum ImageAttachmentError: Error { /// The image could not be converted. case couldNotConvertImage #elseif os(Windows) + /// The architecture-specific `HRESULT` type. +#if _pointerBitWidth(_64) + typealias HRESULT = Int32 +#else + typealias HRESULT = Int +#endif + /// A call to `QueryInterface()` failed. - case queryInterfaceFailed(Any.Type, Int32) + case queryInterfaceFailed(Any.Type, HRESULT) /// The testing library failed to create a COM object. - case comObjectCreationFailed(Any.Type, Int32) + case comObjectCreationFailed(Any.Type, HRESULT) /// An image could not be written. - case imageWritingFailed(Int32) + case imageWritingFailed(HRESULT) /// The testing library failed to get an in-memory stream's underlying buffer. - case globalFromStreamFailed(Int32) + case globalFromStreamFailed(HRESULT) /// A property could not be written to a property bag. - case propertyBagWritingFailed(String, Int32) + case propertyBagWritingFailed(String, HRESULT) #endif } From 1aed2520a90b5f96a2ba77211c9d5bbec5edb95f Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Thu, 4 Sep 2025 17:08:37 -0400 Subject: [PATCH 10/13] package visibility --- Sources/Testing/Attachments/Images/ImageAttachmentError.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index 34da0530b..a7519121d 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -24,9 +24,9 @@ package enum ImageAttachmentError: Error { #elseif os(Windows) /// The architecture-specific `HRESULT` type. #if _pointerBitWidth(_64) - typealias HRESULT = Int32 + package typealias HRESULT = Int32 #else - typealias HRESULT = Int + package typealias HRESULT = Int #endif /// A call to `QueryInterface()` failed. From 66d0aca25cce97b88fdbfd709ef09a348e28afa4 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Fri, 5 Sep 2025 15:38:44 -0400 Subject: [PATCH 11/13] DWORD! --- .../Attachments/AttachableImageFormat+CLSID.swift | 4 ++-- .../_AttachableImageWrapper+AttachableWrapper.swift | 2 +- .../Support/Additions/IWICImagingFactoryAdditions.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift index dcdec67f2..b4448fd3d 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift @@ -26,8 +26,8 @@ extension AttachableImageFormat { var enumerator: UnsafeMutablePointer? let rCreate = factory.pointee.lpVtbl.pointee.CreateComponentEnumerator( factory, - DWORD(bitPattern: WICEncoder.rawValue), - DWORD(bitPattern: WICComponentEnumerateDefault.rawValue), + DWORD(WICEncoder.rawValue), + DWORD(WICComponentEnumerateDefault.rawValue), &enumerator ) guard rCreate == S_OK, let enumerator else { diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift index 5252a919d..ecf4602e4 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/_AttachableImageWrapper+AttachableWrapper.swift @@ -46,7 +46,7 @@ extension _AttachableImageWrapper: Attachable, AttachableWrapper where Image: At let rCreate = CoCreateInstance( &encoderCLSID, nil, - DWORD(bitPattern: CLSCTX_INPROC_SERVER.rawValue), + DWORD(CLSCTX_INPROC_SERVER.rawValue), IID_IWICBitmapEncoder, &encoder ) diff --git a/Sources/Overlays/_Testing_WinSDK/Support/Additions/IWICImagingFactoryAdditions.swift b/Sources/Overlays/_Testing_WinSDK/Support/Additions/IWICImagingFactoryAdditions.swift index dc11ab0fc..acacc80b1 100644 --- a/Sources/Overlays/_Testing_WinSDK/Support/Additions/IWICImagingFactoryAdditions.swift +++ b/Sources/Overlays/_Testing_WinSDK/Support/Additions/IWICImagingFactoryAdditions.swift @@ -25,7 +25,7 @@ extension IWICImagingFactory { let rCreate = CoCreateInstance( CLSID_WICImagingFactory, nil, - DWORD(bitPattern: CLSCTX_INPROC_SERVER.rawValue), + DWORD(CLSCTX_INPROC_SERVER.rawValue), IID_IWICImagingFactory, &factory ) From be938a63dc0c9fa5924804cf4afe369531a86d8f Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Mon, 8 Sep 2025 14:02:17 -0400 Subject: [PATCH 12/13] Can just use CLong instead of redefining HRESULT --- .../Images/ImageAttachmentError.swift | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift index a7519121d..1bd90b641 100644 --- a/Sources/Testing/Attachments/Images/ImageAttachmentError.swift +++ b/Sources/Testing/Attachments/Images/ImageAttachmentError.swift @@ -22,27 +22,20 @@ package enum ImageAttachmentError: Error { /// The image could not be converted. case couldNotConvertImage #elseif os(Windows) - /// The architecture-specific `HRESULT` type. -#if _pointerBitWidth(_64) - package typealias HRESULT = Int32 -#else - package typealias HRESULT = Int -#endif - /// A call to `QueryInterface()` failed. - case queryInterfaceFailed(Any.Type, HRESULT) + case queryInterfaceFailed(Any.Type, CLong) /// The testing library failed to create a COM object. - case comObjectCreationFailed(Any.Type, HRESULT) + case comObjectCreationFailed(Any.Type, CLong) /// An image could not be written. - case imageWritingFailed(HRESULT) + case imageWritingFailed(CLong) /// The testing library failed to get an in-memory stream's underlying buffer. - case globalFromStreamFailed(HRESULT) + case globalFromStreamFailed(CLong) /// A property could not be written to a property bag. - case propertyBagWritingFailed(String, HRESULT) + case propertyBagWritingFailed(String, CLong) #endif } From 37aa87b2e113d853f6ce86d1e0100d303688225e Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Tue, 9 Sep 2025 11:25:22 -0400 Subject: [PATCH 13/13] Add more SPI attributes --- .../Attachments/AttachableImageFormat+CLSID.swift | 1 + .../IWICBitmapSource+AttachableAsIWICBitmapSource.swift | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift index b4448fd3d..2928d7af5 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/AttachableImageFormat+CLSID.swift @@ -12,6 +12,7 @@ @_spi(Experimental) public import Testing public import WinSDK +@_spi(Experimental) extension AttachableImageFormat { private static let _encoderPathExtensionsByCLSID = Result<[UInt128: [String]], any Error> { var result = [UInt128: [String]]() diff --git a/Sources/Overlays/_Testing_WinSDK/Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift b/Sources/Overlays/_Testing_WinSDK/Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift index 8ff6d5430..55c2ec4c2 100644 --- a/Sources/Overlays/_Testing_WinSDK/Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift +++ b/Sources/Overlays/_Testing_WinSDK/Attachments/IWICBitmapSource+AttachableAsIWICBitmapSource.swift @@ -96,6 +96,7 @@ extension UnsafeMutablePointer where Pointee: IWICBitmapSourceProtocol { // MARK: - _AttachableByAddressAsIWICBitmapSource implementation +@_spi(Experimental) extension IWICBitmapSourceProtocol { public static func _copyAttachableIWICBitmapSource( from imageAddress: UnsafeMutablePointer, @@ -119,6 +120,7 @@ extension IWICBitmapSourceProtocol { } extension IWICBitmapSource { + @_spi(Experimental) public static func _copyAttachableIWICBitmapSource( from imageAddress: UnsafeMutablePointer, using factory: UnsafeMutablePointer