mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-19 05:48:10 +00:00
[idd] install: call ensureKeyWithAce once and fail properly
This commit is contained in:
@@ -250,13 +250,6 @@ enum DeviceCreated isIddDeviceCreated()
|
|||||||
|
|
||||||
bool createIddDevice(void)
|
bool createIddDevice(void)
|
||||||
{
|
{
|
||||||
DWORD ec = ensureKeyWithAce();
|
|
||||||
if (ec != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
debugWinError(L"ensureKeyWithAce", ec);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList(&LGIDD_CLASS_GUID, NULL);
|
HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList(&LGIDD_CLASS_GUID, NULL);
|
||||||
if (hDevInfo == INVALID_HANDLE_VALUE)
|
if (hDevInfo == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
@@ -384,13 +377,6 @@ bool installIddInf(PBOOL pbNeedRestart)
|
|||||||
if (!getIddInfPath(szInf))
|
if (!getIddInfPath(szInf))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
DWORD ec = ensureKeyWithAce();
|
|
||||||
if (ec != ERROR_SUCCESS)
|
|
||||||
{
|
|
||||||
debugWinError(L"ensureKeyWithAce", ec);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DiInstallDriverW(NULL, szInf, DIIRFLAG_FORCE_INF, pbNeedRestart))
|
if (!DiInstallDriverW(NULL, szInf, DIIRFLAG_FORCE_INF, pbNeedRestart))
|
||||||
{
|
{
|
||||||
debugWinError(L"DiInstallDriverW", GetLastError());
|
debugWinError(L"DiInstallDriverW", GetLastError());
|
||||||
@@ -407,14 +393,22 @@ void install()
|
|||||||
case DEVICE_NOT_CREATED:
|
case DEVICE_NOT_CREATED:
|
||||||
wprintf(L"Creating LGIdd device: %s...\n", LGIDD_HWID);
|
wprintf(L"Creating LGIdd device: %s...\n", LGIDD_HWID);
|
||||||
if (!createIddDevice())
|
if (!createIddDevice())
|
||||||
return;
|
exit(1);
|
||||||
|
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case DEVICE_CREATED:
|
case DEVICE_CREATED:
|
||||||
|
_putws("Preparing registry key...");
|
||||||
|
DWORD ec = ensureKeyWithAce();
|
||||||
|
if (ec != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
debugWinError(L"ensureKeyWithAce", ec);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
_putws(L"Installing INF...");
|
_putws(L"Installing INF...");
|
||||||
BOOL bNeedRestart;
|
BOOL bNeedRestart;
|
||||||
if (!installIddInf(&bNeedRestart))
|
if (!installIddInf(&bNeedRestart))
|
||||||
return;
|
exit(1);
|
||||||
|
|
||||||
if (bNeedRestart)
|
if (bNeedRestart)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user