kernel32: Add support for completion routine invocation in ReadDirectoryChangesW.
This commit is contained in:
parent
f5d96d1701
commit
45b65d0fb6
|
@ -134,6 +134,12 @@ BOOL WINAPI FindCloseChangeNotification( HANDLE handle )
|
||||||
return CloseHandle( handle );
|
return CloseHandle( handle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WINAPI invoke_completion(LPVOID ctx, IO_STATUS_BLOCK *ios, ULONG res)
|
||||||
|
{
|
||||||
|
LPOVERLAPPED_COMPLETION_ROUTINE completion = ctx;
|
||||||
|
completion(ios->u.Status, ios->Information, (LPOVERLAPPED)ios);
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* ReadDirectoryChangesW (KERNEL32.@)
|
* ReadDirectoryChangesW (KERNEL32.@)
|
||||||
*
|
*
|
||||||
|
@ -169,14 +175,16 @@ BOOL WINAPI ReadDirectoryChangesW( HANDLE handle, LPVOID buffer, DWORD len, BOOL
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pov = overlapped;
|
pov = overlapped;
|
||||||
if (!completion && ((ULONG_PTR)overlapped->hEvent & 1) == 0) cvalue = overlapped;
|
if(completion) cvalue = completion;
|
||||||
|
else if (((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, cvalue,
|
status = NtNotifyChangeDirectoryFile( handle, completion && overlapped ? NULL : pov->hEvent,
|
||||||
ios, buffer, len, filter, subtree );
|
completion && overlapped ? invoke_completion : NULL,
|
||||||
|
cvalue, ios, buffer, len, filter, subtree );
|
||||||
if (status == STATUS_PENDING)
|
if (status == STATUS_PENDING)
|
||||||
{
|
{
|
||||||
if (overlapped)
|
if (overlapped)
|
||||||
|
|
Loading…
Reference in New Issue