ProjectArcade

Форк
0
/
IDokanOperationsUnsafe.cs 
48 строк · 3.1 Кб
1
using System;
2

3
namespace DokanNet
4
{
5
    /// <summary>
6
    /// This is a sub-interface of <see cref="IDokanOperations"/> that can optionally be implemented
7
    /// to get access to the raw, unmanaged buffers for ReadFile() and WriteFile() for performance optimization.
8
    /// Marshalling the unmanaged buffers to and from byte[] arrays for every call of these APIs incurs an extra copy
9
    /// that can be avoided by reading from or writing directly to the unmanaged buffers.
10
    /// 
11
    /// Implementation of this interface is optional. If it is implemented, the overloads of
12
    /// Read/WriteFile(IntPtr, length) will be called instead of Read/WriteFile(byte[]). The caller can fill or read
13
    /// from the unmanaged API with Marshal.Copy, Buffer.MemoryCopy or similar.
14
    /// </summary>
15
    public interface IDokanOperationsUnsafe : IDokanOperations
16
    {
17
        /// <summary>
18
        /// ReadFile callback on the file previously opened in <see cref="CreateFile"/>.
19
        /// It can be called by different thread at the same time,
20
        /// therefore the read has to be thread safe.
21
        /// </summary>
22
        /// <param name="fileName">File path requested by the Kernel on the FileSystem.</param>
23
        /// <param name="buffer">Read buffer that has to be fill with the read result.</param>
24
        /// <param name="bufferLength">The size of 'buffer' in bytes.
25
        /// The buffer size depends of the read size requested by the kernel.</param>
26
        /// <param name="bytesRead">Total number of bytes that has been read.</param>
27
        /// <param name="offset">Offset from where the read has to be proceed.</param>
28
        /// <param name="info">An <see cref="IDokanFileInfo"/> with information about the file or directory.</param>
29
        /// <returns><see cref="NtStatus"/> or <see cref="DokanResult"/> appropriate to the request result.</returns>
30
        /// <seealso cref="WriteFile"/>
31
        NtStatus ReadFile(string fileName, IntPtr buffer, uint bufferLength, out int bytesRead, long offset, IDokanFileInfo info);
32

33
        /// <summary>
34
        /// WriteFile callback on the file previously opened in <see cref="CreateFile"/>
35
        /// It can be called by different thread at the same time,
36
        /// therefore the write/context has to be thread safe.
37
        /// </summary>
38
        /// <param name="fileName">File path requested by the Kernel on the FileSystem.</param>
39
        /// <param name="buffer">Data that has to be written.</param>
40
        /// <param name="bufferLength">The size of 'buffer' in bytes.</param>
41
        /// <param name="bytesWritten">Total number of bytes that has been write.</param>
42
        /// <param name="offset">Offset from where the write has to be proceed.</param>
43
        /// <param name="info">An <see cref="IDokanFileInfo"/> with information about the file or directory.</param>
44
        /// <returns><see cref="NtStatus"/> or <see cref="DokanResult"/> appropriate to the request result.</returns>
45
        /// <seealso cref="ReadFile"/>
46
        NtStatus WriteFile(string fileName, IntPtr buffer, uint bufferLength, out int bytesWritten, long offset, IDokanFileInfo info);
47
    }
48
}
49

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.