API behavior when TA_USER area is empty

Hi,

I discovered this behavior by accident in 4.0.7.3 on Win 7 and was wondering if this is by design.

My installer is run by Administrator and calls UseTrial(TA_VERIFIED_TRIAL | TA_SYSTEM | TA_DISALLOW_VM).The installed application is subsequently run by a standard user. The application calls TA_TrialDaysRemaining(TA_VERIFIED_TRIAL | TA_USER | TA_DISALLOW_VM) without calling UseTrial() first.This returns OK along with the expected days remaining, despite the conflicting TA_SYSTEM vs. TA_USER flags. When I first saw this in the code, I thought for sure the TrialDaysRemaining() call would fail, but it looks like the API is smart enough to look in the TA_SYSTEM area when the TA_USER area is empty. Sort of like a failover.

Does this behavior extend to the Activation methods? For example, the installer calls CheckAndSavePKey(TA_SYSTEM) as Administrator, then in the application, a standard user's call to IsActivated() or GetPKey() will find the expected information.

If the standard user calls CheckAndSavePKey(TA_USER) at some point, would this stop this failover behavior?

I ask this because I'd like to some day support "For All Users" installs by an Administrator as well as "Just for Current User" non-admin installations. In the first case, the installer would use TA_SYSTEM as admin. In the latter case, the installer would use TA_USER as a standard user. The application would not need to care and would always use TA_USER.

If I can count on this failover behavior when the TA_USER area is empty, then that would be a huge help.

Thanks,Carol

Hey Carol,

If TA_SYSTEM has already been set then any subsequent calls with TA_USER will be ignored (it will continue to use TA_SYSTEM).

Perfect. Thanks for confirming, Sam.

I ran some tests on TA_SYSTEM and TA_USER behavior. Linux seems to be strict on the "root must call TA_SYSTEM at least once" rule. On Windows, it seems a non-admin user can make calls with TA_SYSTEM just fine.

Is this true in general, or is there something odd about my Windows PC?

No, just quirky differences between the operating systems. With Unix you must call a function that takes TA_SYSTEM with admin permissions the first time you call it. With Windows 99.99% of the time you don't need to call it with admin permissions the first time (unless the end-user messed up permissions).