Confusion about file offset in Win32 LockFileEx API

-1

According to the LockFileEx() documentation, a file offset is specified in lpOverlapped->Offset/OffsetHigh. But when debugging winword.exe to analyze its file system behaviors, I see it calls LockFileEx() on a 122-byte file with Offset=0xfffffffb and OffsetHigh=0xffffffff, and the call completes successfully. Apparently this is not a valid offset, what does this mean?

winapi
ntfs
asked on Stack Overflow Oct 6, 2020 by herb • edited Oct 6, 2020 by Remy Lebeau

1 Answer

0

From MSDN:

Locking a region that goes beyond the current end-of-file position is not an error.

They could be using the lock as some kind of flag or for synchronization.

answered on Stack Overflow Oct 7, 2020 by Anders

User contributions licensed under CC BY-SA 3.0