GetAppContainerFolderPath function

Gets the path of the local app data folder for the specified app container.

Syntax

USERENVAPI HRESULT GetAppContainerFolderPath(
  PCWSTR pszAppContainerSid,
  PWSTR  *ppszPath
);

Parameters

pszAppContainerSid

A pointer to the SID of the app container.

ppszPath

The address of a pointer to a string that, when this function returns successfully, receives the path of the local folder. It is the responsibility of the caller to free this string when it is no longer needed by calling the CoTaskMemFree function.

Return Value

This function returns an HRESULT code, including but not limited to the following:

Return code Description
S_OK
The operation completed successfully.
E_INVALIDARG
The pszAppContainerSid or ppszPath parameter is NULL.

Remarks

The path retrieved through this function is the same path that you would get by calling the SHGetKnownFolderPath function with FOLDERID_LocalAppData.

If a thread token is set, this function uses the app container for the current user. If no thread token is set, this function uses the app container associated with the process identity.

Requirements

   
Windows version Windows 8 [desktop apps only] Windows Server 2012 [desktop apps only]
Target Platform Windows
Header userenv.h
Library Userenv.lib
DLL Userenv.dll

See Also

GetAppContainerRegistryLocation