1 out of 1 rated this helpful - Rate this topic

PROFILEINFO structure

Applies to: desktop apps only

Contains information used when loading or unloading a user profile.

Syntax

typedef struct _PROFILEINFO {
  DWORD  dwSize;
  DWORD  dwFlags;
  LPTSTR lpUserName;
  LPTSTR lpProfilePath;
  LPTSTR lpDefaultPath;
  LPTSTR lpServerName;
  LPTSTR lpPolicyPath;
  HANDLE hProfile;
} PROFILEINFO, *LPPROFILEINFO;

Members

dwSize

Type: DWORD

The size of this structure, in bytes.

dwFlags

Type: DWORD

This member can be one of the following flags:

PI_NOUI

Prevents the display of profile error messages.

PI_APPLYPOLICY

Not supported.

lpUserName

Type: LPTSTR

A pointer to the name of the user. This member is used as the base name of the directory in which to store a new profile.

lpProfilePath

Type: LPTSTR

A pointer to the roaming user profile path. If the user does not have a roaming profile, this member can be NULL. To retrieve the user's roaming profile path, call the NetUserGetInfo function, specifying information level 3 or 4. For more information, see Remarks.

lpDefaultPath

Type: LPTSTR

A pointer to the default user profile path. This member can be NULL.

lpServerName

Type: LPTSTR

A pointer to the name of the validating domain controller, in NetBIOS format.

lpPolicyPath

Type: LPTSTR

Not used, set to NULL.

hProfile

Type: HANDLE

A handle to the HKEY_CURRENT_USER registry subtree. For more information, see Remarks.

Remarks

Do not use environment variables when specifying a path. The LoadUserProfile function does not expand environment variables, such as %username%, in a path.

When the LoadUserProfile call returns successfully, the hProfile member receives a registry key handle opened to the root of the user's subtree, opened with full access (KEY_ALL_ACCESS). For more information see the Remarks sections in LoadUserProfile, Registry Key Security and Access Rights, and Registry Hives.

Services and applications that call LoadUserProfile should check to see if the user has a roaming profile. If the user has a roaming profile, specify its path as the lpProfilePath member of this structure.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Profinfo.h (include Userenv.h)

Unicode and ANSI names

PROFILEINFOW (Unicode) and PROFILEINFOA (ANSI)

See also

User Profiles Overview
LoadUserProfile
UnloadUserProfile

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Don't pass "domainname\username" for lpUserName; just pass "username"
To clarify, passing domainname\username will appear to work if the already has a profile created on the local machine. However, if the user does not have a profile on the local machine then the string in "lpUserName" will be used to create a directory to contain the new profile. If the string contains a "\" then the path cannot be created and the function will fail. Instead, simply pass the username without the domain as returned by GetUserName().
Roaming Profiles
Using LoadUserProfile with roaming profiles is not fully explained here. When using local profiles the lpUserName field can be domain\username without issue. However, the lpUserName field is used to create both the local profile path and the roaming profile path in Windows 2008 R2 at least. So the domain name becomes part of both paths. In our situation, LoadUserProfile would always create a temporary profile when lpUserName contains domain\username. When looking at HKLM\Software\Microsoft\WindowsNT\CurrentVersion\ProfileList\{SID} the contents of the CentralProfile string contained a bad path that included the domain name. We have experimented with the following and are making much better progress: 1. lpUserName contains just the username, not the domain name. 2. lpServerName now contains the NetBIOS form of the domain server name (take the highest level of the domain name, mydomain, trim or pad with blanks to 15 characters and append \u001B) and 99% of the time it is correct. Domain admins must go way out there way to use a different NetBIOS name. 3. Provide lpProfilePath from NetUserGetInfo. It seems to establish better paths and work.