Restricting a program to run on unauthorised machines

Restricting a program to run on unauthorised machines


Can you please advice what compiler option(s) (if any) I should use to avoid a Fortran program to run on non authorised machines?


7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

AFAIK there is no compiler option that does that for you.

We secured our programs by getting hardware information at runtime. That hardware information is hard coded in our program and compared at the beginning of the program. In case of a mismatch the program won´t start.


I use PLS from Polyhedron and it has various options, one of them using hardware id values to license the software. It works great!



I am after something simple but that works. Markus, can you provide me with some code example(s) I can follow?

Well, you could do the following things:

character*255 username,hostname

call GETENV ("USERNAME", userName)

l = Hostnam(hostname)

These two functions get you the name of the computer and the logged in user. You can do some Registry stuff via Win32, like RegOpenKeyEx and RegQueryValueEx.

It is not a simple matter to license software. The more valuable your software, the more effort people will make to crack it and the more it will cost you to pretect it. For instance, if you embed hardware ID in your code, it will be a fairly simple matter to ovewrite your executable with any other ID, especially if you tell people that is how your software works ! You would need to employ encrytion to stop tampering. If you really want to protect the value of your software you should employ a good comercial system. Intel Fortran itself uses the Flex system I believe, but there are many others such as Safenet.


Thanks for the example.

Neels and Andrew thanks for your valuable comments.

Leave a Comment

Please sign in to add a comment. Not a member? Join today