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
9ff42627
Commit
9ff42627
authored
Nov 17, 2022
by
Eric Pouech
Committed by
Alexandre Julliard
Nov 18, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Extend file tests about delete-on-close and disposition.
Signed-off-by:
Eric Pouech
<
eric.pouech@gmail.com
>
parent
b9bf5abe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
0 deletions
+66
-0
file.c
dlls/ntdll/tests/file.c
+66
-0
No files found.
dlls/ntdll/tests/file.c
View file @
9ff42627
...
...
@@ -3000,6 +3000,10 @@ static void test_file_disposition_information(void)
fdi
.
DoDeleteFile
=
TRUE
;
res
=
pNtSetInformationFile
(
handle
,
&
io
,
&
fdi
,
sizeof
fdi
,
FileDispositionInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"unexpected FileDispositionInformation result (expected STATUS_SUCCESS, got %lx)
\n
"
,
res
);
res
=
NtQueryInformationFile
(
handle
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
todo_wine
ok
(
fsi
.
DeletePending
,
"Handle should be marked for deletion
\n
"
);
CloseHandle
(
handle
);
fileDeleted
=
GetFileAttributesA
(
buffer
)
==
INVALID_FILE_ATTRIBUTES
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
;
ok
(
fileDeleted
,
"File should have been deleted
\n
"
);
...
...
@@ -3408,6 +3412,68 @@ static void test_file_disposition_information(void)
res
=
DeleteFileA
(
buffer
);
ok
(
!
res
,
"expected failure
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"got error %lu
\n
"
,
GetLastError
()
);
/* pending delete flag is shared across handles */
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
FILE_SHARE_DELETE
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
res
=
NtQueryInformationFile
(
handle
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
handle2
=
CreateFileA
(
buffer
,
DELETE
,
FILE_SHARE_DELETE
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
handle2
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
res
=
NtQueryInformationFile
(
handle2
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
res
=
NtSetInformationFile
(
handle
,
&
io
,
&
fdi
,
sizeof
(
fdi
),
FileDispositionInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
res
=
NtQueryInformationFile
(
handle2
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
todo_wine
ok
(
fsi
.
DeletePending
,
"Handle should be marked for deletion
\n
"
);
fdi
.
DoDeleteFile
=
FALSE
;
res
=
NtSetInformationFile
(
handle2
,
&
io
,
&
fdi
,
sizeof
(
fdi
),
FileDispositionInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
res
=
NtQueryInformationFile
(
handle
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
CloseHandle
(
handle
);
CloseHandle
(
handle2
);
res
=
GetFileAttributesA
(
buffer
);
todo_wine
ok
(
res
!=
INVALID_FILE_ATTRIBUTES
,
"expected file to exist
\n
"
);
/* pending delete flag is shared across handles (even after closing) */
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
FILE_SHARE_DELETE
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
res
=
NtQueryInformationFile
(
handle
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
handle2
=
CreateFileA
(
buffer
,
DELETE
,
FILE_SHARE_DELETE
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
handle2
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
res
=
NtQueryInformationFile
(
handle2
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
res
=
NtSetInformationFile
(
handle
,
&
io
,
&
fdi
,
sizeof
(
fdi
),
FileDispositionInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
res
=
NtQueryInformationFile
(
handle2
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
todo_wine
ok
(
fsi
.
DeletePending
,
"Handle should be marked for deletion
\n
"
);
fdi
.
DoDeleteFile
=
FALSE
;
res
=
NtSetInformationFile
(
handle2
,
&
io
,
&
fdi
,
sizeof
(
fdi
),
FileDispositionInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
CloseHandle
(
handle2
);
res
=
NtQueryInformationFile
(
handle
,
&
io
,
&
fsi
,
sizeof
(
fsi
),
FileStandardInformation
);
ok
(
res
==
STATUS_SUCCESS
,
"NtQueryInformationFile failed %lx
\n
"
,
res
);
ok
(
!
fsi
.
DeletePending
,
"Handle shouldn't be marked for deletion
\n
"
);
CloseHandle
(
handle
);
res
=
GetFileAttributesA
(
buffer
);
todo_wine
ok
(
res
!=
INVALID_FILE_ATTRIBUTES
,
"expected file to exist
\n
"
);
}
static
void
test_file_name_information
(
void
)
...
...
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