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
a9c3195e
Commit
a9c3195e
authored
Oct 06, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Oct 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add package validation tests.
parent
ca7cd1bf
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
189 additions
and
7 deletions
+189
-7
install.c
dlls/msi/tests/install.c
+189
-7
No files found.
dlls/msi/tests/install.c
View file @
a9c3195e
...
...
@@ -61,6 +61,7 @@ static const char *msifile2 = "winetest2.msi";
static
const
char
*
mstfile
=
"winetest.mst"
;
static
CHAR
CURR_DIR
[
MAX_PATH
];
static
CHAR
PROG_FILES_DIR
[
MAX_PATH
];
static
CHAR
PROG_FILES_DIR_NATIVE
[
MAX_PATH
];
static
CHAR
COMMON_FILES_DIR
[
MAX_PATH
];
static
CHAR
APP_DATA_DIR
[
MAX_PATH
];
static
CHAR
WINDOWS_DIR
[
MAX_PATH
];
...
...
@@ -590,6 +591,18 @@ static const CHAR sdp_custom_action_dat[] = "Action\tType\tSource\tTarget\tISCom
"CustomAction
\t
Action
\n
"
"SetDirProperty
\t
51
\t
MSITESTDIR
\t
[CommonFilesFolder]msitest
\\\t\n
"
;
static
const
CHAR
pv_install_exec_seq_dat
[]
=
"Action
\t
Condition
\t
Sequence
\n
"
"s72
\t
S255
\t
I2
\n
"
"InstallExecuteSequence
\t
Action
\n
"
"LaunchConditions
\t\t
100
\n
"
"CostInitialize
\t\t
800
\n
"
"FileCost
\t\t
900
\n
"
"CostFinalize
\t\t
1000
\n
"
"InstallValidate
\t\t
1400
\n
"
"InstallInitialize
\t\t
1500
\n
"
"InstallFiles
\t\t
4000
\n
"
"InstallFinalize
\t\t
6600
\n
"
;
static
const
CHAR
cie_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
"
...
...
@@ -3102,6 +3115,18 @@ static const msi_table icon_base_tables[] =
ADD_TABLE
(
icon_property
),
};
static
const
msi_table
pv_tables
[]
=
{
ADD_TABLE
(
rof_component
),
ADD_TABLE
(
directory
),
ADD_TABLE
(
rof_feature
),
ADD_TABLE
(
rof_feature_comp
),
ADD_TABLE
(
rof_file
),
ADD_TABLE
(
pv_install_exec_seq
),
ADD_TABLE
(
rof_media
),
ADD_TABLE
(
property
)
};
/* cabinet definitions */
/* make the max size large so there is only one cab file */
...
...
@@ -3455,6 +3480,12 @@ static BOOL get_system_dirs(void)
return
FALSE
;
}
size
=
MAX_PATH
;
if
(
RegQueryValueExA
(
hkey
,
"ProgramFilesDir"
,
0
,
&
type
,
(
LPBYTE
)
PROG_FILES_DIR_NATIVE
,
&
size
))
{
RegCloseKey
(
hkey
);
return
FALSE
;
}
RegCloseKey
(
hkey
);
if
(
GetWindowsDirectoryA
(
WINDOWS_DIR
,
MAX_PATH
)
!=
ERROR_SUCCESS
)
...
...
@@ -3519,6 +3550,20 @@ static BOOL delete_pf(const CHAR *rel_path, BOOL is_file)
return
RemoveDirectoryA
(
path
);
}
static
BOOL
delete_pf_native
(
const
CHAR
*
rel_path
,
BOOL
is_file
)
{
CHAR
path
[
MAX_PATH
];
lstrcpyA
(
path
,
PROG_FILES_DIR_NATIVE
);
lstrcatA
(
path
,
"
\\
"
);
lstrcatA
(
path
,
rel_path
);
if
(
is_file
)
return
DeleteFileA
(
path
);
else
return
RemoveDirectoryA
(
path
);
}
static
BOOL
delete_cf
(
const
CHAR
*
rel_path
,
BOOL
is_file
)
{
CHAR
path
[
MAX_PATH
];
...
...
@@ -3558,7 +3603,7 @@ static void write_file(const CHAR *filename, const char *data, int data_size)
CloseHandle
(
hf
);
}
static
void
write_msi_summary_info
(
MSIHANDLE
db
,
INT
wordcount
)
static
void
write_msi_summary_info
(
MSIHANDLE
db
,
INT
version
,
INT
wordcount
,
const
char
*
template
)
{
MSIHANDLE
summary
;
UINT
r
;
...
...
@@ -3566,14 +3611,14 @@ static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
r
=
MsiGetSummaryInformationA
(
db
,
NULL
,
5
,
&
summary
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_TEMPLATE
,
VT_LPSTR
,
0
,
NULL
,
";1033"
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_TEMPLATE
,
VT_LPSTR
,
0
,
NULL
,
template
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_REVNUMBER
,
VT_LPSTR
,
0
,
NULL
,
"{004757CA-5092-49c2-AD20-28E1CE0DF5F2}"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_PAGECOUNT
,
VT_I4
,
100
,
NULL
,
NULL
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_PAGECOUNT
,
VT_I4
,
version
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_WORDCOUNT
,
VT_I4
,
wordcount
,
NULL
,
NULL
);
...
...
@@ -3590,10 +3635,14 @@ static void write_msi_summary_info(MSIHANDLE db, INT wordcount)
}
#define create_database(name, tables, num_tables) \
create_database_wordcount(name, tables, num_tables, 0);
create_database_wordcount(name, tables, num_tables, 100, 0, ";1033");
#define create_database_template(name, tables, num_tables, version, template) \
create_database_wordcount(name, tables, num_tables, version, 0, template);
static
void
create_database_wordcount
(
const
CHAR
*
name
,
const
msi_table
*
tables
,
int
num_tables
,
INT
wordcount
)
int
num_tables
,
INT
version
,
INT
wordcount
,
const
char
*
template
)
{
MSIHANDLE
db
;
UINT
r
;
...
...
@@ -3615,7 +3664,7 @@ static void create_database_wordcount(const CHAR *name, const msi_table *tables,
DeleteFileA
(
table
->
filename
);
}
write_msi_summary_info
(
db
,
wordcount
);
write_msi_summary_info
(
db
,
version
,
wordcount
,
template
);
r
=
MsiDatabaseCommit
(
db
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
...
...
@@ -8509,7 +8558,7 @@ static void test_adminimage(void)
create_database_wordcount
(
msifile
,
ai_tables
,
sizeof
(
ai_tables
)
/
sizeof
(
msi_table
),
msidbSumInfoSourceTypeAdminImage
);
100
,
msidbSumInfoSourceTypeAdminImage
,
";1033"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
...
...
@@ -10706,6 +10755,138 @@ static void test_sourcedir_props(void)
DeleteFile
(
msifile
);
}
static
void
test_package_validation
(
void
)
{
UINT
r
;
BOOL
wow64
=
FALSE
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
if
(
pIsWow64Process
)
pIsWow64Process
(
GetCurrentProcess
(),
&
wow64
);
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
maximus"
,
500
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel;1033"
);
MsiSetInternalUI
(
INSTALLUILEVEL_NONE
,
NULL
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
goto
error
;
}
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file does not exist
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"directory does not exist
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel;9999"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_LANGUAGE_UNSUPPORTED
,
"Expected ERROR_INSTALL_LANGUAGE_UNSUPPORTED, got %u
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel32;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_PLATFORM_UNSUPPORTED
,
"Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
if
(
is_64bit
&&
!
wow64
)
{
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file does not exist
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"directory does not exist
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_PACKAGE_INVALID
,
"Expected ERROR_INSTALL_PACKAGE_INVALID, got %u
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
200
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file does not exist
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"directory does not exist
\n
"
);
}
else
if
(
wow64
)
{
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file does not exist
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"directory does not exist
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_PACKAGE_INVALID
,
"Expected ERROR_INSTALL_PACKAGE_INVALID,, got %u
\n
"
,
r
);
ok
(
!
delete_pf_native
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf_native
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
200
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf_native
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
delete_pf_native
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
}
else
{
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"Intel;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file does not exist
\n
"
);
ok
(
delete_pf
(
"msitest"
,
FALSE
),
"directory does not exist
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
100
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_PLATFORM_UNSUPPORTED
,
"Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
DeleteFile
(
msifile
);
create_database_template
(
msifile
,
pv_tables
,
sizeof
(
pv_tables
)
/
sizeof
(
msi_table
),
200
,
"x64;0"
);
r
=
MsiInstallProductA
(
msifile
,
NULL
);
ok
(
r
==
ERROR_INSTALL_PLATFORM_UNSUPPORTED
,
"Expected ERROR_INSTALL_PLATFORM_UNSUPPORTED, got %u
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
maximus"
,
TRUE
),
"file exists
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"directory exists
\n
"
);
}
error:
/* Delete the files in the temp (current) folder */
DeleteFile
(
msifile
);
DeleteFile
(
"msitest
\\
maximus"
);
RemoveDirectory
(
"msitest"
);
}
START_TEST
(
install
)
{
DWORD
len
;
...
...
@@ -10819,6 +11000,7 @@ START_TEST(install)
test_register_mime_info
();
test_icon_table
();
test_sourcedir_props
();
test_package_validation
();
DeleteFileA
(
log_file
);
...
...
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