Esempio n. 1
0
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbNtTransactCreateResponsePacket(SmbNtTransactCreateResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.ntTransParameters = packet.ntTransParameters;
        }
        /// <summary>
        /// Deep copy constructor.
        /// </summary>
        public SmbNtTransactCreateResponsePacket(SmbNtTransactCreateResponsePacket packet)
            : base(packet)
        {
            this.InitDefaultValue();

            this.ntTransParameters = packet.ntTransParameters;
        }
        public SmbNtTransactCreateResponsePacket CreateNtTransactCreateResponse(
            CifsServerPerConnection connection,
            SmbNtTransactCreateRequestPacket request,
            ulong allocationSize,
            ulong endOfFile,
            FileTypeValue resourceType,
            SMB_NMPIPE_STATUS nmPipeStatus,
            byte directory)
        {
            SmbNtTransactCreateResponsePacket response = new SmbNtTransactCreateResponsePacket();
            response.SmbHeader = CifsMessageUtils.CreateSmbHeader(connection, request);

            NT_TRANSACT_CREATE_Response_NT_Trans_Parameters ntTransParameters = response.NtTransParameters;
            ntTransParameters.OpLockLevel = OplockLevelValue.None;
            ntTransParameters.Reserved = 0x00;
            ntTransParameters.FID = (ushort)connection.GenerateFID();
            ntTransParameters.CreateAction = NtTransactCreateActionValues.FILE_CREATED;
            FileTime fileTime = new FileTime();
            fileTime.Time = (ulong)DateTime.Now.ToFileTime();
            ntTransParameters.CreationTime = fileTime;
            ntTransParameters.LastAccessTime = fileTime;
            ntTransParameters.LastWriteTime = fileTime;
            ntTransParameters.LastChangeTime = fileTime;
            ntTransParameters.ExtFileAttributes = request.NtTransParameters.ExtFileAttributes;
            ntTransParameters.AllocationSize = allocationSize;
            ntTransParameters.EndOfFile = endOfFile;
            ntTransParameters.ResourceType = resourceType;
            ntTransParameters.NMPipeStatus = nmPipeStatus;
            ntTransParameters.Directory = directory;
            response.NtTransParameters = ntTransParameters;

            response.UpdateCountAndOffset();

            return response;
        }