FIX: ATL Service with Space in Name Is Not Registered Correctly (185677)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 2.0, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2b
- Microsoft Visual C++, 32-bit Professional Edition 4.2b
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
- The Microsoft Active Template Library (ATL) 2.1, when used with:
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2b
- Microsoft Visual C++, 32-bit Professional Edition 4.2b
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q185677 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).
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.
RESOLUTION
In the resource editor, modify the string resource "IDS_SERVICENAME" to put
the spaces back into the service name.
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
Modification Type: | Major | Last Reviewed: | 12/1/2003 |
---|
Keywords: | kbATL300fix kbBug kbfix kbRegistry kbVC600fix kbwizard KB185677 |
---|
|