CreateRemoteComObject + username/password

I have a Delphi 6 app that attaches to an OPC server via CreateRemoteComObject it works fine as long as the server has been configured to allow access to EVERYONE via DCOMCNFG on the remote machine. I now have a customer who is complaining that they don't want to open up access to EVERYONE for security purposes. My question is: is there a way to include a user name/password in the CreateRemoteComObject function call? I seem to remember something about appending a username/password to the MachineName parameter, but I'm having no luck re-discovering that info via Google.
Who is Participating?
ziolkoConnect With a Mentor Commented:
COM/DCOM is based on windows security mechanism so using user credentials is natural, you can of course try to impersonate your app as other user.
Other way, if you know name and pass of user that is allowed to access remote object, you can create small app that will launch DCOM client with CreateProcessAsUser().

the best and easiest way is to run your app as user that has granted access to DCOM server

BradKilmerAuthor Commented:
Yeah, that was my first thought, but I still would like to know if there is any way to embed to login into my app just in case the customer has some other security reservation. Like I said initially, I thought that I saw a method for doing this by adding the user name/password to the MachineName parameter in the CreateRemoteComObject function call. Am I remembering incorrectly?
Russell LibbySoftware Engineer, Advisory Commented:

You are remembering incorrectly, as CreateRemoteComObject does not let you do this. The following link will give you info on the COM security calls (which are not trivial to use):

As ziolko indicated, you should be using dcomcnfg to specify the clients that are allowed to connect and launch the OPC server.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.