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
641e1bee
Commit
641e1bee
authored
Jul 01, 2013
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add some tests for NtQueryDirectoryFile with a non-wildcard mask.
parent
96b7c71c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
15 deletions
+36
-15
directory.c
dlls/ntdll/tests/directory.c
+36
-15
No files found.
dlls/ntdll/tests/directory.c
View file @
641e1bee
...
...
@@ -162,11 +162,12 @@ static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info)
}
static
void
test_flags_NtQueryDirectoryFile
(
OBJECT_ATTRIBUTES
*
attr
,
const
char
*
testdirA
,
UNICODE_STRING
*
mask
,
BOOLEAN
single_entry
,
BOOLEAN
restart_flag
)
{
HANDLE
dirh
;
IO_STATUS_BLOCK
io
;
UINT
data_pos
;
UINT
data_pos
,
data_size
;
UINT
data_len
;
/* length of dir data */
BYTE
data
[
8192
];
/* directory data */
FILE_BOTH_DIRECTORY_INFORMATION
*
dir_info
;
...
...
@@ -176,6 +177,8 @@ static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char
reset_found_files
();
data_size
=
mask
?
offsetof
(
FILE_BOTH_DIRECTORY_INFORMATION
,
FileName
[
256
]
)
:
sizeof
(
data
);
/* Read the directory and note which files are found */
status
=
pNtOpenFile
(
&
dirh
,
SYNCHRONIZE
|
FILE_LIST_DIRECTORY
,
attr
,
&
io
,
FILE_OPEN
,
FILE_SYNCHRONOUS_IO_NONALERT
|
FILE_OPEN_FOR_BACKUP_INTENT
|
FILE_DIRECTORY_FILE
);
...
...
@@ -185,9 +188,9 @@ static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char
return
;
}
pNtQueryDirectoryFile
(
dirh
,
NULL
,
NULL
,
NULL
,
&
io
,
data
,
sizeof
(
data
)
,
FileBothDirectoryInformation
,
single_entry
,
NULL
,
restart_flag
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"filed to query directory; status %x
\n
"
,
U
(
io
).
Status
);
pNtQueryDirectoryFile
(
dirh
,
NULL
,
NULL
,
NULL
,
&
io
,
data
,
data_size
,
FileBothDirectoryInformation
,
single_entry
,
mask
,
restart_flag
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"f
a
iled to query directory; status %x
\n
"
,
U
(
io
).
Status
);
data_len
=
io
.
Information
;
ok
(
data_len
>=
sizeof
(
FILE_BOTH_DIRECTORY_INFORMATION
),
"not enough data in directory
\n
"
);
...
...
@@ -199,11 +202,11 @@ static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char
tally_test_file
(
dir_info
);
if
(
dir_info
->
NextEntryOffset
==
0
)
{
pNtQueryDirectoryFile
(
dirh
,
0
,
NULL
,
NULL
,
&
io
,
data
,
sizeof
(
data
)
,
FileBothDirectoryInformation
,
single_entry
,
NULL
,
FALSE
);
pNtQueryDirectoryFile
(
dirh
,
0
,
NULL
,
NULL
,
&
io
,
data
,
data_size
,
FileBothDirectoryInformation
,
single_entry
,
mask
,
FALSE
);
if
(
U
(
io
).
Status
==
STATUS_NO_MORE_FILES
)
break
;
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"filed to query directory; status %x
\n
"
,
U
(
io
).
Status
);
ok
(
U
(
io
).
Status
==
STATUS_SUCCESS
,
"f
a
iled to query directory; status %x
\n
"
,
U
(
io
).
Status
);
data_len
=
io
.
Information
;
if
(
data_len
<
sizeof
(
FILE_BOTH_DIRECTORY_INFORMATION
))
break
;
...
...
@@ -215,10 +218,16 @@ static void test_flags_NtQueryDirectoryFile(OBJECT_ATTRIBUTES *attr, const char
}
ok
(
numfiles
<
max_test_dir_size
,
"too many loops
\n
"
);
for
(
i
=
0
;
testfiles
[
i
].
name
;
i
++
)
ok
(
testfiles
[
i
].
nfound
==
1
,
"Wrong number %d of %s files found (ReturnSingleEntry=%d,RestartScan=%d)
\n
"
,
testfiles
[
i
].
nfound
,
testfiles
[
i
].
description
,
single_entry
,
restart_flag
);
if
(
mask
)
for
(
i
=
0
;
testfiles
[
i
].
name
;
i
++
)
ok
(
testfiles
[
i
].
nfound
==
(
testfiles
[
i
].
nameW
==
mask
->
Buffer
),
"Wrong number %d of %s files found (single_entry=%d,mask=%s)
\n
"
,
testfiles
[
i
].
nfound
,
testfiles
[
i
].
description
,
single_entry
,
wine_dbgstr_wn
(
mask
->
Buffer
,
mask
->
Length
/
sizeof
(
WCHAR
)
));
else
for
(
i
=
0
;
testfiles
[
i
].
name
;
i
++
)
ok
(
testfiles
[
i
].
nfound
==
1
,
"Wrong number %d of %s files found (single_entry=%d,restart=%d)
\n
"
,
testfiles
[
i
].
nfound
,
testfiles
[
i
].
description
,
single_entry
,
restart_flag
);
pNtClose
(
dirh
);
}
...
...
@@ -228,6 +237,7 @@ static void test_NtQueryDirectoryFile(void)
UNICODE_STRING
ntdirname
;
char
testdirA
[
MAX_PATH
];
WCHAR
testdirW
[
MAX_PATH
];
int
i
;
/* Clean up from prior aborted run, if any, then set up test files */
ok
(
GetTempPathA
(
MAX_PATH
,
testdirA
),
"couldn't get temp dir
\n
"
);
...
...
@@ -243,10 +253,21 @@ static void test_NtQueryDirectoryFile(void)
}
InitializeObjectAttributes
(
&
attr
,
&
ntdirname
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
FALSE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
FALSE
,
FALSE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
TRUE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
TRUE
,
FALSE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
NULL
,
FALSE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
NULL
,
FALSE
,
FALSE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
NULL
,
TRUE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
NULL
,
TRUE
,
FALSE
);
for
(
i
=
0
;
testfiles
[
i
].
name
;
i
++
)
{
UNICODE_STRING
mask
;
mask
.
Buffer
=
testfiles
[
i
].
nameW
;
mask
.
Length
=
mask
.
MaximumLength
=
lstrlenW
(
testfiles
[
i
].
nameW
)
*
sizeof
(
WCHAR
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
&
mask
,
FALSE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
&
mask
,
FALSE
,
FALSE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
&
mask
,
TRUE
,
TRUE
);
test_flags_NtQueryDirectoryFile
(
&
attr
,
testdirA
,
&
mask
,
TRUE
,
FALSE
);
}
done:
tear_down_attribute_test
(
testdirA
);
...
...
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