Bewerken

Delen via


FsRtlKernelFsControlFile function (ntifs.h)

The FsRtlKernelFsControlFile function builds an explicit FSCTL_XXX IRP, sends it down the stack, synchronously waits for it to complete, and returns the result. This function allows the caller to complete this action by FileObject instead of handle.

Syntax

NTSTATUS FsRtlKernelFsControlFile(
  [in]  PFILE_OBJECT FileObject,
  [in]  ULONG        FsControlCode,
  [in]  PVOID        InputBuffer,
  [in]  ULONG        InputBufferLength,
  [out] PVOID        OutputBuffer,
  [out] ULONG        OutputBufferLength,
  [out] PULONG       RetOutputBufferSize
);

Parameters

[in] FileObject

Pointer to the FILE_OBJECT to send the operation on.

[in] FsControlCode

FSCTL_XXX code that indicates which file system control operation is to be carried out. The value of this parameter determines the formats and required lengths of the InputBuffer and OutputBuffer, as well as which of the following parameter pairs are required. For detailed information about the system-defined FSCTL_XXX codes, see the "Remarks" section of the reference entry for DeviceIoControl in the Microsoft Windows SDK documentation.

[in] InputBuffer

Pointer to a caller-allocated input buffer that contains device-specific information to be given to the target driver. If FsControlCode specifies an operation that does not require input data, this pointer is optional and can be NULL. Note that this buffer might be modified upon return and the caller must adapt to this. This is because this buffer might be used to hold the output data.

[in] InputBufferLength

Length of the InputBuffer in bytes.

[out] OutputBuffer

Pointer to a caller-allocated output buffer in which information is returned from the target driver. If FsControlCode specifies an operation that does not produce output data, this pointer is optional and can be NULL.

[out] OutputBufferLength

Length of the OutputBuffer in bytes.

[out] RetOutputBufferSize

Receives the number of bytes actually written (returned) in the output buffer.

Return value

FsRtlKernelFsControlFile returns STATUS_SUCCESS or an appropriate NTSTATUS value such as one of the following.

Value Meaning
STATUS_INSUFFICIENT_RESOURCES A pool allocation failure occurred.
STATUS_INVALID_PARAMETER An invalid parameter was provided (for example, an invalid FileObject).

Remarks

FsRtlKernelFsControlFile sets the IRP_MN_KERNEL_CALL minor code which allows it to perform operations without requiring manage volume privilege for certain operations.

This function assumes that all buffers passed to it are kernel-mode buffers.

Requirements

Requirement Value
Header ntifs.h

See also

ZwFsControlFile