Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

api-ms-win-core-winrt-string-l1-1-0.dll is missing from your computer

I'm writing a program that needs to run across Windows 7, 8.x and 10. The program has a one (relatively minor) feature that relies on Windows APIs that are only available on Windows 10. This feature will obviously not work on Win7, and before calling these APIs I make sure that the current OS is Windows 10.

In order to use these APIs I'm forced to configure my VS2015 project to "Consume Windows Runtime Extension" (/ZW) and to set "Target Platform Version" to 10.0.10586.0.

However, this causes a problem when I try to run the app on Windows 7. I get an error dialog saying "The program can't start because api-ms-win-core-winrt-string-l1-1-0.dll is missing from your computer". I tried to installed VS2015 redistributable package on the Win7 machine, but that did not solve the problem.

Any idea on how to get this to run on Win7? I really prefer not to change all my code to dynamically load all Windows 10 functions.

The program is written in C++, and the Windows API I use are from Windows.Devices.WifiDirect namespace.

like image 783
greenmind Avatar asked Dec 10 '25 06:12

greenmind


1 Answers

I ended up solving this problem by moving all my Win10-only API calls into a proxy DLL, which is compiled with /ZW. I then removed the /ZW switch from the main program, which then allowed it to run under Windows 7. The proxy DLL is only loaded (using LoadLibrary() call) when my program is running on a Windows 10 machine.

This solved the problem. I did have to write a few proxy functions for the DLL, but it was far lass overhead than doing that for all the Win10-only API calls.

I would still like to hear better solutions, if there are any.

like image 153
greenmind Avatar answered Dec 13 '25 01:12

greenmind