Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5524)

Unified Diff: chrome/installer/mini_installer/mini_installer.cc

Issue 1247993002: Return Windows error code when create-process fails. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: report exit-code and last-error through registry Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/installer/mini_installer/mini_installer_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/mini_installer/mini_installer.cc
diff --git a/chrome/installer/mini_installer/mini_installer.cc b/chrome/installer/mini_installer/mini_installer.cc
index acbdc260ac6c8ed2c744bb29a7e25897dc6d3d1f..7bc51810443b904f5389e383a127e2467a559d0e 100644
--- a/chrome/installer/mini_installer/mini_installer.cc
+++ b/chrome/installer/mini_installer/mini_installer.cc
@@ -75,6 +75,7 @@ class RegKey {
// Write a REG_SZ value to the registry. |value| must be null-terminated.
// Returns ERROR_SUCCESS or an error code.
LONG WriteValue(const wchar_t* value_name, const wchar_t* value);
grt (UTC plus 2) 2015/07/24 14:49:10 some suggestions: - change this to WriteSZValue -
bcwhite 2015/07/24 17:08:01 Done.
+ LONG WriteDword(const wchar_t* value_name, DWORD value);
// Closes the key if it was open.
void Close();
@@ -120,6 +121,12 @@ LONG RegKey::WriteValue(const wchar_t* value_name, const wchar_t* value) {
(lstrlen(value) + 1) * sizeof(wchar_t));
}
+LONG RegKey::WriteDword(const wchar_t* value_name, DWORD value) {
+ return ::RegSetValueEx(key_, value_name, 0, REG_DWORD,
+ reinterpret_cast<const BYTE*>(&value),
+ sizeof(value));
+}
+
void RegKey::Close() {
if (key_ != NULL) {
::RegCloseKey(key_);
@@ -886,6 +893,19 @@ ProcessExitCode WMain(HMODULE module) {
if (ShouldDeleteExtractedFiles())
DeleteExtractedFiles(base_path.get(), archive_path.get(), setup_path.get());
+ const HKEY root_key =
grt (UTC plus 2) 2015/07/24 14:49:11 please move this into a helper function (WriteInst
bcwhite 2015/07/24 17:08:01 Done.
+ configuration.is_system_level() ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+ const wchar_t* app_guid = configuration.chrome_app_guid();
grt (UTC plus 2) 2015/07/24 14:49:11 this and SetInstallerFlags need to use the same Cl
bcwhite 2015/07/24 17:08:01 Done. Complicated logic, though. Please check th
+ const REGSAM key_access = KEY_QUERY_VALUE | KEY_SET_VALUE;
grt (UTC plus 2) 2015/07/24 14:49:11 looks like KEY_QUERY_VALUE isn't needed here.
+ RegKey key;
+ if (OpenClientStateKey(root_key, app_guid, key_access, &key)) {
+ key.WriteDword(kInstallerResultRegistryValue,
+ exit_code ? 1 /* FAILED_CUSTOM_ERROR */ : 0 /* SUCCESS */);
+ key.WriteDword(kInstallerErrorRegistryValue, exit_code);
+ key.WriteDword(kInstallerExtraCode1RegistryValue, ::GetLastError());
grt (UTC plus 2) 2015/07/24 14:49:11 GetLastError must be called immediately after a fa
bcwhite 2015/07/24 17:08:01 Weird. I wrote that for initial testing and chang
+ key.Close();
+ }
+
return exit_code;
}
@@ -894,6 +914,7 @@ ProcessExitCode WMain(HMODULE module) {
int MainEntryPoint() {
mini_installer::ProcessExitCode result =
mini_installer::WMain(::GetModuleHandle(NULL));
+
::ExitProcess(result);
}
« no previous file with comments | « no previous file | chrome/installer/mini_installer/mini_installer_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698