Page 1 of 1

Plugin: Multiple instances & One registration dialog

Posted: Mon Mar 12, 2018 1:38 pm
by Enigma
Next example of flexibility of our Enigma Protector with the plugins system!

We recently got a request from user to fit the following licensing scheme: there are multiple instances of protected application are being running, but only one copy should show a registration dialog, others should wait that.

If we try to apply the standard registration dialog feature to this complex scheme, we find that each running copy will show a registration dialog. This is what client would like to avoid.

We decided to develop a small plugin that will create an event object and while the first running copy shows the registration dialog, others will wait until it completes.

Sources of the project for Delphi and Lazarus are in attachment. Binary is also included.

The magic happes there:

Code: Select all

procedure Enigma_Plugin_OnInit;
  errorcode : dword;
  hndl : THandle;
  // This function is calling when the protected file is being initialized
  // when main program is not initialized yet
  if EP_RegLoadAndCheckKey then

  hndl := CreateEvent(nil, true, false, 'ihiyGUgKUgukiU78yoihilh7ilgUgkuhGKJgI');
  if hndl <> 0 then
    errorcode := GetLastError;
    if errorcode = ERROR_ALREADY_EXISTS then
      WaitForSingleObject(hndl, INFINITE);
    end else
  if not EP_RegLoadAndCheckKey then
- first we check if application is already registered with EP_RegLoadAndCheckKey. If it is - continue execution
- then we create an event object
- if the event object is new one, we show a registration dialog
- if event object already exists, we run the wait routine WaitForSingleObjectthat, it waits the event to be signalled
- once first isntance finished with the registration dialog (user entered the license info or just closed it) it signals SetEvent to other processes to continue
- finally, everyone checks again if application is registered and calls ExitProcess on fail.

Re: Plugin: Multiple instances & One registration dialog

Posted: Mon Apr 16, 2018 1:14 pm
by syntax101
This plugin is not working as it should, please refer to email for clarification about this plugins..


Re: Plugin: Multiple instances & One registration dialog

Posted: Sun Apr 22, 2018 11:49 pm
by syntax101
Any update for this plugin sir??