Any personal computer has components that carry a certain serial quantity. Some figures are assigned when the functioning program is installed, but some are in fact embedded in the hardware. Employing C#, a number of embedded serials can be combined to generate a special personal computer ID.
Why a unique serial? A very simple reason is for branding software program to a unique personal computer. A probably rigid licensing procedure, it can be rather productive relying on how it is used.
For this write-up we will use two serials, the tough push and the CPU. Both of those will be obtained with the designed-in C# course Procedure.Management.
If you make a New Task in Visible Studio 2005 (any of the editions), you will notice the line “utilizing Technique.Administration” does not function. You have to add it manually:
- Go to the Answer Explorer
- Appropriate-simply click on References and click “Add Reference…”
- Find Program.Management from the .Net tab.
At the time established up it is straightforward to get the hardware ID’s.
The tricky push ID’s relies upon of course on the harddrive. Right here is the pseudocode:
- Produce a ManagementObject with the string “earn32_logicaldisk.deviceid=[drive letter here]:”
- Accessibility the serial with the index “VolumeSerialNumber”, for instance disk[“VolumeSerialNumber”] where disk is the ManagementObject
The CPU ID is essentially instead versatile also. Lots of personal computers presently have additional than 1 CPU. You use the initial a person as in my instance, or several kinds:
- Produce a ManagementObject with the string “get32_processor”
- Go by means of the offered processors
- Obtain the house like so: managObject.Houses[“processorID”]
Combining them can be easy or intricate. Basically adding them together in a row is effective just high-quality. For my instance some redundant 0’s are eliminated just before coming the ID’s of the to start with accessible push and the initially CPU.
Try out it out to see how the figures seem.
More Stories
How to Strengthen Your Computer’s Performance
Surviving Lacking Futon Body Components Nightmares
Data Recovery Myths – Logic Board and Platter Replacement