We’re using Cryptlex as a static lib in our plugins (Windows and OSX), and we allow the user to manage his license from within the plugins. All plugins share the same product ID, since we sell them in bundles. Once the license state is altered from within one plugin, it triggers a sync of the new state to the other loaded plugins within the same host application.
We however noticed that when we let the host application load two of our plugins at once, and then activate a license from one of the loaded plugins, and then try to deactivate it from the other loaded plugin (so in the same session), we get an LA_FAIL returned.
When we however let the host load up only one plugin, activate a license from that plugin, and then let the host load in a second plugin, this second plugin is now able to deactivate the license just fine.
I guess this is as expected, since in the first scenario LexActivator’s internal state in the 2nd plugin doesn’t know what the 1st one has been up to, so when asked to deactivate the license it sees it isn’t even activated and thus returns LA_FAIL. (then again I’d expect a LA_E_ACTIVATION_NOT_FOUND instead?)
In the second scenario the 2nd plugin does a call to SetProductData, SetProductId, SetAppVersion, and finally SetLicenseCallback as part of it’s startup code, and I guess that before the host has fully given control back to the user, the server sync has already happened and the 2nd plugin’s cached state is now up-to-speed on the current license state, and can thus successfully perform a license deactivation.
What is the best way to let all plugins update their internal LexActivator state once one of them performs an activation, deactivation, or actually any license state altering action? Do we need to wait for the server check thread in the other plugins to do it’s thing once every hour? Or do we need to mirror the calls to SetLicenseKey / ActivateLicense in the other plugins as well? Then again: doesn’t that bump up the activation count for that installation manyfold? This also because we also use the same code for controlling hosted and on-premise floating licenses. Plus that the user could potentially have up to 80 distinct plugins loaded at once, so if they all perform a simultaneous server sync… Or is this problem fixed if we use the dll version of LexActivator? Then again we’d rather have only static dependencies, since depending on external dlls is tricky when you’re a plugin dll without control over e.g. PATH and cannot call any CHDIR command at load time (the OS thus just won’t find auxiliary dlls, even if they’re right next to our dll). Or is a single call to IsLicenseGenuine / IsLicenseValid / IsTrialGenuine (/ non-existing-IsTrialValid?) enough to reliably sync the internal LexActivator state? Or is there maybe another LexActivator function we can call which effectively just lets it refresh it’s internal state?