Enc_ndr_long() публичный Метод

public Enc_ndr_long ( int l ) : void
l int
Результат void
Пример #1
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Length);
				dst.Enc_ndr_referent(RootDirectory, 1);
				dst.Enc_ndr_referent(ObjectName, 1);
				dst.Enc_ndr_long(Attributes);
				dst.Enc_ndr_long(SecurityDescriptor);
				dst.Enc_ndr_referent(SecurityQualityOfService, 1);
				if (RootDirectory != null)
				{
					dst = dst.Deferred;
					RootDirectory.Encode(dst);
				}
				if (ObjectName != null)
				{
					dst = dst.Deferred;
					ObjectName.Encode(dst);
				}
				if (SecurityQualityOfService != null)
				{
					dst = dst.Deferred;
					SecurityQualityOfService.Encode(dst);
				}
			}
Пример #2
0
		internal virtual void Encode_header(NdrBuffer buf)
		{
			buf.Enc_ndr_small(5);
			buf.Enc_ndr_small(0);
			buf.Enc_ndr_small(Ptype);
			buf.Enc_ndr_small(Flags);
			buf.Enc_ndr_long(unchecked(0x00000010));
			buf.Enc_ndr_short(Length);
			buf.Enc_ndr_short(0);
			buf.Enc_ndr_long(CallId);
		}
Пример #3
0
		/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
		public override void Encode_in(NdrBuffer dst)
		{
			dst.Enc_ndr_short(MaxXmit);
			dst.Enc_ndr_short(MaxRecv);
			dst.Enc_ndr_long(0);
			dst.Enc_ndr_small(1);
			dst.Enc_ndr_small(0);
			dst.Enc_ndr_short(0);
			dst.Enc_ndr_short(0);
			dst.Enc_ndr_small(1);
			dst.Enc_ndr_small(0);
			Binding.Uuid.Encode(dst);
			dst.Enc_ndr_short(Binding.Major);
			dst.Enc_ndr_short(Binding.Minor);
            DcerpcConstants.DcerpcUuidSyntaxNdr.Encode(dst);
			dst.Enc_ndr_long(2);
		}
Пример #4
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Length);
				dst.Enc_ndr_short(ImpersonationLevel);
				dst.Enc_ndr_small(ContextMode);
				dst.Enc_ndr_small(EffectiveOnly);
			}
Пример #5
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Count);
				dst.Enc_ndr_referent(Array, 1);
				if (Array != null)
				{
					dst = dst.Deferred;
					int arrays = Count;
					dst.Enc_ndr_long(arrays);
					int arrayi = dst.Index;
					dst.Advance(4 * arrays);
					dst = dst.Derive(arrayi);
					for (int i = 0; i < arrays; i++)
					{
						Array[i].Encode(dst);
					}
				}
			}
Пример #6
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Count);
				dst.Enc_ndr_referent(S, 1);
				if (S != null)
				{
					dst = dst.Deferred;
					int ss = Count;
					dst.Enc_ndr_long(ss);
					int si = dst.Index;
					dst.Advance(4 * ss);
					dst = dst.Derive(si);
					for (int i = 0; i < ss; i++)
					{
						S[i].Encode(dst);
					}
				}
			}
Пример #7
0
            public override  void Encode(NdrBuffer _dst)  {
                _dst.Align(4);
                _dst.Enc_ndr_long(service_type);
                _dst.Enc_ndr_long(current_state);
                _dst.Enc_ndr_long(controls_accepted);
                _dst.Enc_ndr_long(win32_exit_code);
                _dst.Enc_ndr_long(service_specific_exit_code);
                _dst.Enc_ndr_long(check_point);
                _dst.Enc_ndr_long(wait_hint);

            }
Пример #8
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(TimeLow);
				dst.Enc_ndr_short(TimeMid);
				dst.Enc_ndr_short(TimeHiAndVersion);
				dst.Enc_ndr_small(ClockSeqHiAndReserved);
				dst.Enc_ndr_small(ClockSeqLow);
				int nodes = 6;
				int nodei = dst.Index;
				dst.Advance(1 * nodes);
				dst = dst.Derive(nodei);
				for (int i = 0; i < nodes; i++)
				{
					dst.Enc_ndr_small(Node[i]);
				}
			}
