Solved

Avoid DLL Load

Posted on 2011-03-18
6
360 Views
Last Modified: 2012-05-11
Hello,

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?

Regards
0
Comment
Question by:cebasso
  • 3
  • 2
6 Comments
 
LVL 32

Accepted Solution

by:
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
0
 
LVL 4

Author Comment

by:cebasso
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?
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 35168392

Correct, check when attaching process
0
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

by:jimyX
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;
begin
  if Not Param2 = 'Allow' then // you can have list
    begin
      Result := 'Access to DLL not authorized';
      exit;
    end;

  //Authorized access continues
  ...
end;

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.
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 35168581

@jimyx
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.
0
 
LVL 4

Author Closing Comment

by:cebasso
ID: 35180479
Thank you!
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
URL for downloading Google Chrome for Win XP 2 232
delphi parse string to params 3 151
select query - oracle 16 101
Firemonkey allowing RTL on android 6 56
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

680 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