views:

33

answers:

1

Hello,

I have this function that creates a unique number for hard-disk and CPU combination.

    GetVolumeInformation(drv, szNameBuffer, 256, &dwHddUnique, NULL, NULL, NULL, NULL);

    SYSTEM_INFO si;
    GetSystemInfo(&si);

    dwProcessorUnique = si.dwProcessorType + si.wProcessorArchitecture + si.wProcessorRevision;
    dwUniqueKey = dwProcessorUnique + dwHddUnique;

It returns different numbers if I format my hard-disk and install a new Windows. Any ideas, why?

Thank you.

Edit:

OK, Got it (http://msdn.microsoft.com/en-us/library/aa364993(VS.85).aspx):

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.

A: 

Maybe because when you format your hard disk it generates a new unique UUID for it? (so dwHddUnique would be different)

pakore
Please see my edit. I will accept your answer, anyways.
frbry
Well, It's more or less what I said :)
pakore