Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unique system identificator choice?

Alexander_G_
Beginner
1,180 Views
Greetings everyone. My supervisor asked me if it is possible to force an application to run only on specific PC. My first guess is to generate some sort of unique ID for the PC in question and verify it at start of application. The first thing that springs to mind is to use the Windows product ID as such unique identifier, but I've failed to find a way to get the Windows PID without launching a separate application and parsing its' output, for example, "systeminfo" provides such information, but such solution seems a bit amateur. Is there a proper way of getting the Windows PID? Maybe there is some other way to uniquely identify a PC? I've seen here examples of MAC address acquisition, and that would have suit me if only the MAC address could not be changed so easily. Any ideas? Best regards, Alexander Grushin.
0 Kudos
8 Replies
Arjen_Markus
Honored Contributor II
1,180 Views

There are commercial solutions for that sort of things, but you might try the program "getmac" (see https://helpdesk.latech.edu/index.php?option=com_content&task=view&id=207&Itemid=67). Of course, running an external program is not a very safe way to obtain this data, so perhaps this page is a better solution: http://stackoverflow.com/questions/13646621/how-to-get-mac-address-in-windows-with-c.

0 Kudos
Alexander_G_
Beginner
1,180 Views
arjenmarkus wrote:

There are commercial solutions for that sort of things, but you might try the program "getmac" (see https://helpdesk.latech.edu/index.php?option=com_content&task=view&id=20...). Of course, running an external program is not a very safe way to obtain this data, so perhaps this page is a better solution: http://stackoverflow.com/questions/13646621/how-to-get-mac-address-in-wi....

Thanks for the links, but as I've mentioned in my original post -- the MAC address is no good for my purposes (unique identifier of a PC) since it's very easy to change it.
0 Kudos
mecej4
Honored Contributor III
1,180 Views

Have you considered using the VSN (volume serial number) of the system drive? It is a 32-bit unsigned number and can be retrieved by calling an API function. It can be changed by replacing the drive or reformatting the drive, but as far as I know the new value is assigned by algorithm rather than by the user. Some software for Windows is sold with a license scheme where the customer sends the VSN to the vendor after purchase and installation, and the vendor sends the customer a license file.

Of course, you have to consider how you will handle a customer who comes back to you for a new license after a hard drive failed or a bigger replacement drive was installed.

0 Kudos
Arjen_Markus
Honored Contributor II
1,180 Views

Ah, missed that last bit.

You might use a combination of the MAC address and the hard disk's serial number, as mecej4 mentioned.

0 Kudos
Steven_L_Intel1
Employee
1,180 Views

What is the goal of this restriction? Is this a commercial product that will be widely distributed and you're worried about piracy? Or is this something less formal and internal to your organization? Do you need to specify in advance which system it will run on? How do you plan to protect the code and data that enforces the restriction?

If you are serious about this, I would strongly recommend using a commercial license management package that supports the concept of "activation" and not try to roll your own.

0 Kudos
Alexander_G_
Beginner
1,180 Views
Steve Lionel (Intel) wrote:

What is the goal of this restriction? Is this a commercial product that will be widely distributed and you're worried about piracy? Or is this something less formal and internal to your organization? Do you need to specify in advance which system it will run on? How do you plan to protect the code and data that enforces the restriction?

If you are serious about this, I would strongly recommend using a commercial license management package that supports the concept of "activation" and not try to roll your own.

Steve, it's not "serious" -- the "product" is a very specific one-task-aimed code and it must be provided to only one "customer" and only within a term based contract. So I need at least to do something to stop possible spreading of it and, formally, restrict its' usage after the contract is finished. And since I'm actually in a very close contact with future users of the application I can customize the code anyway necessary. For these reasons, I don't consider commercial protection systems. I do realize, that my "protection" will be easily broken if someone applies just a little effort to it, but on the other hand I feel need to at least try to do this one properly, without careless attitude. Best regards, Alexander.
0 Kudos
Alexander_G_
Beginner
1,180 Views
mecej4 wrote:

Have you considered using the VSN (volume serial number) of the system drive? It is a 32-bit unsigned number and can be retrieved by calling an API function. It can be changed by replacing the drive or reformatting the drive, but as far as I know the new value is assigned by algorithm rather than by the user. Some software for Windows is sold with a license scheme where the customer sends the VSN to the vendor after purchase and installation, and the vendor sends the customer a license file.

Of course, you have to consider how you will handle a customer who comes back to you for a new license after a hard drive failed or a bigger replacement drive was installed.

That seems to be a good idea. I will try that, thanks!
0 Kudos
mecej4
Honored Contributor III
1,180 Views

The API function is documented at https://msdn.microsoft.com/en-us/library/windows/desktop/aa364993%28v=vs.85%29.aspx. Basically, what you have to do is to call the function as follows:

GetVolumeInformationA("C:\\",NULL,0,&VolSno,NULL,NULL,NULL,0);

Note that in a 32-bit program this function is _stdcall in linkage.

0 Kudos
Reply