Store licensing information

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

I would like to store a licensing information in a assembly.
It's easy to crypt/decrypt it, but how to stote it, if my app is
referencing and using this dll?
Is this possible?
 
Hi Nikolay,

You can create assemblies dynamically using the System.Reflection.Emit
namespace, AssemblyBuilder class, AddResourceFile method, etc. but I don´t
think that you can add resources dynamically to an assembly in use.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Hi Carlos,
If an assemply si not in use, can I add resources to it? If so, then
can I load assembly dynamicly?
I guess reading resources from assembly is not a problem if it is in
use. Can I unload assemlby, store the resouce and load it again?
 
This is a challenging problem and I don´t know if it is feasible or not, but
here you have some info:

- To create or manage Assemblies programatically you have to use
System.Reflection.Emit.DynamicAssembly.
- You can create an instance of DynamicAssembly with
AppDomain.DefineDynamicAssembly. I don´t know if you can get a
DynamicAssembly from an already existing Assembly. If the assembly is on
disk and unloaded, certainly you can disassemble it with ildasm.exe, add the
resource, and recompile it (some obfuscators use this technique to rename
symbols, etc.)
- You can add resources to a DynamicAssembly with the methods
AddResourceFile, DefineResource, DefineUnmanagegResource, etc.
- You can save the DynamicAssembly to disk with the Save method.
- You can load assemblies dynamically using Assembly.Load, Assembly.LoadFrom
or Assembly.LoadWithPartialName
- You can not unload assemblies from an AppDomain, you need to unload the
whole AddDomain, which is only possible for secondary AppDomains.

BTW, why can´t you store the license information in a separate XML file or
something like that?

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top