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
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
8 deletions
+20
-8
file.c
dlls/kernel32/tests/file.c
+20
-8
No files found.
dlls/kernel32/tests/file.c
View file @
705cdc88
...
@@ -2132,7 +2132,7 @@ static void test_ReplaceFileA(void)
...
@@ -2132,7 +2132,7 @@ static void test_ReplaceFileA(void)
static
const
char
prefix
[]
=
"pfx"
;
static
const
char
prefix
[]
=
"pfx"
;
char
temp_path
[
MAX_PATH
];
char
temp_path
[
MAX_PATH
];
DWORD
ret
;
DWORD
ret
;
BOOL
retok
;
BOOL
retok
,
removeBackup
=
FALSE
;
if
(
!
pReplaceFileA
)
if
(
!
pReplaceFileA
)
{
{
...
@@ -2252,7 +2252,8 @@ static void test_ReplaceFileA(void)
...
@@ -2252,7 +2252,8 @@ static void test_ReplaceFileA(void)
*/
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
NULL
,
0
,
0
,
0
);
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) */
/* re-create replacement file for pass w/ backup (backup-file not existing) */
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
...
@@ -2264,13 +2265,17 @@ static void test_ReplaceFileA(void)
...
@@ -2264,13 +2265,17 @@ static void test_ReplaceFileA(void)
*/
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
backup
,
0
,
0
,
0
);
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" */
/* re-create replacement file for pass w/ no permissions to "replaced" */
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
ret
=
GetTempFileNameA
(
temp_path
,
prefix
,
0
,
replacement
);
ok
(
ret
!=
0
,
"GetTempFileNameA error (replacement) %d
\n
"
,
GetLastError
());
ok
(
ret
!=
0
,
"GetTempFileNameA error (replacement) %d
\n
"
,
GetLastError
());
ret
=
SetFileAttributesA
(
replaced
,
FILE_ATTRIBUTE_READONLY
);
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")
/* perform replacement w/ backup (no permission to "replaced")
* TODO: flags are not implemented
* TODO: flags are not implemented
*/
*/
...
@@ -2284,17 +2289,20 @@ static void test_ReplaceFileA(void)
...
@@ -2284,17 +2289,20 @@ static void test_ReplaceFileA(void)
"unexpected error, replacement file should still exist %d
\n
"
,
GetLastError
());
"unexpected error, replacement file should still exist %d
\n
"
,
GetLastError
());
CloseHandle
(
hReplacementFile
);
CloseHandle
(
hReplacementFile
);
ret
=
SetFileAttributesA
(
replaced
,
FILE_ATTRIBUTE_NORMAL
);
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" */
/* replacement file still exists, make pass w/o "replaced" */
ret
=
DeleteFileA
(
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")
/* perform replacement w/ backup (no pre-existing backup or "replaced")
* TODO: flags are not implemented
* TODO: flags are not implemented
*/
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
backup
,
0
,
0
,
0
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
backup
,
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
());
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
/* perform replacement w/o existing "replacement" file
/* perform replacement w/o existing "replacement" file
...
@@ -2302,7 +2310,8 @@ static void test_ReplaceFileA(void)
...
@@ -2302,7 +2310,8 @@ static void test_ReplaceFileA(void)
*/
*/
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
pReplaceFileA
(
replaced
,
replacement
,
NULL
,
0
,
0
,
0
);
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
());
"ReplaceFileA: unexpected error %d
\n
"
,
GetLastError
());
/*
/*
...
@@ -2312,10 +2321,13 @@ static void test_ReplaceFileA(void)
...
@@ -2312,10 +2321,13 @@ static void test_ReplaceFileA(void)
*/
*/
/* delete temporary files, replacement and replaced are already deleted */
/* delete temporary files, replacement and replaced are already deleted */
if
(
removeBackup
)
{
ret
=
DeleteFileA
(
backup
);
ret
=
DeleteFileA
(
backup
);
ok
(
ret
||
ok
(
ret
||
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
/* win2k */
broken
(
GetLastError
()
==
ERROR_ACCESS_DENIED
),
/* win2k */
"DeleteFileA: error (backup) %d
\n
"
,
GetLastError
());
"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