Reset() public méthode

public Reset ( ) : void
Résultat void
		/// <exception cref="SharpCifs.Dcerpc.DcerpcException"></exception>
		/// <exception cref="System.IO.IOException"></exception>
		public virtual void Sendrecv(DcerpcMessage msg)
		{
			byte[] stub;
			byte[] frag;
			NdrBuffer buf;
			NdrBuffer fbuf;
			bool isLast;
			bool isDirect;
			DcerpcException de;
			if (State == 0)
			{
				Bind();
			}
			isDirect = true;
			stub = BufferCache.GetBuffer();
			try
			{
				int off;
				int tot;
				int n;
				buf = new NdrBuffer(stub, 0);
                msg.Flags = DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag;
				msg.CallId = _callId++;
				msg.Encode(buf);
				if (SecurityProvider != null)
				{
					buf.SetIndex(0);
					SecurityProvider.Wrap(buf);
				}
				tot = buf.GetLength() - 24;
				off = 0;
				while (off < tot)
				{
					n = tot - off;
					if ((24 + n) > MaxXmit)
					{
                        msg.Flags &= ~DcerpcConstants.DcerpcLastFrag;
						n = MaxXmit - 24;
					}
					else
					{
                        msg.Flags |= DcerpcConstants.DcerpcLastFrag;
						isDirect = false;
						msg.AllocHint = n;
					}
					msg.Length = 24 + n;
					if (off > 0)
					{
                        msg.Flags &= ~DcerpcConstants.DcerpcFirstFrag;
					}
                    if ((msg.Flags & (DcerpcConstants.DcerpcFirstFrag | DcerpcConstants.DcerpcLastFrag)) != (DcerpcConstants.DcerpcFirstFrag |
                        DcerpcConstants.DcerpcLastFrag))
					{
						buf.Start = off;
						buf.Reset();
						msg.Encode_header(buf);
						buf.Enc_ndr_long(msg.AllocHint);
						buf.Enc_ndr_short(0);
						buf.Enc_ndr_short(msg.GetOpnum());
					}
					DoSendFragment(stub, off, msg.Length, isDirect);
					off += n;
				}
				DoReceiveFragment(stub, isDirect);
				buf.Reset();
				buf.SetIndex(8);
				buf.SetLength(buf.Dec_ndr_short());
				if (SecurityProvider != null)
				{
					SecurityProvider.Unwrap(buf);
				}
				buf.SetIndex(0);
				msg.Decode_header(buf);
				off = 24;
                if (msg.Ptype == 2 && msg.IsFlagSet(DcerpcConstants.DcerpcLastFrag) == false)
				{
					off = msg.Length;
				}
				frag = null;
				fbuf = null;
                while (msg.IsFlagSet(DcerpcConstants.DcerpcLastFrag) == false)
				{
					int stubFragLen;
					if (frag == null)
					{
						frag = new byte[MaxRecv];
						fbuf = new NdrBuffer(frag, 0);
					}
					DoReceiveFragment(frag, isDirect);
					fbuf.Reset();
					fbuf.SetIndex(8);
					fbuf.SetLength(fbuf.Dec_ndr_short());
					if (SecurityProvider != null)
					{
						SecurityProvider.Unwrap(fbuf);
					}
					fbuf.Reset();
					msg.Decode_header(fbuf);
					stubFragLen = msg.Length - 24;
					if ((off + stubFragLen) > stub.Length)
					{
						// shouldn't happen if alloc_hint is correct or greater
						byte[] tmp = new byte[off + stubFragLen];
						Array.Copy(stub, 0, tmp, 0, off);
						stub = tmp;
					}
					Array.Copy(frag, 24, stub, off, stubFragLen);
					off += stubFragLen;
				}
				buf = new NdrBuffer(stub, 0);
				msg.Decode(buf);
			}
			finally
			{
				BufferCache.ReleaseBuffer(stub);
			}
			if ((de = msg.GetResult()) != null)
			{
				throw de;
			}
		}