VCRedist 2017 - msvcp140.dll

Questions about Wine on Linux
Locked
mhanft
Level 2
Level 2
Posts: 10
Joined: Fri Sep 15, 2017 1:46 pm

VCRedist 2017 - msvcp140.dll

Post by mhanft »

Hello,

my (32-bit) Windows application uses some "other-manufacturer.dll" which uses Microsoft's VC++ Redistribution Package. Until last version this worked by just copying "msvcp120.dll" and "msvcr120.dll" into the application's directory, but the latest version of the other manufacturer's DLL needs the 2017 version of VCRedist, and they recommend to use Microsoft's original installer "vc_redist.x86.exe" instead of just copying the DLLs (because of some complicated dependencies which are not obvious to the user). vc_redist.x86.exe runs without an error (and msvcp140.dll etc. do exist in ~/.wine/drive_c/windows/syswow64 afterwards). It's just when my application tries LoadLibrary("other manufacturer's dll"), it fails with GetLastError=317 and the SysErrorMessage of that is "Message 0x%1 not found in file %2". On the console, when trying to load the DLL, there appears

Code: Select all

fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (0x33ed6c 1 C) semi-stub
fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (0x33e48c 1 C) semi-stub
fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (0x33de8c 1 C) semi-stub
fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (0x33df3c 1 C) semi-stub
fixme:msvcp:_Locinfo__Locinfo_ctor_cat_cstr (0x33dd2c 1 C) semi-stub
wine: Call from 0x7b43fd0e to unimplemented function msvcp140.dll.?uncaught_exceptions@std@@YAHXZ, aborting
fixme:ntdll:RtlNtStatusToDosErrorNoTeb no mapping for 80000100
I tried with Wine 2.0 and 2.16 on openSUSE Leap 42.3, but a user with macOS Sierra 10.12.6 got the same results.

Is there any solution to it, or do I have to cease from claiming "my program runs with Wine, too"?

Thank you,

-Matt
mhanft
Level 2
Level 2
Posts: 10
Joined: Fri Sep 15, 2017 1:46 pm

Re: VCRedist 2017 - msvcp140.dll

Post by mhanft »

Meanwhile, I found out that changing the Wine DLL attributes of msvcp140 and vcruntime140 to "Native, Builtin" seems to solve the problem. Not quite sure if this suffices, but everything seems to work until now.
Changing VCRuntime attributes
Changing VCRuntime attributes
I'd appreciate any comments if this was the correct solution anyway, or if I should do something different...

-Matt
User avatar
Bob Wya
Level 12
Level 12
Posts: 3068
Joined: Sat Oct 16, 2010 7:40 pm

Re: VCRedist 2017 - msvcp140.dll

Post by Bob Wya »

mhanft wrote:Meanwhile, I found out that changing the Wine DLL attributes of msvcp140 and vcruntime140 to "Native, Builtin" seems to solve the problem. Not quite sure if this suffices, but everything seems to work until now.
...
I'd appreciate any comments if this was the correct solution anyway, or if I should do something different...

-Matt
Yup that looks fine.
Wine will look to the API calls for the native dynamic link libraries you've installed first - then fallback to the Wine builtin ones (which won't exist in the case of VCRedist 2017 I guess... core components maybe??)

That's pretty much what the winetricks script, does behind the scenes, for the earlier supported versions of the MS runtimes...
E.g. Visual C++ 2015 runtime:

Code: Select all

    title="Visual C++ 2015 libraries (concrt140.dll,mfc140.dll,mfc140u.dll,mfcm140.dll,mfcm140u.dll,msvcp140.dll,vcamp140.dll,vccorlib140.dll,vcomp140.dll,vcruntime140.dll)" \
    publisher="Microsoft" \
    year="2015" \
    media="download" \
    file1="vc_redist.x86.exe" \
    installed_file1="$W_SYSTEM32_DLLS_WIN/mfc140.dll"

