网站首页  词典首页

请输入您要查询的函数:

 

术语 createdirectory
释义 CreateDirectory
语法:
C++
BOOL WINAPI CreateDirectory(
__in LPCTSTR lpPathName,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
CreateDirectory函数
创建一个新的目录。如果底层文件系统支持文件和目录的安全性,功能适用于指定的安全描述符到新目录。
要指定一个模板目录,请使用CreateDirectoryEx功能。
作为一个要执行此操作的事务操作,请使用CreateDirectoryTransacted功能。
参数
lpPathName [in]
目录的路径创建。
有一个默认字符串路径的248个字符的大小限制。此限制是有关如何CreateDirectory函数解析路径。
为了延长此限制,以32,767宽字符,调用的功能和前面加上“\\ Unicode版本\\?\\”的路径。有关更多信息,请参见命名一个文件。
lpSecurityAttributes [中,可选]
一个SECURITY_ATTRIBUTES结构的指针。结构的lpSecurityDescriptor成员指定一个新的目录安全描述符。如果lpSecurityAttributes为NULL,则目录得到默认的安全描述。在一个目录的默认安全描述符的ACL都继承自它的父目录。
目标文件系统必须支持此参数有一个安全的影响文件和目录。 (这是标明GetVolumeInformation返回FS_PERSISTENT_ACLS。)
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。为了获得更多错误信息,调用GetLastError。可能的错误包括以下内容。
返回codeDescription
ERROR_ALREADY_EXISTSThe指定的目录已存在。
ERROR_PATH_NOT_FOUNDOne或多个中间目录不存在,这个功能将只创建路径中最后的目录。
备注
Some file systems, such as the NTFS file system, support compression or encryption for individual files and directories.在这样一个文件系统,一个新的目录格式化的卷继承了压缩和它的父目录加密属性。
应用程序可通过调用句柄与FILE_FLAG_BACKUP_SEMANTICS标志CreateFile到一个目录设置。有关代码示例,请参见CreateFile。
为了向后兼容的目的,CreateDirectory不适用于Windows 2000的继承规则,当您指定一个lpSecurityAttributes安全描述符。为了支持在Windows,功能,查询这个对象的安全描述符可能启发式确定和报告,当前版本的继承继承生效。有关更多信息,可继承ACE的自动传播。
实例
有关示例,请参见检索和更改文件属性。
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinBase.h(头文件:winuser.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode和ANSI namesCreateDirectoryW(Unicode)和CreateDirectoryA(ANSI)的
参见
CreateDirectoryEx
CreateDirectoryTransacted
CreateFile
创建和删除目录
目录管理功能
RemoveDirectory
SECURITY_ATTRIBUTES
SECURITY_INFORMATION
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年9月3日
==英文原文==CreateDirectory Function
Creates a new directory. If the underlying file system supports security on files and directories, the function applies a specified security descriptor to the new directory.
To specify a template directory, use the CreateDirectoryEx function.
To perform this operation as a transacted operation, use the CreateDirectoryTransacted function.
Syntax
C++
BOOL WINAPI CreateDirectory(
__in LPCTSTR lpPathName,
__in_opt LPSECURITY_ATTRIBUTES lpSecurityAttributes
);
Parameters
lpPathName [in]
The path of the directory to be created.
There is a default string size limit for paths of 248 characters. This limit is related to how the CreateDirectory function parses paths.
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 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. (This is indicated when GetVolumeInformation returns FS_PERSISTENT_ACLS.)
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 codeDescription
ERROR_ALREADY_EXISTSThe specified directory already exists.
ERROR_PATH_NOT_FOUNDOne or more intermediate directories do not exist; this function will only create the final directory in the path.

Remarks
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.
An application can obtain a handle to a directory by calling CreateFile with the FILE_FLAG_BACKUP_SEMANTICS flag set. For a code example, see CreateFile.
For backward compatibility purposes, CreateDirectory does not apply Windows 2000 inheritance rules when you specify a security descriptor in lpSecurityAttributes. To support inheritance on current versions of Windows, functions that query the security descriptor of this object may heuristically determine and report that inheritance is in effect. See Automatic Propagation of Inheritable ACEs for more information.
Examples
For an example, see Retrieving and Changing File Attributes .
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinBase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll
Unicode and ANSI namesCreateDirectoryW (Unicode) and CreateDirectoryA (ANSI)
See Also
CreateDirectoryEx
CreateDirectoryTransacted
CreateFile
Creating and Deleting Directories
Directory Management Functions
RemoveDirectory
SECURITY_ATTRIBUTES
SECURITY_INFORMATION
Send comments about this topic to Microsoft
Build date: 9/3/2009
==原始网址==http://msdn.microsoft.com/en-us/library/aa363855(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:22:39