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

Unified Diff: chrome/installer/util/self_reg_work_item.cc

Issue 8055021: Merge 100224 - Make Chrome Frame registration and unregistration more robust and make it return e... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: Created 9 years, 3 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_frame/chrome_tab.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/util/self_reg_work_item.cc
===================================================================
--- chrome/installer/util/self_reg_work_item.cc (revision 102980)
+++ chrome/installer/util/self_reg_work_item.cc (working copy)
@@ -27,6 +27,26 @@
SelfRegWorkItem::~SelfRegWorkItem() {
}
+// This is designed to unmux error codes that may be shoe-horned in to HRESULT
+// return codes by ORing a number into the top four bits of the facility code
+// Any number thus found will be returned in |error_code|. The "cleaned"
+// HRESULT is then returned.
+//
+// This only has an effect if the customer bit is set in the HRESULT, if it is
+// not set then *error_code will be unchanged and the original HRESULT is
+// returned.
+//
+// Note that this will do the wrong thing for high-valued facility codes.
+HRESULT UnMuxHRESULTErrorCode(HRESULT hr, int* error_code) {
+ DCHECK(error_code);
+ if (hr & (1 << 29)) {
+ *error_code = (hr & 0x07800000) >> 23;
+ return hr & 0xF87FFFFF;
+ }
+
+ return hr;
+}
+
bool SelfRegWorkItem::RegisterDll(bool do_register) {
VLOG(1) << "COM " << (do_register ? "registration of " : "unregistration of ")
<< dll_path_;
@@ -52,9 +72,12 @@
HRESULT hr = register_server_func();
success = SUCCEEDED(hr);
if (!success) {
- PLOG(ERROR) << "Failed to " << (do_register ? "register" : "unregister")
- << " DLL at " << dll_path_.c_str() <<
- base::StringPrintf(" 0x%08X", hr);
+ int error_code = 0;
+ HRESULT unmuxed_hr = UnMuxHRESULTErrorCode(hr, &error_code);
+ LOG(ERROR) << "Failed to " << (do_register ? "register" : "unregister")
+ << " DLL at " << dll_path_.c_str() << ", hr="
+ << base::StringPrintf(" 0x%08X", unmuxed_hr) << ", code="
+ << error_code;
}
} else {
LOG(ERROR) << "COM registration export function not found";
« no previous file with comments | « no previous file | chrome_frame/chrome_tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698