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
5e240cdf
Commit
5e240cdf
authored
Jul 16, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Jul 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Convert DIR_TEST_CREATE_OPEN into a function.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d7e12831
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
23 deletions
+30
-23
om.c
dlls/ntdll/tests/om.c
+30
-23
No files found.
dlls/ntdll/tests/om.c
View file @
5e240cdf
...
...
@@ -199,18 +199,25 @@ static void test_namespace_pipe(void)
#define DIRECTORY_QUERY (0x0001)
#define SYMBOLIC_LINK_QUERY 0x0001
#define DIR_TEST_CREATE_OPEN(n,e) \
do { \
HANDLE h; \
pRtlCreateUnicodeStringFromAsciiz(&str, n); \
status = pNtCreateDirectoryObject( &h, DIRECTORY_QUERY, &attr ); \
ok( status == e, "NtCreateDirectoryObject(%s) got %08x\n", n, status ); \
if (!status) pNtClose( h ); \
status = pNtOpenDirectoryObject( &h, DIRECTORY_QUERY, &attr ); \
ok( status == e, "NtOpenDirectoryObject(%s) got %08x\n", n, status ); \
if (!status) pNtClose( h ); \
pRtlFreeUnicodeString(&str); \
} while(0)
#define check_create_open_dir(parent, name, status) check_create_open_dir_(__LINE__, parent, name, status)
static
void
check_create_open_dir_
(
int
line
,
HANDLE
parent
,
const
char
*
name
,
NTSTATUS
expect
)
{
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
str
;
NTSTATUS
status
;
HANDLE
h
;
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
name
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
parent
,
NULL
);
status
=
pNtCreateDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
&
attr
);
ok_
(
__FILE__
,
line
)(
status
==
expect
,
"NtCreateDirectoryObject(%s) got %08x
\n
"
,
debugstr_a
(
name
),
status
);
if
(
!
status
)
pNtClose
(
h
);
status
=
pNtOpenDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
&
attr
);
ok_
(
__FILE__
,
line
)(
status
==
expect
,
"NtOpenDirectoryObject(%s) got %08x
\n
"
,
debugstr_a
(
name
),
status
);
if
(
!
status
)
pNtClose
(
h
);
pRtlFreeUnicodeString
(
&
str
);
}
static
BOOL
is_correct_dir
(
HANDLE
dir
,
const
char
*
name
)
{
...
...
@@ -906,11 +913,11 @@ static void test_directory(void)
pRtlFreeUnicodeString
(
&
str
);
pNtClose
(
dir
);
DIR_TEST_CREATE_OPEN
(
"BaseNamedObjects"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
DIR_TEST_CREATE_OPEN
(
"
\\
BaseNamedObjects
\\
"
,
STATUS_OBJECT_NAME_INVALID
);
DIR_TEST_CREATE_OPEN
(
"
\\\\
BaseNamedObjects"
,
STATUS_OBJECT_NAME_INVALID
);
DIR_TEST_CREATE_OPEN
(
"
\\
BaseNamedObjects
\\\\
om.c-test"
,
STATUS_OBJECT_NAME_INVALID
);
DIR_TEST_CREATE_OPEN
(
"
\\
BaseNamedObjects
\\
om.c-test
\\
"
,
STATUS_OBJECT_PATH_NOT_FOUND
);
check_create_open_dir
(
NULL
,
"BaseNamedObjects"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
check_create_open_dir
(
NULL
,
"
\\
BaseNamedObjects
\\
"
,
STATUS_OBJECT_NAME_INVALID
);
check_create_open_dir
(
NULL
,
"
\\\\
BaseNamedObjects"
,
STATUS_OBJECT_NAME_INVALID
);
check_create_open_dir
(
NULL
,
"
\\
BaseNamedObjects
\\\\
om.c-test"
,
STATUS_OBJECT_NAME_INVALID
);
check_create_open_dir
(
NULL
,
"
\\
BaseNamedObjects
\\
om.c-test
\\
"
,
STATUS_OBJECT_PATH_NOT_FOUND
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"
\\
BaseNamedObjects
\\
om.c-test"
);
status
=
pNtCreateDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
&
attr
);
...
...
@@ -1009,13 +1016,13 @@ static void test_directory(void)
status
=
pNtOpenDirectoryObject
(
&
h
,
DIRECTORY_QUERY
,
&
attr
);
ok
(
status
==
STATUS_OBJECT_NAME_INVALID
,
"NtOpenDirectoryObject got %08x
\n
"
,
status
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
dir
,
NULL
);
DIR_TEST_CREATE_OPEN
(
""
,
STATUS_SUCCESS
);
DIR_TEST_CREATE_OPEN
(
"
\\
"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
DIR_TEST_CREATE_OPEN
(
"
\\
om.c-test"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
DIR_TEST_CREATE_OPEN
(
"
\\
om.c-test
\\
"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
DIR_TEST_CREATE_OPEN
(
"om.c-test
\\
"
,
STATUS_OBJECT_PATH_NOT_FOUND
);
check_create_open_dir
(
dir
,
""
,
STATUS_SUCCESS
);
check_create_open_dir
(
dir
,
"
\\
"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
check_create_open_dir
(
dir
,
"
\\
om.c-test"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
check_create_open_dir
(
dir
,
"
\\
om.c-test
\\
"
,
STATUS_OBJECT_PATH_SYNTAX_BAD
);
check_create_open_dir
(
dir
,
"om.c-test
\\
"
,
STATUS_OBJECT_PATH_NOT_FOUND
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
dir
,
NULL
);
pRtlCreateUnicodeStringFromAsciiz
(
&
str
,
"om.c-test"
);
status
=
pNtCreateDirectoryObject
(
&
dir1
,
DIRECTORY_QUERY
,
&
attr
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create directory %08x
\n
"
,
status
);
...
...
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