FileStream stream = new FileStream("myfile.txt", FileMode.CreateNew, FileAccess.Write);
stream.Lock(start_pos, lock_len)
API функция LockFile Kernel32.dll
Подскажите, как я могу использовать апи функцию упомянутую в заголовке темы. Какие туда аргументы, что выходит, где аргументы взять и т.п.
__in HANDLE hFile,
__in DWORD dwFileOffsetLow,
__in DWORD dwFileOffsetHigh,
__in DWORD nNumberOfBytesToLockLow,
__in DWORD nNumberOfBytesToLockHigh
);
Parameters
hFile
A handle to the file. The file handle must have been created with the GENERIC_READ or GENERIC_WRITE access right. For more information, see File Security and Access Rights.
dwFileOffsetLow
The low-order 32 bits of the starting byte offset in the file where the lock should begin.
dwFileOffsetHigh
The high-order 32 bits of the starting byte offset in the file where the lock should begin.
nNumberOfBytesToLockLow
The low-order 32 bits of the length of the byte range to be locked.
nNumberOfBytesToLockHigh
The high-order 32 bits of the length of the byte range to be locked.
З.Ы. Для тех кому МСДН слом почитать
Цитата: tva94
Подскажите, как я могу использовать апи функцию упомянутую в заголовке темы. Какие туда аргументы, что выходит, где аргументы взять и т.п.
Код:
start_pos - начальная позиция секции, которую блокируем,
lock_len - длина секции блокирования
Обратная операция - Unlock.