The two APIs are very similar, but it is unclear what the differences are and when each should be used (except that LoadUserProfile is specified for use with CreateProcessAsUser, which I do not use. I just impersonate access to the bushes).
LoadUserProfile http://msdn.microsoft.com/en-us/library/bb762281(VS.85).aspx
RegOpenCurrentUser http://msdn.microsoft.com/en-us/library/ms724894(VS.85).aspx
According to the article “Services and the registry”: http://msdn.microsoft.com/en-us/library/ms685145(VS.85).aspx we must use RegOpenCurrentUser for impersonation.
But what to do / should RegOpenCurrentUser do, if the user profile is in roaming - should he download it?
As far as I can tell from these docs, both APIs provide the HKEY_CURRENT_USER handle for the user, representing the stream. Therefore, they both “load” the hive, that is, lock it as a database file and provide it with a descriptor for registry APIs.
It may seem that LoadUserProfile loads the user profile in the same way as the user does when he / she logs in, while RegOpenCurrentUser does not - is this correct? What is the fundamental difference (if any) in how the two APIs mount the hive?
What are the implications and differences (if any) between what happens IF
Is the user logging in or logging out when each of these issued pens is already in use?
Has the user already logged in when each corresponding close function (RegCloseKey and UnloadUserProfile) is called?
Will5801
source share