Click here to Skip to main content
15,881,715 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am developing an anti-piracy scheme for a new application by tying its use to a particular PC given its serial number. To verify the corrrectness of the serial number i used Win32_SytemEEnclosure class and the SerialNumber property, these worked fine on laptops but failed to work on desktops. Please, I need a Win32 class with which I can get the serial number of the motherboard of a computer and its manufacture(if possible). I now intent to tie my anti-piracy scheme to the mother board.
Posted

I'm afraid that you are not going to be too happy, but...

There is the Win32_BaseBoard class[^], but there is a good chance that it will not give you any useful information - it depends on the motherboard manufacturer, and not all supply the information you are looking for.

You might be better off getting the MAC address as even the CPU serial number is not available for all processors.

You have to remember that none of this information is required - so it is up to the manufacturer whether they implement it or not. "Not" is cheaper, so guess what most do...
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Feb-13 18:00pm    
Agree, a 5.
—SA
Like the US court says to Sony, "that's your software, but not your computer". And since a user who buy a computer is free to change every part of it, binding a licence software to a piece of hardware not related to the software itself is somehow unfair: volume number can be changed, network adapter can be changed, even a mother board can be changed. And there is no reason someone have to ask for your permission.

Not to mention that a user -according to the laws of the most of, for example, European countries- can make any number of copy he wants for his own personal use. (So whatever mechanism trying to avoid it, can be legally required to be disabled...)

You better not to sell the copies (you know that information propagates by copy and that copy bytes is the way computer internally work, so it cannot be an "exclusive operation", since you are a programmer so I don't need to tell you ...) but to sell "support" to the people who pay you.

Just like a plumber is payed for the time he spend operating a plant, not for the number of time a tap is opened and closed.

In case you want to be able to track who's using your software, implement a registration mechanism and provide each user an id and implement a client server mechanism to track how many "session" are sourced by that id, possibly using encrypted data.

This let the user free to change or move the software between computers but limits the number of contemporary execution he can do. This can be done with no particular restrictions, apart you inform the user that such a mechanism exist and who (person) is responsible for the management of the usage information you will collect (this is to comply with privacy regulation eventually in place)
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 7-Feb-13 17:59pm    
Good point! 5.
—SA
Perhaps you'll find this little utility of some use:
CIMTool for Windows Management Instrumentation - Part 1[^]

You can use it to browse the information available through WMI, just select the class you want to query, and choose File->new->query.

I think I would collect more than one system parameter - as it's kind of nice to be able to get a new motherboard without having to go to all the trouble of getting a new license. A combination of harddisk serial number, mac address, harddisk serial number that would allow the user to upgrade a faulty part of hs system would perhaps be a good idea.

Best regards
Espen Harlinn
 
Share this answer
 
Agree with solution #1 - a better idea is to use the MAC address. This is not completely hack proof but at least it is always there and is meant to be unique. You can use WinApi GetAdaptersInfo function for example.
C++
void GetMacAddress()
{
        CString m_MacAddressStr;
	IP_ADAPTER_INFO AdapterInfo[16];       // Allocate information for up to 16 NICs
	DWORD dwBufLen = sizeof(AdapterInfo);  // Save memory size of buffer
	DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen);
	if (dwStatus != ERROR_SUCCESS)
	{
		return;
	}
    
	// if we get here, we have at least one adapter, and data in AdapterInfo is valid
	
	PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; // Contains pointer to current adapter info
	do 
	{
		m_MacAddressStr.Format("%02X-%02X-%02X-%02X-%02X-%02X", 
			(int)pAdapterInfo->Address[0], (int)pAdapterInfo->Address[1],
			(int)pAdapterInfo->Address[2], (int)pAdapterInfo->Address[3], 
			(int)pAdapterInfo->Address[4], (int)pAdapterInfo->Address[5]);
		
		pAdapterInfo = pAdapterInfo->Next;    // Progress through linked list
		
	} while (pAdapterInfo);
}


By the way, if you have a serial port on the computer on which you are running your code, the chances are you will get the PPP (point to point protocol) adapter first in this list of adapters. Which happens to be "44-45-53-54-00-00". So you should skip it and look for a real MAC address of the first network interface. Most modern PCs will have 2 or more (WiFi and Ethernet, etc).
 
Share this answer
 
v2
Comments
Gbenbam 1-Feb-13 8:56am    
Please do you mean that the the PPP adapter address always "44-45-53-54-00-00" for all PC's?
michaelmel 4-Feb-13 18:22pm    
It is the same on all PCs if they have a serial port (eg RS232)- for some reason, it is always the same address. At least on Windows XP.

Not sure if the same happens when there is a USB to RS232 converter used.
Gbenbam 1-Feb-13 9:08am    
I decided to use Win32_PhysicalMedia tie the scheme to the hard disk. Please, how hark proof is the hard disk serial number?
michaelmel 4-Feb-13 19:06pm    
There are generally 2 serial numbers related to the disk:
1) The volume serial number that you can get through GetVolumeInformation function. Basing any copy protection on this number will not be secure because it can be changed.

To view the volume serial number, go to DOS shell and do dir /p

Here is an article that describes how to change it:

Changing volume's serial number[^]


2) The manufacturer-specific serial number (I don't know how to get it and suspect it will be difficult as you have to take care of different OS-es and disk systems e.g. FAT NTFS etc)

Hope this helps.
H.Brydon 4-Feb-13 22:46pm    
The volume serial number can also be obtained in shorter form with "vol <drive>". For example:

C:/> vol C:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900