Skip to content

Commit

Permalink
DotNetCompatibilityCheck: If running NetCoreCheck.exe fails with erro…
Browse files Browse the repository at this point in the history
…r 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
  • Loading branch information
apacker1 committed Oct 3, 2023
1 parent e570ce5 commit ccb0b81
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/ext/NetFx/ca/netfxca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,12 +977,20 @@ extern "C" UINT __stdcall DotNetCompatibilityCheck(
WcaLog(LOGMSG_VERBOSE, "Command: %ls %ls", pwzNetCoreCheckFilePath, pwzCommandLine);

hr = ProcExec(pwzNetCoreCheckFilePath, pwzCommandLine, SW_HIDE, &hProcess);
ExitOnFailure(hr, "failed to run NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
if (hr == HRESULT_FROM_WIN32(ERROR_EXE_MACHINE_TYPE_MISMATCH) || hr == HRESULT_FROM_WIN32(ERROR_BAD_EXE_FORMAT))
{
dwExitCode = 13;
WcaLog(LOGMSG_VERBOSE, "NetCoreCheck executable for platform %ls is not compatible with current OS", pwzPlatform);
}
else
{
ExitOnFailure(hr, "failed to run NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);

hr = ProcWaitForCompletion(hProcess, INFINITE, &dwExitCode);
ExitOnFailure(hr, "failed to finish NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
WcaLog(LOGMSG_VERBOSE, "Exit code: %lu", dwExitCode);
ReleaseHandle(hProcess);
hr = ProcWaitForCompletion(hProcess, INFINITE, &dwExitCode);
ExitOnFailure(hr, "failed to finish NetCoreCheck from binary '%ls' with command line: %ls %ls", pwzNetCoreCheckBinaryId, pwzNetCoreCheckFilePath, pwzCommandLine);
WcaLog(LOGMSG_VERBOSE, "Exit code: %lu", dwExitCode);
ReleaseHandle(hProcess);
}

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

0 comments on commit ccb0b81

Please sign in to comment.