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
86a75534
Commit
86a75534
authored
Nov 21, 1999
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed MoveFileExA behavior when target file does not exist.
parent
0107f35a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
36 deletions
+42
-36
file.c
files/file.c
+42
-36
No files found.
files/file.c
View file @
86a75534
...
@@ -1640,39 +1640,65 @@ DWORD WINAPI GetFileType( HANDLE hFile )
...
@@ -1640,39 +1640,65 @@ DWORD WINAPI GetFileType( HANDLE hFile )
/**************************************************************************
/**************************************************************************
* MoveFileEx
32
A (KERNEL32.???)
* MoveFileExA (KERNEL32.???)
*/
*/
BOOL
WINAPI
MoveFileExA
(
LPCSTR
fn1
,
LPCSTR
fn2
,
DWORD
flag
)
BOOL
WINAPI
MoveFileExA
(
LPCSTR
fn1
,
LPCSTR
fn2
,
DWORD
flag
)
{
{
DOS_FULL_NAME
full_name1
,
full_name2
;
DOS_FULL_NAME
full_name1
,
full_name2
;
int
mode
=
0
;
/* mode == 1: use copy */
TRACE
(
"(%s,%s,%04lx)
\n
"
,
fn1
,
fn2
,
flag
);
TRACE
(
"(%s,%s,%04lx)
\n
"
,
fn1
,
fn2
,
flag
);
if
(
!
DOSFS_GetFullName
(
fn1
,
TRUE
,
&
full_name1
))
return
FALSE
;
if
(
!
DOSFS_GetFullName
(
fn1
,
TRUE
,
&
full_name1
))
return
FALSE
;
if
(
fn2
)
{
/* !fn2 means delete fn1 */
if
(
!
DOSFS_GetFullName
(
fn2
,
FALSE
,
&
full_name2
))
return
FALSE
;
if
(
fn2
)
/* !fn2 means delete fn1 */
{
if
(
DOSFS_GetFullName
(
fn2
,
TRUE
,
&
full_name2
))
{
/* target exists, check if we may overwrite */
if
(
!
(
flag
&
MOVEFILE_REPLACE_EXISTING
))
{
/* FIXME: Use right error code */
SetLastError
(
ERROR_ACCESS_DENIED
);
return
FALSE
;
}
}
else
if
(
!
DOSFS_GetFullName
(
fn2
,
FALSE
,
&
full_name2
))
return
FALSE
;
/* Source name and target path are valid */
/* Source name and target path are valid */
if
(
full_name1
.
drive
!=
full_name2
.
drive
)
if
(
flag
&
MOVEFILE_DELAY_UNTIL_REBOOT
)
{
/* FIXME: (bon@elektron.ikp.physik.th-darmstadt.de 970706)
Perhaps we should queue these command and execute it
when exiting... What about using on_exit(2)
*/
FIXME
(
"Please move existing file '%s' to file '%s' when Wine has finished
\n
"
,
full_name1
.
long_name
,
full_name2
.
long_name
);
return
TRUE
;
}
if
(
full_name1
.
drive
!=
full_name2
.
drive
)
{
{
/* use copy, if allowed */
/* use copy, if allowed */
if
(
!
(
flag
&
MOVEFILE_COPY_ALLOWED
))
{
if
(
!
(
flag
&
MOVEFILE_COPY_ALLOWED
))
{
/* FIXME: Use right error code */
/* FIXME: Use right error code */
SetLastError
(
ERROR_FILE_EXISTS
);
SetLastError
(
ERROR_FILE_EXISTS
);
return
FALSE
;
return
FALSE
;
}
}
else
mode
=
1
;
return
CopyFileA
(
fn1
,
fn2
,
!
(
flag
&
MOVEFILE_REPLACE_EXISTING
)
)
;
}
}
if
(
DOSFS_GetFullName
(
fn2
,
TRUE
,
&
full_name2
))
if
(
rename
(
full_name1
.
long_name
,
full_name2
.
long_name
)
==
-
1
)
/* target exists, check if we may overwrite */
{
if
(
!
(
flag
&
MOVEFILE_REPLACE_EXISTING
))
{
FILE_SetDosError
();
/* FIXME: Use right error code */
SetLastError
(
ERROR_ACCESS_DENIED
);
return
FALSE
;
return
FALSE
;
}
}
return
TRUE
;
}
}
else
/* fn2 == NULL means delete source */
else
/* fn2 == NULL means delete source */
if
(
flag
&
MOVEFILE_DELAY_UNTIL_REBOOT
)
{
{
if
(
flag
&
MOVEFILE_DELAY_UNTIL_REBOOT
)
{
if
(
flag
&
MOVEFILE_COPY_ALLOWED
)
{
if
(
flag
&
MOVEFILE_COPY_ALLOWED
)
{
WARN
(
"Illegal flag
\n
"
);
WARN
(
"Illegal flag
\n
"
);
SetLastError
(
ERROR_GEN_FAILURE
);
SetLastError
(
ERROR_GEN_FAILURE
);
...
@@ -1686,34 +1712,14 @@ BOOL WINAPI MoveFileExA( LPCSTR fn1, LPCSTR fn2, DWORD flag )
...
@@ -1686,34 +1712,14 @@ BOOL WINAPI MoveFileExA( LPCSTR fn1, LPCSTR fn2, DWORD flag )
full_name1
.
long_name
);
full_name1
.
long_name
);
return
TRUE
;
return
TRUE
;
}
}
else
if
(
unlink
(
full_name1
.
long_name
)
==
-
1
)
{
FILE_SetDosError
();
return
FALSE
;
}
else
return
TRUE
;
/* successfully deleted */
if
(
flag
&
MOVEFILE_DELAY_UNTIL_REBOOT
)
{
if
(
unlink
(
full_name1
.
long_name
)
==
-
1
)
/* FIXME: (bon@elektron.ikp.physik.th-darmstadt.de 970706)
Perhaps we should queue these command and execute it
when exiting... What about using on_exit(2)
*/
FIXME
(
"Please move existing file '%s' to file '%s'"
"when Wine has finished
\n
"
,
full_name1
.
long_name
,
full_name2
.
long_name
);
return
TRUE
;
}
if
(
!
mode
)
/* move the file */
if
(
rename
(
full_name1
.
long_name
,
full_name2
.
long_name
)
==
-
1
)
{
{
FILE_SetDosError
();
FILE_SetDosError
();
return
FALSE
;
return
FALSE
;
}
}
else
return
TRUE
;
return
TRUE
;
/* successfully deleted */
else
/* copy File */
}
return
CopyFileA
(
fn1
,
fn2
,
(
!
(
flag
&
MOVEFILE_REPLACE_EXISTING
)));
}
}
/**************************************************************************
/**************************************************************************
...
...
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