SNHook not working

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 03/11/2012 at 17:37, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R14 
Platform:   Windows  ;   
Language(s) :     C++  ;

---------
Hey Guys,

I want to protect my plugin so I use the SNHook.
Cinema ask for serial, all fine. But if the serial is wrong and i click cancel, the plugin is still loaded?!?

I tried it at R13 and my mate in R14. What do I wrong?

  
//-----------------------------------------------------------------------------------------------------------------------------------------------------------//  
LONG RoomMakerSNHook::SNCheck(const String &c4dsn,const String &sn,LONG regdate,LONG curdate)  
//-----------------------------------------------------------------------------------------------------------------------------------------------------------//  
{      
  return SN_WRONGNUMBER;  
}  
  
case C4DPL_INIT_SYS:  
          if (!resource.Init()) return FALSE; // don't start plugin without resource  
  
          // serial hook example; if used must be registered before PluginStart(), best in C4DPL_INIT_SYS  
          if (!RegisterExampleSNHook()) return FALSE;  

Nothing, it still load my objectData !?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/11/2012 at 01:29, xxxxxxxx wrote:

Returning FALSE from PluginMessage() when C4DPL_INIT_SYS is sent does not prevent Cinema to call PluginStart(). Ask your SNHook subclass instance if it registration was successful.

-Niklas

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/11/2012 at 03:51, xxxxxxxx wrote:

My Subclass?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/11/2012 at 05:33, xxxxxxxx wrote:

RoomMakerSNHook is your subclass of the SNHook class, isn't it?

LONG RoomMakerSNHook::SNCheck(const String &c4dsn,const String &sn,LONG regdate,LONG curdate) {  
  Bool registration_successful = FALSE;  
  /* ... */  
  this->success = registration_successful;  
  if (!registration_successful) return SN_WRONGNUMBER;  
  else return SN_OKAY;  
}  
  
Bool RoomMakerSNHook::Success() {  
  return this->success;  
}  
  
/* ... */  
  
RoomMakerSNHook snhook;  
  
Bool PluginStart() {  
  if (!snhook->Success()) return TRUE;  
  /* Register your plugins. */  
}  
  
Bool PluginMessage(LONG id, void* ptr) {  
  switch (id) {  
      case C4DPL_INIT_SYS:  
          /* Register SNHook and etc. */  
          break;  
  }  
  return TRUE;  
}

That's how I was doin' it. Maybe I missed something obvious. But it works.

Cheers,

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/11/2012 at 01:11, xxxxxxxx wrote:

All right. Thank you. :)