Bug 1315213 - Support reading microcode version from the registry when it is a REG_DWORD value (sometimes used for AMD CPUs). r=milan
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Thu, 01 Dec 2016 09:31:14 +0100
changeset 324978 bb0dcd3dc89305e32a5f3e80c4149f862a7ed282
parent 324977 77ce40d94cfabce30efafe88835cb7bbe485ba19
child 324979 46f6ea9600f0aa6dbf7433f4e2295b3bad241e45
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmilan
bugs1315213
milestone53.0a1
Bug 1315213 - Support reading microcode version from the registry when it is a REG_DWORD value (sometimes used for AMD CPUs). r=milan
toolkit/xre/nsAppRunner.cpp
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -3445,21 +3445,25 @@ XREMain::XRE_mainInit(bool* aExitFlag)
 
       // 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;
+                             &len) == ERROR_SUCCESS) {
+          if (vtype == REG_BINARY && len == sizeof(updateRevision)) {
+            // The first word is unused
+            cpuUpdateRevision = static_cast<int>(updateRevision[1]);
+            break;
+          } else if (vtype == REG_DWORD && len == sizeof(updateRevision[0])) {
+            cpuUpdateRevision = static_cast<int>(updateRevision[0]);
+            break;
+          }
         }
       }
     }
 
 #ifdef MOZ_CRASHREPORTER
     if (cpuUpdateRevision > 0) {
       CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
                                          nsPrintfCString("0x%x",