Windows 7、64 位、DLL 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17023419/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 10:35:33  来源:igfitidea点击:

Windows 7, 64 bit, DLL problems

windowsdll

提问by tlvs

I have a problem with our executable. I'm running this C++ 32-bit executable on my Windows 7 64-bit development box that also has all those Microsoft applications (Visual Studio 2008 + 2010, TFS, SDK, Microsoft Office)... And it's still running just fine.

我的可执行文件有问题。我正在我的 Windows 7 64 位开发盒上运行这个 C++ 32 位可执行文件,它也有所有这些 Microsoft 应用程序(Visual Studio 2008 + 2010、TFS、SDK、Microsoft Office)......它仍然运行得很好。

Now I got the client installation of the very same program and was asked to test it with a clean Windows 7 installation. Thus I got one Windows 7 64-bit VMware and updated it to Windows 7 SP 1 (the very same version my developer box is tuning). But while on my developer box everything is fine the program does not work with the VMware (30 days trial) box.

现在我获得了相同程序的客户端安装,并被要求使用干净的 Windows 7 安装对其进行测试。因此,我获得了一个 Windows 7 64 位 VMware 并将其更新为 Windows 7 SP 1(与我的开发人员框正在调整的版本完全相同)。但是,虽然在我的开发人员框中一切正常,但该程序不适用于 VMware(30 天试用版)框。

The x86 Dependency Walkeris telling me that the following DLL files are missing:

x86 Dependency Walker告诉我缺少以下 DLL 文件:

  • API-MS-WIN-CORE-COM-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
  • API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
  • DCOMP.DLL
  • GPSVC.DLL
  • IESHIMS.DLL
  • API-MS-WIN-CORE-COM-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-ROBUFFER-L1-1-0.DLL
  • API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL
  • API-MS-WIN-SHCORE-SCALING-L1-1-0.DLL
  • 动态链接库
  • GPSVC.DLL
  • 驱动程序DLL

I googled for those API-MS-WIN-... DLL files and found they should actually already be part of Windows 7 (some sites claiming the belong to Windows 8 and Windows Server 2012 though).

我在谷歌上搜索了那些 API-MS-WIN-... DLL 文件,发现它们实际上应该已经是 Windows 7 的一部分(尽管有些网站声称它们属于 Windows 8 和 Windows Server 2012)。

I already tried the suggested fixes I found, which are:

我已经尝试了我发现的建议修复,它们是:

  • running 'sfc /scannow'
  • installing Visual Studio 2008 SP1 runtime executables
  • 运行“证监会/scannow”
  • 安装 Visual Studio 2008 SP1 运行时可执行文件

But that didn't solve anything. :-(

