Microsoft KB Archive/217182

= Descriptions are not added to the registry when using the DECLARE_REGISTRY macro =

Article ID: 217182

Article Last Modified on 9/1/2005

-

APPLIES TO

 Microsoft ActiveX Template Library 3.0, when used with:  Microsoft Visual C++ 6.0 Enterprise Edition

 Microsoft Visual C++ 6.0 Professional Edition

 Microsoft Visual C++ 6.0 Standard Edition 

-

<div class="notice_section">

This article was previously published under Q217182

<div class="symptoms_section">

SYMPTOMS
The DECLARE_REGISTRY macro in ATL allows you to pass a string resource ID, which serves as a description and is supposed to be added to the registry as default values for the following keys:

<pre class="fixed_text">HKCR\<ProgID> HKCR\<Version Independent ProgID> HKCR\CLSID\<CLSID> In ATL 3.0, the string is not added to the registry.

<div class="cause_section">

CAUSE
CComModule::RegisterProgID and CComModule::RegisterClassHelper are used with the DECLARE_REGISTRY macro. Both functions create registry keys with only the KEY_READ flag, allowing only read access.

<div class="resolution_section">

RESOLUTION
Modify CComModule::RegisterProgID and CComModule::RegisterClassHelper so that the calls to CRegKey::Create take KEY_READ|KEY_WRITE instead of just KEY_READ. Modify the following lines from: // line 4909 in ATLBASE.H in CComModule::RegisterProgID LONG lRes = keyProgID.Create(HKEY_CLASSES_ROOT, lpszProgID, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_READ); and // line 5033 in ATLBASE.H in CComModule::RegisterClassHelper lRes = key.Create(key, lpsz, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_READ); to LONG lRes = keyProgID.Create(HKEY_CLASSES_ROOT, lpszProgID, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE); and lRes = key.Create(key, lpsz, REG_NONE, REG_OPTION_NON_VOLATILE, KEY_READ|KEY_WRITE);

<div class="status_section">

STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section. This bug was corrected in Visual Studio 6.0 Service Pack 3.

<div class="references_section">