I know that a question has already been asked about generating a unique ID for a machine but my question is slightly different.
I want to know whether there are any other methods (API calls?) to get hardware information and NOT use WMI. I understand from MSDN that WMI is introduced in Win2000 so it doesnt seem to be available in Win98. I have an application that has to run even on Win98 (I know it sucks but what can you do?) and still get hold of hardware information.
I've done this several times for licensing projects. For the hard drive serial number use:
private static extern long GetVolumeInformation(string PathName, StringBuilder VolumeNameBuffer, UInt32 VolumeNameSize, ref UInt32 VolumeSerialNumber, ref UInt32 MaximumComponentLength, ref UInt32 FileSystemFlags, StringBuilder FileSystemNameBuffer, UInt32 FileSystemNameSize);
Use the VolumeSerialNumber
that is returned by the function.
Also, you may have thought about using the Windows Product ID (Located at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId
). Be careful, a large number of Windows XP users have pirated copies and share the same product keys.