PRB: RegReplaceKey Fails If User Profiles Are Enabled (214775)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API), when used with:
    • the operating system: Microsoft Windows 95
    • the operating system: Microsoft Windows 98
    • the operating system: Microsoft Windows Millennium Edition

This article was previously published under Q214775

SYMPTOMS

If the RegReplaceKey API is used to replace the registry key of the currently-logged-on user (HKEY_USERS\Username), and user profiles are enabled, the API call fails with a return value of 0x57 (ERROR_INVALID_PARAMETER). The specified registry key is not replaced.

CAUSE

RegReplaceKey does not work on Microsoft Windows 95, Microsoft Windows 98, and Microsoft Windows Millennium Edition (Me) if user profiles are enabled.

RESOLUTION

Microsoft does not recommend using the RegReplaceKey API on Windows 95, Windows 98, and Windows Me.

To restore the Windows 95, Windows 98, Windows Me registry from a backup, Microsoft recommends replacing the registry files (System.dat and User.dat) during the real-mode portion of Windows startup. This method prevents possible registry corruption if another application reads from or writes to the registry while the restore (replace) operation is in progress. This method is used by the Registry Checker utility to restore backed-up copies of the registry.

Note that the Command Prompt Only startup option is not sufficient for this. The registry is still accessed and registry corruption can occur. It is recommended that you use the Autoexec.bat to replace this file as the Autoexec.bat is processed during the real-mode portion of the startup process and before the registry is loaded.

MORE INFORMATION

Please see the References section for additional information about the RegReplaceKey API.

REFERENCES

For additional information about problems with RegReplaceKey under Windows 98, please see the following article in the Microsoft Knowledge Base:

193467 BUG: RegReplaceKey() Fails in Windows 98



For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

141721 HOWTO: Boot to a Command Prompt by Default


Modification Type:MinorLast Reviewed:9/27/2004
Keywords:kbBug kbFAQ kbKernBase kbprb KB214775