CreateDirectoryFromAppW function (fileapifromapp.h)

Creates a new directory. The behavior of this function is identical to CreateDirectory, except that this function adheres to the Universal Windows Platform app security model.

Syntax

WINSTORAGEAPI BOOL CreateDirectoryFromAppW(
  LPCWSTR               lpPathName,
  LPSECURITY_ATTRIBUTES lpSecurityAttributes
) noexcept;

Parameters

lpPathName

The path of the directory to be created.

For information about opting out of the MAX_PATH limitation without prepending "\\?\", see the "Maximum Path Length Limitation" section of Naming Files, Paths, and Namespaces for details.

lpSecurityAttributes

A pointer to a SECURITY_ATTRIBUTES structure. The lpSecurityDescriptor member of the structure specifies a security descriptor for the new directory. If lpSecurityAttributes is NULL, the directory gets a default security descriptor. The ACLs in the default security descriptor for a directory are inherited from its parent directory.

The target file system must support security on files and directories for this parameter to have an effect.

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. Possible errors include the following.

Return code Description
ERROR_ALREADY_EXISTS

The specified directory already exists.

ERROR_PATH_NOT_FOUND

One or more intermediate directories do not exist; this function will only create the final directory in the path.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1803
Header fileapifromapp.h