Exemplo n.º 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);
				}
			}
Exemplo n.º 2
0
		public NdrBuffer(byte[] buf, int start)
		{
			this.Buf = buf;
			this.Start = Index = start;
			Length = 0;
			Deferred = this;
		}
Exemplo n.º 3
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				TimeLow = src.Dec_ndr_long();
				TimeMid = (short)src.Dec_ndr_short();
				TimeHiAndVersion = (short)src.Dec_ndr_short();
				ClockSeqHiAndReserved = unchecked((byte)src.Dec_ndr_small());
				ClockSeqLow = unchecked((byte)src.Dec_ndr_small());
				int nodes = 6;
				int nodei = src.Index;
				src.Advance(1 * nodes);
				if (Node == null)
				{
					if (nodes < 0 || nodes > unchecked(0xFFFF))
					{
						throw new NdrException(NdrException.InvalidConformance);
					}
					Node = new byte[nodes];
				}
				src = src.Derive(nodei);
				for (int i = 0; i < nodes; i++)
				{
					Node[i] = unchecked((byte)src.Dec_ndr_small());
				}
			}
Exemplo n.º 4
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int arrayp = src.Dec_ndr_long();
				if (arrayp != 0)
				{
					src = src.Deferred;
					int arrays = src.Dec_ndr_long();
					int arrayi = src.Index;
					src.Advance(4 * arrays);
					if (Array == null)
					{
						if (arrays < 0 || arrays > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Array = new ShareInfo0[arrays];
					}
					src = src.Derive(arrayi);
					for (int i = 0; i < arrays; i++)
					{
						if (Array[i] == null)
						{
							Array[i] = new ShareInfo0();
						}
						Array[i].Decode(src);
					}
				}
			}
Exemplo n.º 5
0
		public virtual NdrBuffer Derive(int idx)
		{
			NdrBuffer nb = new NdrBuffer(Buf, Start);
			nb.Index = idx;
			nb.Deferred = Deferred;
			return nb;
		}
Exemplo n.º 6
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Length = src.Dec_ndr_long();
				ImpersonationLevel = (short)src.Dec_ndr_short();
				ContextMode = unchecked((byte)src.Dec_ndr_small());
				EffectiveOnly = unchecked((byte)src.Dec_ndr_small());
			}
Exemplo n.º 7
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);
			}
Exemplo n.º 8
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				int entryPathp = src.Dec_ndr_long();
				if (entryPathp != 0)
				{
					src = src.Deferred;
					EntryPath = src.Dec_ndr_string();
				}
			}
Exemplo n.º 9
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				int netnamep = src.Dec_ndr_long();
				if (netnamep != 0)
				{
					src = src.Deferred;
					Netname = src.Dec_ndr_string();
				}
			}
Exemplo n.º 10
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_referent(Netname, 1);
				if (Netname != null)
				{
					dst = dst.Deferred;
					dst.Enc_ndr_string(Netname);
				}
			}
Exemplo n.º 11
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode(NdrBuffer dst)
			{
				dst.Align(4);
				dst.Enc_ndr_referent(EntryPath, 1);
				if (EntryPath != null)
				{
					dst = dst.Deferred;
					dst.Enc_ndr_string(EntryPath);
				}
			}
Exemplo n.º 12
0
            public override  void Decode(NdrBuffer _src)  {
                _src.Align(4);
                service_type = (int)_src.Dec_ndr_long();
                current_state = (int)_src.Dec_ndr_long();
                controls_accepted = (int)_src.Dec_ndr_long();
                win32_exit_code = (int)_src.Dec_ndr_long();
                service_specific_exit_code = (int)_src.Dec_ndr_long();
                check_point = (int)_src.Dec_ndr_long();
                wait_hint = (int)_src.Dec_ndr_long();

            }
Exemplo n.º 13
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);

            }
Exemplo n.º 14
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);
		}
Exemplo n.º 15
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);
		}
Exemplo n.º 16
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]);
				}
			}
Exemplo n.º 17
0
		/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
		internal virtual void Decode_header(NdrBuffer buf)
		{
			if (buf.Dec_ndr_small() != 5 || buf.Dec_ndr_small() != 0)
			{
				throw new NdrException("DCERPC version not supported");
			}
			Ptype = buf.Dec_ndr_small();
			Flags = buf.Dec_ndr_small();
			if (buf.Dec_ndr_long() != unchecked(0x00000010))
			{
				throw new NdrException("Data representation not supported");
			}
			Length = buf.Dec_ndr_short();
			if (buf.Dec_ndr_short() != 0)
			{
				throw new NdrException("DCERPC authentication not supported");
			}
			CallId = buf.Dec_ndr_long();
		}
Exemplo n.º 18
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);
					}
				}
			}
Exemplo n.º 19
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);
					}
				}
			}
Exemplo n.º 20
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode_out(NdrBuffer src)
			{
				Retval = src.Dec_ndr_long();
			}
Exemplo n.º 21
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Encode_in(NdrBuffer dst)
			{
				Handle.Encode(dst);
			}
Exemplo n.º 22
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int ridsp = src.Dec_ndr_long();
				if (ridsp != 0)
				{
					src = src.Deferred;
					int ridss = src.Dec_ndr_long();
					int ridsi = src.Index;
					src.Advance(8 * ridss);
					if (Rids == null)
					{
						if (ridss < 0 || ridss > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Rids = new SamrRidWithAttribute[ridss];
					}
					src = src.Derive(ridsi);
					for (int i = 0; i < ridss; i++)
					{
						if (Rids[i] == null)
						{
							Rids[i] = new SamrRidWithAttribute();
						}
						Rids[i].Decode(src);
					}
				}
			}
Exemplo n.º 23
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);
					}
				}
			}
Exemplo n.º 24
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Rid = src.Dec_ndr_long();
				Attributes = src.Dec_ndr_long();
			}
Exemplo n.º 25
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);
			}
Exemplo n.º 26
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode_out(NdrBuffer src)
			{
				AliasHandle.Decode(src);
				Retval = src.Dec_ndr_long();
			}
Exemplo n.º 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);
			}
Exemplo n.º 28
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode_out(NdrBuffer src)
			{
				ResumeHandle = src.Dec_ndr_long();
				int samp = src.Dec_ndr_long();
				if (samp != 0)
				{
					if (Sam == null)
					{
						Sam = new SamrSamArray();
					}
					Sam.Decode(src);
				}
				NumEntries = src.Dec_ndr_long();
				Retval = src.Dec_ndr_long();
			}
Exemplo n.º 29
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);
			}
Exemplo n.º 30
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int entriesp = src.Dec_ndr_long();
				if (entriesp != 0)
				{
					src = src.Deferred;
					int entriess = src.Dec_ndr_long();
					int entriesi = src.Index;
					src.Advance(12 * entriess);
					if (Entries == null)
					{
						if (entriess < 0 || entriess > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Entries = new SamrSamEntry[entriess];
					}
					src = src.Derive(entriesi);
					for (int i = 0; i < entriess; i++)
					{
						if (Entries[i] == null)
						{
							Entries[i] = new SamrSamEntry();
						}
						Entries[i].Decode(src);
					}
				}
			}
Exemplo n.º 31
0
 public virtual void Reset()
 {
     Index    = Start;
     Length   = 0;
     Deferred = this;
 }