[This function is unavailable in Windows Vista and Windows Server "Longhorn"]

The unsupported CreateUserProfileEx function creates a user profile for the given user.

BOOL WINAPI CreateUserProfileEx(
  PSID pSid,
  LPCWSTR lpUserName,
  LPCWSTR lpUserHive,
  LPWSTR lpProfileDir,
  DWORD dwDirSize,
  BOOL Reserved


  • pSid
    [in] The SID of the new user.
  • lpUserName
    [in] The user name of the new user.
  • lpUserHive
    [in, optional] The registry hive to use. This parameter can be NULL.
  • lpProfileDir
    [out, optional] Receives the user's profile directory. This parameter can be NULL.
  • dwDirSize
    [in] Size of the user's profile directory specified by lpProfileDir.
  • Reserved
    [in] Set value to FALSE.

Return Value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.


This function is not declared in the SDK headers and has no associated import library. You must use the LoadLibrary and GetProcAddress functions to link to Userenv.dll.

This function is not available in Windows Vista or Windows Server "Longhorn".


DLL Requires Userenv.dll.