public override void WriteBytes(byte[] buffer, ref int offset) { Header.AceSize = (ushort)Length; Header.WriteBytes(buffer, ref offset); LittleEndianWriter.WriteUInt32(buffer, ref offset, (uint)Mask); Sid.WriteBytes(buffer, ref offset); }
public byte[] GetBytes() { byte[] buffer = new byte[Length]; uint offsetOwner = 0; uint offsetGroup = 0; uint offsetSacl = 0; uint offsetDacl = 0; int offset = FixedLength; if (OwnerSid != null) { offsetOwner = (uint)offset; offset += OwnerSid.Length; } if (GroupSid != null) { offsetGroup = (uint)offset; offset += GroupSid.Length; } if (Sacl != null) { offsetSacl = (uint)offset; offset += Sacl.Length; } if (Dacl != null) { offsetDacl = (uint)offset; _ = Dacl.Length; } offset = 0; ByteWriter.WriteByte(buffer, ref offset, Revision); ByteWriter.WriteByte(buffer, ref offset, Sbz1); LittleEndianWriter.WriteUInt16(buffer, ref offset, (ushort)Control); LittleEndianWriter.WriteUInt32(buffer, ref offset, offsetOwner); LittleEndianWriter.WriteUInt32(buffer, ref offset, offsetGroup); LittleEndianWriter.WriteUInt32(buffer, ref offset, offsetSacl); LittleEndianWriter.WriteUInt32(buffer, ref offset, offsetDacl); OwnerSid?.WriteBytes(buffer, ref offset); GroupSid?.WriteBytes(buffer, ref offset); Sacl?.WriteBytes(buffer, ref offset); Dacl?.WriteBytes(buffer, ref offset); return(buffer); }