/* 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 */
}
/* Check for illegal characters */
- if ((c > 0x7F) || (IllegalMask[c / 32] && (1 << (c % 32))))
+ if ((c > 0x7F) || (IllegalMask[c / 32] & (1 << (c % 32))))
{
return FALSE;
}
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;
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;
}
else
{
- PathLength = GetLongPathNameW(LongPathUni.Buffer, ShortPath, PathLength);
+ PathLength = GetShortPathNameW(LongPathUni.Buffer, ShortPath, PathLength);
}
}
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))