Author: ion
Date: Sun Nov  6 19:42:59 2011
New Revision: 54320

URL: http://svn.reactos.org/svn/reactos?rev=54320&view=rev
Log:
[KERNEL32]: Fix some bugs in previous two commits (thanks Thomas).

Modified:
    trunk/reactos/dll/win32/kernel32/client/path.c

Modified: trunk/reactos/dll/win32/kernel32/client/path.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/path.c?rev=54320&r1=54319&r2=54320&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/kernel32/client/path.c [iso-8859-1] Sun Nov  6 
19:42:59 2011
@@ -57,7 +57,7 @@
     /* Sure, any emtpy name is a short name */
     if (!Length) return TRUE;
 
-    /* This could be . or .. or somethign else */
+    /* This could be . or .. or something else */
     if (*Name == L'.')
     {
         /* Which one is it */
@@ -101,7 +101,7 @@
         }
 
         /* Check for illegal characters */
-        if ((c > 0x7F) || (IllegalMask[c / 32] && (1 << (c % 32))))
+        if ((c > 0x7F) || (IllegalMask[c / 32] & (1 << (c % 32))))
         {
             return FALSE;
         }
@@ -171,14 +171,14 @@
     while (TRUE)
     {
         /* Loop within the path skipping slashes */
-        while ((*Path) && ((*Path == L'\\') || (*Path == L'/'))) Path++;
+        while ((*Path == L'\\') || (*Path == L'/')) Path++;
 
         /* Make sure there's something after the slashes too! */
         if (*Path == UNICODE_NULL) break;
 
-        /* Now do the same thing with the last marker */
+        /* Now skip past the file name until we get to the first slash */
         p = Path + 1;
-        while ((*p) && ((*p == L'\\') || (*p == L'/'))) p++;
+        while ((*p) && ((*p != L'\\') && (*p != L'/'))) p++;
 
         /* Whatever is in between those two is now the file name length */
         Length = p - Path;
@@ -804,7 +804,7 @@
     ErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
 
     /* Do a simple check to see if the path exists */
-    if (GetFileAttributesW(lpszShortPath) == 0xFFFFFFF)
+    if (GetFileAttributesW(lpszShortPath) == INVALID_FILE_ATTRIBUTES)
     {
         /* It doesn't, so fail */
         ReturnLength = 0;
@@ -1111,7 +1111,7 @@
         }
         else
         {
-            PathLength = GetLongPathNameW(LongPathUni.Buffer, ShortPath, 
PathLength);
+            PathLength = GetShortPathNameW(LongPathUni.Buffer, ShortPath, 
PathLength);
         }
     }
 
@@ -1183,7 +1183,7 @@
     ErrorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
 
     /* Do a simple check to see if the path exists */
-    if (GetFileAttributesW(lpszShortPath) == 0xFFFFFFF)
+    if (GetFileAttributesW(lpszShortPath) == INVALID_FILE_ATTRIBUTES)
     {
         /* Windows checks for an application compatibility flag to allow this 
*/
         if (!(NtCurrentPeb()) || !(NtCurrentPeb()->AppCompatFlags.LowPart & 1))


Reply via email to