Align() public method

public Align ( int boundary ) : int
boundary int
return int
Example #1
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());
				}
			}
Example #2
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);
				}
			}
Example #3
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());
			}
Example #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);
			}
Example #5
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();
				}
			}
Example #6
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);
				}
			}
Example #7
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);
				}
			}
Example #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();
				}
			}
Example #9
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();

            }
Example #10
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);

            }
Example #11
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]);
				}
			}
Example #12
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);
					}
				}
			}
Example #13
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);
					}
				}
			}
Example #14
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Idx = src.Dec_ndr_long();
				src.Align(4);
				if (Name == null)
				{
					Name = new Rpc.Unicode_string();
				}
				Name.Length = (short)src.Dec_ndr_short();
				Name.MaximumLength = (short)src.Dec_ndr_short();
				int nameBufferp = src.Dec_ndr_long();
				if (nameBufferp != 0)
				{
					src = src.Deferred;
					int nameBuffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int nameBufferl = src.Dec_ndr_long();
					int nameBufferi = src.Index;
					src.Advance(2 * nameBufferl);
					if (Name.Buffer == null)
					{
						if (nameBuffers < 0 || nameBuffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Name.Buffer = new short[nameBuffers];
					}
					src = src.Derive(nameBufferi);
					for (int i = 0; i < nameBufferl; i++)
					{
						Name.Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
			}
Example #15
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]);
					}
				}
			}
Example #16
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				int subAuthoritys = src.Dec_ndr_long();
				Revision = unchecked((byte)src.Dec_ndr_small());
				SubAuthorityCount = unchecked((byte)src.Dec_ndr_small());
				int identifierAuthoritys = 6;
				int identifierAuthorityi = src.Index;
				src.Advance(1 * identifierAuthoritys);
				int subAuthorityi = src.Index;
				src.Advance(4 * subAuthoritys);
				if (IdentifierAuthority == null)
				{
					if (identifierAuthoritys < 0 || identifierAuthoritys > unchecked(0xFFFF))
					{
						throw new NdrException(NdrException.InvalidConformance);
					}
					IdentifierAuthority = new byte[identifierAuthoritys];
				}
				src = src.Derive(identifierAuthorityi);
				for (int i = 0; i < identifierAuthoritys; i++)
				{
					IdentifierAuthority[i] = unchecked((byte)src.Dec_ndr_small());
				}
				if (SubAuthority == null)
				{
					if (subAuthoritys < 0 || subAuthoritys > unchecked(0xFFFF))
					{
						throw new NdrException(NdrException.InvalidConformance);
					}
					SubAuthority = new int[subAuthoritys];
				}
				src = src.Derive(subAuthorityi);
				for (int i1 = 0; i1 < subAuthoritys; i1++)
				{
					SubAuthority[i1] = src.Dec_ndr_long();
				}
			}
Example #17
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]);
				}
			}
Example #18
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Length = (short)src.Dec_ndr_short();
				MaximumLength = (short)src.Dec_ndr_short();
				int bufferp = src.Dec_ndr_long();
				if (bufferp != 0)
				{
					src = src.Deferred;
					int buffers = src.Dec_ndr_long();
					src.Dec_ndr_long();
					int bufferl = src.Dec_ndr_long();
					int bufferi = src.Index;
					src.Advance(2 * bufferl);
					if (Buffer == null)
					{
						if (buffers < 0 || buffers > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Buffer = new short[buffers];
					}
					src = src.Derive(bufferi);
					for (int i = 0; i < bufferl; i++)
					{
						Buffer[i] = (short)src.Dec_ndr_short();
					}
				}
			}
Example #19
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]);
					}
				}
			}
Example #20
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);
					}
				}
			}
Example #21
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);
			}
Example #22
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);
					}
				}
			}
Example #23
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int sidsp = src.Dec_ndr_long();
				if (sidsp != 0)
				{
					src = src.Deferred;
					int sidss = src.Dec_ndr_long();
					int sidsi = src.Index;
					src.Advance(12 * sidss);
					if (Sids == null)
					{
						if (sidss < 0 || sidss > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Sids = new LsarTranslatedSid[sidss];
					}
					src = src.Derive(sidsi);
					for (int i = 0; i < sidss; i++)
					{
						if (Sids[i] == null)
						{
							Sids[i] = new LsarTranslatedSid();
						}
						Sids[i].Decode(src);
					}
				}
			}
Example #24
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				SidType = src.Dec_ndr_short();
				Rid = src.Dec_ndr_long();
				SidIndex = src.Dec_ndr_long();
			}
Example #25
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);
					}
				}
			}
Example #26
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);
					}
				}
			}
Example #27
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();
			}
Example #28
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int domainsp = src.Dec_ndr_long();
				MaxCount = src.Dec_ndr_long();
				if (domainsp != 0)
				{
					src = src.Deferred;
					int domainss = src.Dec_ndr_long();
					int domainsi = src.Index;
					src.Advance(12 * domainss);
					if (Domains == null)
					{
						if (domainss < 0 || domainss > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Domains = new LsarTrustInformation[domainss];
					}
					src = src.Derive(domainsi);
					for (int i = 0; i < domainss; i++)
					{
						if (Domains[i] == null)
						{
							Domains[i] = new LsarTrustInformation();
						}
						Domains[i].Decode(src);
					}
				}
			}
Example #29
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);
					}
				}
			}
Example #30
0
			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>
			public override void Decode(NdrBuffer src)
			{
				src.Align(4);
				Count = src.Dec_ndr_long();
				int namesp = src.Dec_ndr_long();
				if (namesp != 0)
				{
					src = src.Deferred;
					int namess = src.Dec_ndr_long();
					int namesi = src.Index;
					src.Advance(16 * namess);
					if (Names == null)
					{
						if (namess < 0 || namess > unchecked(0xFFFF))
						{
							throw new NdrException(NdrException.InvalidConformance);
						}
						Names = new LsarTranslatedName[namess];
					}
					src = src.Derive(namesi);
					for (int i = 0; i < namess; i++)
					{
						if (Names[i] == null)
						{
							Names[i] = new LsarTranslatedName();
						}
						Names[i].Decode(src);
					}
				}
			}