ReHIPS forum

English Subforum => Developers' Blog => Topic started by: fixer on June 11, 2018, 12:52:46 PM

Title: [BUG] LoadUserProfile and ERROR_BADDB issue
Post by: fixer on June 11, 2018, 12:52:46 PM
Some time ago we faced a problem: ReHIPS fails to create isolated environments on one of test users' PCs showing "Failed to create user environment" error. When I started debugging it, it turned out it had nothing to do with ReHIPS, but it completely blocked creation of other users, so I decided to make a blogpost about it. So what went wrong?

After some debugging it turned out LoadUserProfile API for a newly created user failed with ERROR_BADDB. So what does this API do? It ensures that user profile is created and loaded. If the user has just been created, there is no profile for him, so it should be created. The profile is mostly created by copying settings from Default user (files and folders from C:\Users\Default). Among these files there is a ntuser.dat file. Registry resides in this file. Sometimes Windows may corrupt this file (maybe because of some update, maybe something else, not sure), and STATUS_REGISTRY_CORRUPT will be returned on an attempt to load this corrupted registry. This will fail user environment creation and hence ReHIPS inability to use isolated environment. While it's a Windows bug, ReHIPS may speed things up as it extensively uses user profiles. To solve this issue a valid ntuser.dat was copied from another PC.