load_vcrun2015()
{
    # https://www.microsoft.com/en-us/download/details.aspx?id=48145
    # 2015/10/12: fdd1e1f0dcae2d0aa0720895eff33b927d13076e64464bb7c7e5843b7667cd14
    w_download https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe fdd1e1f0dcae2d0aa0720895eff33b927d13076e64464bb7c7e5843b7667cd14

    if w_workaround_wine_bug 37781; then
        w_warn "This may fail in non-XP mode, see https://bugs.winehq.org/show_bug.cgi?id=37781"
    fi

    # THIS LINE HERE!! >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    w_override_dlls native,builtin api-ms-win-crt-conio-l1-1-0 api-ms-win-crt-heap-l1-1-0 api-ms-win-crt-locale-l1-1-0 api-ms-win-crt-math-l1-1-0 api-ms-win-crt-runtime-l1-1-0 api-ms-win-crt-stdio-l1-1-0 api-ms-win-crt-time-l1-1-0 atl140 concrt140 msvcp140 msvcr140 ucrtbase vcomp140 vcruntime140

    w_set_winver winxp

    w_try_cd "$W_CACHE"/"$W_PACKAGE"
    w_try "$WINE" vc_redist.x86.exe $W_UNATTENDED_SLASH_Q

    case "$W_ARCH" in
    win64)
        # Also install the 64-bit version
        # 2015/10/12: 5eea714e1f22f1875c1cb7b1738b0c0b1f02aec5ecb95f0fdb1c5171c6cd93a3
        w_download https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe 5eea714e1f22f1875c1cb7b1738b0c0b1f02aec5ecb95f0fdb1c5171c6cd93a3
        if w_workaround_wine_bug 30713 "Manually extracting the 64-bit dlls"; then
            rm -f "$W_TMP"/*  # Avoid permission error
            w_try_cabextract --directory="$W_TMP" vc_redist.x64.exe
            w_try_cabextract --directory="$W_TMP" "$W_TMP/a10"
            w_try_cabextract --directory="$W_TMP" "$W_TMP/a11"
            cp "$W_TMP"/concrt140.dll "$W_SYSTEM64_DLLS"/concrt140.dll
            cp "$W_TMP"/mfc140.dll "$W_SYSTEM64_DLLS"/mfc140.dll
            cp "$W_TMP"/mfc140u.dll "$W_SYSTEM64_DLLS"/mfc140u.dll
            cp "$W_TMP"/mfcm140.dll "$W_SYSTEM64_DLLS"/mfcm140.dll
            cp "$W_TMP"/mfcm140u.dll "$W_SYSTEM64_DLLS"/mfcm140u.dll
            cp "$W_TMP"/msvcp140.dll "$W_SYSTEM64_DLLS"/msvcp140.dll
            cp "$W_TMP"/vcamp140.dll "$W_SYSTEM64_DLLS"/vcamp140.dll
            cp "$W_TMP"/vccorlib140.dll "$W_SYSTEM64_DLLS"/vccorlib140.dll
            cp "$W_TMP"/vcomp140.dll "$W_SYSTEM64_DLLS"/vcomp140.dll
            cp "$W_TMP"/vcruntime140.dll "$W_SYSTEM64_DLLS"/vcruntime140.dll

            cp "$W_TMP"/api_ms_win_crt_conio_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-conio-l1-1-0.dll
            cp "$W_TMP"/api_ms_win_crt_heap_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-heap-l1-1-0.dll
            cp "$W_TMP"/api_ms_win_crt_locale_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-locale-l1-1-0.dll
            cp "$W_TMP"/api_ms_win_crt_math_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-math-l1-1-0.dll
            cp "$W_TMP"/api_ms_win_crt_runtime_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-runtime-l1-1-0.dll
            cp "$W_TMP"/api_ms_win_crt_stdio_l1_1_0.dll "$W_SYSTEM64_DLLS"/api-ms-win-crt-stdio-l1-1-0.dll
            cp "$W_TMP"/ucrtbase.dll "$W_SYSTEM64_DLLS"/ucrtbase.dll
        else
            w_try "$WINE" vc_redist.x64.exe $W_UNATTENDED_SLASH_Q
        fi
        ;;
    esac
}
Always worth checking this script out - even if you're trying to install a newer unsupported runtime... 8)

Bob
tukkek
Newbie
Newbie
Posts: 2
Joined: Sat Jun 09, 2018 8:51 pm

Re: VCRedist 2017 - msvcp140.dll

Post by tukkek »

Hey fellas, I registered to say that Starcraft 2 is working fine again after upgrading from wine to wine-staging. It's actually working a lot better than when it first became free-to-play, in my experience! It might work with wine-devel too but I haven't tried it.

Before upgrading to Wine-staging I was having the same problem as OP and after upgrading it's now working like a charm, no need to mess with configuration or anything. Hope you all can enjoy the game again soon and thanks to all Wine developers for the amazing work!
Locked