public SMB1FileStore TreeConnect(string shareName, ServiceName serviceName, out NTStatus status) { if (!m_isConnected || !m_isLoggedIn) { throw new InvalidOperationException("A login session must be successfully established before connecting to a share"); } TreeConnectAndXRequest request = new TreeConnectAndXRequest(); request.Path = shareName; request.Service = serviceName; TrySendMessage(request); SMB1Message reply = WaitForMessage(CommandName.SMB_COM_TREE_CONNECT_ANDX); if (reply != null) { status = reply.Header.Status; if (reply.Header.Status == NTStatus.STATUS_SUCCESS && reply.Commands[0] is TreeConnectAndXResponse) { TreeConnectAndXResponse response = (TreeConnectAndXResponse)reply.Commands[0]; return(new SMB1FileStore(this, reply.Header.TID)); } } else { status = NTStatus.STATUS_INVALID_SMB; } return(null); }
private static TreeConnectAndXResponse CreateTreeConnectResponse(ServiceName serviceName) { TreeConnectAndXResponse response = new TreeConnectAndXResponse(); response.OptionalSupport = OptionalSupportFlags.SMB_SUPPORT_SEARCH_BITS; response.NativeFileSystem = String.Empty; response.Service = serviceName; return(response); }
private static TreeConnectAndXResponse CreateTreeConnectResponse(ServiceName serviceName, OptionalSupportFlags supportFlags) { TreeConnectAndXResponse response = new TreeConnectAndXResponse(); response.OptionalSupport = supportFlags; response.NativeFileSystem = String.Empty; response.Service = serviceName; return(response); }