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
9779c4b5
Commit
9779c4b5
authored
Feb 13, 2013
by
Hans Leidekker
Committed by
Alexandre Julliard
Feb 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi/tests: Move a couple of tests from install.c to msi.c.
parent
9a2688e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
895 additions
and
556 deletions
+895
-556
install.c
dlls/msi/tests/install.c
+9
-556
msi.c
dlls/msi/tests/msi.c
+886
-0
No files found.
dlls/msi/tests/install.c
View file @
9779c4b5
...
...
@@ -36,8 +36,6 @@
static
UINT
(
WINAPI
*
pMsiQueryComponentStateA
)
(
LPCSTR
,
LPCSTR
,
MSIINSTALLCONTEXT
,
LPCSTR
,
INSTALLSTATE
*
);
static
UINT
(
WINAPI
*
pMsiSetExternalUIRecord
)
(
INSTALLUI_HANDLER_RECORD
,
DWORD
,
LPVOID
,
PINSTALLUI_HANDLER_RECORD
);
static
UINT
(
WINAPI
*
pMsiSourceListEnumSourcesA
)
(
LPCSTR
,
LPCSTR
,
MSIINSTALLCONTEXT
,
DWORD
,
DWORD
,
LPSTR
,
LPDWORD
);
static
UINT
(
WINAPI
*
pMsiSourceListGetInfoA
)
...
...
@@ -866,13 +864,13 @@ static const CHAR mcp_feature_comp_dat[] = "Feature_\tComponent_\n"
"heliox
\t
helium
\n
"
"lithia
\t
lithium"
;
static
const
CHAR
mc
om
p_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
"
"hydrogen
\t
hydrogen
\t
hydrogen
\t
0
\t\t\t
8192
\t
1
\n
"
"helium
\t
helium
\t
helium
\t
0
\t\t\t
8192
\t
1
\n
"
"lithium
\t
lithium
\t
lithium
\t
0
\t\t\t
8192
\t
1
\n
"
"beryllium
\t
missingcomp
\t
beryllium
\t
0
\t\t\t
8192
\t
1"
;
static
const
CHAR
mcp_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
"
"hydrogen
\t
hydrogen
\t
hydrogen
\t
0
\t\t\t
8192
\t
1
\n
"
"helium
\t
helium
\t
helium
\t
0
\t\t\t
8192
\t
1
\n
"
"lithium
\t
lithium
\t
lithium
\t
0
\t\t\t
8192
\t
1
\n
"
"beryllium
\t
missingcomp
\t
beryllium
\t
0
\t\t\t
8192
\t
1"
;
static
const
CHAR
ai_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
"
...
...
@@ -1766,19 +1764,7 @@ static const msi_table mcp_tables[] =
ADD_TABLE
(
directory
),
ADD_TABLE
(
mcp_feature
),
ADD_TABLE
(
mcp_feature_comp
),
ADD_TABLE
(
rem_file
),
ADD_TABLE
(
rem_install_exec_seq
),
ADD_TABLE
(
rof_media
),
ADD_TABLE
(
property
),
};
static
const
msi_table
mcomp_tables
[]
=
{
ADD_TABLE
(
mcp_component
),
ADD_TABLE
(
directory
),
ADD_TABLE
(
mcp_feature
),
ADD_TABLE
(
mcp_feature_comp
),
ADD_TABLE
(
mcomp_file
),
ADD_TABLE
(
mcp_file
),
ADD_TABLE
(
rem_install_exec_seq
),
ADD_TABLE
(
rof_media
),
ADD_TABLE
(
property
),
...
...
@@ -2108,7 +2094,6 @@ static void init_functionpointers(void)
trace("GetProcAddress(%s) failed\n", #func);
GET_PROC
(
hmsi
,
MsiQueryComponentStateA
);
GET_PROC
(
hmsi
,
MsiSetExternalUIRecord
);
GET_PROC
(
hmsi
,
MsiSourceListEnumSourcesA
);
GET_PROC
(
hmsi
,
MsiSourceListGetInfoA
);
GET_PROC
(
hmsi
,
MsiGetComponentPathExA
);
...
...
@@ -4806,291 +4791,6 @@ static void test_sourcepath(void)
DeleteFileA
(
msifile
);
}
static
void
test_MsiConfigureProductEx
(
void
)
{
UINT
r
;
LONG
res
;
DWORD
type
,
size
;
HKEY
props
,
source
;
CHAR
keypath
[
MAX_PATH
*
2
],
localpackage
[
MAX_PATH
],
packagename
[
MAX_PATH
];
REGSAM
access
=
KEY_ALL_ACCESS
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
hydrogen"
,
500
);
create_file
(
"msitest
\\
helium"
,
500
);
create_file
(
"msitest
\\
lithium"
,
500
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
if
(
is_wow64
)
access
|=
KEY_WOW64_64KEY
;
MsiSetInternalUI
(
INSTALLUILEVEL_NONE
,
NULL
);
/* NULL szProduct */
r
=
MsiConfigureProductExA
(
NULL
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* empty szProduct */
r
=
MsiConfigureProductExA
(
""
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* garbage szProduct */
r
=
MsiConfigureProductExA
(
"garbage"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid without brackets */
r
=
MsiConfigureProductExA
(
"6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid with brackets */
r
=
MsiConfigureProductExA
(
"{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* same length as guid, but random */
r
=
MsiConfigureProductExA
(
"A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* product not installed yet */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* install the product, per-user unmanaged */
r
=
MsiInstallProductA
(
msifile
,
"INSTALLLEVEL=10 PROPVAR=42"
);
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
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* product is installed per-user managed, remove it */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
/* product has been removed */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %u
\n
"
,
r
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* product is installed machine, remove it */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
/* product has been removed */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %u
\n
"
,
r
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
DeleteFileA
(
msifile
);
/* msifile is removed */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
DeleteFileA
(
msifile
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"84A88FD7F6998CE40A22FB59F6B9C2BB
\\
InstallProperties"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
props
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
props
,
"LocalPackage"
,
NULL
,
&
type
,
(
LPBYTE
)
localpackage
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"C:
\\
idontexist.msi"
,
18
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* LocalPackage is used to find the cached msi package */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INSTALL_SOURCE_ABSENT
,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
RegCloseKey
(
props
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
/* LastUsedSource can be used as a last resort */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
DeleteFileA
(
localpackage
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"84A88FD7F6998CE40A22FB59F6B9C2BB
\\
InstallProperties"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
props
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
props
,
"LocalPackage"
,
NULL
,
&
type
,
(
LPBYTE
)
localpackage
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"C:
\\
idontexist.msi"
,
18
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Classes
\\
Installer
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"84A88FD7F6998CE40A22FB59F6B9C2BB
\\
SourceList"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
source
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
source
,
"PackageName"
,
NULL
,
&
type
,
(
LPBYTE
)
packagename
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
source
,
"PackageName"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"idontexist.msi"
,
15
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* SourceList is altered */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INSTALL_SOURCE_ABSENT
,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* restore PackageName */
res
=
RegSetValueExA
(
source
,
"PackageName"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
packagename
,
lstrlenA
(
packagename
)
+
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* restore LocalPackage */
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
localpackage
,
lstrlenA
(
localpackage
)
+
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* finally remove the product */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
RegCloseKey
(
source
);
RegCloseKey
(
props
);
error:
DeleteFileA
(
"msitest
\\
hydrogen"
);
DeleteFileA
(
"msitest
\\
helium"
);
DeleteFileA
(
"msitest
\\
lithium"
);
RemoveDirectoryA
(
"msitest"
);
DeleteFileA
(
msifile
);
}
static
void
test_missingcomponent
(
void
)
{
UINT
r
;
...
...
@@ -5107,7 +4807,7 @@ static void test_missingcomponent(void)
create_file
(
"msitest
\\
lithium"
,
500
);
create_file
(
"beryllium"
,
500
);
create_database
(
msifile
,
mc
omp_tables
,
sizeof
(
mcom
p_tables
)
/
sizeof
(
msi_table
));
create_database
(
msifile
,
mc
p_tables
,
sizeof
(
mc
p_tables
)
/
sizeof
(
msi_table
));
MsiSetInternalUI
(
INSTALLUILEVEL_NONE
,
NULL
);
...
...
@@ -5832,84 +5532,6 @@ error:
DeleteFile
(
msifile
);
}
static
INT
CALLBACK
handler_a
(
LPVOID
context
,
UINT
type
,
LPCSTR
msg
)
{
return
IDOK
;
}
static
INT
CALLBACK
handler_w
(
LPVOID
context
,
UINT
type
,
LPCWSTR
msg
)
{
return
IDOK
;
}
static
INT
CALLBACK
handler_record
(
LPVOID
context
,
UINT
type
,
MSIHANDLE
record
)
{
return
IDOK
;
}
static
void
test_MsiSetExternalUI
(
void
)
{
INSTALLUI_HANDLERA
ret_a
;
INSTALLUI_HANDLERW
ret_w
;
INSTALLUI_HANDLER_RECORD
prev
;
UINT
error
;
ret_a
=
MsiSetExternalUIA
(
handler_a
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_a
=
MsiSetExternalUIA
(
NULL
,
0
,
NULL
);
ok
(
ret_a
==
handler_a
,
"expected %p, got %p
\n
"
,
handler_a
,
ret_a
);
/* Not present before Installer 3.1 */
if
(
!
pMsiSetExternalUIRecord
)
{
win_skip
(
"MsiSetExternalUIRecord is not available
\n
"
);
return
;
}
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
NULL
,
"expected NULL, got %p
\n
"
,
prev
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
NULL
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
handler_record
,
"expected %p, got %p
\n
"
,
handler_record
,
prev
);
ret_w
=
MsiSetExternalUIW
(
handler_w
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
ret_w
=
MsiSetExternalUIW
(
NULL
,
0
,
NULL
);
ok
(
ret_w
==
handler_w
,
"expected %p, got %p
\n
"
,
handler_w
,
ret_w
);
ret_a
=
MsiSetExternalUIA
(
handler_a
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_w
=
MsiSetExternalUIW
(
handler_w
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
NULL
,
"expected NULL, got %p
\n
"
,
prev
);
ret_a
=
MsiSetExternalUIA
(
NULL
,
0
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_w
=
MsiSetExternalUIW
(
NULL
,
0
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
NULL
,
0
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
handler_record
,
"expected %p, got %p
\n
"
,
handler_record
,
prev
);
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
NULL
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
error
=
pMsiSetExternalUIRecord
(
NULL
,
0
,
NULL
,
NULL
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
}
static
void
test_feature_override
(
void
)
{
UINT
r
;
...
...
@@ -6518,171 +6140,6 @@ static void test_upgrade_code(void)
DeleteFile
(
msifile
);
}
static
void
test_MsiGetFeatureInfo
(
void
)
{
UINT
r
;
MSIHANDLE
package
;
char
title
[
32
],
help
[
32
],
path
[
MAX_PATH
];
DWORD
attrs
,
title_len
,
help_len
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
create_database
(
msifile
,
tables
,
sizeof
(
tables
)
/
sizeof
(
tables
[
0
])
);
strcpy
(
path
,
CURR_DIR
);
strcat
(
path
,
"
\\
"
);
strcat
(
path
,
msifile
);
r
=
MsiOpenPackage
(
path
,
&
package
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
DeleteFileA
(
msifile
);
return
;
}
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
""
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
0
,
"One"
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
r
);
title_len
=
help_len
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
NULL
,
&
title_len
,
NULL
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
15
,
"expected 15, got %u
\n
"
,
help_len
);
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
help_len
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %u
\n
"
,
r
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
15
,
"expected 15, got %u
\n
"
,
help_len
);
attrs
=
0
;
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
sizeof
(
title
);
help_len
=
sizeof
(
help
);
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got %u
\n
"
,
attrs
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
15
,
"expected 15, got %u
\n
"
,
help_len
);
ok
(
!
strcmp
(
title
,
"One"
),
"expected
\"
One
\"
, got
\"
%s
\"\n
"
,
title
);
ok
(
!
strcmp
(
help
,
"The One Feature"
),
"expected
\"
The One Feature
\"
, got
\"
%s
\"\n
"
,
help
);
attrs
=
0
;
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
sizeof
(
title
);
help_len
=
sizeof
(
help
);
r
=
MsiGetFeatureInfoA
(
package
,
"feature"
,
&
attrs
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got %u
\n
"
,
attrs
);
ok
(
!
title_len
,
"expected 0, got %u
\n
"
,
title_len
);
ok
(
!
help_len
,
"expected 0, got %u
\n
"
,
help_len
);
ok
(
!
title
[
0
],
"expected
\"\"
, got
\"
%s
\"\n
"
,
title
);
ok
(
!
help
[
0
],
"expected
\"\"
, got
\"
%s
\"\n
"
,
help
);
MsiCloseHandle
(
package
);
DeleteFileA
(
msifile
);
}
static
void
test_MsiSetFeatureAttributes
(
void
)
{
UINT
r
;
DWORD
attrs
;
char
path
[
MAX_PATH
];
MSIHANDLE
package
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
create_database
(
msifile
,
tables
,
sizeof
(
tables
)
/
sizeof
(
tables
[
0
])
);
strcpy
(
path
,
CURR_DIR
);
strcat
(
path
,
"
\\
"
);
strcat
(
path
,
msifile
);
r
=
MsiOpenPackage
(
path
,
&
package
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
DeleteFileA
(
msifile
);
return
;
}
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %u
\n
"
,
r
);
r
=
MsiDoAction
(
package
,
"CostInitialize"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
0
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
""
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
NULL
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0xdeadbeef
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got 0x%08x
\n
"
,
attrs
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got 0x%08x
\n
"
,
attrs
);
r
=
MsiDoAction
(
package
,
"FileCost"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORSOURCE
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORSOURCE
,
"expected INSTALLFEATUREATTRIBUTE_FAVORSOURCE, got 0x%08x
\n
"
,
attrs
);
r
=
MsiDoAction
(
package
,
"CostFinalize"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"expected ERROR_FUNCTION_FAILED, got %u
\n
"
,
r
);
MsiCloseHandle
(
package
);
DeleteFileA
(
msifile
);
}
static
void
test_mixed_package
(
void
)
{
UINT
r
;
...
...
@@ -6832,7 +6289,6 @@ START_TEST(install)
test_customaction51
();
test_installstate
();
test_sourcepath
();
test_MsiConfigureProductEx
();
test_missingcomponent
();
test_sourcedirprop
();
test_adminimage
();
...
...
@@ -6844,7 +6300,6 @@ START_TEST(install)
test_installed_prop
();
test_file_in_use
();
test_file_in_use_cab
();
test_MsiSetExternalUI
();
test_allusers_prop
();
test_feature_override
();
test_icon_table
();
...
...
@@ -6852,8 +6307,6 @@ START_TEST(install)
test_package_validation
();
test_command_line_parsing
();
test_upgrade_code
();
test_MsiGetFeatureInfo
();
test_MsiSetFeatureAttributes
();
test_mixed_package
();
DeleteFileA
(
log_file
);
...
...
dlls/msi/tests/msi.c
View file @
9779c4b5
...
...
@@ -31,8 +31,14 @@
static
BOOL
is_wow64
;
static
const
char
msifile
[]
=
"winetest.msi"
;
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
WINDOWS_DIR
[
MAX_PATH
];
static
BOOL
(
WINAPI
*
pConvertSidToStringSidA
)(
PSID
,
LPSTR
*
);
static
BOOL
(
WINAPI
*
pOpenProcessToken
)(
HANDLE
,
DWORD
,
PHANDLE
);
static
LONG
(
WINAPI
*
pRegDeleteKeyExA
)(
HKEY
,
LPCSTR
,
REGSAM
,
DWORD
);
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
...
...
@@ -59,6 +65,8 @@ static UINT (WINAPI *pMsiEnumProductsExA)
(
LPCSTR
,
LPCSTR
,
DWORD
,
DWORD
,
CHAR
[
39
],
MSIINSTALLCONTEXT
*
,
LPSTR
,
LPDWORD
);
static
UINT
(
WINAPI
*
pMsiEnumComponentsExA
)
(
LPCSTR
,
DWORD
,
DWORD
,
CHAR
[
39
],
MSIINSTALLCONTEXT
*
,
LPSTR
,
LPDWORD
);
static
UINT
(
WINAPI
*
pMsiSetExternalUIRecord
)
(
INSTALLUI_HANDLER_RECORD
,
DWORD
,
LPVOID
,
PINSTALLUI_HANDLER_RECORD
);
static
void
init_functionpointers
(
void
)
{
...
...
@@ -78,18 +86,313 @@ static void init_functionpointers(void)
GET_PROC
(
hmsi
,
MsiOpenPackageExW
)
GET_PROC
(
hmsi
,
MsiEnumPatchesExA
)
GET_PROC
(
hmsi
,
MsiQueryComponentStateA
)
GET_PROC
(
hmsi
,
MsiSetExternalUIRecord
)
GET_PROC
(
hmsi
,
MsiUseFeatureExA
)
GET_PROC
(
hmsi
,
MsiGetPatchInfoExA
)
GET_PROC
(
hmsi
,
MsiEnumProductsExA
)
GET_PROC
(
hmsi
,
MsiEnumComponentsExA
)
GET_PROC
(
hadvapi32
,
ConvertSidToStringSidA
)
GET_PROC
(
hadvapi32
,
OpenProcessToken
);
GET_PROC
(
hadvapi32
,
RegDeleteKeyExA
)
GET_PROC
(
hkernel32
,
IsWow64Process
)
#undef GET_PROC
}
static
BOOL
get_system_dirs
(
void
)
{
HKEY
hkey
;
DWORD
type
,
size
;
if
(
RegOpenKey
(
HKEY_LOCAL_MACHINE
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion"
,
&
hkey
))
return
FALSE
;
size
=
MAX_PATH
;
if
(
RegQueryValueExA
(
hkey
,
"ProgramFilesDir (x86)"
,
0
,
&
type
,
(
LPBYTE
)
PROG_FILES_DIR
,
&
size
)
&&
RegQueryValueExA
(
hkey
,
"ProgramFilesDir"
,
0
,
&
type
,
(
LPBYTE
)
PROG_FILES_DIR
,
&
size
))
{
RegCloseKey
(
hkey
);
return
FALSE
;
}
size
=
MAX_PATH
;
if
(
RegQueryValueExA
(
hkey
,
"CommonFilesDir (x86)"
,
0
,
&
type
,
(
LPBYTE
)
COMMON_FILES_DIR
,
&
size
)
&&
RegQueryValueExA
(
hkey
,
"CommonFilesDir"
,
0
,
&
type
,
(
LPBYTE
)
COMMON_FILES_DIR
,
&
size
))
{
RegCloseKey
(
hkey
);
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
))
return
FALSE
;
return
TRUE
;
}
static
BOOL
file_exists
(
const
char
*
file
)
{
return
GetFileAttributes
(
file
)
!=
INVALID_FILE_ATTRIBUTES
;
}
static
BOOL
pf_exists
(
const
char
*
file
)
{
char
path
[
MAX_PATH
];
lstrcpyA
(
path
,
PROG_FILES_DIR
);
lstrcatA
(
path
,
"
\\
"
);
lstrcatA
(
path
,
file
);
return
file_exists
(
path
);
}
static
BOOL
delete_pf
(
const
char
*
rel_path
,
BOOL
is_file
)
{
char
path
[
MAX_PATH
];
lstrcpyA
(
path
,
PROG_FILES_DIR
);
lstrcatA
(
path
,
"
\\
"
);
lstrcatA
(
path
,
rel_path
);
if
(
is_file
)
return
DeleteFileA
(
path
);
else
return
RemoveDirectoryA
(
path
);
}
static
BOOL
is_process_limited
(
void
)
{
HANDLE
token
;
TOKEN_ELEVATION_TYPE
type
=
TokenElevationTypeDefault
;
DWORD
size
;
BOOL
ret
;
if
(
!
pOpenProcessToken
)
return
FALSE
;
if
(
!
pOpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
return
FALSE
;
ret
=
GetTokenInformation
(
token
,
TokenElevationType
,
&
type
,
sizeof
(
type
),
&
size
);
CloseHandle
(
token
);
return
(
ret
&&
type
==
TokenElevationTypeLimited
);
}
/* msi database data */
static
const
char
directory_dat
[]
=
"Directory
\t
Directory_Parent
\t
DefaultDir
\n
"
"s72
\t
S72
\t
l255
\n
"
"Directory
\t
Directory
\n
"
"MSITESTDIR
\t
ProgramFilesFolder
\t
msitest
\n
"
"ProgramFilesFolder
\t
TARGETDIR
\t
.
\n
"
"TARGETDIR
\t\t
SourceDir"
;
static
const
char
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
"
"One
\t
{8F5BAEEF-DD92-40AC-9397-BE3CF9F97C81}
\t
MSITESTDIR
\t
2
\t
NOT REINSTALL
\t
one.txt
\n
"
;
static
const
char
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
"
"One
\t\t
One
\t
One
\t
1
\t
3
\t
MSITESTDIR
\t
0
\n
"
"Two
\t\t\t\t
2
\t
1
\t
TARGETDIR
\t
0
\n
"
;
static
const
char
feature_comp_dat
[]
=
"Feature_
\t
Component_
\n
"
"s38
\t
s72
\n
"
"FeatureComponents
\t
Feature_
\t
Component_
\n
"
"One
\t
One
\n
"
;
static
const
char
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
"
"one.txt
\t
One
\t
one.txt
\t
1000
\t\t\t
0
\t
1
\n
"
;
static
const
char
install_exec_seq_dat
[]
=
"Action
\t
Condition
\t
Sequence
\n
"
"s72
\t
S255
\t
I2
\n
"
"InstallExecuteSequence
\t
Action
\n
"
"ValidateProductID
\t\t
700
\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
"
"ProcessComponents
\t\t
1600
\n
"
"UnpublishFeatures
\t\t
1800
\n
"
"RemoveFiles
\t\t
3500
\n
"
"InstallFiles
\t\t
4000
\n
"
"RegisterProduct
\t\t
6100
\n
"
"PublishFeatures
\t\t
6300
\n
"
"PublishProduct
\t\t
6400
\n
"
"InstallFinalize
\t\t
6600"
;
static
const
char
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
"
;
static
const
char
property_dat
[]
=
"Property
\t
Value
\n
"
"s72
\t
l0
\n
"
"Property
\t
Property
\n
"
"INSTALLLEVEL
\t
3
\n
"
"Manufacturer
\t
Wine
\n
"
"ProductCode
\t
{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}
\n
"
"ProductName
\t
MSITEST
\n
"
"ProductVersion
\t
1.1.1
\n
"
"UpgradeCode
\t
{9574448F-9B86-4E07-B6F6-8D199DA12127}
\n
"
"MSIFASTINSTALL
\t
1
\n
"
;
static
const
char
mcp_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
"
"hydrogen
\t
{C844BD1E-1907-4C00-8BC9-150BD70DF0A1}
\t
MSITESTDIR
\t
2
\t\t
hydrogen
\n
"
"helium
\t
{5AD3C142-CEF8-490D-B569-784D80670685}
\t
MSITESTDIR
\t
2
\t\t
helium
\n
"
"lithium
\t
{4AF28FFC-71C7-4307-BDE4-B77C5338F56F}
\t
MSITESTDIR
\t
2
\t
PROPVAR=42
\t
lithium
\n
"
;
static
const
char
mcp_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
"
"hydroxyl
\t\t
hydroxyl
\t
hydroxyl
\t
2
\t
1
\t
TARGETDIR
\t
0
\n
"
"heliox
\t\t
heliox
\t
heliox
\t
2
\t
5
\t
TARGETDIR
\t
0
\n
"
"lithia
\t\t
lithia
\t
lithia
\t
2
\t
10
\t
TARGETDIR
\t
0"
;
static
const
char
mcp_feature_comp_dat
[]
=
"Feature_
\t
Component_
\n
"
"s38
\t
s72
\n
"
"FeatureComponents
\t
Feature_
\t
Component_
\n
"
"hydroxyl
\t
hydrogen
\n
"
"heliox
\t
helium
\n
"
"lithia
\t
lithium"
;
static
const
CHAR
mcp_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
"
"hydrogen
\t
hydrogen
\t
hydrogen
\t
0
\t\t\t
8192
\t
1
\n
"
"helium
\t
helium
\t
helium
\t
0
\t\t\t
8192
\t
1
\n
"
"lithium
\t
lithium
\t
lithium
\t
0
\t\t\t
8192
\t
1"
;
typedef
struct
_msi_table
{
const
CHAR
*
filename
;
const
CHAR
*
data
;
int
size
;
}
msi_table
;
#define ADD_TABLE(x) {#x".idt", x##_dat, sizeof(x##_dat)}
static
const
msi_table
tables
[]
=
{
ADD_TABLE
(
directory
),
ADD_TABLE
(
component
),
ADD_TABLE
(
feature
),
ADD_TABLE
(
feature_comp
),
ADD_TABLE
(
file
),
ADD_TABLE
(
install_exec_seq
),
ADD_TABLE
(
media
),
ADD_TABLE
(
property
),
};
static
const
msi_table
mcp_tables
[]
=
{
ADD_TABLE
(
directory
),
ADD_TABLE
(
mcp_component
),
ADD_TABLE
(
mcp_feature
),
ADD_TABLE
(
mcp_feature_comp
),
ADD_TABLE
(
mcp_file
),
ADD_TABLE
(
install_exec_seq
),
ADD_TABLE
(
media
),
ADD_TABLE
(
property
)
};
static
void
write_file
(
const
CHAR
*
filename
,
const
char
*
data
,
int
data_size
)
{
DWORD
size
;
HANDLE
hf
=
CreateFile
(
filename
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
WriteFile
(
hf
,
data
,
data_size
,
&
size
,
NULL
);
CloseHandle
(
hf
);
}
static
void
write_msi_summary_info
(
MSIHANDLE
db
,
INT
version
,
INT
wordcount
,
const
char
*
template
)
{
MSIHANDLE
summary
;
UINT
r
;
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
,
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
,
version
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_WORDCOUNT
,
VT_I4
,
wordcount
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSummaryInfoSetPropertyA
(
summary
,
PID_TITLE
,
VT_LPSTR
,
0
,
NULL
,
"MSITEST"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
/* write the summary changes back to the stream */
r
=
MsiSummaryInfoPersist
(
summary
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
MsiCloseHandle
(
summary
);
}
#define create_database(name, tables, num_tables) \
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
version
,
INT
wordcount
,
const
char
*
template
)
{
MSIHANDLE
db
;
UINT
r
;
int
j
;
r
=
MsiOpenDatabaseA
(
name
,
MSIDBOPEN_CREATE
,
&
db
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
/* import the tables into the database */
for
(
j
=
0
;
j
<
num_tables
;
j
++
)
{
const
msi_table
*
table
=
&
tables
[
j
];
write_file
(
table
->
filename
,
table
->
data
,
(
table
->
size
-
1
)
*
sizeof
(
char
));
r
=
MsiDatabaseImportA
(
db
,
CURR_DIR
,
table
->
filename
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
DeleteFileA
(
table
->
filename
);
}
write_msi_summary_info
(
db
,
version
,
wordcount
,
template
);
r
=
MsiDatabaseCommit
(
db
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
MsiCloseHandle
(
db
);
}
static
UINT
run_query
(
MSIHANDLE
hdb
,
const
char
*
query
)
{
MSIHANDLE
hview
=
0
;
...
...
@@ -3231,6 +3534,12 @@ static void test_MsiGetProductInfo(void)
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
localkey
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
LocalFree
(
usersid
);
return
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* local user product code exists */
...
...
@@ -7345,6 +7654,12 @@ static void test_MsiGetUserInfo(void)
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
userprod
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
LocalFree
(
usersid
);
return
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegCreateKeyExA
(
userprod
,
"InstallProperties"
,
0
,
NULL
,
0
,
access
,
NULL
,
&
props
,
NULL
);
...
...
@@ -7821,6 +8136,12 @@ static void test_MsiOpenProduct(void)
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
userkey
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
LocalFree
(
usersid
);
return
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* user product key exists */
...
...
@@ -8443,6 +8764,11 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
udprod
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
return
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* UserData product key exists */
...
...
@@ -8901,6 +9227,11 @@ static void test_MsiEnumPatchesEx_userunmanaged(LPCSTR usersid, LPCSTR expecteds
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
udprod
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
goto
error
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* UserData product key exists */
...
...
@@ -10291,6 +10622,12 @@ static void test_MsiEnumPatches(void)
lstrcatA
(
keypath
,
prod_squashed
);
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
prodkey
,
NULL
);
if
(
res
==
ERROR_ACCESS_DENIED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
LocalFree
(
usersid
);
return
;
}
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* local product key exists */
...
...
@@ -12174,13 +12511,556 @@ done:
LocalFree
(
usersid
);
}
static
void
test_MsiConfigureProductEx
(
void
)
{
UINT
r
;
LONG
res
;
DWORD
type
,
size
;
HKEY
props
,
source
;
CHAR
keypath
[
MAX_PATH
*
2
],
localpackage
[
MAX_PATH
],
packagename
[
MAX_PATH
];
REGSAM
access
=
KEY_ALL_ACCESS
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
CreateDirectoryA
(
"msitest"
,
NULL
);
create_file
(
"msitest
\\
hydrogen"
,
"hydrogen"
,
500
);
create_file
(
"msitest
\\
helium"
,
"helium"
,
500
);
create_file
(
"msitest
\\
lithium"
,
"lithium"
,
500
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
if
(
is_wow64
)
access
|=
KEY_WOW64_64KEY
;
MsiSetInternalUI
(
INSTALLUILEVEL_NONE
,
NULL
);
/* NULL szProduct */
r
=
MsiConfigureProductExA
(
NULL
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* empty szProduct */
r
=
MsiConfigureProductExA
(
""
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* garbage szProduct */
r
=
MsiConfigureProductExA
(
"garbage"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid without brackets */
r
=
MsiConfigureProductExA
(
"6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
/* guid with brackets */
r
=
MsiConfigureProductExA
(
"{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* same length as guid, but random */
r
=
MsiConfigureProductExA
(
"A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* product not installed yet */
r
=
MsiConfigureProductExA
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
/* install the product, per-user unmanaged */
r
=
MsiInstallProductA
(
msifile
,
"INSTALLLEVEL=10 PROPVAR=42"
);
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
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* product is installed per-user managed, remove it */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
/* product has been removed */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %u
\n
"
,
r
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* product is installed machine, remove it */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
/* product has been removed */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_DEFAULT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %u
\n
"
,
r
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
DeleteFileA
(
msifile
);
/* msifile is removed */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
DeleteFileA
(
msifile
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"83374883CBB1401418CAF2AA7CCEDDDC
\\
InstallProperties"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
props
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
props
,
"LocalPackage"
,
NULL
,
&
type
,
(
LPBYTE
)
localpackage
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"C:
\\
idontexist.msi"
,
18
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* LocalPackage is used to find the cached msi package */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INSTALL_SOURCE_ABSENT
,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
RegCloseKey
(
props
);
create_database
(
msifile
,
mcp_tables
,
sizeof
(
mcp_tables
)
/
sizeof
(
msi_table
));
/* LastUsedSource can be used as a last resort */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
DeleteFileA
(
localpackage
);
/* install the product, machine */
r
=
MsiInstallProductA
(
msifile
,
"ALLUSERS=1 INSTALLLEVEL=10 PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"83374883CBB1401418CAF2AA7CCEDDDC
\\
InstallProperties"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
props
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
props
,
"LocalPackage"
,
NULL
,
&
type
,
(
LPBYTE
)
localpackage
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"C:
\\
idontexist.msi"
,
18
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
lstrcpyA
(
keypath
,
"SOFTWARE
\\
Classes
\\
Installer
\\
Products
\\
"
);
lstrcatA
(
keypath
,
"83374883CBB1401418CAF2AA7CCEDDDC
\\
SourceList"
);
res
=
RegOpenKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
access
,
&
source
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
type
=
REG_SZ
;
size
=
MAX_PATH
;
res
=
RegQueryValueExA
(
source
,
"PackageName"
,
NULL
,
&
type
,
(
LPBYTE
)
packagename
,
&
size
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
source
,
"PackageName"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"idontexist.msi"
,
15
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* SourceList is altered */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_INSTALL_SOURCE_ABSENT
,
"Expected ERROR_INSTALL_SOURCE_ABSENT, got %d
\n
"
,
r
);
ok
(
pf_exists
(
"msitest
\\
hydrogen"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
helium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest
\\
lithium"
),
"File not installed
\n
"
);
ok
(
pf_exists
(
"msitest"
),
"File not installed
\n
"
);
/* restore PackageName */
res
=
RegSetValueExA
(
source
,
"PackageName"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
packagename
,
lstrlenA
(
packagename
)
+
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* restore LocalPackage */
res
=
RegSetValueExA
(
props
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
localpackage
,
lstrlenA
(
localpackage
)
+
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* finally remove the product */
r
=
MsiConfigureProductExA
(
"{38847338-1BBC-4104-81AC-2FAAC7ECDDCD}"
,
INSTALLLEVEL_DEFAULT
,
INSTALLSTATE_ABSENT
,
"PROPVAR=42"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
!
delete_pf
(
"msitest
\\
hydrogen"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
helium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest
\\
lithium"
,
TRUE
),
"File not removed
\n
"
);
ok
(
!
delete_pf
(
"msitest"
,
FALSE
),
"Directory not removed
\n
"
);
RegCloseKey
(
source
);
RegCloseKey
(
props
);
error:
DeleteFileA
(
"msitest
\\
hydrogen"
);
DeleteFileA
(
"msitest
\\
helium"
);
DeleteFileA
(
"msitest
\\
lithium"
);
RemoveDirectoryA
(
"msitest"
);
DeleteFileA
(
msifile
);
}
static
void
test_MsiSetFeatureAttributes
(
void
)
{
UINT
r
;
DWORD
attrs
;
char
path
[
MAX_PATH
];
MSIHANDLE
package
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
create_database
(
msifile
,
tables
,
sizeof
(
tables
)
/
sizeof
(
tables
[
0
])
);
strcpy
(
path
,
CURR_DIR
);
strcat
(
path
,
"
\\
"
);
strcat
(
path
,
msifile
);
r
=
MsiOpenPackage
(
path
,
&
package
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
DeleteFileA
(
msifile
);
return
;
}
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %u
\n
"
,
r
);
r
=
MsiDoAction
(
package
,
"CostInitialize"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
0
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
""
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
NULL
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0xdeadbeef
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got 0x%08x
\n
"
,
attrs
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got 0x%08x
\n
"
,
attrs
);
r
=
MsiDoAction
(
package
,
"FileCost"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORSOURCE
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
attrs
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORSOURCE
,
"expected INSTALLFEATUREATTRIBUTE_FAVORSOURCE, got 0x%08x
\n
"
,
attrs
);
r
=
MsiDoAction
(
package
,
"CostFinalize"
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiSetFeatureAttributesA
(
package
,
"One"
,
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
);
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"expected ERROR_FUNCTION_FAILED, got %u
\n
"
,
r
);
MsiCloseHandle
(
package
);
DeleteFileA
(
msifile
);
}
static
void
test_MsiGetFeatureInfo
(
void
)
{
UINT
r
;
MSIHANDLE
package
;
char
title
[
32
],
help
[
32
],
path
[
MAX_PATH
];
DWORD
attrs
,
title_len
,
help_len
;
if
(
is_process_limited
())
{
skip
(
"process is limited
\n
"
);
return
;
}
create_database
(
msifile
,
tables
,
sizeof
(
tables
)
/
sizeof
(
tables
[
0
])
);
strcpy
(
path
,
CURR_DIR
);
strcat
(
path
,
"
\\
"
);
strcat
(
path
,
msifile
);
r
=
MsiOpenPackage
(
path
,
&
package
);
if
(
r
==
ERROR_INSTALL_PACKAGE_REJECTED
)
{
skip
(
"Not enough rights to perform tests
\n
"
);
DeleteFileA
(
msifile
);
return
;
}
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
0
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"expected ERROR_INVALID_PARAMETER, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
""
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_UNKNOWN_FEATURE
,
"expected ERROR_UNKNOWN_FEATURE, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
r
=
MsiGetFeatureInfoA
(
0
,
"One"
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
r
==
ERROR_INVALID_HANDLE
,
"expected ERROR_INVALID_HANDLE, got %u
\n
"
,
r
);
title_len
=
help_len
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
NULL
,
&
title_len
,
NULL
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
3
,
"expected 3, got %u
\n
"
,
help_len
);
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
help_len
=
0
;
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
NULL
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_MORE_DATA
,
"expected ERROR_MORE_DATA, got %u
\n
"
,
r
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
3
,
"expected 3, got %u
\n
"
,
help_len
);
attrs
=
0
;
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
sizeof
(
title
);
help_len
=
sizeof
(
help
);
r
=
MsiGetFeatureInfoA
(
package
,
"One"
,
&
attrs
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got %u
\n
"
,
attrs
);
ok
(
title_len
==
3
,
"expected 3, got %u
\n
"
,
title_len
);
ok
(
help_len
==
3
,
"expected 3, got %u
\n
"
,
help_len
);
ok
(
!
strcmp
(
title
,
"One"
),
"expected
\"
One
\"
, got
\"
%s
\"\n
"
,
title
);
ok
(
!
strcmp
(
help
,
"One"
),
"expected
\"
One
\"
, got
\"
%s
\"\n
"
,
help
);
attrs
=
0
;
title
[
0
]
=
help
[
0
]
=
0
;
title_len
=
sizeof
(
title
);
help_len
=
sizeof
(
help
);
r
=
MsiGetFeatureInfoA
(
package
,
"Two"
,
&
attrs
,
title
,
&
title_len
,
help
,
&
help_len
);
ok
(
r
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
r
);
ok
(
attrs
==
INSTALLFEATUREATTRIBUTE_FAVORLOCAL
,
"expected INSTALLFEATUREATTRIBUTE_FAVORLOCAL, got %u
\n
"
,
attrs
);
ok
(
!
title_len
,
"expected 0, got %u
\n
"
,
title_len
);
ok
(
!
help_len
,
"expected 0, got %u
\n
"
,
help_len
);
ok
(
!
title
[
0
],
"expected
\"\"
, got
\"
%s
\"\n
"
,
title
);
ok
(
!
help
[
0
],
"expected
\"\"
, got
\"
%s
\"\n
"
,
help
);
MsiCloseHandle
(
package
);
DeleteFileA
(
msifile
);
}
static
INT
CALLBACK
handler_a
(
LPVOID
context
,
UINT
type
,
LPCSTR
msg
)
{
return
IDOK
;
}
static
INT
CALLBACK
handler_w
(
LPVOID
context
,
UINT
type
,
LPCWSTR
msg
)
{
return
IDOK
;
}
static
INT
CALLBACK
handler_record
(
LPVOID
context
,
UINT
type
,
MSIHANDLE
record
)
{
return
IDOK
;
}
static
void
test_MsiSetExternalUI
(
void
)
{
INSTALLUI_HANDLERA
ret_a
;
INSTALLUI_HANDLERW
ret_w
;
INSTALLUI_HANDLER_RECORD
prev
;
UINT
error
;
ret_a
=
MsiSetExternalUIA
(
handler_a
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_a
=
MsiSetExternalUIA
(
NULL
,
0
,
NULL
);
ok
(
ret_a
==
handler_a
,
"expected %p, got %p
\n
"
,
handler_a
,
ret_a
);
/* Not present before Installer 3.1 */
if
(
!
pMsiSetExternalUIRecord
)
{
win_skip
(
"MsiSetExternalUIRecord is not available
\n
"
);
return
;
}
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
NULL
,
"expected NULL, got %p
\n
"
,
prev
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
NULL
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
handler_record
,
"expected %p, got %p
\n
"
,
handler_record
,
prev
);
ret_w
=
MsiSetExternalUIW
(
handler_w
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
ret_w
=
MsiSetExternalUIW
(
NULL
,
0
,
NULL
);
ok
(
ret_w
==
handler_w
,
"expected %p, got %p
\n
"
,
handler_w
,
ret_w
);
ret_a
=
MsiSetExternalUIA
(
handler_a
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_w
=
MsiSetExternalUIW
(
handler_w
,
INSTALLLOGMODE_ERROR
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
NULL
,
"expected NULL, got %p
\n
"
,
prev
);
ret_a
=
MsiSetExternalUIA
(
NULL
,
0
,
NULL
);
ok
(
ret_a
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_a
);
ret_w
=
MsiSetExternalUIW
(
NULL
,
0
,
NULL
);
ok
(
ret_w
==
NULL
,
"expected NULL, got %p
\n
"
,
ret_w
);
prev
=
(
INSTALLUI_HANDLER_RECORD
)
0xdeadbeef
;
error
=
pMsiSetExternalUIRecord
(
NULL
,
0
,
NULL
,
&
prev
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
ok
(
prev
==
handler_record
,
"expected %p, got %p
\n
"
,
handler_record
,
prev
);
error
=
pMsiSetExternalUIRecord
(
handler_record
,
INSTALLLOGMODE_ERROR
,
NULL
,
NULL
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
error
=
pMsiSetExternalUIRecord
(
NULL
,
0
,
NULL
,
NULL
);
ok
(
!
error
,
"MsiSetExternalUIRecord failed %u
\n
"
,
error
);
}
START_TEST
(
msi
)
{
DWORD
len
;
char
temp_path
[
MAX_PATH
],
prev_path
[
MAX_PATH
];
init_functionpointers
();
if
(
pIsWow64Process
)
pIsWow64Process
(
GetCurrentProcess
(),
&
is_wow64
);
GetCurrentDirectoryA
(
MAX_PATH
,
prev_path
);
GetTempPath
(
MAX_PATH
,
temp_path
);
SetCurrentDirectoryA
(
temp_path
);
lstrcpyA
(
CURR_DIR
,
temp_path
);
len
=
lstrlenA
(
CURR_DIR
);
if
(
len
&&
(
CURR_DIR
[
len
-
1
]
==
'\\'
))
CURR_DIR
[
len
-
1
]
=
0
;
ok
(
get_system_dirs
(),
"failed to retrieve system dirs
\n
"
);
test_usefeature
();
test_null
();
test_getcomponentpath
();
...
...
@@ -12212,4 +13092,10 @@ START_TEST(msi)
}
test_MsiGetFileVersion
();
test_MsiGetFileSignatureInformation
();
test_MsiConfigureProductEx
();
test_MsiSetFeatureAttributes
();
test_MsiGetFeatureInfo
();
test_MsiSetExternalUI
();
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