mirror of
https://github.com/reactos/reactos.git
synced 2025-05-25 12:14:32 +00:00
[KERNEL32]
Fix handling of trailing backslash. Patch by Thomas Faber. ROSTESTS-135 svn path=/trunk/; revision=73925
This commit is contained in:
parent
84b6e377ec
commit
298e2fb71c
1 changed files with 13 additions and 0 deletions
|
@ -104,6 +104,7 @@ HANDLE WINAPI CreateFileW (LPCWSTR lpFileName,
|
|||
ULONG FileAttributes, Flags = 0;
|
||||
PVOID EaBuffer = NULL;
|
||||
ULONG EaLength = 0;
|
||||
BOOLEAN TrailingBackslash;
|
||||
|
||||
if (!lpFileName || !lpFileName[0])
|
||||
{
|
||||
|
@ -220,6 +221,13 @@ HANDLE WINAPI CreateFileW (LPCWSTR lpFileName,
|
|||
}
|
||||
|
||||
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 @@ HANDLE WINAPI CreateFileW (LPCWSTR lpFileName,
|
|||
{
|
||||
SetLastError( ERROR_FILE_EXISTS );
|
||||
}
|
||||
else if (Status == STATUS_FILE_IS_A_DIRECTORY &&
|
||||
TrailingBackslash)
|
||||
{
|
||||
SetLastError(ERROR_PATH_NOT_FOUND);
|
||||
}
|
||||
else
|
||||
{
|
||||
BaseSetLastNTError (Status);
|
||||
|
|
Loading…
Reference in a new issue