但这并没有解决任何问题。:-(

Side note: My development box does not have them either, and does not seem to need them. For example, the user32.dll on my box does not link against one of those, while the installation on the VMware does.

旁注:我的开发箱也没有它们,而且似乎不需要它们。例如,我的机器上的 user32.dll 没有链接到其中之一,而 VMware 上的安装却有。

Any idea on how to fix this issue? I tried to find a suitable download / fix on the Microsoft pages, but I failed.

关于如何解决这个问题的任何想法?我试图在 Microsoft 页面上找到合适的下载/修复程序,但失败了。



After solving my issue I wanted to report what I found out, and I can't post this as an answer because the question has been closed.

解决我的问题后,我想报告我发现的内容,但我无法将其发布为答案,因为问题已关闭。

Actually all the DLL files reported missing by the Dependency Walker tool, namely those

实际上,Dependency Walker 工具报告丢失的所有 DLL 文件,即那些

* API-MS-WIN-CORE-...

type DLL files were not part of the actual problem.

类型 DLL 文件不是实际问题的一部分。

In my case the registration of three OCX files was missing and after that everything was just fine, BUT Dependency Walker tool still listed all the very same DLL files as before even when the program was just running fine now.

在我的情况下,三个 OCX 文件的注册丢失了,之后一切都很好,但是 Dependency Walker 工具仍然列出了所有与以前完全相同的 DLL 文件,即使程序现在运行良好。

The gist of it: As someone elsewhere stated, the tool is a bit dated by now and does not always work properly with a newer OS. Thus keep an eye open and don't get mislead by missing 'API-MS-WIN-CORE-COM-L1-1-0.DLL', ... the problem probably lies entirely elsewhere.

它的要点:正如其他人所说的那样,该工具现在有点过时,并且在较新的操作系统上并不总是正常工作。因此,请保持警惕,不要因为缺少“API-MS-WIN-CORE-COM-L1-1-0.DLL”而被误导,...问题可能完全出在其他地方。

回答by meawoppl

This problem is related to missing the Visual Studio "redistributable package." It is not obvious which one is missing based on the dependency walk, but I would try the one that corresponds with your compiler version first and see if things run properly:

此问题与缺少 Visual Studio“可再发行组件包”有关。根据依赖遍历,不清楚缺少哪一个,但我会先尝试与您的编译器版本相对应的那个,看看是否运行正常:

Visual Studio 2015

视觉工作室 2015

Visual Studio 2013

视觉工作室 2013

Visual Studio 2010

视觉工作室 2010

Visual Studio 2008

视觉工作室 2008

I ran into this problem because I am using the Visual Studio compilers, but not the full Visual Studio environment.

我遇到了这个问题,因为我使用的是 Visual Studio 编译器,而不是完整的 Visual Studio 环境。



Going to dare to inject a new link here: The latest supported Visual C++ downloads. Stein ?smul, 29.11.2018.

敢在这里注入一个新链接:最新支持的 Visual C++ 下载斯坦 ? smul, 29.11.2018.

回答by Inejose

I just resolved the same problem with C++ Qt 5 and Windows 7 64 bits with MSCVC 2012.

我刚刚使用 MSCVC 2012 解决了 C++ Qt 5 和 Windows 7 64 位的相同问题。

In the beginning I thought it was a MSVC/Windows DLL file problem, but as BorisP said, the problem was in my project dependencies. The key is "How to know your project dependencies in Qt 5?".

一开始我以为是MSVC/Windows DLL文件问题,但正如BorisP所说,问题出在我的项目依赖项上。关键是“如何知道你在 Qt 5 中的项目依赖关系?”。

As I didn't find any clear way to know it (Dependency Walkerdidn't help me a lot...), I followed next the "inverse procedure" that takes no more than 5 minutes and avoid a lot of headaches with DLL file dependencies:

由于我没有找到任何明确的方法来了解它(Dependency Walker对我没有多大帮助......),我接下来遵循了“逆过程”,该过程不超过 5 分钟,避免了很多令人头疼的 DLL文件依赖:

  1. Compile your project and take the executable file to an empty folder: myproject.exe
  2. Try to execute it, It will retrieve an error (missing DLL files...).
  3. Now, copy all the DLL filesfrom Qt (in my case they were in C:\Qt\Qt5.1.1\5.1.1\msvc2012_64_opengl\bin) to this folder.
  4. Try to execute again, it will probably works fine.
  5. Start to delete progressively and try every time your executable still works, trying to leave the minimum necessary DLL files.
  1. 编译您的项目并将可执行文件放到一个空文件夹中:myproject.exe
  2. 尝试执行它,它将检索错误(缺少 DLL 文件...)。
  3. 现在,Qt 中的所有 DLL 文件(在我的例子中它们在 C:\Qt\Qt5.1.1\5.1.1\msvc2012_64_opengl\bin)复制到这个文件夹。
  4. 尝试再次执行,它可能会正常工作。
  5. 开始逐步删除并尝试每次您的可执行文件仍然有效时,尽量保留最少的必要 DLL 文件。

When you have all the DLL files in the same folder it is easier to find which of them are not valid (XML, WebKit, ... whatever..), and consequently this method doesn't take more than five minutes.

当您将所有 DLL 文件放在同一个文件夹中时,更容易找到哪些文件无效(XML、WebKit 等等),因此该方法不会花费超过五分钟的时间。

回答by BorisP

I just resolved the same problem.

我刚刚解决了同样的问题。

Dependency Walkeris misleading in this case and caused me to lose time. So, the list of "missing" DLL files from the first post is not helpful, and you can probably ignore it.

在这种情况下,Dependency Walker具有误导性,导致我浪费时间。因此,第一篇文章中“丢失”的 DLL 文件列表没有帮助,您可以忽略它。

The solution is to find which references yourproject is calling and check if they are really installed on the server.

