GetProfilesDirectoryA function

Retrieves the path to the root directory where user profiles are stored.

Syntax

USERENVAPI BOOL GetProfilesDirectoryA(
  LPSTR   lpProfileDir,
  LPDWORD lpcchSize
);

Parameters

lpProfileDir

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

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]
Target Platform Windows
Header userenv.h
Library Userenv.lib
DLL Userenv.dll

See Also

GetAllUsersProfileDirectory

GetDefaultUserProfileDirectory

GetUserProfileDirectory

User Profiles Overview

User Profiles Reference