IoCheckEaBufferValidity function

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

EaBuffer

Pointer to the buffer containing the EAs to be checked.

EaLength

Length, in bytes, of EaBuffer.

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.

Warning
IoCheckEaBufferValidity does not 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

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

See Also

IRP_MJ_SET_EA

IRP_MJ_QUERY_EA

FILE_FULL_EA_INFORMATION

Send comments about this topic to Microsoft