Пример #9
0
		/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
		public override void Encode(NdrBuffer buf)
		{
			int start = buf.GetIndex();
			int allocHintIndex = 0;
			buf.Advance(16);
			if (Ptype == 0)
			{
				allocHintIndex = buf.GetIndex();
				buf.Enc_ndr_long(0);
				buf.Enc_ndr_short(0);
				buf.Enc_ndr_short(GetOpnum());
			}
			Encode_in(buf);
			Length = buf.GetIndex() - start;
			if (Ptype == 0)
			{
				buf.SetIndex(allocHintIndex);
				AllocHint = Length - allocHintIndex;
				buf.Enc_ndr_long(AllocHint);
			}
			buf.SetIndex(start);
			Encode_header(buf);
			buf.SetIndex(start + Length);
		}
Пример #10
0
            public override void Encode_in(NdrBuffer _dst)  {
                _dst.Enc_ndr_referent(machine_name, 1);
                if (machine_name != null) {
                    _dst.Enc_ndr_string(machine_name);

                }
                _dst.Enc_ndr_referent(database_name, 1);
                if (database_name != null) {
                    _dst.Enc_ndr_string(database_name);

                }
                _dst.Enc_ndr_long(access_mask);
            }
Пример #11
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Rid);
				dst.Enc_ndr_long(Attributes);
			}
Пример #12
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Idx);
				dst.Enc_ndr_short(Name.Length);
				dst.Enc_ndr_short(Name.MaximumLength);
				dst.Enc_ndr_referent(Name.Buffer, 1);
				if (Name.Buffer != null)
				{
					dst = dst.Deferred;
					int nameBufferl = Name.Length / 2;
					int nameBuffers = Name.MaximumLength / 2;
					dst.Enc_ndr_long(nameBuffers);
					dst.Enc_ndr_long(0);
					dst.Enc_ndr_long(nameBufferl);
					int nameBufferi = dst.Index;
					dst.Advance(2 * nameBufferl);
					dst = dst.Derive(nameBufferi);
					for (int i = 0; i < nameBufferl; i++)
					{
						dst.Enc_ndr_short(Name.Buffer[i]);
					}
				}
			}
Пример #13
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				DomainHandle.Encode(dst);
				dst.Enc_ndr_long(ResumeHandle);
				dst.Enc_ndr_long(AcctFlags);
			}
Пример #14
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(NumSids);
				dst.Enc_ndr_referent(Sids, 1);
				if (Sids != null)
				{
					dst = dst.Deferred;
					int sidss = NumSids;
					dst.Enc_ndr_long(sidss);
					int sidsi = dst.Index;
					dst.Advance(4 * sidss);
					dst = dst.Derive(sidsi);
					for (int i = 0; i < sidss; i++)
					{
						Sids[i].Encode(dst);
					}
				}
			}
Пример #15
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_short(SidType);
				dst.Enc_ndr_long(Rid);
				dst.Enc_ndr_long(SidIndex);
			}
Пример #16
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_short(Name.Length);
				dst.Enc_ndr_short(Name.MaximumLength);
				dst.Enc_ndr_referent(Name.Buffer, 1);
				dst.Enc_ndr_short(DnsDomain.Length);
				dst.Enc_ndr_short(DnsDomain.MaximumLength);
				dst.Enc_ndr_referent(DnsDomain.Buffer, 1);
				dst.Enc_ndr_short(DnsForest.Length);
				dst.Enc_ndr_short(DnsForest.MaximumLength);
				dst.Enc_ndr_referent(DnsForest.Buffer, 1);
				dst.Enc_ndr_long(DomainGuid.TimeLow);
				dst.Enc_ndr_short(DomainGuid.TimeMid);
				dst.Enc_ndr_short(DomainGuid.TimeHiAndVersion);
				dst.Enc_ndr_small(DomainGuid.ClockSeqHiAndReserved);
				dst.Enc_ndr_small(DomainGuid.ClockSeqLow);
				int domainGuidNodes = 6;
				int domainGuidNodei = dst.Index;
				dst.Advance(1 * domainGuidNodes);
				dst.Enc_ndr_referent(Sid, 1);
				if (Name.Buffer != null)
				{
					dst = dst.Deferred;
					int nameBufferl = Name.Length / 2;
					int nameBuffers = Name.MaximumLength / 2;
					dst.Enc_ndr_long(nameBuffers);
					dst.Enc_ndr_long(0);
					dst.Enc_ndr_long(nameBufferl);
					int nameBufferi = dst.Index;
					dst.Advance(2 * nameBufferl);
					dst = dst.Derive(nameBufferi);
					for (int i = 0; i < nameBufferl; i++)
					{
						dst.Enc_ndr_short(Name.Buffer[i]);
					}
				}
				if (DnsDomain.Buffer != null)
				{
					dst = dst.Deferred;
					int dnsDomainBufferl = DnsDomain.Length / 2;
					int dnsDomainBuffers = DnsDomain.MaximumLength / 2;
					dst.Enc_ndr_long(dnsDomainBuffers);
					dst.Enc_ndr_long(0);
					dst.Enc_ndr_long(dnsDomainBufferl);
					int dnsDomainBufferi = dst.Index;
					dst.Advance(2 * dnsDomainBufferl);
					dst = dst.Derive(dnsDomainBufferi);
					for (int i = 0; i < dnsDomainBufferl; i++)
					{
						dst.Enc_ndr_short(DnsDomain.Buffer[i]);
					}
				}
				if (DnsForest.Buffer != null)
				{
					dst = dst.Deferred;
					int dnsForestBufferl = DnsForest.Length / 2;
					int dnsForestBuffers = DnsForest.MaximumLength / 2;
					dst.Enc_ndr_long(dnsForestBuffers);
					dst.Enc_ndr_long(0);
					dst.Enc_ndr_long(dnsForestBufferl);
					int dnsForestBufferi = dst.Index;
					dst.Advance(2 * dnsForestBufferl);
					dst = dst.Derive(dnsForestBufferi);
					for (int i = 0; i < dnsForestBufferl; i++)
					{
						dst.Enc_ndr_short(DnsForest.Buffer[i]);
					}
				}
				dst = dst.Derive(domainGuidNodei);
				for (int i1 = 0; i1 < domainGuidNodes; i1++)
				{
					dst.Enc_ndr_small(DomainGuid.Node[i1]);
				}
				if (Sid != null)
				{
					dst = dst.Deferred;
					Sid.Encode(dst);
				}
			}
Пример #17
0
 public override void Encode_in(NdrBuffer _dst)  {
     handle.Encode(_dst);
     _dst.Enc_ndr_long(type);
     _dst.Enc_ndr_long(state);
     _dst.Enc_ndr_long(buf_size);
     _dst.Enc_ndr_long(resume_handle);
 }
Пример #18
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				dst.Enc_ndr_referent(SystemName, 1);
				if (SystemName != null)
				{
					dst.Enc_ndr_string(SystemName);
				}
				ObjectAttributes.Encode(dst);
				dst.Enc_ndr_long(DesiredAccess);
			}
Пример #19
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				Handle.Encode(dst);
				Sids.Encode(dst);
				Names.Encode(dst);
				dst.Enc_ndr_short(Level);
				dst.Enc_ndr_long(Count);
			}
Пример #20
0
		/// <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;
			}
		}
Пример #21
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				dst.Enc_ndr_referent(SystemName, 1);
				if (SystemName != null)
				{
					dst.Enc_ndr_string(SystemName);
				}
				dst.Enc_ndr_long(Unknown);
				dst.Enc_ndr_long(AccessMask);
			}
Пример #22
0
 public override void Encode_in(NdrBuffer _dst)  {
     scmanager_handle.Encode(_dst);
     _dst.Enc_ndr_string(service_name);
     _dst.Enc_ndr_long(access_mask);
 }
