DotNetCompatibilityCheck: If running NetCoreCheck.exe fails with error code ERROR_EXE_MACHINE_TYPE_MISMATCH or ERROR_BAD_EXE_FORMAT then don't abort the installation, just set the property to 13. Fixes issue #7737
apacker1 committed
Sep 22, 2023 at 14:41 UTC
0014af66faa541f70f84b22dc7aa5eea0d524d37
1 file changed
+13
-5
src/ext/NetFx/ca/netfxca.cpp
+13
-5
@@ -977,12 +977,20 @@ extern "C" UINT __stdcall DotNetCompatibilityCheck(
977
WcaLog(LOGMSG_VERBOSE, "Command: %ls %ls", pwzNetCoreCheckFilePath, pwzCommandLine);
978
979
hr = ProcExec(pwzNetCoreCheckFilePath, pwzCommandLine, SW_HIDE, &hProcess);
980
- ExitOnFailure(hr, "failed to run NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
980
+ if (hr == HRESULT_FROM_WIN32(ERROR_EXE_MACHINE_TYPE_MISMATCH) || hr == HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT))
981
+ {
982
+ dwExitCode = 13;
983
+ WcaLog(LOGMSG_VERBOSE, "NetCoreCheck executable for platform %ls is not compatible with current OS", pwzPlatform);
984
+ }
985
+ else
986
+ {
987
+ ExitOnFailure(hr, "failed to run NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
988
982
- hr = ProcWaitForCompletion(hProcess, INFINITE, &dwExitCode);
983
- ExitOnFailure(hr, "failed to finish NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
984
- WcaLog(LOGMSG_VERBOSE, "Exit code: %lu", dwExitCode);
985
- ReleaseHandle(hProcess);
989
+ hr = ProcWaitForCompletion(hProcess, INFINITE, &dwExitCode);
990
+ ExitOnFailure(hr, "failed to finish NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
991
+ WcaLog(LOGMSG_VERBOSE, "Exit code: %lu", dwExitCode);
992
+ ReleaseHandle(hProcess);
993
+ }
994
995
hr = WcaSetIntProperty(pwzProperty, dwExitCode);
996
ExitOnFailure(hr, "failed to set NetCoreCheck result in %ls", pwzProperty);