GetProfilesDirectory function
Retrieves the path to the root directory where user profiles are stored.
Syntax
BOOL WINAPI GetProfilesDirectory( _Out_ LPTSTR lpProfilesDir, _Inout_ LPDWORD lpcchSize );
Parameters
- lpProfilesDir [out]
-
Type: LPTSTR
A pointer to a buffer that, when this function returns successfully, receives the path to the profiles directory. Set this value to NULL to determine the required size of the buffer.
- lpcchSize [in, out]
-
Type: LPDWORD
Specifies the size of the lpProfilesDir buffer, in TCHARs.
If the buffer specified by lpProfilesDir is not large enough or lpProfilesDir is NULL, the function fails and this parameter receives the necessary buffer size, including the terminating null character.
Return value
Type: BOOL
TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.
Remarks
The following is an example of the path returned by GetProfilesDirectory in Windows XP:
C:\Documents and Settings
The following is an example of the path returned by GetProfilesDirectory in Windows 7:
C:\Users
To obtain the paths of subdirectories of this directory, use the SHGetFolderPath (Windows XP and earlier) or SHGetKnownFolderPath (Windows Vista) function.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
GetProfilesDirectoryW (Unicode) and GetProfilesDirectoryA (ANSI) |
See also
- User Profiles Overview
- User Profiles Reference
- GetAllUsersProfileDirectory
- GetDefaultUserProfileDirectory
- GetUserProfileDirectory