سؤال

I am facing a rather strange and very specific DCOM related problem and I am hoping someone might have encountered it and solved it.

I am trying to instantiate a COM object in an EXE server on a Windows 7 machine (call it W7). The client resides on a Windows XP machine (call it WXP). On WXP the logged-in user is a domain user. On W7 the user is a local user. I have (afaik) correctly set all the DCOM rights, authentication and account privileges. There is no firewall involved.

All I get is that the COM EXE server process is started on W7, with the username I expect, but does not seem to even reach its WinMain function and remains hanging and never dies unless I kill it. I can attach a remote debugger (Visual Studio 2010) to it which will warn me that the process might be deadlocked, and when I break it, it stops in a message queue loop (GetMessage/Dispatch).

The client gets a (seemingly valid) pointer but any attempt to use it, results in E_ACCESSDENIED.

If anything from the scenario above is changed, the instantiation of the COM object succeeds and the object behaves correctly.

I know the chance is slight to find an answer but any tip is extremely welcome.

Thanks.

هل كانت مفيدة؟

المحلول

DCOM client and server either needs to be both the same local administrator on workgroup, or domain users on the same domain.

You can use this test app to check if your two machines are configured correctly: http://support.microsoft.com/kb/259011 This way you make sure that your machine's permission and firewall are setup properly first without your own code.

نصائح أخرى

Answering my own question...

It turns out that in the client CoInitializeSecurity didn't have all credentials it needed after all... It was called too early, before the credentials were known.

I discovered this after using CoSetProxyBlanket (as described here: How does impersonation in DCOM work?) on each component I was instantiating. Every component on which I called CoSetProxyBlanket was correctly working. This triggered me to go and double check the CoInitializeSecurity.

It remains strange that the reverse connection (from W7 to WXP) worked, but this is another research I need to do. The current question can be closed.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top