kernel32: Pass completion value to ntdll layer.
This commit is contained in:
parent
d1a8155882
commit
308f73c06d
|
@ -155,6 +155,7 @@ BOOL WINAPI ReadDirectoryChangesW( HANDLE handle, LPVOID buffer, DWORD len, BOOL
|
||||||
IO_STATUS_BLOCK *ios;
|
IO_STATUS_BLOCK *ios;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
|
LPVOID cvalue = NULL;
|
||||||
|
|
||||||
TRACE("%p %p %08x %d %08x %p %p %p\n", handle, buffer, len, subtree, filter,
|
TRACE("%p %p %08x %d %08x %p %p %p\n", handle, buffer, len, subtree, filter,
|
||||||
returned, overlapped, completion );
|
returned, overlapped, completion );
|
||||||
|
@ -166,12 +167,15 @@ BOOL WINAPI ReadDirectoryChangesW( HANDLE handle, LPVOID buffer, DWORD len, BOOL
|
||||||
pov = &ov;
|
pov = &ov;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pov = overlapped;
|
pov = overlapped;
|
||||||
|
if (!completion && ((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
|
||||||
|
}
|
||||||
|
|
||||||
ios = (PIO_STATUS_BLOCK) pov;
|
ios = (PIO_STATUS_BLOCK) pov;
|
||||||
ios->u.Status = STATUS_PENDING;
|
ios->u.Status = STATUS_PENDING;
|
||||||
|
|
||||||
status = NtNotifyChangeDirectoryFile( handle, pov->hEvent, NULL, NULL,
|
status = NtNotifyChangeDirectoryFile( handle, pov->hEvent, NULL, cvalue,
|
||||||
ios, buffer, len, filter, subtree );
|
ios, buffer, len, filter, subtree );
|
||||||
if (status == STATUS_PENDING)
|
if (status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
|
|
|
@ -402,6 +402,7 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
|
||||||
PIO_STATUS_BLOCK io_status = &iosb;
|
PIO_STATUS_BLOCK io_status = &iosb;
|
||||||
HANDLE hEvent = 0;
|
HANDLE hEvent = 0;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
|
LPVOID cvalue = NULL;
|
||||||
|
|
||||||
TRACE("%p %p %d %p %p\n", hFile, buffer, bytesToRead,
|
TRACE("%p %p %d %p %p\n", hFile, buffer, bytesToRead,
|
||||||
bytesRead, overlapped );
|
bytesRead, overlapped );
|
||||||
|
@ -419,11 +420,12 @@ BOOL WINAPI ReadFile( HANDLE hFile, LPVOID buffer, DWORD bytesToRead,
|
||||||
poffset = &offset;
|
poffset = &offset;
|
||||||
hEvent = overlapped->hEvent;
|
hEvent = overlapped->hEvent;
|
||||||
io_status = (PIO_STATUS_BLOCK)overlapped;
|
io_status = (PIO_STATUS_BLOCK)overlapped;
|
||||||
|
if (((ULONG_PTR)hEvent & 1) == 0) cvalue = overlapped;
|
||||||
}
|
}
|
||||||
io_status->u.Status = STATUS_PENDING;
|
io_status->u.Status = STATUS_PENDING;
|
||||||
io_status->Information = 0;
|
io_status->Information = 0;
|
||||||
|
|
||||||
status = NtReadFile(hFile, hEvent, NULL, NULL, io_status, buffer, bytesToRead, poffset, NULL);
|
status = NtReadFile(hFile, hEvent, NULL, cvalue, io_status, buffer, bytesToRead, poffset, NULL);
|
||||||
|
|
||||||
if (status == STATUS_PENDING && !overlapped)
|
if (status == STATUS_PENDING && !overlapped)
|
||||||
{
|
{
|
||||||
|
@ -488,6 +490,7 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
IO_STATUS_BLOCK iosb;
|
IO_STATUS_BLOCK iosb;
|
||||||
PIO_STATUS_BLOCK piosb = &iosb;
|
PIO_STATUS_BLOCK piosb = &iosb;
|
||||||
|
LPVOID cvalue = NULL;
|
||||||
|
|
||||||
TRACE("%p %p %d %p %p\n", hFile, buffer, bytesToWrite, bytesWritten, overlapped );
|
TRACE("%p %p %d %p %p\n", hFile, buffer, bytesToWrite, bytesWritten, overlapped );
|
||||||
|
|
||||||
|
@ -501,17 +504,18 @@ BOOL WINAPI WriteFile( HANDLE hFile, LPCVOID buffer, DWORD bytesToWrite,
|
||||||
poffset = &offset;
|
poffset = &offset;
|
||||||
hEvent = overlapped->hEvent;
|
hEvent = overlapped->hEvent;
|
||||||
piosb = (PIO_STATUS_BLOCK)overlapped;
|
piosb = (PIO_STATUS_BLOCK)overlapped;
|
||||||
|
if (((ULONG_PTR)hEvent & 1) == 0) cvalue = overlapped;
|
||||||
}
|
}
|
||||||
piosb->u.Status = STATUS_PENDING;
|
piosb->u.Status = STATUS_PENDING;
|
||||||
piosb->Information = 0;
|
piosb->Information = 0;
|
||||||
|
|
||||||
status = NtWriteFile(hFile, hEvent, NULL, NULL, piosb,
|
status = NtWriteFile(hFile, hEvent, NULL, cvalue, piosb,
|
||||||
buffer, bytesToWrite, poffset, NULL);
|
buffer, bytesToWrite, poffset, NULL);
|
||||||
|
|
||||||
/* FIXME: NtWriteFile does not always cause page faults, generate them now */
|
/* FIXME: NtWriteFile does not always cause page faults, generate them now */
|
||||||
if (status == STATUS_INVALID_USER_BUFFER && !IsBadReadPtr( buffer, bytesToWrite ))
|
if (status == STATUS_INVALID_USER_BUFFER && !IsBadReadPtr( buffer, bytesToWrite ))
|
||||||
{
|
{
|
||||||
status = NtWriteFile(hFile, hEvent, NULL, NULL, piosb,
|
status = NtWriteFile(hFile, hEvent, NULL, cvalue, piosb,
|
||||||
buffer, bytesToWrite, poffset, NULL);
|
buffer, bytesToWrite, poffset, NULL);
|
||||||
if (status != STATUS_INVALID_USER_BUFFER)
|
if (status != STATUS_INVALID_USER_BUFFER)
|
||||||
FIXME("Could not access memory (%p,%d) at first, now OK. Protected by DIBSection code?\n",
|
FIXME("Could not access memory (%p,%d) at first, now OK. Protected by DIBSection code?\n",
|
||||||
|
@ -1052,9 +1056,9 @@ BOOL WINAPI LockFile( HANDLE hFile, DWORD offset_low, DWORD offset_high,
|
||||||
offset.u.LowPart = offset_low;
|
offset.u.LowPart = offset_low;
|
||||||
offset.u.HighPart = offset_high;
|
offset.u.HighPart = offset_high;
|
||||||
|
|
||||||
status = NtLockFile( hFile, 0, NULL, NULL,
|
status = NtLockFile( hFile, 0, NULL, NULL,
|
||||||
NULL, &offset, &count, NULL, TRUE, TRUE );
|
NULL, &offset, &count, NULL, TRUE, TRUE );
|
||||||
|
|
||||||
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
|
if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
return !status;
|
return !status;
|
||||||
}
|
}
|
||||||
|
@ -1077,6 +1081,7 @@ BOOL WINAPI LockFileEx( HANDLE hFile, DWORD flags, DWORD reserved,
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
LARGE_INTEGER count, offset;
|
LARGE_INTEGER count, offset;
|
||||||
|
LPVOID cvalue = NULL;
|
||||||
|
|
||||||
if (reserved)
|
if (reserved)
|
||||||
{
|
{
|
||||||
|
@ -1093,11 +1098,13 @@ BOOL WINAPI LockFileEx( HANDLE hFile, DWORD flags, DWORD reserved,
|
||||||
offset.u.LowPart = overlapped->u.s.Offset;
|
offset.u.LowPart = overlapped->u.s.Offset;
|
||||||
offset.u.HighPart = overlapped->u.s.OffsetHigh;
|
offset.u.HighPart = overlapped->u.s.OffsetHigh;
|
||||||
|
|
||||||
status = NtLockFile( hFile, overlapped->hEvent, NULL, NULL,
|
if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
|
||||||
NULL, &offset, &count, NULL,
|
|
||||||
|
status = NtLockFile( hFile, overlapped->hEvent, NULL, cvalue,
|
||||||
|
NULL, &offset, &count, NULL,
|
||||||
flags & LOCKFILE_FAIL_IMMEDIATELY,
|
flags & LOCKFILE_FAIL_IMMEDIATELY,
|
||||||
flags & LOCKFILE_EXCLUSIVE_LOCK );
|
flags & LOCKFILE_EXCLUSIVE_LOCK );
|
||||||
|
|
||||||
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
if (status) SetLastError( RtlNtStatusToDosError(status) );
|
||||||
return !status;
|
return !status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1328,6 +1328,7 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
IO_STATUS_BLOCK status_block;
|
IO_STATUS_BLOCK status_block;
|
||||||
|
LPVOID cvalue = NULL;
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", hPipe, overlapped);
|
TRACE("(%p,%p)\n", hPipe, overlapped);
|
||||||
|
|
||||||
|
@ -1335,9 +1336,10 @@ BOOL WINAPI ConnectNamedPipe(HANDLE hPipe, LPOVERLAPPED overlapped)
|
||||||
{
|
{
|
||||||
overlapped->Internal = STATUS_PENDING;
|
overlapped->Internal = STATUS_PENDING;
|
||||||
overlapped->InternalHigh = 0;
|
overlapped->InternalHigh = 0;
|
||||||
|
if (((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = NtFsControlFile(hPipe, overlapped ? overlapped->hEvent : NULL, NULL, NULL,
|
status = NtFsControlFile(hPipe, overlapped ? overlapped->hEvent : NULL, NULL, cvalue,
|
||||||
overlapped ? (IO_STATUS_BLOCK *)overlapped : &status_block,
|
overlapped ? (IO_STATUS_BLOCK *)overlapped : &status_block,
|
||||||
FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0);
|
FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0);
|
||||||
|
|
||||||
|
|
|
@ -351,16 +351,17 @@ BOOL WINAPI DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode,
|
||||||
|
|
||||||
if (lpOverlapped)
|
if (lpOverlapped)
|
||||||
{
|
{
|
||||||
|
LPVOID cvalue = ((ULONG_PTR)lpOverlapped->hEvent & 1) ? NULL : lpOverlapped;
|
||||||
lpOverlapped->Internal = STATUS_PENDING;
|
lpOverlapped->Internal = STATUS_PENDING;
|
||||||
lpOverlapped->InternalHigh = 0;
|
lpOverlapped->InternalHigh = 0;
|
||||||
if (HIWORD(dwIoControlCode) == FILE_DEVICE_FILE_SYSTEM)
|
if (HIWORD(dwIoControlCode) == FILE_DEVICE_FILE_SYSTEM)
|
||||||
status = NtFsControlFile(hDevice, lpOverlapped->hEvent,
|
status = NtFsControlFile(hDevice, lpOverlapped->hEvent,
|
||||||
NULL, NULL, (PIO_STATUS_BLOCK)lpOverlapped,
|
NULL, cvalue, (PIO_STATUS_BLOCK)lpOverlapped,
|
||||||
dwIoControlCode, lpvInBuffer, cbInBuffer,
|
dwIoControlCode, lpvInBuffer, cbInBuffer,
|
||||||
lpvOutBuffer, cbOutBuffer);
|
lpvOutBuffer, cbOutBuffer);
|
||||||
else
|
else
|
||||||
status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent,
|
status = NtDeviceIoControlFile(hDevice, lpOverlapped->hEvent,
|
||||||
NULL, NULL, (PIO_STATUS_BLOCK)lpOverlapped,
|
NULL, cvalue, (PIO_STATUS_BLOCK)lpOverlapped,
|
||||||
dwIoControlCode, lpvInBuffer, cbInBuffer,
|
dwIoControlCode, lpvInBuffer, cbInBuffer,
|
||||||
lpvOutBuffer, cbOutBuffer);
|
lpvOutBuffer, cbOutBuffer);
|
||||||
if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh;
|
if (lpcbBytesReturned) *lpcbBytesReturned = lpOverlapped->InternalHigh;
|
||||||
|
|
Loading…
Reference in New Issue