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
538c8bc5
Commit
538c8bc5
authored
Dec 08, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add tests for open directories with NtCreateFile and strange options.
parent
151446a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
0 deletions
+81
-0
file.c
dlls/ntdll/tests/file.c
+81
-0
No files found.
dlls/ntdll/tests/file.c
View file @
538c8bc5
...
...
@@ -50,6 +50,7 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG, ULONG * );
static
NTSTATUS
(
WINAPI
*
pNtCreateMailslotFile
)(
PHANDLE
,
ULONG
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
ULONG
,
ULONG
,
ULONG
,
PLARGE_INTEGER
);
static
NTSTATUS
(
WINAPI
*
pNtCreateFile
)(
PHANDLE
,
ACCESS_MASK
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
PLARGE_INTEGER
,
ULONG
,
ULONG
,
ULONG
,
ULONG
,
PVOID
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pNtOpenFile
)(
PHANDLE
,
ACCESS_MASK
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
ULONG
,
ULONG
);
static
NTSTATUS
(
WINAPI
*
pNtDeleteFile
)(
POBJECT_ATTRIBUTES
ObjectAttributes
);
static
NTSTATUS
(
WINAPI
*
pNtReadFile
)(
HANDLE
hFile
,
HANDLE
hEvent
,
...
...
@@ -152,6 +153,84 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
ok
(
!
reserved
,
"reserved is not 0: %x
\n
"
,
reserved
);
}
static
void
create_file_test
(
void
)
{
NTSTATUS
status
;
HANDLE
dir
;
WCHAR
path
[
MAX_PATH
];
OBJECT_ATTRIBUTES
attr
;
IO_STATUS_BLOCK
io
;
UNICODE_STRING
nameW
;
UINT
len
;
len
=
GetCurrentDirectoryW
(
MAX_PATH
,
path
);
pRtlDosPathNameToNtPathName_U
(
path
,
&
nameW
,
NULL
,
NULL
);
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
ObjectName
=
&
nameW
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
/* try various open modes and options on directories */
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
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
);
CloseHandle
(
dir
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_ACCESS_DENIED
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN_IF
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
CloseHandle
(
dir
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SUPERSEDE
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OVERWRITE
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OVERWRITE_IF
,
FILE_DIRECTORY_FILE
,
NULL
,
0
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN
,
0
,
NULL
,
0
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
CloseHandle
(
dir
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_CREATE
,
0
,
NULL
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_ACCESS_DENIED
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OPEN_IF
,
0
,
NULL
,
0
);
ok
(
!
status
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
CloseHandle
(
dir
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_SUPERSEDE
,
0
,
NULL
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_ACCESS_DENIED
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OVERWRITE
,
0
,
NULL
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_ACCESS_DENIED
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
status
=
pNtCreateFile
(
&
dir
,
GENERIC_READ
,
&
attr
,
&
io
,
NULL
,
0
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
FILE_OVERWRITE_IF
,
0
,
NULL
,
0
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_ACCESS_DENIED
,
"open %s failed %x
\n
"
,
wine_dbgstr_w
(
nameW
.
Buffer
),
status
);
}
static
void
open_file_test
(
void
)
{
NTSTATUS
status
;
...
...
@@ -1344,6 +1423,7 @@ START_TEST(file)
pRtlDosPathNameToNtPathName_U
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDosPathNameToNtPathName_U"
);
pRtlWow64EnableFsRedirectionEx
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlWow64EnableFsRedirectionEx"
);
pNtCreateMailslotFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateMailslotFile"
);
pNtCreateFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateFile"
);
pNtOpenFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtOpenFile"
);
pNtDeleteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDeleteFile"
);
pNtReadFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReadFile"
);
...
...
@@ -1360,6 +1440,7 @@ START_TEST(file)
pNtQueryInformationFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryInformationFile"
);
pNtQueryDirectoryFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtQueryDirectoryFile"
);
create_file_test
();
open_file_test
();
delete_file_test
();
read_file_test
();
...
...
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