Move common data structures for MFS, HFS and ISO9660 (Apple Extensions) to common class.

This commit is contained in:
2020-02-19 03:37:51 +00:00
parent 177031d7ac
commit 999657502b
14 changed files with 459 additions and 351 deletions

View File

@@ -45,5 +45,42 @@ namespace DiscImageChef.Filesystems
DoesNotNeedCache = 0x400, BootInconsistent = 0x800, ReusedIds = 0x1000,
Journaled = 0x2000, Inconsistent = 0x4000, SoftwareLock = 0x8000
}
[Flags]
internal enum FinderFlags : ushort
{
/// <summary>Is on desktop.</summary>
kIsOnDesk = 0x0001,
/// <summary>Color mask.</summary>
kColor = 0x000E, kRequireSwitchLaunch = 0x0020,
/// <summary>If clear, the application needs to write to its resource fork, and therefore cannot be shared on a server.</summary>
kIsShared = 0x0040,
/// <summary>Extension or control panel with no INIT entries in resource fork.</summary>
kHasNoINITs = 0x0080,
/// <summary>
/// Clear if the file contains desktop database resources ('BNDL', 'FREF', 'open', 'kind'...) that have not been
/// added yet. Set only by the Finder. Reserved for folders - make sure this bit is cleared for folders.
/// </summary>
kHasBeenInited = 0x0100,
/// <summary>PowerTalk</summary>
kAOCE = 0x200, kChanged = 0x0200,
/// <summary>Has a custom icon in the resource fork.</summary>
kHasCustomIcon = 0x0400,
/// <summary>Is a stationery.</summary>
kIsStationery = 0x0800,
/// <summary>Cannot be renamed.</summary>
kNameLocked = 0x1000,
/// <summary>Indicates that a file has a BNDL resource or that a folder is displayed as a package.</summary>
kHasBundle = 0x2000,
/// <summary>Hidden.</summary>
kIsInvisible = 0x4000,
/// <summary>Is an alias</summary>
kIsAlias = 0x8000
}
internal enum FinderFolder : short
{
fTrash = -3, fDesktop = -2, fDisk = 0
}
}
}

View File

@@ -88,5 +88,25 @@ namespace DiscImageChef.Filesystems
/// <summary>0x090, Fraction of RAM for system heap</summary>
public readonly uint bbSysHeapFract;
}
internal struct Point
{
public ushort v;
public ushort h;
}
internal struct FInfo
{
/// <summary>The type of the file.</summary>
public uint fdType;
/// <summary>The file's creator.</summary>
public uint fdCreator;
/// <summary>Flags.</summary>
public FinderFlags fdFlags;
/// <summary>File's location in the folder.</summary>
public Point fdLocation;
/// <summary>Folder file belongs to (used only in flat filesystems like MFS).</summary>
public FinderFolder fdFldr;
}
}
}

View File

@@ -33,6 +33,8 @@
using System;
namespace DiscImageChef.Filesystems
{
public partial class AppleHFS
{
internal enum NodeType : sbyte
{
@@ -63,38 +65,6 @@ namespace DiscImageChef.Filesystems
Data = 0, Resource = -1
}
[Flags]
internal enum FinderFlags : ushort
{
/// <summary>Is on desktop.</summary>
kIsOnDesk = 0x0001,
/// <summary>Color mask.</summary>
kColor = 0x000E, kRequireSwitchLaunch = 0x0020,
/// <summary>If clear, the application needs to write to its resource fork, and therefore cannot be shared on a server.</summary>
kIsShared = 0x0040,
/// <summary>Extension or control panel with no INIT entries in resource fork.</summary>
kHasNoINITs = 0x0080,
/// <summary>
/// Clear if the file contains desktop database resources ('BNDL', 'FREF', 'open', 'kind'...) that have not been
/// added yet. Set only by the Finder. Reserved for folders - make sure this bit is cleared for folders.
/// </summary>
kHasBeenInited = 0x0100,
/// <summary>PowerTalk</summary>
kAOCE = 0x200,
/// <summary>Has a custom icon in the resource fork.</summary>
kHasCustomIcon = 0x0400,
/// <summary>Is a stationery.</summary>
kIsStationery = 0x0800,
/// <summary>Cannot be renamed.</summary>
kNameLocked = 0x1000,
/// <summary>Indicates that a file has a BNDL resource or that a folder is displayed as a package.</summary>
kHasBundle = 0x2000,
/// <summary>Hidden.</summary>
kIsInvisible = 0x4000,
/// <summary>Is an alias</summary>
kIsAlias = 0x8000
}
[Flags]
internal enum ExtendedFinderFlags : ushort
{
@@ -107,9 +77,5 @@ namespace DiscImageChef.Filesystems
/// <summary>Set if the file contains routing info resource.</summary>
kExtendedFlagHasRoutingInfo = 0x0004
}
internal enum FinderFolder : short
{
fTrash = -3, fDesktop = -2, fDisk = 0
}
}

View File

@@ -233,7 +233,7 @@ namespace DiscImageChef.Filesystems
/// <summary>File type.</summary>
public readonly sbyte filType;
/// <summary>Finder information.</summary>
public readonly FInfo filUsrWds;
public readonly AppleCommon.FInfo filUsrWds;
/// <summary>File ID.</summary>
public readonly uint filFlNum;
/// <summary>First allocation block of data fork.</summary>
@@ -328,12 +328,6 @@ namespace DiscImageChef.Filesystems
public readonly ushort xkrFABN;
}
struct Point
{
public ushort v;
public ushort h;
}
struct Rect
{
public ushort top;
@@ -342,20 +336,6 @@ namespace DiscImageChef.Filesystems
public ushort right;
}
struct FInfo
{
/// <summary>The type of the file.</summary>
public uint fdType;
/// <summary>The file's creator.</summary>
public uint fdCreator;
/// <summary>Flags.</summary>
public FinderFlags fdFlags;
/// <summary>File's location in the folder.</summary>
public Point fdLocation;
/// <summary>Folder file belongs to (used only in flat filesystems like MFS).</summary>
public FinderFolder fdFldr;
}
struct FXInfo
{
/// <summary>Resource fork ID of file icon.</summary>
@@ -375,9 +355,9 @@ namespace DiscImageChef.Filesystems
/// <summary>Position and dimensions of the folder's window.</summary>
public Rect frRect;
/// <summary>Flags.</summary>
public FinderFlags frFlags;
public AppleCommon.FinderFlags frFlags;
/// <summary>Folder's location in the parent folder.</summary>
public Point frLocation;
public AppleCommon.Point frLocation;
/// <summary>Finder view selected for folder.</summary>
public ushort frView;
}
@@ -385,7 +365,7 @@ namespace DiscImageChef.Filesystems
struct DXInfo
{
/// <summary>Scroll position for icon views.</summary>
public Point frScroll;
public AppleCommon.Point frScroll;
/// <summary>Directory ID chain of open folders.</summary>
public uint frOpenChain;
/// <summary>Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags.</summary>

View File

@@ -35,6 +35,7 @@ using System.Collections.Generic;
using System.Linq;
using DiscImageChef.CommonTypes.Structs;
using DiscImageChef.Console;
using DiscImageChef.Helpers;
namespace DiscImageChef.Filesystems.AppleMFS
{
@@ -44,9 +45,12 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno ReadDir(string path, out List<string> contents)
{
contents = null;
if(!mounted) return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
if(!mounted)
return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) &&
string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported;
contents = idToFilename.Select(kvp => kvp.Value).ToList();
@@ -56,10 +60,13 @@ namespace DiscImageChef.Filesystems.AppleMFS
contents.Add("$");
contents.Add("$Bitmap");
contents.Add("$MDB");
if(bootBlocks != null) contents.Add("$Boot");
if(bootBlocks != null)
contents.Add("$Boot");
}
contents.Sort();
return Errno.NoError;
}
@@ -70,17 +77,22 @@ namespace DiscImageChef.Filesystems.AppleMFS
filenameToId = new Dictionary<string, uint>();
int offset = 0;
while(offset + 51 < directoryBlocks.Length)
{
MFS_FileEntry entry = new MFS_FileEntry
var entry = new MFS_FileEntry
{
flUsrWds = new byte[16], flFlags = (MFS_FileFlags)directoryBlocks[offset + 0]
flFlags = (MFS_FileFlags)directoryBlocks[offset + 0]
};
if(!entry.flFlags.HasFlag(MFS_FileFlags.Used)) break;
if(!entry.flFlags.HasFlag(MFS_FileFlags.Used))
break;
entry.flTyp = directoryBlocks[offset + 1];
Array.Copy(directoryBlocks, offset + 2, entry.flUsrWds, 0, 16);
entry.flUsrWds =
Marshal.ByteArrayToStructureBigEndian<AppleCommon.FInfo>(directoryBlocks, offset + 2, 16);
entry.flFlNum = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 18);
entry.flStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 22);
entry.flLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 24);
@@ -92,16 +104,21 @@ namespace DiscImageChef.Filesystems.AppleMFS
entry.flMdDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 46);
entry.flNam = new byte[directoryBlocks[offset + 50] + 1];
Array.Copy(directoryBlocks, offset + 50, entry.flNam, 0, entry.flNam.Length);
string lowerFilename = StringHandlers
.PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':');
if(entry.flFlags.HasFlag(MFS_FileFlags.Used) && !idToFilename.ContainsKey(entry.flFlNum) &&
!idToEntry.ContainsKey(entry.flFlNum) && !filenameToId.ContainsKey(lowerFilename) &&
string lowerFilename = StringHandlers.
PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':');
if(entry.flFlags.HasFlag(MFS_FileFlags.Used) &&
!idToFilename.ContainsKey(entry.flFlNum) &&
!idToEntry.ContainsKey(entry.flFlNum) &&
!filenameToId.ContainsKey(lowerFilename) &&
entry.flFlNum > 0)
{
idToEntry.Add(entry.flFlNum, entry);
idToFilename.Add(entry.flFlNum,
StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':'));
filenameToId.Add(lowerFilename, entry.flFlNum);
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags);
@@ -113,10 +130,13 @@ namespace DiscImageChef.Filesystems.AppleMFS
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRStBlk = {0}", entry.flRStBlk);
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRLgLen = {0}", entry.flRLgLen);
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flRPyLen = {0}", entry.flRPyLen);
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flCrDat = {0}",
DateHandlers.MacToDateTime(entry.flCrDat));
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flMdDat = {0}",
DateHandlers.MacToDateTime(entry.flMdDat));
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flNam0 = {0}",
StringHandlers.PascalToString(entry.flNam, Encoding));
}
@@ -124,7 +144,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
offset += 50 + entry.flNam.Length;
// "Entries are always an integral number of words"
if(offset % 2 != 0) offset++;
if(offset % 2 != 0)
offset++;
// TODO: "Entries don't cross logical block boundaries"
}

View File

@@ -46,18 +46,27 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
deviceBlock = new long();
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz) return Errno.InvalidArgument;
if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz)
return Errno.InvalidArgument;
uint nextBlock = entry.flStBlk;
long relBlock = 0;
@@ -66,11 +75,14 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
if(relBlock == fileBlock)
{
deviceBlock = (nextBlock - 2) * sectorsPerBlock + volMDB.drAlBlSt + (long)partitionStart;
deviceBlock = ((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + (long)partitionStart;
return Errno.NoError;
}
if(blockMap[nextBlock] == BMAP_FREE || blockMap[nextBlock] == BMAP_LAST) break;
if(blockMap[nextBlock] == BMAP_FREE ||
blockMap[nextBlock] == BMAP_LAST)
break;
nextBlock = blockMap[nextBlock];
relBlock++;
@@ -82,32 +94,60 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno GetAttributes(string path, out FileAttributes attributes)
{
attributes = new FileAttributes();
if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
MFS_FinderFlags fdFlags = (MFS_FinderFlags)BigEndianBitConverter.ToUInt16(entry.flUsrWds, 0x08);
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias))
attributes |= FileAttributes.Alias;
if(fdFlags.HasFlag(MFS_FinderFlags.kIsAlias)) attributes |= FileAttributes.Alias;
if(fdFlags.HasFlag(MFS_FinderFlags.kHasBundle)) attributes |= FileAttributes.Bundle;
if(fdFlags.HasFlag(MFS_FinderFlags.kHasBeenInited)) attributes |= FileAttributes.HasBeenInited;
if(fdFlags.HasFlag(MFS_FinderFlags.kHasCustomIcon)) attributes |= FileAttributes.HasCustomIcon;
if(fdFlags.HasFlag(MFS_FinderFlags.kHasNoINITs)) attributes |= FileAttributes.HasNoINITs;
if(fdFlags.HasFlag(MFS_FinderFlags.kIsInvisible)) attributes |= FileAttributes.Hidden;
if(entry.flFlags.HasFlag(MFS_FileFlags.Locked)) attributes |= FileAttributes.Immutable;
if(fdFlags.HasFlag(MFS_FinderFlags.kIsOnDesk)) attributes |= FileAttributes.IsOnDesk;
if(fdFlags.HasFlag(MFS_FinderFlags.kIsShared)) attributes |= FileAttributes.Shared;
if(fdFlags.HasFlag(MFS_FinderFlags.kIsStationery)) attributes |= FileAttributes.Stationery;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle))
attributes |= FileAttributes.Bundle;
if(!attributes.HasFlag(FileAttributes.Alias) && !attributes.HasFlag(FileAttributes.Bundle) &&
!attributes.HasFlag(FileAttributes.Stationery)) attributes |= FileAttributes.File;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited))
attributes |= FileAttributes.HasBeenInited;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon))
attributes |= FileAttributes.HasCustomIcon;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs))
attributes |= FileAttributes.HasNoINITs;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible))
attributes |= FileAttributes.Hidden;
if(entry.flFlags.HasFlag(MFS_FileFlags.Locked))
attributes |= FileAttributes.Immutable;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk))
attributes |= FileAttributes.IsOnDesk;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared))
attributes |= FileAttributes.Shared;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery))
attributes |= FileAttributes.Stationery;
if(!attributes.HasFlag(FileAttributes.Alias) &&
!attributes.HasFlag(FileAttributes.Bundle) &&
!attributes.HasFlag(FileAttributes.Stationery))
attributes |= FileAttributes.File;
attributes |= FileAttributes.BlockUnits;
@@ -116,33 +156,40 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno Read(string path, long offset, long size, ref byte[] buf)
{
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
byte[] file;
Errno error = Errno.NoError;
if(debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0) file = directoryBlocks;
else if(debug && string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 &&
if(debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
file = directoryBlocks;
else if(debug &&
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 &&
bootBlocks != null)
file = bootBlocks;
else if(debug && string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
file = blockMapBytes;
else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0) file = mdbBlocks;
else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
file = mdbBlocks;
else
error =
ReadFile(path, out file, false, false);
error = ReadFile(path, out file, false, false);
if(error != Errno.NoError) return error;
if(error != Errno.NoError)
return error;
if(size == 0)
{
buf = new byte[0];
return Errno.NoError;
}
if(offset >= file.Length) return Errno.InvalidArgument;
if(offset >= file.Length)
return Errno.InvalidArgument;
if(size + offset >= file.Length) size = file.Length - offset;
if(size + offset >= file.Length)
size = file.Length - offset;
buf = new byte[size];
@@ -154,10 +201,17 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno Stat(string path, out FileEntryInfo stat)
{
stat = null;
if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
@@ -174,46 +228,50 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = directoryBlocks.Length / stat.BlockSize + directoryBlocks.Length % stat.BlockSize;
stat.Blocks = (directoryBlocks.Length / stat.BlockSize) +
(directoryBlocks.Length % stat.BlockSize);
stat.Length = directoryBlocks.Length;
}
else if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = blockMapBytes.Length / stat.BlockSize + blockMapBytes.Length % stat.BlockSize;
stat.Blocks = (blockMapBytes.Length / stat.BlockSize) + (blockMapBytes.Length % stat.BlockSize);
stat.Length = blockMapBytes.Length;
}
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 && bootBlocks != null)
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 &&
bootBlocks != null)
{
stat.Blocks = bootBlocks.Length / stat.BlockSize + bootBlocks.Length % stat.BlockSize;
stat.Blocks = (bootBlocks.Length / stat.BlockSize) + (bootBlocks.Length % stat.BlockSize);
stat.Length = bootBlocks.Length;
}
else if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
{
stat.Blocks = mdbBlocks.Length / stat.BlockSize + mdbBlocks.Length % stat.BlockSize;
stat.Blocks = (mdbBlocks.Length / stat.BlockSize) + (mdbBlocks.Length % stat.BlockSize);
stat.Length = mdbBlocks.Length;
}
else return Errno.InvalidArgument;
else
return Errno.InvalidArgument;
return Errno.NoError;
}
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
Errno error = GetAttributes(path, out FileAttributes attr);
if(error != Errno.NoError) return error;
if(error != Errno.NoError)
return error;
stat = new FileEntryInfo
{
Attributes = attr,
Blocks = entry.flLgLen / volMDB.drAlBlkSiz,
Attributes = attr, Blocks = entry.flLgLen / volMDB.drAlBlkSiz,
BlockSize = volMDB.drAlBlkSiz,
CreationTime = DateHandlers.MacToDateTime(entry.flCrDat),
Inode = entry.flFlNum,
LastWriteTime = DateHandlers.MacToDateTime(entry.flMdDat),
Length = entry.flPyLen,
Links = 1
CreationTime = DateHandlers.MacToDateTime(entry.flCrDat), Inode = entry.flFlNum,
LastWriteTime = DateHandlers.MacToDateTime(entry.flMdDat), Length = entry.flPyLen, Links = 1
};
return Errno.NoError;
@@ -222,6 +280,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno ReadLink(string path, out string dest)
{
dest = null;
return Errno.NotImplemented;
}
@@ -229,16 +288,24 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
buf = null;
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
uint nextBlock;
@@ -247,6 +314,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(entry.flRPyLen == 0)
{
buf = new byte[0];
return Errno.NoError;
}
@@ -257,17 +325,19 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(entry.flPyLen == 0)
{
buf = new byte[0];
return Errno.NoError;
}
nextBlock = entry.flStBlk;
}
MemoryStream ms = new MemoryStream();
var ms = new MemoryStream();
do
{
byte[] sectors;
if(tags)
sectors =
device.ReadSectorsTag((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart,
@@ -282,18 +352,20 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(blockMap[nextBlock] == BMAP_FREE)
{
DicConsole.ErrorWriteLine("File truncated at block {0}", nextBlock);
break;
}
nextBlock = blockMap[nextBlock];
}
while(nextBlock > BMAP_LAST);
} while(nextBlock > BMAP_LAST);
if(tags) buf = ms.ToArray();
if(tags)
buf = ms.ToArray();
else
{
if(resourceFork)
if(ms.Length < entry.flRLgLen) buf = ms.ToArray();
if(ms.Length < entry.flRLgLen)
buf = ms.ToArray();
else
{
buf = new byte[entry.flRLgLen];
@@ -301,7 +373,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
}
else
{
if(ms.Length < entry.flLgLen) buf = ms.ToArray();
if(ms.Length < entry.flLgLen)
buf = ms.ToArray();
else
{
buf = new byte[entry.flLgLen];

View File

@@ -82,31 +82,6 @@ namespace DiscImageChef.Filesystems.AppleMFS
Locked = 0x01, Used = 0x80
}
[Flags]
enum MFS_FinderFlags : ushort
{
kIsOnDesk = 0x0001, kColor = 0x000E, kRequireSwitchLaunch = 0x0020,
kIsShared = 0x0040, kHasNoINITs = 0x0080, kHasBeenInited = 0x0100,
kHasCustomIcon = 0x0400, kLetter = 0x0200, kChanged = 0x0200,
kIsStationery = 0x0800, kNameLocked = 0x1000, kHasBundle = 0x2000,
kIsInvisible = 0x4000, kIsAlias = 0x8000
}
struct MFS_Point
{
public short x;
public short y;
}
struct MFS_FinderInfo
{
public uint fdType;
public uint fdCreator;
public MFS_FinderFlags fdFlags;
public MFS_Point fdLocation;
public short fdFldr;
}
struct MFS_FileEntry
{
/// <summary>0x00, Entry flags</summary>
@@ -114,7 +89,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
/// <summary>0x01, Version number</summary>
public byte flTyp;
/// <summary>0x02, FinderInfo</summary>
public byte[] flUsrWds;
public AppleCommon.FInfo flUsrWds;
/// <summary>0x12, file ID</summary>
public uint flFlNum;
/// <summary>0x16, first allocation block of data fork</summary>

View File

@@ -35,6 +35,7 @@ using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Structs;
using DiscImageChef.Helpers;
namespace DiscImageChef.Filesystems.AppleMFS
{
@@ -44,10 +45,17 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno ListXAttr(string path, out List<string> xattrs)
{
xattrs = null;
if(!mounted) return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
@@ -65,20 +73,25 @@ namespace DiscImageChef.Filesystems.AppleMFS
return Errno.NoError;
}
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
if(entry.flRLgLen > 0)
{
xattrs.Add("com.apple.ResourceFork");
if(debug && device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
xattrs.Add("com.apple.ResourceFork.tags");
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds)) xattrs.Add("com.apple.FinderInfo");
xattrs.Add("com.apple.FinderInfo");
if(debug && device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) && entry.flLgLen > 0)
if(debug &&
device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
entry.flLgLen > 0)
xattrs.Add("com.apple.macintosh.tags");
xattrs.Sort();
@@ -88,10 +101,16 @@ namespace DiscImageChef.Filesystems.AppleMFS
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1) return Errno.NotSupported;
string[] pathElements = path.Split(new[]
{
'/'
}, StringSplitOptions.RemoveEmptyEntries);
if(pathElements.Length != 1)
return Errno.NotSupported;
path = pathElements[0];
@@ -107,6 +126,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
buf = new byte[directoryTags.Length];
Array.Copy(directoryTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
@@ -114,6 +134,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
buf = new byte[bitmapTags.Length];
Array.Copy(bitmapTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
@@ -121,6 +142,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
buf = new byte[bootTags.Length];
Array.Copy(bootTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
@@ -128,6 +150,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
buf = new byte[mdbTags.Length];
Array.Copy(mdbTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
}
@@ -136,14 +159,17 @@ namespace DiscImageChef.Filesystems.AppleMFS
Errno error;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId)) return Errno.NoSuchFile;
if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry)) return Errno.NoSuchFile;
if(!idToEntry.TryGetValue(fileId, out MFS_FileEntry entry))
return Errno.NoSuchFile;
if(entry.flRLgLen > 0 &&
string.Compare(xattr, "com.apple.ResourceFork", StringComparison.InvariantCulture) == 0)
{
error = ReadFile(path, out buf, true, false);
return error;
}
@@ -151,22 +177,24 @@ namespace DiscImageChef.Filesystems.AppleMFS
string.Compare(xattr, "com.apple.ResourceFork.tags", StringComparison.InvariantCulture) == 0)
{
error = ReadFile(path, out buf, true, true);
return error;
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(entry.flUsrWds) &&
string.Compare(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture) == 0)
if(string.Compare(xattr, "com.apple.FinderInfo", StringComparison.InvariantCulture) == 0)
{
buf = new byte[16];
Array.Copy(entry.flUsrWds, 0, buf, 0, 16);
buf = Marshal.StructureToByteArrayBigEndian(entry.flUsrWds);
return Errno.NoError;
}
if(!debug || !device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) ||
if(!debug ||
!device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) ||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) != 0)
return Errno.NoSuchExtendedAttribute;
error = ReadFile(path, out buf, false, true);
return error;
}
}

View File

@@ -520,6 +520,7 @@ namespace DiscImageChef.Filesystems.ISO9660
hasResourceFork = false;
bool continueSymlink = false;
bool continueSymlinkComponent = false;
AppleCommon.FInfo fInfo;
while(systemAreaOff + 2 <= end)
{
@@ -563,10 +564,11 @@ namespace DiscImageChef.Filesystems.ISO9660
hasResourceFork = true;
entry.FinderInfo = new FinderInfo();
entry.FinderInfo.fdCreator = appleHfsSystemUse.creator;
entry.FinderInfo.fdFlags = (FinderFlags)appleHfsSystemUse.finder_flags;
entry.FinderInfo.fdType = appleHfsSystemUse.type;
fInfo = new AppleCommon.FInfo();
fInfo.fdCreator = appleHfsSystemUse.creator;
fInfo.fdFlags = appleHfsSystemUse.finder_flags;
fInfo.fdType = appleHfsSystemUse.type;
entry.FinderInfo = fInfo;
break;
}
@@ -606,9 +608,10 @@ namespace DiscImageChef.Filesystems.ISO9660
hasResourceFork = true;
entry.FinderInfo = new FinderInfo();
entry.FinderInfo.fdCreator = appleHfsTypeCreatorSystemUse.creator;
entry.FinderInfo.fdType = appleHfsTypeCreatorSystemUse.type;
fInfo = new AppleCommon.FInfo();
fInfo.fdCreator = appleHfsTypeCreatorSystemUse.creator;
fInfo.fdType = appleHfsTypeCreatorSystemUse.type;
entry.FinderInfo = fInfo;
systemAreaOff += Marshal.SizeOf<AppleHFSTypeCreatorSystemUse>();
@@ -624,9 +627,10 @@ namespace DiscImageChef.Filesystems.ISO9660
hasResourceFork = true;
entry.FinderInfo = new FinderInfo();
entry.FinderInfo.fdCreator = appleHfsIconSystemUse.creator;
entry.FinderInfo.fdType = appleHfsIconSystemUse.type;
fInfo = new AppleCommon.FInfo();
fInfo.fdCreator = appleHfsIconSystemUse.creator;
fInfo.fdType = appleHfsIconSystemUse.type;
entry.FinderInfo = fInfo;
entry.AppleIcon = appleHfsIconSystemUse.icon;
systemAreaOff += Marshal.SizeOf<AppleHFSIconSystemUse>();
@@ -642,10 +646,11 @@ namespace DiscImageChef.Filesystems.ISO9660
hasResourceFork = true;
entry.FinderInfo = new FinderInfo();
entry.FinderInfo.fdCreator = appleHfsSystemUse.creator;
entry.FinderInfo.fdFlags = (FinderFlags)appleHfsSystemUse.finder_flags;
entry.FinderInfo.fdType = appleHfsSystemUse.type;
fInfo = new AppleCommon.FInfo();
fInfo.fdCreator = appleHfsSystemUse.creator;
fInfo.fdFlags = (AppleCommon.FinderFlags)appleHfsSystemUse.finder_flags;
fInfo.fdType = appleHfsSystemUse.type;
entry.FinderInfo = fInfo;
systemAreaOff += Marshal.SizeOf<AppleHFSOldSystemUse>();

View File

@@ -177,31 +177,33 @@ namespace DiscImageChef.Filesystems.ISO9660
if(entry.FinderInfo != null)
{
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kIsAlias))
AppleCommon.FInfo finderInfo = entry.FinderInfo.Value;
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias))
stat.Attributes |= FileAttributes.Alias;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kIsInvisible))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsInvisible))
stat.Attributes |= FileAttributes.Hidden;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kHasBeenInited))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBeenInited))
stat.Attributes |= FileAttributes.HasBeenInited;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kHasCustomIcon))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasCustomIcon))
stat.Attributes |= FileAttributes.HasCustomIcon;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kHasNoINITs))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasNoINITs))
stat.Attributes |= FileAttributes.HasNoINITs;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kIsOnDesk))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsOnDesk))
stat.Attributes |= FileAttributes.IsOnDesk;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kIsShared))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsShared))
stat.Attributes |= FileAttributes.Shared;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kIsStationery))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsStationery))
stat.Attributes |= FileAttributes.Stationery;
if(entry.FinderInfo.fdFlags.HasFlag(FinderFlags.kHasBundle))
if(finderInfo.fdFlags.HasFlag(AppleCommon.FinderFlags.kHasBundle))
stat.Attributes |= FileAttributes.Bundle;
}

View File

