mirror of
https://github.com/winfsp/winfsp.git
synced 2025-07-26 04:22:50 -05:00
grand EaSize patch; passes winfsp-tests and ifstest
This commit is contained in:
@@ -1161,14 +1161,21 @@ namespace Fsp
|
||||
Object FileNode,
|
||||
Object FileDesc,
|
||||
IntPtr Ea,
|
||||
UInt32 EaLength)
|
||||
UInt32 EaLength,
|
||||
out FileInfo FileInfo)
|
||||
{
|
||||
return Api.FspFileSystemEnumerateEa(
|
||||
Int32 Result;
|
||||
Result = SetEaEntries(
|
||||
FileNode,
|
||||
FileDesc,
|
||||
this.SetEaEntry,
|
||||
Ea,
|
||||
EaLength);
|
||||
if (0 > Result)
|
||||
{
|
||||
FileInfo = default(FileInfo);
|
||||
return Result;
|
||||
}
|
||||
return GetFileInfo(FileNode, FileDesc, out FileInfo);
|
||||
}
|
||||
public virtual Int32 SetEaEntry(
|
||||
Object FileNode,
|
||||
@@ -1445,12 +1452,25 @@ namespace Fsp
|
||||
return self.ExceptionHandler(ex);
|
||||
}
|
||||
}
|
||||
public Int32 SetEaEntries(
|
||||
Object FileNode,
|
||||
Object FileDesc,
|
||||
IntPtr Ea,
|
||||
UInt32 EaLength)
|
||||
{
|
||||
return Api.FspFileSystemEnumerateEa(
|
||||
FileNode,
|
||||
FileDesc,
|
||||
this.SetEaEntry,
|
||||
Ea,
|
||||
EaLength);
|
||||
}
|
||||
public static UInt32 GetEaEntrySize(
|
||||
String EaName,
|
||||
Byte[] EaValue,
|
||||
Boolean NeedEa)
|
||||
{
|
||||
return FullEaInformation.Size(EaName, EaValue, NeedEa);
|
||||
return FullEaInformation.PackedSize(EaName, EaValue, NeedEa);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1122,7 +1122,8 @@ namespace Fsp
|
||||
IntPtr FileSystemPtr,
|
||||
ref FullContext FullContext,
|
||||
IntPtr Ea,
|
||||
UInt32 EaLength)
|
||||
UInt32 EaLength,
|
||||
out FileInfo FileInfo)
|
||||
{
|
||||
FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr);
|
||||
try
|
||||
@@ -1133,10 +1134,12 @@ namespace Fsp
|
||||
FileNode,
|
||||
FileDesc,
|
||||
Ea,
|
||||
EaLength);
|
||||
EaLength,
|
||||
out FileInfo);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FileInfo = default(FileInfo);
|
||||
return ExceptionHandler(FileSystem, ex);
|
||||
}
|
||||
}
|
||||
|
@@ -283,8 +283,6 @@ namespace Fsp.Interop
|
||||
* This should really be:
|
||||
* FSP_FSCTL_TRANSACT_RSP_BUFFER_SIZEMAX - FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName)
|
||||
*/
|
||||
internal static int EaNameOffset =
|
||||
(int)Marshal.OffsetOf(typeof(FullEaInformation), "EaName");
|
||||
|
||||
internal UInt32 NextEntryOffset;
|
||||
internal Byte Flags;
|
||||
@@ -313,13 +311,14 @@ namespace Fsp.Interop
|
||||
P[I + J] = Value[J];
|
||||
}
|
||||
}
|
||||
internal static UInt32 Size(String Name, Byte[] Value, Boolean NeedEa)
|
||||
internal static UInt32 PackedSize(String Name, Byte[] Value, Boolean NeedEa)
|
||||
{
|
||||
int NameLength = 254 < Name.Length ? 254 : Name.Length;
|
||||
int ValueLength = EaNameSize - Name.Length - 1 < Value.Length ?
|
||||
EaNameSize - Name.Length - 1 : Value.Length;
|
||||
|
||||
return (UInt32)((EaNameOffset + NameLength + 1 + ValueLength + 3) & ~3);
|
||||
/* magic computations are courtesy of NTFS */
|
||||
return (UInt32)(5 + NameLength + ValueLength);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,7 +565,8 @@ namespace Fsp.Interop
|
||||
IntPtr FileSystem,
|
||||
ref FullContext FullContext,
|
||||
IntPtr Ea,
|
||||
UInt32 EaLength);
|
||||
UInt32 EaLength,
|
||||
out FileInfo FileInfo);
|
||||
}
|
||||
|
||||
internal static int Size = IntPtr.Size * 64;
|
||||
|
Reference in New Issue
Block a user