Hardware Dev Center

Collapse the table of content
Expand the table of content
Expand Minimize

IoReplaceFileObjectName routine

The IoReplaceFileObjectName routine replaces the name of a file object.

Syntax


NTSTATUS IoReplaceFileObjectName(
  _In_ PFILE_OBJECT FileObject,
  _In_ PWSTR        NewFileName,
  _In_ USHORT       FileNameLength
);

Parameters

FileObject [in]

Pointer to the file object whose file name is being replaced.

NewFileName [in]

Pointer to the string buffer for the new name for the file object.

FileNameLength [in]

Length, in bytes, of the new name for the file object.

Return value

Returns STATUS_SUCCESS or one of the following NTSTATUS values otherwise:

Return codeDescription
STATUS_INVALID_PARAMETER

Indicates that the file object provided does not have a name to replace.

STATUS_INSUFFICIENT_RESOURCES

Indicates that inadequate memory is available to allocate a buffer to complete this operation.

 

Remarks

Drivers should use IoReplaceFileObjectName to safely replace the name in a file object. This allows the I/O manager to control the lifetime of the buffer associated with the file object. Replacing a file object name directly without using IoReplaceFileObjectName may conflict with other uses of the name and should be avoided when possible.

This routine should be used to replace the file object name instead of doing so manually to allow the kernel to manage the lifetime of the name correctly.

Requirements

Target platform

Universal

Version

Available starting with Windows 7.

Header

Ntifs.h (include Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

PASSIVE_LEVEL

 

 

Send comments about this topic to Microsoft

Show:
© 2015 Microsoft