Author Topic: How to restrain the use of a dll only on one computer?  (Read 1788 times)

0 Members and 1 Guest are viewing this topic.

hermanos23

  • Guest
How to restrain the use of a dll only on one computer?
« on: June 20, 2012, 02:41:29 PM »
Hello!

I've got a little involved in Autocad .Net programming and I have a little issue: I want that a given dll to run on only one computer only - it's a kind of licensing. :)

The first thing that got in my mind is, based on some particular information of a given computer, the commands from a given dll will run if only some criteria are met - like example: the install date of of an the os, the MAC address of the network etc.

In my mind everything was simple: I create the dll file, having a global variable which is null. The first time the user uses the my dll file, my program sets this variable with the install date of the os.  The second time the user uses the library, I check if the build date is the same as the date from my global variable, but I found out that the between uses, the global variable loses its value be and my idea is worthless.

So, my questions:

1. Can I maintain the state of a givin variable inside of a dll, without programming it?
2. Do you have any other ideas for my problem? ( How to restrain the use of a dll only on one computer?  )


P.S. Sorry for my English.


mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: How to restrain the use of a dll only on one computer?
« Reply #1 on: June 20, 2012, 03:36:02 PM »
Your "global variable" could be saved as a setting.
Problem is the setting is written to a physical file which could be tampered with.
But if you encrypted and decrypted the values that could prevent tampering.
The encrypting/decrypting could be done using the System.Security.Cryptography tools.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: How to restrain the use of a dll only on one computer?
« Reply #2 on: June 20, 2012, 10:13:03 PM »
1. Can I maintain the state of a givin variable inside of a dll, without programming it?

No, it will require some programming. You could use the registry or a file to store the data, but regardless of what you do, it will require programming to make it work.

2. Do you have any other ideas for my problem? ( How to restrain the use of a dll only on one computer?  )

How are you deploying the application? If you know what system the file will be used on, you can gather the required information from that specific computer and then encode that information in your application. When you build the application the data will be hard-coded in the dll. It isn't a perfect solution, but it would work fine in a small deployment zone.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: How to restrain the use of a dll only on one computer?
« Reply #3 on: June 21, 2012, 07:23:08 AM »
Along the lines of what Keith mentioned.  You could use the System.Security.Principal.WindowsIdentity namespace to hard code users or computers in your code.
Revit 2019, AMEP 2019 64bit Win 10