Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ba40c463
Commit
ba40c463
authored
Feb 26, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Feb 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Overwrite an existing read-only file when copying the install file.
parent
a40d6871
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
6 deletions
+110
-6
files.c
dlls/msi/files.c
+22
-6
install.c
dlls/msi/tests/install.c
+88
-0
No files found.
dlls/msi/files.c
View file @
ba40c463
...
...
@@ -638,13 +638,9 @@ static void schedule_install_files(MSIPACKAGE *package)
}
}
static
UINT
copy_
install_
file
(
MSIFILE
*
file
)
static
UINT
copy_file
(
MSIFILE
*
file
)
{
BOOL
ret
;
UINT
gle
;
TRACE
(
"Copying %s to %s
\n
"
,
debugstr_w
(
file
->
SourcePath
),
debugstr_w
(
file
->
TargetPath
));
ret
=
CopyFileW
(
file
->
SourcePath
,
file
->
TargetPath
,
FALSE
);
if
(
ret
)
...
...
@@ -653,7 +649,20 @@ static UINT copy_install_file(MSIFILE *file)
return
ERROR_SUCCESS
;
}
gle
=
GetLastError
();
return
GetLastError
();
}
static
UINT
copy_install_file
(
MSIFILE
*
file
)
{
UINT
gle
;
TRACE
(
"Copying %s to %s
\n
"
,
debugstr_w
(
file
->
SourcePath
),
debugstr_w
(
file
->
TargetPath
));
gle
=
copy_file
(
file
);
if
(
gle
==
ERROR_SUCCESS
)
return
gle
;
if
(
gle
==
ERROR_ALREADY_EXISTS
&&
file
->
state
==
msifs_overwrite
)
{
TRACE
(
"overwriting existing file
\n
"
);
...
...
@@ -665,6 +674,13 @@ static UINT copy_install_file(MSIFILE *file)
TRACE
(
"Source file not found
\n
"
);
gle
=
ERROR_SUCCESS
;
}
else
if
(
gle
==
ERROR_ACCESS_DENIED
)
{
SetFileAttributesW
(
file
->
TargetPath
,
FILE_ATTRIBUTE_NORMAL
);
gle
=
copy_file
(
file
);
TRACE
(
"Overwriting existing file: %d
\n
"
,
gle
);
}
else
if
(
!
(
file
->
Attributes
&
msidbFileAttributesVital
))
{
TRACE
(
"Ignoring error for nonvital
\n
"
);
...
...
dlls/msi/tests/install.c
View file @
ba40c463
...
...
@@ -241,6 +241,31 @@ static const CHAR ui_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComm
"CustomAction
\t
Action
\n
"
"SetUIProperty
\t
51
\t
HASUIRUN
\t
1
\t\n
"
;
static
const
CHAR
rof_component_dat
[]
=
"Component
\t
ComponentId
\t
Directory_
\t
Attributes
\t
Condition
\t
KeyPath
\n
"
"s72
\t
S38
\t
s72
\t
i2
\t
S255
\t
S72
\n
"
"Component
\t
Component
\n
"
"maximus
\t\t
MSITESTDIR
\t
0
\t
1
\t
maximus
\n
"
;
static
const
CHAR
rof_feature_dat
[]
=
"Feature
\t
Feature_Parent
\t
Title
\t
Description
\t
Display
\t
Level
\t
Directory_
\t
Attributes
\n
"
"s38
\t
S38
\t
L64
\t
L255
\t
I2
\t
i2
\t
S72
\t
i2
\n
"
"Feature
\t
Feature
\n
"
"feature
\t\t\t\t
2
\t
1
\t
TARGETDIR
\t
0"
;
static
const
CHAR
rof_feature_comp_dat
[]
=
"Feature_
\t
Component_
\n
"
"s38
\t
s72
\n
"
"FeatureComponents
\t
Feature_
\t
Component_
\n
"
"feature
\t
maximus"
;
static
const
CHAR
rof_file_dat
[]
=
"File
\t
Component_
\t
FileName
\t
FileSize
\t
Version
\t
Language
\t
Attributes
\t
Sequence
\n
"
"s72
\t
s72
\t
l255
\t
i4
\t
S72
\t
S20
\t
I2
\t
i2
\n
"
"File
\t
File
\n
"
"maximus
\t
maximus
\t
maximus
\t
500
\t\t\t
8192
\t
1"
;
static
const
CHAR
rof_media_dat
[]
=
"DiskId
\t
LastSequence
\t
DiskPrompt
\t
Cabinet
\t
VolumeLabel
\t
Source
\n
"
"i2
\t
i4
\t
L64
\t
S255
\t
S32
\t
S72
\n
"
"Media
\t
DiskId
\n
"
"1
\t
1
\t\t\t
DISK1
\t\n
"
;
typedef
struct
_msi_table
{
const
CHAR
*
filename
;
...
...
@@ -339,6 +364,18 @@ static const msi_table ui_tables[] =
ADD_TABLE
(
property
),
};
static
const
msi_table
rof_tables
[]
=
{
ADD_TABLE
(
rof_component
),
ADD_TABLE
(
directory
),
ADD_TABLE
(
rof_feature
),
ADD_TABLE
(
rof_feature_comp
),
ADD_TABLE
(
rof_file
),
ADD_TABLE
(
install_exec_seq
),
ADD_TABLE
(
rof_media
),
ADD_TABLE
(
property
),
};
/* cabinet definitions */
/* make the max size large so there is only one cab file */
...
...
@@ -1120,6 +1157,56 @@ static void test_uiLevelFlags(void)
DeleteFile
(
msifile
);
}
static
BOOL
file_matches
(
LPSTR
path
)
{
CHAR
buf
[
MAX_PATH
];
HANDLE
file
;
DWORD
size
;
file
=
CreateFile
(
path
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
);
ZeroMemory
(
buf
,
MAX_PATH
);
ReadFile
(
file
,
buf
,
15
,
&
size
,
NULL
);
CloseHandle
(
file
);
return
!
lstrcmp
(
buf
,
"msitest
\\
maximus"
);
}
static
void
test_readonlyfile
(
void
)
{
UINT
r
;
DWORD
size
;
HANDLE
file
;
CHAR
path
[
MAX_PATH
];
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
maximus"
,
500
);
create_database
(
msifile
,
rof_tables
,
sizeof
(
rof_tables
)
/
sizeof
(
msi_table
));
MsiSetInternalUI
(
INSTALLUILEVEL_NONE
,
NULL
);
lstrcpy
(
path
,
PROG_FILES_DIR
);
lstrcat
(
path
,
"
\\
msitest"
);
CreateDirectory
(
path
,
NULL
);
lstrcat
(
path
,
"
\\
maximus"
);
file
=
CreateFile
(
path
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
CREATE_NEW
,
FILE_ATTRIBUTE_READONLY
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
printf
(
"didnt work here: %d
\n
"
,
GetLastError
());
WriteFile
(
file
,
"readonlyfile"
,
20
,
&
size
,
NULL
);
CloseHandle
(
file
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
file_matches
(
path
),
"Expected file to be overwritten
\n
"
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"File not installed
\n
"
);
DeleteFile
(
msifile
);
}
START_TEST
(
install
)
{
DWORD
len
;
...
...
@@ -1145,6 +1232,7 @@ START_TEST(install)
test_mixedmedia
();
test_samesequence
();
test_uiLevelFlags
();
test_readonlyfile
();
SetCurrentDirectoryA
(
prev_path
);
}
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