PDA

View Full Version : Subscription key - best way to perform runtime check



NewsArchive
08-15-2007, 02:50 AM
Some of my application have become so rock solid that the customers choose
not to upgrade to newer versions. I can't do anything with those already
decided so, but in the future I might be forced to time-out my applications
if there is no valid subscription.
I wonder if there is a good way to verify the Setupbuilder generated
subscription key when executing the _installed program. Currently I have
saved the key and expiration date in a registry key, but we all know how
easy is is to change the date in registry. Is the VerifySubscriptionKey
function perhaps available in a dll I can use?

Thanks
Bjarne

NewsArchive
08-15-2007, 02:50 AM
Hi Bjarne,

I would suggest to use the "Verify Subscription Key" script function to
handle this. The %_SB_RETURNEX% variable value holds two list items
containing the expiration date and expiration version of the subscription
key.

If you like to display the expiration date in your About screen, you can do
the following. Write a small application using SetupBuilder that can be
called from within your application. Then write the result (e.g. the
expiration date) to an INI file, etc. and read that value from your About
screen.

You can use the "Exit Installation" function to return a value from the
SetupBuilder created application to the calling application (e.g. your
Clarion app). Return "0" if the subscription expired, and "1" if it is
still valid (or whatever you want).

Please note that some smart customers may reset their system clock! There
is a "Get Atomic Clock Time" function to detect this.

Does this help?

Friedrich

NewsArchive
08-15-2007, 02:52 AM
Looks like you and I found the same solution :)

Bjarne Havnen

NewsArchive
08-15-2007, 02:53 AM
>
> Looks like you and I found the same solution :)
>

I see great minds think alike <bg> :)

Friedrich

NewsArchive
08-15-2007, 02:55 AM
I might have found a possible way:
Create a new setupfile
use comand line options /V to pass serialnumber and subscription key to the
installer
use Verify Subscription key function to validate the data
use ExitCode to tell the program if the subscription is valid or not. In
Clarion, this can be read with RUNCODE() after a RUN statement

Does this look doable?


Bjarne

NewsArchive
08-15-2007, 02:56 AM
>
> Does this look doable?
>

Perfect!

Friedrich

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.5
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
08-16-2007, 02:33 AM
Remove all dialogs

[ Initialize Setup ]
! --- Define commonly used constants ---
#include script "Common Definitions.sbi"
Set Variable %SUBSCRIPTION% to "" [Append Value]
! CHANCE THE ENCRYPTION PASSWORD BELOW
Set Variable %RESULT% to FUNCTION:Verify Subscription Key(%_SB_USERSERIAL%,
Encryptionpassword, %SUBSCRIPTION%)
!HOW TO EXTRACT DATE
Set Variable %EXPIRYDATE% to FUNCTION:Get List Item(%_SB_RETURNEX%, 1)
Edit INI File ".\license.ini" (Always Install)
Exit Installation %RESULT%

!and test for the values 0,1,2 and 3 in your program where
!0=Valid
!1 = Expired
!2=subsciption version expired
!3=Invalid key

Sample usage

Run('LISENS.EXE /V _SB_USERSERIAL '&Glo:Serial&' /V SUBSCRIPTION
'&Glo:SubscriptionKey,1)
Case RunCode()
Of 0
expiry=Getini('license','Expiry',,'.\license.ini')
datediff=Deformat(expiry,@D12)-Today()
Message('Your license is valid in '&Datediff& ' more days')
Of 1
expiry=Getini('license','Expiry',,'.\license.ini')
datediff=Deformat(expiry,@D12)-Today()
Message('Your subscription has expired '&abs(datediff) &' days ago')
of 2
Message('Your version has expired')
of 3
Message('You have provided invalid subscription key or serialno')
End


Bjarne Havnen

NewsArchive
08-16-2007, 02:34 AM
Guess I have to set the execution level to highest available, it won't work
that well if it requires administrator. Also, I guess the inifile should not
reside in the application directory if on Vista, so I may have to skip that
part since I don't know what program actually runs the setupfile - could
pass more variables though...

Bjarne Havnen