Skip to content

Commit 82348b9

Browse files
committed
* fix Windows build -> Loader Snaps
1 parent 3bbb2be commit 82348b9

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

.github/scripts/windows/test_task.bat

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ if exist %PHP_BUILD_DIR%\vcruntime140.dll (
5656
echo.
5757
echo Testing PHP executable...
5858
cd /d %PHP_BUILD_DIR%
59+
60+
echo Enabling Loader Snaps for detailed DLL loading diagnostics...
61+
set LDR_CNTRL_DEBUG_DLL_LOADS=1
62+
set LOADER_DEBUG=1
63+
64+
echo Running PHP with Loader Snaps enabled...
5965
php.exe --version
6066
set PHP_EXIT_CODE=%errorlevel%
6167

@@ -88,8 +94,18 @@ if %PHP_EXIT_CODE% neq 0 (
8894
powershell -Command "Get-WinEvent -FilterHashtable @{LogName='Application'; Level=2; StartTime=(Get-Date).AddMinutes(-1)} -MaxEvents 2 -ErrorAction SilentlyContinue | ForEach-Object { Write-Host ('Time: ' + $_.TimeCreated + ' - ID: ' + $_.Id + ' - Message: ' + $_.Message.Substring(0, [Math]::Min(200, $_.Message.Length))) }"
8995

9096
echo.
91-
echo Trying with SysInternals style dependency check:
92-
powershell -Command "try { [System.Reflection.Assembly]::LoadFile('%CD%\php.exe') } catch { Write-Host 'LoadFile error: ' $_.Exception.Message }"
97+
echo === Detailed DLL Analysis ===
98+
99+
echo Using PowerShell to find exact missing DLLs:
100+
powershell -Command "$proc = Start-Process -FilePath '%CD%\php.exe' -ArgumentList '--version' -Wait -PassThru -WindowStyle Hidden -ErrorAction SilentlyContinue; if ($proc.ExitCode -ne 0) { Write-Host 'Process failed with exit code:' $proc.ExitCode }"
101+
102+
echo.
103+
echo Checking with SFC style scan:
104+
powershell -Command "try { Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; public class Kernel32 { [DllImport(\"kernel32.dll\")] public static extern IntPtr LoadLibrary(string lpFileName); [DllImport(\"kernel32.dll\")] public static extern uint GetLastError(); }'; $handle = [Kernel32]::LoadLibrary('%CD%\php.exe'); if ($handle -eq [IntPtr]::Zero) { $error = [Kernel32]::GetLastError(); Write-Host 'LoadLibrary failed with error code:' $error; switch($error) { 126 { Write-Host 'ERROR 126: The specified module could not be found (missing DLL)' }; 127 { Write-Host 'ERROR 127: The specified procedure could not be found' }; 193 { Write-Host 'ERROR 193: Not a valid Win32 application' }; default { Write-Host 'Unknown error code' } } } else { Write-Host 'LoadLibrary succeeded' } } catch { Write-Host 'Exception:' $_.Exception.Message }"
105+
106+
echo.
107+
echo Trying dependency walker style check:
108+
powershell -Command "Get-ChildItem '%CD%' -Filter '*.dll' | ForEach-Object { try { [System.Reflection.Assembly]::LoadFile($_.FullName) | Out-Null; Write-Host 'OK:' $_.Name } catch { Write-Host 'FAIL:' $_.Name '-' $_.Exception.Message } }"
93109

94110
exit /b 1
95111
)

0 commit comments

Comments
 (0)