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
45448262
Commit
45448262
authored
Sep 24, 2013
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Sep 24, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Use official path for temporary files instead of current directory.
parent
cccba760
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
file.c
dlls/ntdll/tests/file.c
+12
-10
No files found.
dlls/ntdll/tests/file.c
View file @
45448262
...
...
@@ -1344,7 +1344,7 @@ static void test_file_both_information(void)
static
void
test_file_disposition_information
(
void
)
{
char
buffer
[
MAX_PATH
+
16
];
char
tmp_path
[
MAX_PATH
],
buffer
[
MAX_PATH
+
16
];
DWORD
dirpos
;
HANDLE
handle
,
handle2
;
NTSTATUS
res
;
...
...
@@ -1352,8 +1352,10 @@ static void test_file_disposition_information(void)
FILE_DISPOSITION_INFORMATION
fdi
;
BOOL
fileDeleted
;
GetTempPathA
(
MAX_PATH
,
tmp_path
);
/* cannot set disposition on file not opened with delete access */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
res
=
pNtQueryInformationFile
(
handle
,
&
io
,
&
fdi
,
sizeof
fdi
,
FileDispositionInformation
);
...
...
@@ -1368,7 +1370,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* can set disposition on file opened with proper access */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
...
...
@@ -1382,7 +1384,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* cannot set disposition on readonly file */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_READONLY
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
...
...
@@ -1396,7 +1398,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* can set disposition on file and then reset it */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
TRUE
;
...
...
@@ -1413,7 +1415,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* Delete-on-close flag doesn't change file disposition until a handle is closed */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
fdi
.
DoDeleteFile
=
FALSE
;
...
...
@@ -1426,7 +1428,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* Delete-on-close flag sets disposition when a handle is closed and then it could be changed back */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
handle
=
CreateFileA
(
buffer
,
GENERIC_WRITE
|
DELETE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_FLAG_DELETE_ON_CLOSE
,
0
);
ok
(
handle
!=
INVALID_HANDLE_VALUE
,
"failed to create temp file
\n
"
);
ok
(
DuplicateHandle
(
GetCurrentProcess
(),
handle
,
GetCurrentProcess
(),
&
handle2
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
),
"DuplicateHandle failed
\n
"
);
...
...
@@ -1441,7 +1443,7 @@ static void test_file_disposition_information(void)
DeleteFileA
(
buffer
);
/* can set disposition on a directory opened with proper access */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
DeleteFileA
(
buffer
);
ok
(
CreateDirectoryA
(
buffer
,
NULL
),
"CreateDirectory failed
\n
"
);
handle
=
CreateFileA
(
buffer
,
DELETE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
);
...
...
@@ -1457,7 +1459,7 @@ static void test_file_disposition_information(void)
RemoveDirectoryA
(
buffer
);
/* RemoveDirectory sets directory disposition and it can be undone */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
DeleteFileA
(
buffer
);
ok
(
CreateDirectoryA
(
buffer
,
NULL
),
"CreateDirectory failed
\n
"
);
handle
=
CreateFileA
(
buffer
,
DELETE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
);
...
...
@@ -1473,7 +1475,7 @@ static void test_file_disposition_information(void)
RemoveDirectoryA
(
buffer
);
/* cannot set disposition on a non-empty directory */
GetTempFileNameA
(
"."
,
"dis"
,
0
,
buffer
);
GetTempFileNameA
(
tmp_path
,
"dis"
,
0
,
buffer
);
DeleteFileA
(
buffer
);
ok
(
CreateDirectoryA
(
buffer
,
NULL
),
"CreateDirectory failed
\n
"
);
handle
=
CreateFileA
(
buffer
,
DELETE
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_FLAG_BACKUP_SEMANTICS
,
0
);
...
...
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