private void DeleteFile(ModelDialectRevision dialect, string target, bool isDirectory)
        {
            LeasingClientInfo clientInfo = new LeasingClientInfo(testConfig.Timeout, testConfig);

            InitializeClient(clientInfo, dialect);

            Packet_Header header;
            CREATE_Response createResponse;
            Smb2CreateContextResponse[] serverCreateContexts;
            uint status = 0;

            status = clientInfo.Client.Create(1, 64, clientInfo.Flags, clientInfo.MessageId++, clientInfo.SessionId, clientInfo.TreeId, target,
                AccessMask.GENERIC_READ | AccessMask.GENERIC_WRITE | AccessMask.DELETE,
                ShareAccess_Values.FILE_SHARE_READ | ShareAccess_Values.FILE_SHARE_WRITE | ShareAccess_Values.FILE_SHARE_DELETE,
                (isDirectory ? CreateOptions_Values.FILE_DIRECTORY_FILE : CreateOptions_Values.FILE_NON_DIRECTORY_FILE) | CreateOptions_Values.FILE_DELETE_ON_CLOSE,
                CreateDisposition_Values.FILE_OPEN_IF,
                File_Attributes.NONE,
                ImpersonationLevel_Values.Impersonation,
                SecurityFlags_Values.NONE,
                RequestedOplockLevel_Values.OPLOCK_LEVEL_NONE,
                null,
                out clientInfo.FileId,
                out serverCreateContexts,
                out header,
                out createResponse);
            clientInfo.GrantedCredit = header.CreditRequestResponse;

            FileDispositionInformation deleteInfo;
            deleteInfo.DeletePending = 1;

            byte[] inputBuffer;
            inputBuffer = TypeMarshal.ToBytes<FileDispositionInformation>(deleteInfo);

            SET_INFO_Response responsePayload;
            clientInfo.Client.SetInfo(
                1,
                1,
                clientInfo.Flags,
                clientInfo.MessageId++,
                clientInfo.SessionId,
                clientInfo.TreeId,
                SET_INFO_Request_InfoType_Values.SMB2_0_INFO_FILE,
                (byte)FileInformationClasses.FileDispositionInformation,
                SET_INFO_Request_AdditionalInformation_Values.NONE,
                clientInfo.FileId,
                inputBuffer,
                out header,
                out responsePayload);
            clientInfo.Cleanup();
        }
        private void CreateFile(ModelDialectRevision dialect, string target, bool isDirectory)
        {
            LeasingClientInfo clientInfo = new LeasingClientInfo(testConfig.Timeout, testConfig);
            clientInfo.File = target;

            InitializeClient(clientInfo, dialect);

            Packet_Header header;
            CREATE_Response createResponse;
            Smb2CreateContextResponse[] serverCreateContexts;
            uint status = 0;

            status = clientInfo.Client.Create(1, 64, clientInfo.Flags, clientInfo.MessageId++, clientInfo.SessionId, clientInfo.TreeId, clientInfo.File,
                AccessMask.GENERIC_READ | AccessMask.GENERIC_WRITE | AccessMask.DELETE,
                ShareAccess_Values.FILE_SHARE_READ | ShareAccess_Values.FILE_SHARE_WRITE | ShareAccess_Values.FILE_SHARE_DELETE,
                isDirectory ? CreateOptions_Values.FILE_DIRECTORY_FILE : CreateOptions_Values.FILE_NON_DIRECTORY_FILE,
                CreateDisposition_Values.FILE_OPEN_IF,
                File_Attributes.NONE,
                ImpersonationLevel_Values.Impersonation,
                SecurityFlags_Values.NONE,
                RequestedOplockLevel_Values.OPLOCK_LEVEL_NONE,
                null,
                out clientInfo.FileId,
                out serverCreateContexts,
                out header,
                out createResponse);
            clientInfo.GrantedCredit = header.CreditRequestResponse;
            Site.Assert.AreEqual(Smb2Status.STATUS_SUCCESS, status, "Create a file {0} should succeed, actual status is {1}", clientInfo.File, Smb2Status.GetStatusCode(status));

            clientInfo.Cleanup();
        }