Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6c2ac810
Commit
6c2ac810
authored
Oct 23, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 24, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add more NtQueryInformationFile tests.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8b8eba7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
om.c
dlls/ntdll/tests/om.c
+43
-0
No files found.
dlls/ntdll/tests/om.c
View file @
6c2ac810
...
...
@@ -69,6 +69,7 @@ static NTSTATUS (WINAPI *pNtWaitForKeyedEvent)( HANDLE, const void *, BOOLEAN, c
static
NTSTATUS
(
WINAPI
*
pNtReleaseKeyedEvent
)(
HANDLE
,
const
void
*
,
BOOLEAN
,
const
LARGE_INTEGER
*
);
static
NTSTATUS
(
WINAPI
*
pNtCreateIoCompletion
)(
PHANDLE
,
ACCESS_MASK
,
POBJECT_ATTRIBUTES
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pNtOpenIoCompletion
)(
PHANDLE
,
ACCESS_MASK
,
POBJECT_ATTRIBUTES
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationFile
)(
HANDLE
,
PIO_STATUS_BLOCK
,
void
*
,
ULONG
,
FILE_INFORMATION_CLASS
);
#define KEYEDEVENT_WAIT 0x0001
#define KEYEDEVENT_WAKE 0x0002
...
...
@@ -1270,6 +1271,37 @@ static void test_symboliclink(void)
pNtClose
(
dir
);
}
#define test_file_info(a) _test_file_info(__LINE__,a)
static
void
_test_file_info
(
unsigned
line
,
HANDLE
handle
)
{
IO_STATUS_BLOCK
io
;
char
buf
[
256
];
NTSTATUS
status
;
status
=
pNtQueryInformationFile
(
handle
,
&
io
,
buf
,
sizeof
(
buf
),
0xdeadbeef
);
ok_
(
__FILE__
,
line
)(
status
==
STATUS_INVALID_INFO_CLASS
||
status
==
STATUS_NOT_IMPLEMENTED
,
"expected STATUS_NOT_IMPLEMENTED, got %x
\n
"
,
status
);
status
=
pNtQueryInformationFile
(
handle
,
&
io
,
buf
,
sizeof
(
buf
),
FileAccessInformation
);
ok_
(
__FILE__
,
line
)(
status
==
STATUS_SUCCESS
,
"FileAccessInformation returned %x
\n
"
,
status
);
}
#define test_no_file_info(a) _test_no_file_info(__LINE__,a)
static
void
_test_no_file_info
(
unsigned
line
,
HANDLE
handle
)
{
IO_STATUS_BLOCK
io
;
char
buf
[
256
];
NTSTATUS
status
;
status
=
pNtQueryInformationFile
(
handle
,
&
io
,
buf
,
sizeof
(
buf
),
0xdeadbeef
);
ok_
(
__FILE__
,
line
)(
status
==
STATUS_INVALID_INFO_CLASS
||
status
==
STATUS_NOT_IMPLEMENTED
,
"expected STATUS_NOT_IMPLEMENTED, got %x
\n
"
,
status
);
status
=
pNtQueryInformationFile
(
handle
,
&
io
,
buf
,
sizeof
(
buf
),
FileAccessInformation
);
ok_
(
__FILE__
,
line
)(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"FileAccessInformation returned %x
\n
"
,
status
);
}
static
void
test_query_object
(
void
)
{
static
const
WCHAR
name
[]
=
{
'\\'
,
'B'
,
'a'
,
's'
,
'e'
,
'N'
,
'a'
,
'm'
,
'e'
,
'd'
,
'O'
,
'b'
,
'j'
,
'e'
,
'c'
,
't'
,
's'
,
...
...
@@ -1351,6 +1383,7 @@ static void test_query_object(void)
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"NtQueryObject failed %x
\n
"
,
status
);
ok
(
len
>=
sizeof
(
OBJECT_TYPE_INFORMATION
)
+
sizeof
(
type_event
)
+
sizeof
(
WCHAR
),
"unexpected len %u
\n
"
,
len
);
test_no_file_info
(
handle
);
pNtClose
(
handle
);
handle
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
NULL
);
...
...
@@ -1361,6 +1394,7 @@ static void test_query_object(void)
str
=
(
UNICODE_STRING
*
)
buffer
;
ok
(
str
->
Length
==
0
,
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
==
NULL
,
"unexpected ptr %p
\n
"
,
str
->
Buffer
);
test_no_file_info
(
handle
);
pNtClose
(
handle
);
GetWindowsDirectoryA
(
dir
,
MAX_PATH
);
...
...
@@ -1401,6 +1435,7 @@ static void test_query_object(void)
ok
(
len
>=
expected_len
,
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_file
,
sizeof
(
type_file
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_file_info
(
handle
);
pNtClose
(
handle
);
...
...
@@ -1418,6 +1453,7 @@ static void test_query_object(void)
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_file
,
sizeof
(
type_file
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
DeleteFileA
(
file1
);
test_file_info
(
handle
);
pNtClose
(
handle
);
status
=
pNtCreateIoCompletion
(
&
handle
,
IO_COMPLETION_ALL_ACCESS
,
NULL
,
0
);
...
...
@@ -1432,6 +1468,7 @@ static void test_query_object(void)
ok
(
len
>=
expected_len
,
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_iocompletion
,
sizeof
(
type_iocompletion
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_no_file_info
(
handle
);
pNtClose
(
handle
);
status
=
pNtCreateDirectoryObject
(
&
handle
,
DIRECTORY_QUERY
,
NULL
);
...
...
@@ -1446,6 +1483,7 @@ static void test_query_object(void)
ok
(
len
>=
expected_len
,
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_directory
,
sizeof
(
type_directory
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_no_file_info
(
handle
);
pNtClose
(
handle
);
size
.
u
.
LowPart
=
256
;
...
...
@@ -1462,6 +1500,7 @@ static void test_query_object(void)
ok
(
len
>=
expected_len
,
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_section
,
sizeof
(
type_section
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_no_file_info
(
handle
);
pNtClose
(
handle
);
handle
=
CreateMailslotA
(
"
\\\\
.
\\
mailslot
\\
test_mailslot"
,
100
,
1000
,
NULL
);
...
...
@@ -1478,6 +1517,7 @@ static void test_query_object(void)
ok
(
len
>
sizeof
(
UNICODE_STRING
)
+
sizeof
(
"
\\
test_mailslot"
)
*
sizeof
(
WCHAR
),
"name too short %s
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
)
);
trace
(
"got %s len %u
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
len
);
test_file_info
(
handle
);
pNtClose
(
handle
);
handle
=
CreateNamedPipeA
(
"
\\\\
.
\\
pipe
\\
test_pipe"
,
PIPE_ACCESS_DUPLEX
,
PIPE_READMODE_BYTE
,
...
...
@@ -1508,6 +1548,7 @@ static void test_query_object(void)
ok
(
len
>=
sizeof
(
OBJECT_TYPE_INFORMATION
)
+
str
->
Length
+
sizeof
(
WCHAR
),
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_file
,
sizeof
(
type_file
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_file_info
(
handle
);
client
=
CreateFileA
(
"
\\\\
.
\\
pipe
\\
test_pipe"
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
...
...
@@ -1522,6 +1563,7 @@ static void test_query_object(void)
ok
(
len
>=
sizeof
(
OBJECT_TYPE_INFORMATION
)
+
str
->
Length
+
sizeof
(
WCHAR
),
"unexpected len %u
\n
"
,
len
);
ok
(
str
->
Buffer
&&
!
memcmp
(
str
->
Buffer
,
type_file
,
sizeof
(
type_file
)
),
"wrong/bad type name %s (%p)
\n
"
,
wine_dbgstr_w
(
str
->
Buffer
),
str
->
Buffer
);
test_file_info
(
client
);
pNtClose
(
client
);
pNtClose
(
handle
);
...
...
@@ -2064,6 +2106,7 @@ START_TEST(om)
pNtReleaseKeyedEvent
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReleaseKeyedEvent"
);
pNtCreateIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateIoCompletion"
);
pNtOpenIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtOpenIoCompletion"
);
pNtQueryInformationFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryInformationFile"
);
test_case_sensitive
();
test_namespace_pipe
();
...
...
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