зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1305120: CPU microcode as a separate field in the crash report. r=ted.mielczarek
MozReview-Commit-ID: 9g8ku4Et6sM --HG-- extra : rebase_source : 9f6dec72efc99b7d3a8b14e11b00509d2d3fc656
This commit is contained in:
Родитель
ce3cbbcf73
Коммит
9624c5aac5
|
@ -3414,6 +3414,45 @@ XREMain::XRE_mainInit(bool* aExitFlag)
|
|||
gSafeMode = true;
|
||||
#endif
|
||||
|
||||
#ifdef XP_WIN
|
||||
{
|
||||
// Add CPU microcode version to the crash report as "CPUMicrocodeVersion".
|
||||
// It feels like this code may belong in nsSystemInfo instead.
|
||||
int cpuUpdateRevision = -1;
|
||||
HKEY key;
|
||||
static const WCHAR keyName[] =
|
||||
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName , 0, KEY_QUERY_VALUE, &key) == ERROR_SUCCESS) {
|
||||
|
||||
DWORD updateRevision[2];
|
||||
DWORD len = sizeof(updateRevision);
|
||||
DWORD vtype;
|
||||
|
||||
// Windows 7 uses Update Signature, 8 uses "Update Revision".
|
||||
// Take the first one we find.
|
||||
LPCWSTR choices[] = {L"Update Signature", L"Update Revision"};
|
||||
for (size_t oneChoice=0; oneChoice<ArrayLength(choices); oneChoice++) {
|
||||
if (RegQueryValueExW(key, choices[oneChoice],
|
||||
0, &vtype,
|
||||
reinterpret_cast<LPBYTE>(updateRevision),
|
||||
&len) == ERROR_SUCCESS &&
|
||||
vtype == REG_BINARY && len == sizeof(updateRevision)) {
|
||||
// The first word is unused
|
||||
cpuUpdateRevision = static_cast<int>(updateRevision[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cpuUpdateRevision > 0) {
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
|
||||
nsPrintfCString("0x%x",
|
||||
cpuUpdateRevision));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
|
||||
gSafeMode ? NS_LITERAL_CSTRING("1") :
|
||||
|
|
Загрузка…
Ссылка в новой задаче