Microsoft SDK for Java

Q223367 FIX: RegistryKey setValue() Fails Terminating Character on NT

The information in this article applies to:

SYMPTOMS

RegistryKey.setValue might not set the value of a registry key correctly. This problem only occurs on Microsoft® Windows NT®.

CAUSE

The setValue method, when executed under Windows NT, does not account for the terminating null character, which causes incorrect data to be written to the registry key.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This bug was corrected in Microsoft® Visual Studio® 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a new Console Application.

  2. Import com.ms.wfc.app.*

  3. Add the following code to main:
    RegistryKey r = Registry.CURRENT_USER.createSubKey
    ("Software\\Microsoft\\VisualStudio\\6.0\\Debugger");
    
    r.setValue("Test1","ABC");
    r.setValue("Test2","DEF");
    r.setValue("Test3","XYZ");
    r.setValue("Test2","");
  4. Compile and run the code.

  5. View the specified keys in REGEDIT.

    Without Visual Studio Service Pack 3, the key "Test2" will hold the value of one of its peer keys.

© 1999 Microsoft Corporation. All rights reserved. Terms of use.