| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734 | // This code is derived from jcifs smb client library <jcifs at samba dot org>// Ported by J. Arturo <webmaster at komodosoft dot net>//  // This library is free software; you can redistribute it and/or// modify it under the terms of the GNU Lesser General Public// License as published by the Free Software Foundation; either// version 2.1 of the License, or (at your option) any later version.// // This library is distributed in the hope that it will be useful,// but WITHOUT ANY WARRANTY; without even the implied warranty of// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU// Lesser General Public License for more details.// // You should have received a copy of the GNU Lesser General Public// License along with this library; if not, write to the Free Software// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USAusing SharpCifs.Dcerpc.Ndr;namespace SharpCifs.Dcerpc.Msrpc{	public class Srvsvc	{		public static string GetSyntax()		{			return "4b324fc8-1670-01d3-1278-5a47bf6ee188:3.0";		}		public class ShareInfo0 : NdrObject		{			public string Netname;			/// <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);				}			}			/// <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();				}			}		}		public class ShareInfoCtr0 : NdrObject		{			public int Count;			public ShareInfo0[] Array;			/// <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);					}				}			}			/// <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);					}				}			}		}		public class ShareInfo1 : NdrObject		{			public string Netname;			public int Type;			public string Remark;			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode(NdrBuffer dst)			{				dst.Align(4);				dst.Enc_ndr_referent(Netname, 1);				dst.Enc_ndr_long(Type);				dst.Enc_ndr_referent(Remark, 1);				if (Netname != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Netname);				}				if (Remark != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Remark);				}			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode(NdrBuffer src)			{				src.Align(4);				int netnamep = src.Dec_ndr_long();				Type = src.Dec_ndr_long();				int remarkp = src.Dec_ndr_long();				if (netnamep != 0)				{					src = src.Deferred;					Netname = src.Dec_ndr_string();				}				if (remarkp != 0)				{					src = src.Deferred;					Remark = src.Dec_ndr_string();				}			}		}		public class ShareInfoCtr1 : NdrObject		{			public int Count;			public ShareInfo1[] Array;			/// <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(12 * arrays);					dst = dst.Derive(arrayi);					for (int i = 0; i < arrays; i++)					{						Array[i].Encode(dst);					}				}			}			/// <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(12 * arrays);					if (Array == null)					{						if (arrays < 0 || arrays > unchecked(0xFFFF))						{							throw new NdrException(NdrException.InvalidConformance);						}						Array = new ShareInfo1[arrays];					}					src = src.Derive(arrayi);					for (int i = 0; i < arrays; i++)					{						if (Array[i] == null)						{							Array[i] = new ShareInfo1();						}						Array[i].Decode(src);					}				}			}		}		public class ShareInfo502 : NdrObject		{			public string Netname;			public int Type;			public string Remark;			public int Permissions;			public int MaxUses;			public int CurrentUses;			public string Path;			public string Password;			public int SdSize;			public byte[] SecurityDescriptor;			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode(NdrBuffer dst)			{				dst.Align(4);				dst.Enc_ndr_referent(Netname, 1);				dst.Enc_ndr_long(Type);				dst.Enc_ndr_referent(Remark, 1);				dst.Enc_ndr_long(Permissions);				dst.Enc_ndr_long(MaxUses);				dst.Enc_ndr_long(CurrentUses);				dst.Enc_ndr_referent(Path, 1);				dst.Enc_ndr_referent(Password, 1);				dst.Enc_ndr_long(SdSize);				dst.Enc_ndr_referent(SecurityDescriptor, 1);				if (Netname != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Netname);				}				if (Remark != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Remark);				}				if (Path != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Path);				}				if (Password != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Password);				}				if (SecurityDescriptor != null)				{					dst = dst.Deferred;					int securityDescriptors = SdSize;					dst.Enc_ndr_long(securityDescriptors);					int securityDescriptori = dst.Index;					dst.Advance(1 * securityDescriptors);					dst = dst.Derive(securityDescriptori);					for (int i = 0; i < securityDescriptors; i++)					{						dst.Enc_ndr_small(SecurityDescriptor[i]);					}				}			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode(NdrBuffer src)			{				src.Align(4);				int netnamep = src.Dec_ndr_long();				Type = src.Dec_ndr_long();				int remarkp = src.Dec_ndr_long();				Permissions = src.Dec_ndr_long();				MaxUses = src.Dec_ndr_long();				CurrentUses = src.Dec_ndr_long();				int pathp = src.Dec_ndr_long();				int passwordp = src.Dec_ndr_long();				SdSize = src.Dec_ndr_long();				int securityDescriptorp = src.Dec_ndr_long();				if (netnamep != 0)				{					src = src.Deferred;					Netname = src.Dec_ndr_string();				}				if (remarkp != 0)				{					src = src.Deferred;					Remark = src.Dec_ndr_string();				}				if (pathp != 0)				{					src = src.Deferred;					Path = src.Dec_ndr_string();				}				if (passwordp != 0)				{					src = src.Deferred;					Password = src.Dec_ndr_string();				}				if (securityDescriptorp != 0)				{					src = src.Deferred;					int securityDescriptors = src.Dec_ndr_long();					int securityDescriptori = src.Index;					src.Advance(1 * securityDescriptors);					if (SecurityDescriptor == null)					{						if (securityDescriptors < 0 || securityDescriptors > unchecked(0xFFFF))						{							throw new NdrException(NdrException.InvalidConformance);						}						SecurityDescriptor = new byte[securityDescriptors];					}					src = src.Derive(securityDescriptori);					for (int i = 0; i < securityDescriptors; i++)					{						SecurityDescriptor[i] = unchecked((byte)src.Dec_ndr_small());					}				}			}		}		public class ShareInfoCtr502 : NdrObject		{			public int Count;			public ShareInfo502[] Array;			/// <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(40 * arrays);					dst = dst.Derive(arrayi);					for (int i = 0; i < arrays; i++)					{						Array[i].Encode(dst);					}				}			}			/// <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(40 * arrays);					if (Array == null)					{						if (arrays < 0 || arrays > unchecked(0xFFFF))						{							throw new NdrException(NdrException.InvalidConformance);						}						Array = new ShareInfo502[arrays];					}					src = src.Derive(arrayi);					for (int i = 0; i < arrays; i++)					{						if (Array[i] == null)						{							Array[i] = new ShareInfo502();						}						Array[i].Decode(src);					}				}			}		}		public class ShareEnumAll : DcerpcMessage		{			public override int GetOpnum()			{				return unchecked(0x0f);			}			public int Retval;			public string Servername;			public int Level;			public NdrObject Info;			public int Prefmaxlen;			public int Totalentries;			public int ResumeHandle;			public ShareEnumAll(string servername, int level, NdrObject info, int prefmaxlen, 				int totalentries, int resumeHandle)			{				this.Servername = servername;				this.Level = level;				this.Info = info;				this.Prefmaxlen = prefmaxlen;				this.Totalentries = totalentries;				this.ResumeHandle = resumeHandle;			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode_in(NdrBuffer dst)			{				dst.Enc_ndr_referent(Servername, 1);				if (Servername != null)				{					dst.Enc_ndr_string(Servername);				}				dst.Enc_ndr_long(Level);				int descr = Level;				dst.Enc_ndr_long(descr);				dst.Enc_ndr_referent(Info, 1);				if (Info != null)				{					dst = dst.Deferred;					Info.Encode(dst);				}				dst.Enc_ndr_long(Prefmaxlen);				dst.Enc_ndr_long(ResumeHandle);			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode_out(NdrBuffer src)			{				Level = src.Dec_ndr_long();				src.Dec_ndr_long();				int infop = src.Dec_ndr_long();				if (infop != 0)				{					if (Info == null)					{						Info = new ShareInfoCtr0();					}					src = src.Deferred;					Info.Decode(src);				}				Totalentries = src.Dec_ndr_long();				ResumeHandle = src.Dec_ndr_long();				Retval = src.Dec_ndr_long();			}		}		public class ShareGetInfo : DcerpcMessage		{			public override int GetOpnum()			{				return unchecked(0x10);			}			public int Retval;			public string Servername;			public string Sharename;			public int Level;			public NdrObject Info;			public ShareGetInfo(string servername, string sharename, int level, NdrObject info				)			{				this.Servername = servername;				this.Sharename = sharename;				this.Level = level;				this.Info = info;			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode_in(NdrBuffer dst)			{				dst.Enc_ndr_referent(Servername, 1);				if (Servername != null)				{					dst.Enc_ndr_string(Servername);				}				dst.Enc_ndr_string(Sharename);				dst.Enc_ndr_long(Level);			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode_out(NdrBuffer src)			{				src.Dec_ndr_long();				int infop = src.Dec_ndr_long();				if (infop != 0)				{					if (Info == null)					{						Info = new ShareInfo0();					}					src = src.Deferred;					Info.Decode(src);				}				Retval = src.Dec_ndr_long();			}		}		public class ServerInfo100 : NdrObject		{			public int PlatformId;			public string Name;			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode(NdrBuffer dst)			{				dst.Align(4);				dst.Enc_ndr_long(PlatformId);				dst.Enc_ndr_referent(Name, 1);				if (Name != null)				{					dst = dst.Deferred;					dst.Enc_ndr_string(Name);				}			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode(NdrBuffer src)			{				src.Align(4);				PlatformId = src.Dec_ndr_long();				int namep = src.Dec_ndr_long();				if (namep != 0)				{					src = src.Deferred;					Name = src.Dec_ndr_string();				}			}		}		public class ServerGetInfo : DcerpcMessage		{			public override int GetOpnum()			{				return unchecked(0x15);			}			public int Retval;			public string Servername;			public int Level;			public NdrObject Info;			public ServerGetInfo(string servername, int level, NdrObject info)			{				this.Servername = servername;				this.Level = level;				this.Info = info;			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode_in(NdrBuffer dst)			{				dst.Enc_ndr_referent(Servername, 1);				if (Servername != null)				{					dst.Enc_ndr_string(Servername);				}				dst.Enc_ndr_long(Level);			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode_out(NdrBuffer src)			{				src.Dec_ndr_long();				int infop = src.Dec_ndr_long();				if (infop != 0)				{					if (Info == null)					{						Info = new ServerInfo100();					}					src = src.Deferred;					Info.Decode(src);				}				Retval = src.Dec_ndr_long();			}		}		public class TimeOfDayInfo : NdrObject		{			public int Elapsedt;			public int Msecs;			public int Hours;			public int Mins;			public int Secs;			public int Hunds;			public int Timezone;			public int Tinterval;			public int Day;			public int Month;			public int Year;			public int Weekday;			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode(NdrBuffer dst)			{				dst.Align(4);				dst.Enc_ndr_long(Elapsedt);				dst.Enc_ndr_long(Msecs);				dst.Enc_ndr_long(Hours);				dst.Enc_ndr_long(Mins);				dst.Enc_ndr_long(Secs);				dst.Enc_ndr_long(Hunds);				dst.Enc_ndr_long(Timezone);				dst.Enc_ndr_long(Tinterval);				dst.Enc_ndr_long(Day);				dst.Enc_ndr_long(Month);				dst.Enc_ndr_long(Year);				dst.Enc_ndr_long(Weekday);			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode(NdrBuffer src)			{				src.Align(4);				Elapsedt = src.Dec_ndr_long();				Msecs = src.Dec_ndr_long();				Hours = src.Dec_ndr_long();				Mins = src.Dec_ndr_long();				Secs = src.Dec_ndr_long();				Hunds = src.Dec_ndr_long();				Timezone = src.Dec_ndr_long();				Tinterval = src.Dec_ndr_long();				Day = src.Dec_ndr_long();				Month = src.Dec_ndr_long();				Year = src.Dec_ndr_long();				Weekday = src.Dec_ndr_long();			}		}		public class RemoteTod : DcerpcMessage		{			public override int GetOpnum()			{				return unchecked(0x1c);			}			public int Retval;			public string Servername;			public TimeOfDayInfo Info;			public RemoteTod(string servername, TimeOfDayInfo info)			{				this.Servername = servername;				this.Info = info;			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Encode_in(NdrBuffer dst)			{				dst.Enc_ndr_referent(Servername, 1);				if (Servername != null)				{					dst.Enc_ndr_string(Servername);				}			}			/// <exception cref="SharpCifs.Dcerpc.Ndr.NdrException"></exception>			public override void Decode_out(NdrBuffer src)			{				int infop = src.Dec_ndr_long();				if (infop != 0)				{					if (Info == null)					{						Info = new TimeOfDayInfo();					}					Info.Decode(src);				}				Retval = src.Dec_ndr_long();			}		}	}}
 |