Пример #23
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				Handle.Encode(dst);
				dst.Enc_ndr_long(AccessMask);
				Sid.Encode(dst);
			}
Пример #24
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Count);
				dst.Enc_ndr_referent(Domains, 1);
				dst.Enc_ndr_long(MaxCount);
				if (Domains != null)
				{
					dst = dst.Deferred;
					int domainss = Count;
					dst.Enc_ndr_long(domainss);
					int domainsi = dst.Index;
					dst.Advance(12 * domainss);
					dst = dst.Derive(domainsi);
					for (int i = 0; i < domainss; i++)
					{
						Domains[i].Encode(dst);
					}
				}
			}
Пример #25
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Count);
				dst.Enc_ndr_referent(Entries, 1);
				if (Entries != null)
				{
					dst = dst.Deferred;
					int entriess = Count;
					dst.Enc_ndr_long(entriess);
					int entriesi = dst.Index;
					dst.Advance(12 * entriess);
					dst = dst.Derive(entriesi);
					for (int i = 0; i < entriess; i++)
					{
						Entries[i].Encode(dst);
					}
				}
			}
Пример #26
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_short(Length);
				dst.Enc_ndr_short(MaximumLength);
				dst.Enc_ndr_referent(Buffer, 1);
				if (Buffer != null)
				{
					dst = dst.Deferred;
					int bufferl = Length / 2;
					int buffers = MaximumLength / 2;
					dst.Enc_ndr_long(buffers);
					dst.Enc_ndr_long(0);
					dst.Enc_ndr_long(bufferl);
					int bufferi = dst.Index;
					dst.Advance(2 * bufferl);
					dst = dst.Derive(bufferi);
					for (int i = 0; i < bufferl; i++)
					{
						dst.Enc_ndr_short(Buffer[i]);
					}
				}
			}
Пример #27
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				DomainHandle.Encode(dst);
				dst.Enc_ndr_long(AccessMask);
				dst.Enc_ndr_long(Rid);
			}
Пример #28
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				int subAuthoritys = SubAuthorityCount;
				dst.Enc_ndr_long(subAuthoritys);
				dst.Enc_ndr_small(Revision);
				dst.Enc_ndr_small(SubAuthorityCount);
				int identifierAuthoritys = 6;
				int identifierAuthorityi = dst.Index;
				dst.Advance(1 * identifierAuthoritys);
				int subAuthorityi = dst.Index;
				dst.Advance(4 * subAuthoritys);
				dst = dst.Derive(identifierAuthorityi);
				for (int i = 0; i < identifierAuthoritys; i++)
				{
					dst.Enc_ndr_small(IdentifierAuthority[i]);
				}
				dst = dst.Derive(subAuthorityi);
				for (int i1 = 0; i1 < subAuthoritys; i1++)
				{
					dst.Enc_ndr_long(SubAuthority[i1]);
				}
			}
Пример #29
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_long(Count);
				dst.Enc_ndr_referent(Rids, 1);
				if (Rids != null)
				{
					dst = dst.Deferred;
					int ridss = Count;
					dst.Enc_ndr_long(ridss);
					int ridsi = dst.Index;
					dst.Advance(8 * ridss);
					dst = dst.Derive(ridsi);
					for (int i = 0; i < ridss; i++)
					{
						Rids[i].Encode(dst);
					}
				}
			}
Пример #30
0
            public override void Encode_in(NdrBuffer _dst)  {
                handle.Encode(_dst);
                _dst.Enc_ndr_long(num_service_args);
                _dst.Enc_ndr_referent(service_arg_vectors, 1);
                if (service_arg_vectors != null) {
                    int _service_arg_vectorss = num_service_args;
                    _dst.Enc_ndr_long(_service_arg_vectorss);
                    for (int _i = 0; _i < _service_arg_vectorss; _i++) {
                        _dst.Enc_ndr_referent(service_arg_vectors[_i], 1);
                    }

                    for (int _i = 0; _i < _service_arg_vectorss; _i++) {
                        if (service_arg_vectors[_i] != null) {
                            _dst.Enc_ndr_string(service_arg_vectors[_i]);

                        }
                    }
                }
            }