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
b8315e87
Commit
b8315e87
authored
Oct 08, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Oct 08, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for calling NtReadFile/NtWriteFile on directory.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b34b65e4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
file.c
dlls/ntdll/tests/file.c
+33
-2
No files found.
dlls/ntdll/tests/file.c
View file @
b8315e87
...
@@ -177,6 +177,7 @@ static void create_file_test(void)
...
@@ -177,6 +177,7 @@ static void create_file_test(void)
static
const
WCHAR
pathInvalidNtW
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
pathInvalidNtW
[]
=
{
'\\'
,
'\\'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
pathInvalidNt2W
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
pathInvalidNt2W
[]
=
{
'\\'
,
'?'
,
'?'
,
'\\'
,
0
};
static
const
WCHAR
pathInvalidDosW
[]
=
{
'\\'
,
'D'
,
'o'
,
's'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
'\\'
,
0
};
static
const
WCHAR
pathInvalidDosW
[]
=
{
'\\'
,
'D'
,
'o'
,
's'
,
'D'
,
'e'
,
'v'
,
'i'
,
'c'
,
'e'
,
's'
,
'\\'
,
0
};
static
const
char
testdata
[]
=
"Hello World"
;
FILE_NETWORK_OPEN_INFORMATION
info
;
FILE_NETWORK_OPEN_INFORMATION
info
;
NTSTATUS
status
;
NTSTATUS
status
;
HANDLE
dir
,
file
;
HANDLE
dir
,
file
;
...
@@ -184,6 +185,9 @@ static void create_file_test(void)
...
@@ -184,6 +185,9 @@ static void create_file_test(void)
OBJECT_ATTRIBUTES
attr
;
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
IO_STATUS_BLOCK
io
;
UNICODE_STRING
nameW
;
UNICODE_STRING
nameW
;
LARGE_INTEGER
offset
;
char
buf
[
32
];
DWORD
ret
;
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
...
@@ -195,9 +199,36 @@ static void create_file_test(void)
...
@@ -195,9 +199,36 @@ static void create_file_test(void)
attr
.
SecurityQualityOfService
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
/* try various open modes and options on directories */
/* try various open modes and options on directories */
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
|
GENERIC_WRITE
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_OPEN
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
FILE_
SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_
OPEN
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
U
(
io
).
Status
=
0xdeadbeef
;
offset
.
QuadPart
=
0
;
status
=
pNtReadFile
(
dir
,
NULL
,
NULL
,
NULL
,
&
io
,
buf
,
sizeof
(
buf
),
&
offset
,
NULL
);
todo_wine
ok
(
status
==
STATUS_INVALID_DEVICE_REQUEST
||
status
==
STATUS_PENDING
,
"NtReadFile error %08x
\n
"
,
status
);
if
(
status
==
STATUS_PENDING
)
{
ret
=
WaitForSingleObject
(
dir
,
1000
);
ok
(
ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject error %u
\n
"
,
ret
);
ok
(
U
(
io
).
Status
==
STATUS_INVALID_DEVICE_REQUEST
,
"expected STATUS_INVALID_DEVICE_REQUEST, got %08x
\n
"
,
U
(
io
).
Status
);
}
U
(
io
).
Status
=
0xdeadbeef
;
offset
.
QuadPart
=
0
;
status
=
pNtWriteFile
(
dir
,
NULL
,
NULL
,
NULL
,
&
io
,
testdata
,
sizeof
(
testdata
),
&
offset
,
NULL
);
todo_wine
ok
(
status
==
STATUS_INVALID_DEVICE_REQUEST
||
status
==
STATUS_PENDING
,
"NtWriteFile error %08x
\n
"
,
status
);
if
(
status
==
STATUS_PENDING
)
{
ret
=
WaitForSingleObject
(
dir
,
1000
);
ok
(
ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject error %u
\n
"
,
ret
);
ok
(
U
(
io
).
Status
==
STATUS_INVALID_DEVICE_REQUEST
,
"expected STATUS_INVALID_DEVICE_REQUEST, got %08x
\n
"
,
U
(
io
).
Status
);
}
CloseHandle
(
dir
);
CloseHandle
(
dir
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
...
...
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