Click to Rate and Give Feedback
MSDN
MSDN Library
Windows Development
Windows Shell
Shell Reference
Shell Functions
 UnloadUserProfile function
UnloadUserProfile function

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.

Syntax

BOOL WINAPI UnloadUserProfile(
  __in  HANDLE hToken,
  __in  HANDLE hProfile
);

Parameters

hToken [in]

Type: HANDLE

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.

hProfile [in]

Type: HANDLE

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.

Return value

Type: BOOL

TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.

Remarks

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.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Userenv.h

Library

Userenv.lib

DLL

Userenv.dll

See also

User Profiles Overview
User Profiles Reference
LoadUserProfile
PROFILEINFO

 

 

Send comments about this topic to Microsoft

Build date: 9/7/2011

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2012 Microsoft. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker