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
688799b1
Commit
688799b1
authored
Jul 21, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Map errno to a status also in directory functions.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=49523
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f8d42a31
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
8 deletions
+30
-8
file.c
dlls/ntdll/tests/file.c
+25
-0
file.c
dlls/ntdll/unix/file.c
+5
-8
No files found.
dlls/ntdll/tests/file.c
View file @
688799b1
...
...
@@ -401,6 +401,31 @@ static void open_file_test(void)
CloseHandle
(
handle
);
CloseHandle
(
dir
);
attr
.
RootDirectory
=
0
;
wcscat
(
path
,
L"
\\
cmd.exe"
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
status
=
pNtOpenFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_DIRECTORY_FILE
);
ok
(
status
==
STATUS_NOT_A_DIRECTORY
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
CloseHandle
(
handle
);
status
=
pNtOpenFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_NON_DIRECTORY_FILE
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
CloseHandle
(
handle
);
pRtlFreeUnicodeString
(
&
nameW
);
wcscat
(
path
,
L"
\\
cmd.exe"
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
status
=
pNtOpenFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_DIRECTORY_FILE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtOpenFile
(
&
handle
,
GENERIC_READ
,
&
attr
,
&
io
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_NON_DIRECTORY_FILE
);
todo_wine
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
pRtlFreeUnicodeString
(
&
nameW
);
GetTempPathW
(
MAX_PATH
,
path
);
lstrcatW
(
path
,
testdirW
);
CreateDirectoryW
(
path
,
NULL
);
...
...
dlls/ntdll/unix/file.c
View file @
688799b1
...
...
@@ -2454,7 +2454,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, PIO_APC_ROUTI
}
if
(
cwd
==
-
1
||
fchdir
(
cwd
)
==
-
1
)
chdir
(
"/"
);
}
else
status
=
STATUS_ACCESS_DENIED
;
else
status
=
errno_to_status
(
errno
)
;
pthread_mutex_unlock
(
&
dir_mutex
);
...
...
@@ -2557,11 +2557,8 @@ static NTSTATUS find_file_in_dir( char *unix_name, int pos, const WCHAR *name, i
}
#endif
/* VFAT_IOCTL_READDIR_BOTH */
if
(
!
(
dir
=
opendir
(
unix_name
)))
{
if
(
errno
==
ENOENT
)
return
STATUS_OBJECT_PATH_NOT_FOUND
;
else
return
STATUS_ACCESS_DENIED
;
}
if
(
!
(
dir
=
opendir
(
unix_name
)))
return
errno_to_status
(
errno
);
unix_name
[
pos
-
1
]
=
'/'
;
while
((
de
=
readdir
(
dir
)))
{
...
...
@@ -3038,7 +3035,7 @@ static NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *
}
if
(
fchdir
(
old_cwd
)
==
-
1
)
chdir
(
"/"
);
}
else
status
=
STATUS_ACCESS_DENIED
;
else
status
=
errno_to_status
(
errno
)
;
pthread_mutex_unlock
(
&
dir_mutex
);
if
(
old_cwd
!=
-
1
)
close
(
old_cwd
);
...
...
@@ -3217,7 +3214,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char *
disposition
,
FALSE
);
if
(
fchdir
(
old_cwd
)
==
-
1
)
chdir
(
"/"
);
}
else
status
=
STATUS_ACCESS_DENIED
;
else
status
=
errno_to_status
(
errno
)
;
pthread_mutex_unlock
(
&
dir_mutex
);
if
(
old_cwd
!=
-
1
)
close
(
old_cwd
);
if
(
needs_close
)
close
(
root_fd
);
...
...
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