How to get unique machine signature without WMI?
Asked Answered
D

3

4

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.

Donte answered 16/5, 2009 at 12:57 Comment(2)
Which language would you like your example in?Mesentery
I am looking for appropriate API calls which can give me this information. Sample in any language (C#, C++, C, Pascal) will do.Donte
M
3

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.

Mesentery answered 16/5, 2009 at 13:22 Comment(1)
MSDN online will tell you that GetVolumeInformation is only available from Windows 2000, but that's not true. Recent versions of the MSDN library content like to deny the existence of Windows 9x, but if you look in an old version of the MSDN library (I looked in the one that came with Visual Studio 2005) it shows that GetVolumeInformation is available in Windows 98.Lermontov
C
2

You can combine different hardware information in order to create a unique key.

For example, CPU ID, MAC address etc etc. You retrieve them, combine them, encrypt them and you have a unique representation of the hardware setup of this machine.

Try googling about the subject: how to read hardware information.

From what I can see there is a very useful post in CodeProject: How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...).

Curious answered 16/5, 2009 at 13:10 Comment(2)
Thats exactly the question! HOW to get hold of this information?Donte
the example refers to .NET 2.0 which is OK for your Win98 requirementCurious
R
1

Look through the WinAPI's kernel32 and user32 library. It has all sorts of goodies like EnumDisplayDevices, GetLogicalDrives, GlobalMemoryStatus, GetVolumeInformation, etc, etc. I Like to use PInvoke to browse the API since it gives me the C# wrapper code - but MSDN will have it all as well in the Windows SDK.

@novatrust's answer regarding the hard drive serial is a good one - but can be combined with more. I've provided the GetVolumeInformation API link to pinvoke above, but a simple Google should work as well.

Remise answered 16/5, 2009 at 13:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.