IoCheckEaBufferValidity function (ntifs.h)

The IoCheckEaBufferValidity routine checks whether the specified extended attribute (EA) buffer is valid.

Syntax

NTSTATUS IoCheckEaBufferValidity(
  [in]  PFILE_FULL_EA_INFORMATION EaBuffer,
  [in]  ULONG                     EaLength,
  [out] PULONG                    ErrorOffset
);

Parameters

[in] EaBuffer

Pointer to the buffer containing the EAs to be checked.

[in] EaLength

Length, in bytes, of EaBuffer.

[out] ErrorOffset

Pointer to a variable that receives the offset of the offending entry in the EA buffer if an error is found. This variable is only valid if an error occurs.

Return value

IoCheckEaBufferValidity returns STATUS_SUCCESS if the EA buffer is valid; otherwise it returns STATUS_EA_LIST_INCONSISTENT.

Remarks

IoCheckEaBufferValidity checks each FILE_FULL_EA_INFORMATION entry in the specified EA buffer to ensure that the following conditions are met:

  • The entire entry must fall within the buffer.

  • The value of EaName must be a null-terminated character array.

  • The value of EaNameLength must match the length in bytes of the EaName array (not including the zero-terminator).

  • For all entries except the last, the value of NextEntryOffset must be greater than zero and must fall on a ULONG boundary.

In addition, IoCheckEaBufferValidity checks the EA buffer to ensure that the following conditions are met:

  • The length passed in EaLength matches the actual length of the buffer.

  • The actual buffer length is nonnegative.

To be valid, the EA buffer must meet all of these conditions.

IoCheckEaBufferValidity doesn't perform any synchronization to ensure that the contents of EaBuffer do not change asynchronously. If a user-mode application can access the buffer in another thread, the application could change the buffer while IoCheckEaBufferValidity is running. This change might cause the routine to return incorrect information. To avoid this scenario, the driver should copy the buffer before calling IoCheckEaBufferValidity. After the buffer has been validated, the caller should use only the validated copy, not the original buffer.

Requirements

Requirement Value
Target Platform Universal
Header ntifs.h (include Ntifs.h)
Library NtosKrnl.lib
DLL NtosKrnl.exe
IRQL < DISPATCH_LEVEL

See also

FILE_FULL_EA_INFORMATION

IRP_MJ_QUERY_EA

IRP_MJ_SET_EA