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
84d2610a
Commit
84d2610a
authored
Aug 21, 2015
by
Sebastian Lackner
Committed by
Alexandre Julliard
Aug 21, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add additional tests for calling NtOpenFile with file object as RootDirectory.
parent
1f2a443c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
2 deletions
+45
-2
file.c
dlls/ntdll/tests/file.c
+45
-2
No files found.
dlls/ntdll/tests/file.c
View file @
84d2610a
...
...
@@ -297,7 +297,8 @@ static void create_file_test(void)
static
void
open_file_test
(
void
)
{
static
const
WCHAR
fooW
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
static
const
char
testdata
[]
=
"Hello World"
;
static
WCHAR
fooW
[]
=
{
'f'
,
'o'
,
'o'
,
0
};
NTSTATUS
status
;
HANDLE
dir
,
root
,
handle
,
file
;
WCHAR
path
[
MAX_PATH
],
tmpfile
[
MAX_PATH
];
...
...
@@ -306,7 +307,8 @@ static void open_file_test(void)
IO_STATUS_BLOCK
io
;
UNICODE_STRING
nameW
;
UINT
i
,
len
;
BOOL
restart
=
TRUE
;
BOOL
ret
,
restart
=
TRUE
;
DWORD
numbytes
;
len
=
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
...
...
@@ -432,6 +434,14 @@ static void open_file_test(void)
GetTempFileNameW
(
path
,
fooW
,
0
,
tmpfile
);
pRtlDosPathNameToNtPathName_U
(
tmpfile
,
&
nameW
,
NULL
,
NULL
);
file
=
CreateFileW
(
tmpfile
,
FILE_WRITE_DATA
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"CreateFile error %d
\n
"
,
GetLastError
()
);
numbytes
=
0xdeadbeef
;
ret
=
WriteFile
(
file
,
testdata
,
sizeof
(
testdata
)
-
1
,
&
numbytes
,
NULL
);
ok
(
ret
,
"WriteFile failed with error %u
\n
"
,
GetLastError
()
);
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"failed to write all data
\n
"
);
CloseHandle
(
file
);
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
...
...
@@ -443,6 +453,22 @@ static void open_file_test(void)
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
pRtlFreeUnicodeString
(
&
nameW
);
numbytes
=
0xdeadbeef
;
memset
(
data
,
0
,
sizeof
(
data
)
);
ret
=
ReadFile
(
file
,
data
,
sizeof
(
data
),
&
numbytes
,
NULL
);
ok
(
ret
,
"ReadFile failed with error %u
\n
"
,
GetLastError
()
);
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"failed to read all data
\n
"
);
ok
(
!
memcmp
(
data
,
testdata
,
sizeof
(
testdata
)
-
1
),
"testdata doesn't match
\n
"
);
nameW
.
Length
=
sizeof
(
fooW
)
-
sizeof
(
WCHAR
);
nameW
.
Buffer
=
fooW
;
attr
.
RootDirectory
=
file
;
attr
.
ObjectName
=
&
nameW
;
status
=
pNtOpenFile
(
&
root
,
SYNCHRONIZE
|
FILE_LIST_DIRECTORY
,
&
attr
,
&
io
,
FILE_SHARE_READ
,
FILE_SYNCHRONOUS_IO_NONALERT
);
todo_wine
ok
(
status
==
STATUS_OBJECT_PATH_NOT_FOUND
,
"expected STATUS_OBJECT_PATH_NOT_FOUND, got %08x
\n
"
,
status
);
nameW
.
Length
=
0
;
nameW
.
Buffer
=
NULL
;
attr
.
RootDirectory
=
file
;
...
...
@@ -451,6 +477,23 @@ static void open_file_test(void)
FILE_SHARE_READ
,
FILE_SYNCHRONOUS_IO_NONALERT
);
todo_wine
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
tmpfile
),
status
);
numbytes
=
SetFilePointer
(
file
,
0
,
0
,
FILE_CURRENT
);
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"SetFilePointer returned %u
\n
"
,
numbytes
);
numbytes
=
SetFilePointer
(
root
,
0
,
0
,
FILE_CURRENT
);
todo_wine
ok
(
numbytes
==
0
,
"SetFilePointer returned %u
\n
"
,
numbytes
);
numbytes
=
0xdeadbeef
;
memset
(
data
,
0
,
sizeof
(
data
)
);
ret
=
ReadFile
(
root
,
data
,
sizeof
(
data
),
&
numbytes
,
NULL
);
todo_wine
ok
(
ret
,
"ReadFile failed with error %u
\n
"
,
GetLastError
()
);
todo_wine
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"failed to read all data
\n
"
);
todo_wine
ok
(
!
memcmp
(
data
,
testdata
,
sizeof
(
testdata
)
-
1
),
"testdata doesn't match
\n
"
);
numbytes
=
SetFilePointer
(
file
,
0
,
0
,
FILE_CURRENT
);
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"SetFilePointer returned %u
\n
"
,
numbytes
);
numbytes
=
SetFilePointer
(
root
,
0
,
0
,
FILE_CURRENT
);
todo_wine
ok
(
numbytes
==
sizeof
(
testdata
)
-
1
,
"SetFilePointer returned %u
\n
"
,
numbytes
);
CloseHandle
(
file
);
CloseHandle
(
root
);
DeleteFileW
(
tmpfile
);
...
...
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