Inheritance: AndXServerMessageBlock
コード例 #1
0
ファイル: SmbTree.cs プロジェクト: MCord/SharpCifs.Std
 /// <exception cref="SharpCifs.Smb.SmbException"></exception>
 internal virtual void TreeConnect(ServerMessageBlock andx,
                                   ServerMessageBlock andxResponse)
 {
     lock (Session.Transport())
     {
         string unc;
         while (ConnectionState != 0)
         {
             if (ConnectionState == 2 || ConnectionState == 3)
             {
                 // connected or disconnecting
                 return;
             }
             try
             {
                 Runtime.Wait(Session.transport);
             }
             catch (Exception ie)
             {
                 throw new SmbException(ie.Message, ie);
             }
         }
         ConnectionState = 1;
         // trying ...
         try
         {
             Session.transport.Connect();
             unc     = "\\\\" + Session.transport.TconHostName + '\\' + Share;
             Service = Service0;
             if (Session.transport.Log.Level >= 4)
             {
                 Session.transport.Log.WriteLine(
                     "treeConnect: unc=" + unc
                     + ",service=" + Service);
             }
             SmbComTreeConnectAndXResponse response
                 = new SmbComTreeConnectAndXResponse(andxResponse);
             SmbComTreeConnectAndX request
                 = new SmbComTreeConnectAndX(Session, unc, Service, andx);
             Session.Send(request, response);
             Tid             = response.Tid;
             Service         = response.Service;
             InDfs           = response.ShareIsInDfs;
             TreeNum         = _treeConnCounter++;
             ConnectionState = 2;
         }
         catch (SmbException se)
         {
             // connected
             TreeDisconnect(true);
             ConnectionState = 0;
             throw;
         }
     }
 }
コード例 #2
0
ファイル: SmbTree.cs プロジェクト: Cyber-Forensic/Potato
		/// <exception cref="SharpCifs.Smb.SmbException"></exception>
		internal virtual void TreeConnect(ServerMessageBlock andx, ServerMessageBlock andxResponse
			)
		{
			lock (Session.Transport())
			{
				string unc;
				while (ConnectionState != 0)
				{
					if (ConnectionState == 2 || ConnectionState == 3)
					{
						// connected or disconnecting
						return;
					}
					try
					{
						Runtime.Wait(Session.transport);
					}
					catch (Exception ie)
					{
						throw new SmbException(ie.Message, ie);
					}
				}
				ConnectionState = 1;
				// trying ...
				try
				{
					Session.transport.Connect();
					unc = "\\\\" + Session.transport.TconHostName + '\\' + Share;
					Service = Service0;
					if (Session.transport.Log.Level >= 4)
					{
						Session.transport.Log.WriteLine("treeConnect: unc=" + unc + ",service=" + Service
							);
					}
					SmbComTreeConnectAndXResponse response = new SmbComTreeConnectAndXResponse(andxResponse
						);
					SmbComTreeConnectAndX request = new SmbComTreeConnectAndX(Session, unc, Service, 
						andx);
					Session.Send(request, response);
					Tid = response.Tid;
					Service = response.Service;
					InDfs = response.ShareIsInDfs;
					TreeNum = _treeConnCounter++;
					ConnectionState = 2;
				}
				catch (SmbException se)
				{
					// connected
					TreeDisconnect(true);
					ConnectionState = 0;
					throw;
				}
			}
		}