Skip to content

Commit

Permalink
Added reboot required check
Browse files Browse the repository at this point in the history
  • Loading branch information
nefarius committed Jul 10, 2022
1 parent 8b9ae1a commit 7ef1f71
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Devcon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,30 @@ bool devcon::inf_default_install(const std::wstring& fullInfPath, bool* rebootRe
break;
}

Newdev newdev;
BOOL reboot;

if (!newdev.pDiInstallDriverW)
{
logger->error("Couldn't find DiInstallDriverW export");
SetLastError(ERROR_INVALID_FUNCTION);
return false;
}

logger->verbose(1, "Invoking DiInstallDriverW");

const auto ret = newdev.pDiInstallDriverW(
nullptr,
fullInfPath.c_str(),
0,
&reboot
);

logger->verbose(1, "DiInstallDriverW returned with %v, reboot required: %v", ret, reboot);

if (rebootRequired)
*rebootRequired = reboot > 1;

} while (FALSE);

if (hInf != INVALID_HANDLE_VALUE)
Expand Down

0 comments on commit 7ef1f71

Please sign in to comment.