From 8dc411563ba5e15e895d7172d38c8c2eca137950 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Tue, 22 Feb 2011 18:56:46 +0000 Subject: [PATCH] [KERNEL32] Don't make FindFirstChangeNotificationA() rely on Wine's strings conversions functions svn path=/trunk/; revision=50868 --- reactos/dll/win32/kernel32/file/cnotify.c | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/reactos/dll/win32/kernel32/file/cnotify.c b/reactos/dll/win32/kernel32/file/cnotify.c index 3f6420bf7ec..37814a13384 100644 --- a/reactos/dll/win32/kernel32/file/cnotify.c +++ b/reactos/dll/win32/kernel32/file/cnotify.c @@ -9,10 +9,14 @@ * Created 01/11/98 */ +/* INCLUDES *****************************************************************/ + #include #define NDEBUG #include +/* FUNCTIONS ****************************************************************/ + /* * @implemented */ @@ -35,20 +39,30 @@ FindCloseChangeNotification (HANDLE hChangeHandle) */ HANDLE WINAPI -FindFirstChangeNotificationA ( - LPCSTR lpPathName, - BOOL bWatchSubtree, - DWORD dwNotifyFilter - ) +FindFirstChangeNotificationA(IN LPCSTR lpPathName, + IN BOOL bWatchSubtree, + IN DWORD dwNotifyFilter) { - PWCHAR PathNameW; + NTSTATUS Status; + ANSI_STRING PathNameString; - if (!(PathNameW = FilenameA2W(lpPathName, FALSE))) - return INVALID_HANDLE_VALUE; + RtlInitAnsiString(&PathNameString, lpPathName); + Status = RtlAnsiStringToUnicodeString(&(NtCurrentTeb()->StaticUnicodeString), &PathNameString, FALSE); + if (!NT_SUCCESS(Status)) + { + if (Status != STATUS_BUFFER_OVERFLOW) + { + SetLastError(ERROR_FILENAME_EXCED_RANGE); + } + else + { + BaseSetLastNTError(Status); + } + return INVALID_HANDLE_VALUE; + } - return FindFirstChangeNotificationW (PathNameW , - bWatchSubtree, - dwNotifyFilter); + return FindFirstChangeNotificationW(NtCurrentTeb()->StaticUnicodeString.Buffer, + bWatchSubtree, dwNotifyFilter); }