LexActivator.ExtendTrial always fails if LexActivator is locked to OS user

Hi there.

So, I have a problem.
When my application is started it first checks whether it is already genuine. Because I have user lock, this is executed right at the start:
LexActivator.SetVersionGUID(guid, LexActivator.LA_USER);

If there was no valid licence, the application falls back to a verified trial.

If the verified trial has expired, then the application runs in a very limited mode.

Once the application has loaded, the user may enter a trial extension key.
However, because I have already done LexActivator.SetUserLock(true), key extension always fails:
LexActivator.ExtendTrial(key) returns 1

Because I have been told that SetUserLock() must be executed right after setting the GUID, I am now at a loss at the order of commands to execute in this particular case.

Any ideas?

Also a few addon questions:

  1. Can I terminate the extended trial (without deleting origina expiredl trial)? I need this to test try to extend the trial again.
  2. Should extending trial work while current trial extension has not yet expired (given that total trial extension length is not longer than the original initial trial)?



The trial extension is most probably not failing due to the user lock.

For trial extension to work please note following points:

1- Trial should have expired
2- Trial extension length must be less than trial length

For testing purpose, you can create multiple product versions in the dashboard, as each product version will have it’s own trial.

The trial was expired. The trial extension key was shorter than the original trial.
All I had to do to make it work is comment out LexActivator.SetUserLock(true)

For clarity, I have been trying same product, same OS, same user, same extension key, all within one 30 minute window. The only difference was that extension was failing if LexActivator.SetUserLock(true) was used before trying to extend the key in that JVM instance.

Please look into this, it is paramount for us that both features work.


How can I make the extended trial expired, so I can run test more often than once a day?

It seems that trial was started without user lock and product key was activated with a user lock.

Please try again with a new version.

For testing, you can create multiple product versions to start the fresh trial whenever you want.

But then the initial trial period on the new product will last at least a day, and only then I can try to test trial extension. Am I missing something?

Yes, to try trial extension you have to wait for atleast a day for the trial to expire.

I can’t get the trials to extend reliably. For example, I am trying to extend it right now. The original trial has expired. The extension has also expired. I have created another extension key for 1 day, but when I try to extend, it returns status code 1.
It isn’t very informative… What could be the reason for failure?
Should it be possible to extend a trial that has already been extended (and expired again)?

The code I am using to test is this:

LexActivator.SetVersionGUID(“D514172C-1B8A-9FE3-1152-3BFAF8051F23”, LexActivator.LA_USER);

It prints:

Another weird thing is, the control panel says Time left: 3 days, but
returns 0

Is there anything I could be doing wrong about using GetTrialDaysLeft() method?


All the functions return the status code, the Get functions pass the value to the pointer passed.

Um, I don’t understand what you mean. I don’t pass any pointers in Java. I use the Java API provided by Cryptlex.

This is the method in the LexActivator class provided by you:
* Gets the number of remaining days after which the license expires.
* @return Returns the number of days
* @throws LexActivatorException

public static int GetDaysLeftToExpiration() throws LexActivatorException
    int status;
    IntByReference daysLeft = new IntByReference(0);
    status = LexActivatorNative.GetDaysLeftToExpiration(daysLeft);
    switch (status)
        case LA_OK:
            return daysLeft.getValue();
        case LA_FAIL:
            return 0;
            throw new LexActivatorException(status);

So, it is supposed to return the number of days left. And it returns 0 instead of 3 days shown on the control panel.

If I insert this code into your API method:
System.out.println("status = "+status);
System.out.println("daysLeft = "+daysLeft.getValue());

It prints
status = 1
daysLeft = 0

So, the problem is that instead of the number of days it returns an “unknown error”.

Could you explain please why this is happening?

We have to do a release very soon, and this trial+extension issue is really becoming a problem.


I thought you were using the C - API. The usage is correct in Java.

The reason it’s not returning the correct value is you might have changed the trial length in the dashboard, but didn’t download the updated product.dat file.

Updating trial length requires updated product.dat file

Ah, yes, that must be it. I didn’t know that the dat file needs to be re-downloaded when trial length is changed.


Hi, can you please confirm that updating trial lenght no longer requires an updated product.dat file?

I just tested a) issuing a new trial policy (after deleting the old one) with longer time lenght, than b) reset() the machine locally and finally activating the new trial using the old product.dat.
Surprisingly the activation was successfull, with the longer time lenght and not requiring an updated product.dat.

Note: if relevant the local machine is running linux on Win10/ WSL2 and I’m using python.

Hi Rob,

Yes, I confirm that updating trial length no more required updating the dat file. That was required in LexActivator v2 (before 2018).

1 Like