解决方案是查找您的项目正在调用哪些引用并检查它们是否真的安装在服务器上。

@Ben Brammer, it is not important which three .ocx files are missing, because they are missing only for Leo T Abraham's project. Your project probably calls other DLL files.

@Ben Brammer,缺少哪三个 .ocx 文件并不重要,因为它们仅在 Leo T Abraham 的项目中丢失。您的项目可能会调用其他 DLL 文件。

In my case, it was not three .ocx files, but missing MySQL connector DLL file. After installing of MySQL Connector for .NET on server, the problem disappeared.

就我而言,它不是三个 .ocx 文件,而是缺少 MySQL 连接器 DLL 文件。在服务器上安装 MySQL Connector for .NET 后,问题消失了。

So, in short, the solution is: check if all your project references are there.

因此,简而言之,解决方案是:检查您的所有项目引用是否都在那里。

回答by Ofek Shilon

As mentioned, DCOMP is part of the VC++ redistributables (implementing the OpenMP runtime) and is the only truly missing component. All the rest are false reports.

如前所述,DCOMP 是 VC++ 可再发行组件(实现 OpenMP 运行时)的一部分,并且是唯一真正缺失的组件。其余均为虚假报道。

Specifically API-MS-WIN-XXXX.DLL are API-sets- essentially, an extra level of call indirectionintroduced gradually since Windows 7. Dependency Walkerdevelopment seemingly halted long before that, and it can't handle API sets properly.

具体来说,API-MS-WIN-XXXX.DLL 是API 集-本质上,自 Windows 7 以来逐渐引入了额外的调用间接级别。Dependency Walker开发似乎在此之前很久就停止了,并且它无法正确处理 API 集。

So there is nothing to worry about there. You're not missing anything more.

所以没有什么可担心的。你不会再错过任何东西了。

A better alternative to find the truly needed DLL files that are missing (if that is indeed the problem) is to run Process Monitorand step backwards from the failure, searching for sequences of failed probes for a specific DLL file in all the system path.

找到丢失的真正需要的 DLL 文件(如果这确实是问题所在)的一个更好的替代方法是运行Process Monitor并从故障中退回,在所有系统路径中搜索特定 DLL 文件的失败探测序列。

回答by hlongmore

I also ran into this problem, but the solution that seems to be a common thread here, and I saw elsewhere on the web, is "[re]install the redistributable package". However, for me that does not work, as the problem arose when running the installer for our product (which installs the redistributable package) to test our shiny new Visual Studio 2015 builds.

我也遇到了这个问题,但这里似乎是一个常见线程的解决方案,我在网上的其他地方看到的,是“[重新]安装可再发行包”。但是,对我来说这不起作用,因为在运行我们产品的安装程序(安装可再发行组件包)以测试我们闪亮的新 Visual Studio 2015 版本时出现了问题。

The issue came up because the DLL files listed are not located in the Visual Studio install path (for example, C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist) and thus had not been added to the install. These api-ms-win-* dlls get installed to a Windows 10 SDK install path as part of the Visual Studio 2015 install (e.g. C:\Program Files (x86)\Windows Kits\10\Redist).

出现此问题是因为列出的 DLL 文件不在 Visual Studio 安装路径(例如,C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist)中,因此未添加到安装中。这些 api-ms-win-* dll 作为 Visual Studio 2015 安装的一部分安装到 Windows 10 SDK 安装路径(例如 C:\Program Files (x86)\Windows Kits\10\Redist)。

Installing on Windows 10 worked fine, but installing on Windows 7 required adding these DLL files to our product install. For more information, see Update for Universal C Runtime in Windowswhich describes the addition of these dependencies caused by Visual Studio 2015 and provides downloads for various Windows platforms; also see Introducing the Universal CRTwhich describes the redesign of the CRT libraries. Of particular interest is item 6 under the section titled Distributing Software that uses the Universal CRT:

在 Windows 10 上安装工作正常,但在 Windows 7 上安装需要将这些 DLL 文件添加到我们的产品安装中。有关更多信息,请参阅Windows 中通用 C 运行时的更新,其中描述了由 Visual Studio 2015 引起的这些依赖项的添加,并提供了适用于各种 Windows 平台的下载;另请参阅介绍通用 CRT,它描述了 CRT 库的重新设计。特别感兴趣的是标题为“使用通用 CRT 的分发软件”部分下的第 6 项:

