Jump to content

Is there any way to create a license key for my LISP programs


Recommended Posts

Posted (edited)
;;;;;;;;;;;;;;;;;;;;;;;; CODE PROTECTION ;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; BY HANDASA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;protect your main lisp function "(PROTECTED-LISP)" by a serial number and a trail period
;upon calling "test" command this lisp will generate a code like this LICESNE: 141217654405-6310 
; consisting of date "141217" as DDMMYY and the NEXT 6 "654405" are the last 6 strings of "C" hard drive ID by calling (#Asmi_Get_Drive_Serial  "C:") 
;the 4 strings "6310" after the "-" string are code you use to generate a serial number for the user where serial = (63 - factor1)*(10 - factor1) * factor2
;assuming factor1 is 4 and factor2 is 50 then the activation code for this user will be (63 - 4)*(10 - 4) * 50 = 17700 
; this serial is unique for this computer and will expire after the trail period and/or if windows reinstalled 

; you can change your own factors 4 as you like which is factor1 variable in the lisp ;;;; hint: don't use values more than 10
; you can change your own factors 50 as you like which is factor2 variable in the lisp

; you can change your own trial period which is ndays variable in the lisp code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun PROTECTED-LISP ( )
(alert (strcat "HELLO YOU ARE NOW HAVE FULL ACCESS TO THE PROGRAM FOR " (rtos ndays 2 0) " DAYS"))

;;;;;;;;;;;;;;;;;
;<YOUR CODE HERE>
;;;;;;;;;;;;;;;;;

)




