Chromium Code Reviews| Index: chrome/installer/util/self_reg_work_item.cc |
| =================================================================== |
| --- chrome/installer/util/self_reg_work_item.cc (revision 98956) |
| +++ chrome/installer/util/self_reg_work_item.cc (working copy) |
| @@ -27,6 +27,17 @@ |
| 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. Note that this will do the wrong thing for |
| +// high-valued facility codes. |
| +HRESULT UnMuxHRESULTErrorCode(HRESULT hr, int* error_code) { |
| + DCHECK(error_code); |
| + *error_code = (hr & 0x07800000) >> 23; |
|
grt (UTC plus 2)
2011/09/06 14:56:55
why not do this only if the customer bit is set?
robertshield
2011/09/06 20:23:42
Good idea, done.
|
| + return hr & 0xF87FFFFF; |
| +} |
| + |
| bool SelfRegWorkItem::RegisterDll(bool do_register) { |
| VLOG(1) << "COM " << (do_register ? "registration of " : "unregistration of ") |
| << dll_path_; |
| @@ -52,9 +63,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"; |