internal virtual int Decode(byte[] buf, int bi) { Allow = buf[bi++] == unchecked (unchecked (0x00)); Flags = buf[bi++] & unchecked (0xFF); int size = ServerMessageBlock.ReadInt2(buf, bi); bi += 2; Access = ServerMessageBlock.ReadInt4(buf, bi); bi += 4; Sid = new Sid(buf, bi); return(size); }
/// <exception cref="System.IO.IOException"></exception> public virtual int Decode(byte[] buffer, int bufferIndex, int len) { int start = bufferIndex; bufferIndex++; // revision bufferIndex++; Type = ServerMessageBlock.ReadInt2(buffer, bufferIndex); bufferIndex += 2; ServerMessageBlock.ReadInt4(buffer, bufferIndex); // offset to owner sid bufferIndex += 4; ServerMessageBlock.ReadInt4(buffer, bufferIndex); // offset to group sid bufferIndex += 4; ServerMessageBlock.ReadInt4(buffer, bufferIndex); // offset to sacl bufferIndex += 4; int daclOffset = ServerMessageBlock.ReadInt4(buffer, bufferIndex); bufferIndex = start + daclOffset; bufferIndex++; // revision bufferIndex++; int size = ServerMessageBlock.ReadInt2(buffer, bufferIndex); bufferIndex += 2; int numAces = ServerMessageBlock.ReadInt4(buffer, bufferIndex); bufferIndex += 4; if (numAces > 4096) { throw new IOException("Invalid SecurityDescriptor"); } if (daclOffset != 0) { Aces = new Ace[numAces]; for (int i = 0; i < numAces; i++) { Aces[i] = new Ace(); bufferIndex += Aces[i].Decode(buffer, bufferIndex); } } else { Aces = null; } return(bufferIndex - start); }