Updated September 11, 2015: App-local deployment of the Universal CRT is supported. To obtain the binaries for app-local deployment, install the Windows Software Development Kit (SDK) for Windows 10. The binaries will be installed to C:\Program Files (x86)\Windows Kits\10\Redist\ucrt. You will need to copy all of the DLLs with your app (note that the set of DLL files are necessary is different on different versions of Windows, so you must include all of the DLL files in order for your program to run on all supported versions of Windows).

2015 年 9 月 11 日更新:支持应用程序本地部署通用 CRT。要获取用于应用本地部署的二进制文件,请安装适用于 Windows 10 的 Windows 软件开发工具包 (SDK)。二进制文件将安装到 C:\Program Files (x86)\Windows Kits\10\Redist\ucrt。您将需要使用您的应用程序复制所有 DLL(请注意,所需的 DLL 文件集在不同版本的 Windows 上是不同的,因此您必须包含所有 DLL 文件,以便您的程序在所有支持的版本上运行的窗户)。

回答by normanius

This contribution does not really answer the initial question, but taking into account the hit-rate of this thread I assume that there are quite a few people dealing with the problem that API-MS-WIN-CORE- libraries cannot be found.

这个贡献并没有真正回答最初的问题,但考虑到这个线程的命中率,我假设有很多人在处理找不到 API-MS-WIN-CORE- 库的问题。

I was able to solve a problem where my application refused to start with the error message that API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL is not found by simply updating Visual Studio.

我能够解决一个问题,即我的应用程序拒绝启动并显示错误消息,即通过简单地更新 Visual Studio 找不到 API-MS-WIN-CORE-WINRT-STRING-L1-1-0.DLL。

I don't think that my build environment (Windows 7 Pro SP1, Visual Studio Ultimate 2012) was messed up completely, it worked fine for most of my projects. But under some very specific circumstances I got the error message (see below).

我不认为我的构建环境(Windows 7 Pro SP1、Visual Studio Ultimate 2012)完全搞砸了,它对我的​​大多数项目都很好。但是在某些非常特殊的情况下,我收到了错误消息(见下文)。

After updating Visual Studio 11from the initial CD-Version (I forgot to look up the version number) to version 11.0.61030.00 Update 4 also the broken project was running again.

经过更新的Visual Studio 11从最初的CD-版本(我忘了抬头看版本号),版本更新11.0.61030.00 4还破碎的项目重新运行。

Error message at application startup

应用程序启动时的错误消息

回答by Krazibit312

This solved the issue for me:

这为我解决了这个问题:

Uninstall the Visual Studio 2010 redistributable package if you have it installed already, and then install Microsoft Windows 7 SDK.

如果已安装 Visual Studio 2010 可再发行组件包,请卸载它,然后安装Microsoft Windows 7 SDK

回答by Kim

I solved the problem. When I registered the OCX files, I ran it with the Command Window that had been executed as an administrator.

我解决了这个问题。当我注册 OCX 文件时,我使用以管理员身份执行的命令窗口运行它。

回答by NoWomenNoCry

For anybody who came here, but with a Photoshopproblem: my solution was to uninstall the MS VC++ redistributable first x86 and 64 both. Then install one appropriate to the Windows version and architecture (86 or 64).

对于来到这里但遇到Photoshop问题的任何人:我的解决方案是先卸载 MS VC++ 可再发行版 x86 和 64。然后安装一个适合 Windows 版本和体系结构(86 或 64)。

回答by djsmiley2kStaysInside

I came here with this problem occurring, after trying a fresh Windows 7 OEM install, upgrading to Windows 10.

在尝试全新的 Windows 7 OEM 安装并升级到 Windows 10 后,我遇到了这个问题。

After some searching of Microsoft forums and such I found the following solution which worked for me:

在对 Microsoft 论坛等进行了一些搜索之后,我找到了以下对我有用的解决方案:

Replace C:\Windows10Upgrade\wimgapi.dllwith the one from C:\Windows\System32\wimgapi.dll

替换C:\Windows10Upgrade\wimgapi.dll为来自C:\Windows\System32\wimgapi.dll