EN
Dieser Inhalt ist in Ihrer Sprache leider nicht verfügbar. Im Folgenden finden Sie die englische Version.

CreateDirectoryTransacted function

[Microsoft strongly recommends developers utilize alternative means to achieve your application’s needs. Many scenarios that TxF was developed for can be achieved through simpler and more readily available techniques. Furthermore, TxF may not be available in future versions of Microsoft Windows. For more information, and alternatives to TxF, please see Alternatives to using Transactional NTFS.]

Creates a new directory as a transacted operation, with the attributes of a specified template directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory. The new directory retains the other attributes of the specified template directory.

Syntax


BOOL WINAPI CreateDirectoryTransacted(
  _In_opt_  LPCTSTR lpTemplateDirectory,
  _In_      LPCTSTR lpNewDirectory,
  _In_opt_  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  _In_      HANDLE hTransaction
);

Parameters

lpTemplateDirectory [in, optional]

The path of the directory to use as a template when creating the new directory. This parameter can be NULL.

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

The directory must reside on the local computer; otherwise, the function fails and the last error code is set to ERROR_TRANSACTIONS_UNSUPPORTED_REMOTE.

lpNewDirectory [in]

The path of the directory to be created.

In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.

lpSecurityAttributes [in, optional]

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 access control lists (ACL) 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. This is indicated when GetVolumeInformation returns FS_PERSISTENT_ACLS.

hTransaction [in]

A handle to the transaction. This handle is returned by the CreateTransaction function.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero (0). To get extended error information, call GetLastError. Possible errors include the following.

Return codeDescription
ERROR_ALREADY_EXISTS

The specified directory already exists.

ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION

You cannot create a child directory with a parent directory that has encryption disabled.

ERROR_PATH_NOT_FOUND

One or more intermediate directories do not exist. This function only creates the final directory in the path.

 

Remarks

The CreateDirectoryTransacted function allows you to create directories that inherit stream information from other directories. This function is useful, for example, when you are using Macintosh directories, which have a resource stream that is needed to properly identify directory contents as an attribute.

Some file systems, such as the NTFS file system, support compression or encryption for individual files and directories. On volumes formatted for such a file system, a new directory inherits the compression and encryption attributes of its parent directory.

This function fails with ERROR_EFS_NOT_ALLOWED_IN_TRANSACTION if you try to create a child directory with a parent directory that has encryption disabled.

You can obtain a handle to a directory by calling the CreateFileTransacted function with the FILE_FLAG_BACKUP_SEMANTICS flag set.

In Windows 8 and Windows Server 2012, this function is supported by the following technologies.

TechnologySupported

Server Message Block (SMB) 3.0 protocol

No

SMB 3.0 Transparent Failover (TFO)

No

SMB 3.0 with Scale-out File Shares (SO)

No

Cluster Shared Volume File System (CsvFS)

No

Resilient File System (ReFS)

No

 

SMB 3.0 does not support TxF.

Requirements

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinBase.h (include Windows.h)

Library

Kernel32.lib

DLL

Kernel32.dll

Unicode and ANSI names

CreateDirectoryTransactedW (Unicode) and CreateDirectoryTransactedA (ANSI)

See also

CreateFileTransacted
Creating and Deleting Directories
Directory Management Functions
RemoveDirectoryTransacted
SECURITY_ATTRIBUTES
Transactional NTFS

 

 

Community-Beiträge

HINZUFÜGEN
Anzeigen:
© 2014 Microsoft