Unloads a user's profile that was loaded by the LoadUserProfile function. The caller must have administrative privileges on the computer. For more information, see the Remarks section of the LoadUserProfile function.
USERENVAPI BOOL UnloadUserProfile( HANDLE hToken, HANDLE hProfile );
Token for the user, returned from the LogonUser, CreateRestrictedToken, DuplicateToken, OpenProcessToken, or OpenThreadToken function. The token must have TOKEN_IMPERSONATE and TOKEN_DUPLICATE access. For more information, see Access Rights for Access-Token Objects.
Handle to the registry key. This value is the hProfile member of the PROFILEINFO structure. For more information see the Remarks section of LoadUserProfile and Registry Key Security and Access Rights.
TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.
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. For more information, see Registry Key Security and Access Rights and Registry Hives.
For more information about calling functions that require administrator privileges, see Running with Special Privileges.
|Windows version||Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]|