Skip to content

Commit 0014af6

Browse files
apacker1barnson
authored andcommitted
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
1 parent e570ce5 commit 0014af6

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/ext/NetFx/ca/netfxca.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -977,12 +977,20 @@ extern "C" UINT __stdcall DotNetCompatibilityCheck(
977977
WcaLog(LOGMSG_VERBOSE, "Command: %ls %ls", pwzNetCoreCheckFilePath, pwzCommandLine);
978978

979979
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);
981988

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+
}
986994

987995
hr = WcaSetIntProperty(pwzProperty, dwExitCode);
988996
ExitOnFailure(hr, "failed to set NetCoreCheck result in %ls", pwzProperty);

0 commit comments

Comments
 (0)