Export (0) Print
Expand All

ZwCreateDirectoryObject routine

The ZwCreateDirectoryObject routine creates or opens an object-directory object.

Syntax


NTSTATUS ZwCreateDirectoryObject(
  _Out_  PHANDLE DirectoryHandle,
  _In_   ACCESS_MASK DesiredAccess,
  _In_   POBJECT_ATTRIBUTES ObjectAttributes
);

Parameters

DirectoryHandle [out]

Pointer to a HANDLE variable that receives a handle to the object directory.

DesiredAccess [in]

Specifies an ACCESS_MASK value that determines the requested access to the object. In addition to the access rights that are defined for all types of objects (see ACCESS_MASK), the caller can specify one or more of the following access rights, which are specific to object directories:

ACCESS_MASK flagType of access

DIRECTORY_QUERY

Query

DIRECTORY_TRAVERSE

Name lookup

DIRECTORY_CREATE_OBJECT

Name creation

DIRECTORY_CREATE_SUBDIRECTORY

Subdirectory creation

DIRECTORY_ALL_ACCESS

All of the preceding types

 

ObjectAttributes [in]

Pointer to an OBJECT_ATTRIBUTES structure that contains the object's attributes, which you must have already initialized by calling InitializeObjectAttributes.

Return value

ZwCreateDirectoryObject returns an NTSTATUS value. Possible return values include:

STATUS_SUCCESS
STATUS_ACCESS_DENIED
STATUS_ACCESS_VIOLATION
STATUS_DATATYPE_MISALIGNMENT

Remarks

Once the handle pointed to by DirectoryHandle is no longer in use, the driver must call ZwClose to close it.

If the caller is not running in a system thread context, it must ensure that any handles it creates are private handles. Otherwise, the handle can be accessed by the process in whose context the driver is running. For more information, see Object Handles.

The system uses object directories to organize other types of objects, such as device objects. For more information, see Object Directories.

Note that the system does not use object directory objects to represent file-system directories, which are represented instead as file objects.

Note  If the call to this function occurs in user mode, you should use the name "NtCreateDirectoryObject" instead of "ZwCreateDirectoryObject".

Requirements

Version

Available starting with Windows 2000.

Header

Wdm.h (include Wdm.h, Ntddk.h, or Ntifs.h)

Library

Ntoskrnl.lib

IRQL

PASSIVE_LEVEL

DDI compliance rules

PowerIrpDDis, HwStorPortProhibitedDDIs

See also

ACCESS_MASK
InitializeObjectAttributes
ZwClose

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft