summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Knight <andrew.knight@digia.com>2014-03-24 15:16:58 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-24 19:15:53 +0100
commit7beaf99c64cec1ce991c683c3f8ed71783eb9cfe (patch)
tree6e93529661362ecbb320c8181b2580e1f86c5771
parent596a088b27447de3e67eece0fb5301119d9f0326 (diff)
downloadqttools-7beaf99c64cec1ce991c683c3f8ed71783eb9cfe.tar.gz
qttools-7beaf99c64cec1ce991c683c3f8ed71783eb9cfe.tar.bz2
qttools-7beaf99c64cec1ce991c683c3f8ed71783eb9cfe.zip
CoreCon: Improve error messaging
This adds another HRESULT_FACILITY to the conmanui whitelist, and adds fallback to qt_error_string if the string is not found. Change-Id: Ib4dddeca5cf5ba76e3c7fc5254f85e5a6949febe Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com> Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
-rw-r--r--src/shared/corecon/corecon.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/shared/corecon/corecon.cpp b/src/shared/corecon/corecon.cpp
index 579d7795..683e219b 100644
--- a/src/shared/corecon/corecon.cpp
+++ b/src/shared/corecon/corecon.cpp
@@ -353,11 +353,12 @@ QString CoreConServer::formatError(HRESULT hr) const
wchar_t error[1024];
HMODULE module = 0;
DWORD origin = HRESULT_FACILITY(hr);
- if (origin == 0x973 || origin == 0x974)
+ if (origin == 0x973 || origin == 0x974 || origin == 0x103)
module = d->langModule;
- if (module)
- LoadString(module, HRESULT_CODE(hr), error, sizeof(error)/sizeof(wchar_t));
- else
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, 0, error, sizeof(error)/sizeof(wchar_t), NULL);
- return QString::fromWCharArray(error).trimmed();
+ if (module) {
+ int length = LoadString(module, HRESULT_CODE(hr), error, sizeof(error)/sizeof(wchar_t));
+ if (length)
+ return QString::fromWCharArray(error, length).trimmed();
+ }
+ return qt_error_string(hr);
}