mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1128472 - Part 3. Vendor string on windows. r=aklotz
This commit is contained in:
parent
79db27187c
commit
9a9792e17d
@ -80,7 +80,7 @@ Structure::
|
||||
cpu: {
|
||||
count: <number>, // desktop only, e.g. 8, or null on failure - logical cpus
|
||||
cores: <number>, // desktop only, e.g., 4, or null on failure - physical cores
|
||||
vendor: <string>, // e.g. "GenuineIntel", or null on failure, only on mac & linux
|
||||
vendor: <string>, // desktop only, e.g. "GenuineIntel", or null on failure
|
||||
family: <string>, // desktop only, null on failure
|
||||
model: <string>, // desktop only, null on failure
|
||||
stepping: <string>, // desktop only, null on failure
|
||||
|
@ -368,10 +368,7 @@ function checkSystemSection(data) {
|
||||
|
||||
if (gIsWindows || gIsMac || gIsLinux) {
|
||||
let EXTRA_CPU_FIELDS = ["cores", "model", "family", "stepping",
|
||||
"l2cacheKB", "l3cacheKB", "speedMHz"];
|
||||
if (gIsMac || gIsLinux) {
|
||||
EXTRA_CPU_FIELDS.push("vendor");
|
||||
}
|
||||
"l2cacheKB", "l3cacheKB", "speedMHz", "vendor"];
|
||||
|
||||
for (let f of EXTRA_CPU_FIELDS) {
|
||||
// Note this is testing TelemetryEnvironment.js only, not that the
|
||||
|
@ -396,13 +396,28 @@ nsSystemInfo::Init()
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, keyName , 0, KEY_QUERY_VALUE, &key)
|
||||
== ERROR_SUCCESS) {
|
||||
DWORD data, len;
|
||||
DWORD data, len, vtype;
|
||||
len = sizeof(data);
|
||||
|
||||
if (RegQueryValueEx(key, L"~Mhz", 0, 0, reinterpret_cast<LPBYTE>(&data),
|
||||
&len) == ERROR_SUCCESS) {
|
||||
cpuSpeed = static_cast<int>(data);
|
||||
}
|
||||
|
||||
// Limit to 64 double byte characters, should be plenty, but create
|
||||
// a buffer one larger as the result may not be null terminated. If
|
||||
// it is more than 64, we will not get the value.
|
||||
wchar_t cpuVendorStr[64+1];
|
||||
len = sizeof(cpuVendorStr)-2;
|
||||
if (RegQueryValueExW(key, L"VendorIdentifier",
|
||||
0, &vtype,
|
||||
reinterpret_cast<LPBYTE>(cpuVendorStr),
|
||||
&len) == ERROR_SUCCESS &&
|
||||
vtype == REG_SZ && len % 2 == 0 && len > 1) {
|
||||
cpuVendorStr[len/2] = 0; // In case it isn't null terminated
|
||||
CopyUTF16toUTF8(nsDependentString(cpuVendorStr), cpuVendor);
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user