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

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

问题描述

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


程序无法启动,因为api-ms-win计算机上缺少-crt-runtime-l1-1-0.dll。尝试重新安装程序来解决这个问题。


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



如何防止发生此错误?我可以改变我的解决方案,以便我不需要这种依赖性吗?我链接到我可以删除的东西吗?可以和我的应用一起重新分发修补程序吗?



编辑:在项目属性中,目标平台版本是8.1,平台工具集是Visual Studio 2015(v140),如果这有帮助。



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


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


我已经尝试使用MSVS 2015调试应用程序,但无处可寻。我在Dependency Walker中打开了可执行文件,看来我在这个答案说,Dependency Walker是老的,这是一个红色的鲱鱼。



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



编辑3:启用加载器快照,并得到这个当从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由血散。
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:状态:0x00000000
00c0:1200 @ 02106250 - LdrpFindOrMapDll - 返回:状态:0x00000000
00c0: 1200 @ 02106250 - LdrpFindOrMapDependency - 返回:状态:0x00000000
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlSetLastWin32Errorby name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlLeaveCriticalSection by name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlEnterCriticalSectionby name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlInitializeCriticalSectionby name
00c0 :1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlDe leteCriticalSectionby name
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:定位过程RtlQueryPerformanceCounter,名称为
00c0:1200 @ 02106250 - LdrpGetProcedureAddress - INFO:按名称
定位LdrResolveDelayLoadedAPI 00c0:1200 @ 02106250 - LdrpMergeNodes - 信息:合并一个根植于USER32.dll的循环。
00c0:1200 @ 02106250 - LdrpMergeNodes - INFO:添加循环模块GDI32.dll。
(c0.1200):中断指令异常 - 代码80000003(第一次机会)
***错误:找不到符号文件。默认为导出ntdll.dll符号 -
ntdll!LdrInitShimEngineDynamic + 0x330:
00007ffc`d68732e8 cc int 3
0:000>


解决方案

您应该将静态连接到CRT。对于消费者应用程序,存在许多导致特定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天全站免登陆