mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
LockFileEx: forward overlapped->hEvent to NtLockFile
LockFile: zero overlapped->hEvent svn path=/trunk/; revision=13900
This commit is contained in:
parent
8f22c7534c
commit
67bd235566
1 changed files with 10 additions and 14 deletions
|
@ -39,6 +39,7 @@ LockFile(
|
||||||
|
|
||||||
Overlapped.Offset = dwFileOffsetLow;
|
Overlapped.Offset = dwFileOffsetLow;
|
||||||
Overlapped.OffsetHigh = dwFileOffsetHigh;
|
Overlapped.OffsetHigh = dwFileOffsetHigh;
|
||||||
|
Overlapped.hEvent = NULL;
|
||||||
dwReserved = 0;
|
dwReserved = 0;
|
||||||
|
|
||||||
return LockFileEx(hFile, LOCKFILE_FAIL_IMMEDIATELY|LOCKFILE_EXCLUSIVE_LOCK,dwReserved,nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &Overlapped ) ;
|
return LockFileEx(hFile, LOCKFILE_FAIL_IMMEDIATELY|LOCKFILE_EXCLUSIVE_LOCK,dwReserved,nNumberOfBytesToLockLow, nNumberOfBytesToLockHigh, &Overlapped ) ;
|
||||||
|
@ -57,7 +58,7 @@ LockFileEx(
|
||||||
DWORD dwReserved,
|
DWORD dwReserved,
|
||||||
DWORD nNumberOfBytesToLockLow,
|
DWORD nNumberOfBytesToLockLow,
|
||||||
DWORD nNumberOfBytesToLockHigh,
|
DWORD nNumberOfBytesToLockHigh,
|
||||||
LPOVERLAPPED lpOverlapped
|
LPOVERLAPPED lpOverlapped /* required! */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER BytesToLock;
|
LARGE_INTEGER BytesToLock;
|
||||||
|
@ -66,7 +67,7 @@ LockFileEx(
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
LARGE_INTEGER Offset;
|
LARGE_INTEGER Offset;
|
||||||
|
|
||||||
if(dwReserved != 0)
|
if(dwReserved != 0 || lpOverlapped==NULL)
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -91,7 +92,7 @@ LockFileEx(
|
||||||
BytesToLock.u.HighPart = nNumberOfBytesToLockHigh;
|
BytesToLock.u.HighPart = nNumberOfBytesToLockHigh;
|
||||||
|
|
||||||
errCode = NtLockFile(hFile,
|
errCode = NtLockFile(hFile,
|
||||||
NULL,
|
lpOverlapped->hEvent,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
(PIO_STATUS_BLOCK)lpOverlapped,
|
(PIO_STATUS_BLOCK)lpOverlapped,
|
||||||
|
@ -124,13 +125,13 @@ UnlockFile(
|
||||||
DWORD nNumberOfBytesToUnlockHigh
|
DWORD nNumberOfBytesToUnlockHigh
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
DWORD dwReserved;
|
|
||||||
OVERLAPPED Overlapped;
|
OVERLAPPED Overlapped;
|
||||||
|
DWORD dwReserved;
|
||||||
Overlapped.Offset = dwFileOffsetLow;
|
Overlapped.Offset = dwFileOffsetLow;
|
||||||
Overlapped.OffsetHigh = dwFileOffsetHigh;
|
Overlapped.OffsetHigh = dwFileOffsetHigh;
|
||||||
dwReserved = 0;
|
dwReserved = 0;
|
||||||
return UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, &Overlapped);
|
|
||||||
|
|
||||||
|
return UnlockFileEx(hFile, dwReserved, nNumberOfBytesToUnlockLow, nNumberOfBytesToUnlockHigh, &Overlapped);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,19 +145,14 @@ UnlockFileEx(
|
||||||
DWORD dwReserved,
|
DWORD dwReserved,
|
||||||
DWORD nNumberOfBytesToUnLockLow,
|
DWORD nNumberOfBytesToUnLockLow,
|
||||||
DWORD nNumberOfBytesToUnLockHigh,
|
DWORD nNumberOfBytesToUnLockHigh,
|
||||||
LPOVERLAPPED lpOverlapped
|
LPOVERLAPPED lpOverlapped /* required! */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
LARGE_INTEGER BytesToUnLock;
|
LARGE_INTEGER BytesToUnLock;
|
||||||
LARGE_INTEGER StartAddress;
|
LARGE_INTEGER StartAddress;
|
||||||
NTSTATUS errCode;
|
NTSTATUS errCode;
|
||||||
|
|
||||||
if(dwReserved != 0)
|
if(dwReserved != 0 || lpOverlapped == NULL)
|
||||||
{
|
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if ( lpOverlapped == NULL )
|
|
||||||
{
|
{
|
||||||
SetLastError(ERROR_INVALID_PARAMETER);
|
SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue