State of license incorrect when running app in command-line mode

For my application, it can be run in either GUI or command-line only mode.
When running the GUI, it has a window to allow user to enter cryptlex key and activate the license.
This is working correctly.

But when running in command-line mode, the calls to IsLicenseGenuine() and IsTrialGenuine() both return different results that when the app is running in GUI mode.

GUI and command line modes use exactly the same app executable. There is a command line parameter to enable command-line mode.

Does the app’s main window somehow affect how lexactivator stores the license details?

No, it doesn’t. In fact if you run different apps with same product id and license, all of them will return status.

It could be that the app is being run as a different user in one of the modes, e.g. root user in cli mode.

Thanks for the quick response, as always!

Yes you are correct, I had a bug in my app.
When command-line mode was enabled, it failed to call SetProductData()