Avoid DLL Load

Posted on 2011-03-18
Last Modified: 2012-05-11

In my app, i have some DLLs that is used as a SDK... i mean, my app has a SDK where others programmers can use it...

Anyway, some DLLs has functions where can be used outside my app, like copying it and using in another app...

What is the best way to avoid it? some idea like, link each DLL example

DLLA linked with DLLB and DLLB with DLLC etc

so, trying to load just one will show that msg like "DLLC not found"

some idea?

Question by:cebasso
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 32

Accepted Solution

Ephraim Wangoya earned 500 total points
ID: 35168345

Statically linking them is just a headache even for you. Suppose you only wanted to distribute one DLL. That would be very limiting.

You can add code to the DLL that checks what application initiated them (Get the handle of the calling application and check for an identifier). if it is not your application, then show an error message and kill the process

Author Comment

ID: 35168367
hmm nice, like a Mutex?
the same way from prevent multiples app instance right?

ok but, in that DLL i add the code over DLL_PROCESS_ATTACH?
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 35168392

Correct, check when attaching process
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 24

Expert Comment

ID: 35168452
I am sure there are many better ways but how about creating key (or list of passwords) that you store and check whenever the function is called from the DLL:

function AddIntegers(Param1 :integer; Param2 :string): string; stdcall;
  if Not Param2 = 'Allow' then // you can have list
      Result := 'Access to DLL not authorized';

  //Authorized access continues

Open in new window

That was just a simple example you can make it difficult by having internal encryption/decryption functions to make it more complicated.
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 35168581

And you check the passwords against what?
It does not matter whether you encrypt a password that you store in your application, its still in the application which means its accessible any time.

Author Closing Comment

ID: 35180479
Thank you!

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi application Soap connection 5 152
Delphi 2 91
Error E2158 compiling with Delphi XE10 Seattle 2 141
How to create virtual printer while installing my application 5 83
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question