Esempio n. 1
0
        public void TestCancel()
        {
            object     handle;
            FileStatus fileStatus;

            m_fileStore.CreateFile(out handle, out fileStatus, TestDirName, AccessMask.GENERIC_ALL, FileAttributes.Directory, ShareAccess.Read, CreateDisposition.FILE_OPEN, CreateOptions.FILE_DIRECTORY_FILE, null);

            object   ioRequest = null;
            NTStatus status    = m_fileStore.NotifyChange(out ioRequest, handle, NotifyChangeFilter.FileName | NotifyChangeFilter.LastWrite | NotifyChangeFilter.DirName, false, 8192, OnNotifyChangeCompleted, null);

            Assert.IsTrue(status == NTStatus.STATUS_PENDING);

            m_fileStore.Cancel(ioRequest);
            m_fileStore.CloseFile(handle);
            while (m_notifyChangeStatus == null)
            {
                Thread.Sleep(1);
            }
            Assert.IsTrue(m_notifyChangeStatus.Value == NTStatus.STATUS_CANCELLED);
        }