Files
video-v1/vav1/test-dll-loading.ps1
2025-09-17 04:16:34 +09:00

85 lines
3.0 KiB
PowerShell

# PowerShell script to test dav1d.dll loading
Write-Host "=== DAV1D DLL Loading Test ===" -ForegroundColor Yellow
Write-Host
$dllPath = ".\Vav1Player\bin\x64\Debug\net9.0-windows\dav1d.dll"
$appPath = ".\Vav1Player\bin\x64\Debug\net9.0-windows\Vav1Player.exe"
Write-Host "Checking files..." -ForegroundColor Cyan
Write-Host "DLL exists: $(Test-Path $dllPath)"
Write-Host "App exists: $(Test-Path $appPath)"
if (Test-Path $dllPath) {
$dllInfo = Get-Item $dllPath
Write-Host "DLL Size: $($dllInfo.Length) bytes"
Write-Host "DLL Modified: $($dllInfo.LastWriteTime)"
}
Write-Host
Write-Host "Testing DLL load with PowerShell..." -ForegroundColor Cyan
try {
# Test 1: Check file properties
$fileInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo((Resolve-Path $dllPath).Path)
Write-Host "✓ File info accessible" -ForegroundColor Green
# Test 2: Try to load DLL
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class DllLoader {
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string dllToLoad);
[DllImport("kernel32.dll")]
public static extern bool FreeLibrary(IntPtr hModule);
[DllImport("kernel32.dll")]
public static extern uint GetLastError();
}
"@
$handle = [DllLoader]::LoadLibrary((Resolve-Path $dllPath).Path)
if ($handle -ne [IntPtr]::Zero) {
Write-Host "✓ DLL loaded successfully" -ForegroundColor Green
[DllLoader]::FreeLibrary($handle) | Out-Null
} else {
$error = [DllLoader]::GetLastError()
Write-Host "✗ DLL load failed. Error: $error" -ForegroundColor Red
switch ($error) {
126 { Write-Host " → Missing dependencies" -ForegroundColor Yellow }
193 { Write-Host " → Architecture mismatch or invalid PE" -ForegroundColor Yellow }
default { Write-Host " → Unknown error" -ForegroundColor Yellow }
}
}
} catch {
Write-Host "✗ Error during test: $($_.Exception.Message)" -ForegroundColor Red
}
Write-Host
Write-Host "Dependencies check..." -ForegroundColor Cyan
$vcredist = Get-ItemProperty "HKLM:SOFTWARE\Classes\Installer\Dependencies\*VC*redist*" -ErrorAction SilentlyContinue | Select-Object DisplayName
if ($vcredist) {
Write-Host "✓ Visual C++ Redistributables found:" -ForegroundColor Green
$vcredist | ForEach-Object { Write-Host " - $($_.DisplayName)" }
} else {
Write-Host "✗ No Visual C++ Redistributables detected" -ForegroundColor Red
}
Write-Host
Write-Host "Running application for 3 seconds to capture debug output..." -ForegroundColor Cyan
$process = Start-Process -FilePath $appPath -PassThru -WindowStyle Minimized -ErrorAction SilentlyContinue
if ($process) {
Start-Sleep -Seconds 3
if (!$process.HasExited) {
$process.Kill()
}
Write-Host "✓ Application started (check Debug output in Visual Studio)" -ForegroundColor Green
} else {
Write-Host "✗ Failed to start application" -ForegroundColor Red
}
Write-Host
Write-Host "Test completed!" -ForegroundColor Yellow