summaryrefslogtreecommitdiff
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.cpp51
1 files changed, 14 insertions, 37 deletions
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index 9953be83..e83e0811 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -607,6 +607,7 @@ extern "C" HRESULT RegistrationSessionBegin(
607 HKEY hkRegistration = NULL; 607 HKEY hkRegistration = NULL;
608 BOOL fCreated = FALSE; 608 BOOL fCreated = FALSE;
609 LPWSTR sczPublisher = NULL; 609 LPWSTR sczPublisher = NULL;
610 DWORD er = ERROR_SUCCESS;
610 611
611 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE"); 612 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE");
612 613
@@ -776,6 +777,15 @@ extern "C" HRESULT RegistrationSessionBegin(
776 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1); 777 hr = RegWriteNumber(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT, 1);
777 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT); 778 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
778 } 779 }
780 else
781 {
782 er = ::RegDeleteValueW(hkRegistration, REGISTRY_BUNDLE_SYSTEM_COMPONENT);
783 if (ERROR_FILE_NOT_FOUND == er || ERROR_PATH_NOT_FOUND == er)
784 {
785 er = ERROR_SUCCESS;
786 }
787 ExitOnWin32Error(er, hr, "Failed to delete %ls value.", REGISTRY_BUNDLE_SYSTEM_COMPONENT);
788 }
779 789
780 // QuietUninstallString: [path to exe] /uninstall /quiet 790 // QuietUninstallString: [path to exe] /uninstall /quiet
781 hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /%ls /uninstall /quiet", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM); 791 hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_QUIET_UNINSTALL_STRING, L"\"%ls\" /%ls /uninstall /quiet", pRegistration->sczCacheExecutablePath, BURN_COMMANDLINE_SWITCH_CLEAN_ROOM);
@@ -829,40 +839,6 @@ LExit:
829 839
830 840
831/******************************************************************* 841/*******************************************************************
832 RegistrationSessionResume - Resumes a previous run session.
833
834*******************************************************************/
835extern "C" HRESULT RegistrationSessionResume(
836 __in BURN_REGISTRATION* pRegistration,
837 __in BURN_VARIABLES* pVariables,
838 __in BOOTSTRAPPER_REGISTRATION_TYPE registrationType
839 )
840{
841 HRESULT hr = S_OK;
842 HKEY hkRegistration = NULL;
843
844 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE");
845
846 // open registration key
847 hr = RegOpen(pRegistration->hkRoot, pRegistration->sczRegistrationKey, KEY_WRITE, &hkRegistration);
848 ExitOnFailure(hr, "Failed to open registration key.");
849
850 // update resume mode
851 hr = UpdateResumeMode(pRegistration, hkRegistration, BURN_RESUME_MODE_ACTIVE, registrationType, FALSE);
852 ExitOnFailure(hr, "Failed to update resume mode.");
853
854 // update display name
855 hr = UpdateBundleNameRegistration(pRegistration, pVariables, hkRegistration, BOOTSTRAPPER_REGISTRATION_TYPE_INPROGRESS == registrationType);
856 ExitOnFailure(hr, "Failed to update name and publisher.");
857
858LExit:
859 ReleaseRegKey(hkRegistration);
860
861 return hr;
862}
863
864
865/*******************************************************************
866 RegistrationSessionEnd - Unregisters a run session from the system. 842 RegistrationSessionEnd - Unregisters a run session from the system.
867 843
868 *******************************************************************/ 844 *******************************************************************/
@@ -950,6 +926,7 @@ extern "C" HRESULT RegistrationSaveState(
950 LPWSTR sczValueName = NULL; 926 LPWSTR sczValueName = NULL;
951 DWORD dwType = 0; 927 DWORD dwType = 0;
952 DWORD dwNumberOfExistingValues = 0; 928 DWORD dwNumberOfExistingValues = 0;
929 DWORD er = ERROR_SUCCESS;
953 930
954 931
955 // write data to file 932 // write data to file
@@ -989,8 +966,8 @@ extern "C" HRESULT RegistrationSaveState(
989 966
990 ExitOnFailure(hr, "Failed to enumerate value %u", i); 967 ExitOnFailure(hr, "Failed to enumerate value %u", i);
991 968
992 hr = RegDeleteValue(hkRegistration, sczValueName); 969 er = ::RegDeleteValueW(hkRegistration, sczValueName);
993 ExitOnFailure(hr, "Failed to delete registration variable value."); 970 ExitOnWin32Error(er, hr, "Failed to delete registration variable value.");
994 } 971 }
995 972
996 // Write variables. 973 // Write variables.
@@ -1313,7 +1290,7 @@ static HRESULT UpdateResumeMode(
1313 } 1290 }
1314 else 1291 else
1315 { 1292 {
1316 ExitOnWin32Error(er, hr, "Failed to open run key."); 1293 ExitOnFailure(hr, "Failed to open run key.");
1317 1294
1318 er = ::RegDeleteValueW(hkRun, pRegistration->sczId); 1295 er = ::RegDeleteValueW(hkRun, pRegistration->sczId);
1319 if (ERROR_FILE_NOT_FOUND == er) 1296 if (ERROR_FILE_NOT_FOUND == er)