PrfQueryProfile

Syntax
PrfQueryProfile ( hab, pprfproProfile )

Parameters

 * HAB hab (input): Handle to an Anchor Block returned by WinInitialize.
 * PPRFPROFILE pprfproProfile (input/output): Pointer to a PRFPROFILE structure.

Returns

 * BOOL bRC
 * This return value is always either:
 * TRUE Success
 * FALSE Error occurred. Some internal failure, or there was not enough space for the record names. This will cause the names to be truncated.

Include Info
or or
 * 1) define INCL_WINSHELLDATA
 * 1) define INCL_WIN
 * 1) define INCL_PM
 * 2) include

Usage Explanation
This function merely gives you the filenames of the current user and system profiles. If either ULONG field of the PRFPROFILE structure is zero, then rather than write to a buffer, PrfQueryProfile will return in that ULONG the number of bytes required to hold the name. This will allow you to allocate memory for a second call. If those ULONGs are greater than zero, PrfQueryProfile expects that there is sufficient memory allocated in the PSZ fields to store the file names. If there isn't, the names will be truncated to fit.

Gotchas
The biggest "gotcha" applying to this API call is memory management. You should ALWAYS call this function twice; first, with pprfproProfile->cchUserName and pprfproProfile->cchSysName equal to zero. then allocate enough memory based on their returns, and finally call PrfQueryProfile again with the newly allocated buffers.