THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/04/2009 at 15:41, xxxxxxxx wrote:
Given the background information above, the first thing to note is that the license-key for the plugin needs to be different in a License Server environment than we normally use for stand-alone usage - it now needs to have 11 additional characters and a dash tacked on the front (technically, the dash may not be required, but can be used for our own parsing). The last 5 of those characters also needs to match the last 5 digits of the "CINEMA 4D" (and "Multi-License") 11-digit numbers.
Again, just to recap and using Riptide Pro as an example, my normal license keys consist of 16 alpha-numeric characters, with no dashes or spaces or any other special characters, so I'll represent that as:
...This is what I send to customers once they purchase the plugin for entering into the "Personalize" dialog.
For use in a License Server environment, I need to send my customers a longer formatted string:
Riptide Pro [11-0-1022532] <<RipPro12345-XOXOXOXOXOXOXOXO>>
...this lets them copy/paste it into the License Server's "Add Serials" dialog and tells the License server the plugin ID and which "serial package" it belongs with. The XOXO part of the above string in this case (my plugin's generated license key) would be based on the 11-digit serial of the "Multi-License" serial number, instead of the "CINEMA 4D" serial numbers.
So now we can get into some implementation details...
I don't plan to list a complete SNHookClass implementation here, but the primary routine/mechanism within that class used to validate license keys is the SNCheck() call...
SNCheck(const String& c4dsn, const String& sn, LONG regdate, LONG curdate)
...this routine is called by the system at startup and allows your code to validate the license key that the user entered - again, how this key is generated and validated is up to the developer - but the example code to follow will cover some details related to License Server usage.
Before we get to the code, are a few specific points about SNCheck() being called within a License Server environment:
- c4dsn - this will (should) be the same as you always see - it's the 11-digit string from the stand-alone CINEMA 4D serial number.
- sn - this string (your plugin's license key) will have those extra 11 characters and dash tacked on the front.
- regdate - is INVALID/meaningless - you can not use it to check for trial period expirations.
...to get the 'Multi-License' digits, we need to call the GeGetSerialInfo() routine and if the 'nr' String member of the filled-in SerialInfo structure has Content(), then that's the Multi-License digits. If there is no Content(), then C4D is being run in stand-alone mode (ie. not being fed keys from a License Server).
The next post will include the actual sample code (with additional comments) for a SNCheck() routine...