I would like to limit who/what can use my C++ DLL. I have an .mq4
script ( or it can be anything else I guess ) and I use DLL
-#import
-ed functions in it.
How I want to do the limitation is: there is a static filepath in the DLL, and at the begining of every function I just calculate a new checksum ( sha1
) of the file ( where filepath points to ) and compare it to the original checksum ( also static ). It's good, because if someone modify the .mq4
, the function will not work.
My problem is: If I just leave the original .mq4
there, and I create a new one, importing the DLL in there, I can use the DLL with no problem, because in the DLL I'm checking the original .mq4
, ( where the static filepath points to ) not where I have used it from.
So somehow I should figure it out, where the DLL has been imported and check the sum of that file. Or maybe there is another technique, I don't know.