Skip to content

Creates a unique identifier based on the properties of hardware installed; also called HWID, HID, or hardware id/identity. Uses Windows Management Instrument (WMI) and standard code structuring to provide ease-of-use.

License

njmacmurchy96/hardwareid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

C#/VB.NET Hardware ID Generator (HWID / HardwareID)

An API that makes efficient use of the Windows Management Instrument Win32 Providers to generate a unique identifier (Hardware ID) based upon the properties of the Motherboard, CDROM, BIOS, HDD, GPU, and CPU. This APIs main purpose is to allow software to remain locked to one PC (or multiple) depending upon its utilization.

Windows Manage Instruments based on the Win32 Provider Classes (WMI)

Usage

C# Syntax Usage:

//Initialize instance of HardwareID
HardwareID HWID = new HardwareID();

//Generate Unique ID based upon hardware of current PC.
Console.WriteLine(HWID.Generate());

//Every time *Generate* is called it sets the *LastID* property.
Console.WriteLine(HWID.LastID)

//The internal *GetProperties* function uses a string array that follows the format { WMI_CLASS, Properties... }. 
//                           Motherboard      --> Parameters
// string[] MOTHERBOARD = { "Win32_BaseBoard", "Name", "Manufacturer", "Version" };
GetProperties(WMI_CLASSES.MOTHERBOARD);

private static string GetProcessorProperties()
{
    return GetProperties(WMI_CLASSES.CPU);
}

VB.NET Syntax Usage:

'Initialize instance of HardwareID
Dim HWID As New HardwareID()

'Generate Unique ID based upon hardware of current PC
Console.WriteLine(HWID.Generate())

'Every time Generate is called LastID is set
Console.WriteLine(HWID.LastID)

'The internal *GetProperties* function uses a string array that follows the format { WMI_CLASS, Properties... }. 
'                                              Motherboard      --> Parameters
' Dim MOTHERBOARD As String() = New String() { "Win32_BaseBoard", "Name", "Manufacturer", "Version" }
Private Shared Function GetProcessorProperties()
    Return GetProperties(WMI_CLASSES.CPU)
End Function

Every property gathered from the WMI class is hashed together with SHA1 and then turned into a Hex string.

//Output: A7EA-FB91-9995-84B7-E843-CCB4-4E81-51B9-2B3B-6587

Updates

  • Increased speed and efficiency.
  • Found reliable properties of each piece of hardware.

TO-DO

  • Further Optimize WMI Access & Query Generation
  • Check if Hardware Exists, if not then attempt other options (Runtime Error Prevention)

Issues

  • Assumes CDROMDrive exists.

License
GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007

About

Creates a unique identifier based on the properties of hardware installed; also called HWID, HID, or hardware id/identity. Uses Windows Management Instrument (WMI) and standard code structuring to provide ease-of-use.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published