Getting Serial number in NETrender
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2009 at 14:45, xxxxxxxx wrote:
LONG SNCheck(const String& c4dsn, const String& sn, LONG regdate, LONG curdate)
SNCheck is called for you when you call Register(). Here's my entire Main.cpp with SNHookClass. Note that I donot check the serial number when running Demo, Net, Server.
>
// Includes \> #ifdef MACOS \> #include "Rijndael_Mac.h" \> #else \> #include "Rijndael.h" \> #endif \> #include "c4d.h" \> #include "lib_sn.h" \> #include "general.h" \> \> // Size of serial number string \> #define ENTRY_SIZE 17 \> \> // KDZSerial: Serial Number Hook Class \> class KDZSerial : public SNHookClass \> { \> private: \> // Data \> const String SNPluginName; \> // Methods \> // - KDZSerial.checkSerial \> //\*---------------------------------------------------------------------------\* \> Bool checkSerial(const String& c4dsn, const String& sn) \> //\*---------------------------------------------------------------------------\* \> { \> // Key is 11-Digit C4D SN + 5-Char PluginCode + NullTerminator \> char key[ENTRY_SIZE]; \> c4dsn.GetCString(&key;[0], c4dsn.GetCStringLen()+1L, St7bit); \> // Example \> key[11] = 'x'; \> key[12] = 'x'; \> key[13] = 'x'; \> key[14] = 'x'; \> key[15] = 'x'; \> key[16] = 0; \> \> // Encrypt plugin serial no. using AES \> char dout[ENTRY_SIZE] = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; \> // One block testing \> CRijndael oRijndael; \> if (!oRijndael.MakeKey(&key;[0], "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, 16)) \> { \> MessageDialog(GeLoadString(PDRERR_SNMAKEKEY)); \> return FALSE; \> } \> char din[ENTRY_SIZE]; \> memcpy(&din;[0], &key;[0], ENTRY_SIZE); \> if (!oRijndael.EncryptBlock(din, dout)) \> { \> MessageDialog(GeLoadString(PDRERR_SNENCRYPTION)); \> return FALSE; \> } \> dout[16] = 0; // Null-terminate \> \> UINT i; \> UCHAR val; \> // Convert to AlphaNumerics for user serial number entry \> for (i = 0; i != 16; ++i) \> { \> val = (UCHAR)dout[i]; \> // Beyond AlphaNumerics \> if (val > 122) val /= 3; \> // Below AlphaNumberics \> if (val < 48) val += 48; \> // Between numerals and UC Alpha \> if ((val > 57) && (val < 65)) val += 24; \> // Between UC Alpha and LC Alpha \> if ((val > 90) && (val < 97)) val += 12; \> dout[i] = (char)val; \> } \> dout[16] = 0; // Null-terminate \> \> sn.GetCString(&key;[0], sn.GetCStringLen()+1L, St7bit); //ENTRY_SIZE, St7bit); \> // Check sn against Encrypted-AlphaNumericized dout \> for (i = 0; i != 16; ++i) \> { \> //GePrint("key["+LongToString(i)+"]=\'"+LongToString(key[i])+"\' == chk["+LongToString(i)+"]=\'"+LongToString(dout[i])+"\'"); \> if (key[i] != dout[i]) \> { \> MessageDialog(GeLoadString(PDRERR_SNINVALID)); \> return FALSE; \> } \> } \> return TRUE; \> } \> public: \> // Data \> // - mode = 0 (not registered/not demo), 1 (demo), 2 (registered) \> UCHAR mode; \> LONG time; \> // Methods \> // - Constructor \> //\*---------------------------------------------------------------------------\* \> KDZSerial() : SNPluginName("PipeDream") \> //\*---------------------------------------------------------------------------\* \> { \> mode = 0; \> } \> // - SNHookClass.SNCheck \> //\*---------------------------------------------------------------------------\* \> LONG SNCheck(const String& c4dsn, const String& sn, LONG regdate, LONG curdate) \> //\*---------------------------------------------------------------------------\* \> { \> if (!sn.Content()) return SN_WRONGNUMBER; \> \> // Demo mode (14 day trial) \> if (sn.GetLength() == 4L) \> { \> // Case-insensitive serial number 'demo' \> if (sn.LexCompare("DEMO")) return SN_WRONGNUMBER; \> \> if (!regdate) \> { \> mode = 1; \> return SN_OKAY; \> } \> \> // Calculate timeout of Demo or Beta modes \> LONG timeout = 14L - (curdate - regdate); \> if (timeout < 0L) return SN_EXPIRED; \> time = timeout; \> mode = 1; \> if (timeout <= 14L) return SN_EXPIRE_14 - timeout; \> return SN_OKAY; \> } \> // Registered user \> else if (sn.GetLength() == 16L) \> { \> if (checkSerial(c4dsn, sn)) \> { \> mode = 2; \> return SN_OKAY; \> } \> } \> #ifdef C4D_R11 \> // Multi-License Server \> else \> { \> // Check for R11 Multi-License \> SerialInfo mlsn; \> GeGetSerialInfo(SERIAL_MULTILICENSE, &mlsn;); \> if (mlsn.nr.Content()) \> { \> //-------------------------------------------------------------------------------- \> // Note that we also need to skip over the extra data added to the front of the \> // plugin's license key (11 digits/characters and a dash)... \> //-------------------------------------------------------------------------------- \> String plug_sn = sn; \> LONG dashPos; \> if (plug_sn.FindFirst("-", &dashPos;, 0L)) \> { \> plug_sn = plug_sn.SubStr(dashPos+1L, plug_sn.GetLength()-dashPos-1L); \> if (checkSerial(mlsn.nr, plug_sn)) \> { \> mode = 2; \> return SN_OKAY; \> } \> } \> } \> } \> #else \> else MessageDialog(GeLoadString(PDRERR_SNSIZE)); \> #endif \> \> return SN_WRONGNUMBER; \> } \> // - SNHookClass.GetTitle \> //\*---------------------------------------------------------------------------\* \> const String& GetTitle() \> //\*---------------------------------------------------------------------------\* \> { \> return SNPluginName; \> } \> }; \> \> static KDZSerial\* kdzSerial = NULL; \> \> //\*---------------------------------------------------------------------------\* \> Bool RegisterKDZSerial() \> //\*---------------------------------------------------------------------------\* \> { \> kdzSerial = gNew KDZSerial(); \> if (!kdzSerial) return ErrorException::Throw(GeLoadString(PDRERR_MEMORY), "main.RegisterKDZSerial.kdzSerial"); \> return kdzSerial->Register(ID_PIPEDREAMOBJ, SNFLAG_OWN); \> } \> //\*---------------------------------------------------------------------------\* \> void FreeKDZSerial() \> //\*---------------------------------------------------------------------------\* \> { \> gDelete(kdzSerial); \> } \> \> \> // Plugin Functions ================================================================================================== \> \> // Declare Global Plugin Registrants \> Bool RegisterPipeDreamObj(); \> Bool RegisterPipeDreamTag(); \> \> //\*---------------------------------------------------------------------------\* \> Bool PluginStart() \> //\*---------------------------------------------------------------------------\* \> { \> Bool network = FALSE; \> LONG vtype = GeGetVersionType(); \> if ((vtype & VERSION_SERVER) || (vtype & VERSION_NET)) network = TRUE; \> #ifdef C4D_R11 \> if (vtype & VERSION_DEMO) GePrint("C4D Demo"); \> else if (vtype & (VERSION_SAVABLEDEMO|VERSION_SAVABLEDEMO_ACTIVE)) GePrint("C4D Savable Demo"); \> else if (vtype & VERSION_SERVER) GePrint("C4D Server"); \> else if (vtype & VERSION_NET) GePrint("C4D Net"); \> else \> { \> // serial number check \> if (!(kdzSerial && kdzSerial->mode)) return FALSE; \> } \> #else \> if (!((vtype & VERSION_DEMO) || network)) \> { \> // serial number check \> if (!(kdzSerial && kdzSerial->mode)) return FALSE; \> } \> #endif \> \> GePrint(" "); \> GePrint(GeLoadString(PDRS_PLUGIN_BANNER)); \> GePrint("-- "+GeLoadString(PDRS_PLUGIN_NAME)+" "+GeLoadString(PDRS_PLUGIN_EDITION)+" v"+GeLoadString(PDRS_PLUGIN_VERSION)+" "+GeLoadString(PDRS_PLUGIN_COPYRIGHT)); \> if (kdzSerial) \> { \> if (kdzSerial->mode == 1) GePrint("-- Trial: "+LongToString(kdzSerial->time)+" days left"); \> else if (kdzSerial->mode == 2) \> { \> SerialInfo si; \> GeGetSerialInfo(SERIAL_CINEMA4D, &si;); \> GePrint("-- Licensed to: "+si.name); \> } \> } \> GePrint(GeLoadString(PDRS_PLUGIN_BANNER)); \> GePrint(" "); \> \> return RegisterPipeDreamObj() && RegisterPipeDreamTag(); \> } \> \> //\*---------------------------------------------------------------------------\* \> void PluginEnd() \> //\*---------------------------------------------------------------------------\* \> { \> } \> \> //\*---------------------------------------------------------------------------\* \> Bool PluginMessage(LONG id, void\* data) \> //\*---------------------------------------------------------------------------\* \> { \> if (id == C4DPL_INIT_SYS) \> { \> // initialize global resource object \> if (!resource.Init()) return FALSE; \> \> // initialize and register Serial Number Hook \> LONG vtype = GeGetVersionType(); \> #ifdef C4D_R11 \> if (vtype & VERSION_DEMO) { GePrint("C4D Demo"); return TRUE; } \> if (vtype & (VERSION_SAVABLEDEMO|VERSION_SAVABLEDEMO_ACTIVE)) { GePrint("C4D Savable Demo"); return TRUE; } \> if (vtype & VERSION_SERVER) { GePrint("C4D Server"); return TRUE; } \> if (vtype & VERSION_NET) { GePrint("C4D Net"); return TRUE; } \> #else \> if ((vtype & VERSION_DEMO) || (vtype & VERSION_SERVER) || (vtype & VERSION_NET)) return TRUE; \> #endif \> return RegisterKDZSerial(); \> } \> else if (id == C4DPL_ENDACTIVITY) \> { \> FreeKDZSerial(); \> return TRUE; \> } \> else if (id == C4DMSG_PRIORITY) return TRUE; \> return FALSE; \> }
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/10/2009 at 23:57, xxxxxxxx wrote:
thank you very much... lets see if i can get the hang of all this finally
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 11:58, xxxxxxxx wrote:
Quote: __
>
> * * *
>
> Note that I donot check the serial number when running Demo, Net, Server.
>
> * * *doesn't that mean that everyone using net could use the plugin??
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 12:40, xxxxxxxx wrote:
Quote: Originally posted by anubis23 on 14 October 2009
>
> * * *
>
>> Quote: __
>>
>> * * *
>>
>> Note that I donot check the serial number when running Demo, Net, Server.
>
>>
>> * * *
>
>
>
>
> doesn't that mean that everyone using net could use the plugin??
>
>
> * * *Yes, but you can't do anything useful except rendering in NET, for example you can't create scenes.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 12:46, xxxxxxxx wrote:
To render and that is all.
Can't do much else without the registered plugin in Cinema 4D itself.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 12:52, xxxxxxxx wrote:
*crosspost*
I don't agree with tcastudios take on this. I don't care if someone has a license version of my plugin or not to do NET Render work. Anyway, without a license for Cinema 4D itself, they can't even load a document and use NET Render to render it from there - they'll just have a bunch of malfunctioning garbage with '?' for the unregistered plugins required. So, they can get a c4d document with my plugin being used and render it with NET Render but that is about it.
For several of the render farms out there, I simply provide them the plugin - no serial number needed. Less work for me, less stress on them.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 14:00, xxxxxxxx wrote:
Robert, there must be a misunderstanding here.
All my plugin do run -without- licenses on NET, and I recommended
that that is a good idea.Having licenses for NET is just a hustle for renderfarms to do installs
and possible just make life complicated for all.What I meant was, in the case that anyone should run them without buying a license (for the main app) they cannot count on any support.
Luckely no problems have turned up and the prominent commercial
renderfarms have all bought a main license.Cheers
Lennart -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 14:50, xxxxxxxx wrote:
I misunderstood then. Sorry about that.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/10/2009 at 23:28, xxxxxxxx wrote:
ah, ok.. didnt know how that whole net thing works.. now i guess i understand..
thanks a lot to all of you!
cheers,
ello -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 07:46, xxxxxxxx wrote:
Hi Robert,
I notice that you use two separate versions of Rijndael.h in your code sample. would you mind sharing what changes you had to make for it to work on Mac?
Thanks,
Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2011 at 21:33, xxxxxxxx wrote:
Shawn,
There were some changes required between the OSs. I'll attached them to a PM.