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 */
Please make sure your code is consident with the ReactOS Coding style as well as the general kernel formatting that is already present in almost all the kernel files.
PBYTE is not a kernel type, it is a Win32 type, and should not be used. Please use ULONG_PTR for pointer arithmetic.
Please explain what the line "LenOfEaBuffer = ((LenOfEaBuffer + 3) & 0xFFFFFFFC);" is trying to achieve, as well as this calculation: "EaBufferEnd->EaNameLength+EaBufferEnd->EaValueLength + 9;".
Thank you!
On 8/20/07, netzimme@aim.com netzimme@aim.com wrote:
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*http://pr.atwola.com/promoclk/100122638x1081283466x1074645346/aol?redir=http%3A%2F%2Fwww%2Eaim%2Ecom%2Ffun%2Fmail%2F-- 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 withStatus: %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
*/
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
Hello
PBYTE is not a kernel type, it is a Win32 type, and should not be
used. Please use ULONG_PTR for pointer arithmetic.
Okay that shout not a problem.
Please explain what the line "LenOfEaBuffer = ((LenOfEaBuffer + 3) &
0xFFFFFFFC);" is trying to achieve, as well as this calculation:
"EaBufferEnd->EaNameLength+EaBufferEnd->EaValueLength + 9;".
From the MSDN (http://msdn2.microsoft.com/en-us/library/ms795740.aspx) the next buffer offset must be greater than zero and must fall on a ULONG boundary.
EaBufferEnd->EaNameLength+EaBufferEnd->EaValueLength + 9:
The Length of the rest of the buffer must lesser equal to the size of the Name + Value + BYTE_ALIGN(sizeof(FILE_FULL_EA_INFORMATION)).
Thanks Daniel Zimmermann
________________________________________________________________________ Check Out the new free AIM(R) Mail -- 2 GB of storage and industry-leading spam and email virus protection.