Windows 可执行文件的系统版本限制
问题描述
编译的可执行文件,一般存在最小系统版本限制,比如 Windows 7,Windows 10 等。但客户的系统版本可能低于这个限制,导致无法运行。
验证方法
确认可执行文件的最小支持
Windows
版本。Linux
下借助file
命令查看文件版本:file node.dll
node.dll: PE32 executable for MS Windows 6.00 (DLL), Intel i386, 5 sections
file demo.exe
demo.exe: PE32 executable for MS Windows 5.02 (GUI), Intel i386, 8 sections使用
ver
等命令查看当前系统版本。Windows
下,控制台输入ver
,即可查看。ver
Microsoft Windows [Version 5.00.2195] # Win2000
Microsoft Windows [Version 6.0.6000] # Win Vista也可以用其他命令,如:
systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName
由上述输出可知,demo.exe
最低支持 Windows 2000
,但因为其依赖的 node.dll
最低支持 Windows Vista
,所以 demo.exe
无法在 Windows 2000
上运行。
解决方案
建议客户升级系统版本,或者重新编译 node.dll
,使其支持更低版本的 Windows
。
这里,我们建议客户升级系统版本,因为重新编译 node.dll
过于复杂,且还需要重新编译许多其他依赖的 dll
,工程量浩大。