Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
We have a COM component (local server say B.exe which runs on the same machine as client) that needs to run as a user who has administrative rights. However, user(s) who launch main application do not have administrative rights.

We are using “CreateProcessWithLogonW”to launch COM component B with credential of a user who has administrative rights (In DCOMCNFG we specify the same user to run this COM component as “This user”) and later we call CreateInstance() to get the interface pointers to access the component. This mechanism works well on Windows XP.
However this same mechanism doesn’t work on Windows 7, when we say CreateInstance(),
DCOM tries to launch another instance of the process even though one is already running with the same user credential (by earlier call toCreateProcessWithLogonW).This DCOM attempt to launch another instance of the process times out with an error “server execution failed”

To simplify on Windows 7, I tried a COM client & server test in which I logged into computer as a user who has administrative rights and specified the same user in DCOMCNFG to run the COM component as “This user”. I followed the same mechanism as above by using “CreateProcessWithLogonW”to launch COM component and then call CreateInstance() to get the interface pointers, even in this simple case DCOM tried to launch another instance of the process but failed after timeout with an error “server execution failed”.

If in DCOMCNFG, I use any option other than “This user” then, it works fine.
If both DCOM client and server are running under the same user account, why DCOM/COM launcher is not forcing client to use the existing server instance? What I am missing here?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900