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
89472db9
Commit
89472db9
authored
Jun 09, 2011
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Create temp files in the destination directory instead of the root.
parent
9059fee7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
23 deletions
+30
-23
files.c
dlls/msi/files.c
+14
-11
media.c
dlls/msi/media.c
+16
-12
No files found.
dlls/msi/files.c
View file @
89472db9
...
...
@@ -195,23 +195,25 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
}
if
(
gle
==
ERROR_SHARING_VIOLATION
||
gle
==
ERROR_USER_MAPPED_FILE
)
{
WCHAR
tmpfileW
[
MAX_PATH
]
,
*
pathW
,
*
p
;
WCHAR
*
tmpfileW
,
*
pathW
,
*
p
;
DWORD
len
;
TRACE
(
"file in use, scheduling rename operation
\n
"
);
GetTempFileNameW
(
szBackSlash
,
szMsi
,
0
,
tmpfileW
);
len
=
strlenW
(
file
->
TargetPath
)
+
strlenW
(
tmpfileW
)
+
1
;
if
(
!
(
pathW
=
msi_alloc
(
len
*
sizeof
(
WCHAR
))))
return
ERROR_OUTOFMEMORY
;
strcpyW
(
pathW
,
file
->
TargetPath
);
if
(
!
(
pathW
=
strdupW
(
file
->
TargetPath
)))
return
ERROR_OUTOFMEMORY
;
if
((
p
=
strrchrW
(
pathW
,
'\\'
)))
*
p
=
0
;
strcatW
(
pathW
,
tmpfileW
);
len
=
strlenW
(
pathW
)
+
16
;
if
(
!
(
tmpfileW
=
msi_alloc
(
len
*
sizeof
(
WCHAR
))))
{
msi_free
(
pathW
);
return
ERROR_OUTOFMEMORY
;
}
if
(
!
GetTempFileNameW
(
pathW
,
szMsi
,
0
,
tmpfileW
))
tmpfileW
[
0
]
=
0
;
msi_free
(
pathW
);
if
(
CopyFileW
(
source
,
path
W
,
FALSE
)
&&
if
(
CopyFileW
(
source
,
tmpfile
W
,
FALSE
)
&&
MoveFileExW
(
file
->
TargetPath
,
NULL
,
MOVEFILE_DELAY_UNTIL_REBOOT
)
&&
MoveFileExW
(
path
W
,
file
->
TargetPath
,
MOVEFILE_DELAY_UNTIL_REBOOT
))
MoveFileExW
(
tmpfile
W
,
file
->
TargetPath
,
MOVEFILE_DELAY_UNTIL_REBOOT
))
{
file
->
state
=
msifs_installed
;
package
->
need_reboot
=
1
;
...
...
@@ -221,8 +223,9 @@ static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source)
{
gle
=
GetLastError
();
WARN
(
"failed to schedule rename operation: %d)
\n
"
,
gle
);
DeleteFileW
(
tmpfileW
);
}
msi_free
(
path
W
);
msi_free
(
tmpfile
W
);
}
return
gle
;
...
...
dlls/msi/media.c
View file @
89472db9
...
...
@@ -458,32 +458,36 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
}
if
(
err
==
ERROR_SHARING_VIOLATION
||
err
==
ERROR_USER_MAPPED_FILE
)
{
WCHAR
tmpfileW
[
MAX_PATH
]
,
*
tmppathW
,
*
p
;
WCHAR
*
tmpfileW
,
*
tmppathW
,
*
p
;
DWORD
len
;
TRACE
(
"file in use, scheduling rename operation
\n
"
);
GetTempFileNameW
(
szBackSlash
,
szMsi
,
0
,
tmpfileW
);
len
=
strlenW
(
path
)
+
strlenW
(
tmpfileW
)
+
1
;
if
(
!
(
tmppathW
=
msi_alloc
(
len
*
sizeof
(
WCHAR
))))
return
ERROR_OUTOFMEMORY
;
strcpyW
(
tmppathW
,
path
);
if
(
!
(
tmppathW
=
strdupW
(
path
)))
return
ERROR_OUTOFMEMORY
;
if
((
p
=
strrchrW
(
tmppathW
,
'\\'
)))
*
p
=
0
;
strcatW
(
tmppathW
,
tmpfileW
);
len
=
strlenW
(
tmppathW
)
+
16
;
if
(
!
(
tmpfileW
=
msi_alloc
(
len
*
sizeof
(
WCHAR
))))
{
msi_free
(
tmppathW
);
return
ERROR_OUTOFMEMORY
;
}
if
(
!
GetTempFileNameW
(
tmppathW
,
szMsi
,
0
,
tmpfileW
))
tmpfileW
[
0
]
=
0
;
msi_free
(
tmppathW
);
handle
=
CreateFileW
(
tmp
path
W
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
attrs
,
NULL
);
handle
=
CreateFileW
(
tmp
file
W
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
attrs
,
NULL
);
if
(
handle
!=
INVALID_HANDLE_VALUE
&&
MoveFileExW
(
path
,
NULL
,
MOVEFILE_DELAY_UNTIL_REBOOT
)
&&
MoveFileExW
(
tmp
path
W
,
path
,
MOVEFILE_DELAY_UNTIL_REBOOT
))
MoveFileExW
(
tmp
file
W
,
path
,
MOVEFILE_DELAY_UNTIL_REBOOT
))
{
data
->
package
->
need_reboot
=
1
;
}
else
{
WARN
(
"failed to schedule rename operation %s (error %d)
\n
"
,
debugstr_w
(
path
),
GetLastError
());
msi_free
(
tmppathW
);
DeleteFileW
(
tmpfileW
);
}
msi_free
(
tmpfileW
);
}
else
WARN
(
"failed to create %s (error %d)
\n
"
,
debugstr_w
(
path
),
err
);
...
...
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