dotNet Protector Samples - Activation System

DllActivation solution sample

 

DllActivation shows how to activate a Dll, and helps understand the 2 dll activation mode available in dotNet Protector: activate to run and activate to reference.

NOTE: Protected dlls need the runtime to work.

1.       PvLogiciels.dotNetProtector.Runtime.dll is the common runtime

2.       PvLogiciels.dotNetProtector.RuntimeV1 is the v1.1 (x86 only) runtime

3.       PvLogiciels.dotNetProtector.RuntimeX86 is the v2/x86 runtime

4.       PvLogiciels.dotNetProtector.RuntimeAMD64 is the v2/x64 runtime

5.       PvLogiciels.dotNetProtector.RuntimeItanium is the v2/IA64 runtime

This is a v2 project. 1 and 3 are needed if you run in a 32bit process, 1 and 4 on x64, 1 and 5 on ia64

 

DllToActivate : This is the dummy dll we are supposed to protect.

 

ActivateToRun : a simple exe that consumes the dll. This exe references the ‘activate to run’ protected version of the dll.

 

ActivateToReference : the same as above, but references the ‘activate to reference’ version.

Notice the ActivateToReference.licx file in project: it tells VS to launch LicenseCompiler (LC.EXE) to build a runtime license resource.

The licx syntax for dotNet Protector is straightforward:

The licensed type is always <dotNetProtector>, followed by your component assembly name.

In this case : <dotNetProtector>, DllToProtect

 

Keygen : the same as in ActivationSample.

 

ActivateToRun.dpp : dotNet Protector Project that protects the dll with ‘activate to run’ option

 

ActivateToReference.dpp : dotNet Protector Project that protects the dll with ‘activate to Reference’ option

 

Building the solution

1.       Export your keyset (from dotNet Protector’s menu Tools/Export Keyset) to the keygen  directory.

2.       Rebuild keygen and protect it (keygen.dpp)

3.       Protect the dll using ActivateToRun.dpp and ActivateToReference.dpp

4.       Run Keygen for each protected dll

. keygen 1000 ActivateToRun\DllToActivate.dll

. keygen 1001 ActivateToReference\DllToActivate.dll

5.       Rebuild ActivateToRefence.exe

6.       Run ActivateToRun.exe : An exception should occur when you click ‘Dll Invoke’

7.       Copy ActivateToRun\DllToActivate.dll.license to ActivateToRun\bin\debug. ActivateToRun should run without exception. (‘Dll Invoke’ should display a dialog saying ‘Hello, world’)

8.       Run ActivateToReference.exe. No license needed at run time. It should work without a license file.

 

 

Send comments about this topic to PV Logiciels