PDA

View Full Version : hardwareAddress(es)



uygar
11th June 2009, 14:13
I need to know any hardware id which will never change? Like HDD, GPU, CPU or BIOS serial that unique and can't changeable.

I tried to use QNetworkInterface but It couldn't helped because
On one hand even if I format the OS and reinstall it MAC "QNetworkInterface::hardwareAddress()" doesn't changes but it can be chanced by anybody.
On the other hand if I use "QNetworkInterface::name()" It can't be changed by anybody but after formating the system and reinstalling the OS, it change randomly.

I need any unique and not changeable serial number (or string) of hardware:confused:

Lykurg
11th June 2009, 14:21
I need any unique and not changeable serial number (or string) of hardware:confused:

That is not possible! Everything can change, you can change your CPU, your main board...

I guess you will generate a serial number, so take a string which contains more information, like cpu, gpu, BIOS and whatever, and check against them in a manner that it is valid even if one parameter changed or two or... It depends how friendly you will be against your customer.

nightghost
11th June 2009, 15:17
What are you trying to archieve?

uygar
11th June 2009, 15:43
What are you trying to archieve?

I want to protect my project and my pruduct. I install it by myself in the first time but after that, my customers calls me for a new serial key of my pruduct. I need to be sure that they ask for the same system that I installed before not for a new one.


That is not possible! Everything can change, you can change your CPU, your main board...
I know that, but it is not problem, because it happen too rare and it is acceptable to take a risk of it.

I guess you will generate a serial number, so take a string which contains more information, like cpu, gpu, BIOS and whatever, and check against them in a manner that it is valid even if one parameter changed or two or...

That is true, if I read more than one hardware serial, I could figure out that, that is just an upgrade or not.

Or you may have any idea about protecting of software with out disturbing the customers.

uygar
11th June 2009, 19:20
Maybe BIOS and GPU serial could be good for this job but I don't know how I read these strings

Lykurg
11th June 2009, 19:49
Maybe BIOS and GPU serial could be good for this job but I don't know how I read these strings

you have to use native functions. Qt won't help you on that. There are some threads about hard disk serial detection on that forum with some example code. Use the search to find them. I don't know them right now..

nightghost
12th June 2009, 09:35
you have to use native functions. Qt won't help you on that. There are some threads about hard disk serial detection on that forum with some example code. Use the search to find them. I don't know them right now..



#ifdef Q_WS_X11
//native code
#elif Q_WS_MAC
//native code
#elif Q_WS_WIN
//native code
#endif



I think QNetworkInterface::hardwareAddress() will do the job. It may not be perfect, but enough to prevent easy copying. If you need more maybe a commercial License Management Solution (http://www.google.com/search?hl=de&client=firefox-a&rls=org.mozilla%3Ade%3Aofficial&hs=Sa1&q=license+management+c%2B%2B&btnG=Suche&meta=) will be a better solution

Lykurg
12th June 2009, 11:49
Harddisk serial: see this thread (http://www.qtcentre.org/forum/f-qt-programming-2/t-how-to-get-harddisk-serial-18468.html).

uygar
12th June 2009, 12:32
Harddisk serial: see this thread (http://www.qtcentre.org/forum/f-qt-programming-2/t-how-to-get-harddisk-serial-18468.html).

Wow this's realy helpfull thanks a lot, I'll try it immediately.

uygar
13th June 2009, 14:11
...
#ifdef Q_WS_WIN
#define Q_WS_WIN
DWORD dwVolSerial;
BOOL bIsRetrieved;
bIsRetrieved = GetVolumeInformation(TEXT("C:\\"), NULL, NULL, &dwVolSerial, NULL, NULL, NULL, NULL);
if (bIsRetrieved) {
QMessageBox::information(0, QString::fromUtf8("Good"), "Serial number of drive C is\n" + QString::number(dwVolSerial,16));
} else {
QMessageBox::warning(0, QString::fromUtf8("Bad"), "Serial number of drive C is nothing");
}
#endif
...
I read HardDisc VolumeSerial but after formating the system it changes. That because it is not perfect but it's OK:).

While I was searching about that, I found that link:
http://msdn.microsoft.com/en-us/library/aa394373.aspx

That is really good, especially UniqueId

UniqueId
Data type: string
Access type: Read-only:D
Globally unique identifier for the processor. This identifier may only be unique within a processor family. This property is inherited from CIM_Processor.


But I could not use it because I am not too good at codding. What should I do to use this proporty?:confused:

freezeblue
13th June 2009, 15:32
http://crystalmark.info/?lang=en

CPU id and Disk info, open source:)

uygar
15th June 2009, 12:38
http://crystalmark.info/?lang=en

CPU id and Disk info, open source:)

Thank you freezeblue but I have alrady used them. It just gave me about what is cpu, Not unique things. I mean if both of us buy systems having same CPUs it returns same strings.


ChipID=Intel(R) Core(TM)2 Duo CPU P7350 @ 2.00GHz
VendorID=GenuineIntel
etc.

uygar
15th June 2009, 21:18
class Win32_Processor : CIM_Processor
{
uint16 AddressWidth;
...
string UniqueId;
...
uint32 VoltageCaps;
};

This is the class I need to use but I can't.:confused:
http://msdn.microsoft.com/en-us/library/aa394373.aspx

aekilic
17th June 2009, 11:42
same thing happened to I failed to get an address with a qt application