Group: Shell Functions - Library: userenv
BOOL WINAPI UnloadUserProfile(
_In_ HANDLE hToken,
_In_ HANDLE hProfile
);
DECLARE UnloadUserProfile IN userenv;
INTEGER hToken,;
INTEGER hProfile
hToken [in] Type: HANDLE Token for the user, returned from the LogonUser, CreateRestrictedToken, DuplicateToken, OpenProcessToken, or OpenThreadToken function.
hProfile [in] Type: HANDLE Handle to the registry key. This value is the hProfile member of the PROFILEINFO structure.
TRUE if successful; otherwise, FALSE.
Before calling UnloadUserProfile you should ensure that all handles to keys that you have opened in the user"s registry hive are closed. If you do not close all open registry handles, the user"s profile fails to unload.
See also: LoadUserProfile.