Microsoft KB Archive/214775

{|
 * width="100%"|

PRB: RegReplaceKey Fails on Windows 98 If User Profiles Are Enabled

 * }

Q214775

-

The information in this article applies to:


 * Microsoft Win32 Application Programming Interface (API), on platform(s):
 * Microsoft Windows 98
 * Microsoft Windows 95

-

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 Windows 98 if user profiles are enabled.

RESOLUTION
Microsoft does not recommend using the RegReplaceKey API on Windows 98.

To restore the Windows 98 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 Windows 98 Registry Checker utility to restore backed-up copies of the Windows 98 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.