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
f0fed283
Commit
f0fed283
authored
Oct 28, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Ignore some system directories in NtQueryDirectoryFile to avoid recursion troubles.
parent
56788cc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
0 deletions
+45
-0
directory.c
dlls/ntdll/directory.c
+45
-0
No files found.
dlls/ntdll/directory.c
View file @
f0fed283
...
...
@@ -23,6 +23,7 @@
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <sys/types.h>
#ifdef HAVE_DIRENT_H
# include <dirent.h>
...
...
@@ -136,6 +137,15 @@ static inline int getdents64( int fd, char *de, unsigned int size )
#define MAX_DIR_ENTRY_LEN 255
/* max length of a directory entry in chars */
#define MAX_IGNORED_FILES 4
static
struct
{
dev_t
dev
;
ino_t
ino
;
}
ignored_files
[
MAX_IGNORED_FILES
];
static
int
ignored_files_count
;
static
const
unsigned
int
max_dir_info_size
=
FIELD_OFFSET
(
FILE_BOTH_DIR_INFORMATION
,
FileName
[
MAX_DIR_ENTRY_LEN
]
);
static
int
show_dot_files
=
-
1
;
...
...
@@ -172,6 +182,28 @@ static inline int is_valid_mounted_device( const struct stat *st )
#endif
}
static
inline
void
ignore_file
(
const
char
*
name
)
{
struct
stat
st
;
assert
(
ignored_files_count
<
MAX_IGNORED_FILES
);
if
(
!
stat
(
name
,
&
st
))
{
ignored_files
[
ignored_files_count
].
dev
=
st
.
st_dev
;
ignored_files
[
ignored_files_count
].
ino
=
st
.
st_ino
;
ignored_files_count
++
;
}
}
static
inline
BOOL
is_ignored_file
(
const
struct
stat
*
st
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
ignored_files_count
;
i
++
)
if
(
ignored_files
[
i
].
dev
==
st
->
st_dev
&&
ignored_files
[
i
].
ino
==
st
->
st_ino
)
return
TRUE
;
return
FALSE
;
}
/***********************************************************************
* get_default_com_device
*
...
...
@@ -694,6 +726,14 @@ static void init_options(void)
NtClose
(
hkey
);
}
NtClose
(
root
);
/* a couple of directories that we don't want to return in directory searches */
ignore_file
(
wine_get_config_dir
()
);
ignore_file
(
"/dev"
);
ignore_file
(
"/proc"
);
#ifdef linux
ignore_file
(
"/sys"
);
#endif
}
...
...
@@ -929,6 +969,11 @@ static FILE_BOTH_DIR_INFORMATION *append_entry( void *info_ptr, ULONG_PTR *pos,
if
(
stat
(
long_name
,
&
st
)
==
-
1
)
return
NULL
;
if
(
S_ISDIR
(
st
.
st_mode
))
info
->
FileAttributes
|=
FILE_ATTRIBUTE_REPARSE_POINT
;
}
if
(
is_ignored_file
(
&
st
))
{
TRACE
(
"ignoring file %s
\n
"
,
long_name
);
return
NULL
;
}
info
->
NextEntryOffset
=
total_len
;
info
->
FileIndex
=
0
;
/* NTFS always has 0 here, so let's not bother with it */
...
...
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