Hello,
I have this function that creates a unique number for hard-disk and CPU combination.
DWORD hw_hash()
{
char drv[4];
char szNameBuffer[256];
DWORD dwHddUnique;
DWORD dwProcessorUnique;
DWORD dwUniqueKey;
char *sysDrive = getenv ("SystemDrive");
strcpy(drv, sysDrive);
drv[2] = '\\';
drv[3] = 0;
GetVolumeInformation(drv, szNameBuffer, 256, &dwHddUnique, NULL, NULL, NULL, NULL);
SYSTEM_INFO si;
GetSystemInfo(&si);
dwProcessorUnique = si.dwProcessorType + si.wProcessorArchitecture + si.wProcessorRevision;
dwUniqueKey = dwProcessorUnique + dwHddUnique;
return dwUniqueKey;
}
It returns different numbers if I format my hard-disk and install a new Windows. Any ideas, why?
Thank you.
Edit:
OK, Got it:
This function returns the volume
serial number that the operating
system assigns when a hard disk is
formatted. To programmatically obtain
the hard disk's serial number that the
manufacturer assigns, use the Windows
Management Instrumentation (WMI)
Win32_PhysicalMedia property
SerialNumber.
I should do more research before posting my problems online. Sorry to bother you, let's keep this here in case anybody else can need it.