From e75c7cff46ea85629aa507e346ae71c24051030f Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 13 Sep 2025 04:51:03 -0400 Subject: [PATCH] [idd] install: call ensureKeyWithAce once and fail properly --- idd/LGIddInstall/LGIddInstall.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/idd/LGIddInstall/LGIddInstall.c b/idd/LGIddInstall/LGIddInstall.c index 6bfe8dca..2649cf61 100644 --- a/idd/LGIddInstall/LGIddInstall.c +++ b/idd/LGIddInstall/LGIddInstall.c @@ -250,13 +250,6 @@ enum DeviceCreated isIddDeviceCreated() bool createIddDevice(void) { - DWORD ec = ensureKeyWithAce(); - if (ec != ERROR_SUCCESS) - { - debugWinError(L"ensureKeyWithAce", ec); - return false; - } - HDEVINFO hDevInfo = SetupDiCreateDeviceInfoList(&LGIDD_CLASS_GUID, NULL); if (hDevInfo == INVALID_HANDLE_VALUE) { @@ -384,13 +377,6 @@ bool installIddInf(PBOOL pbNeedRestart) if (!getIddInfPath(szInf)) return false; - DWORD ec = ensureKeyWithAce(); - if (ec != ERROR_SUCCESS) - { - debugWinError(L"ensureKeyWithAce", ec); - return false; - } - if (!DiInstallDriverW(NULL, szInf, DIIRFLAG_FORCE_INF, pbNeedRestart)) { debugWinError(L"DiInstallDriverW", GetLastError()); @@ -407,14 +393,22 @@ void install() case DEVICE_NOT_CREATED: wprintf(L"Creating LGIdd device: %s...\n", LGIDD_HWID); if (!createIddDevice()) - return; + exit(1); // fallthrough case DEVICE_CREATED: + _putws("Preparing registry key..."); + DWORD ec = ensureKeyWithAce(); + if (ec != ERROR_SUCCESS) + { + debugWinError(L"ensureKeyWithAce", ec); + exit(1); + } + _putws(L"Installing INF..."); BOOL bNeedRestart; if (!installIddInf(&bNeedRestart)) - return; + exit(1); if (bNeedRestart) {