Author: pschweitzer
Date: Sun Feb 26 14:06:50 2017
New Revision: 73925

URL: http://svn.reactos.org/svn/reactos?rev=73925&view=rev
Log:
[KERNEL32]
Fix handling of trailing backslash.
Patch by Thomas Faber.

ROSTESTS-135

Modified:
    trunk/reactos/dll/win32/kernel32/client/file/create.c

Modified: trunk/reactos/dll/win32/kernel32/client/file/create.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/file/create.c?rev=73925&r1=73924&r2=73925&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/file/create.c       [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/kernel32/client/file/create.c       [iso-8859-1] 
Sun Feb 26 14:06:50 2017
@@ -104,6 +104,7 @@
    ULONG FileAttributes, Flags = 0;
    PVOID EaBuffer = NULL;
    ULONG EaLength = 0;
+   BOOLEAN TrailingBackslash;
 
    if (!lpFileName || !lpFileName[0])
    {
@@ -220,6 +221,13 @@
    }
 
    TRACE("NtPathU \'%wZ\'\n", &NtPathU);
+   
+   TrailingBackslash = FALSE;
+   if (NtPathU.Length >= sizeof(WCHAR) &&
+       NtPathU.Buffer[NtPathU.Length / sizeof(WCHAR) - 1])
+   {
+      TrailingBackslash = TRUE;
+   }
 
    if (hTemplateFile != NULL)
    {
@@ -350,6 +358,11 @@
       {
          SetLastError( ERROR_FILE_EXISTS );
       }
+      else if (Status == STATUS_FILE_IS_A_DIRECTORY &&
+               TrailingBackslash)
+      {
+         SetLastError(ERROR_PATH_NOT_FOUND);
+      }
       else
       {
          BaseSetLastNTError (Status);


Reply via email to