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
705cdc88
Commit
705cdc88
authored
Feb 12, 2009
by
Juan Lang
Committed by
Alexandre Julliard
Feb 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Fix some more failures on systems with reduced privilege.
parent
5dd87ec9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
13 deletions
+25
-13
file.c
dlls/kernel32/tests/file.c
+25
-13
No files found.
dlls/kernel32/tests/file.c
View file @
705cdc88
...
...
@@ -2132,7 +2132,7 @@ static void test_ReplaceFileA(void)
static
const
char
prefix
[]
=
"pfx"
;
char
temp_path
[
MAX_PATH
];
DWORD
ret
;
BOOL
retok
;
BOOL
retok
,
removeBackup
=
FALSE
;
if
(
!
pReplaceFileA
)
{
...
...
@@ -2252,7 +2252,8 @@ static void test_ReplaceFileA(void)
*/
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
NULL
,
0
,
0
,
0
);
ok
(
ret
,
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
/* re-create replacement file for pass w/ backup (backup-file not existing) */
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
...
...
@@ -2264,13 +2265,17 @@ static void test_ReplaceFileA(void)
*/
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
backup
,
0
,
0
,
0
);
ok
(
ret
,
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
if
(
ret
)
removeBackup
=
TRUE
;
/* re-create replacement file for pass w/ no permissions to "replaced" */
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
ok
(
ret
!=
0
,
"GetTempFileNameA error (replacement) %d
\n
"
,
GetLastError
());
ret
=
SetFileAttributesA
(
replaced
,
FILE_ATTRIBUTE_READONLY
);
ok
(
ret
,
"SetFileAttributesA: error setting to read only %d
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"SetFileAttributesA: error setting to read only %d
\n
"
,
GetLastError
());
/* perform replacement w/ backup (no permission to "replaced")
* TODO: flags are not implemented
*/
...
...
@@ -2284,25 +2289,29 @@ static void test_ReplaceFileA(void)
"unexpected error, replacement file should still exist %d
\n
"
,
GetLastError
());
CloseHandle
(
hReplacementFile
);
ret
=
SetFileAttributesA
(
replaced
,
FILE_ATTRIBUTE_NORMAL
);
ok
(
ret
,
"SetFileAttributesA: error setting to normal %d
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"SetFileAttributesA: error setting to normal %d
\n
"
,
GetLastError
());
/* replacement file still exists, make pass w/o "replaced" */
ret
=
DeleteFileA
(
replaced
);
ok
(
ret
,
"DeleteFileA: error (replaced) %d
\n
"
,
GetLastError
());
ok
(
ret
||
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"DeleteFileA: error (replaced) %d
\n
"
,
GetLastError
());
/* perform replacement w/ backup (no pre-existing backup or "replaced")
* TODO: flags are not implemented
*/
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
backup
,
0
,
0
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
||
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
/* perform replacement w/o existing "replacement" file
* TODO: flags are not implemented
*/
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
NULL
,
0
,
0
,
0
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
||
GetLastError
()
==
ERROR_ACCESS_DENIED
),
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
/*
...
...
@@ -2312,10 +2321,13 @@ static void test_ReplaceFileA(void)
*/
/* delete temporary files, replacement and replaced are already deleted */
ret
=
DeleteFileA
(
backup
);
ok
(
ret
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
/* win2k */
"DeleteFileA: error (backup) %d
\n
"
,
GetLastError
());
if
(
removeBackup
)
{
ret
=
DeleteFileA
(
backup
);
ok
(
ret
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
/* win2k */
"DeleteFileA: error (backup) %d
\n
"
,
GetLastError
());
}
}
/*
...
...
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