diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index edce2257..6ce079b2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -526,6 +526,13 @@ jobs: $wheels = @(Get-ChildItem artifacts\python-x64\payload -Filter *.whl -File) if ($wheels.Count -ne 1) { throw 'Expected exactly the verified CPython 3.12 x64 wheel' } & $python -m pip install $wheels[0].FullName --no-deps --no-index --quiet + - name: Check prebuilt Python native imports + shell: pwsh + run: | + $PSNativeCommandUseErrorActionPreference = $true + $native = @(Get-ChildItem bindings\py\.venv\Lib\site-packages\dynwinrt -Filter *.pyd -File) + if ($native.Count -ne 1) { throw 'Expected exactly one installed production Python extension' } + node bindings\js\scripts\check-ui-helper-imports.mjs $native[0].FullName - name: Test Python binding run: | .\bindings\py\.venv\Scripts\python.exe -m pytest bindings\py\tests -q diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index a13ef775..7497de76 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -11,6 +11,8 @@ on: - 'bindings/py/**' - 'crates/dynwinrt/**' - 'crates/dynwinrt-com-contracts/**' + - 'bindings/js/scripts/pe-imports.mjs' + - 'bindings/js/scripts/check-ui-helper-imports.mjs' - 'eng/release/python/prepare_python_release.py' - 'eng/release/python/test_python_*_wheel.ps1' - 'eng/release/python/verify_python_release.py' @@ -334,6 +336,9 @@ jobs: with: name: python-runtime-${{ matrix.tag }}-x64 path: artifacts\runtime + - uses: actions/setup-node@v4 + with: + node-version: 24 - uses: actions/download-artifact@v4 with: name: python-codegen-x64 @@ -370,6 +375,9 @@ jobs: with: name: python-runtime-${{ matrix.tag }}-arm64 path: artifacts\runtime + - uses: actions/setup-node@v4 + with: + node-version: 24 - uses: actions/download-artifact@v4 with: name: python-codegen-arm64 diff --git a/bindings/js/__test__/native-imports.spec.ts b/bindings/js/__test__/native-imports.spec.ts index b27bdb2f..884521f0 100644 --- a/bindings/js/__test__/native-imports.spec.ts +++ b/bindings/js/__test__/native-imports.spec.ts @@ -5,7 +5,7 @@ import test from 'ava' import { spawnSync, type SpawnSyncReturns } from 'node:child_process' import { join } from 'node:path' import { fileURLToPath } from 'node:url' -import { verifyDispatcherQueueImports } from '../scripts/pe-imports.mjs' +import { verifyDispatcherQueueImports, verifyUiHelperImports } from '../scripts/pe-imports.mjs' const packageDir = fileURLToPath(new URL('..', import.meta.url)) const distDir = join(packageDir, 'dist') @@ -35,6 +35,10 @@ test('native addons do not statically import CoreMessaging or CreateDispatcherQu t.true(verifyDispatcherQueueImports(distDir).length > 0) }) +test('production native addons have no ordinary or delay GDI/USER32 helper imports', (t) => { + t.true(verifyUiHelperImports(distDir).length > 0) +}) + for (const entrypoint of ['@microsoft/dynwinrt', '@microsoft/dynwinrt/com']) { test(`fresh ${entrypoint} import does not load CoreMessaging for DispatcherQueue`, (t) => { const child = spawnSync( diff --git a/bindings/js/__test__/pe-imports.spec.ts b/bindings/js/__test__/pe-imports.spec.ts index 3663fbb4..afca1b29 100644 --- a/bindings/js/__test__/pe-imports.spec.ts +++ b/bindings/js/__test__/pe-imports.spec.ts @@ -2,15 +2,18 @@ // Licensed under the MIT License. import test from 'ava' +import { spawnSync } from 'node:child_process' import { mkdtempSync, rmSync, writeFileSync } from 'node:fs' import { join } from 'node:path' import { fileURLToPath } from 'node:url' import { assertNoDispatcherQueueImports, assertNoEagerWin32Imports, + assertNoUiHelperImports, readPeImports, verifyAddonImports, verifyDispatcherQueueImports, + verifyUiHelperImports, } from '../scripts/pe-imports.mjs' function fixture(wide: boolean) { @@ -510,3 +513,129 @@ test('Win32 DispatcherQueue verification scans every addon including ARM64 delay rmSync(directory, { recursive: true, force: true }) } }) + +test('UI helper policy rejects DLL descriptors and scoped exports without banning OLEAUT32', (t) => { + for (const dll of ['GDI32.dll', 'user32.dll', 'C:\\Windows\\System32\\UsEr32.DlL']) { + for (const symbols of [['UnrelatedExport'], [17], []]) { + t.throws(() => assertNoUiHelperImports([{ dll, symbols }]), { message: /GDI\/USER32.*dynamically/ }) + } + } + for (const symbol of [ + 'DeleteObject', + 'DestroyIcon', + 'CreateWindowExW', + 'AreDpiAwarenessContextsEqual', + 'GetDpiAwarenessContextForProcess', + 'SetProcessDpiAwarenessContext', + 'SetThreadDpiAwarenessContext', + ]) { + for (const spelling of [symbol, symbol.toLowerCase(), `_${symbol}@8`, `__imp_${symbol}`]) { + t.throws(() => assertNoUiHelperImports([{ dll: 'api-alias.dll', symbols: [spelling] }]), { + message: /api-alias\.dll:/, + }) + } + } + t.notThrows(() => + assertNoUiHelperImports([ + { dll: 'kernel32.dll', symbols: ['LoadLibraryExW', 'GetProcAddress'] }, + { dll: 'oleaut32.dll', symbols: ['SysAllocStringLen', 'VariantClear', 'SafeArrayDestroy'] }, + { dll: 'ole32.dll', symbols: ['CoInitializeEx'] }, + { dll: 'combase.dll', symbols: ['RoInitialize'] }, + ]), + ) +}) + +for (const wide of [false, true]) { + for (const delayed of [false, true]) { + test(`UI helper policy inspects ${wide ? 'PE32+' : 'PE32'} ${delayed ? 'delay' : 'ordinary'} tables`, (t) => { + const { bytes, writeThunk, width } = delayFixture(wide) + // Start with unrelated DLLs in both directories. + bytes.write('other.dll\0', 0x450) + const name = delayed ? 0x490 : 0x760 + const symbol = delayed ? 0x522 : 0x782 + const lookup = delayed ? 0x3a0 : 0x2a0 + const options = { includeDelayImports: true } + t.notThrows(() => assertNoUiHelperImports(readPeImports(bytes, options))) + bytes.write('gdi32.dll\0', name) + writeThunk(lookup, (1n << BigInt(width * 8 - 1)) | 17n) + t.throws(() => assertNoUiHelperImports(readPeImports(bytes, options)), { message: /gdi32\.dll: #17/ }) + bytes.write('alias.dll\0', name) + writeThunk(lookup, BigInt(delayed ? 0x2320 : 0x4080)) + bytes.write('_SetThreadDpiAwarenessContext@4\0', symbol) + t.throws(() => assertNoUiHelperImports(readPeImports(bytes, options)), { message: /alias\.dll: _SetThread/ }) + }) + } +} + +test('UI helper production checks scan every architecture and Python extensions without loading them', (t) => { + const directory = mkdtempSync(fileURLToPath(new URL('../target-pe-imports-', import.meta.url))) + const safe = fixture(true) + safe.bytes.write('ole32.dll\0', 0x760) + const forbidden = delayFixture(true) + forbidden.bytes.writeUInt16LE(0xaa64, 0x84) + const x64 = 'dynwinrt.win32-x64-msvc.node' + const arm64 = 'dynwinrt.win32-arm64-msvc.node' + const script = fileURLToPath(new URL('../scripts/check-ui-helper-imports.mjs', import.meta.url)) + const pyd = join(directory, 'dynwinrt.cp313-win_arm64.pyd') + try { + t.throws(() => verifyUiHelperImports(directory), { message: /No native addons/ }) + writeFileSync(join(directory, x64), safe.bytes) + writeFileSync(join(directory, arm64), forbidden.bytes) + t.throws(() => verifyUiHelperImports(directory), { message: /arm64-msvc\.node:.*GDI\/USER32/ }) + writeFileSync(join(directory, arm64), safe.bytes) + t.deepEqual(verifyUiHelperImports(directory), [arm64, x64]) + writeFileSync(pyd, safe.bytes) + t.is(spawnSync(process.execPath, [script, pyd], { encoding: 'utf8' }).status, 0) + writeFileSync(pyd, forbidden.bytes) + const child = spawnSync(process.execPath, [script, pyd], { encoding: 'utf8' }) + t.not(child.status, 0) + t.regex(child.stderr, /GDI\/USER32/) + writeFileSync(join(directory, arm64), Buffer.from('MZ')) + t.throws(() => verifyUiHelperImports(directory), { message: /arm64-msvc\.node: Invalid PE import table/ }) + } finally { + rmSync(directory, { recursive: true, force: true }) + } +}) + +test('UI helper CLI permits optional Win32 delay-only imports but still rejects their ordinary imports', (t) => { + const directory = mkdtempSync(fileURLToPath(new URL('../target-pe-imports-', import.meta.url))) + const script = fileURLToPath(new URL('../scripts/check-ui-helper-imports.mjs', import.meta.url)) + const pyd = join(directory, 'optional-subsystem.pyd') + try { + for (const wide of [false, true]) { + for (const [dll, symbol] of [ + ['mapi32.dll', 'MAPIInitialize'], + ['gdiplus.dll', 'GdiplusStartup'], + ['ws2_32.dll', 'WSAStartup'], + ['mfplat.dll', 'MFStartup'], + ]) { + const delayed = delayFixture(wide) + delayed.bytes.writeUInt32LE(0, delayed.directory + 8) + delayed.bytes.writeUInt32LE(0, delayed.directory + 12) + delayed.bytes.fill(0, 0x340, 0x360) + delayed.bytes.write(`${dll}\0`, 0x450) + delayed.bytes.write(`${symbol}\0`, 0x4d2) + const ordinary = readPeImports(delayed.bytes) + const combined = readPeImports(delayed.bytes, { includeDelayImports: true }) + t.deepEqual(ordinary, []) + t.deepEqual(combined, [{ dll, symbols: [symbol, 23] }]) + t.notThrows(() => assertNoEagerWin32Imports(ordinary)) + t.notThrows(() => assertNoUiHelperImports(combined)) + t.notThrows(() => assertNoDispatcherQueueImports(combined)) + writeFileSync(pyd, delayed.bytes) + const accepted = spawnSync(process.execPath, [script, pyd], { encoding: 'utf8' }) + t.is(accepted.status, 0, accepted.stderr) + + const eager = fixture(wide) + eager.bytes.write(`${dll}\0`, 0x760) + eager.bytes.write(`${symbol}\0`, 0x782) + writeFileSync(pyd, eager.bytes) + const rejected = spawnSync(process.execPath, [script, pyd], { encoding: 'utf8' }) + t.not(rejected.status, 0) + t.regex(rejected.stderr, /Optional Win32 subsystem DLLs must load lazily/) + } + } + } finally { + rmSync(directory, { recursive: true, force: true }) + } +}) diff --git a/bindings/js/scripts/check-ui-helper-imports.mjs b/bindings/js/scripts/check-ui-helper-imports.mjs new file mode 100644 index 00000000..0f16b0e2 --- /dev/null +++ b/bindings/js/scripts/check-ui-helper-imports.mjs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { readFileSync } from 'node:fs' +import { extname } from 'node:path' +import { + assertNoDispatcherQueueImports, + assertNoEagerWin32Imports, + assertNoUiHelperImports, + readPeImports, +} from './pe-imports.mjs' + +const files = process.argv.slice(2) +if (!files.length) throw new Error('Usage: node check-ui-helper-imports.mjs [...]') +for (const file of files) { + if (!['.node', '.pyd'].includes(extname(file).toLowerCase())) { + throw new Error(`Expected a production .node or .pyd binary: ${file}`) + } + const bytes = readFileSync(file) + const ordinary = readPeImports(bytes) + const combined = readPeImports(bytes, { includeDelayImports: true }) + assertNoUiHelperImports(combined) + assertNoDispatcherQueueImports(combined) + // The existing optional-subsystem policy permits delay imports. + assertNoEagerWin32Imports(ordinary) + console.log(`Verified production native import policies: ${file}`) +} diff --git a/bindings/js/scripts/pe-imports.d.mts b/bindings/js/scripts/pe-imports.d.mts index 9b2d115a..9834dea0 100644 --- a/bindings/js/scripts/pe-imports.d.mts +++ b/bindings/js/scripts/pe-imports.d.mts @@ -9,5 +9,7 @@ export interface PeImport { export function readPeImports(bytes: Buffer, options?: { includeDelayImports?: boolean }): PeImport[] export function assertNoEagerWin32Imports(imports: PeImport[], options?: { testHooks?: boolean }): void export function assertNoDispatcherQueueImports(imports: PeImport[]): void +export function assertNoUiHelperImports(imports: PeImport[]): void export function verifyAddonImports(directory: string, options?: { testHooksAddon?: string }): string[] export function verifyDispatcherQueueImports(directory: string): string[] +export function verifyUiHelperImports(directory: string): string[] diff --git a/bindings/js/scripts/pe-imports.mjs b/bindings/js/scripts/pe-imports.mjs index b8e523a3..6efff650 100644 --- a/bindings/js/scripts/pe-imports.mjs +++ b/bindings/js/scripts/pe-imports.mjs @@ -200,6 +200,48 @@ export function assertNoDispatcherQueueImports(imports) { } } +const uiHelperSymbols = new Set([ + 'deleteobject', + 'destroyicon', + 'createwindowexw', + 'aredpiawarenesscontextsequal', + 'getdpiawarenesscontextforprocess', + 'setprocessdpiawarenesscontext', + 'setthreaddpiawarenesscontext', +]) + +/** + * Production binaries must resolve the scoped GDI/USER32 helpers dynamically. + * This is a direct-import guarantee, not an OS/host transitive DLL-load guarantee. + * @param {PeImport[]} imports + */ +export function assertNoUiHelperImports(imports) { + const violations = imports.filter( + ({ dll, symbols }) => + ['gdi32.dll', 'user32.dll'].includes(win32.basename(dll).toLowerCase()) || + symbols.some( + (symbol) => + typeof symbol === 'string' && + uiHelperSymbols.has( + symbol + .toLowerCase() + .replace(/^(__imp_)?_?/, '') + .replace(/@\d+$/, ''), + ), + ), + ) + if (violations.length) { + throw new Error( + `Production GDI/USER32 helpers must resolve dynamically; PE imports:\n${violations + .map( + ({ dll, symbols }) => + `${dll}: ${symbols.map((symbol) => (typeof symbol === 'number' ? `#${symbol}` : symbol)).join(', ')}`, + ) + .join('\n')}`, + ) + } +} + /** * @param {string} directory * @param {(bytes: Buffer, addon: string) => void} inspect @@ -244,3 +286,10 @@ export function verifyDispatcherQueueImports(directory) { assertNoDispatcherQueueImports(readPeImports(bytes, { includeDelayImports: true })), ) } + +/** @param {string} directory */ +export function verifyUiHelperImports(directory) { + return verifyAddonFiles(directory, (bytes) => + assertNoUiHelperImports(readPeImports(bytes, { includeDelayImports: true })), + ) +} diff --git a/bindings/js/scripts/verify-runtime-artifact.mjs b/bindings/js/scripts/verify-runtime-artifact.mjs index 96e4191e..83d4cb62 100644 --- a/bindings/js/scripts/verify-runtime-artifact.mjs +++ b/bindings/js/scripts/verify-runtime-artifact.mjs @@ -6,7 +6,7 @@ import { readFileSync, realpathSync, statSync } from 'node:fs' import { createRequire } from 'node:module' import { dirname, join } from 'node:path' import { fileURLToPath, pathToFileURL } from 'node:url' -import { verifyAddonImports } from './pe-imports.mjs' +import { verifyAddonImports, verifyUiHelperImports } from './pe-imports.mjs' const args = process.argv.slice(2) if (args.length !== 1 && !(args.length === 2 && args[1] === '--test-hooks')) { @@ -20,6 +20,7 @@ const require = createRequire(join(artifact, 'artifact-consumer.cjs')) const modules = new Map() const testHooksAddon = args[1] === '--test-hooks' ? `dynwinrt.win32-${process.arch}-msvc.node` : undefined const addons = verifyAddonImports(artifact, { testHooksAddon }) +if (!testHooksAddon) verifyUiHelperImports(artifact) if (testHooksAddon) { assert.equal( typeof require(join(artifact, testHooksAddon)).DynComBorrowedCopyTestFixture, diff --git a/bindings/js/src/com.rs b/bindings/js/src/com.rs index 7b69eaf7..037af1c4 100644 --- a/bindings/js/src/com.rs +++ b/bindings/js/src/com.rs @@ -314,7 +314,7 @@ pub(crate) fn apartment_bound_com_object(value: IUnknown) -> napi::Result napi::Result { use std::sync::atomic::{AtomicUsize, Ordering}; - use windows::Win32::UI::WindowsAndMessaging::{CreateWindowExW, WINDOW_EX_STYLE, WS_POPUP}; + use windows::Win32::UI::WindowsAndMessaging::{WINDOW_EX_STYLE, WS_POPUP}; static CACHED_HWND: AtomicUsize = AtomicUsize::new(0); let cached = CACHED_HWND.load(Ordering::Acquire); @@ -324,7 +324,7 @@ fn create_test_hwnd() -> napi::Result { let class_name: Vec = "STATIC".encode_utf16().chain(Some(0)).collect(); let title: Vec = "dynwinrt-test-hwnd\0".encode_utf16().collect(); let hwnd = unsafe { - CreateWindowExW( + dynwinrt::system_helpers::create_window_ex( WINDOW_EX_STYLE(0), windows::core::PCWSTR(class_name.as_ptr()), windows::core::PCWSTR(title.as_ptr()), @@ -2972,10 +2972,11 @@ impl DynComOwnedHandle { let succeeded = match cleanup { dynwinrt::com::OwnedHandleCleanup::DeleteObject if force_failure => false, dynwinrt::com::OwnedHandleCleanup::DeleteObject => unsafe { - windows::Win32::Graphics::Gdi::DeleteObject(windows::Win32::Graphics::Gdi::HGDIOBJ( - std::ptr::with_exposed_provenance_mut(address), - )) - .as_bool() + dynwinrt::system_helpers::GdiObjectDeleter::prepared() + .delete(windows::Win32::Graphics::Gdi::HGDIOBJ( + std::ptr::with_exposed_provenance_mut(address), + )) + .as_bool() }, }; if succeeded { @@ -6602,6 +6603,7 @@ mod tests { #[test] fn delete_object_owned_handle_consumes_exact_provenance_and_releases_once() { + dynwinrt::system_helpers::GdiObjectDeleter::resolve().unwrap(); let bitmap = unsafe { windows::Win32::Graphics::Gdi::CreateBitmap(1, 1, 1, 1, None) }; assert!(!bitmap.is_invalid()); let ptr = bitmap.0; @@ -6631,6 +6633,7 @@ mod tests { #[test] fn delete_object_owned_handle_drop_releases_bitmap() { + dynwinrt::system_helpers::GdiObjectDeleter::resolve().unwrap(); let bitmap = unsafe { windows::Win32::Graphics::Gdi::CreateBitmap(1, 1, 1, 1, None) }; assert!(!bitmap.is_invalid()); let pointer = bitmap.0; diff --git a/bindings/js/src/com_raw.rs b/bindings/js/src/com_raw.rs index 42db8a49..d08c51b3 100644 --- a/bindings/js/src/com_raw.rs +++ b/bindings/js/src/com_raw.rs @@ -581,6 +581,17 @@ native_class! { pub struct DynComRawCleanup; } +fn cleanup_external_ui_handle( + pointer: &mut DynComRawPointer, + operation: &str, + cleanup: impl FnOnce(usize) -> windows::core::Result<()>, +) -> napi::Result<()> { + let address = pointer.external_cleanup_address(operation)?; + cleanup(address).map_err(|error| napi::Error::from_reason(error.to_string()))?; + pointer.consume_external_cleanup(); + Ok(()) +} + #[napi] impl DynComRawCleanup { #[napi] @@ -730,31 +741,25 @@ impl DynComRawCleanup { #[napi] pub fn destroy_icon(pointer: &mut DynComRawPointer) -> napi::Result<()> { - let address = pointer.external_cleanup_address("destroyIcon")?; - unsafe { - windows::Win32::UI::WindowsAndMessaging::DestroyIcon( - windows::Win32::UI::WindowsAndMessaging::HICON(std::ptr::with_exposed_provenance_mut( - address, - )), - ) - } - .map_err(|error| napi::Error::from_reason(error.to_string()))?; - pointer.consume_external_cleanup(); - Ok(()) + cleanup_external_ui_handle(pointer, "destroyIcon", |address| unsafe { + dynwinrt::system_helpers::destroy_icon(windows::Win32::UI::WindowsAndMessaging::HICON( + std::ptr::with_exposed_provenance_mut(address), + )) + }) } #[napi] pub fn delete_object(pointer: &mut DynComRawPointer) -> napi::Result<()> { - let address = pointer.external_cleanup_address("deleteObject")?; - unsafe { - windows::Win32::Graphics::Gdi::DeleteObject(windows::Win32::Graphics::Gdi::HGDIOBJ( - std::ptr::with_exposed_provenance_mut(address), - )) - } - .ok() - .map_err(|error| napi::Error::from_reason(error.to_string()))?; - pointer.consume_external_cleanup(); - Ok(()) + cleanup_external_ui_handle(pointer, "deleteObject", |address| { + let deleter = dynwinrt::system_helpers::GdiObjectDeleter::resolve()?; + unsafe { + deleter + .delete(windows::Win32::Graphics::Gdi::HGDIOBJ( + std::ptr::with_exposed_provenance_mut(address), + )) + .ok() + } + }) } } @@ -6123,6 +6128,34 @@ mod tests { let mut brush_pointer = external_pointer(brush.0 as usize); DynComRawCleanup::delete_object(&mut brush_pointer).unwrap(); assert!(DynComRawCleanup::delete_object(&mut brush_pointer).is_err()); + + let mut invalid_icon = DynComRawPointer::null(); + assert!(DynComRawCleanup::destroy_icon(&mut invalid_icon).is_err()); + assert!(invalid_icon.address().is_ok()); + let mut invalid_object = DynComRawPointer::null(); + assert!(DynComRawCleanup::delete_object(&mut invalid_object).is_err()); + assert!(invalid_object.address().is_ok()); + } + + #[test] + fn raw_ui_cleanup_resolution_failure_retains_provenance_for_retry() { + for operation in ["destroyIcon", "deleteObject"] { + let mut pointer = external_pointer(0x1234); + let error = cleanup_external_ui_handle(&mut pointer, operation, |_| { + Err(windows::core::Error::from_hresult( + windows::core::HRESULT::from_win32(windows::Win32::Foundation::ERROR_PROC_NOT_FOUND.0), + )) + }) + .unwrap_err(); + assert!(!error.reason.is_empty()); + assert_eq!(pointer.external_cleanup_address(operation).unwrap(), 0x1234); + cleanup_external_ui_handle(&mut pointer, operation, |address| { + assert_eq!(address, 0x1234); + Ok(()) + }) + .unwrap(); + assert!(pointer.external_cleanup_address(operation).is_err()); + } } #[test] diff --git a/bindings/js/src/js_boundary_tests.rs b/bindings/js/src/js_boundary_tests.rs index e21ac7a8..6a10d769 100644 --- a/bindings/js/src/js_boundary_tests.rs +++ b/bindings/js/src/js_boundary_tests.rs @@ -69,6 +69,7 @@ fn progress_type_validation_allows_structs_and_rejects_unsupported_shapes() { #[test] fn failed_explicit_bitmap_release_preserves_owner_for_retry() { + dynwinrt::system_helpers::GdiObjectDeleter::resolve().unwrap(); let bitmap = unsafe { windows::Win32::Graphics::Gdi::CreateBitmap(1, 1, 1, 1, None) }; assert!(!bitmap.is_invalid()); let pointer = bitmap.0; @@ -105,6 +106,7 @@ fn failed_explicit_bitmap_release_preserves_owner_for_retry() { #[test] fn actual_delete_object_failure_preserves_generic_owner() { + dynwinrt::system_helpers::GdiObjectDeleter::resolve().unwrap(); let pointer = std::ptr::with_exposed_provenance_mut(1); let mut value = DynWinRTValue::from_com_result( dynwinrt::WinRTValue::RawPtr(pointer), diff --git a/crates/dynwinrt/src/com.rs b/crates/dynwinrt/src/com.rs index 96ad4ef0..3875b9ac 100644 --- a/crates/dynwinrt/src/com.rs +++ b/crates/dynwinrt/src/com.rs @@ -35,6 +35,9 @@ pub mod borrowed; #[path = "com_completion.rs"] #[doc(hidden)] pub mod completion; +#[cfg(test)] +#[path = "com_gdi_cleanup_tests.rs"] +mod gdi_cleanup_tests; pub use automation::{ DispatchParamsValue, ExcepInfoValue, PropVariantData, PropVariantType, PropVariantValue, PropVariantVector, PropVariantVectorType, SafeArrayBound, SafeArrayElementType, diff --git a/crates/dynwinrt/src/com_gdi_cleanup_tests.rs b/crates/dynwinrt/src/com_gdi_cleanup_tests.rs new file mode 100644 index 00000000..79af6638 --- /dev/null +++ b/crates/dynwinrt/src/com_gdi_cleanup_tests.rs @@ -0,0 +1,402 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +use super::*; +use crate::system_helpers::test_support::{ResolutionFailure, delete_calls, resolution_calls}; +use windows::Win32::{ + Foundation::{E_ACCESSDENIED, ERROR_PROC_NOT_FOUND}, + Graphics::Gdi::{BITMAP, CreateBitmap, GetObjectW, HGDIOBJ}, +}; + +#[repr(C)] +struct BitmapCall { + vtable: *const *mut c_void, + status: HRESULT, + calls: Cell, + output: Cell<*mut c_void>, + cleanup_phase: RefCell>, +} + +impl BitmapCall { + fn new(vtable: &[*mut c_void], status: HRESULT) -> Self { + Self { + vtable: vtable.as_ptr(), + status, + calls: Cell::new(0), + output: Cell::new(std::ptr::null_mut()), + cleanup_phase: RefCell::new(None), + } + } + + fn produce(&self) -> *mut c_void { + self.calls.set(self.calls.get() + 1); + let bitmap = unsafe { CreateBitmap(2, 2, 1, 1, None) }; + self.output.set(bitmap.0); + // Any attempt to resolve again after native dispatch must fail. Cleanup + // must use the deleter secured before the callee acquired ownership. + *self.cleanup_phase.borrow_mut() = Some(ResolutionFailure::new(HRESULT::from_win32( + ERROR_PROC_NOT_FOUND.0, + ))); + bitmap.0 + } + + fn assert_cleaned_once(&self, before: usize) { + assert_eq!(self.calls.get(), 1); + assert!(!self.output.get().is_null()); + assert_eq!(delete_calls(), before + 1); + let mut info = BITMAP::default(); + assert_eq!( + unsafe { + GetObjectW( + HGDIOBJ(self.output.get()), + size_of::() as i32, + Some((&mut info as *mut BITMAP).cast()), + ) + }, + 0 + ); + } +} + +unsafe extern "system" fn write_bitmap(this: *mut c_void, output: *mut *mut c_void) -> HRESULT { + let call = unsafe { &*this.cast::() }; + unsafe { *output = call.produce() }; + call.status +} + +unsafe extern "system" fn write_bitmap_with_input( + this: *mut c_void, + _: u32, + output: *mut *mut c_void, +) -> HRESULT { + unsafe { write_bitmap(this, output) } +} + +unsafe extern "system" fn write_bitmap_and_number( + this: *mut c_void, + output: *mut *mut c_void, + number: *mut u32, +) -> HRESULT { + unsafe { *number = 42 }; + unsafe { write_bitmap(this, output) } +} + +unsafe extern "system" fn return_bitmap(this: *mut c_void) -> *mut c_void { + unsafe { &*this.cast::() }.produce() +} + +fn owned() -> Type { + Type::owned_handle_output(OwnedHandleCleanup::DeleteObject) +} + +fn output_cases(table: &Arc) -> Vec<(MethodSignature, *mut c_void, Vec)> { + vec![ + ( + MethodSignature::new(table).add_out(owned()), + write_bitmap as *mut c_void, + vec![], + ), + ( + MethodSignature::new(table) + .add_in(Type::winrt(table.u32_type())) + .add_out(owned()), + write_bitmap_with_input as *mut c_void, + vec![Value::WinRt(WinRTValue::U32(7))], + ), + ( + MethodSignature::new(table) + .add_out(owned()) + .add_out(Type::winrt(table.u32_type())), + write_bitmap_and_number as *mut c_void, + vec![], + ), + ( + MethodSignature::new(table).add_optional_out(owned()), + write_bitmap as *mut c_void, + vec![Value::WinRt(WinRTValue::Bool(true))], + ), + ( + MethodSignature::new(table) + .add_out(owned()) + .preserve_hresult(), + write_bitmap as *mut c_void, + vec![], + ), + ] +} + +#[test] +fn gdi_cleanup_admission_is_lazy_retryable_and_precedes_every_dispatch_path() { + let table = MetadataTable::new(); + let mut cases = output_cases(&table); + cases.push(( + MethodSignature::new(&table).returns(owned()), + return_bitmap as *mut c_void, + vec![], + )); + for (signature, function, args) in cases { + let denied = ResolutionFailure::new(HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0)); + // Signature lowering/registration cannot perform DLL resolution. + let resolutions = resolution_calls(); + let registered = signature.build(0).unwrap(); + assert_eq!(resolution_calls(), resolutions); + let vtable = [function]; + let mut call = BitmapCall::new(&vtable, HRESULT(0)); + let dispatched = Cell::new(false); + let before = delete_calls(); + let error = registered + .plan + .invoke_values_guarded((&mut call as *mut BitmapCall).cast(), &args, || { + dispatched.set(true); + Ok(()) + }) + .unwrap_err(); + assert!(matches!(error, result::Error::WindowsError(ref error) + if error.code() == HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0))); + assert!(!dispatched.get()); + assert_eq!(call.calls.get(), 0); + assert!(call.output.get().is_null()); + assert_eq!(delete_calls(), before); + drop(denied); + + let values = registered + .plan + .invoke_values((&mut call as *mut BitmapCall).cast(), &args) + .unwrap(); + let pointer = values + .iter() + .find_map(|value| match value { + Value::WinRt(WinRTValue::RawPtr(pointer)) => Some(*pointer), + _ => None, + }) + .unwrap(); + assert_eq!(pointer, call.output.get()); + unsafe { OutputCleanup::DeleteObject.cleanup(pointer) }; + call.assert_cleaned_once(before); + } +} + +#[test] +fn gdi_cleanup_admission_survives_prepared_call_rebinding() { + let table = MetadataTable::new(); + let mut cases = output_cases(&table); + cases.push(( + MethodSignature::new(&table).returns(owned()), + return_bitmap as *mut c_void, + vec![], + )); + let expected = HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0); + let _denied = ResolutionFailure::new(expected); + for (signature, function, args) in cases { + let resolutions = resolution_calls(); + let mut registered = signature.build(0).unwrap(); + let (info, prepared) = registered.plan.native.into_parts(); + registered.plan.native = NativeMethod::from_parts(info, Arc::clone(&prepared)); + assert!(Arc::ptr_eq( + registered.plan.native.prepared_call(), + &prepared + )); + assert_eq!(resolution_calls(), resolutions); + + let vtable = [function]; + let mut call = BitmapCall::new(&vtable, HRESULT(0)); + let dispatched = Cell::new(false); + let before = delete_calls(); + let error = registered + .plan + .invoke_values_guarded((&mut call as *mut BitmapCall).cast(), &args, || { + dispatched.set(true); + Ok(()) + }) + .unwrap_err(); + assert!( + matches!(error, result::Error::WindowsError(ref error) if error.code() == expected) + ); + assert!(!dispatched.get()); + assert_eq!(call.calls.get(), 0); + assert!(call.output.get().is_null()); + assert_eq!(delete_calls(), before); + } +} + +unsafe extern "system" fn write_null(_: *mut c_void, output: *mut *mut c_void) -> HRESULT { + unsafe { *output = std::ptr::null_mut() }; + HRESULT(0) +} + +#[test] +fn borrowed_handle_calls_do_not_resolve_gdi_cleanup() { + let _denied = ResolutionFailure::new(HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0)); + let before = resolution_calls(); + let registered = MethodSignature::new(&MetadataTable::new()) + .add_out(Type::borrowed_handle_output()) + .build(0) + .unwrap(); + let vtable = [write_null as *mut c_void]; + let mut call = BitmapCall::new(&vtable, HRESULT(0)); + let values = registered + .plan + .invoke_values((&mut call as *mut BitmapCall).cast(), &[]) + .unwrap(); + assert!( + matches!(values.as_slice(), [Value::WinRt(WinRTValue::RawPtr(pointer))] if pointer.is_null()) + ); + assert_eq!(resolution_calls(), before); +} + +#[test] +fn gdi_partial_outputs_are_cleaned_once_without_replacing_failed_hresult() { + for (signature, function, args) in output_cases(&MetadataTable::new()) { + let registered = signature.build(0).unwrap(); + let vtable = [function]; + let mut call = BitmapCall::new(&vtable, E_ACCESSDENIED); + let before = delete_calls(); + let error = registered + .plan + .invoke_values((&mut call as *mut BitmapCall).cast(), &args) + .unwrap_err(); + assert!( + matches!(error, result::Error::WindowsError(ref error) if error.code() == E_ACCESSDENIED) + ); + call.assert_cleaned_once(before); + drop(error); + assert_eq!(delete_calls(), before + 1); + } +} + +#[repr(C)] +struct SizedPod { + cb_size: u32, + value: u32, +} + +fn sized_pod() -> Type { + let layout = NativeStructLayout::new( + "Tests.GdiCleanupSizedPod", + size_of::(), + align_of::(), + vec![ + NativeStructField::new( + "cbSize", + 0, + 1, + NativeStructFieldType::Scalar(NativeStructScalar::U32), + ) + .unwrap(), + NativeStructField::new( + "value", + 4, + 1, + NativeStructFieldType::Scalar(NativeStructScalar::U32), + ) + .unwrap(), + ], + ) + .unwrap() + .with_size_field_initializer("cbSize") + .unwrap(); + Type::raw_native_struct(Arc::new(layout)).unwrap() +} + +unsafe extern "system" fn invalid_return_with_bitmap( + this: *mut c_void, + bitmap: *mut *mut c_void, +) -> SizedPod { + unsafe { *bitmap = (&*this.cast::()).produce() }; + SizedPod { + cb_size: 0, + value: 42, + } +} + +unsafe extern "system" fn bitmap_return_with_invalid_output( + this: *mut c_void, + pod: *mut SizedPod, +) -> *mut c_void { + unsafe { + *pod = SizedPod { + cb_size: 0, + value: 42, + } + }; + unsafe { &*this.cast::() }.produce() +} + +#[test] +fn gdi_direct_and_parameter_outputs_survive_fallible_result_extraction() { + let table = MetadataTable::new(); + for (signature, function) in [ + ( + MethodSignature::new(&table) + .add_out(owned()) + .returns(sized_pod()), + invalid_return_with_bitmap as *mut c_void, + ), + ( + MethodSignature::new(&table) + .add_out(sized_pod()) + .returns(owned()), + bitmap_return_with_invalid_output as *mut c_void, + ), + ] { + let registered = signature.build(0).unwrap(); + let vtable = [function]; + let mut call = BitmapCall::new(&vtable, HRESULT(0)); + let before = delete_calls(); + let error = registered + .plan + .invoke_values((&mut call as *mut BitmapCall).cast(), &[]) + .unwrap_err(); + assert!(error.message().contains("size field")); + call.assert_cleaned_once(before); + } +} + +unsafe extern "system" fn bitmap_and_invalid_buffer_count( + this: *mut c_void, + bitmap: *mut *mut c_void, + _: *mut u8, + capacity: u32, + actual: *mut u32, +) -> HRESULT { + unsafe { + *bitmap = (&*this.cast::()).produce(); + *actual = capacity + 1; + } + HRESULT(0) +} + +#[test] +fn gdi_output_is_cleaned_when_com_post_call_validation_fails() { + let table = MetadataTable::new(); + let registered = MethodSignature::new(&table) + .add_out(owned()) + .add_caller_output_buffer( + Type::winrt(table.u8_type()), + 2, + Some(3), + BufferCountUnit::Elements, + false, + ) + .unwrap() + .add_in(Type::winrt(table.u32_type())) + .add_out(Type::winrt(table.u32_type())) + .build(0) + .unwrap(); + let vtable = [bitmap_and_invalid_buffer_count as *mut c_void]; + let mut call = BitmapCall::new(&vtable, HRESULT(0)); + let mut bytes = [0u8; 4]; + let buffer = + unsafe { ComBufferValue::borrowed(bytes.as_mut_ptr().cast(), bytes.len(), 1, true, true) } + .unwrap(); + let before = delete_calls(); + let error = registered + .plan + .invoke_values( + (&mut call as *mut BitmapCall).cast(), + &[Value::Buffer(buffer)], + ) + .unwrap_err(); + assert!(error.message().contains("exceeds capacity")); + call.assert_cleaned_once(before); +} diff --git a/crates/dynwinrt/src/lib.rs b/crates/dynwinrt/src/lib.rs index c81668eb..f5c80339 100644 --- a/crates/dynwinrt/src/lib.rs +++ b/crates/dynwinrt/src/lib.rs @@ -16,6 +16,8 @@ mod property_value; mod result; mod roapi; mod signature; +#[doc(hidden)] +pub mod system_helpers; mod value; pub mod win32; mod winapp; diff --git a/crates/dynwinrt/src/native_call.rs b/crates/dynwinrt/src/native_call.rs index 96e69c30..15e9f073 100644 --- a/crates/dynwinrt/src/native_call.rs +++ b/crates/dynwinrt/src/native_call.rs @@ -135,7 +135,7 @@ impl OutputCleanup { Self::PropVariantClear => crate::com::automation::cleanup_propvariant(ptr), Self::DeleteObject => { unsafe { - let _ = windows::Win32::Graphics::Gdi::DeleteObject( + let _ = crate::system_helpers::GdiObjectDeleter::prepared().delete( windows::Win32::Graphics::Gdi::HGDIOBJ( std::ptr::with_exposed_provenance_mut(ptr.addr()), ), @@ -978,16 +978,16 @@ impl AbiMethodSignature { CallStrategy::Libffi(system_cif(types, self.return_kind.libffi_type())) }; - Method { - info: MethodInfo { + Method::from_parts( + MethodInfo { index, parameters: self.parameters, input_count: self.input_count, out_count: self.out_count, return_kind: self.return_kind, }, - strategy: Arc::new(PreparedCall(strategy)), - } + Arc::new(PreparedCall(strategy)), + ) } } @@ -1070,6 +1070,7 @@ unsafe impl Sync for PreparedCall {} pub struct Method { info: MethodInfo, strategy: Arc, + needs_gdi_cleanup: bool, } fn expected_object_iid(typ: &TypeHandle) -> Option { @@ -1534,6 +1535,13 @@ impl call::ArgumentList for ComInvocationArgs<'_> { } impl Method { + fn prepare_output_cleanup(&self) -> windows_core::Result<()> { + if self.needs_gdi_cleanup { + crate::system_helpers::GdiObjectDeleter::resolve()?; + } + Ok(()) + } + #[cfg(test)] pub(crate) fn prepared_call(&self) -> &Arc { &self.strategy @@ -1545,7 +1553,22 @@ impl Method { /// Rebind metadata without changing the completed method's ABI shape. pub(crate) fn from_parts(info: MethodInfo, strategy: Arc) -> Self { - Self { info, strategy } + let needs_gdi_cleanup = info + .parameters + .iter() + .any(|parameter| parameter.output_cleanup == OutputCleanup::DeleteObject) + || matches!( + info.return_kind, + MethodReturn::Value { + cleanup: OutputCleanup::DeleteObject, + .. + } + ); + Self { + info, + strategy, + needs_gdi_cleanup, + } } pub(crate) fn parameter_type(&self, parameter_index: usize) -> &ParameterType { @@ -1836,6 +1859,7 @@ impl Method { } let mut mark_dispatched = Some(mark_dispatched); let mut mark_dispatched = || { + self.prepare_output_cleanup()?; mark_dispatched .take() .expect("native dispatch marker must run exactly once")() @@ -2358,7 +2382,10 @@ impl Method { self.info.out_count, &self.info.return_kind, cif, - mark_dispatched, + || { + self.prepare_output_cleanup()?; + mark_dispatched() + }, ) .map(|values| { values @@ -2403,7 +2430,10 @@ impl Method { self.info.out_count, &self.info.return_kind, cif, - before_dispatch, + || { + self.prepare_output_cleanup()?; + before_dispatch() + }, ) } } diff --git a/crates/dynwinrt/src/system_helpers.rs b/crates/dynwinrt/src/system_helpers.rs new file mode 100644 index 00000000..0479874b --- /dev/null +++ b/crates/dynwinrt/src/system_helpers.rs @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +//! Internal, typed system helpers shared with the native language bindings. +//! This is not a general DLL loader or a supported projection API. + +use std::{ffi::c_void, sync::OnceLock}; +use windows::Win32::{ + Foundation::{FreeLibrary, GetLastError, HANDLE, HINSTANCE, HMODULE, HWND, SetLastError}, + Graphics::Gdi::HGDIOBJ, + System::LibraryLoader::{GetProcAddress, LOAD_LIBRARY_SEARCH_SYSTEM32, LoadLibraryExW}, + UI::{ + HiDpi::DPI_AWARENESS_CONTEXT, + WindowsAndMessaging::{HICON, HMENU, WINDOW_EX_STYLE, WINDOW_STYLE}, + }, +}; +use windows_core::{BOOL, Error, PCSTR, PCWSTR, Result, s, w}; + +type Export = unsafe extern "system" fn() -> isize; +type DeleteObjectFn = unsafe extern "system" fn(HGDIOBJ) -> BOOL; +type DestroyIconFn = unsafe extern "system" fn(HICON) -> BOOL; +type CreateWindowExWFn = unsafe extern "system" fn( + WINDOW_EX_STYLE, + PCWSTR, + PCWSTR, + WINDOW_STYLE, + i32, + i32, + i32, + i32, + HWND, + HMENU, + HINSTANCE, + *const c_void, +) -> HWND; + +struct Module(HMODULE); + +impl Drop for Module { + fn drop(&mut self) { + let _ = unsafe { FreeLibrary(self.0) }; + } +} + +fn load(name: PCWSTR) -> Result { + unsafe { LoadLibraryExW(name, None, LOAD_LIBRARY_SEARCH_SYSTEM32) }.map(Module) +} + +fn find(module: &Module, name: PCSTR, label: &str) -> Result { + unsafe { GetProcAddress(module.0, name) } + .ok_or_else(Error::from_thread) + .map_err(|error| Error::new(error.code(), format!("Failed to resolve {label}: {error}"))) +} + +fn resolve<'a, M, T>( + cache: &'a OnceLock, + dll: &str, + load: impl FnOnce() -> Result, + find: impl FnOnce(&M) -> Result, +) -> Result<&'a T> { + if let Some(api) = cache.get() { + return Ok(api); + } + // Loading and export lookup must not run under the publication lock. + // Only successes are cached; failure and race-loser references are released. + let last_error = unsafe { GetLastError() }; + let module = load() + .map_err(|error| Error::new(error.code(), format!("Failed to load {dll}: {error}")))?; + let api = find(&module)?; + let api = cache.get_or_init(|| { + // The winning loader reference outlives every published function pointer. + std::mem::forget(module); + api + }); + // Some helpers do not set LastError on every result. Successful admission + // must not substitute loader bookkeeping for the caller's incoming value. + unsafe { SetLastError(last_error) }; + Ok(api) +} + +// Each signature below matches the SDK/windows-rs extern "system" declaration, +// not the fallible/generic windows-rs convenience wrapper. +macro_rules! export { + ($module:expr, $dll:literal, $name:literal, $typ:ty) => { + unsafe { + std::mem::transmute::(find( + $module, + s!($name), + concat!($dll, "!", $name), + )?) + } + }; +} + +static DELETE_OBJECT: OnceLock = OnceLock::new(); +static DESTROY_ICON: OnceLock = OnceLock::new(); +static CREATE_WINDOW: OnceLock = OnceLock::new(); +static DPI_API: OnceLock = OnceLock::new(); + +/// A typed deleter backed by a process-lifetime loader reference. +#[derive(Clone, Copy, Debug)] +pub struct GdiObjectDeleter(DeleteObjectFn); + +impl GdiObjectDeleter { + /// Resolve before invoking any native operation that can produce an owned GDI object. + pub fn resolve() -> Result { + #[cfg(test)] + test_support::check_resolution()?; + resolve( + &DELETE_OBJECT, + "gdi32.dll", + || load(w!("gdi32.dll")), + |module| { + Ok(Self(export!( + module, + "gdi32.dll", + "DeleteObject", + DeleteObjectFn + ))) + }, + ) + .copied() + } + + /// Use only after admission has resolved the deleter, including on native failure. + /// This never loads a DLL or performs a fallible export lookup in cleanup. + pub fn prepared() -> Self { + *DELETE_OBJECT + .get() + .expect("GDI output ownership requires pre-dispatch cleanup admission") + } + + /// # Safety + /// `object` must be a GDI object for which the caller may call DeleteObject. + pub unsafe fn delete(self, object: HGDIOBJ) -> BOOL { + #[cfg(test)] + test_support::record_delete(); + unsafe { (self.0)(object) } + } +} + +/// # Safety +/// `icon` must satisfy the SDK DestroyIcon ownership requirements. +pub unsafe fn destroy_icon(icon: HICON) -> Result<()> { + let destroy = resolve( + &DESTROY_ICON, + "user32.dll", + || load(w!("user32.dll")), + |module| Ok(export!(module, "user32.dll", "DestroyIcon", DestroyIconFn)), + )?; + unsafe { destroy(icon).ok() } +} + +/// # Safety +/// Arguments and the calling thread must satisfy the SDK CreateWindowExW contract. +#[allow(clippy::too_many_arguments)] +pub unsafe fn create_window_ex( + ex_style: WINDOW_EX_STYLE, + class_name: PCWSTR, + title: PCWSTR, + style: WINDOW_STYLE, + x: i32, + y: i32, + width: i32, + height: i32, + parent: Option, + menu: Option, + instance: Option, + param: Option<*const c_void>, +) -> Result { + let create = resolve( + &CREATE_WINDOW, + "user32.dll", + || load(w!("user32.dll")), + |module| { + Ok(export!( + module, + "user32.dll", + "CreateWindowExW", + CreateWindowExWFn + )) + }, + )?; + let window = unsafe { + create( + ex_style, + class_name, + title, + style, + x, + y, + width, + height, + parent.unwrap_or_default(), + menu.unwrap_or_default(), + instance.unwrap_or_default(), + param.unwrap_or(std::ptr::null()), + ) + }; + (!window.is_invalid()) + .then_some(window) + .ok_or_else(Error::from_thread) +} + +pub(crate) struct DpiApi { + pub(crate) contexts_equal: + unsafe extern "system" fn(DPI_AWARENESS_CONTEXT, DPI_AWARENESS_CONTEXT) -> BOOL, + pub(crate) process_context: unsafe extern "system" fn(HANDLE) -> DPI_AWARENESS_CONTEXT, + pub(crate) set_process_context: unsafe extern "system" fn(DPI_AWARENESS_CONTEXT) -> BOOL, + pub(crate) set_thread_context: + unsafe extern "system" fn(DPI_AWARENESS_CONTEXT) -> DPI_AWARENESS_CONTEXT, +} + +impl DpiApi { + pub(crate) fn resolve() -> Result<&'static Self> { + resolve( + &DPI_API, + "user32.dll", + || load(w!("user32.dll")), + |module| { + Ok(Self { + contexts_equal: export!( + module, + "user32.dll", + "AreDpiAwarenessContextsEqual", + unsafe extern "system" fn( + DPI_AWARENESS_CONTEXT, + DPI_AWARENESS_CONTEXT, + ) -> BOOL + ), + process_context: export!( + module, + "user32.dll", + "GetDpiAwarenessContextForProcess", + unsafe extern "system" fn(HANDLE) -> DPI_AWARENESS_CONTEXT + ), + set_process_context: export!( + module, + "user32.dll", + "SetProcessDpiAwarenessContext", + unsafe extern "system" fn(DPI_AWARENESS_CONTEXT) -> BOOL + ), + set_thread_context: export!( + module, + "user32.dll", + "SetThreadDpiAwarenessContext", + unsafe extern "system" fn(DPI_AWARENESS_CONTEXT) -> DPI_AWARENESS_CONTEXT + ), + }) + }, + ) + } +} + +#[cfg(test)] +pub(crate) mod test_support { + use std::cell::Cell; + use windows_core::{Error, HRESULT, Result}; + + thread_local! { + static RESOLUTION_FAILURE: Cell> = const { Cell::new(None) }; + static RESOLUTION_CALLS: Cell = const { Cell::new(0) }; + static DELETE_CALLS: Cell = const { Cell::new(0) }; + } + + pub(crate) struct ResolutionFailure(Option); + + impl ResolutionFailure { + pub(crate) fn new(error: HRESULT) -> Self { + Self(RESOLUTION_FAILURE.replace(Some(error))) + } + } + + impl Drop for ResolutionFailure { + fn drop(&mut self) { + RESOLUTION_FAILURE.set(self.0); + } + } + + pub(super) fn check_resolution() -> Result<()> { + RESOLUTION_CALLS.set(RESOLUTION_CALLS.get() + 1); + match RESOLUTION_FAILURE.get() { + Some(error) => Err(Error::new( + error, + "Failed to resolve gdi32.dll!DeleteObject (test)", + )), + None => Ok(()), + } + } + + pub(super) fn record_delete() { + DELETE_CALLS.set(DELETE_CALLS.get() + 1); + } + + pub(crate) fn delete_calls() -> usize { + DELETE_CALLS.get() + } + + pub(crate) fn resolution_calls() -> usize { + RESOLUTION_CALLS.get() + } +} + +#[cfg(test)] +mod tests; diff --git a/crates/dynwinrt/src/system_helpers/tests.rs b/crates/dynwinrt/src/system_helpers/tests.rs new file mode 100644 index 00000000..16fc0656 --- /dev/null +++ b/crates/dynwinrt/src/system_helpers/tests.rs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +use super::*; +use std::{ + sync::{ + Arc, + atomic::{AtomicUsize, Ordering}, + mpsc, + }, + time::Duration, +}; +use windows::Win32::{ + Foundation::{ERROR_MOD_NOT_FOUND, ERROR_PROC_NOT_FOUND}, + Graphics::Gdi::{BITMAP, CreateBitmap, GetObjectW}, + UI::WindowsAndMessaging::{CreateIcon, DestroyWindow, WS_POPUP}, +}; +use windows_core::HRESULT; + +struct ModuleProbe(Arc); + +impl Drop for ModuleProbe { + fn drop(&mut self) { + self.0.fetch_add(1, Ordering::SeqCst); + } +} + +#[test] +fn successful_cold_resolution_preserves_incoming_last_error() { + use windows::Win32::Foundation::{ERROR_ACCESS_DENIED, ERROR_INVALID_DATA}; + let cache = OnceLock::new(); + unsafe { SetLastError(ERROR_ACCESS_DENIED) }; + resolve( + &cache, + "test.dll", + || { + unsafe { SetLastError(ERROR_INVALID_DATA) }; + Ok(()) + }, + |_| { + unsafe { SetLastError(ERROR_PROC_NOT_FOUND) }; + Ok(7usize) + }, + ) + .unwrap(); + assert_eq!(unsafe { GetLastError() }, ERROR_ACCESS_DENIED); + resolve( + &cache, + "test.dll", + || -> Result<()> { panic!("cache hit must not call the loader") }, + |_| panic!("cache hit must not resolve exports"), + ) + .unwrap(); + assert_eq!(unsafe { GetLastError() }, ERROR_ACCESS_DENIED); +} + +#[test] +fn missing_system_dll_preserves_error_and_leaves_cache_retryable() { + let cache = OnceLock::::new(); + let error = resolve( + &cache, + "dynwinrt-missing-ui-helper.dll", + || load(w!("dynwinrt-missing-ui-helper.dll")), + |_| panic!("failed loading must not resolve exports"), + ) + .unwrap_err(); + assert_eq!(error.code(), HRESULT::from_win32(ERROR_MOD_NOT_FOUND.0)); + assert!(error.message().contains("dynwinrt-missing-ui-helper.dll")); + assert!(cache.get().is_none()); + assert_eq!( + *resolve(&cache, "test.dll", || Ok(()), |_| Ok(7)).unwrap(), + 7 + ); +} + +#[test] +fn missing_native_export_preserves_last_error_before_free_library() { + let cache = OnceLock::new(); + let error = resolve( + &cache, + "user32.dll", + || load(w!("user32.dll")), + |module| { + find( + module, + s!("DynwinrtMissingUiHelper"), + "user32.dll!DynwinrtMissingUiHelper", + ) + }, + ) + .unwrap_err(); + assert_eq!(error.code(), HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0)); + assert!( + error + .message() + .contains("user32.dll!DynwinrtMissingUiHelper") + ); + assert!(cache.get().is_none()); +} + +#[test] +fn failed_resolution_releases_module_and_success_is_cached() { + let cache = OnceLock::new(); + let drops = Arc::new(AtomicUsize::new(0)); + let error = resolve( + &cache, + "test.dll", + || Ok(ModuleProbe(drops.clone())), + |_| -> Result { + Err(Error::from_hresult(HRESULT::from_win32( + ERROR_PROC_NOT_FOUND.0, + ))) + }, + ) + .unwrap_err(); + assert_eq!(error.code(), HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0)); + assert_eq!(drops.load(Ordering::SeqCst), 1); + assert!(cache.get().is_none()); + let first = resolve( + &cache, + "test.dll", + || Ok(ModuleProbe(drops.clone())), + |_| Ok(7), + ) + .unwrap(); + let second = resolve( + &cache, + "test.dll", + || -> Result { panic!("cached helper must not load again") }, + |_| panic!("cached helper must not look up the export again"), + ) + .unwrap(); + assert!(std::ptr::eq(first, second)); + assert_eq!(drops.load(Ordering::SeqCst), 1); +} + +#[test] +fn concurrent_resolution_loads_outside_publication_and_retains_only_winner() { + const THREADS: usize = 8; + let cache = OnceLock::new(); + let drops = Arc::new(AtomicUsize::new(0)); + let (ready_tx, ready_rx) = mpsc::channel(); + std::thread::scope(|scope| { + let threads = (0..THREADS) + .map(|_| { + scope.spawn(|| { + let api = resolve( + &cache, + "test.dll", + || Ok(ModuleProbe(drops.clone())), + |_| { + let (release_tx, release_rx) = mpsc::channel(); + ready_tx.send(release_tx).unwrap(); + release_rx.recv_timeout(Duration::from_secs(10)).unwrap(); + Ok(7usize) + }, + ) + .unwrap(); + api as *const usize as usize + }) + }) + .collect::>(); + let releases = (0..THREADS) + .map(|_| ready_rx.recv_timeout(Duration::from_secs(10)).unwrap()) + .collect::>(); + for release in releases { + release.send(()).unwrap(); + } + let pointers = threads + .into_iter() + .map(|thread| thread.join().unwrap()) + .collect::>(); + assert!(pointers.iter().all(|pointer| *pointer == pointers[0])); + }); + assert_eq!(drops.load(Ordering::SeqCst), THREADS - 1); +} + +#[test] +fn typed_gdi_deleter_releases_real_bitmap_once_without_loading_during_cleanup() { + let deleter = GdiObjectDeleter::resolve().unwrap(); + let bitmap = unsafe { CreateBitmap(1, 1, 1, 1, None) }; + assert!(!bitmap.is_invalid()); + let object = HGDIOBJ(bitmap.0); + let mut info = BITMAP::default(); + let size = std::mem::size_of::() as i32; + assert_eq!( + unsafe { GetObjectW(object, size, Some((&mut info as *mut BITMAP).cast())) }, + size + ); + let before = test_support::delete_calls(); + let _failure = + test_support::ResolutionFailure::new(HRESULT::from_win32(ERROR_PROC_NOT_FOUND.0)); + assert!(GdiObjectDeleter::resolve().is_err()); + assert!(unsafe { deleter.delete(object) }.as_bool()); + assert_eq!(test_support::delete_calls(), before + 1); + // GetObjectType can report stale handle type bits even after deletion. + assert_eq!( + unsafe { GetObjectW(object, size, Some((&mut info as *mut BITMAP).cast())) }, + 0 + ); + // The prepared path also remains available while a new resolution would fail. + let _ = GdiObjectDeleter::prepared(); +} + +#[test] +fn typed_destroy_icon_uses_icon_cleanup_not_delete_object() { + let and_mask = [0xff; 32]; + let xor_mask = [0; 32]; + let icon = + unsafe { CreateIcon(None, 16, 16, 1, 1, and_mask.as_ptr(), xor_mask.as_ptr()) }.unwrap(); + let before = test_support::delete_calls(); + unsafe { destroy_icon(icon) }.unwrap(); + assert_eq!(test_support::delete_calls(), before); + assert!(unsafe { destroy_icon(HICON::default()) }.is_err()); +} + +#[test] +fn typed_create_window_preserves_result_and_last_error() { + let window = unsafe { + create_window_ex( + WINDOW_EX_STYLE(0), + w!("STATIC"), + w!("dynwinrt-lazy-ui-test"), + WS_POPUP, + 0, + 0, + 1, + 1, + None, + None, + None, + None, + ) + } + .unwrap(); + unsafe { DestroyWindow(window) }.unwrap(); + + let error = unsafe { + create_window_ex( + WINDOW_EX_STYLE(0), + w!("DynwinrtUnregisteredWindowClass"), + w!(""), + WS_POPUP, + 0, + 0, + 1, + 1, + None, + None, + None, + None, + ) + } + .unwrap_err(); + let sdk_error = unsafe { + windows::Win32::UI::WindowsAndMessaging::CreateWindowExW( + WINDOW_EX_STYLE(0), + w!("DynwinrtUnregisteredWindowClass"), + w!(""), + WS_POPUP, + 0, + 0, + 1, + 1, + None, + None, + None, + None, + ) + } + .unwrap_err(); + assert_eq!(error.code(), sdk_error.code()); +} diff --git a/crates/dynwinrt/src/xaml_application.rs b/crates/dynwinrt/src/xaml_application.rs index 407ebe88..bc88f0bd 100644 --- a/crates/dynwinrt/src/xaml_application.rs +++ b/crates/dynwinrt/src/xaml_application.rs @@ -11,10 +11,7 @@ use std::sync::{Arc, LazyLock, Mutex}; use windows::Win32::System::Com::CoTaskMemAlloc; use windows::Win32::System::Threading::GetCurrentProcess; -use windows::Win32::UI::HiDpi::{ - AreDpiAwarenessContextsEqual, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, - GetDpiAwarenessContextForProcess, SetProcessDpiAwarenessContext, SetThreadDpiAwarenessContext, -}; +use windows::Win32::UI::HiDpi::DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2; use windows_core::{GUID, HRESULT, HSTRING, IUnknown, Interface}; use crate::com_helpers::{E_FAIL, E_NOINTERFACE, E_NOTIMPL, E_POINTER, IInspectableVtbl, S_OK}; @@ -1152,17 +1149,16 @@ fn query_interface(object: &IUnknown, iid: &GUID) -> windows_core::Result windows_core::Result<()> { + let api = crate::system_helpers::DpiApi::resolve()?; // WinUI popup hosts consult the process context, so it must match the UI thread. - let process_context = unsafe { GetDpiAwarenessContextForProcess(GetCurrentProcess()) }; + let process_context = unsafe { (api.process_context)(GetCurrentProcess()) }; if !unsafe { - AreDpiAwarenessContextsEqual(process_context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) - .as_bool() + (api.contexts_equal)(process_context, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2).as_bool() } { - unsafe { SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2)? }; + unsafe { (api.set_process_context)(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2).ok()? }; } - let previous = - unsafe { SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) }; + let previous = unsafe { (api.set_thread_context)(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) }; if previous.0.is_null() { Err(windows_core::Error::from_thread()) } else { @@ -1855,15 +1851,14 @@ mod tests { fn enables_per_monitor_v2_on_the_process_and_ui_thread() { enable_per_monitor_v2().unwrap(); - let process = unsafe { GetDpiAwarenessContextForProcess(GetCurrentProcess()) }; + let api = crate::system_helpers::DpiApi::resolve().unwrap(); + let process = unsafe { (api.process_context)(GetCurrentProcess()) }; let current = unsafe { GetThreadDpiAwarenessContext() }; assert!(unsafe { - AreDpiAwarenessContextsEqual(process, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) - .as_bool() + (api.contexts_equal)(process, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2).as_bool() }); assert!(unsafe { - AreDpiAwarenessContextsEqual(current, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) - .as_bool() + (api.contexts_equal)(current, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2).as_bool() }); } } diff --git a/docs/architecture/classic-com-support.md b/docs/architecture/classic-com-support.md index 33f3197f..ec6c0440 100644 --- a/docs/architecture/classic-com-support.md +++ b/docs/architecture/classic-com-support.md @@ -24,6 +24,10 @@ Both entrypoints use the same native N-API binary and private libffi call machinery. Classic COM metadata, generated wrappers, ownership rules, and public APIs remain separate from the WinRT projection. +The [lazy GDI/USER32 helper boundary](lazy-system-helpers.md) removes those +direct production PE dependencies without changing ownership or promising +transitive DLL isolation. + The private Node storage, value-sidecar and registration boundaries are described in [JavaScript binding internals](javascript-binding-internals.md). Sharing JS backing-store protection does not share COM ownership or ABI semantics. diff --git a/docs/architecture/lazy-system-helpers.md b/docs/architecture/lazy-system-helpers.md new file mode 100644 index 00000000..9bbc52a1 --- /dev/null +++ b/docs/architecture/lazy-system-helpers.md @@ -0,0 +1,155 @@ +# Lazy GDI and USER32 helpers + +The native bindings resolve the following existing helpers on demand rather +than importing them through the PE ordinary or delay import tables. This is +a **direct-import boundary**, not complete physical isolation from UI DLLs. +The binaries remain monolithic, and the host or other Windows dependencies +can still load USER32 and GDI. No startup-speed improvement is claimed. + +| DLL | Helpers | First resolution | +| --- | --- | --- | +| GDI32 | `DeleteObject` | Before invoking a completed call plan that can produce an owned GDI output, or at an explicit raw cleanup request | +| USER32 | `DestroyIcon` | At an explicit raw icon cleanup request | +| USER32 | `CreateWindowExW` | At the existing `DynCom.createTestHwnd()` request on `/com/unsafe` | +| USER32 | `AreDpiAwarenessContextsEqual`, `GetDpiAwarenessContextForProcess`, `SetProcessDpiAwarenessContext`, `SetThreadDpiAwarenessContext` | When creating a XAML application and applying its existing per-monitor-v2 policy | + +The metadata-independent implementation is in +`crates/dynwinrt/src/system_helpers.rs`. Its small, doc-hidden Rust surface is +shared with the JS binding; it is not a new supported projection API or a +general-purpose DLL loader. The WinRT, Classic COM, and flat Win32 semantic +models, generated code, and public JS/Python signatures are unchanged. + +## Resolution and lifetime + +Each helper has its SDK/windows-rs `extern "system"` signature, including +typed `HGDIOBJ`, `HICON`, `HWND`, DPI contexts, and native BOOL results. +The four DPI exports are published as one complete table. GDI deletion, icon +destruction, and window creation have independent caches, so using one does +not require unrelated exports. + +Loads use `LoadLibraryExW` with `LOAD_LIBRARY_SEARCH_SYSTEM32`. Loading and +`GetProcAddress` execute outside the cache publication lock. Only successful +resolutions are cached. A winning loader reference is retained for the +process lifetime before publication; failure and concurrent-loser references +are released. Repeated calls reuse the typed function pointer without another +export lookup. Failure is retryable and reports the DLL/export and original +Windows error code. + +Successful cold resolution restores the incoming thread LastError **before** +calling the target API. It does not restore anything after that call: SDK-style +BOOL/null failures read the target's LastError immediately. This avoids +exposing successful loader bookkeeping as a native API failure. + +## Ownership admission + +Building a type, registering an interface, importing a projection, and +initializing a native module do not resolve these helpers. + +The shared native executor records whether the completed parameter or direct +return cleanup plan can own a GDI handle. At actual invocation, it resolves +the deleter before the dispatch marker and native operation. This covers +fast calls, libffi calls, the COM-value path, and direct returns. Failure +prevents native execution and therefore cannot strand a newly produced owned +output. + +Building or rebinding a shared prepared call recomputes this requirement from +the completed cleanup contracts without resolving a DLL. Rebinding therefore +preserves both the shared call-plan lifetime and pre-dispatch cleanup admission. + +Partial outputs on failed HRESULTs, native result-extraction failures, +COM post-call validation failures, and JS owners/finalizers use the already +prepared, permanently backed GDI deleter. They never attempt a fallible first +load during cleanup. Original HRESULTs remain failures after cleanup. +The existing best-effort treatment of a native destructor's failure is not +changed; explicit JS release still retains ownership/provenance when native +deletion fails so the caller can retry. + +Raw GDI/icon cleanup has an existing fallible contract. It resolves and calls +the matching deleter before consuming the external pointer's provenance. +Load, export, and native cleanup failures leave that pointer available for +retry. `HICON` continues to use `DestroyIcon`, not `DeleteObject`. +No apartment, callback, shutdown, or DPI policy is changed. + +## Production import gate + +`bindings/js/scripts/pe-imports.mjs` supplies the shared PE32/PE32+ reader and +policy. The new production policy is intentionally **stronger than a +seven-symbol check**: it rejects every GDI32/USER32 descriptor, including +empty and ordinal-only descriptors, plus the scoped named exports through +other DLL names. It checks both ordinary and delay imports. OLEAUT32, +OLE32, and COMBASE are not prohibited. + +The existing optional Win32 subsystem rule remains ordinary-import-only: +MAPI/GDI+/Winsock/Media Foundation delay imports are allowed by that rule. +The CLI passes only ordinary imports to it, while GDI/USER32 and CoreMessaging +checks receive the combined ordinary/delay list. + +`npm run test:imports` and production artifact verification check every +`.node` architecture without loading foreign-architecture binaries. +The dependency-free CLI also checks an existing Python extension: + +```powershell +node .\bindings\js\scripts\check-ui-helper-imports.mjs +``` + +The Build workflow checks the installed, verified, no-test-hooks CI Python +wheel (its existing profile is **dev**, not release). The Python release +workflow separately checks the installed **release** wheel in each x64/ARM64 +runtime-consumer lane, with explicit Node 24 setup. Both use the same reader +and policy, without rebuilding or loading the `.pyd` for inspection. +Existing artifact identity, upload, and publication rules are unchanged. + +Native test programs and explicitly marked test-hooks addons can import +GDI/USER32 fixture-creation APIs. They are not evidence about shipping binary +imports. Production checks do not grant those fixtures an exception. + +## Retained validation + +[Machine-readable evidence](../status/generated/lazy-system-helpers-validation.json) +records before/after production PE tables and hashes, calibrated cold-process +module observations, and regression-log digests. The baseline is +`34eb6246627c671113a501c00edc8e3317fc8b3d`. + +The original measurements below cover runtime commit `1a84b31a` with the +import-policy correction at `7cc049a9`. The report's `mergeValidation` entry +separately records ARM64 rebuilds and focused checks after merging main +`f446adbf`, including call-plan rebinding and metadata lifetime regressions. +The earlier x64/i686 measurements are not relabeled as tests of that merge. + +| Observation | Before | After | +| --- | --- | --- | +| ARM64 release Node addon | GDI32 `DeleteObject`; USER32 six scoped exports | No GDI32/USER32 ordinary or delay descriptors | +| ARM64 release CPython 3.13 extension | GDI32 `DeleteObject`; USER32 four DPI exports | No GDI32/USER32 ordinary or delay descriptors | +| Cross-built x64 release addon payload | Not measured locally at baseline | No GDI32/USER32 ordinary or delay descriptors | +| Fresh ARM64 Node: host / root import / primitive / Uri | 35 / 37 / 37 / 39 modules | 35 / 37 / 37 / 39 modules | +| Fresh ARM64 Python: host / root import / primitive / Uri | 15 / 28 / 28 / 30 modules | 15 / 28 / 28 / 30 modules | + +MSVC `dumpbin /imports` independently confirms the changed production PE +tables. In this machine's cold processes, **module counts did not decrease**. +Node already maps the UI DLLs; Python still maps them through remaining +system dependencies. Neither absence of new Node modules nor removed direct +PE entries proves transitive isolation. + +The observer runs in a separate ARM64 PowerShell process and enumerates the +child-reported PID with `K32EnumProcessModulesEx` / +`K32GetModuleFileNameExW`. Each phase has a stdin/stdout handshake, an +`ntdll.dll` positive control, a plausible module-count check, and bounded +natural exit. No `ctypes`, process-report call, or observer is injected into +the measured child. Registration and hidden-window opt-in probes are separate +from non-UI import/primitive/Uri probes. + +Focused coverage includes retryable missing DLL/export resolution, concurrent +cache publication/reference balance, LastError preservation, real bitmap and +icon cleanup, native failure and partial outputs, failed extraction and +post-call validation, explicit release retry, and hidden-window/DPI use. +The native scoped tests ran on ARM64 and on x64/i686 under +**Windows-on-ARM emulation**, not physical x64/i686 hardware. +The x64 addon was cross-built and inspected, not executed in an x64 Node host. +Local Python runtime measurements cover ARM64 CPython 3.13 only. + +Existing CoreMessaging and optional Win32 import gates, WinRT snapshots, +generated non-UI Uri calls in both languages, generated stock WIC COM calls, +and a flat Win32 `GetTickCount` package smoke test remain covered. +This work does not delay OLEAUT32, replace existing optional-subsystem loaders, +split binaries, establish support for older Windows versions, or prove +complete absence of COM/UI DLLs in a process. diff --git a/docs/status/generated/lazy-system-helpers-validation.json b/docs/status/generated/lazy-system-helpers-validation.json new file mode 100644 index 00000000..da4913f5 --- /dev/null +++ b/docs/status/generated/lazy-system-helpers-validation.json @@ -0,0 +1,3485 @@ +{ + "baseCommit": "34eb6246627c671113a501c00edc8e3317fc8b3d", + "afterSource": "Initial scoped runtime at 1a84b31a43c07874d21af17864d5bf69963d9fb1 with import-policy correction at 7cc049a9e787892092b5ce2b2522c00a2ae1a5ce; production release builds with no test-hooks", + "mergeValidation": { + "mainCommit": "f446adbf994e91decdf1ab6a242ca02d374f41f3", + "previousReviewedHead": "7cc049a9e787892092b5ce2b2522c00a2ae1a5ce", + "platform": "Native Windows ARM64; no new x64/i686 execution claimed", + "resolution": "Preserve Arc and recompute GDI cleanup admission from completed contracts in Method::from_parts for both construction and rebinding, without loading DLLs", + "productionBinaries": [ + { + "filename": "dynwinrt.win32-arm64-msvc.node", + "sha256": "34cc2a3a415067ea7eef67bafb80e7a945f519b3f954a4b3949bcf97978b9f33", + "profile": "release", + "testHooks": false, + "gdi32User32OrdinaryOrDelayImports": [] + }, + { + "filename": "dynwinrt.cp313-win_arm64.pyd", + "sha256": "abdb66fa38e6df7cd90b9856a6166307211ba8c7400a3ad0d2a38fea2ccf2538", + "profile": "release", + "testHooks": false, + "gdi32User32OrdinaryOrDelayImports": [] + } + ], + "checks": { + "scopedCoreTests": 21, + "metadataLifetimeTests": 17, + "jsNativeOwnershipAndIdentityTests": 10, + "nativeClassBoundaryChildProcesses": 8, + "pePolicyAndProductionImportTests": 137, + "calibratedColdProcessObservations": 13 + }, + "logs": [ + "merge-core-tests.log", + "merge-metadata-lifetime-tests.log", + "merge-js-native-tests.log", + "merge-native-class-e2e.log", + "merge-import-gates.log", + "merge-pe-imports.json", + "merge-loaded-modules.json" + ] + }, + "platform": "Windows ARM64; x64 and i686 native tests ran under Windows-on-ARM emulation, not physical x64/i686 hardware", + "tools": { + "rustc": "1.97.1", + "node": "24.15.0 ARM64", + "python": "3.13.15 ARM64", + "maturin": "1.14.1" + }, + "observer": "Separate ARM64 PowerShell K32EnumProcessModulesEx/K32GetModuleFileNameExW, child-reported PID and stdin/stdout handshake; no observer code injected into Node/Python", + "controls": { + "minimumModuleCount": 10, + "requiredModule": "ntdll.dll", + "phasesTimeoutSeconds": 30, + "naturalExitTimeoutSeconds": 15, + "independentPeControl": "MSVC 14.51.36231 dumpbin /imports", + "unchangedJsRuntimeSources": 16, + "unchangedPythonPackageSources": 4 + }, + "binaries": [ + { + "stage": "before", + "filename": "baseline.node", + "sha256": "456506e8a2404fd699e261d3d8b9537b94f0cf0e46f079eb2261daf4725b3cb8", + "machine": "ARM64", + "profile": "release", + "testHooks": false, + "ordinary": [ + { + "dll": "oleaut32.dll", + "symbols": [ + "SafeArrayGetUBound", + "SafeArrayGetLBound", + "SafeArrayUnaccessData", + "SafeArrayGetIID", + "SafeArrayGetDim", + "SafeArrayGetVartype", + "VariantCopy", + "GetErrorInfo", + "CreateErrorInfo", + "SafeArrayCreateEx", + "VariantInit", + "SafeArrayCreate", + "SafeArrayCopy", + "SysAllocStringLen", + "SysFreeString", + "SafeArrayAccessData", + "SysStringLen", + "SetErrorInfo", + "SafeArrayGetElemsize", + "VariantClear", + "SafeArrayDestroy" + ] + }, + { + "dll": "kernel32.dll", + "symbols": [ + "GlobalSize", + "CancelIoEx", + "GlobalAlloc", + "CreateIoCompletionPort", + "GetQueuedCompletionStatus", + "GetOverlappedResult", + "WriteFile", + "ReadFile", + "HeapAlloc", + "LocalFree", + "GetCurrentProcess", + "GetWindowsDirectoryW", + "WaitForSingleObjectEx", + "LoadLibraryA", + "GetCurrentProcessId", + "CreateMutexA", + "ReleaseMutex", + "GetComputerNameW", + "GetFullPathNameW", + "SetLastError", + "GetCurrentThread", + "SetThreadStackGuarantee", + "GetModuleHandleA", + "CreateFileW", + "GetFileInformationByHandle", + "FindFirstFileExW", + "FindClose", + "GetFileInformationByHandleEx", + "LoadLibraryExA", + "LoadLibraryW", + "Sleep", + "VirtualAlloc", + "VirtualFree", + "VirtualQuery", + "WaitForSingleObject", + "CreateThread", + "GlobalLock", + "HeapFree", + "GetSystemInfo", + "GetCurrentThreadId", + "GetProcessHeap", + "HeapReAlloc", + "LoadLibraryExW", + "GetModuleHandleW", + "FormatMessageW", + "SwitchToThread", + "CloseHandle", + "GetModuleHandleExW", + "GetProcAddress", + "GetLastError", + "FreeLibrary", + "GetSystemTimeAsFileTime", + "DisableThreadLibraryCalls", + "GlobalFree", + "GlobalUnlock" + ] + }, + { + "dll": "api-ms-win-core-synch-l1-2-0.dll", + "symbols": [ + "WakeByAddressAll", + "WaitOnAddress", + "WakeByAddressSingle" + ] + }, + { + "dll": "combase.dll", + "symbols": [ + "CoTaskMemAlloc", + "CoTaskMemFree", + "CoIncrementMTAUsage", + "RoGetAgileReference", + "CoCreateFreeThreadedMarshaler" + ] + }, + { + "dll": "gdi32.dll", + "symbols": [ + "DeleteObject" + ] + }, + { + "dll": "ole32.dll", + "symbols": [ + "CoInitializeEx", + "ReleaseStgMedium", + "CoGetClassObject", + "CoUninitialize", + "CoGetMalloc", + "CoGetApartmentType", + "PropVariantClear", + "CoCreateInstance" + ] + }, + { + "dll": "api-ms-win-core-winrt-l1-1-0.dll", + "symbols": [ + "RoUninitialize", + "RoInitialize", + "RoGetActivationFactory" + ] + }, + { + "dll": "api-ms-win-appmodel-runtime-l1-1-3.dll", + "symbols": [ + "GetCurrentPackageInfo2" + ] + }, + { + "dll": "user32.dll", + "symbols": [ + "AreDpiAwarenessContextsEqual", + "SetProcessDpiAwarenessContext", + "GetDpiAwarenessContextForProcess", + "SetThreadDpiAwarenessContext", + "DestroyIcon", + "CreateWindowExW" + ] + }, + { + "dll": "advapi32.dll", + "symbols": [ + "CloseServiceHandle", + "RegCloseKey", + "CredFree" + ] + }, + { + "dll": "ntdll.dll", + "symbols": [ + "NtWriteFile", + "RtlNtStatusToDosError", + "NtQueryInformationFile" + ] + }, + { + "dll": "api-ms-win-core-winrt-error-l1-1-0.dll", + "symbols": [ + "RoOriginateErrorW" + ] + }, + { + "dll": "bcryptprimitives.dll", + "symbols": [ + "ProcessPrng" + ] + }, + { + "dll": "KERNEL32.dll", + "symbols": [ + "InitializeSListHead", + "GetConsoleMode", + "GetStdHandle", + "RtlVirtualUnwind", + "WideCharToMultiByte", + "lstrlenW", + "RtlLookupFunctionEntry", + "RtlCaptureContext", + "GetCurrentDirectoryW", + "MultiByteToWideChar", + "WriteConsoleW", + "GetEnvironmentVariableW", + "QueryPerformanceFrequency", + "QueryPerformanceCounter", + "FlushInstructionCache", + "GetConsoleOutputCP" + ] + }, + { + "dll": "VCRUNTIME140.dll", + "symbols": [ + "memset", + "__std_type_info_destroy_list", + "memcmp", + "__CxxFrameHandler3", + "_CxxThrowException", + "memmove", + "memcpy", + "__C_specific_handler" + ] + }, + { + "dll": "api-ms-win-crt-heap-l1-1-0.dll", + "symbols": [ + "malloc", + "free" + ] + }, + { + "dll": "api-ms-win-crt-string-l1-1-0.dll", + "symbols": [ + "strlen", + "wcslen" + ] + }, + { + "dll": "api-ms-win-crt-runtime-l1-1-0.dll", + "symbols": [ + "_initialize_narrow_environment", + "_execute_onexit_table", + "_initterm_e", + "_initterm", + "abort", + "_seh_filter_dll", + "_configure_narrow_argv", + "_cexit", + "_initialize_onexit_table" + ] + } + ], + "delay": [] + }, + { + "stage": "before", + "filename": "dynwinrt.cp313-win_arm64.pyd", + "sha256": "7e3fe77eb0732c8e3b13ab77c5b615fbf88d480ac7ab6e5d89ae8a70632e24c5", + "machine": "ARM64", + "profile": "release", + "testHooks": false, + "ordinary": [ + { + "dll": "oleaut32.dll", + "symbols": [ + "SysStringLen", + "SafeArrayGetVartype", + "SafeArrayUnaccessData", + "SafeArrayGetIID", + "SafeArrayGetElemsize", + "SafeArrayGetLBound", + "VariantInit", + "GetErrorInfo", + "SafeArrayAccessData", + "SafeArrayDestroy", + "VariantClear", + "SafeArrayGetDim", + "SetErrorInfo", + "SysFreeString", + "SafeArrayGetUBound" + ] + }, + { + "dll": "kernel32.dll", + "symbols": [ + "SetThreadStackGuarantee", + "Sleep", + "VirtualAlloc", + "VirtualFree", + "VirtualQuery", + "GetModuleHandleA", + "GetCurrentThread", + "GetFileInformationByHandleEx", + "GetModuleHandleW", + "GetProcessHeap", + "HeapFree", + "LoadLibraryExA", + "WaitForSingleObject", + "FindClose", + "HeapReAlloc", + "FormatMessageW", + "ReleaseMutex", + "FindFirstFileExW", + "CreateMutexA", + "GetCurrentProcessId", + "LoadLibraryA", + "WaitForSingleObjectEx", + "GetCurrentThreadId", + "GetFileInformationByHandle", + "GetModuleFileNameW", + "GetModuleHandleExW", + "GlobalUnlock", + "GlobalLock", + "GlobalSize", + "CreateThread", + "GetCurrentProcess", + "LoadLibraryExW", + "DisableThreadLibraryCalls", + "GetLastError", + "HeapAlloc", + "LoadLibraryW", + "GetProcAddress", + "FreeLibrary", + "GetFullPathNameW", + "SetLastError", + "GetComputerNameW", + "CloseHandle", + "CreateFileW" + ] + }, + { + "dll": "api-ms-win-core-synch-l1-2-0.dll", + "symbols": [ + "WakeByAddressAll", + "WakeByAddressSingle", + "WaitOnAddress" + ] + }, + { + "dll": "combase.dll", + "symbols": [ + "CoCreateFreeThreadedMarshaler", + "CoTaskMemFree", + "CoIncrementMTAUsage", + "CoTaskMemAlloc" + ] + }, + { + "dll": "api-ms-win-core-winrt-l1-1-0.dll", + "symbols": [ + "RoInitialize", + "RoGetActivationFactory", + "RoUninitialize" + ] + }, + { + "dll": "user32.dll", + "symbols": [ + "AreDpiAwarenessContextsEqual", + "GetDpiAwarenessContextForProcess", + "SetProcessDpiAwarenessContext", + "SetThreadDpiAwarenessContext" + ] + }, + { + "dll": "ole32.dll", + "symbols": [ + "CoGetApartmentType", + "ReleaseStgMedium", + "PropVariantClear" + ] + }, + { + "dll": "gdi32.dll", + "symbols": [ + "DeleteObject" + ] + }, + { + "dll": "api-ms-win-appmodel-runtime-l1-1-3.dll", + "symbols": [ + "GetCurrentPackageInfo2" + ] + }, + { + "dll": "ntdll.dll", + "symbols": [ + "NtWriteFile", + "RtlNtStatusToDosError" + ] + }, + { + "dll": "api-ms-win-core-winrt-error-l1-1-0.dll", + "symbols": [ + "RoOriginateErrorW" + ] + }, + { + "dll": "python313.dll", + "symbols": [ + "PyLong_AsLongLong", + "PyBytes_FromStringAndSize", + "PyBytes_Type", + "PyByteArray_Type", + "PyByteArray_AsString", + "PyByteArray_Size", + "PyBytes_AsString", + "PyBytes_Size", + "PyInterpreterState_Get", + "PyInterpreterState_Main", + "PyModule_Type", + "PyModule_GetDict", + "PyBaseObject_Type", + "PyObject_ClearWeakRefs", + "PyException_GetTraceback", + "PyTraceBack_Print", + "PyUnicode_Type", + "PyType_GetQualName", + "PyObject_Str", + "Py_IsInitialized", + "Py_IsFinalizing", + "PyGILState_Ensure", + "PyErr_GetRaisedException", + "PyUnicode_AsEncodedString", + "PyExc_TypeError", + "PyErr_SetString", + "PyErr_SetObject", + "PyType_GetName", + "PyExc_SystemError", + "PyErr_PrintEx", + "PyUnicode_InternInPlace", + "PyObject_Repr", + "Py_CompileStringExFlags", + "PyImport_AddModuleRef", + "PyEval_GetBuiltins", + "PyDict_SetDefaultRef", + "PyEval_EvalCode", + "PyException_SetCause", + "PyException_SetTraceback", + "PyObject_SetAttrString", + "PyType_Modified", + "PyExc_ValueError", + "PyObject_GenericGetDict", + "PyObject_GenericSetDict", + "PyType_FromSpec", + "PyLong_FromSsize_t", + "PyObject_GetItem", + "PyObject_SetItem", + "PyObject_DelItem", + "PyList_Type", + "PyObject_SetAttr", + "PyOS_FSPath", + "PyUnicode_AsWideChar", + "PyLong_Type", + "PyNumber_Index", + "PyLong_AsUnsignedLongLong", + "PyModule_GetNameObject", + "PyCMethod_New", + "PyBool_Type", + "PyType_GetModuleName", + "PyUnicode_EqualToUTF8AndSize", + "PyObject_IsTrue", + "PyDict_New", + "PyDict_SetItem", + "PyObject_VectorcallDict", + "PyLong_FromNativeBytes", + "PyLong_AsLong", + "_Py_TrueStruct", + "_Py_FalseStruct", + "PyCallable_Check", + "PyDict_Type", + "PyObject_CallNoArgs", + "_Py_NoneStruct", + "PyExc_OverflowError", + "PyExc_BaseException", + "PyExc_RuntimeError", + "PyExc_IndexError", + "PyErr_GivenExceptionMatches", + "PyExc_AttributeError", + "PyObject_Call", + "PyObject_Vectorcall", + "PyFloat_AsDouble", + "PyFloat_Type", + "PyTuple_Type", + "PyTuple_New", + "PyErr_WriteUnraisable", + "PyType_Type", + "PyErr_NewExceptionWithDoc", + "PyExc_Exception", + "PyLong_FromLongLong", + "PyLong_FromUnsignedLongLong", + "PyLong_FromLong", + "PyFloat_FromDouble", + "PyObject_GetAttr", + "PyUnicode_FromWideChar", + "PyGILState_Release", + "PyObject_GC_UnTrack", + "PyErr_Occurred", + "PyType_IsSubtype", + "PyIter_Next", + "PyObject_GetIter", + "PyObject_Size", + "PySequence_Check", + "PyErr_SetRaisedException", + "PyEval_SaveThread", + "PyObject_CallOneArg", + "PyObject_VectorcallMethod", + "PyList_Append", + "PyList_New", + "PyDict_Next", + "PyUnicode_AsUTF8AndSize", + "PyEval_RestoreThread", + "_Py_Dealloc", + "PyImport_Import", + "PyUnicode_FromStringAndSize", + "PyModuleDef_Init", + "PyExc_OSError" + ] + }, + { + "dll": "bcryptprimitives.dll", + "symbols": [ + "ProcessPrng" + ] + }, + { + "dll": "KERNEL32.dll", + "symbols": [ + "GetSystemInfo", + "InitializeSListHead", + "GetCurrentDirectoryW", + "RtlCaptureContext", + "FlushInstructionCache", + "RtlLookupFunctionEntry", + "QueryPerformanceCounter", + "QueryPerformanceFrequency", + "lstrlenW", + "GetEnvironmentVariableW", + "WideCharToMultiByte", + "RtlVirtualUnwind", + "GetSystemTimeAsFileTime", + "GetStdHandle", + "GetConsoleMode", + "GetConsoleOutputCP", + "MultiByteToWideChar", + "WriteConsoleW" + ] + }, + { + "dll": "VCRUNTIME140.dll", + "symbols": [ + "__std_type_info_destroy_list", + "__C_specific_handler", + "_CxxThrowException", + "__CxxFrameHandler3", + "memcpy", + "memcmp", + "memset", + "memmove" + ] + }, + { + "dll": "api-ms-win-crt-heap-l1-1-0.dll", + "symbols": [ + "malloc", + "free" + ] + }, + { + "dll": "api-ms-win-crt-string-l1-1-0.dll", + "symbols": [ + "wcslen" + ] + }, + { + "dll": "api-ms-win-crt-math-l1-1-0.dll", + "symbols": [ + "pow" + ] + }, + { + "dll": "api-ms-win-crt-runtime-l1-1-0.dll", + "symbols": [ + "_initterm_e", + "_seh_filter_dll", + "_cexit", + "_initialize_narrow_environment", + "_initterm", + "abort", + "_configure_narrow_argv", + "_execute_onexit_table", + "_initialize_onexit_table" + ] + } + ], + "delay": [] + }, + { + "stage": "after", + "filename": "dynwinrt.win32-arm64-msvc.node", + "sha256": "0ec885b9bf959f4d74d4c8875d5c04192a6da948eeeccbaad367a38123344920", + "machine": "ARM64", + "profile": "release", + "testHooks": false, + "ordinary": [ + { + "dll": "oleaut32.dll", + "symbols": [ + "SafeArrayGetElemsize", + "SafeArrayGetLBound", + "SafeArrayGetUBound", + "SafeArrayAccessData", + "SafeArrayGetVartype", + "SafeArrayUnaccessData", + "SafeArrayCopy", + "SysAllocStringLen", + "VariantCopy", + "SysStringLen", + "SafeArrayCreateEx", + "SafeArrayCreate", + "VariantClear", + "SafeArrayDestroy", + "SysFreeString", + "SafeArrayGetDim", + "VariantInit", + "SafeArrayGetIID", + "SetErrorInfo", + "CreateErrorInfo", + "GetErrorInfo" + ] + }, + { + "dll": "kernel32.dll", + "symbols": [ + "CreateIoCompletionPort", + "WriteFile", + "ReadFile", + "CancelIoEx", + "GetFullPathNameW", + "SetLastError", + "LoadLibraryW", + "WaitForSingleObjectEx", + "LoadLibraryA", + "GlobalSize", + "CreateMutexA", + "ReleaseMutex", + "GlobalUnlock", + "WaitForSingleObject", + "GlobalLock", + "GetCurrentThread", + "SetThreadStackGuarantee", + "GetModuleHandleA", + "CreateFileW", + "GetFileInformationByHandle", + "FindFirstFileExW", + "FindClose", + "GetFileInformationByHandleEx", + "LoadLibraryExA", + "CreateThread", + "Sleep", + "VirtualAlloc", + "VirtualFree", + "VirtualQuery", + "GetSystemInfo", + "GetComputerNameW", + "GetCurrentThreadId", + "HeapReAlloc", + "GetModuleHandleW", + "SwitchToThread", + "GlobalAlloc", + "CloseHandle", + "FormatMessageW", + "GetWindowsDirectoryW", + "GetQueuedCompletionStatus", + "GetCurrentProcess", + "HeapAlloc", + "GetCurrentProcessId", + "LocalFree", + "HeapFree", + "GetProcessHeap", + "LoadLibraryExW", + "GetModuleHandleExW", + "GetProcAddress", + "GetLastError", + "FreeLibrary", + "GetSystemTimeAsFileTime", + "DisableThreadLibraryCalls", + "GlobalFree", + "GetOverlappedResult" + ] + }, + { + "dll": "api-ms-win-core-synch-l1-2-0.dll", + "symbols": [ + "WaitOnAddress", + "WakeByAddressAll", + "WakeByAddressSingle" + ] + }, + { + "dll": "combase.dll", + "symbols": [ + "CoTaskMemAlloc", + "CoTaskMemFree", + "CoCreateFreeThreadedMarshaler", + "RoGetAgileReference", + "CoIncrementMTAUsage" + ] + }, + { + "dll": "ole32.dll", + "symbols": [ + "CoInitializeEx", + "CoCreateInstance", + "CoGetClassObject", + "CoUninitialize", + "CoGetApartmentType", + "CoGetMalloc", + "PropVariantClear", + "ReleaseStgMedium" + ] + }, + { + "dll": "api-ms-win-core-winrt-l1-1-0.dll", + "symbols": [ + "RoInitialize", + "RoGetActivationFactory", + "RoUninitialize" + ] + }, + { + "dll": "api-ms-win-appmodel-runtime-l1-1-3.dll", + "symbols": [ + "GetCurrentPackageInfo2" + ] + }, + { + "dll": "advapi32.dll", + "symbols": [ + "RegCloseKey", + "CloseServiceHandle", + "CredFree" + ] + }, + { + "dll": "ntdll.dll", + "symbols": [ + "RtlNtStatusToDosError", + "NtWriteFile", + "NtQueryInformationFile" + ] + }, + { + "dll": "api-ms-win-core-winrt-error-l1-1-0.dll", + "symbols": [ + "RoOriginateErrorW" + ] + }, + { + "dll": "bcryptprimitives.dll", + "symbols": [ + "ProcessPrng" + ] + }, + { + "dll": "KERNEL32.dll", + "symbols": [ + "InitializeSListHead", + "FlushInstructionCache", + "QueryPerformanceCounter", + "QueryPerformanceFrequency", + "GetEnvironmentVariableW", + "WriteConsoleW", + "MultiByteToWideChar", + "GetConsoleOutputCP", + "GetConsoleMode", + "GetStdHandle", + "RtlVirtualUnwind", + "WideCharToMultiByte", + "lstrlenW", + "RtlLookupFunctionEntry", + "RtlCaptureContext", + "GetCurrentDirectoryW" + ] + }, + { + "dll": "VCRUNTIME140.dll", + "symbols": [ + "memset", + "__CxxFrameHandler3", + "memcpy", + "memcmp", + "__std_type_info_destroy_list", + "__C_specific_handler", + "_CxxThrowException", + "memmove" + ] + }, + { + "dll": "api-ms-win-crt-heap-l1-1-0.dll", + "symbols": [ + "malloc", + "free" + ] + }, + { + "dll": "api-ms-win-crt-string-l1-1-0.dll", + "symbols": [ + "wcslen", + "strlen" + ] + }, + { + "dll": "api-ms-win-crt-runtime-l1-1-0.dll", + "symbols": [ + "_configure_narrow_argv", + "_cexit", + "_initialize_narrow_environment", + "_initialize_onexit_table", + "_execute_onexit_table", + "_seh_filter_dll", + "_initterm_e", + "_initterm", + "abort" + ] + } + ], + "delay": [] + }, + { + "stage": "after", + "filename": "dynwinrt.cp313-win_arm64.pyd", + "sha256": "b62df20c9b213a3c5faec32334aa61781a0e756d2782e49e8b24d76ef49e5985", + "machine": "ARM64", + "profile": "release", + "testHooks": false, + "ordinary": [ + { + "dll": "oleaut32.dll", + "symbols": [ + "VariantInit", + "SafeArrayDestroy", + "SafeArrayUnaccessData", + "SafeArrayGetElemsize", + "SysStringLen", + "GetErrorInfo", + "SafeArrayAccessData", + "SafeArrayGetVartype", + "SafeArrayGetUBound", + "SysFreeString", + "SafeArrayGetDim", + "VariantClear", + "SetErrorInfo", + "SafeArrayGetIID", + "SafeArrayGetLBound" + ] + }, + { + "dll": "kernel32.dll", + "symbols": [ + "VirtualFree", + "VirtualQuery", + "GetProcessHeap", + "HeapFree", + "VirtualAlloc", + "Sleep", + "FindClose", + "LoadLibraryExA", + "CreateThread", + "HeapReAlloc", + "FindFirstFileExW", + "FormatMessageW", + "GlobalLock", + "DisableThreadLibraryCalls", + "GetFileInformationByHandle", + "CreateFileW", + "GetModuleHandleA", + "SetThreadStackGuarantee", + "GetCurrentThread", + "GetModuleHandleW", + "GlobalSize", + "GetLastError", + "WaitForSingleObject", + "LoadLibraryExW", + "ReleaseMutex", + "CloseHandle", + "CreateMutexA", + "GetCurrentProcessId", + "LoadLibraryA", + "WaitForSingleObjectEx", + "GetCurrentThreadId", + "FreeLibrary", + "GetModuleFileNameW", + "GetModuleHandleExW", + "GlobalUnlock", + "SetLastError", + "GetCurrentProcess", + "HeapAlloc", + "GetFullPathNameW", + "LoadLibraryW", + "GetProcAddress", + "GetComputerNameW", + "GetFileInformationByHandleEx" + ] + }, + { + "dll": "api-ms-win-core-synch-l1-2-0.dll", + "symbols": [ + "WakeByAddressSingle", + "WaitOnAddress", + "WakeByAddressAll" + ] + }, + { + "dll": "combase.dll", + "symbols": [ + "CoCreateFreeThreadedMarshaler", + "CoTaskMemFree", + "CoIncrementMTAUsage", + "CoTaskMemAlloc" + ] + }, + { + "dll": "api-ms-win-core-winrt-l1-1-0.dll", + "symbols": [ + "RoUninitialize", + "RoGetActivationFactory", + "RoInitialize" + ] + }, + { + "dll": "ole32.dll", + "symbols": [ + "CoGetApartmentType", + "ReleaseStgMedium", + "PropVariantClear" + ] + }, + { + "dll": "api-ms-win-appmodel-runtime-l1-1-3.dll", + "symbols": [ + "GetCurrentPackageInfo2" + ] + }, + { + "dll": "ntdll.dll", + "symbols": [ + "RtlNtStatusToDosError", + "NtWriteFile" + ] + }, + { + "dll": "api-ms-win-core-winrt-error-l1-1-0.dll", + "symbols": [ + "RoOriginateErrorW" + ] + }, + { + "dll": "python313.dll", + "symbols": [ + "PyByteArray_AsString", + "PyByteArray_Size", + "PyBytes_AsString", + "PyBytes_Size", + "PyInterpreterState_Get", + "PyInterpreterState_Main", + "PyModule_Type", + "PyModule_GetDict", + "PyBaseObject_Type", + "PyObject_ClearWeakRefs", + "PyException_GetTraceback", + "PyTraceBack_Print", + "PyUnicode_Type", + "PyType_GetQualName", + "PyObject_Str", + "Py_IsInitialized", + "Py_IsFinalizing", + "PyGILState_Ensure", + "PyErr_GetRaisedException", + "PyUnicode_AsEncodedString", + "PyExc_TypeError", + "PyErr_SetString", + "PyErr_SetObject", + "PyType_GetName", + "PyExc_SystemError", + "PyErr_PrintEx", + "PyUnicode_InternInPlace", + "PyObject_Repr", + "Py_CompileStringExFlags", + "PyImport_AddModuleRef", + "PyEval_GetBuiltins", + "PyDict_SetDefaultRef", + "PyEval_EvalCode", + "PyException_SetCause", + "PyException_SetTraceback", + "PyObject_SetAttrString", + "PyType_Modified", + "PyExc_ValueError", + "PyObject_GenericGetDict", + "PyObject_GenericSetDict", + "PyType_FromSpec", + "PyLong_FromSsize_t", + "PyObject_GetItem", + "PyObject_SetItem", + "PyObject_DelItem", + "PyList_Type", + "PyObject_SetAttr", + "PyOS_FSPath", + "PyUnicode_AsWideChar", + "PyLong_Type", + "PyNumber_Index", + "PyLong_AsUnsignedLongLong", + "PyModule_GetNameObject", + "PyCMethod_New", + "PyBool_Type", + "PyType_GetModuleName", + "PyUnicode_EqualToUTF8AndSize", + "PyObject_IsTrue", + "PyDict_New", + "PyDict_SetItem", + "PyObject_VectorcallDict", + "PyByteArray_Type", + "PyBytes_Type", + "PyBytes_FromStringAndSize", + "PyLong_AsLongLong", + "PyLong_FromNativeBytes", + "PyLong_AsLong", + "_Py_TrueStruct", + "_Py_FalseStruct", + "PyCallable_Check", + "PyDict_Type", + "_Py_NoneStruct", + "PyExc_OSError", + "PyExc_OverflowError", + "PyExc_BaseException", + "PyExc_RuntimeError", + "PyExc_IndexError", + "PyErr_GivenExceptionMatches", + "PyExc_AttributeError", + "PyObject_Call", + "PyObject_Vectorcall", + "PyFloat_AsDouble", + "PyFloat_Type", + "PyTuple_Type", + "PyTuple_New", + "PyErr_WriteUnraisable", + "PyType_Type", + "PyErr_NewExceptionWithDoc", + "PyExc_Exception", + "PyLong_FromLongLong", + "PyLong_FromUnsignedLongLong", + "PyLong_FromLong", + "PyFloat_FromDouble", + "PyObject_GetAttr", + "PyUnicode_FromWideChar", + "PyGILState_Release", + "PyObject_GC_UnTrack", + "PyErr_Occurred", + "PyType_IsSubtype", + "PyIter_Next", + "PyObject_GetIter", + "PyObject_Size", + "PySequence_Check", + "PyErr_SetRaisedException", + "PyEval_SaveThread", + "PyObject_CallOneArg", + "PyObject_VectorcallMethod", + "PyList_Append", + "PyList_New", + "PyDict_Next", + "PyUnicode_AsUTF8AndSize", + "PyEval_RestoreThread", + "_Py_Dealloc", + "PyImport_Import", + "PyUnicode_FromStringAndSize", + "PyModuleDef_Init", + "PyObject_CallNoArgs" + ] + }, + { + "dll": "bcryptprimitives.dll", + "symbols": [ + "ProcessPrng" + ] + }, + { + "dll": "KERNEL32.dll", + "symbols": [ + "GetSystemInfo", + "InitializeSListHead", + "GetCurrentDirectoryW", + "RtlCaptureContext", + "GetSystemTimeAsFileTime", + "RtlLookupFunctionEntry", + "lstrlenW", + "WideCharToMultiByte", + "RtlVirtualUnwind", + "GetStdHandle", + "GetConsoleMode", + "GetConsoleOutputCP", + "MultiByteToWideChar", + "WriteConsoleW", + "GetEnvironmentVariableW", + "QueryPerformanceFrequency", + "QueryPerformanceCounter", + "FlushInstructionCache" + ] + }, + { + "dll": "VCRUNTIME140.dll", + "symbols": [ + "__C_specific_handler", + "__CxxFrameHandler3", + "memcpy", + "memcmp", + "memset", + "memmove", + "_CxxThrowException", + "__std_type_info_destroy_list" + ] + }, + { + "dll": "api-ms-win-crt-heap-l1-1-0.dll", + "symbols": [ + "malloc", + "free" + ] + }, + { + "dll": "api-ms-win-crt-string-l1-1-0.dll", + "symbols": [ + "wcslen" + ] + }, + { + "dll": "api-ms-win-crt-math-l1-1-0.dll", + "symbols": [ + "pow" + ] + }, + { + "dll": "api-ms-win-crt-runtime-l1-1-0.dll", + "symbols": [ + "_initterm_e", + "_initterm", + "_configure_narrow_argv", + "_initialize_narrow_environment", + "_initialize_onexit_table", + "_execute_onexit_table", + "_cexit", + "abort", + "_seh_filter_dll" + ] + } + ], + "delay": [] + }, + { + "stage": "after", + "filename": "after-x64.node", + "sha256": "6fc3c954c6dc031a650ee3d93e1745b31a553401d3e69bc4a4c383e051b97406", + "machine": "x64", + "profile": "release", + "testHooks": false, + "ordinary": [ + { + "dll": "oleaut32.dll", + "symbols": [ + "SafeArrayGetElemsize", + "SafeArrayGetLBound", + "SafeArrayGetUBound", + "SafeArrayAccessData", + "SafeArrayGetVartype", + "SafeArrayUnaccessData", + "SafeArrayCopy", + "SysAllocStringLen", + "VariantCopy", + "SysStringLen", + "SafeArrayCreateEx", + "SafeArrayCreate", + "VariantClear", + "SysFreeString", + "SafeArrayGetIID", + "SafeArrayDestroy", + "VariantInit", + "SafeArrayGetDim", + "SetErrorInfo", + "CreateErrorInfo", + "GetErrorInfo" + ] + }, + { + "dll": "kernel32.dll", + "symbols": [ + "WriteFile", + "ReadFile", + "GetModuleHandleW", + "GetFullPathNameW", + "SetLastError", + "SwitchToThread", + "WaitForSingleObjectEx", + "LoadLibraryA", + "GetCurrentProcessId", + "CreateMutexA", + "ReleaseMutex", + "GetWindowsDirectoryW", + "HeapAlloc", + "LoadLibraryW", + "GetCurrentThread", + "GetComputerNameW", + "GetModuleHandleA", + "CreateFileW", + "GetFileInformationByHandle", + "GetFileInformationByHandleEx", + "FindFirstFileExW", + "FindClose", + "LoadLibraryExA", + "CreateIoCompletionPort", + "Sleep", + "VirtualAlloc", + "VirtualFree", + "VirtualQuery", + "WaitForSingleObject", + "GetOverlappedResult", + "LocalFree", + "GetCurrentProcess", + "CancelIoEx", + "CreateThread", + "CloseHandle", + "GetSystemInfo", + "FormatMessageW", + "GlobalSize", + "GlobalUnlock", + "GlobalLock", + "HeapReAlloc", + "GetQueuedCompletionStatus", + "SetThreadStackGuarantee", + "GetCurrentThreadId", + "HeapFree", + "GetProcessHeap", + "LoadLibraryExW", + "GetModuleHandleExW", + "GetProcAddress", + "GetLastError", + "FreeLibrary", + "GetSystemTimeAsFileTime", + "DisableThreadLibraryCalls", + "GlobalFree", + "GlobalAlloc" + ] + }, + { + "dll": "api-ms-win-core-synch-l1-2-0.dll", + "symbols": [ + "WakeByAddressSingle", + "WakeByAddressAll", + "WaitOnAddress" + ] + }, + { + "dll": "combase.dll", + "symbols": [ + "CoTaskMemFree", + "RoGetAgileReference", + "CoCreateFreeThreadedMarshaler", + "CoIncrementMTAUsage", + "CoTaskMemAlloc" + ] + }, + { + "dll": "ole32.dll", + "symbols": [ + "CoInitializeEx", + "CoCreateInstance", + "CoGetClassObject", + "CoUninitialize", + "CoGetApartmentType", + "CoGetMalloc", + "PropVariantClear", + "ReleaseStgMedium" + ] + }, + { + "dll": "api-ms-win-core-winrt-l1-1-0.dll", + "symbols": [ + "RoGetActivationFactory", + "RoUninitialize", + "RoInitialize" + ] + }, + { + "dll": "api-ms-win-appmodel-runtime-l1-1-3.dll", + "symbols": [ + "GetCurrentPackageInfo2" + ] + }, + { + "dll": "advapi32.dll", + "symbols": [ + "CloseServiceHandle", + "CredFree", + "RegCloseKey" + ] + }, + { + "dll": "ntdll.dll", + "symbols": [ + "RtlNtStatusToDosError", + "NtWriteFile", + "NtQueryInformationFile" + ] + }, + { + "dll": "api-ms-win-core-winrt-error-l1-1-0.dll", + "symbols": [ + "RoOriginateErrorW" + ] + }, + { + "dll": "bcryptprimitives.dll", + "symbols": [ + "ProcessPrng" + ] + }, + { + "dll": "KERNEL32.dll", + "symbols": [ + "InitializeSListHead", + "RtlCaptureContext", + "RtlLookupFunctionEntry", + "QueryPerformanceCounter", + "QueryPerformanceFrequency", + "GetEnvironmentVariableW", + "WriteConsoleW", + "MultiByteToWideChar", + "GetConsoleOutputCP", + "GetConsoleMode", + "GetStdHandle", + "WideCharToMultiByte", + "RtlVirtualUnwind", + "lstrlenW", + "GetCurrentDirectoryW" + ] + }, + { + "dll": "VCRUNTIME140.dll", + "symbols": [ + "memcpy", + "memmove", + "memset", + "memcmp", + "_CxxThrowException", + "__C_specific_handler", + "__std_type_info_destroy_list", + "__CxxFrameHandler3" + ] + }, + { + "dll": "api-ms-win-crt-heap-l1-1-0.dll", + "symbols": [ + "malloc", + "free" + ] + }, + { + "dll": "api-ms-win-crt-math-l1-1-0.dll", + "symbols": [ + "trunc" + ] + }, + { + "dll": "api-ms-win-crt-string-l1-1-0.dll", + "symbols": [ + "strlen", + "wcslen" + ] + }, + { + "dll": "api-ms-win-crt-runtime-l1-1-0.dll", + "symbols": [ + "_initialize_narrow_environment", + "_initialize_onexit_table", + "_configure_narrow_argv", + "_seh_filter_dll", + "_initterm_e", + "_initterm", + "abort", + "_execute_onexit_table", + "_cexit" + ] + } + ], + "delay": [] + } + ], + "observations": [ + { + "stage": "baseline", + "language": "node", + "scenario": "host", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "winrt-data", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:primitive", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:projection-import", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:apartment", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:uri", + "moduleCount": 39, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "clbcatq.dll", + "dynwinrt.win32-arm64-msvc.node", + "iertutil.dll", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:cleanup", + "moduleCount": 39, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "clbcatq.dll", + "dynwinrt.win32-arm64-msvc.node", + "iertutil.dll", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "registration", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com-unsafe", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "com:owned-gdi-signature-registered", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "window", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com-unsafe", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "ui:hidden-window", + "moduleCount": 38, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "msctf.dll", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:root", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:com", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:win32", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:root,com,win32", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:com,win32,root", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "node", + "scenario": "imports:win32,root,com", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "python", + "scenario": "host", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + } + ] + }, + { + "stage": "baseline", + "language": "python", + "scenario": "import", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + } + ] + }, + { + "stage": "baseline", + "language": "python", + "scenario": "winrt-data", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:primitive", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:projection-import", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:apartment", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:uri", + "moduleCount": 30, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "clbcatq.dll", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "iertutil.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:cleanup", + "moduleCount": 30, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "clbcatq.dll", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "iertutil.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "host", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "winrt-data", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:primitive", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:projection-import", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:apartment", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:uri", + "moduleCount": 39, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "clbcatq.dll", + "dynwinrt.win32-arm64-msvc.node", + "iertutil.dll", + "vcruntime140.dll" + ] + }, + { + "phase": "winrt:cleanup", + "moduleCount": 39, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "clbcatq.dll", + "dynwinrt.win32-arm64-msvc.node", + "iertutil.dll", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "registration", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com-unsafe", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "com:owned-gdi-signature-registered", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "window", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com-unsafe", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "ui:hidden-window", + "moduleCount": 38, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "msctf.dll", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:root", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:com", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:win32", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:root,com,win32", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:com,win32,root", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "node", + "scenario": "imports:win32,root,com", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 35, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:win32", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:root", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + }, + { + "phase": "import:com", + "moduleCount": 37, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "dynwinrt.win32-arm64-msvc.node", + "vcruntime140.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "python", + "scenario": "host", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + } + ] + }, + { + "stage": "after", + "language": "python", + "scenario": "import", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + } + ] + }, + { + "stage": "after", + "language": "python", + "scenario": "winrt-data", + "exit": 0, + "timedOut": false, + "phases": [ + { + "phase": "host", + "moduleCount": 15, + "scopedModules": [ + "ntdll.dll", + "ws2_32.dll" + ], + "addedSinceHost": [] + }, + { + "phase": "import:root", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:primitive", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:projection-import", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:apartment", + "moduleCount": 28, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:uri", + "moduleCount": 30, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "clbcatq.dll", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "iertutil.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + }, + { + "phase": "winrt:cleanup", + "moduleCount": 30, + "scopedModules": [ + "combase.dll", + "gdi32.dll", + "gdi32full.dll", + "imm32.dll", + "ntdll.dll", + "ole32.dll", + "oleaut32.dll", + "user32.dll", + "win32u.dll", + "ws2_32.dll" + ], + "addedSinceHost": [ + "_uuid.pyd", + "clbcatq.dll", + "combase.dll", + "dynwinrt.cp313-win_arm64.pyd", + "gdi32.dll", + "gdi32full.dll", + "iertutil.dll", + "imm32.dll", + "kernel.appcore.dll", + "msvcp_win.dll", + "ole32.dll", + "oleaut32.dll", + "python3.dll", + "user32.dll", + "win32u.dll" + ] + } + ] + } + ], + "regressions": [ + { + "name": "ARM64 scoped native behavior", + "command": "cargo test --locked --offline -p dynwinrt --lib -- system_helpers com::gdi_cleanup_tests dispatcher_queue::core_messaging xaml_application::tests::enables_per_monitor_v2", + "result": "20 passed; 0 failed;", + "log": "scoped-core-tests.log", + "logSha256": "394b279a0883e759034d185779cd88d90be4ced969c08363ec2aaa3014aeb731" + }, + { + "name": "x64 scoped native behavior (Windows ARM emulation)", + "command": "cargo test --locked --offline -p dynwinrt --target x86_64-pc-windows-msvc --lib -- system_helpers com::gdi_cleanup_tests dispatcher_queue::core_messaging xaml_application::tests::enables_per_monitor_v2", + "result": "20 passed; 0 failed;", + "log": "scoped-core-x64-emulation-tests.log", + "logSha256": "352623cdaddd9622f792817595f595dc49f598b8dd359484e1a9175b4eab91f1" + }, + { + "name": "i686 scoped native behavior (Windows ARM emulation)", + "command": "cargo test --locked --offline -p dynwinrt --target i686-pc-windows-msvc --lib -- system_helpers com::gdi_cleanup_tests dispatcher_queue::core_messaging xaml_application::tests::enables_per_monitor_v2", + "result": "20 passed; 0 failed;", + "log": "scoped-core-i686-emulation-tests.log", + "logSha256": "91ce18d28d15700fc80376d1e1f4875eaecb90c0b81df392d462b5309300f2fa" + }, + { + "name": "JS native ownership boundaries", + "command": "cargo test --locked --offline -p jswinrt_rs --lib -- delete_object bitmap raw_cleanup raw_ui_cleanup", + "result": "9 passed; 0 failed;", + "log": "scoped-js-native-tests.log", + "logSha256": "0898b53f8709f2e675b462277e60cfaf9ed532a8471eeea930fa17a50d4e15c0" + }, + { + "name": "WinRT generated snapshots", + "command": "cargo test --locked --offline -p dynwinrt-codegen --test snapshot_test", + "result": "6 passed; 0 failed;", + "log": "winrt-snapshot-tests.log", + "logSha256": "19c9f5cfa92c4a74df1ae436586df916b9e5b773263316e798477bcdee10caf8" + }, + { + "name": "PE reader and import policies", + "command": "npx --no-install ava __test__\\pe-imports.spec.ts", + "result": "129 tests passed", + "log": "pe-policy-tests.log", + "logSha256": "08948b04bcba0297fbf327e699bc3923573b9e7eec1bbaf9788bd9c4ba363061" + }, + { + "name": "Production import gates", + "command": "npx --no-install ava __test__\\native-imports.spec.ts __test__\\win32-imports.spec.ts", + "result": "8 tests passed", + "log": "production-import-gates.log", + "logSha256": "124fed00a8ff8a6e631950d3da1152e29c59bd856632c1ced84fcdaa0d13dd23" + }, + { + "name": "CI environment and artifact wiring", + "command": "python -m unittest test_ci.WorkflowTests test_ci.NativeImportGateTests -v", + "result": "Ran 6 tests", + "log": "ci-import-gate-tests.log", + "logSha256": "0de7937a45e901fe3e1611570f0c1e3a300d324990f55961556ef834c17fcf53" + }, + { + "name": "Generated stock WIC Classic COM call", + "command": "node .\\tests\\e2e\\runners\\com\\wic-imaging-factory.mjs", + "result": "wic-imaging-factory ok", + "log": "safe-com-e2e.log", + "logSha256": "cd108a59efd76f170fa5f5591a21dc2c1ca9e7a880df13ed44d7738044cbda4f" + }, + { + "name": "Production package and flat Win32 call", + "command": "node .\\bindings\\js\\scripts\\verify-runtime-artifact.mjs .\\bindings\\js\\dist", + "result": "Verified 6 downloaded runtime entrypoints", + "log": "production-package-win32-e2e.log", + "logSha256": "c4ac0c8d42c7fcb3a5727cac0800a201de655980e2de3d92a65b85a23821bcd1" + } + ] +} diff --git a/eng/ci/test_ci.py b/eng/ci/test_ci.py index eba5666f..e0eeada5 100644 --- a/eng/ci/test_ci.py +++ b/eng/ci/test_ci.py @@ -324,6 +324,45 @@ def test_gate_truth_tables_execute_the_real_gate(self): self.assertEqual(result.returncode, 0, result.stdout + result.stderr) +class NativeImportGateTests(unittest.TestCase): + def test_prebuilt_python_gate_uses_node_and_installed_no_hooks_extension(self): + steps = JOBS["e2e-runtime"]["steps"] + node = next(index for index, step in enumerate(steps) + if step.get("uses") == "actions/setup-node@v4") + gate = next(index for index, step in enumerate(steps) + if step.get("name") == "Check prebuilt Python native imports") + install = next(index for index, step in enumerate(steps) + if step.get("name") == "Install prebuilt Python binding") + self.assertLess(node, gate) + self.assertLess(install, gate) + self.assertEqual(steps[node]["with"]["node-version"], 24) + self.assertIn(r"site-packages\dynwinrt", steps[gate]["run"]) + self.assertIn("-Filter *.pyd", steps[gate]["run"]) + self.assertIn(r"bindings\js\scripts\check-ui-helper-imports.mjs", steps[gate]["run"]) + self.assertNotIn("test-hooks", steps[gate]["run"]) + + def test_shipping_runtime_wheels_use_the_same_gate_without_rebuilding(self): + workflow = yaml.safe_load( + (ROOT / ".github" / "workflows" / "python-release.yml").read_text(encoding="utf-8") + ) + for architecture in ("x64", "arm64"): + steps = workflow["jobs"][f"consume-runtime-{architecture}"]["steps"] + node = next(index for index, step in enumerate(steps) + if step.get("uses") == "actions/setup-node@v4") + consumer = next(index for index, step in enumerate(steps) + if "test_python_runtime_wheel.ps1" in step.get("run", "")) + self.assertLess(node, consumer) + self.assertEqual(steps[node]["with"]["node-version"], 24) + script = (ROOT / "eng" / "release" / "python" / "test_python_runtime_wheel.ps1").read_text( + encoding="utf-8" + ) + self.assertIn(r"venv\Lib\site-packages\dynwinrt", script) + self.assertIn(r"bindings\js\scripts\check-ui-helper-imports.mjs", script) + self.assertLess(script.index("check-ui-helper-imports.mjs"), script.index("$env:PATH =")) + self.assertNotIn("maturin", script) + self.assertNotIn("cargo", script) + + class ArtifactTests(unittest.TestCase): def setUp(self): self.temporary = tempfile.TemporaryDirectory(prefix="dynwinrt-ci-artifact-") diff --git a/eng/release/python/test_python_runtime_wheel.ps1 b/eng/release/python/test_python_runtime_wheel.ps1 index 95a596c9..cce05d8c 100644 --- a/eng/release/python/test_python_runtime_wheel.ps1 +++ b/eng/release/python/test_python_runtime_wheel.ps1 @@ -27,6 +27,12 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } --find-links $CodegenWheelDirectory "dynwinrt-codegen==$Version" if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } +$native = @(Get-ChildItem (Join-Path $root 'venv\Lib\site-packages\dynwinrt') -Filter *.pyd -File) +if ($native.Count -ne 1) { throw 'Expected exactly one installed production Python extension' } +& (Get-Command node -ErrorAction Stop).Source ` + (Join-Path $repoRoot 'bindings\js\scripts\check-ui-helper-imports.mjs') $native[0].FullName +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $scripts = Join-Path $root 'venv\Scripts' $env:PATH = "$scripts;$env:SystemRoot\System32;$env:SystemRoot" $env:PYTHONPATH = ''