THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/01/2010 at 03:42, xxxxxxxx wrote:
It's a pity that the SDK doesn't contain a standardised method of doing this. As it is, when I was working out how to do this, it seemed that there were as many methods of writing these routines as there are plugin authors! The result is that I don't really know if the method I used is valid (i.e. secure), just that it works. This is how I did it:
1. I have a global boolean indicating if the plugin is registered. When the plugin is called by the user, that boolean is checked in the Execute() function. The first time the plugin is called in any session of using C4D, the boolean will be false, so I do a serial number check.
2. To do that, I attempt to load the serial using ReadPluginInfo(), and if I can read someting, I run a serial check on what has been loaded (you need to provide your own algorithm for that).
3. If the serial is valid, the global boolean is set to true, so from then on whenever the user calls the plugin, Execute() checks the boolean and doesn't need to check the serial again.
4. If the serial is bad, or ReadPluginInfo() couldn't read anything, I ask the user to enter a serial, and if they enter a valid one that is saved to disk using WritePluginInfo(). From then on, it's registered and the user won't have to do that again.
Complications arise if you provide a demo - you have to decide how that will work. It seems to me that there are three choices: a limited functionality demo, which is made fully functional when a valid serial is entered; a time-limited fully-functional demo, which is the option I favoured but then you have the bother of saving the initial installation date and checking that if the serial check is not valid; or letting the demo version only work in the C4D demo, which I personally dislike as it means having the demo installated alongside my registered C4D installation.
Hope that helps a little.