2 * Win32 file change notification functions
4 * Copyright 1998 Ulrich Weigand
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include "wine/windef16.h"
32 #include "wine/server.h"
33 #include "wine/debug.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(file);
37 /****************************************************************************
38 * FindFirstChangeNotificationA (KERNEL32.@)
40 HANDLE WINAPI FindFirstChangeNotificationA( LPCSTR lpPathName, BOOL bWatchSubtree,
41 DWORD dwNotifyFilter )
44 HANDLE ret = INVALID_HANDLE_VALUE;
46 if (RtlCreateUnicodeStringFromAsciiz( &pathW, lpPathName ))
48 ret = FindFirstChangeNotificationW( pathW.Buffer, bWatchSubtree, dwNotifyFilter );
49 RtlFreeUnicodeString( &pathW );
51 else SetLastError( ERROR_NOT_ENOUGH_MEMORY );
55 /****************************************************************************
56 * FindFirstChangeNotificationW (KERNEL32.@)
58 HANDLE WINAPI FindFirstChangeNotificationW( LPCWSTR lpPathName, BOOL bWatchSubtree,
61 UNICODE_STRING nt_name;
62 OBJECT_ATTRIBUTES attr;
65 HANDLE file, ret = INVALID_HANDLE_VALUE;
67 TRACE( "%s %d %lx\n", debugstr_w(lpPathName), bWatchSubtree, dwNotifyFilter );
69 if (!RtlDosPathNameToNtPathName_U( lpPathName, &nt_name, NULL, NULL ))
71 SetLastError( ERROR_PATH_NOT_FOUND );
72 return INVALID_HANDLE_VALUE;
75 attr.Length = sizeof(attr);
76 attr.RootDirectory = 0;
77 attr.Attributes = OBJ_CASE_INSENSITIVE;
78 attr.ObjectName = &nt_name;
79 attr.SecurityDescriptor = NULL;
80 attr.SecurityQualityOfService = NULL;
82 status = NtOpenFile( &file, 0, &attr, &io, 0,
83 FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT );
84 RtlFreeUnicodeString( &nt_name );
86 if (status != STATUS_SUCCESS)
88 SetLastError( RtlNtStatusToDosError(status) );
89 return INVALID_HANDLE_VALUE;
92 SERVER_START_REQ( create_change_notification )
95 req->subtree = bWatchSubtree;
96 req->filter = dwNotifyFilter;
97 if (!wine_server_call_err( req )) ret = reply->handle;
104 /****************************************************************************
105 * FindNextChangeNotification (KERNEL32.@)
107 BOOL WINAPI FindNextChangeNotification( HANDLE handle )
111 TRACE("%p\n",handle);
113 SERVER_START_REQ( next_change_notification )
115 req->handle = handle;
116 ret = !wine_server_call_err( req );
122 /****************************************************************************
123 * FindCloseChangeNotification (KERNEL32.@)
125 BOOL WINAPI FindCloseChangeNotification( HANDLE handle )
127 return CloseHandle( handle );
130 /***********************************************************************
131 * FileCDR (KERNEL.130)
133 FARPROC16 WINAPI FileCDR16(FARPROC16 x)
135 FIXME("(0x%8x): stub\n", (int) x);
136 return (FARPROC16)TRUE;