Update cpu_speed.c

This commit is contained in:
Jan Bodnar 2016-02-01 12:14:00 +01:00
parent 24f2532913
commit 200f998402

View File

@ -8,12 +8,12 @@ int wmain(void) {
HKEY key;
long r = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_READ, &key);
L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0, KEY_READ, &key);
if (r != ERROR_SUCCESS) {
wprintf(L"RegOpenKeyExW() failed %ld", GetLastError());
return 1;
return 1;
}
r = RegQueryValueExW(key, L"~MHz", NULL, NULL, (LPBYTE) &mhz, &BufSize);
@ -26,5 +26,13 @@ int wmain(void) {
wprintf(L"CPU speed: %lu MHz\n", mhz);
r = RegCloseKey(key);
if (r != ERROR_SUCCESS) {
wprintf(L"Failed to close registry handle %ld", GetLastError());
return 1;
}
return 0;
}