internal virtual int WriteAndXWireFormat(byte[] dst, int dstIndex)
{
int start = dstIndex;
WordCount = WriteParameterWordsWireFormat(dst, start + AndxOffsetOffset + 2);
WordCount += 4;
// for command, reserved, and offset
dstIndex += WordCount + 1;
WordCount /= 2;
dst[start] = unchecked ((byte)(WordCount & unchecked (0xFF)));
ByteCount = WriteBytesWireFormat(dst, dstIndex + 2);
dst[dstIndex++] = unchecked ((byte)(ByteCount & unchecked (0xFF)));
dst[dstIndex++] = unchecked ((byte)((ByteCount >> 8) & unchecked (0xFF)));
dstIndex += ByteCount;
if (Andx == null || SmbConstants.UseBatching == false || BatchLevel >= GetBatchLimit(Andx.Command
))
{
_andxCommand = unchecked (unchecked (0xFF));
Andx = null;
dst[start + AndxCommandOffset] = unchecked (unchecked (0xFF));
dst[start + AndxReservedOffset] = unchecked (unchecked (0x00));
// dst[start + ANDX_OFFSET_OFFSET] = (byte)0x00;
// dst[start + ANDX_OFFSET_OFFSET + 1] = (byte)0x00;
dst[start + AndxOffsetOffset] = unchecked (unchecked (0xde));
dst[start + AndxOffsetOffset + 1] = unchecked (unchecked (0xde));
// andx not used; return
return(dstIndex - start);
}
Andx.BatchLevel = BatchLevel + 1;
dst[start + AndxCommandOffset] = _andxCommand;
dst[start + AndxReservedOffset] = unchecked (unchecked (0x00));
_andxOffset = dstIndex - HeaderStart;
WriteInt2(_andxOffset, dst, start + AndxOffsetOffset);
Andx.UseUnicode = UseUnicode;
if (Andx is AndXServerMessageBlock)
{
Andx.Uid = Uid;
dstIndex += ((AndXServerMessageBlock)Andx).WriteAndXWireFormat(dst, dstIndex
);
}
else
{
// the andx smb is not of type andx so lets just write it here and
// were done.
int andxStart = dstIndex;
Andx.WordCount = Andx.WriteParameterWordsWireFormat(dst, dstIndex);
dstIndex += Andx.WordCount + 1;
Andx.WordCount /= 2;
dst[andxStart] = unchecked ((byte)(Andx.WordCount & unchecked (0xFF)));
Andx.ByteCount = Andx.WriteBytesWireFormat(dst, dstIndex + 2);
dst[dstIndex++] = unchecked ((byte)(Andx.ByteCount & unchecked (0xFF)));
dst[dstIndex++] = unchecked ((byte)((Andx.ByteCount >> 8) & unchecked (0xFF)
));
dstIndex += Andx.ByteCount;
}
return(dstIndex - start);
}