please dont rip this site Prev Next

LockFileEx info  Overview  Group

The LockFileEx function locks a byte range within an open file for shared or exclusive access.

BOOL LockFileEx(

    HANDLE hFile,

// handle of file to lock

    DWORD dwFlags,

// functional behavior modification flags

    DWORD dwReserved,

// reserved, must be set to zero

    DWORD nNumberOfBytesToLockLow,

// low-order 32 bits of length to lock

    DWORD nNumberOfBytesToLockHigh,

// high-order 32 bits of length to lock

    LPOVERLAPPED lpOverlapped 

// addr. of structure with lock region start offset

   );

Parameters

hFile
Identifies an open handle to a file that is to have a range of bytes locked for shared or exclusive access. The handle must have been created with either GENERIC_READ or GENERIC_WRITE access to the file.
dwFlags
Specifies flags that modify the behavior of this function. This parameter may be one or more of the following values:

Value

Meaning

LOCKFILE_FAIL_IMMEDIATELY

If this value is specified, the function returns immediately if it is unable to acquire the requested lock. Otherwise, it waits.

LOCKFILE_EXCLUSIVE_LOCK

If this value is specified, the function requests an exclusive lock. Otherwise, it requests a shared lock.

dwReserved
Reserved parameter; must be set to zero.
nNumberOfBytesToLockLow
Specifies the low-order 32 bits of the length of the byte range to lock.
nNumberOfBytesToLockHigh
Specifies the high-order 32 bits of the length of the byte range to lock.
lpOverlapped
Points to an OVERLAPPED structure that the function uses with the locking request. This structure, which is required, contains the file offset of the beginning of the lock range.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero or NULL. To get extended error information, call GetLastError.

Remarks

Locking a region of a file is used to acquire shared or exclusive access to the specified region of the file. File locks are not inherited by a new process during process creation.

Locking a portion of a file for exclusive access denies all other processes both read and write access to the specified region of the file. Locking a region that goes beyond the current end-of-file position is not an error.

Locking a portion of a file for shared access denies all processes write access to the specified region of the file, including the process that first locks the region. All processes can read the locked region.

If an exclusive lock is requested for a range of a file that already has a shared or exclusive lock, this call waits until the lock is granted, unless the LOCKFILE_FAIL_IMMEDIATELY flag is specified.

Locks may not overlap an existing locked region of the file.

See Also

CreateFile, LockFile, OVERLAPPED, UnlockFile, UnlockFileEx 


file: /Techref/os/win/api/win32/func/src/f54_16.htm, 5KB, , updated: 2000/4/7 11:19, local time: 2024/11/8 12:41,
TOP NEW HELP FIND: 
18.227.134.45:LOG IN
©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/os/win/api/win32/func/src/f54_16.htm"> LockFileEx</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 

Welcome to massmind.ecomorder.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .