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.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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
)
<DllImportAttribute("UserEnv.dll", CharSet := CharSet.Auto, SetLastError := true>]
Public Shared Function LoadUserProfile (
hToken As IntPtr,
ByRef refProfileInfo As UserProfileInfo
) As Boolean
Dim hToken As IntPtr
Dim refProfileInfo As UserProfileInfo
Dim returnValue As Boolean
returnValue = UserEnv.LoadUserProfile(hToken,
refProfileInfo)
public:
[DllImportAttribute(L"UserEnv.dll", CharSet = CharSet::Auto, SetLastError = true)]
static bool LoadUserProfile(
IntPtr hToken,
UserProfileInfo% refProfileInfo
)
[<DllImportAttribute("UserEnv.dll", CharSet = CharSet.Auto, SetLastError = true)>]
static member LoadUserProfile :
hToken : IntPtr *
refProfileInfo : UserProfileInfo byref -> bool
No code example is currently available or this language may not be supported.
- 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.
Boolean
If the function succeeds, the return value is
.
If the function fails, the return value is
.
To get extended error information, call
GetLastWin32Error.