aboutsummaryrefslogtreecommitdiff
path: root/src/burn/engine/registration.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn/engine/registration.cpp')
-rw-r--r--src/burn/engine/registration.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index 484c08ac..35100336 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -492,25 +492,28 @@ extern "C" HRESULT RegistrationDetectResumeType(
492{ 492{
493 HRESULT hr = S_OK; 493 HRESULT hr = S_OK;
494 HKEY hkRegistration = NULL; 494 HKEY hkRegistration = NULL;
495 BOOL fExists = FALSE;
495 DWORD dwResume = 0; 496 DWORD dwResume = 0;
496 497
497 // open registration key 498 // open registration key
498 hr = RegOpen(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_QUERY_VALUE, &hkRegistration); 499 hr = RegOpen(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_QUERY_VALUE, &hkRegistration);
499 if (E_FILENOTFOUND == hr || E_PATHNOTFOUND == hr) 500 ExitOnPathFailure(hr, fExists, "Failed to open registration key.");
501
502 if (!fExists)
500 { 503 {
501 *pResumeType = BOOTSTRAPPER_RESUME_TYPE_NONE; 504 *pResumeType = BOOTSTRAPPER_RESUME_TYPE_NONE;
502 ExitFunction1(hr = S_OK); 505 ExitFunction();
503 } 506 }
504 ExitOnFailure(hr, "Failed to open registration key.");
505 507
506 // read Resume value 508 // read Resume value
507 hr = RegReadNumber(hkRegistration, L"Resume", &dwResume); 509 hr = RegReadNumber(hkRegistration, L"Resume", &dwResume);
508 if (E_FILENOTFOUND == hr) 510 ExitOnPathFailure(hr, fExists, "Failed to read Resume value.");
511
512 if (!fExists)
509 { 513 {
510 *pResumeType = BOOTSTRAPPER_RESUME_TYPE_INVALID; 514 *pResumeType = BOOTSTRAPPER_RESUME_TYPE_INVALID;
511 ExitFunction1(hr = S_OK); 515 ExitFunction();
512 } 516 }
513 ExitOnFailure(hr, "Failed to read Resume value.");
514 517
515 switch (dwResume) 518 switch (dwResume)
516 { 519 {
@@ -855,6 +858,7 @@ extern "C" HRESULT RegistrationSessionEnd(
855{ 858{
856 HRESULT hr = S_OK; 859 HRESULT hr = S_OK;
857 HKEY hkRegistration = NULL; 860 HKEY hkRegistration = NULL;
861 BOOL fDeleted = FALSE;
858 862
859 // If no resume mode, then remove the bundle registration. 863 // If no resume mode, then remove the bundle registration.
860 if (BURN_RESUME_MODE_NONE == resumeMode) 864 if (BURN_RESUME_MODE_NONE == resumeMode)
@@ -874,10 +878,7 @@ extern "C" HRESULT RegistrationSessionEnd(
874 878
875 // Delete registration key. 879 // Delete registration key.
876 hr = RegDelete(pRegistration->hkRoot, pRegistration->sczRegistrationKey, REG_KEY_DEFAULT, TRUE); 880 hr = RegDelete(pRegistration->hkRoot, pRegistration->sczRegistrationKey, REG_KEY_DEFAULT, TRUE);
877 if (E_FILENOTFOUND != hr) 881 ExitOnPathFailure(hr, fDeleted, "Failed to delete registration key: %ls", pRegistration->sczRegistrationKey);
878 {
879 ExitOnFailure(hr, "Failed to delete registration key: %ls", pRegistration->sczRegistrationKey);
880 }
881 882
882 CacheRemoveBundle(pCache, pRegistration->fPerMachine, pRegistration->sczId); 883 CacheRemoveBundle(pCache, pRegistration->fPerMachine, pRegistration->sczId);
883 } 884 }
@@ -967,7 +968,10 @@ extern "C" HRESULT RegistrationSaveState(
967 ExitOnFailure(hr, "Failed to enumerate value %u", i); 968 ExitOnFailure(hr, "Failed to enumerate value %u", i);
968 969
969 er = ::RegDeleteValueW(hkRegistration, sczValueName); 970 er = ::RegDeleteValueW(hkRegistration, sczValueName);
970 ExitOnWin32Error(er, hr, "Failed to delete registration variable value."); 971 if (ERROR_FILE_NOT_FOUND != er)
972 {
973 ExitOnWin32Error(er, hr, "Failed to delete registration variable value.");
974 }
971 } 975 }
972 976
973 // Write variables. 977 // Write variables.
@@ -1486,6 +1490,7 @@ static HRESULT RemoveUpdateRegistration(
1486 LPWSTR sczPackageVersion = NULL; 1490 LPWSTR sczPackageVersion = NULL;
1487 HKEY hkKey = NULL; 1491 HKEY hkKey = NULL;
1488 BOOL fDeleteRegKey = TRUE; 1492 BOOL fDeleteRegKey = TRUE;
1493 BOOL fDeleted = FALSE;
1489 1494
1490 hr = FormatUpdateRegistrationKey(pRegistration, &sczKey); 1495 hr = FormatUpdateRegistrationKey(pRegistration, &sczKey);
1491 ExitOnFailure(hr, "Failed to format key for update registration."); 1496 ExitOnFailure(hr, "Failed to format key for update registration.");
@@ -1513,10 +1518,7 @@ static HRESULT RemoveUpdateRegistration(
1513 if (fDeleteRegKey) 1518 if (fDeleteRegKey)
1514 { 1519 {
1515 hr = RegDelete(pRegistration->hkRoot, sczKey, REG_KEY_DEFAULT, FALSE); 1520 hr = RegDelete(pRegistration->hkRoot, sczKey, REG_KEY_DEFAULT, FALSE);
1516 if (E_FILENOTFOUND != hr) 1521 ExitOnPathFailure(hr, fDeleted, "Failed to remove update registration key: %ls", sczKey);
1517 {
1518 ExitOnFailure(hr, "Failed to remove update registration key: %ls", sczKey);
1519 }
1520 } 1522 }
1521 1523
1522LExit: 1524LExit: