NTFS on non-Windows systems.
See original GitHub issueMuch of your NTFS implementation relies on RawSecurityDescriptor
and SecurityIdentifier
.
This is not supported on some non-windows CLR environments (.NET Core App 2), it infact throws an exception:
public RawSecurityDescriptor(byte[] binaryForm, int offset)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_AccessControl);
}
This includes when you perform Null checks.
public sealed class SecurityIdentifier : IdentityReference, IComparable<SecurityIdentifier>
{
...
public static bool operator ==(SecurityIdentifier left, SecurityIdentifier right)
{
throw new PlatformNotSupportedException(SR.PlatformNotSupported_Principal);
}
...
}
I have some code written to allow you to determine if this is available at runtime:
private static bool? _HasRawSecurityDescriptors;
public static bool HasRawSecurityDescriptors
{
get
{
if (_HasRawSecurityDescriptors == null)
{
try
{
// The `if` will throw if we do not support this functionality
// at runtime.
SecurityIdentifier willThrowIfNoPolicyFramework = null;
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
if (willThrowIfNoPolicyFramework == null) {}
_HasRawSecurityDescriptors = true;
}
catch (PlatformNotSupportedException ex)
{
_HasRawSecurityDescriptors = false;
}
}
return _HasRawSecurityDescriptors ?? false;
}
}
It would be nice to be able to create NTFS volumes on other systems without relying on native support that doesn’t exist outside of the Windows CLR.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
NTFS overview
NTFS, the primary file system for recent versions of Windows and Windows Server, provides a full set of features including security descriptors, ...
Read more >NTFS
New Technology File System (NTFS) is a proprietary journaling file system developed by Microsoft. Starting with Windows NT 3.1, it is the default...
Read more >How can I fix an inconsistent NTFS file system without ...
If the computer has nothing but Linux, you should not be using NTFS. There are no good Linux tools for repairing NTFS damage....
Read more >NTFS: What is new technology file system, and how does it ...
NTFS is used by removable storage devices and Microsoft Windows to name, organize and store files. NT file system can encrypt or decrypt...
Read more >What Is NTFS and How Does It Work?
NT file system (NTFS), which is also sometimes called the New Technology File System, is a process that the Windows NT operating system...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Whats fascinating is this code partially works on Mono… but .NET Core explicitly throws.
Mono
.NET Core
I did it some time ago, then forgot about it. Feel free to backport whatever, it’s all taken from Mono project anyway.
https://github.com/Ciastex/DiscUtils/commit/cf64cfc4a05763e1ebe655da6e05b7a7993ef246