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
e98a52e5
Commit
e98a52e5
authored
Sep 09, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Force overwriting of read-only files when extracting a cabinet, with tests.
parent
bab99e53
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
4 deletions
+84
-4
media.c
dlls/msi/media.c
+12
-4
install.c
dlls/msi/tests/install.c
+72
-0
No files found.
dlls/msi/media.c
View file @
e98a52e5
...
...
@@ -333,11 +333,19 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint,
NULL
,
CREATE_ALWAYS
,
attrs
,
NULL
);
if
(
handle
==
INVALID_HANDLE_VALUE
)
{
if
(
GetFileAttributesW
(
path
)
==
INVALID_FILE_ATTRIBUTES
)
ERR
(
"failed to create %s (error %d)
\n
"
,
debugstr_w
(
path
),
GetLastError
());
DWORD
err
=
GetLastError
();
DWORD
attrs
=
GetFileAttributesW
(
path
);
goto
done
;
if
(
attrs
==
INVALID_FILE_ATTRIBUTES
)
ERR
(
"failed to create %s (error %d)
\n
"
,
debugstr_w
(
path
),
err
);
else
if
(
err
==
ERROR_ACCESS_DENIED
&&
(
attrs
&
FILE_ATTRIBUTE_READONLY
))
{
TRACE
(
"removing read-only attribute on %s
\n
"
,
debugstr_w
(
path
));
SetFileAttributesW
(
path
,
attrs
&
~
FILE_ATTRIBUTE_READONLY
);
handle
=
CreateFileW
(
path
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
attrs
,
NULL
);
}
else
WARN
(
"failed to create %s (error %d)
\n
"
,
debugstr_w
(
path
),
err
);
}
done:
...
...
dlls/msi/tests/install.c
View file @
e98a52e5
...
...
@@ -381,6 +381,16 @@ static const CHAR rof_media_dat[] = "DiskId\tLastSequence\tDiskPrompt\tCabinet\t
"Media
\t
DiskId
\n
"
"1
\t
1
\t\t\t
DISK1
\t\n
"
;
static
const
CHAR
rofc_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
16384
\t
1"
;
static
const
CHAR
rofc_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
test1.cab
\t
DISK1
\t\n
"
;
static
const
CHAR
sdp_install_exec_seq_dat
[]
=
"Action
\t
Condition
\t
Sequence
\n
"
"s72
\t
S255
\t
I2
\n
"
"InstallExecuteSequence
\t
Action
\n
"
...
...
@@ -1078,6 +1088,18 @@ static const msi_table rof_tables[] =
ADD_TABLE
(
property
),
};
static
const
msi_table
rofc_tables
[]
=
{
ADD_TABLE
(
rof_component
),
ADD_TABLE
(
directory
),
ADD_TABLE
(
rof_feature
),
ADD_TABLE
(
rof_feature_comp
),
ADD_TABLE
(
rofc_file
),
ADD_TABLE
(
install_exec_seq
),
ADD_TABLE
(
rofc_media
),
ADD_TABLE
(
property
),
};
static
const
msi_table
sdp_tables
[]
=
{
ADD_TABLE
(
rof_component
),
...
...
@@ -2578,6 +2600,55 @@ static void test_readonlyfile(void)
DeleteFile
(
msifile
);
}
static
void
test_readonlyfile_cab
(
void
)
{
UINT
r
;
DWORD
size
;
HANDLE
file
;
CHAR
path
[
MAX_PATH
];
CHAR
buf
[
16
];
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"maximus"
,
500
);
create_cab_file
(
"test1.cab"
,
MEDIA_SIZE
,
"maximus
\0
"
);
DeleteFile
(
"maximus"
);
create_database
(
msifile
,
rofc_tables
,
sizeof
(
rofc_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
);
WriteFile
(
file
,
"readonlyfile"
,
strlen
(
"readonlyfile"
),
&
size
,
NULL
);
CloseHandle
(
file
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
memset
(
buf
,
0
,
sizeof
(
buf
)
);
if
((
file
=
CreateFile
(
path
,
GENERIC_READ
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_EXISTING
,
0
,
NULL
))
!=
INVALID_HANDLE_VALUE
)
{
ReadFile
(
file
,
buf
,
sizeof
(
buf
)
-
1
,
&
size
,
NULL
);
CloseHandle
(
file
);
}
ok
(
!
lstrcmp
(
buf
,
"maximus"
),
"Expected file to be overwritten, got '%s'
\n
"
,
buf
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"File not installed
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"File not installed
\n
"
);
/* Delete the files in the temp (current) folder */
delete_cab_files
();
DeleteFile
(
"msitest
\\
maximus"
);
RemoveDirectory
(
"msitest"
);
DeleteFile
(
msifile
);
}
static
void
test_setdirproperty
(
void
)
{
UINT
r
;
...
...
@@ -6160,6 +6231,7 @@ START_TEST(install)
test_samesequence
();
test_uiLevelFlags
();
test_readonlyfile
();
test_readonlyfile_cab
();
test_setdirproperty
();
test_cabisextracted
();
test_concurrentinstall
();
...
...
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