Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

But if the registration code is invalid, all symbols created during application loading must be set to 'nil'.

Posted

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/

 

  • Like 1
Posted (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 by GLAVCVS
  • Like 1
Posted (edited)

@GLAVCVS How do I update the compiled main lisp file to work with other UUID?

Edited by NanGlase
Posted
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?

Posted

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"))
)

 

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...