3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: lib/kernel32/file/find.c
6 * PURPOSE: Find functions
7 * PROGRAMMER: Ariadne ( ariadne@xs4all.nl)
15 #include <kernel32/kernel32.h>
21 FindCloseChangeNotification (HANDLE hChangeHandle)
23 NtClose(hChangeHandle);
33 FindFirstChangeNotificationA (
35 WINBOOL bWatchSubtree,
39 UNICODE_STRING PathNameU;
43 RtlInitAnsiString (&PathName,
46 /* convert ansi (or oem) string to unicode */
49 RtlAnsiStringToUnicodeString (&PathNameU,
55 RtlOemStringToUnicodeString (&PathNameU,
60 hNotify = FindFirstChangeNotificationW (PathNameU.Buffer,
64 RtlFreeUnicodeString(&PathNameU);
75 FindFirstChangeNotificationW (
77 WINBOOL bWatchSubtree,
82 UNICODE_STRING NtPathU;
83 IO_STATUS_BLOCK IoStatus;
84 OBJECT_ATTRIBUTES ObjectAttributes;
88 RtlDosPathNameToNtPathName takes a fully qualified file name "C:\Projects\LoadLibrary\Debug\TestDll.dll"
89 and returns something like "\??\C:\Projects\LoadLibrary\Debug\TestDll.dll."
90 If the file name cannot be interpreted, then the routine returns STATUS_OBJECT_PATH_SYNTAX_BAD and
94 if (!RtlDosPathNameToNtPathName_U ((LPWSTR)lpPathName,
99 SetLastErrorByStatus(STATUS_OBJECT_PATH_SYNTAX_BAD);
100 return INVALID_HANDLE_VALUE;
103 InitializeObjectAttributes (&ObjectAttributes,
109 Status = NtOpenFile (&hDir,
110 SYNCHRONIZE|FILE_LIST_DIRECTORY,
113 FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
114 FILE_DIRECTORY_FILE);
116 if (!NT_SUCCESS(Status))
118 SetLastErrorByStatus(Status);
119 return INVALID_HANDLE_VALUE;
122 Status = NtNotifyChangeDirectoryFile(hDir,
131 if (!NT_SUCCESS(Status))
133 SetLastErrorByStatus(Status);
134 return INVALID_HANDLE_VALUE;
146 FindNextChangeNotification (
150 IO_STATUS_BLOCK IoStatus;
153 Status = NtNotifyChangeDirectoryFile(hChangeHandle,
160 FILE_NOTIFY_CHANGE_SECURITY,//meaningless for subsequent calls, but must contain a valid flag(s)
161 0//meaningless for subsequent calls
163 if (!NT_SUCCESS(Status))
165 SetLastErrorByStatus(Status);