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
a2022c89
Commit
a2022c89
authored
Aug 31, 2008
by
Jeff Zaroyko
Committed by
Alexandre Julliard
Sep 03, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add some tests for NtDeleteFile.
parent
1b5873ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
0 deletions
+70
-0
file.c
dlls/ntdll/tests/file.c
+70
-0
No files found.
dlls/ntdll/tests/file.c
View file @
a2022c89
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
*
*
* Copyright 2007 Jeff Latimer
* Copyright 2007 Jeff Latimer
* Copyright 2007 Andrey Turkin
* Copyright 2007 Andrey Turkin
* Copyright 2008 Jeff Zaroyko
*
*
* This library is free software; you can redistribute it and/or
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* modify it under the terms of the GNU Lesser General Public
...
@@ -38,9 +39,12 @@
...
@@ -38,9 +39,12 @@
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
#define IO_COMPLETION_ALL_ACCESS 0x001F0003
#endif
#endif
static
NTSTATUS
(
WINAPI
*
pRtlFreeUnicodeString
)(
PUNICODE_STRING
);
static
VOID
(
WINAPI
*
pRtlInitUnicodeString
)(
PUNICODE_STRING
,
LPCWSTR
);
static
VOID
(
WINAPI
*
pRtlInitUnicodeString
)(
PUNICODE_STRING
,
LPCWSTR
);
static
BOOL
(
WINAPI
*
pRtlDosPathNameToNtPathName_U
)(
LPCWSTR
,
PUNICODE_STRING
,
PWSTR
*
,
CURDIR
*
);
static
NTSTATUS
(
WINAPI
*
pNtCreateMailslotFile
)(
PHANDLE
,
ULONG
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
static
NTSTATUS
(
WINAPI
*
pNtCreateMailslotFile
)(
PHANDLE
,
ULONG
,
POBJECT_ATTRIBUTES
,
PIO_STATUS_BLOCK
,
ULONG
,
ULONG
,
ULONG
,
PLARGE_INTEGER
);
ULONG
,
ULONG
,
ULONG
,
PLARGE_INTEGER
);
static
NTSTATUS
(
WINAPI
*
pNtDeleteFile
)(
POBJECT_ATTRIBUTES
ObjectAttributes
);
static
NTSTATUS
(
WINAPI
*
pNtReadFile
)(
HANDLE
hFile
,
HANDLE
hEvent
,
static
NTSTATUS
(
WINAPI
*
pNtReadFile
)(
HANDLE
hFile
,
HANDLE
hEvent
,
PIO_APC_ROUTINE
apc
,
void
*
apc_user
,
PIO_APC_ROUTINE
apc
,
void
*
apc_user
,
PIO_STATUS_BLOCK
io_status
,
void
*
buffer
,
ULONG
length
,
PIO_STATUS_BLOCK
io_status
,
void
*
buffer
,
ULONG
length
,
...
@@ -136,6 +140,68 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
...
@@ -136,6 +140,68 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
ok
(
!
reserved
,
"reserved is not 0: %x
\n
"
,
reserved
);
ok
(
!
reserved
,
"reserved is not 0: %x
\n
"
,
reserved
);
}
}
static
void
delete_file_test
(
void
)
{
NTSTATUS
ret
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
nameW
;
WCHAR
pathW
[
MAX_PATH
];
WCHAR
pathsubW
[
MAX_PATH
];
static
const
WCHAR
testdirW
[]
=
{
'n'
,
't'
,
'd'
,
'e'
,
'l'
,
'e'
,
't'
,
'e'
,
'f'
,
'i'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
subdirW
[]
=
{
'\\'
,
's'
,
'u'
,
'b'
,
0
};
ret
=
GetTempPathW
(
MAX_PATH
,
pathW
);
if
(
!
ret
)
{
ok
(
0
,
"couldn't get temp dir
\n
"
);
return
;
}
if
(
ret
+
sizeof
(
testdirW
)
/
sizeof
(
WCHAR
)
-
1
+
sizeof
(
subdirW
)
/
sizeof
(
WCHAR
)
-
1
>=
MAX_PATH
)
{
ok
(
0
,
"MAX_PATH exceeded in constructing paths
\n
"
);
return
;
}
lstrcatW
(
pathW
,
testdirW
);
lstrcpyW
(
pathsubW
,
pathW
);
lstrcatW
(
pathsubW
,
subdirW
);
ret
=
CreateDirectoryW
(
pathW
,
NULL
);
ok
(
ret
==
TRUE
,
"couldn't create directory ntdeletefile
\n
"
);
if
(
!
pRtlDosPathNameToNtPathName_U
(
pathW
,
&
nameW
,
NULL
,
NULL
))
{
ok
(
0
,
"RtlDosPathNametoNtPathName_U failed
\n
"
);
return
;
}
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
OBJ_CASE_INSENSITIVE
;
attr
.
ObjectName
=
&
nameW
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
/* test NtDeleteFile on an empty directory */
ret
=
pNtDeleteFile
(
&
attr
);
ok
(
ret
==
STATUS_SUCCESS
,
"NtDeleteFile should succeed in removing an empty directory
\n
"
);
ret
=
RemoveDirectoryW
(
pathW
);
ok
(
ret
==
FALSE
,
"expected to fail removing directory, NtDeleteFile should have removed it
\n
"
);
/* test NtDeleteFile on a non-empty directory */
ret
=
CreateDirectoryW
(
pathW
,
NULL
);
ok
(
ret
==
TRUE
,
"couldn't create directory ntdeletefile ?!
\n
"
);
ret
=
CreateDirectoryW
(
pathsubW
,
NULL
);
ok
(
ret
==
TRUE
,
"couldn't create directory subdir
\n
"
);
ret
=
pNtDeleteFile
(
&
attr
);
ok
(
ret
==
STATUS_SUCCESS
,
"expected NtDeleteFile to ret STATUS_SUCCESS
\n
"
);
ret
=
RemoveDirectoryW
(
pathsubW
);
ok
(
ret
==
TRUE
,
"expected to remove directory ntdeletefile
\\
sub
\n
"
);
ret
=
RemoveDirectoryW
(
pathW
);
ok
(
ret
==
TRUE
,
"expected to remove directory ntdeletefile, NtDeleteFile failed.
\n
"
);
pRtlFreeUnicodeString
(
&
nameW
);
}
static
void
read_file_test
(
void
)
static
void
read_file_test
(
void
)
{
{
const
char
text
[]
=
"foobar"
;
const
char
text
[]
=
"foobar"
;
...
@@ -623,8 +689,11 @@ START_TEST(file)
...
@@ -623,8 +689,11 @@ START_TEST(file)
return
;
return
;
}
}
pRtlFreeUnicodeString
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlFreeUnicodeString"
);
pRtlInitUnicodeString
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitUnicodeString"
);
pRtlInitUnicodeString
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlInitUnicodeString"
);
pRtlDosPathNameToNtPathName_U
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlDosPathNameToNtPathName_U"
);
pNtCreateMailslotFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateMailslotFile"
);
pNtCreateMailslotFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtCreateMailslotFile"
);
pNtDeleteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtDeleteFile"
);
pNtReadFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReadFile"
);
pNtReadFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtReadFile"
);
pNtWriteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtWriteFile"
);
pNtWriteFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtWriteFile"
);
pNtClose
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtClose"
);
pNtClose
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtClose"
);
...
@@ -635,6 +704,7 @@ START_TEST(file)
...
@@ -635,6 +704,7 @@ START_TEST(file)
pNtSetIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtSetIoCompletion"
);
pNtSetIoCompletion
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtSetIoCompletion"
);
pNtSetInformationFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtSetInformationFile"
);
pNtSetInformationFile
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtSetInformationFile"
);
delete_file_test
();
read_file_test
();
read_file_test
();
nt_mailslot_test
();
nt_mailslot_test
();
test_iocompletion
();
test_iocompletion
();
...
...
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