GetProfilesDirectoryA function (userenv.h)
Retrieves the path to the root directory where user profiles are stored.
USERENVAPI BOOL GetProfilesDirectoryA( [out] LPSTR lpProfileDir, [in, out] LPDWORD lpcchSize );
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.
[in, out] lpcchSize
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.
TRUE if successful; otherwise, FALSE. To get extended error information, call GetLastError.
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:
The userenv.h header defines GetProfilesDirectory as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.
|Minimum supported client||Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|