Hallo
Have a patch that implemented the function IoCheckEaBufferValidity in
ntoskrnl\io\iomgr\util.c.
Tested with Windows 2000 and Vista Ultimate 64 Bit.
Perhaps some one can comit it for me.
Thanks
dz
________________________________________________________________________
Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam and email
virus protection.
===================================================================
--- file.c (revision 28441)
+++ file.c (working copy)
@@ -1632,6 +1632,7 @@
IN ULONG Options)
{
KPROCESSOR_MODE AccessMode;
+ ULONG EaErrorOffset;
HANDLE LocalHandle = 0;
LARGE_INTEGER SafeAllocationSize;
PVOID SystemEaBuffer = NULL;
@@ -1732,10 +1733,10 @@
/* Validate the buffer */
Status = IoCheckEaBufferValidity(SystemEaBuffer,
EaLength,
- NULL);
+ &EaErrorOffset);
if (!NT_SUCCESS(Status))
{
- /* FIXME: Fail once function is implemented */
+ DPRINT1("FIXME: IoCheckEaBufferValidity failed with Status:
%lx\n",Status);
}
}
}
Index: util.c
===================================================================
--- util.c (revision 28441)
+++ util.c (working copy)
@@ -129,8 +129,9 @@
return STATUS_SUCCESS;
}
+
/*
- * @unimplemented
+ * @implemented
*/
NTSTATUS
NTAPI
@@ -138,10 +139,58 @@
IN ULONG EaLength,
OUT PULONG ErrorOffset)
{
- UNIMPLEMENTED;
- return STATUS_NOT_IMPLEMENTED;
+ PFILE_FULL_EA_INFORMATION EaBufferEnd;
+ ULONG LenOfEaBuffer;
+ UINT IntEaLength;
+
+ IntEaLength = EaLength;
+ EaBufferEnd = EaBuffer;
+
+ while (IntEaLength >= 8)
+ {
+ LenOfEaBuffer = EaBufferEnd->EaNameLength+EaBufferEnd->EaValueLength + 9;
+ if (IntEaLength >= LenOfEaBuffer)
+ {
+ if (EaBufferEnd->EaName[EaBufferEnd->EaNameLength]==0)
+ {
+ if (EaBufferEnd->NextEntryOffset == 0)
+ {
+ IntEaLength = IntEaLength - LenOfEaBuffer;
+ if (IntEaLength>=0)
+ {
+ return STATUS_SUCCESS;
+ }
+ }
+ else
+ {
+ LenOfEaBuffer = ((LenOfEaBuffer + 3) & 0xFFFFFFFC);
+ if (EaBufferEnd->NextEntryOffset == LenOfEaBuffer)
+ {
+ if (EaBufferEnd->NextEntryOffset>0)
+ {
+ IntEaLength = IntEaLength - EaBufferEnd->NextEntryOffset;
+ if (IntEaLength>=0)
+ {
+ LenOfEaBuffer = EaBufferEnd->NextEntryOffset;
+ EaBufferEnd = (PFILE_FULL_EA_INFORMATION)((PBYTE)EaBufferEnd +
LenOfEaBuffer);
+ continue;
+ }
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ if (ErrorOffset != NULL)
+ {
+ *ErrorOffset = (ULONG)((PBYTE)EaBufferEnd - (PBYTE)EaBuffer);
+ }
+
+ return STATUS_EA_LIST_INCONSISTENT;
}
+
/*
* @unimplemented
*/