UserEnvUnloadUserProfile Method

Unloads a user's profile that was loaded by the LoadUserProfile(IntPtr, UserProfileInfo) function.

The caller must have administrative privileges to unload a user's profile.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("UserEnv.dll", EntryPoint = "LoadUserProfile", CharSet = CharSet.Auto, 
	SetLastError = true)]
public static bool UnloadUserProfile(
	IntPtr hToken,
	IntPtr hProfile
)

Parameters

hToken  IntPtr
Token for the user, which is returned by the LogonUser, CreateRestrictedToken, DuplicateToken(IntPtr, SecurityImpersonationLevel, IntPtr), OpenProcessToken(SafeProcessHandle, TokenAccess, IntPtr), or OpenThreadToken(IntPtr, TokenAccess, Boolean, IntPtr) function.

The token must have Impersonate, and Duplicate access.

hProfile  IntPtr
Handle to the registry key.

This value is the RegistryHandle member.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also