Visual Studio 2015 C ++应用程序需要在客户端客户端上的api-ms-win-crt-runtime-l1-1-0.dll [英] Visual Studio 2015 C++ app requires api-ms-win-crt-runtime-l1-1-0.dll on client clients

查看:427
本文介绍了Visual Studio 2015 C ++应用程序需要在客户端客户端上的api-ms-win-crt-runtime-l1-1-0.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Visual Studio 2015社区版构建了一个应用程序。当我的一些用户尝试运行它,它们会收到以下错误:


程序无法启动,因为api-ms- -crt-runtime-l1-1-0.dll从您的计算机丢失。请尝试重新安装程序以解决此问题。


显然,这是通过安装在Windows中的Universal C Runtime的更新(KB2999226)。我可以在安装脚本中检查修补程序,但所有的我发现这样做的方法或者的太慢或不可靠



如何防止此错误发生?我可以更改我的解决方案,使我不需要这种依赖吗?我可以链接到我可以删除的东西吗?

编辑:在项目属性中,目标平台版本是8.1,我的应用程序



编辑2:我尝试复制所有的通用C运行时库DLL到应用程序目录,因为 Microsoft现在允许(但不推荐)本地模式安装UCRT 。在 C:\Program Files(x86)\Windows Kits\10\Redist\ucrt\DLLs\x64 和<$ c中有41个文件$ c> api-ms-win-crt-runtime-l1-1-0.dll 是其中之一。但是,现在运行应用程序会导致此错误:


应用程序无法正确启动(0xc0000142)。点击确定关闭应用程序。


我试过用MSVS 2015调试应用程序,但无处可去。我打开可执行文件的Dependency Walker,看来,我缺少的

我试图通过Process Monitor(procmon)运行应用程序,没有什么不寻常的。应用程序只需在WerFault.exe上调用进程创建,然后线程退出。



编辑3: http://blogs.msdn.com/b/junfeng/archive/2006/11/20/debugging-loadlibrary-failures.aspx =nofollow>加载器快照在可执行文件上,并得到这个从cdb运行它,如果它有帮助:

  ... 
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - 状态:0x00000000
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - ENTER:DLL名称:api-ms-win-core-sysinfo-l1-2-1.dll。
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - INFO:DLL名称api-ms-win-core-sysinfo-l1-2-1.dll被重定向到C:\WINDOWS\SYSTEM32\kernelbase.dll SxS。
00C0:1200 @ 02106250 - LdrpFindOrMapDll - ENTER键:DLL名称:C:\WINDOWS\SYSTEM32\kernelbase.dll
00C0:1200 @ 02106250 - LdrpResolveDllName - ENTER键:DLL名称:C:\\ \\WINDOWS\SYSTEM32\kernelbase.dll
00C0:1200 @ 02106250 - LdrpResolveDllName - RETURN:状态:00000000
00C0:1200 @ 02106250 - LdrpFindOrMapDll - RETURN:状态:00000000
00C0: 1200 @ 02106250 - LdrpFindOrMapDependency - RETURN:状态:00000000
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlSetLastWin32Error的名称
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlLeaveCriticalSection 按名称
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlEnterCriticalSection的名称
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlInitializeCriticalSection的名称
00C0 :1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlDeleteCriticalSection的名称
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:查找程序RtlQueryPerformanceCounter的名称
00C0:1200 @ 02106250 - LdrpGetProcedureAddress - 信息:按名称定位过程LdrResolveDelayLoadedAPI
00c0:1200 @ 02106250 - LdrpMergeNodes - INFO:合并基于USER32.dll的周期。
00c0:1200 @ 02106250 - LdrpMergeNodes - 信息:添加循环模块GDI32.dll。
(c0.1200):断点指令异常 - 代码80000003(第一次机会)
***错误:找不到符号文件。默认为ntdll.dll的导出符号 -
ntdll!LdrInitShimEngineDynamic + 0x330:
00007ffc`d68732e8 cc int 3
0:000>


解决方案

对于消费者应用程序,有很多情况导致特定的DLL丢失或其配置烦恼。我是安装技术铅的非常的流行的Windows应用程序(每天成千上万安装的),你不会相信常见错误配置的Windows机器是如何在那里。



通用CRT是一个好主意,但相对较新,它会一段时间(可能很长一段时间),直到它被破坏防止您的客户的PC启动。这应该是阈值:如果你的客户不能登录没有DLL X,那么就可以依赖它。



常见的怪异状态:




  • 正在进行的MSI安装程序:某些Windows认为正在安装

  • COM数据库不一致: HKCU部分
    注册表是一个粗糙的地方

  • 缺少MSVC crts或预发布版本

  • 预发布版本Windows:我们猜想
    预发布的Windows更容易盗版。

  • 仍在sysprep中:OEM
    忘记密封机器配置。

  • 字体损坏:如果使用DirectWrite特别痛苦

  • 超频:文件系统缓冲区中的最终位翻转等于损坏的文件。


I've built an application with Visual Studio 2015 Community edition. When some of my users try to run it it they receive the following error:

The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

Clearly this is solved by installing the Update for Universal C Runtime in Windows (KB2999226). I could check for the hotfix during the install script but all of the methods I've found to do this are either too slow or unreliable.

How can I prevent this error from occurring? Can I change my solution so that I don't require this dependency? Am I linking against something I can remove? Can I redistribute the hotfix along with my application?

Edit: In the project properties, the "Target Platform Version" is 8.1 and the "Platform Toolset" is "Visual Studio 2015 (v140)", if that helps at all.

Edit 2: I've tried copying all of the Universal C Runtime Library DLL's to the application directory since Microsoft now allows (but doesn't recommend) local mode installation of the UCRT. There are 41 files in C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64 and api-ms-win-crt-runtime-l1-1-0.dll is one of them. However, now running the application results in this error:

The application was unable to start correctly (0xc0000142). Click OK to close the application.

I've tried debugging the application with MSVS 2015 but got nowhere. I opened the executable in Dependency Walker and it appears that I'm missing similar DLLs listed in this answer, which says that Dependency Walker is old and this is a red herring.

I tried running the application through Process Monitor (procmon) and there's nothing unusual. The application simply calls "Process Create" on WerFault.exe and then "Thread Exit."

Edit 3: I enabled loader snaps on the executable and got this when running it from cdb, if it helps:

...
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - RETURN: Status: 0x00000000
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - ENTER: DLL name: api-ms-win-core-sysinfo-l1-2-1.dll.
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - INFO: DLL name api-ms-win-core-sysinfo-l1-2-1.dll was redirected to C:\WINDOWS\SYSTEM32\kernelbase.dll by SxS.
00c0:1200 @ 02106250 - LdrpFindOrMapDll - ENTER: DLL name: C:\WINDOWS\SYSTEM32\kernelbase.dll
00c0:1200 @ 02106250 - LdrpResolveDllName - ENTER: DLL name: C:\WINDOWS\SYSTEM32\kernelbase.dll
00c0:1200 @ 02106250 - LdrpResolveDllName - RETURN: Status: 0x00000000
00c0:1200 @ 02106250 - LdrpFindOrMapDll - RETURN: Status: 0x00000000
00c0:1200 @ 02106250 - LdrpFindOrMapDependency - RETURN: Status: 0x00000000
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlSetLastWin32Error" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlLeaveCriticalSection" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlEnterCriticalSection" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlInitializeCriticalSection" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlDeleteCriticalSection" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "RtlQueryPerformanceCounter" by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO: Locating procedure "LdrResolveDelayLoadedAPI" by name
00c0:1200 @ 02106250 - LdrpMergeNodes - INFO: Merging a cycle rooted at USER32.dll.
00c0:1200 @ 02106250 - LdrpMergeNodes - INFO: Adding cyclic module GDI32.dll.
(c0.1200): Break instruction exception - code 80000003 (first chance)
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll -
ntdll!LdrInitShimEngineDynamic+0x330:
00007ffc`d68732e8 cc              int     3
0:000>

解决方案

You should link statically with the CRT. For a consumer application there are a lot of scenarios which result in particular DLL missing or its configuration botched. I was the installer technical lead for a very popular Windows application (thousands of installs per day) and you would not believe how common misconfigured Windows machines are out there. At the bottom I'll give a short list.

The universal CRT is a good idea but relatively new and it will be a while, (possibly a long while) until it being broken prevents your customers' PC from booting. That should be the threshold: If your customer cannot log in without DLL X then it is ok to depend on it.

Common Weird states:

  • MSI installer in progress : Somehow Windows thinks that there is an installation in progress
  • COM database inconsistent : The HKCU part of the registry is a rough place
  • Missing MSVC crts or pre-release versions in there
  • Pre-release versions of Windows : we guess that pre-release Windows are easier to pirate.
  • Still in sysprep : The OEM forgot to seal the machine configuration.
  • Fonts corrupt: Specially painful if you use DirectWrite
  • Overclocked: eventual bit flips in filesystem buffers equal corrupted files.

这篇关于Visual Studio 2015 C ++应用程序需要在客户端客户端上的api-ms-win-crt-runtime-l1-1-0.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