Mike McCormack : kernel32: FindFirstChangeNotification needs a static
IO_STATUS_BLOCK.
Alexandre Julliard
julliard at wine.codeweavers.com
Thu Feb 2 07:09:16 CST 2006
Module: wine
Branch: refs/heads/master
Commit: d77baf358b2ba376d68ed9f590fe1d413e9f12c9
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=d77baf358b2ba376d68ed9f590fe1d413e9f12c9
Author: Mike McCormack <mike at codeweavers.com>
Date: Thu Feb 2 13:20:58 2006 +0100
kernel32: FindFirstChangeNotification needs a static IO_STATUS_BLOCK.
---
dlls/kernel/change.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/kernel/change.c b/dlls/kernel/change.c
index 573e94c..2323917 100644
--- a/dlls/kernel/change.c
+++ b/dlls/kernel/change.c
@@ -47,6 +47,13 @@ HANDLE WINAPI FindFirstChangeNotificatio
return FindFirstChangeNotificationW( pathW, bWatchSubtree, dwNotifyFilter );
}
+/*
+ * NtNotifyChangeDirectoryFile may write back to the IO_STATUS_BLOCK
+ * asynchronously. We don't care about the contents, but it can't
+ * be placed on the stack since it will go out of scope when we return.
+ */
+static IO_STATUS_BLOCK FindFirstChange_iosb;
+
/****************************************************************************
* FindFirstChangeNotificationW (KERNEL32.@)
*/
@@ -55,7 +62,6 @@ HANDLE WINAPI FindFirstChangeNotificatio
{
UNICODE_STRING nt_name;
OBJECT_ATTRIBUTES attr;
- IO_STATUS_BLOCK io;
NTSTATUS status;
HANDLE handle = INVALID_HANDLE_VALUE;
@@ -74,7 +80,8 @@ HANDLE WINAPI FindFirstChangeNotificatio
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- status = NtOpenFile( &handle, SYNCHRONIZE, &attr, &io,
+ status = NtOpenFile( &handle, FILE_LIST_DIRECTORY | SYNCHRONIZE,
+ &attr, &FindFirstChange_iosb,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
RtlFreeUnicodeString( &nt_name );
@@ -85,7 +92,8 @@ HANDLE WINAPI FindFirstChangeNotificatio
return INVALID_HANDLE_VALUE;
}
- status = NtNotifyChangeDirectoryFile( handle, NULL, NULL, NULL, &io,
+ status = NtNotifyChangeDirectoryFile( handle, NULL, NULL, NULL,
+ &FindFirstChange_iosb,
NULL, 0, dwNotifyFilter, bWatchSubtree );
if (status != STATUS_PENDING)
{
@@ -101,12 +109,12 @@ HANDLE WINAPI FindFirstChangeNotificatio
*/
BOOL WINAPI FindNextChangeNotification( HANDLE handle )
{
- IO_STATUS_BLOCK io;
NTSTATUS status;
TRACE("%p\n",handle);
- status = NtNotifyChangeDirectoryFile( handle, NULL, NULL, NULL, &io,
+ status = NtNotifyChangeDirectoryFile( handle, NULL, NULL, NULL,
+ &FindFirstChange_iosb,
NULL, 0, FILE_NOTIFY_CHANGE_SIZE, 0 );
if (status != STATUS_PENDING)
{
More information about the wine-cvs
mailing list