用LockFile函数锁定一个打开文件的某一个区域,可以防止其它进程访问该区域。 LockFile API函数在msdn中的声明如下:BOOL LockFile( HANDLE hFile, // handle of file to lock DWORD dwFileOffsetLow, // low-order word of lock region offset DWORD dwFileOffsetHigh, // high-order word of lock region offset DWORD nNumberOfBytesToLockLow, // low-order word of length to lock DWORD nNumberOfBytesToLockHigh // high-order word of length to lock ); [email protected] [email protected]
LockFile API函数在msdn中的声明如下:BOOL LockFile(
HANDLE hFile, // handle of file to lock
DWORD dwFileOffsetLow, // low-order word of lock region offset
DWORD dwFileOffsetHigh, // high-order word of lock region offset
DWORD nNumberOfBytesToLockLow,
// low-order word of length to lock
DWORD nNumberOfBytesToLockHigh
// high-order word of length to lock
);
[email protected]
[email protected]
LockFile还是只对Process有效啊.