Author: pschweitzer
Date: Tue Feb 22 18:56:46 2011
New Revision: 50868

URL: http://svn.reactos.org/svn/reactos?rev=50868&view=rev
Log:
[KERNEL32]
Don't make FindFirstChangeNotificationA() rely on Wine's strings conversions 
functions

Modified:
    trunk/reactos/dll/win32/kernel32/file/cnotify.c

Modified: trunk/reactos/dll/win32/kernel32/file/cnotify.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/file/cnotify.c?rev=50868&r1=50867&r2=50868&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/file/cnotify.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/file/cnotify.c [iso-8859-1] Tue Feb 22 
18:56:46 2011
@@ -9,10 +9,14 @@
  *                  Created 01/11/98
  */
 
+/* INCLUDES *****************************************************************/
+
 #include <k32.h>
 #define NDEBUG
 #include <debug.h>
 
+/* FUNCTIONS ****************************************************************/
+
 /*
  * @implemented
  */
@@ -35,20 +39,30 @@
  */
 HANDLE
 WINAPI
-FindFirstChangeNotificationA (
-       LPCSTR  lpPathName,
-       BOOL    bWatchSubtree,
-       DWORD   dwNotifyFilter
-       )
-{
-       PWCHAR PathNameW;
-
-   if (!(PathNameW = FilenameA2W(lpPathName, FALSE)))
-      return INVALID_HANDLE_VALUE;
-
-   return FindFirstChangeNotificationW (PathNameW ,
-                                               bWatchSubtree,
-                                               dwNotifyFilter);
+FindFirstChangeNotificationA(IN LPCSTR lpPathName,
+                             IN BOOL bWatchSubtree,
+                             IN DWORD dwNotifyFilter)
+{
+    NTSTATUS Status;
+    ANSI_STRING PathNameString;
+
+    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(NtCurrentTeb()->StaticUnicodeString.Buffer,
+                                        bWatchSubtree, dwNotifyFilter);
 }
 
 


Reply via email to