dotnet: interop: FileInfo.EaSize is now a property

This commit is contained in:
Bill Zissimopoulos 2019-03-21 21:42:27 -07:00
parent 46210b0c48
commit 88896c2fd8
No known key found for this signature in database
GPG Key ID: 3D4F95D52C7B3EA3
2 changed files with 19 additions and 3 deletions

View File

@ -196,10 +196,28 @@ namespace Fsp.Interop
/// Not currently implemented. Set to 0.
/// </summary>
public UInt32 HardLinks;
/// <summary>
/// The extended attribute size of the file.
/// </summary>
public UInt32 EaSize;
public UInt32 EaSize
{
get { return GetEaSize(); }
set { SetEaSize(value); }
}
internal static int EaSizeOffset =
(int)Marshal.OffsetOf(typeof(FileInfo), "HardLinks") + 4;
internal unsafe UInt32 GetEaSize()
{
fixed (FileInfo *P = &this)
return *(UInt32 *)((Int64)(IntPtr)P + EaSizeOffset);
}
internal unsafe void SetEaSize(UInt32 value)
{
fixed (FileInfo *P = &this)
*(UInt32 *)((Int64)(IntPtr)P + EaSizeOffset) = value;
}
}
[StructLayout(LayoutKind.Sequential)]

View File

@ -78,7 +78,6 @@ namespace passthrough
FileInfo.ChangeTime = FileInfo.LastWriteTime;
FileInfo.IndexNumber = 0;
FileInfo.HardLinks = 0;
FileInfo.EaSize = 0;
}
public Int32 GetFileInfo(out FileInfo FileInfo)
{
@ -99,7 +98,6 @@ namespace passthrough
FileInfo.ChangeTime = FileInfo.LastWriteTime;
FileInfo.IndexNumber = 0;
FileInfo.HardLinks = 0;
FileInfo.EaSize = 0;
}
else
GetFileInfoFromFileSystemInfo(DirInfo, out FileInfo);