aboutsummaryrefslogtreecommitdiff
path: root/src/burn
diff options
context:
space:
mode:
Diffstat (limited to 'src/burn')
-rw-r--r--src/burn/engine/registration.cpp13
-rw-r--r--src/burn/test/BurnUnitTest/RegistrationTest.cpp2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/burn/engine/registration.cpp b/src/burn/engine/registration.cpp
index 0117a993..01ed30d7 100644
--- a/src/burn/engine/registration.cpp
+++ b/src/burn/engine/registration.cpp
@@ -10,6 +10,7 @@ const LPCWSTR REGISTRY_RUN_ONCE_KEY = L"SOFTWARE\\Microsoft\\Windows\\CurrentVer
10const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon"; 10const LPCWSTR REGISTRY_BUNDLE_DISPLAY_ICON = L"DisplayIcon";
11const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion"; 11const LPCWSTR REGISTRY_BUNDLE_DISPLAY_VERSION = L"DisplayVersion";
12const LPCWSTR REGISTRY_BUNDLE_ESTIMATED_SIZE = L"EstimatedSize"; 12const LPCWSTR REGISTRY_BUNDLE_ESTIMATED_SIZE = L"EstimatedSize";
13const LPCWSTR REGISTRY_BUNDLE_INSTALL_DATE = L"InstallDate";
13const LPCWSTR REGISTRY_BUNDLE_PUBLISHER = L"Publisher"; 14const LPCWSTR REGISTRY_BUNDLE_PUBLISHER = L"Publisher";
14const LPCWSTR REGISTRY_BUNDLE_HELP_LINK = L"HelpLink"; 15const LPCWSTR REGISTRY_BUNDLE_HELP_LINK = L"HelpLink";
15const LPCWSTR REGISTRY_BUNDLE_HELP_TELEPHONE = L"HelpTelephone"; 16const LPCWSTR REGISTRY_BUNDLE_HELP_TELEPHONE = L"HelpTelephone";
@@ -610,6 +611,7 @@ extern "C" HRESULT RegistrationSessionBegin(
610 HKEY hkRegistration = NULL; 611 HKEY hkRegistration = NULL;
611 BOOL fCreated = FALSE; 612 BOOL fCreated = FALSE;
612 LPWSTR sczPublisher = NULL; 613 LPWSTR sczPublisher = NULL;
614 SYSTEMTIME systime = { };
613 DWORD er = ERROR_SUCCESS; 615 DWORD er = ERROR_SUCCESS;
614 616
615 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE"); 617 AssertSz(BOOTSTRAPPER_REGISTRATION_TYPE_NONE != registrationType, "Registration type can't be NONE");
@@ -814,10 +816,17 @@ extern "C" HRESULT RegistrationSessionBegin(
814 ExitOnFailure(hr, "Failed to write update registration."); 816 ExitOnFailure(hr, "Failed to write update registration.");
815 } 817 }
816 818
817 // Only set estimated size here for the first time. 819 // Only set install date and initial estimated size here for the first time.
818 // It will always get updated at the end of the session. 820 // Estimated size will always get updated at the end of the session.
819 if (fCreated) 821 if (fCreated)
820 { 822 {
823 // Write the install date.
824 ::GetLocalTime(&systime);
825
826 hr = RegWriteStringFormatted(hkRegistration, REGISTRY_BUNDLE_INSTALL_DATE, L"%04u%02u%02u", systime.wYear, systime.wMonth, systime.wDay);
827 ExitOnFailure(hr, "Failed to write %ls value.", REGISTRY_BUNDLE_INSTALL_DATE);
828
829 // Write the initial estimated size.
821 hr = UpdateEstimatedSize(hkRegistration, qwEstimatedSize); 830 hr = UpdateEstimatedSize(hkRegistration, qwEstimatedSize);
822 ExitOnFailure(hr, "Failed to update estimated size."); 831 ExitOnFailure(hr, "Failed to update estimated size.");
823 } 832 }
diff --git a/src/burn/test/BurnUnitTest/RegistrationTest.cpp b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
index f95c011f..fc84511d 100644
--- a/src/burn/test/BurnUnitTest/RegistrationTest.cpp
+++ b/src/burn/test/BurnUnitTest/RegistrationTest.cpp
@@ -111,6 +111,7 @@ namespace Bootstrapper
111 Assert::True(Directory::Exists(cacheDirectory), "Cache directory didn't exist."); 111 Assert::True(Directory::Exists(cacheDirectory), "Cache directory didn't exist.");
112 Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe"))), "Bundle exe wasn't cached."); 112 Assert::True(File::Exists(Path::Combine(cacheDirectory, gcnew String(L"setup.exe"))), "Bundle exe wasn't cached.");
113 113
114 this->ValidateUninstallKeyString(L"InstallDate", DateTime::Now.ToString("yyyyMMdd"));
114 this->ValidateUninstallKeyResume(Int32(BURN_RESUME_MODE_ACTIVE)); 115 this->ValidateUninstallKeyResume(Int32(BURN_RESUME_MODE_ACTIVE));
115 this->ValidateRunOnceKeyEntry(cacheExePath); 116 this->ValidateRunOnceKeyEntry(cacheExePath);
116 117
@@ -121,6 +122,7 @@ namespace Bootstrapper
121 // verify that registration was removed 122 // verify that registration was removed
122 Assert::False(Directory::Exists(cacheDirectory), "Cache directory wasn't removed."); 123 Assert::False(Directory::Exists(cacheDirectory), "Cache directory wasn't removed.");
123 124
125 this->ValidateUninstallKeyNull(L"InstallDate");
124 this->ValidateUninstallKeyNull(L"Resume"); 126 this->ValidateUninstallKeyNull(L"Resume");
125 this->ValidateRunOnceKeyString(TEST_BUNDLE_ID, nullptr); 127 this->ValidateRunOnceKeyString(TEST_BUNDLE_ID, nullptr);
126 } 128 }