Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

The logon operation fails when you use Terminal Services to log on to a DCOM server from a Windows-based server


View products that this article applies to.

Symptoms

You use Terminal Services to log on to a DCOM server from a Microsoft Windows-based server. However, the logon operation fails. Additionally, you receive the following error message:
0x80070002 (ERROR_FILE_NOT_FOUND)
This problem occurs when the following conditions are true:
  • The host computer and the client computer are running Microsoft Windows Server 2003, Microsoft Windows XP, or Microsoft Windows 2000.

    Note The host computer and the client computer are not necessarily running the same operating system.
  • The client dynamic link library (DLL) and the Active Template Library (ATL) are installed on the client computer.
  • The ATL executable (.exe) file is set to run under the Launching User identity of the Component Object Model (COM).
  • The Component Object Model (COM) client calls the CoCreateInstance function on an out-of-process COM executable file. This COM executable file is loaded by the WinLogon.exe process when you start the client computer and every time that you try to start a new Terminal Services session.
You do not experience this problem when you log on locally to the host computer. The result from a call to the CoCreateInstance function is written to a log file that reports that the CoCreateInstance function succeeded. Specifically, HRESULT 0 (S_OK) is returned.

↑ Back to the top


Cause

This problem occurs because DCOM cannot create a COM component by calling the CoCreateInstance function during the logon event.

When you log on to the computer, the Winlogon.exe process loads the client DLL. The Winlogon.exe process, in turn, calls the ATL server. DCOM calls the CoCreateInstance function after the connection is made to the server and before the Graphical Identification and Authentication (GINA) user interface appears. This behavior creates a nonzero session. DCOM cannot start a COM server in a nonzero session until Terminal Services has finished initializing and processing the user logon event.

Terminal Services also uses a Winlogon notification DLL. The client registers for the session startup event. This behavior occurs before Terminal Services receives the logon event. Even if the client has also started by using the logon event, the Winlogon.exe process does not guarantee the order in which notification DLLs are loaded. Therefore, this process does not work reliably.

↑ Back to the top


Workaround

To work around this problem, use one of the following methods:
  • Start the COM server asynchronously when you start the session. If the logon attempt fails, try to log on again.
  • Use the WtsWaitSystemEvent(WTS_EVENT_LOGON) function in your code. The Terminal Services session is then fully initialized, and COM activations run successfully.

↑ Back to the top


Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

↑ Back to the top


References

For more information about the WtsWaitSystemEvent function, visit the following Microsoft Web site:

↑ Back to the top


Keywords: KB922215, kbprb, kbtshoot, kbexpertiseadvanced, kberrmsg

↑ Back to the top

Article Info
Article ID : 922215
Revision : 4
Created on : 5/30/2007
Published on : 5/30/2007
Exists online : False
Views : 284