summaryrefslogtreecommitdiffstats
path: root/chrome/installer/mini_installer
diff options
context:
space:
mode:
authorkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 00:49:23 +0000
committerkuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-16 00:49:23 +0000
commitec648f82550abbef6ac12b5c7417b3ccbb83f136 (patch)
treec768bc0fd780e40354060321a10d6c56499b8924 /chrome/installer/mini_installer
parent26ff25e5aa52a060e93783c654ae0829f576cea1 (diff)
downloadchromium_src-ec648f82550abbef6ac12b5c7417b3ccbb83f136.zip
chromium_src-ec648f82550abbef6ac12b5c7417b3ccbb83f136.tar.gz
chromium_src-ec648f82550abbef6ac12b5c7417b3ccbb83f136.tar.bz2
Set magic string in registry to enable fallback to full installer in case of 3 stage updates.
BUG=12832 Review URL: http://codereview.chromium.org/126157 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18468 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/mini_installer')
-rw-r--r--chrome/installer/mini_installer/mini_installer.cc29
-rw-r--r--chrome/installer/mini_installer/mini_installer.h12
2 files changed, 39 insertions, 2 deletions
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index 9fe42c0..84c7d94 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -143,6 +143,29 @@ bool ReadValueFromRegistry(HKEY root_key, const wchar_t *sub_key,
return false;
}
+// This function sets the flag in registry to indicate that Google Update
+// should try full installer next time. If the current installer works, this
+// flag is cleared by setup.exe at the end of install.
+void SetFullInstallerFlag(HKEY root_key) {
+ HKEY key;
+ if (::RegOpenKeyEx(root_key, kApRegistryKey, NULL,
+ KEY_READ | KEY_SET_VALUE, &key) != ERROR_SUCCESS)
+ return;
+
+ wchar_t value[128];
+ size_t size = _countof(value);
+ if ((::RegQueryValueEx(key, kApRegistryValueName, NULL, NULL,
+ reinterpret_cast<LPBYTE>(value),
+ reinterpret_cast<LPDWORD>(&size)) == ERROR_SUCCESS) &&
+ (!StrEndsWith(value, kFullInstallerSuffix)) &&
+ (SafeStrCat(value, size, kFullInstallerSuffix))) {
+ ::RegSetValueEx(key, kApRegistryValueName, 0, REG_SZ,
+ reinterpret_cast<LPBYTE>(value),
+ lstrlen(value) * sizeof(wchar_t));
+ }
+
+ ::RegCloseKey(key);
+}
// Gets the setup.exe path from Registry by looking the value of Uninstall
// string, strips the arguments for uninstall and returns only the full path
@@ -472,6 +495,12 @@ int WMain(HMODULE module) {
if (!GetWorkDir(module, base_path))
return 101;
+ // Set the magic suffix in registry to try full installer next time. We ignore
+ // any errors here and we try to set the suffix for user level as well as
+ // system level.
+ SetFullInstallerFlag(HKEY_LOCAL_MACHINE);
+ SetFullInstallerFlag(HKEY_CURRENT_USER);
+
wchar_t archive_path[MAX_PATH] = {0};
wchar_t setup_path[MAX_PATH] = {0};
if (!UnpackBinaryResources(module, base_path, archive_path, MAX_PATH,
diff --git a/chrome/installer/mini_installer/mini_installer.h b/chrome/installer/mini_installer/mini_installer.h
index b1afc19..fde3656 100644
--- a/chrome/installer/mini_installer/mini_installer.h
+++ b/chrome/installer/mini_installer/mini_installer.h
@@ -24,6 +24,8 @@ const wchar_t kCmdNewSetupExe[] = L" --new-setup-exe";
// Temp directory prefix that this process creates
const wchar_t kTempPrefix[] = L"CR_";
+// Google Update will use full installer if this suffix is found in ap key.
+const wchar_t kFullInstallerSuffix[] = L"-full";
// The resource types that would be unpacked from the mini installer.
// 'BN' is uncompressed binary and 'BL' is LZ compressed binary.
@@ -32,15 +34,21 @@ const wchar_t kLZCResourceType[] = L"BL";
const wchar_t kLZMAResourceType[] = L"B7";
// Registry key to get uninstall command
-const wchar_t kUninstallRegistryValueName[] = L"UninstallString";
+const wchar_t kApRegistryValueName[] = L"ap";
// Registry key that tells Chrome installer not to delete extracted files.
const wchar_t kCleanupRegistryValueName[] = L"ChromeInstallerCleanup";
-// Paths for the above two registry keys
+// Registry key to get uninstall command
+const wchar_t kUninstallRegistryValueName[] = L"UninstallString";
+
+// Paths for the above registry keys
#if defined(GOOGLE_CHROME_BUILD)
+const wchar_t kApRegistryKey[] = L"Software\\Google\\Update\\ClientState\\"
+ L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
const wchar_t kUninstallRegistryKey[] =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Google Chrome";
const wchar_t kCleanupRegistryKey[] = L"Software\\Google";
#else
+const wchar_t kApRegistryKey[] = L"Software\\Chromium";
const wchar_t kUninstallRegistryKey[] =
L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Chromium";
const wchar_t kCleanupRegistryKey[] = L"Software\\Chromium";