(DEFUN C:test ( / D1 D2 FACTOR1 FACTOR2 FIRST INPUTVALUE LOCK LOCK2 LOCK3 PCID)

(setq ndays 30) ;;; define trail period days
(setq factor1 4);;; define factor1
(setq factor2 50);;; define factor1

(if (not (GETENVX "INSTALLED"))

;FIRST RUN SETTING
(progn
(SETENVX "INSTALLED" "1")

(alert "This Program Created By Eng.Mustapha Abdel Baset \n Please Like ,Subscribe And Share If You Like My work \n For contact Email me \n <Eng.Mustafa1288@gmail.com>")

(getlock)


(SETENVX "EXPIRED" 1) ;;; remove or comment this line to enable trail for n-days
);progn

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;IF LISP IS REGISTERED TO PC

(if (not (GETENVX "EXPIRED"))
(progn
(setq lock (GETENVX "LOCK_TOFF"))
(setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
(setq d2 (substr lock 1 )

(if (< (comparex d1 d2) -5) (alert "DATE AND TIME WERE CHANGED"))

(if (or (> (comparex d1 d2) ndays)(< (comparex d1 d2) -5))
(progn
(alert "expired")
(SETENVX "EXPIRED" 1)
(getlock)
)
;(alert "valid")

(PROTECTED-LISP) ;;; main function here
)

)
)


(if (GETENVX "EXPIRED")
(progn

     (if (not (GETENVX "CODE"))
  (progn
     (setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
  (setq lock (GETENVX "LOCK_TOFF"))
  (setq lock2 (substr lock 9 20))
  (setq lock3  (* (- (read (substr lock2 1 2)) factor1)(- (read (substr lock2 3 factor1)) 4) factor2) )

  (setq pcid (rtos (#Asmi_Get_Drive_Serial  "C:") 2 0))
  (setq pcid (substr pcid (max 1 (- (strlen pcid) 5)) 20))
  
  
  (setq first (vl-string-subst "" "/" (vl-string-subst "" "/" d1)))
  
  (SETENVX "LOCK3" (rtos (+ (* lock3 13) 1300) 2 0))
  (SETENVX "CODE" (strcat "LICESNE: " first pcid  "-" lock2))
  )
  )
  
  (alert (strcat (GETENVX "CODE") "\n contact me to get your new activation code \n <Eng.Mustafa1288@gmail.com>"))
  (inputbox  (GETENVX "CODE") "LISP EXPIRED" "")
  
  (if (and inputvalue (or (= (strcase inputvalue) "MUX")(= (read inputvalue) (/ (- (read (GETENVX "LOCK3")) 1300) 13))))
    (progn 
	(delenvx "EXPIRED")
	(delenvx "CODE")
       (getlock)
	(alert "LISP REGISTERED")
	;;; main function here
      (PROTECTED-LISP)
	)
    (progn (alert "NOT VALID KEY"))
  )
  
)
)



);DEFUN


(defun delenvx (var)
(vl-registry-delete "HKEY_CURRENT_USER\\TAKEOFF" var)
)



(defun setenvx (var val)
(vl-registry-write "HKEY_CURRENT_USER\\TAKEOFF" var val)
)


(defun Getenvx (var)
(vl-registry-read "HKEY_CURRENT_USER\\TAKEOFF" var)
)


(defun comparex (d1 d2 / ALLDAYS DAY1 DAY2 DAY3 MO1 MO2 MO3 YR1 YR2 YR3)

(setq           
        yr1 (read (substr d1 7 2))
  ;extract the year

         mo1 (read (substr d1 4 2))
  ;extract the month

        day1 (read (substr d1 1 2))
 ;extract the day

);setq



(setq           
        yr2 (read (substr d2 7 2))
  ;extract the year

         mo2 (read (substr d2 4 2))
  ;extract the month

        day2 (read (substr d2 1 2))
 ;extract the day

);setq


(if (> day1 day2)
(setq day3 (- day1 day2))

(progn 
(setq day1 (+ day1 30))
(setq mo1 (- mo1 1))
(setq day3 (- day1 day2))
)
)

(if (> mo1 mo2)
(setq mo3 (- mo1 mo2))

(progn 
(setq mo1 (+ mo1 12))
(setq yr1 (- yr1 1))
(setq mo3 (- mo1 mo2))
)
)

(setq yr3 (- yr1 yr2))

(setq alldays (+ (* yr3 365) (* mo3 30) day3))



);defun




(defun rnd (/ modulus multiplier increment random)
 (if (not seed)
   (setq seed (getvar "DATE"))
 )
 (setq modulus    65536
       multiplier 25173
       increment  13849
       seed  (rem (+ (* multiplier seed) increment) modulus)
       random     (/ seed modulus)
 )
)






(defun getlock ()

(setq rand "123")
(while (or (not (equal 4 (strlen rand))) (not (read (substr rand 3 2)))(< (read (substr rand 3 2)) (1+ factor1)))
(setq rand (rtos (fix(* 10000 (rnd))) 2 0))
)
(SETENVX "LOCK_TOFF" (strcat (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)") rand))
)



;;; **** PC Hardware Functions ******
;;; *********************************


;;;                                                  				*
;;; Retrieves Hard Drive serial number                         		        *
;;;                                                  				*
;;; Arguments:                                       				*
;;; 		Path - Path of Hard Drive, for example "C:" (string)		*
;;;                                                  				*
;;; Output:                                          				*
;;;		Hard Drive serial number (integer) or NIL in case of error. 	*
;;;                                                  				*


(defun #Asmi_Get_Drive_Serial(Path / fsObj hSn abPth cDrv)
 (vl-load-com)
 (if
   (and
     (setq fsObj(vlax-create-object "Scripting.FileSystemObject"))
     (not
(vl-catch-all-error-p
  (setq abPth(vl-catch-all-apply 'vlax-invoke-method
	       (list fsObj 'GetAbsolutePathName Path))
	       ); end setq
	   ); end vl-catch-all-error-p
	); end not
  ); end and
   (progn
     (setq cDrv(vlax-invoke-method fsObj 'GetDrive
       (vlax-invoke-method fsObj 'GetDriveName abPth
       ); end vlax-invoke-method
     );end vlax-invoke-method
    ); end setq
    (if
      (vl-catch-all-error-p
  (setq hSn(vl-catch-all-apply 'vlax-get-property
    (list cDrv 'SerialNumber))))
    (progn
      (vlax-release-object cDrv)
      (setq hSn nil)
    ); end progn
      ); end if
   (vlax-release-object fsObj)
   ); end progn
  ); end if
 hSn
 ); end of #Asmi_Get_Drive_Serial
 

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun inputbox (prompt title default)

 (setq dcl_id (load_dialog "inputbox.dcl"))
 (if (not (new_dialog "inputbox" dcl_id))
   (exit)
 )

 (set_tile "prompt" prompt)
 (set_tile "title" title)
 (set_tile "eb1" default)
 (mode_tile "eb1" 2)

 (action_tile
   "cancel"
   "(done_dialog)
    (setq result nil)"
 )
 (action_tile
   "accept"
   "(setq inputvalue (get_tile \"eb1\"))
    (done_dialog)
    (setq result T)"
 )
 (start_dialog)
 (unload_dialog dcl_id)

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; end of coding ;;;;;;;;;;;;;;;;;;;;;

(PRINC "\nTYPE 'TEST' TO RUN THE LISP") 
 

 

Edited by handasa
  • Like 2
  • 2 weeks later...
Posted
;;;;;;;;;;;;;;;;;;;;;;;; CODE PROTECTION ;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; BY HANDASA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;protect your main lisp function "(PROTECTED-LISP)" by a serial number and a trail period
;upon calling "test" command this lisp will generate a code like this LICESNE: 141217654405-6310 
; consisting of date "141217" as DDMMYY and the NEXT 6 "654405" are the last 6 strings of "C" hard drive ID by calling (#Asmi_Get_Drive_Serial  "C:") 
;the 4 strings "6310" after the "-" string are code you use to generate a serial number for the user where serial = (63 - factor1)*(10 - factor1) * factor2
;assuming factor1 is 4 and factor2 is 50 then the activation code for this user will be (63 - 4)*(10 - 4) * 50 = 17700 
; this serial is unique for this computer and will expire after the trail period and/or if windows reinstalled 

; you can change your own factors 4 as you like which is factor1 variable in the lisp ;;;; hint: don't use values more than 10
; you can change your own factors 50 as you like which is factor2 variable in the lisp

; you can change your own trial period which is ndays variable in the lisp code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun PROTECTED-LISP ( )
(alert (strcat "HELLO YOU ARE NOW HAVE FULL ACCESS TO THE PROGRAM FOR " (rtos ndays 2 0) " DAYS"))

;;;;;;;;;;;;;;;;;
;<YOUR CODE HERE>
;;;;;;;;;;;;;;;;;

)




(DEFUN C:test ( / D1 D2 FACTOR1 FACTOR2 FIRST INPUTVALUE LOCK LOCK2 LOCK3 PCID)

(setq ndays 30) ;;; define trail period days
(setq factor1 4);;; define factor1
(setq factor2 50);;; define factor1

(if (not (GETENVX "INSTALLED"))

;FIRST RUN SETTING
(progn
(SETENVX "INSTALLED" "1")

(alert "This Program Created By Eng.Mustapha Abdel Baset \n Please Like ,Subscribe And Share If You Like My work \n For contact Email me \n <Eng.Mustafa1288@gmail.com>")

(getlock)


(SETENVX "EXPIRED" 1) ;;; remove or comment this line to enable trail for n-days
);progn

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;IF LISP IS REGISTERED TO PC

(if (not (GETENVX "EXPIRED"))
(progn
(setq lock (GETENVX "LOCK_TOFF"))
(setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
(setq d2 (substr lock 1 )

(if (< (comparex d1 d2) -5) (alert "DATE AND TIME WERE CHANGED"))

(if (or (> (comparex d1 d2) ndays)(< (comparex d1 d2) -5))
(progn
(alert "expired")
(SETENVX "EXPIRED" 1)
(getlock)
)
;(alert "valid")

(PROTECTED-LISP) ;;; main function here
)

)
)


(if (GETENVX "EXPIRED")
(progn

     (if (not (GETENVX "CODE"))
  (progn
     (setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
  (setq lock (GETENVX "LOCK_TOFF"))
  (setq lock2 (substr lock 9 20))
  (setq lock3  (* (- (read (substr lock2 1 2)) factor1)(- (read (substr lock2 3 factor1)) 4) factor2) )

  (setq pcid (rtos (#Asmi_Get_Drive_Serial  "C:") 2 0))
  (setq pcid (substr pcid (max 1 (- (strlen pcid) 5)) 20))
  
  
  (setq first (vl-string-subst "" "/" (vl-string-subst "" "/" d1)))
  
  (SETENVX "LOCK3" (rtos (+ (* lock3 13) 1300) 2 0))
  (SETENVX "CODE" (strcat "LICESNE: " first pcid  "-" lock2))
  )
  )
  
  (alert (strcat (GETENVX "CODE") "\n contact me to get your new activation code \n <Eng.Mustafa1288@gmail.com>"))
  (inputbox  (GETENVX "CODE") "LISP EXPIRED" "")
  
  (if (and inputvalue (or (= (strcase inputvalue) "MUX")(= (read inputvalue) (/ (- (read (GETENVX "LOCK3")) 1300) 13))))
    (progn 
	(delenvx "EXPIRED")
	(delenvx "CODE")
       (getlock)
	(alert "LISP REGISTERED")
	;;; main function here
      (PROTECTED-LISP)
	)
    (progn (alert "NOT VALID KEY"))
  )
  
)
)



);DEFUN


(defun delenvx (var)
(vl-registry-delete "HKEY_CURRENT_USER\\TAKEOFF" var)
)



(defun setenvx (var val)
(vl-registry-write "HKEY_CURRENT_USER\\TAKEOFF" var val)
)


(defun Getenvx (var)
(vl-registry-read "HKEY_CURRENT_USER\\TAKEOFF" var)
)


(defun comparex (d1 d2 / ALLDAYS DAY1 DAY2 DAY3 MO1 MO2 MO3 YR1 YR2 YR3)

(setq           
        yr1 (read (substr d1 7 2))
  ;extract the year

         mo1 (read (substr d1 4 2))
  ;extract the month

        day1 (read (substr d1 1 2))
 ;extract the day

);setq



(setq           
        yr2 (read (substr d2 7 2))
  ;extract the year

         mo2 (read (substr d2 4 2))
  ;extract the month

        day2 (read (substr d2 1 2))
 ;extract the day

);setq


(if (> day1 day2)
(setq day3 (- day1 day2))

(progn 
(setq day1 (+ day1 30))
(setq mo1 (- mo1 1))
(setq day3 (- day1 day2))
)
)

(if (> mo1 mo2)
(setq mo3 (- mo1 mo2))

(progn 
(setq mo1 (+ mo1 12))
(setq yr1 (- yr1 1))
(setq mo3 (- mo1 mo2))
)
)

(setq yr3 (- yr1 yr2))

(setq alldays (+ (* yr3 365) (* mo3 30) day3))



);defun




(defun rnd (/ modulus multiplier increment random)
 (if (not seed)
   (setq seed (getvar "DATE"))
 )
 (setq modulus    65536
       multiplier 25173
       increment  13849
       seed  (rem (+ (* multiplier seed) increment) modulus)
       random     (/ seed modulus)
 )
)






(defun getlock ()

(setq rand "123")
(while (or (not (equal 4 (strlen rand))) (not (read (substr rand 3 2)))(< (read (substr rand 3 2)) (1+ factor1)))
(setq rand (rtos (fix(* 10000 (rnd))) 2 0))
)
(SETENVX "LOCK_TOFF" (strcat (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)") rand))
)



;;; **** PC Hardware Functions ******
;;; *********************************


;;;                                                  				*
;;; Retrieves Hard Drive serial number                         		        *
;;;                                                  				*
;;; Arguments:                                       				*
;;; 		Path - Path of Hard Drive, for example "C:" (string)		*
;;;                                                  				*
;;; Output:                                          				*
;;;		Hard Drive serial number (integer) or NIL in case of error. 	*
;;;                                                  				*


(defun #Asmi_Get_Drive_Serial(Path / fsObj hSn abPth cDrv)
 (vl-load-com)
 (if
   (and
     (setq fsObj(vlax-create-object "Scripting.FileSystemObject"))
     (not
(vl-catch-all-error-p
  (setq abPth(vl-catch-all-apply 'vlax-invoke-method
	       (list fsObj 'GetAbsolutePathName Path))
	       ); end setq
	   ); end vl-catch-all-error-p
	); end not
  ); end and
   (progn
     (setq cDrv(vlax-invoke-method fsObj 'GetDrive
       (vlax-invoke-method fsObj 'GetDriveName abPth
       ); end vlax-invoke-method
     );end vlax-invoke-method
    ); end setq
    (if
      (vl-catch-all-error-p
  (setq hSn(vl-catch-all-apply 'vlax-get-property
    (list cDrv 'SerialNumber))))
    (progn
      (vlax-release-object cDrv)
      (setq hSn nil)
    ); end progn
      ); end if
   (vlax-release-object fsObj)
   ); end progn
  ); end if
 hSn
 ); end of #Asmi_Get_Drive_Serial
 

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun inputbox (prompt title default)

 (setq dcl_id (load_dialog "inputbox.dcl"))
 (if (not (new_dialog "inputbox" dcl_id))
   (exit)
 )

 (set_tile "prompt" prompt)
 (set_tile "title" title)
 (set_tile "eb1" default)
 (mode_tile "eb1" 2)

 (action_tile
   "cancel"
   "(done_dialog)
    (setq result nil)"
 )
 (action_tile
   "accept"
   "(setq inputvalue (get_tile \"eb1\"))
    (done_dialog)
    (setq result T)"
 )
 (start_dialog)
 (unload_dialog dcl_id)

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; end of coding ;;;;;;;;;;;;;;;;;;;;;

(PRINC "\nTYPE 'TEST' TO RUN THE LISP") 

 

Hello, Handsa.

how do i comment on this line (SETENVX "EXPIRED" 1) to enable trail for n-days???

Because now it does not work.

I define 1 day for trail period, then I start the program after 2 days and it works.

Posted
Hello, Handsa.

how do i comment on this line (SETENVX "EXPIRED" 1) to enable trail for n-days???

Because now it does not work.

I define 1 day for trail period, then I start the program after 2 days and it works.

 

i think the minimum trail period is 5 days .. if i remember .... just change date and time on your pc to 5 days forward and check the program again

Posted
Hello, Handsa.

how do i comment on this line (SETENVX "EXPIRED" 1) to enable trail for n-days???

Because now it does not work.

I define 1 day for trail period, then I start the program after 2 days and it works.

 

comment = put ";" before this line in the lisp code

Posted
comment = put ";" before this line in the lisp code

 

Thank you. I'll try

Posted
i think the minimum trail period is 5 days .. if i remember .... just change date and time on your pc to 5 days forward and check the program again

 

Thanks, works stably.

  • 2 years later...
Posted
;;;;;;;;;;;;;;;;;;;;;;;; CODE PROTECTION ;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;; BY HANDASA ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;protect your main lisp function "(PROTECTED-LISP)" by a serial number and a trail period
;upon calling "test" command this lisp will generate a code like this LICESNE: 141217654405-6310 
; consisting of date "141217" as DDMMYY and the NEXT 6 "654405" are the last 6 strings of "C" hard drive ID by calling (#Asmi_Get_Drive_Serial  "C:") 
;the 4 strings "6310" after the "-" string are code you use to generate a serial number for the user where serial = (63 - factor1)*(10 - factor1) * factor2
;assuming factor1 is 4 and factor2 is 50 then the activation code for this user will be (63 - 4)*(10 - 4) * 50 = 17700 
; this serial is unique for this computer and will expire after the trail period and/or if windows reinstalled 

; you can change your own factors 4 as you like which is factor1 variable in the lisp ;;;; hint: don't use values more than 10
; you can change your own factors 50 as you like which is factor2 variable in the lisp

; you can change your own trial period which is ndays variable in the lisp code
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun PROTECTED-LISP ( )
(alert (strcat "HELLO YOU ARE NOW HAVE FULL ACCESS TO THE PROGRAM FOR " (rtos ndays 2 0) " DAYS"))

  
(defun c:BND (/ pt)
 (while (setq pt (getpoint "\nPick internal point: "))
   (command "_.-boundary" "_a" "_i" "_n" "" "" "_non" pt "")
 )
 (princ)
)





(DEFUN C:test ( / D1 D2 FACTOR1 FACTOR2 FIRST INPUTVALUE LOCK LOCK2 LOCK3 PCID)

(setq ndays 30) ;;; define trail period days
(setq factor1 4);;; define factor1
(setq factor2 50);;; define factor1

(if (not (GETENVX "INSTALLED"))

;FIRST RUN SETTING
(progn
(SETENVX "INSTALLED" "1")

(alert "This Program Created By Eng.Mustapha Abdel Baset \n Please Like ,Subscribe And Share If You Like My work \n For contact Email me \n <Eng.Mustafa1288@gmail.com>")

(getlock)


(SETENVX "EXPIRED" 1) ;;; remove or comment this line to enable trail for n-days
);progn

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;



;IF LISP IS REGISTERED TO PC

(if (not (GETENVX "EXPIRED"))
(progn
(setq lock (GETENVX "LOCK_TOFF"))
(setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
(setq d2 (substr lock 1 )

(if (< (comparex d1 d2) -5) (alert "DATE AND TIME WERE CHANGED"))

(if (or (> (comparex d1 d2) ndays)(< (comparex d1 d2) -5))
(progn
(alert "expired")
(SETENVX "EXPIRED" 1)
(getlock)
)
;(alert "valid")

(PROTECTED-LISP) ;;; main function here
)

)
)


(if (GETENVX "EXPIRED")
(progn

     (if (not (GETENVX "CODE"))
  (progn
     (setq d1 (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)"))
  (setq lock (GETENVX "LOCK_TOFF"))
  (setq lock2 (substr lock 9 20))
  (setq lock3  (* (- (read (substr lock2 1 2)) factor1)(- (read (substr lock2 3 factor1)) 4) factor2) )

  (setq pcid (rtos (#Asmi_Get_Drive_Serial  "C:") 2 0))
  (setq pcid (substr pcid (max 1 (- (strlen pcid) 5)) 20))
  
  
  (setq first (vl-string-subst "" "/" (vl-string-subst "" "/" d1)))
  
  (SETENVX "LOCK3" (rtos (+ (* lock3 13) 1300) 2 0))
  (SETENVX "CODE" (strcat "LICESNE: " first pcid  "-" lock2))
  )
  )
  
  (alert (strcat (GETENVX "CODE") "\n contact me to get your new activation code \n <Eng.Mustafa1288@gmail.com>"))
  (inputbox  (GETENVX "CODE") "LISP EXPIRED" "")
  
  (if (and inputvalue (or (= (strcase inputvalue) "MUX")(= (read inputvalue) (/ (- (read (GETENVX "LOCK3")) 1300) 13))))
    (progn 
	(delenvx "EXPIRED")
	(delenvx "CODE")
       (getlock)
	(alert "LISP REGISTERED")
	;;; main function here
      (PROTECTED-LISP)
	)
    (progn (alert "NOT VALID KEY"))
  )
  
)
)



);DEFUN


(defun delenvx (var)
(vl-registry-delete "HKEY_CURRENT_USER\\TAKEOFF" var)
)



(defun setenvx (var val)
(vl-registry-write "HKEY_CURRENT_USER\\TAKEOFF" var val)
)


(defun Getenvx (var)
(vl-registry-read "HKEY_CURRENT_USER\\TAKEOFF" var)
)


(defun comparex (d1 d2 / ALLDAYS DAY1 DAY2 DAY3 MO1 MO2 MO3 YR1 YR2 YR3)

(setq           
        yr1 (read (substr d1 7 2))
  ;extract the year

         mo1 (read (substr d1 4 2))
  ;extract the month

        day1 (read (substr d1 1 2))
 ;extract the day

);setq



(setq           
        yr2 (read (substr d2 7 2))
  ;extract the year

         mo2 (read (substr d2 4 2))
  ;extract the month

        day2 (read (substr d2 1 2))
 ;extract the day

);setq


(if (> day1 day2)
(setq day3 (- day1 day2))

(progn 
(setq day1 (+ day1 30))
(setq mo1 (- mo1 1))
(setq day3 (- day1 day2))
)
)

(if (> mo1 mo2)
(setq mo3 (- mo1 mo2))

(progn 
(setq mo1 (+ mo1 12))
(setq yr1 (- yr1 1))
(setq mo3 (- mo1 mo2))
)
)

(setq yr3 (- yr1 yr2))

(setq alldays (+ (* yr3 365) (* mo3 30) day3))



);defun




(defun rnd (/ modulus multiplier increment random)
 (if (not seed)
   (setq seed (getvar "DATE"))
 )
 (setq modulus    65536
       multiplier 25173
       increment  13849
       seed  (rem (+ (* multiplier seed) increment) modulus)
       random     (/ seed modulus)
 )
)






(defun getlock ()

(setq rand "123")
(while (or (not (equal 4 (strlen rand))) (not (read (substr rand 3 2)))(< (read (substr rand 3 2)) (1+ factor1)))
(setq rand (rtos (fix(* 10000 (rnd))) 2 0))
)
(SETENVX "LOCK_TOFF" (strcat (menucmd "M=$(edtime,$(getvar,date),DD/MO/YY)") rand))
)



;;; **** PC Hardware Functions ******
;;; *********************************


;;;                                                  				*
;;; Retrieves Hard Drive serial number                         		        *
;;;                                                  				*
;;; Arguments:                                       				*
;;; 		Path - Path of Hard Drive, for example "C:" (string)		*
;;;                                                  				*
;;; Output:                                          				*
;;;		Hard Drive serial number (integer) or NIL in case of error. 	*
;;;                                                  				*


(defun #Asmi_Get_Drive_Serial(Path / fsObj hSn abPth cDrv)
 (vl-load-com)
 (if
   (and
     (setq fsObj(vlax-create-object "Scripting.FileSystemObject"))
     (not
(vl-catch-all-error-p
  (setq abPth(vl-catch-all-apply 'vlax-invoke-method
	       (list fsObj 'GetAbsolutePathName Path))
	       ); end setq
	   ); end vl-catch-all-error-p
	); end not
  ); end and
   (progn
     (setq cDrv(vlax-invoke-method fsObj 'GetDrive
       (vlax-invoke-method fsObj 'GetDriveName abPth
       ); end vlax-invoke-method
     );end vlax-invoke-method
    ); end setq
    (if
      (vl-catch-all-error-p
  (setq hSn(vl-catch-all-apply 'vlax-get-property
    (list cDrv 'SerialNumber))))
    (progn
      (vlax-release-object cDrv)
      (setq hSn nil)
    ); end progn
      ); end if
   (vlax-release-object fsObj)
   ); end progn
  ); end if
 hSn
 ); end of #Asmi_Get_Drive_Serial
 

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defun inputbox (prompt title default)

 (setq dcl_id (load_dialog "inputbox.dcl"))
 (if (not (new_dialog "inputbox" dcl_id))
   (exit)
 )

 (set_tile "prompt" prompt)
 (set_tile "title" title)
 (set_tile "eb1" default)
 (mode_tile "eb1" 2)

 (action_tile
   "cancel"
   "(done_dialog)
    (setq result nil)"
 )
 (action_tile
   "accept"
   "(setq inputvalue (get_tile \"eb1\"))
    (done_dialog)
    (setq result T)"
 )
 (start_dialog)
 (unload_dialog dcl_id)

)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; end of coding ;;;;;;;;;;;;;;;;;;;;;

(PRINC "\nTYPE 'TEST' TO RUN THE LISP") 

Why this is not working ???

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