Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 371
  • Last Modified:

Avoid DLL Load

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
cebasso
Asked:
cebasso
  • 3
  • 2
1 Solution
 
Ephraim WangoyaCommented:

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
 
cebassoAuthor Commented:
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
 
Ephraim WangoyaCommented:

Correct, check when attaching process
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
jimyXCommented:
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
 
Ephraim WangoyaCommented:

@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
 
cebassoAuthor Commented:
Thank you!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now