@@ -57,7 +57,7 @@ namespace DiscImageChef.Filesystems.ISO9660
public readonly AppleId id;
public readonly uint type;
public readonly uint creator;
public readonly FinderFlags finder_flags;
public readonly AppleCommon.FinderFlags finder_flags;
}
// Little-endian

View File

@@ -69,7 +69,7 @@ namespace DiscImageChef.Filesystems.ISO9660
public List<(uint extent, uint size)> Extents;
public string Filename;
public byte FileUnitSize;
public FinderInfo FinderInfo;
public AppleCommon.FInfo? FinderInfo;
public FileFlags Flags;
public byte Interleave;
public PosixAttributes? PosixAttributes;
@@ -95,40 +95,6 @@ namespace DiscImageChef.Filesystems.ISO9660
public override string ToString() => Filename;
}
[Flags]
enum FinderFlags : ushort
{
kIsOnDesk = 0x0001,
kColor = 0x000E,
kRequireSwitchLaunch = 0x0020,
kIsShared = 0x0040,
kHasNoINITs = 0x0080,
kHasBeenInited = 0x0100,
kHasCustomIcon = 0x0400,
kLetter = 0x0200,
kChanged = 0x0200,
kIsStationery = 0x0800,
kNameLocked = 0x1000,
kHasBundle = 0x2000,
kIsInvisible = 0x4000,
kIsAlias = 0x8000
}
struct Point
{
public short x;
public short y;
}
class FinderInfo
{
public uint fdCreator;
public FinderFlags fdFlags;
public short fdFldr;
public Point fdLocation;
public uint fdType;
}
class PathTableEntryInternal
{
public uint Extent;

View File

@@ -34,6 +34,7 @@
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
using DiscImageChef.Helpers;
namespace DiscImageChef.Filesystems.ISO9660
{
@@ -42,21 +43,40 @@ namespace DiscImageChef.Filesystems.ISO9660
public Errno ListXAttr(string path, out List<string> xattrs)
{
xattrs = null;
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
Errno err = GetFileEntry(path, out DecodedDirectoryEntry entry);
if(err != Errno.NoError) return err;
if(err != Errno.NoError)
return err;
xattrs = new List<string>();
if(entry.XattrLength > 0) xattrs.Add("org.iso.9660.ea");
if(entry.AssociatedFile != null) xattrs.Add("org.iso.9660.AssociatedFile");
if(entry.AppleDosType != null) xattrs.Add("com.apple.dos.type");
if(entry.AppleProDosType != null) xattrs.Add("com.apple.prodos.type");
if(entry.ResourceFork != null) xattrs.Add("com.apple.ResourceFork");
if(entry.FinderInfo != null) xattrs.Add("com.apple.FinderInfo");
if(entry.AppleIcon != null) xattrs.Add("com.apple.Macintosh.Icon");
if(entry.AmigaComment != null) xattrs.Add("com.amiga.comments");
if(entry.XattrLength > 0)
xattrs.Add("org.iso.9660.ea");
if(entry.AssociatedFile != null)
xattrs.Add("org.iso.9660.AssociatedFile");
if(entry.AppleDosType != null)
xattrs.Add("com.apple.dos.type");
if(entry.AppleProDosType != null)
xattrs.Add("com.apple.prodos.type");
if(entry.ResourceFork != null)
xattrs.Add("com.apple.ResourceFork");
if(entry.FinderInfo != null)
xattrs.Add("com.apple.FinderInfo");
if(entry.AppleIcon != null)
xattrs.Add("com.apple.Macintosh.Icon");
if(entry.AmigaComment != null)
xattrs.Add("com.amiga.comments");
return Errno.NoError;
}
@@ -64,20 +84,28 @@ namespace DiscImageChef.Filesystems.ISO9660
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
buf = null;
if(!mounted) return Errno.AccessDenied;
if(!mounted)
return Errno.AccessDenied;
Errno err = GetFileEntry(path, out DecodedDirectoryEntry entry);
if(err != Errno.NoError) return err;
if(err != Errno.NoError)
return err;
switch(xattr)
{
case"org.iso.9660.ea":
if(entry.XattrLength == 0) return Errno.NoSuchExtendedAttribute;
if(entry.XattrLength == 0)
return Errno.NoSuchExtendedAttribute;
if(entry.Extents is null) return Errno.InvalidArgument;
if(entry.Extents is null)
return Errno.InvalidArgument;
uint eaSizeInSectors = (uint)(entry.XattrLength / 2048);
if(entry.XattrLength % 2048 > 0) eaSizeInSectors++;
if(entry.XattrLength % 2048 > 0)
eaSizeInSectors++;
byte[] ea = ReadSectors(entry.Extents[0].extent, eaSizeInSectors);
@@ -86,91 +114,98 @@ namespace DiscImageChef.Filesystems.ISO9660
return Errno.NoError;
case"org.iso.9660.AssociatedFile":
if(entry.AssociatedFile is null) return Errno.NoSuchExtendedAttribute;
if(entry.AssociatedFile is null)
return Errno.NoSuchExtendedAttribute;
if(entry.AssociatedFile.Extents is null) return Errno.InvalidArgument;
if(entry.AssociatedFile.Extents is null)
return Errno.InvalidArgument;
if(entry.AssociatedFile.Size == 0)
{
buf = new byte[0];
return Errno.NoError;
}
if(entry.AssociatedFile.Extents.Count == 1)
{
uint associatedFileSize = (uint)(entry.AssociatedFile.Size / 2048);
if(entry.AssociatedFile.Size % 2048 > 0) associatedFileSize++;
if(entry.AssociatedFile.Size % 2048 > 0)
associatedFileSize++;
byte[] buffer = ReadSectors(entry.AssociatedFile.Extents[0].extent, associatedFileSize);
buf = new byte[entry.AssociatedFile.Size];
Array.Copy(buffer, 0, buf, 0, buf.LongLength);
}
else buf = ReadWithExtents(0, (long)entry.AssociatedFile.Size, entry.AssociatedFile.Extents);
else
buf = ReadWithExtents(0, (long)entry.AssociatedFile.Size, entry.AssociatedFile.Extents);
return Errno.NoError;
case"com.apple.dos.type":
if(entry.AppleDosType is null) return Errno.NoSuchExtendedAttribute;
if(entry.AppleDosType is null)
return Errno.NoSuchExtendedAttribute;
buf = new byte[1];
buf[0] = entry.AppleDosType.Value;
return Errno.NoError;
case"com.apple.prodos.type":
if(entry.AppleProDosType is null) return Errno.NoSuchExtendedAttribute;
if(entry.AppleProDosType is null)
return Errno.NoSuchExtendedAttribute;
buf = BitConverter.GetBytes(entry.AppleProDosType.Value);
return Errno.NoError;
case"com.apple.ResourceFork":
if(entry.ResourceFork is null) return Errno.NoSuchExtendedAttribute;
if(entry.ResourceFork is null)
return Errno.NoSuchExtendedAttribute;
if(entry.ResourceFork.Extents is null) return Errno.InvalidArgument;
if(entry.ResourceFork.Extents is null)
return Errno.InvalidArgument;
if(entry.ResourceFork.Size == 0)
{
buf = new byte[0];
return Errno.NoError;
}
if(entry.ResourceFork.Extents.Count == 1)
{
uint rsrcSizeInSectors = (uint)(entry.ResourceFork.Size / 2048);
if(entry.AssociatedFile.Size % 2048 > 0) rsrcSizeInSectors++;
if(entry.AssociatedFile.Size % 2048 > 0)
rsrcSizeInSectors++;
byte[] buffer = ReadSectors(entry.ResourceFork.Extents[0].extent, rsrcSizeInSectors);
buf = new byte[entry.ResourceFork.Size];
Array.Copy(buffer, 0, buf, 0, buf.LongLength);
}
else buf = ReadWithExtents(0, (long)entry.ResourceFork.Size, entry.ResourceFork.Extents);
else
buf = ReadWithExtents(0, (long)entry.ResourceFork.Size, entry.ResourceFork.Extents);
return Errno.NoError;
case"com.apple.FinderInfo":
if(entry.FinderInfo is null) return Errno.NoSuchExtendedAttribute;
if(entry.FinderInfo is null)
return Errno.NoSuchExtendedAttribute;
buf = new byte[16];
byte[] tmp = BigEndianBitConverter.GetBytes(entry.FinderInfo.fdType);
Array.Copy(tmp, 0, buf, 0, tmp.Length);
tmp = BigEndianBitConverter.GetBytes(entry.FinderInfo.fdCreator);
Array.Copy(tmp, 0, buf, 4, tmp.Length);
tmp = BigEndianBitConverter.GetBytes((ushort)entry.FinderInfo.fdFlags);
Array.Copy(tmp, 0, buf, 8, tmp.Length);
tmp = BigEndianBitConverter.GetBytes(entry.FinderInfo.fdLocation.x);
Array.Copy(tmp, 0, buf, 10, tmp.Length);
tmp = BigEndianBitConverter.GetBytes(entry.FinderInfo.fdLocation.y);
Array.Copy(tmp, 0, buf, 12, tmp.Length);
tmp = BigEndianBitConverter.GetBytes(entry.FinderInfo.fdFldr);
Array.Copy(tmp, 0, buf, 14, tmp.Length);
buf = Marshal.StructureToByteArrayBigEndian(entry.FinderInfo.Value);
return Errno.NoError;
case"com.apple.Macintosh.Icon":
if(entry.AppleIcon is null) return Errno.NoSuchExtendedAttribute;
if(entry.AppleIcon is null)
return Errno.NoSuchExtendedAttribute;
buf = new byte[entry.AppleIcon.Length];
Array.Copy(entry.AppleIcon, 0, buf, 0, entry.AppleIcon.Length);
return Errno.NoError;
case"com.amiga.comments":
if(entry.AmigaComment is null) return Errno.NoSuchExtendedAttribute;
if(entry.AmigaComment is null)
return Errno.NoSuchExtendedAttribute;
buf = new byte[entry.AmigaComment.Length];
Array.Copy(entry.AmigaComment, 0, buf, 0, entry.AmigaComment.Length);