Xojo 64 bit Activate(ExtraData) raises InvalidArgsExceptionSolved

Problem Method: TurboActivate.Activate(ExtraData As String)An exception is raised when attempting activation with extra data in 64 bit builds only.The exception value is ret = 19: Case TA_E_INVALID_ARGS Raise new InvalidArgsException

With the corresponding message: "The arguments passed to the function are invalid. Double check your logic."

- Problem NOT seen on Xojo 2017 R2.1 Mac 32 bit and Windows 32 bit.- Problem seen on Xojo 2017 R2.1 Mac 64 bit and Windows 64 bit.- Problem seen with compiled Windows 64 code and Interpreted Mac code.- Problem seen in TurboActivate V-3.4.7 and V-4.0.9.6.

Note 1: I have been using TurboActivate 3.4.7 until now. I have ported my code for version 4.0.9.6 in order to check if the issue was still present (it is!).I will likely keep the latest TurboActivate version once I validate the rest of my code. With both versions of TurboActivate I can do GetKey, IsProductKeyValid, IsActivated, and Deactivate in 32 bit and 64 bit (I have not tested offline activation, deactivation, trials, and trials extension code in 64 bit yet).

Note 2: In order for Activate(ExtraData) to transfer the extra data correctly, I have implemented the suggestion mentioned in:

https://wyday.com/forum/t/3063/activateex-on-xojo-2015-problems-and-solutions/#post-14993

This additional code is required in both TurboActivate V-3.4.7 and V-4.0.9.6. Nonetheless, I have tried to activate with extra data with and without the suggested code, and the error is the same.

I suspect the problem may be due to variable types , i.e. UInt32, UInt64, Integer, and I have made many trials in this regard, without success so far.

Thanks for any help.

We'll look into this. The existing Xojo TurboActivate example if for Xojo 32-bit (because that's all that was available when we wrote it). We'll have to update the Xojo code to support 64-bit.

Our TurboActivate libraries already support 64-bit -- the tricky bit is just getting Xojo to "talk" to TurboActivate correctly.

Thanks for the response Wyatt,

It is a fact that Xojo 64 bit support has been lagging. The 2017 R1 release finally enables 64 bit debugging in the IDE (Mac only, not yet Windows) and the executables on both OSs are more robust in release 2.1 (the last release!).

Xojo admits (on one of their blog) to have been forced to accelerate 64 bit development because of Apple announcement that all NEW macOS apps submitted to the App store need to be 64 bit in January 2018. Also, all update of old apps in the Mac app store must be 64 bit in June 2018. Finally, macOS High-Sierra is the last to support 32 bit without compromise (in or out of the Mac app store). I mention all of this just to point out that proper 64 bit operation with macOS will become an essential requirement for developers and is not just something I want to add to my app for marketing reasons (there are already many features that I will have to drop because of 64 bit so I do not do it because I want to be on the bleeding edge).

If I can be of some help in solving this issue, by doing tests or whatever, please contact me.

I found a solution.

1- The previous bug fix to assign the Activate Method input string (ExtraData) to a local WString (for Windows) or CString (for Mac) is still required. To do so, the input parameter ExtraData is renamed ExtraDataIn; the Method is now: Activate(ExtraDataIn As String).

2- Two news structures are required. These are 64 bit version of the previous structures (previous structures: ACTIVATE_OPTIONS_W and ACTIVATE_OPTIONS). The new structures are named ACTIVATE_OPTIONS_W_64 and ACTIVATE_OPTIONS_64 respectively. The only change in each structure is:nLength As UInt64instead of Uint32.

Note: The Total size shown for these structures is 12 bytes but we will NOT use this value; we use "16" when we assign nLength, which corresponds to the value obtained when we call "options.Size" (in 64 bit!).

The revised code for the Method is shown below. This was tested on Mac and Windows with Xojo 2017 R2.1 and TurboActivate 4.0.9.6.

#if TargetWindows // Note (BUG FIX-Windows): transfer the extra data input to a WString; if not done, the first character may be garbled Dim ExtraData As WString ExtraData = ExtraDataIn #if Target32Bit Declare Function TA_Activate Lib TALibrary (handle As UInteger, ByRef options As ACTIVATE_OPTIONS_W) As Int32 Dim options As ACTIVATE_OPTIONS_W options.nLength = 8 options.sExtraData = ExtraData #else // Windows - 64 bit Declare Function TA_Activate Lib TALibrary (handle As UInteger, ByRef options As ACTIVATE_OPTIONS_W_64) As Int32 Dim options As ACTIVATE_OPTIONS_W_64 options.nLength = 16 // = options.Size (even if the structure has a size of 12 bytes as defined) options.sExtraData = ExtraData #endif #else // Mac // Note (BUG FIX-Mac): transfer the extra data input to a CString; if not done, no data is sent Dim ExtraData As CString ExtraData = ExtraDataIn #if Target32Bit Declare Function TA_Activate Lib TALibrary (handle As UInteger, ByRef options As ACTIVATE_OPTIONS) As Int32 Dim options As ACTIVATE_OPTIONS options.nLength = 8 options.sExtraData = ExtraData #else // Mac - 64 bit Declare Function TA_Activate Lib TALibrary (handle As UInteger, ByRef options As ACTIVATE_OPTIONS_64) As Int32 Dim options As ACTIVATE_OPTIONS_64 options.nLength = 16 // = options.Size (even if the structure has a size of 12 bytes as defined) options.sExtraData = ExtraData #endif #endif

Dim ret As Int32 = TA_Activate(handle, options)

(...)

Many Thanks for this workaround !

Highly appreciated,Fred

The latest TurboActivate has an updated Xojo project with full 64-bit support.

Also, we didn't find the "ExtraData" hack/fix suggested here as necessary. Xojo likely fixed a bug in their implementation.