コード例 #1
0
        /// <summary>
        /// There are no interim response messages.
        /// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
        /// The server MUST respond to the transaction request as a whole.
        /// </summary>
        internal static SMBCommand GetTransactionResponse(SMBHeader header, TransactionRequest request, object share, StateObject state, List <SMBCommand> sendQueue)
        {
            ProcessStateObject processState = state.ObtainProcessState(header.PID);

            processState.MaxDataCount = request.MaxDataCount;

            if (request.TransParameters.Length < request.TotalParameterCount ||
                request.TransData.Length < request.TotalDataCount)
            {
                // A secondary transaction request is pending
                processState.TransactionSetup      = request.Setup;
                processState.TransactionParameters = new byte[request.TotalParameterCount];
                processState.TransactionData       = new byte[request.TotalDataCount];
                ByteWriter.WriteBytes(processState.TransactionParameters, 0, request.TransParameters);
                ByteWriter.WriteBytes(processState.TransactionData, 0, request.TransData);
                processState.TransactionParametersReceived += request.TransParameters.Length;
                processState.TransactionDataReceived       += request.TransData.Length;
                return(null);
            }
            else
            {
                // We have a complete command
                if (request is Transaction2Request)
                {
                    return(GetCompleteTransaction2Response(header, request.Setup, request.TransParameters, request.TransData, share, state, sendQueue));
                }
                else
                {
                    return(GetCompleteTransactionResponse(header, request.Setup, request.TransParameters, request.TransData, share, state, sendQueue));
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// The client MUST send as many secondary requests as are needed to complete the transfer of the transaction request.
 /// </summary>
 internal static SMBCommand GetNTTransactResponse(SMBHeader header, NTTransactRequest request, object share, StateObject state, List <SMBCommand> sendQueue)
 {
     if (request.TransParameters.Length < request.TotalParameterCount ||
         request.TransData.Length < request.TotalDataCount)
     {
         ProcessStateObject processState = state.ObtainProcessState(header.PID);
         // A secondary transaction request is pending
         processState.SubcommandID          = (ushort)request.Function;
         processState.TransactionSetup      = request.Setup;
         processState.TransactionParameters = new byte[request.TotalParameterCount];
         processState.TransactionData       = new byte[request.TotalDataCount];
         ByteWriter.WriteBytes(processState.TransactionParameters, 0, request.TransParameters);
         ByteWriter.WriteBytes(processState.TransactionData, 0, request.TransData);
         processState.TransactionParametersReceived += request.TransParameters.Length;
         processState.TransactionDataReceived       += request.TransData.Length;
         return(new NTTransactInterimResponse());
     }
     else
     {
         // We have a complete command
         return(GetCompleteNTTransactResponse(header, request.Function, request.Setup, request.TransParameters, request.TransData, share, state, sendQueue));
     }
 }