Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent a dll from being loaded in other apps

currently I develop a C#.Net application in which I'm using a custom control I developed some time ago. I need the dll to be shipped within the new application - but understandably I do not want the dll file to be used for foreign apps.

That's why I need the custom dll to be somehow compiled within the new application. Currently the dll is copied into the application directory.

Any ideas? Should be trivial imho.

Thanks & regards, Daniel

like image 434
dhh Avatar asked May 24 '10 18:05

dhh


People also ask

Can two applications use the same DLL?

It's possible. You could install the DLL in the GAC (requires strong named assemblies) in order for both applications to have easy access to it. Or stick it in a folder and have both apps search that folder for the dll.

How do I disable DLL files?

Type "regsvr32 /u DLL NAME" into the command prompt, substituting the actual DLL name without the brackets for "DLL NAME." Press enter. The DLL file is now no longer running on your system.

How do I protect a DLL file?

Keep the DLL in a resource and expose it in the file system (under a suitably obscure name, perhaps even generated at run time) only when running. Hide all real functions behind a factory method that exchanges a secret (better, proof of knowledge of a secret) for a table of function pointers to the real methods.

How do I find out what app is using a DLL?

Process Explorer has a facility that allows you to search through the currently running processes for a specific file. To perform this search go to Find -> Find Handle or DLL... and then enter the name of the file you are interested in.


1 Answers

I think you need to be looking into licensing your control(s): http://msdn.microsoft.com/en-us/library/fe8b1eh9.aspx

like image 156
lesscode Avatar answered Nov 15 '22 21:11

lesscode