Starting in December, we will archive content from the community that is 10 years and older. This FAQ provides more information.
Bonjour @Pihu_2024
I understand that "locking" is to make it impossible to read by a human.
If it is the case, the best is compiling in FAS our VLX with the IDE functions.
Menu File -> Create Application and so onā¦
Amicalement
Didier Aveline
Dear Sir,
Thanks for the reply
I want to my lisp programming don't work other computer.
This type lock required.
You can make an unique text file or a system environment variable with (setenv) that is only on your computer and create a condition in your routine to find that file or to read that variable. And if it is not found the program quits.
I would also add some funny popup alert message at program exit for that person who is not welcome to use the program.
@andkal ,
The unique text file method is what I used to protect my client's proprietary programs from piracy. It was before I had learned anything about the registry.
There was a worker who left that company for another (and took copies of the VLXs with him) and then called me to find out how to make the code run and what it would cost him.
All he got from me was a boat load of expletives.
John F. Uhden
You can build into your code to always first check the current registry entry for the default login email account.
If the domain (@domain.com) matches with the company the code belongs to then run otherwise exit:
(car (vl-registry-descendents "HKEY_CURRENT_USER\\Software\\Microsoft\\IdentityCRL\\UserExtendedProperties"))
Above taken from this thread:
Re: Find local user Email address? - Autodesk Community
Then as @-didier- posted compile the LSP as VLX
Dear Sir,
Please give complete programming, lisp file lock by registry number.
Very simple to add something similar to the beginning of your code:
; get default user email account from registry
(setq emlid (car (vl-registry-descendents "HKEY_CURRENT_USER\\Software\\Microsoft\\IdentityCRL\\UserExtendedProperties")))
(if(not(wcmatch emlid "*`@companydomain.com")) ; replace with your specific company domain name
(progn ; email account domain name did not match
(alert "Company Account Not Authorized...Exiting") ; alert user
(exit) ; exit lisp function
)
(progn
(alert "Company Account Validated.") ; alert user
; include the rest of your lisp code here
)
) ; if
Thanks for the reply,
Dear Sir,
Registry number write? And main programming insert?
I request you Please send sample programming.
Another is, read Cad serial number, read hard disk ID, read network card ID. You need to make fas or vlx, des for Bricscad.
As above use setenv and check a value.
You do this on the computer, only once.
(setenv "PIHU" "1")
Inside code
(if (/= (setq pihucnt (getenv "PIHU") nil))
(princ "ok")
(if (>= pihucnt 30)
(progn
(alert "Your trial time is up\n \n You need to contact\n \n PIHU Consulting \n \n info@PIHU"_)
(exit)
)
)
)
Serial number (getvar "_pkser")
Almost forgot if you have multiple lisps you can use a old fashioned DOS command to add the protection to every lisp before making FAS etc.
copy protect.lsp+c:/mylips/lisp1.lsp c:/protectlisp/lisp1.lsp
I'm not writing anything to the registry.
Did you try executing this line of code on your computer to see what email address returns on your computer?
(car (vl-registry-descendents "HKEY_CURRENT_USER\\Software\\Microsoft\\IdentityCRL\\UserExtendedProperties"))
Dear Sir,
I request you Please send sample programming for lock by cad serial number.
A number of years ago when Autodesk sold perpetual licenses of AutoCAD serial numbers were issued.
But since Autodesk switched all their products to subscription base, serial numbers are no longer issued. Instead it's now depending on your Autodesk User ID.
This is hard disk ID
Search this Forum. This has come up before. Whether you will find suggestions not already mentioned here, I will let you determine.
On the suggestions here so far, many have the problem that a knowledgeable user could get around them easily enough. If they have access to the code itself, they can just set their own environment variable, or put there own computer serial number in place of yours, or some such thing. I think the compiled-file [.FAS or .VLX] suggestion is probably best, because it prevents that possibility, as long as the knowledgeable user does not have access to the source .LSP code.
Of course, another question arises: If you want it usable on only one computer, how is it available to any other(s) on which it would need to run one of these tests? If you keep it on that only-one computer, and not on something shared like a server, won't that prevent use on other computers?
Unless I am mistaken, all that does is check if the current user belongs to the company's domain, if it has one, like mine is "j*@gmail.com." There is likely to be many users whose domains are all the same, whereas @Pihu_2024 wants to restrict program access to only specific users (I think). So I think it would be better to check just the username without the domain. For that he would have to have a list of only those names that are allowed. This can be done securely by creating a .FAS file with just a list, eg. (setq allowed ("Melvin Smedlap" "Dan Druff" "Barb Dwyer" "Ben Dover")) which is loaded at the top of each program and test using (if (not (vl-position username allowed)) (exit)). Of course 'allowed should be localized. You would need just to update the .LSP/.FAS file as people come and go or their status changes from OK to NOK or vice versa.
John F. Uhden
@Pihu_2024 we need you explain more where the code is going, staying within your company, so limit users, email a copy to an external company and so on. For me send a lisp program and get them to send back a jumbled code of the disk ID you unjumble and use.
Yes have had that phone call "trying to install and not working", was given to some one else. "Show me the money !"
You can ping a server over the internet and get an approval code, the way Autocad works now.
Dear Sir,
I want to export registry number .txt file, Lisp programming.
Hereās an example of exporting your email address from the registry to a text file:
(setq des (open "C:\\MyTextFile.txt" "w"))
(write-line "This is your email address " des)
(write-line
(car (vl-registry-descendents "HKEY_CURRENT_USER\\Software\\Microsoft\\IdentityCRL\\UserExtendedProperties"))
des)
(close des)
Dear Sir,
Thanks for the reply.
I have trying, error:bad argument type: streamp nil