[Bug] LoadUserProfile and ERROR_PARTIAL_COPY issue

Started by fixer, June 05, 2017, 12:51:08 PM

Previous topic - Next topic

fixer

A couple of days ago a customer emailed us with a problem: ReHIPS fails to create isolated environments on one of PCs. 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_PARTIAL_COPY. 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, registry, etc.). And this is done using new user credentials like this new user is copying files and folders, so copied objects could get proper access rights. But what happens, if somehow there is a file or folder in default user profile that has some bad access rights and thus isn't accessible to the new user? You guessed it right, this file will be failed to copy, Windows will consider it an error and abort operation with ERROR_PARTIAL_COPY. In our case it was C:\Users\Default\AppData\Temp\Temporary Internet Files\counters.dat As I didn't have any Temp folder in C:\Users\Default\AppData on some other PC, I just removed it and the issue was solved.

So keep in mind, someone may create files or folders in Default user profile. And if these files have bad access rights, it will completely block creation of other users.

And I'd like to thank our client for his time and express my gratitude for kindly allowing me to remotely debug this issue on a Sunday afternoon.

motormouth

#1
Hello Thanks for your reply ,I have no such file counter.dat anywhere in user area. I reinstalled rehips with same problem. Any ideas? Thks
I noticed default folder under user my user name does not have admin access under it ,is that normal?

HJLBX

Quote from: motormouth on September 15, 2017, 07:12:40 PM
Hello Thanks for your reply ,I have no such file counter.dat anywhere in user area. I reinstalled rehips with same problem. Any ideas? Thks
I noticed default folder under user my user name does not have admin access under it ,is that normal?

The issue isn't dependent upon the presence of counters.dat; it could be some other file or folder in the default User Profile.  Re-read what fixer said.