Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your help!

We need 7 developers from Canada and 18 more from Australia to help us complete a research survey.

Support our site by taking a quick sponsored survey and win a chance at a $50 Amazon gift card. Click here to get started!


How to retrieve hardware serial numbers under Windows?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
9 replies to this topic

#1 Ramius   Members   -  Reputation: 144

Like
0Likes
Like

Posted 14 February 2006 - 11:42 AM

Anyone know how to retrieve the serial number of a hardware device, preferably the hard disk drive, under Win 98 and later? I've searched the net in vain for a method that works under Windows 9x/2000 (Win XP has the WMI classes). And yes, it's for a simple copy protection scheme. :)

Sponsor:

#2 JY   Members   -  Reputation: 289

Like
0Likes
Like

Posted 14 February 2006 - 08:44 PM

If you use the GetVolumeInformation function you can get the serial number for a volume (ie C:\). This is not a hardware serial number so it will change if the disk is reformatted. I looked into this a while ago and I couldn't find the hardware serial number, so if you do i'd be interested to know the method as well ;)

#3 Ramius   Members   -  Reputation: 144

Like
0Likes
Like

Posted 15 February 2006 - 03:20 AM

Yeah, there's like a dozen documented ways for retrieving the volume serial number but none for the actual manufacturer serial number. [rolleyes] I wouldn't have any problem with binding an install to the volume number if it wasn't so easy for the end user to change said number. While I imagine even a "hard" serial number could be faked by an extreme power user (could use a RAMdisk or custom device driver or something) I would think that it would stop the majority of people. On the other hand, your casual user probably doesn't even know what a volume serial number is, so I guess it could do well enough for my purposes. Still would like to know how to access the manufacturer's serial though. [smile]

#4 Zeu5   Members   -  Reputation: 126

Like
0Likes
Like

Posted 15 February 2006 - 03:41 AM

You'd have to investigate the functions CreateFile and DeviceIoControl.

look at this example:

http://www.dotnetspider.com/Question6159.aspx

I hope that helps.

#5 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 15 February 2006 - 03:48 AM

You could use the MAC address of the network card instead. Probably less intrusive, although not everyone is on hi-speed LANs.

#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 15 February 2006 - 03:50 AM

You could use the MAC address of the network card instead. Probably less intrusive, although not everyone is on hi-speed LANs.

#7 Ramius   Members   -  Reputation: 144

Like
0Likes
Like

Posted 15 February 2006 - 05:36 AM

Quote:
You'd have to investigate the functions CreateFile and DeviceIoControl.


Thanks for the tip. Unfortunately, DeviceIoControl can only access the old DOS int 21h functions when called under Win 9x, and to the best of my knowledge none of those can query for a physical drive's hardware serial number.

Quote:
You could use the MAC address of the network card instead.


I thought about using the serial number (or other semi-unique identifier like a MAC address) of some piece of hardware other than the hard disk, but I'd like my copy protection scheme to be as convenient to the end user as possible. This makes a hard disk the ideal physical object to bind my program to, as it's generally the least likely thing to be replaced during a system upgrade. That's also the reason why I'd prefer to use the hardware serial # vs the volume #, as the former doesn't get changed during a reformat. :)

#8 Basiror   Members   -  Reputation: 241

Like
0Likes
Like

Posted 15 February 2006 - 06:04 AM

Quote:
Original post by Anonymous Poster
You could use the MAC address of the network card instead. Probably less intrusive, although not everyone is on hi-speed LANs.


unfortunately you can hide your mac address by software which is actually quite common to avoid punkbuster detection

on linux you can get all this information quite easy with some console commands
*please don t ask me for the command names. its a while back that i needed them*

#9 AceroSBU   Members   -  Reputation: 127

Like
0Likes
Like

Posted 15 February 2006 - 06:23 AM

Take a look at this site. Not completely sure it will give you what you are looking for, but it certainly looks possible. Source code and all.

http://www.winsim.com/diskid32/diskid32.html

#10 Ramius   Members   -  Reputation: 144

Like
0Likes
Like

Posted 15 February 2006 - 09:20 AM

Quote:
http://www.winsim.com/diskid32/diskid32.html


Thank you very much for that link. :) It's the first documentation I've seen that covers methods for Win 9x, 2k, and XP. Unfortunately, having looked through the code provided I've decided that its limitations (no SCSI support, requiring direct port manipulations under 9x, etc.) are too risky to base a no-hassle copy protection scheme around. So I guess it's back to using the volume serial # for me. [cool]




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS