Commit 45b65d0f authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

kernel32: Add support for completion routine invocation in ReadDirectoryChangesW.

parent f5d96d17
......@@ -134,6 +134,12 @@ BOOL WINAPI FindCloseChangeNotification( HANDLE 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.@)
*
......@@ -169,14 +175,16 @@ BOOL WINAPI ReadDirectoryChangesW( HANDLE handle, LPVOID buffer, DWORD len, BOOL
else
{
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->u.Status = STATUS_PENDING;
status = NtNotifyChangeDirectoryFile( handle, pov->hEvent, NULL, cvalue,
ios, buffer, len, filter, subtree );
status = NtNotifyChangeDirectoryFile( handle, completion && overlapped ? NULL : pov->hEvent,
completion && overlapped ? invoke_completion : NULL,
cvalue, ios, buffer, len, filter, subtree );
if (status == STATUS_PENDING)
{
if (overlapped)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment