This example calls PrfQueryProfile to obtain a description of the current user and system profiles, in this case querying the lengths of the user and system profile file names and placing the values in variables.
#define INCL_WINSHELLDATA /* Window Shell functions */
#include <os2.h>
BOOL fSuccess; /* success indicator */
HAB hab; /* anchor-block handle */
PRFPROFILE pprfproProfile; /* Profile names structure */
ULONG ulUserNameLen; /* length of user file name */
ULONG ulSysNameLen; /* length of system file name */
/* initialize lengths so that query will return the buffer sizes*/
pprfproProfile.cchUserName = 0L;
pprfproProfile.cchSysName = 0L;
fSuccess = PrfQueryProfile(hab, &pprfproProfile);
if (fSuccess == TRUE)
{
ulUserNameLen = pprfproProfile.cchUserName;
ulSysNameLen = pprfproProfile.cchSysName;
}