简体   繁体   English

为什么我的WINVER 4 .exe无法在W98SE下运行?

[英]Why won't my WINVER 4 .exe run under W98SE?

I need to build my application for a legacy system running Windows 98SE. 我需要为运行Windows 98SE的旧系统构建应用程序。 (The system involves special hardware and an OS upgrade is not a possibility.) My development environment is Visual C++; (系统涉及特殊的硬件,不可能进行OS升级。)我的开发环境是Visual C ++。 the application is vanilla ANSI C, and the result is a WIN32 console application. 该应用程序是普通ANSI C,结果是WIN32控制台应用程序。

I am aware that in Visual Studio 2008 support for older version of Windows was dropped completely, so I am using instead Visual Studio 2005 (which I still have on my last-generation Windows XP laptop). 我知道在Visual Studio 2008中,对Windows的较早版本的支持已完全删除,因此我改用Visual Studio 2005(我的上一代Windows XP笔记本电脑上仍然有)。 I have conditional compilation to avoid calling API functions not available under W98SE, and I know about not using Unicode. 我有条件编译以避免调用W98SE下不可用的API函数,并且我知道不使用Unicode。

nb This all used to work . nb 这一切过去都是可行的 I have successfully built W98SE executables in the past. 我过去已经成功构建了W98SE可执行文件。 Somehow. 不知何故。

The application I have built fails with the "Expects a newer version of Windows. Upgrade your Windows version". 我构建的应用程序因“期望Windows的较新版本。升级Windows版本”而失败。

I have examined the .exe file with a hex editor, and the WINVER value (which in this case is at offset 288 decimal) is 4, as it should be. 我已经用十六进制编辑器检查了.exe文件,并且WINVER值(在本例中为288十进制偏移)为4。 On the normal build, ie for modern Windows versions, the WINVER value (which in this case is at offset 296 decimal) is 5. So how is it possible for the WINVER=4 version to cause the "Expects a newer version" error to be reported? 在正常版本上,即对于现代Windows版本,WINVER值(在这种情况下为偏移十进制296)为5。因此,WINVER = 4版本如何导致“期望新版本”错误发生?被举报?

Most likely you have linked it with more recent runtime library MSVCRT.DLL. 您很可能已将其链接到最新的运行时库MSVCRT.DLL。 Try following: 请尝试以下操作:

dumpbin /dependents myfile.exe

If it shows MSVCRTnn.DLL, you are in trouble. 如果显示MSVCRTnn.DLL,则您有麻烦。 If it shows MSVCRT.DLL (no numbers), you should be good, but still cautious. 如果显示MSVCRT.DLL(无数字),则应该不错,但仍要谨慎。

Probably easiest solution is to link runtime library statically: in project properties, under C/C++, Code generation, set Runtime Library to /MT or /MTd. 可能最简单的解决方案是静态链接运行时库:在项目属性中的C / C ++下,在代码生成下,将运行时库设置为/ MT或/ MTd。 If you use /MD or /MDd or default, it will link to runtime dynamically and may cause trouble. 如果使用/ MD或/ MDd或默认值,它将动态链接到运行时,可能会引起麻烦。

After changing this, "dumpbin /dependents myfile.exe" should no longer list dependency on MSVCRT.DLL and it should just work. 更改此设置后,“ dumpbin / depends myfile.exe”应该不再列出对MSVCRT.DLL的依赖关系,它应该可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 编译的exe文件无法通过我的自定义方案cmd运行吗? - Compiled exe won't run through my custom schemed cmd? 为什么我的 Python 脚本不能使用 Docker 运行? - Why won't my Python script run using Docker? 为什么我的程序不能从Program Files目录运行,而不能从其他任何地方运行? - Why won't my program run from the Program Files directory but will from anywhere else? 自从更改Windows“环境变量”以来,为什么批处理文件不运行? - Why won't my batch files run since I changed a Windows “Environment Variable”? 在Windows PC上运行时,为什么命令提示符无法识别ssh-keygen? - Why won't the command prompt identify ssh-keygen when I run it on my windows pc? 为什么 Winver 显示的版本不是 Powershell? - Why is Winver showing another Version than Powershell? 为什么我的jarsigner无法工作? - Why won't my jarsigner work? 为什么我的 EnumWindowProc 不能用 C 编译? - Why won't my EnumWindowProc compile in C? 为什么我的exe文件无法在其他PC上运行? [调试] - Why did my exe file not run in other pc? [Debug] 为什么我不能从命令提示符运行这个 exe 文件? - why can't I run this exe file from the command prompt?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM