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
ad6b7cd4
Commit
ad6b7cd4
authored
Dec 02, 2010
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 02, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Clear last error on success in MsiQueryFeatureState and MsiQueryProductState.
parent
d2055e6e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
207 additions
and
1 deletion
+207
-1
msi.c
dlls/msi/msi.c
+7
-0
msi.c
dlls/msi/tests/msi.c
+200
-1
No files found.
dlls/msi/msi.c
View file @
ad6b7cd4
...
...
@@ -1980,6 +1980,11 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
if
(
lstrlenW
(
szProduct
)
!=
GUID_SIZE
-
1
)
return
INSTALLSTATE_INVALIDARG
;
if
(
szProduct
[
0
]
!=
'{'
||
szProduct
[
37
]
!=
'}'
)
return
INSTALLSTATE_UNKNOWN
;
SetLastError
(
ERROR_SUCCESS
);
if
(
MSIREG_OpenProductKey
(
szProduct
,
NULL
,
MSIINSTALLCONTEXT_USERMANAGED
,
&
prodkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenProductKey
(
szProduct
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
...
...
@@ -2629,6 +2634,8 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
if
(
!
squash_guid
(
szProduct
,
squishProduct
))
return
INSTALLSTATE_INVALIDARG
;
SetLastError
(
ERROR_SUCCESS
);
if
(
MSIREG_OpenFeaturesKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenFeaturesKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
...
...
dlls/msi/tests/msi.c
View file @
ad6b7cd4
...
...
@@ -573,7 +573,7 @@ static void test_MsiQueryProductState(void)
LONG
res
;
HKEY
userkey
,
localkey
,
props
;
HKEY
prodkey
;
DWORD
data
;
DWORD
data
,
error
;
REGSAM
access
=
KEY_ALL_ACCESS
;
create_test_guid
(
prodcode
,
prod_squashed
);
...
...
@@ -583,33 +583,56 @@ static void test_MsiQueryProductState(void)
access
|=
KEY_WOW64_64KEY
;
/* NULL prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
NULL
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* empty prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
""
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* garbage prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
"garbage"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* guid without brackets */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
"6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* guid with brackets */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
"{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
/* same length as guid, but random */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
"A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Installer
\\
Products
\\
"
);
lstrcatA
(
keypath
,
prod_squashed
);
...
...
@@ -618,8 +641,12 @@ static void test_MsiQueryProductState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* user product key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Uninstall
\\
"
);
lstrcatA
(
keypath
,
prodcode
);
...
...
@@ -635,16 +662,24 @@ static void test_MsiQueryProductState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* local uninstall key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
data
=
1
;
res
=
RegSetValueExA
(
localkey
,
"WindowsInstaller"
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
data
,
sizeof
(
DWORD
));
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* WindowsInstaller value exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
RegDeleteValueA
(
localkey
,
"WindowsInstaller"
);
delete_key
(
localkey
,
""
,
access
&
KEY_WOW64_64KEY
);
...
...
@@ -658,37 +693,57 @@ static void test_MsiQueryProductState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* local product key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegCreateKeyExA
(
localkey
,
"InstallProperties"
,
0
,
NULL
,
0
,
access
,
NULL
,
&
props
,
NULL
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* install properties key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
data
=
1
;
res
=
RegSetValueExA
(
props
,
"WindowsInstaller"
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
data
,
sizeof
(
DWORD
));
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* WindowsInstaller value exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
data
=
2
;
res
=
RegSetValueExA
(
props
,
"WindowsInstaller"
,
0
,
REG_DWORD
,
(
const
BYTE
*
)
&
data
,
sizeof
(
DWORD
));
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* WindowsInstaller value is not 1 */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
RegDeleteKeyA
(
userkey
,
""
);
/* user product key does not exist */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryProductStateA
(
prodcode
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
RegDeleteValueA
(
props
,
"WindowsInstaller"
);
delete_key
(
props
,
""
,
access
&
KEY_WOW64_64KEY
);
...
...
@@ -860,6 +915,7 @@ static void test_MsiQueryFeatureState(void)
LPSTR
usersid
;
LONG
res
;
REGSAM
access
=
KEY_ALL_ACCESS
;
DWORD
error
;
create_test_guid
(
prodcode
,
prod_squashed
);
compose_base85_guid
(
component
,
comp_base85
,
comp_squashed
);
...
...
@@ -870,40 +926,69 @@ static void test_MsiQueryFeatureState(void)
access
|=
KEY_WOW64_64KEY
;
/* NULL prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
NULL
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* empty prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
""
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* garbage prodcode */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
"garbage"
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* guid without brackets */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
"6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D"
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* guid with brackets */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
"{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}"
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
/* same length as guid, but random */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
"A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93"
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* NULL szFeature */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
NULL
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_INVALIDARG
,
"Expected INSTALLSTATE_INVALIDARG, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* empty szFeature */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
""
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
/* feature key does not exist yet */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
...
...
@@ -914,15 +999,23 @@ static void test_MsiQueryFeatureState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* feature key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
userkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
""
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* feature value exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
...
...
@@ -942,32 +1035,52 @@ static void test_MsiQueryFeatureState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* userdata features key exists */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"aaaaaaaaaaaaaaaaaaa"
,
20
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_BADCONFIG
,
"Expected INSTALLSTATE_BADCONFIG, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"aaaaaaaaaaaaaaaaaaaa"
,
21
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"aaaaaaaaaaaaaaaaaaaaa"
,
22
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
comp_base85
,
41
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
...
...
@@ -985,55 +1098,87 @@ static void test_MsiQueryFeatureState(void)
res
=
RegCreateKeyExA
(
HKEY_LOCAL_MACHINE
,
keypath
,
0
,
NULL
,
0
,
access
,
NULL
,
&
compkey2
,
NULL
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
""
,
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"apple"
,
6
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey2
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"orange"
,
7
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_LOCAL */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01
\\
"
,
4
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_SOURCE */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_SOURCE
,
"Expected INSTALLSTATE_SOURCE, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01"
,
3
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* bad INSTALLSTATE_SOURCE */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01a"
,
4
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_SOURCE */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_SOURCE
,
"Expected INSTALLSTATE_SOURCE, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01"
,
3
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* bad INSTALLSTATE_SOURCE */
SetLastError
(
0xdeadbeef
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
ERROR_SUCCESS
||
broken
(
error
==
ERROR_NO_TOKEN
)
/* win2k */
,
"expected ERROR_SUCCESS, got %u
\n
"
,
error
);
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteValueA
(
compkey2
,
prod_squashed
);
...
...
@@ -1272,6 +1417,7 @@ static void test_MsiQueryComponentState(void)
LONG
res
;
UINT
r
;
REGSAM
access
=
KEY_ALL_ACCESS
;
DWORD
error
;
static
const
INSTALLSTATE
MAGIC_ERROR
=
0xdeadbeef
;
...
...
@@ -1290,44 +1436,65 @@ static void test_MsiQueryComponentState(void)
/* NULL szProductCode */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
NULL
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* empty szProductCode */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
""
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* random szProductCode */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
"random"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* GUID-length szProductCode */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
"DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* GUID-length with brackets */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
"{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* actual GUID */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Classes
\\
Installer
\\
Products
\\
"
);
lstrcatA
(
keypath
,
prod_squashed
);
...
...
@@ -1342,9 +1509,12 @@ static void test_MsiQueryComponentState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
delete_key
(
prodkey
,
""
,
access
&
KEY_WOW64_64KEY
);
RegCloseKey
(
prodkey
);
...
...
@@ -1360,17 +1530,22 @@ static void test_MsiQueryComponentState(void)
/* local system product key exists */
state
=
MAGIC_ERROR
;
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
prodkey
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"msitest.msi"
,
11
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* LocalPackage value exists */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
S-1-5-18
\\
Components
\\
"
);
lstrcatA
(
keypath
,
comp_squashed
);
...
...
@@ -1380,70 +1555,94 @@ static void test_MsiQueryComponentState(void)
/* component key exists */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
""
,
0
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* component\product exists */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
error
=
GetLastError
();
ok
(
state
==
INSTALLSTATE_NOTUSED
||
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_NOTUSED or INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
/* NULL component, product exists */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
NULL
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
MAGIC_ERROR
,
"Expected state not changed, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"hi"
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_LOCAL */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01
\\
"
,
4
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_SOURCE */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_SOURCE
,
"Expected INSTALLSTATE_SOURCE, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01"
,
3
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* bad INSTALLSTATE_SOURCE */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01a"
,
4
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* INSTALLSTATE_SOURCE */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_SOURCE
,
"Expected INSTALLSTATE_SOURCE, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"01"
,
3
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* bad INSTALLSTATE_SOURCE */
state
=
MAGIC_ERROR
;
SetLastError
(
0xdeadbeef
);
r
=
pMsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
error
=
GetLastError
();
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
error
==
0xdeadbeef
,
"expected 0xdeadbeef, got %u
\n
"
,
error
);
RegDeleteValueA
(
prodkey
,
"LocalPackage"
);
delete_key
(
prodkey
,
""
,
access
&
KEY_WOW64_64KEY
);
...
...
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