Microsoft KB Archive/185677

= FIX: ATL Service with Space in Name Is Not Registered Correctly =

Article ID: 185677

Article Last Modified on 12/1/2003

-

APPLIES TO

 Microsoft ActiveX Template Library 2.0, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition

 Microsoft Visual C++ 4.2 Professional Edition

 Microsoft Visual C++ 5.0 Enterprise Edition

 Microsoft Visual C++ 5.0 Professional Edition</li></ul> </li> Microsoft ActiveX Template Library 2.1, when used with:  Microsoft Visual C++ 4.2 Enterprise Edition</li></ul>

 Microsoft Visual C++ 4.2 Professional Edition</li></ul>

 Microsoft Visual C++ 5.0 Enterprise Edition</li></ul>

 Microsoft Visual C++ 5.0 Professional Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q185677

<div class="symptoms_section">

SYMPTOMS
If you create an ATL service exposing a COM object, with a space in the name, such as "A Service," you may see multiple instances of the executable. If you do not have the HKCR\CLSID\{CLSID}\LocalServer32 key for the COM object, then you may get an HRESULT of 0x80040154 (class not registered).

<div class="cause_section">

CAUSE
This is a bug in the ATL wizard-generated code when you create an ATL NT- service project with an embedded space in the service name. For example, if you create "A Service," the wizard generated code installs "AService" as the service name with the Service Controller Manager database, but registers "A Service" under HKCR\AppID\{APPID}\LocalService.

When a client tries to create the COM object exposed by the service, COM attempts to start "A Service," fails and starts .exe under the LocalServer32 entry instead. As a result, you see multiple instances (one was a service that you started manually from the Services application; the other a regular win32 process started by COM from the LocalServer32 entry). When the LocalServer32 key is not present, you get an HRESULT of 0x80040154.

<div class="resolution_section">

RESOLUTION
In the resource editor, modify the string resource "IDS_SERVICENAME" to put the spaces back into the service name.

<div class="status_section">

STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Visual C++ version 6.0 for Windows.

(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Chuck Bell, Microsoft Corporation

Additional query words: kbatliss kbatlservice

Keywords: kbbug kbfix kbregistry kbvc600fix kbatl300fix kbwizard KB185677

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.