[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Providing selective access to a VB 6.0 ActiveX DLL

Posted on 2004-11-09
5
Medium Priority
?
154 Views
Last Modified: 2010-05-18
I have an ActiveX DLL that I want to distribute with my application, but I don't want people to be able to use its exposed (public) methods.  Is there a way I can determine from within the ActiveX DLL which Windows program called it, and if the calling program is one of my programs to allow the call but to disregard it otherwise?  

I thought about having my programs just send a secret code to activate the DLL.  Problem is someone could just use my program to activate it, and then make calls to the DLL themselves if I don't have a way of detecting which program is making each individual call.

Thanks for any suggestions!
0
Comment
Question by:scottwb_98
5 Comments
 
LVL 14

Accepted Solution

by:
Shiju Sasidharan earned 1200 total points
ID: 12541743
hi

Set one of the Propery of ur ActiveX Dll as "SecretCode" and in ur coding u fill ur secret code to the property "SecretCode"
and with in Dll for every function and sub routine make a checking whether this SecretCode Property is filled with correct data and proceed only if it is correct

i hope u got the idea

;-)
Shiju
0
 
LVL 8

Expert Comment

by:rajaloysious
ID: 12542919
I guess COM does'nt have any ability to disregard specific calling programs.

But you can always use methods like this mentioned by shijusn.

Cheers
0
 
LVL 5

Expert Comment

by:brianb99999
ID: 12548980
I thought about having my programs just send a secret code to activate the DLL.  Problem is someone could just use my program to activate it, and then make calls to the DLL themselves if I don't have a way of detecting which program is making each individual call.

In the functions/procedures that are public, pass a 'secret code', this way the code needs to be passed and verified everytime the function/procedure is called.  This will avoid the 'Problem is someone could just use my program to activate it, and then make calls to the DLL themselves' problem.

ie
public somesub(secretcode as string)
  if secretcode = "xyz" then
    msgbox "access granted"
    ...
  else
    msgbox "go away"
  end if

Brian.
0
 

Author Comment

by:scottwb_98
ID: 12549102
Only problem is someone could theoretically create their own DLL using the same function names and parameters, and use that to capture the password.  That would render the password effectively useless.  This is why I was thinking detecting which program is calling the DLL would be the best method...
0
 
LVL 5

Expert Comment

by:brianb99999
ID: 12551740
This is why I was thinking detecting which program is calling the DLL would be the best method...
Hmmm, although I am sure there would be a way to do this, I have not needed to.  But what about hiding an entry in the registry whenever your program calls the .dll (removing it straight after the call) and detecting the reg entry?  As long as the reg entry is the first thing the .DLL looks for it should work.

Brian.
0

Featured Post

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!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month18 days, 4 hours left to enroll

830 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