UserEnvLoadUserProfile Method

Loads the specified user's profile. The profile can be a local user profile or a roaming user profile.

The caller must have administrative privileges to load 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", CharSet = CharSet.Auto, SetLastError = true)]
public static bool LoadUserProfile(
	IntPtr hToken,
	ref UserProfileInfo refProfileInfo
)

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 Query, Impersonate, and Duplicate access.

refProfileInfo  UserProfileInfo
Pointer to a UserProfileInfo structure.

The function LoadUserProfile(IntPtr, UserProfileInfo) fails and returns E_INVALIDARG if the SizeOfStruct member is not set to Marshal.SizeOf(Of UserProfileInfo) or if the UserName member is .

If this parameter is , the function obtains the path from the registry.

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