private static Int32 GetSecurityByName( IntPtr FileSystemPtr, String FileName, IntPtr PFileAttributes /* or ReparsePointIndex */, IntPtr SecurityDescriptor, IntPtr PSecurityDescriptorSize) { FileSystemBase FileSystem = (FileSystemBase)Api.GetUserContext(FileSystemPtr); try { UInt32 FileAttributes; Byte[] SecurityDescriptorBytes = null; Int32 Result; if (IntPtr.Zero != PSecurityDescriptorSize) { SecurityDescriptorBytes = ByteBufferNotNull; } Result = FileSystem.GetSecurityByName( FileName, out FileAttributes, ref SecurityDescriptorBytes); if (0 <= Result && 260 /*STATUS_REPARSE*/ != Result) { if (IntPtr.Zero != PFileAttributes) { Marshal.WriteInt32(PFileAttributes, (Int32)FileAttributes); } Result = Api.CopySecurityDescriptor(SecurityDescriptorBytes, SecurityDescriptor, PSecurityDescriptorSize); } return(Result); } catch (Exception ex) { return(ExceptionHandler(FileSystem, ex)); } }