You can get the cpu freq from the registry, or you can calculate it yourself.
HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0\~MHZ
You can get info about the harddisk in roughly the same place:
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\Scsi\Scsi Port 0\Scsi Bus 0\Target Id 0\Logical Unit Id 0
In order to compute the speed yourself, you can use the following code. The value returned is the speed in MHz. Divide by 1000 to get GHz.
unsigned int hiPart, loPart;
unsigned __int64 CycleCount()
{
__int64 result;
asm(
"rdtsc\n"
"mov %eax, _loPart\n"
"mov %edx, _hiPart"
);
result = hiPart;
result <<= 32;
result |= loPart;
return result;
}
int GetCpuSpeed()
{
unsigned __int64 start, stop, elapsed;
unsigned int total;
start = CycleCount();
Sleep(1000);
stop = CycleCount();
elapsed = stop - start;
total = (unsigned)(stop/1000000);
return total;
}
In my case, the registry returns "2494" (Mhz) and the above snippet returns a value of 2,492 (Mhz).