Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
3af02587
Commit
3af02587
authored
Jun 28, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix returned status code for paths with a trailing slash.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fef675e7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
35 deletions
+21
-35
file.c
dlls/kernel32/tests/file.c
+4
-21
file.c
dlls/ntdll/tests/file.c
+1
-4
path.c
dlls/ntdll/tests/path.c
+5
-6
file.c
dlls/ntdll/unix/file.c
+5
-2
misc.c
dlls/ucrtbase/tests/misc.c
+1
-1
fd.c
server/fd.c
+5
-1
No files found.
dlls/kernel32/tests/file.c
View file @
3af02587
...
...
@@ -432,27 +432,10 @@ static void test__lcreat( void )
ok
(
ret
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
filehandle
=
_lcreat
(
slashname
,
0
);
/* illegal name */
if
(
HFILE_ERROR
==
filehandle
)
{
err
=
GetLastError
();
ok
(
err
==
ERROR_INVALID_NAME
||
err
==
ERROR_PATH_NOT_FOUND
,
"creating file
\"
%s
\"
failed with error %d
\n
"
,
slashname
,
err
);
}
else
{
/* only NT succeeds */
_lclose
(
filehandle
);
find
=
FindFirstFileA
(
slashname
,
&
search_results
);
if
(
INVALID_HANDLE_VALUE
!=
find
)
{
ret
=
FindClose
(
find
);
ok
(
0
!=
ret
,
"FindClose complains (%ld)
\n
"
,
GetLastError
());
slashname
[
strlen
(
slashname
)
-
1
]
=
0
;
ok
(
!
strcmp
(
slashname
,
search_results
.
cFileName
),
"found unexpected name
\"
%s
\"\n
"
,
search_results
.
cFileName
);
ok
(
FILE_ATTRIBUTE_ARCHIVE
==
search_results
.
dwFileAttributes
,
"attributes of file
\"
%s
\"
are 0x%04lx
\n
"
,
search_results
.
cFileName
,
search_results
.
dwFileAttributes
);
}
ret
=
DeleteFileA
(
slashname
);
ok
(
ret
,
"DeleteFile failed (%ld)
\n
"
,
GetLastError
(
)
);
}
ok
(
filehandle
==
HFILE_ERROR
,
"succeeded
\n
"
);
err
=
GetLastError
();
ok
(
err
==
ERROR_INVALID_NAME
||
err
==
ERROR_PATH_NOT_FOUND
,
"creating file
\"
%s
\"
failed with error %d
\n
"
,
slashname
,
err
);
filehandle
=
_lcreat
(
filename
,
8
);
/* illegal attribute */
if
(
HFILE_ERROR
==
filehandle
)
...
...
dlls/ntdll/tests/file.c
View file @
3af02587
...
...
@@ -4255,15 +4255,12 @@ static void test_NtCreateFile(void)
status
=
pNtCreateFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
0
,
NULL
,
0
);
todo_wine
ok
(
status
==
STATUS_OBJECT_NAME_INVALID
,
"failed %s %lx
\n
"
,
debugstr_w
(
nameW
.
Buffer
),
status
);
if
(
!
status
)
DeleteFileW
(
path
);
status
=
pNtCreateFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
todo_wine
ok
(
!
status
,
"failed %s %lx
\n
"
,
debugstr_w
(
nameW
.
Buffer
),
status
);
if
(
!
status
)
RemoveDirectoryW
(
path
);
RemoveDirectoryW
(
path
);
}
static
void
test_read_write
(
void
)
...
...
dlls/ntdll/tests/path.c
View file @
3af02587
...
...
@@ -627,7 +627,7 @@ static void test_RtlDosPathNameToNtPathName_U(void)
static
void
test_nt_names
(
void
)
{
static
const
struct
{
const
WCHAR
*
root
,
*
name
;
NTSTATUS
expect
,
broken
;
BOOL
todo
;
}
tests
[]
=
static
const
struct
{
const
WCHAR
*
root
,
*
name
;
NTSTATUS
expect
,
broken
;
}
tests
[]
=
{
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
kernel32.dll"
,
STATUS_SUCCESS
},
{
NULL
,
L"
\\
??
\\
C:
\\\\
windows
\\
system32
\\
kernel32.dll"
,
STATUS_SUCCESS
,
STATUS_OBJECT_NAME_INVALID
},
...
...
@@ -652,9 +652,9 @@ static void test_nt_names(void)
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
SyStEm32
\\
"
,
STATUS_FILE_IS_A_DIRECTORY
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
foobar
\\
"
,
STATUS_OBJECT_NAME_NOT_FOUND
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
kernel32.dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
,
0
,
TRUE
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
kernel32.dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
kernel32.dll
\\
foo"
,
STATUS_OBJECT_PATH_NOT_FOUND
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
Kernel32.Dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
,
0
,
TRUE
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
Kernel32.Dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
system32
\\
Kernel32.Dll
\\
foo"
,
STATUS_OBJECT_PATH_NOT_FOUND
},
{
NULL
,
L"
\\
??
\\
C:
\\
windows
\\
sys
\001
"
,
STATUS_OBJECT_NAME_INVALID
},
{
L"
\\
??
\\
"
,
NULL
,
STATUS_OBJECT_NAME_INVALID
},
...
...
@@ -678,9 +678,9 @@ static void test_nt_names(void)
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"SyStEm32
\\
"
,
STATUS_FILE_IS_A_DIRECTORY
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
foobar
\\
"
,
STATUS_OBJECT_NAME_NOT_FOUND
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
kernel32.dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
,
0
,
TRUE
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
kernel32.dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
kernel32.dll
\\
foo"
,
STATUS_OBJECT_PATH_NOT_FOUND
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
Kernel32.Dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
,
0
,
TRUE
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
Kernel32.Dll
\\
"
,
STATUS_OBJECT_NAME_INVALID
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"system32
\\
Kernel32.Dll
\\
foo"
,
STATUS_OBJECT_PATH_NOT_FOUND
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"
\\
system32
\\
kernel32.dll"
,
STATUS_INVALID_PARAMETER
},
{
L"
\\
??
\\
C:
\\
windows
\\
"
,
L"/system32
\\
kernel32.dll"
,
STATUS_OBJECT_NAME_INVALID
},
...
...
@@ -720,7 +720,6 @@ static void test_nt_names(void)
}
if
(
attr
.
RootDirectory
)
NtClose
(
attr
.
RootDirectory
);
if
(
handle
)
NtClose
(
handle
);
todo_wine_if
(
tests
[
i
].
todo
)
ok
(
status
==
tests
[
i
].
expect
||
broken
(
tests
[
i
].
broken
&&
status
==
tests
[
i
].
broken
),
"%u: got %lx / %lx for %s + %s
\n
"
,
i
,
status
,
tests
[
i
].
expect
,
debugstr_w
(
tests
[
i
].
root
),
debugstr_w
(
tests
[
i
].
name
));
...
...
dlls/ntdll/unix/file.c
View file @
3af02587
...
...
@@ -3187,7 +3187,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
/* grow the buffer if needed */
if
(
unix_len
-
pos
<
MAX_DIR_ENTRY_LEN
+
2
)
if
(
unix_len
-
pos
<
MAX_DIR_ENTRY_LEN
+
3
)
{
char
*
new_name
;
unix_len
+=
2
*
MAX_DIR_ENTRY_LEN
;
...
...
@@ -3208,7 +3208,9 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
if
(
ret
>
0
&&
ret
<=
MAX_DIR_ENTRY_LEN
)
{
unix_name
[
pos
]
=
'/'
;
unix_name
[
pos
+
1
+
ret
]
=
0
;
pos
+=
ret
+
1
;
if
(
end
<
next
)
unix_name
[
pos
++
]
=
'/'
;
unix_name
[
pos
]
=
0
;
status
=
STATUS_NO_SUCH_FILE
;
break
;
}
...
...
@@ -3218,6 +3220,7 @@ static NTSTATUS lookup_unix_name( const WCHAR *name, int name_len, char **buffer
{
status
=
STATUS_OBJECT_NAME_COLLISION
;
}
if
(
end
<
next
)
strcat
(
unix_name
,
"/"
);
}
else
if
(
status
==
STATUS_OBJECT_NAME_NOT_FOUND
)
status
=
STATUS_OBJECT_PATH_NOT_FOUND
;
...
...
dlls/ucrtbase/tests/misc.c
View file @
3af02587
...
...
@@ -1309,7 +1309,7 @@ static void test__stat32(void)
ok
(
!
ret
,
"_stat32('%s') returned %d
\n
"
,
path
,
ret
);
strcat
(
path
,
"
\\
"
);
ret
=
_stat32
(
path
,
&
buf
);
todo_wine
ok
(
ret
,
"_stat32('%s') returned %d
\n
"
,
path
,
ret
);
ok
(
ret
,
"_stat32('%s') returned %d
\n
"
,
path
,
ret
);
close
(
fd
);
remove
(
path
);
}
...
...
server/fd.c
View file @
3af02587
...
...
@@ -1959,7 +1959,11 @@ struct fd *open_fd( struct fd *root, const char *name, struct unicode_str nt_nam
if
(
fd
->
unix_fd
==
-
1
)
{
file_set_error
();
/* check for trailing slash on file path */
if
((
errno
==
ENOENT
||
errno
==
ENOTDIR
)
&&
name
[
strlen
(
name
)
-
1
]
==
'/'
)
set_error
(
STATUS_OBJECT_NAME_INVALID
);
else
file_set_error
();
goto
error
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment