Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Get Computer Unique ID

Posted on 1999-01-05
6
Medium Priority
?
458 Views
Last Modified: 2013-12-03
I need code to obtain a computer specific information, HDD serial number, BIOS date and so on.
0
Comment
Question by:VAM345
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 11

Expert Comment

by:alexo
ID: 1418077
This question pops about once or twice a month on EE.

If you want to do it for copy protection -- don't!  Two reasons:

1. This kind of copy protection is easy to break.

2. If a legitimate user upgrades his hardware and your program stops working, you'll get no return business and lots of bad publicity.

[I'm submitting this as a comment so you can delete the question]
0
 

Expert Comment

by:PeteI
ID: 1418078
With the exception of network cards, there's no PC hardware that's guaranteed to have a unique ID.

There are some quasi-unique values that are relatively easy to obtain.  For instance, you can get a volume serial number (a DWORD based on the date and time the volume was formatted) by calling GetVolumeInformation().

One reasonable was to uniquely identify a PC is to create a GUID (CoCreateGuid) and stash it on the system -- the registry is a good place.  The chance of two GUIDs matching is astronomically remote.


0
 
LVL 1

Author Comment

by:VAM345
ID: 1418079
Volume serial number is easy to fake.
With GUID can`t sure to that is same computer. With out LAN card GUID is not similar digit, obtain thah is same machine.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Expert Comment

by:PeteI
ID: 1418080
VAM345, Your comment is difficult to understand.

Note that I didn't specify that the volume serial number is guaranteed unique.  It's not.  It is, however, a well-distributed value that is _unlikely_ to change over time.

A GUID is a Globally Unique Identifier.  That means a GUID created on one machine via CoCreateGuid() will never match a GUID created on any other machine ever again, regardless of whether or not the machine has a network card.
0
 
LVL 1

Author Comment

by:VAM345
ID: 1418081
Problem is I need to obtain ID every time when I start program ant check that is same mashine.
0
 

Accepted Solution

by:
ddgamer earned 200 total points
ID: 1418082
I do not understand why you say the GetVolumeInformation() will not work.

It doesn't return a GUID, but lpdwVolSerialNum, or a pointer to a Dword.

So it seems that this number should be the same unless the user re-formats the drive.

--------------------------------------------------
The c code to do this is as follows:

// Your variables
static char szVolLabel[128];
static char szRootPath[MAX_PATH+1];
DWORD  dwVolSerialNum = 0;

//Make root path information
GetCurrentDirectory( MAX_PATH, szRootPath);
szRootPath[3] = 0;


//Get the Volume Information
GetVolumeInformation( szRootPath, szVolLabel, sizeof(szVolLabel)-1, &dwVolSerialNum, NULL, NULL, NULL, 0);

--------------------------------------------------

That should do it.

However, if what you are looking for is a truly low level solution to this in Windows then you are out of luck, unless you feel like doing some really complex Vxd programming. The serial number returned by GetVolumeInformation is the only place that I know of to get the serial number without performing direct disk access. Which can not be done unless you are in a VxD or can obtain ring0 access in your application somehow.

If any of this just gives you more questions write to me at ddgamer@hotmail.com. I'll try to help you out if I can.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question