NanGlase Posted 12 hours ago Posted 12 hours ago Hello, I'm here again. I have already created a few independent Lisp programs. I want to add a registration feature using a combination of the computer name, volume serial number, and a secret code. I'm thinking of creating a main Lisp file that all the other Lisp files will depend on. The idea is that if the main file detects that the computer's details don't match the registration code, the entire program won't run. Is it possible to implement this?" Please, can anyone help me? Quote
GLAVCVS Posted 8 hours ago Posted 8 hours ago Hi I suppose you should compile the code. Do you have functions to obtain hardware serial numbers? If so, one implementation of the code could be to group the payment functions under a main function that only runs if a key you created exists in the Windows registry. Your code should create that key when the user enters a valid registration code. Another option is to save the registration code in a file. Or in both. If, when your application loads, it finds the key and it's correct, then it would load the defun with all the protected code. Quote
GLAVCVS Posted 8 hours ago Posted 8 hours ago But if the registration code is invalid, all symbols created during application loading must be set to 'nil'. Quote
Steven P Posted 7 hours ago Posted 7 hours ago So you'll need to compile the code otherwise the test can just be overwritten and the LISP used without it. (getenv "COMPUTERNAME") will give you the computer name and this might give you the drive number - based on a drive (setq ser (vla-get-Serialnumber (vlax-invoke (vlax-create-object "Scripting.FileSystemObject") 'getdrive "c:"))) ;;https://www.cadtutor.net/forum/topic/70821-usb-drive-serial-number/ 1 Quote
GLAVCVS Posted 6 hours ago Posted 6 hours ago (edited) This returns the serial number of the motherboard. It is more unique than the hard drive's serial number and also more unique than the variant of this same function that uses "Select * from Win32_BaseBoard". (defun obt_UUID (/ LObj SObj OSObj UUID) (setq LObj (vlax-create-object "WbemScripting.SWbemLocator") SObj (vlax-invoke LObj 'ConnectServer nil nil nil nil nil nil nil nil) OSObj (vlax-invoke SObj 'ExecQuery "SELECT UUID FROM Win32_ComputerSystemProduct") ) (vlax-for Obj OSObj (setq UUID (vlax-get Obj 'UUID)) ) (foreach Obj (list LObj SObj OSObj) (and Obj (vlax-release-object Obj)) ) UUID ) This might be a good option if you want your program to continue working when the user changes their hard drive but not their motherboard. Edited 6 hours ago by GLAVCVS 1 Quote
NanGlase Posted 5 hours ago Author Posted 5 hours ago (edited) @GLAVCVS How do I update the compiled main lisp file to work with other UUID? Edited 5 hours ago by NanGlase Quote
GLAVCVS Posted 5 hours ago Posted 5 hours ago 21 minutes ago, NanGlase said: @GLAVCVS How do I update the compiled main lisp file to work with other UUID? I don't think I understand exactly what you mean. Can you explain that a little more? Quote
BIGAL Posted 4 hours ago Posted 4 hours ago Ok one of the things you can do is using old fashioned DOS, yes us oldy's know what that is, but you can write one checkuser.lsp program that has the hidden code in it. Ok from windows cmd you can run a bat file, yeah old DOS. Repeat for every lisp. Copy checkuser.lsp+mylispprogram1.lsp c:/compile/mylispprogram.lsp You do this in a bat file for every lisp program so it appends your check code to your lisp programs. Saving as a copy is a good idea. You can then use this to make FAS files of the new lisp. ; must have vlide open to work (vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "Vlide") (setq loads (list ""xxx3d pts on face 4" "xxxblock atts invisible" "xxxChange client logos-3" "xxxClose plines" "xxxCogo Label_C" ) ) (setq loc1 "C:\\XXX-CAD-TOOLS\\") ;;change dirs to where ever you want them found (setq loc2 "D:\\XXX\\compile\\") ;;change dirs to where ever you want them saved (foreach lisp loads (vlisp-compile 'st (strcat loc1 lisp ".lsp") (strcat loc2 lisp ".fas")) ) Quote
GLAVCVS Posted 3 hours ago Posted 3 hours ago 1 hour ago, NanGlase said: @GLAVCVS How do I update the compiled main lisp file to work with other UUID? Maybe I finally understood your question: If what you mean is that you were planning to write a unique registration code in your Lisp to register your application on any PC, I don't think it's a good idea. The right thing to do is design an algorithm to generate a key from the serial number of the hard drive or motherboard (whichever you prefer). From that algorithm, you'll need to write a function that converts the serial number into a key. And that key will be the one you'll need to register when you first install your application, and it will be checked every time it's loaded thereafter. Therefore, your algorithm will create a different key for each PC. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.