将可执行文件重命名为 game.exe 导致运行时出现 15 秒延迟 - 奇怪的问题
这动摇了我对计算机和操作系统的理解,让我感到非常不安。我刚刚花了大约一个小时向 g++
输入编译命令的不同迭代,在我的愤怒中,我将一直存在延迟的可执行文件从 game.exe
重命名为 gameg.exe
突然间问题就消失了。
这里有更多背景信息:我最近注意到,当我运行 Eclipse 单元测试构建时,当我开始启用 SDL 的测试时,它会打开 SDL 窗口并冻结大约 20 秒,然后才能开始测试。在后续测试(调用 SDL_Quit()
并重新初始化 SDL 作为测试过程的一部分)中,不会出现这种延迟。现在我已经确定,只有当可执行文件被准确命名为“game.exe”时,才会发生这种情况!我将其重命名为任何其他文件名,它会愉快地运行测试,像平常一样在一秒钟内初始化 SDL 系统。我之前假设一定有某种错误导致我的 Eclipse 构建具有 makefile 构建中不存在的这种行为,但事实证明,如果我采用 Eclipse 构建并重命名其可执行文件(项目文件夹)它的名称是 game
因此 game.exe
)它不会表现出这种行为。
同样,我将 makefile 构建(其文件名为 entropy_unittest_disp.exe
仅供参考)并将其重命名为 game.exe
,然后它就开始执行此操作。我将其重命名为 game
并且它也这样做了(我从 mingw 的 bash 运行..当不使用 .exe
扩展名时,资源管理器不知道它是可执行文件)。不过我将其更改为 game.ex
并且它正常工作。
这是什么黑魔法?为什么程序的功能会根据其文件名而有所不同???我确实查询 argv[0] 并且实际上是为了打印以控制台其值(出于调试目的),但不出所料,它只是打印程序及其路径。在我的程序中没有对其执行任何逻辑。
我尝试运行 GDB 来找出它冻结的位置,但是一旦我按 Ctrl+C,GDB 就会退出。
有人知道这可能是由什么引起的吗?病毒?
编辑:我从这个网站下载了这个演示: http://www.sdltutorials.com/ sdl-opengl-tutorial-basics/
提取它,将文件重命名为 game.exe,是的,同样的事情发生了。这是什么?接下来我将尝试运行 dependency walker 来查看是否有东西试图连接到它。
This shakes my understanding of computers and operating systems on a level that makes me very uneasy. I have just spent about an hour entering different iterations of compile commands to g++
and in my exasperation I renamed the executable which kept having the delay from game.exe
to gameg.exe
and all of a sudden the problem vanished.
Here's some more background: I was noticing recently that when I ran my Eclipse unit test build, when I start with an SDL enabled test it would open the SDL window and freeze for about 20 seconds before being able to get the test started. On subsequent tests (which call SDL_Quit()
and re-initialize SDL as part of the test process) this delay is not present. Now I have ascertained that ONLY when the executable is named exactly "game.exe" does this happen! I rename it to any other filename and it goes along running tests happily, initializing the SDL system within a second like it usually does. I had assumed before that there must be some kind of bug that was causing my Eclipse build to have this behavior which wasn't present in the makefile build, but it turns out if I take the eclipse build and rename its executable (the project folder it's in is called game
hence game.exe
) it doesn't exhibit the behavior.
Likewise I take my makefile build (whose filename is entropy_unittest_disp.exe
fyi) and rename it to game.exe
and it begins to do this. I rename it to game
and it also does it (I am running from mingw's bash.. when not with .exe
extension, explorer doesn't know it's an executable). However I changed it to game.exx
and it worked normally.
WHAT IS THIS BLACK MAGIC? Why should a program function differently depending on its filename??? I do query argv[0] and i actually do it to print to console its value (for debug purposes) but unsurprisingly it just prints the program and its path. No logic is ever performed on it in my program.
I tried to run GDB to find out where it is freezing but once I press Ctrl+C GDB simply exits.
does anybody have any idea what this might be caused by? A virus?
edit: I downloaded this demo from this site: http://www.sdltutorials.com/sdl-opengl-tutorial-basics/
extracted it, renamed the file to game.exe, and yup, same thing happens. WHAT IS THIS? I'm going to try running dependency walker next to see if something's trying to hook into it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我假设您有 AMD (ATI) 或 Nvidia 显卡及其官方驱动程序。
有可能,game.exe 是实际发布的游戏的可执行文件名称,并且您的驱动程序正在为“游戏”运行特殊优化或加载该游戏的 Crossfire 或 SLI 配置文件。谷歌快速搜索似乎告诉我,《生化危机 4》将其可执行文件称为“game.exe”。
我建议查看此链接以了解有关可能发生的情况的更多详细信息:
http://www.kn00tcn .net/site/ati-catalyst-profiles/
I'm assuming you have either a AMD (ATI) or Nvidia graphics card with their official drivers.
Chances are, game.exe is the executable name for an actual game released and your drivers are running special optimizations for the "game" or loading the Crossfire or SLI profiles for this game. A quick Google search seems to tell me that Resident Evil 4 calls their executable "game.exe."
I recommend taking a look at this link for further details as to what may be happening:
http://www.kn00tcn.net/site/ati-catalyst-profiles/
不知道如何回复史蒂文对最佳答案的评论,但关于驱动程序配置文件,这只是对 .exe 文件名的基本强力检查,
某些游戏保证位于特定的子文件夹中,因此驱动程序会在其中查找 exe 所在位置,例如“\team fortress 2\hl2.exe”,
但由于大多数游戏都让您选择要安装到的文件夹名称,&很多时候,exe 位于同一个根文件夹中,驱动程序别无选择,只能盲目地假设 gameX.exe 将是 gameX,
这是一个很好的“副作用”,您可以在任何游戏上强制使用其他游戏配置文件故障排除目的,或尝试启用 CF/SLI 缩放,
因此请始终尝试确保您的可执行文件具有原始名称,以了解 gfx 驱动程序不会尝试运行专门为其他游戏制作的“优化”
not sure how to reply to steven's comment on the top answer, but regarding driver profiles, it's just a basic brute force check of .exe filenames
some games are guaranteed to be in a specific sub folder, so the driver looks for where the exe is located, such as '\team fortress 2\hl2.exe'
but since most games let you pick what folder name you're installing to, & a lot of the time the exe is in that same root folder, the drivers have no choice but to blindly assume gameX.exe is going to be gameX
a nice 'side effect' of this is you can force other game profiles on any game for troubleshooting purposes, or to try to enable CF/SLI scaling
so always try to make sure that your executable has an original name to know that the gfx driver isnt attempting to run 'optimizations' made exclusively for other games
这可能是由于您的操作系统上运行的防病毒软件造成的吗?病毒中常用的某些文件“Game.exe”可能是其中之一,因此 OS / AV 需要额外注意以确保其安全
Could this be due to Anti virus software running on your OS? Certain files are commonly used in Virus "Game.exe" could be one of them and hence additional care from OS / AV to ensure that it is safe
在干净的窗口中进行测试,无需安装任何额外的软件,如果工作正常,那么也许您有一些保护软件,例如防病毒或沙箱,...,如果您有任何此类软件,请禁用它们,然后再次测试
Test it in clean windows, without any extra software installation, if it work fine, then maybe you have some protection software like Anti-virus or sandbox , ... , if you have any of this software disable them, and test again
检查“Image File Execution Options”注册表项
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
中是否列出了 game.exe。它可用于启动特定程序作为具有特定名称的应用程序的调试器。 (有关图像文件执行选项的详细信息)Check to see if game.exe is listed in the Image File Execution Options registry key
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
. It can be used to launch a particular program as a debugger for an application with a particular name. (More info on Image File Execution Options)由于 AppCompat Shimming,EXE 的行为会根据其名称而有所不同。检查加载的模块列表,看看是否有一堆以“ac”开头的DLL加载到您的应用程序中。
An EXE will behave differently based on its name due to AppCompat Shimming. Check the loaded module list and see if there are a bunch of DLLs that start with "ac" loaded into your app.