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
072adfa9
Commit
072adfa9
authored
Aug 06, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Aug 07, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add tests for MsiQueryComponentState.
parent
48dcc3fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
238 additions
and
0 deletions
+238
-0
msi.c
dlls/msi/tests/msi.c
+238
-0
No files found.
dlls/msi/tests/msi.c
View file @
072adfa9
...
...
@@ -644,6 +644,243 @@ static void test_MsiQueryFeatureState(void)
RegCloseKey
(
userkey
);
}
static
void
test_MsiQueryComponentState
(
void
)
{
HKEY
compkey
,
prodkey
;
CHAR
prodcode
[
MAX_PATH
];
CHAR
prod_squashed
[
MAX_PATH
];
CHAR
component
[
MAX_PATH
];
CHAR
comp_base85
[
MAX_PATH
];
CHAR
comp_squashed
[
MAX_PATH
];
CHAR
keypath
[
MAX_PATH
];
INSTALLSTATE
state
;
LPSTR
usersid
;
LONG
res
;
UINT
r
;
create_test_guid
(
prodcode
,
prod_squashed
);
compose_base85_guid
(
component
,
comp_base85
,
comp_squashed
);
get_user_sid
(
&
usersid
);
/* NULL szProductCode */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
NULL
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* empty szProductCode */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
""
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
\
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* random szProductCode */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
"random"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* GUID-length szProductCode */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
"DJANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KDE"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* GUID-length with brackets */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
"{JANE93KNDNAS-2KN2NR93KMN3LN13=L1N3KD}"
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
r
);
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* actual GUID */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
todo_wine
{
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
/* create local system product key */
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
lstrcatA
(
keypath
,
prod_squashed
);
lstrcatA
(
keypath
,
"
\\
InstallProperties"
);
res
=
RegCreateKeyA
(
HKEY_LOCAL_MACHINE
,
keypath
,
&
prodkey
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
prodkey
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"msitest.msi"
,
11
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* local system product key exists */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
}
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
S-1-5-18
\\
Components
\\
"
);
lstrcatA
(
keypath
,
comp_squashed
);
res
=
RegCreateKeyA
(
HKEY_LOCAL_MACHINE
,
keypath
,
&
compkey
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* component key exists */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
}
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
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
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_NOTUSED
,
"Expected INSTALLSTATE_NOTUSED, got %d
\n
"
,
state
);
}
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"hi"
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_MACHINE
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
RegDeleteValueA
(
prodkey
,
"LocalPackage"
);
RegDeleteKeyA
(
prodkey
,
""
);
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
prodkey
,
""
);
RegCloseKey
(
prodkey
);
RegCloseKey
(
compkey
);
/* MSIINSTALLCONTEXT_USERUNMANAGED */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
component
,
&
state
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
todo_wine
{
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
lstrcatA
(
keypath
,
"
\\
Products
\\
"
);
lstrcatA
(
keypath
,
prod_squashed
);
lstrcatA
(
keypath
,
"
\\
InstallProperties"
);
res
=
RegCreateKeyA
(
HKEY_LOCAL_MACHINE
,
keypath
,
&
prodkey
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
res
=
RegSetValueExA
(
prodkey
,
"LocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"msitest.msi"
,
11
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
}
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
lstrcatA
(
keypath
,
"
\\
Components
\\
"
);
lstrcatA
(
keypath
,
comp_squashed
);
res
=
RegCreateKeyA
(
HKEY_LOCAL_MACHINE
,
keypath
,
&
compkey
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
/* component key exists */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_UNKNOWN_COMPONENT
,
"Expected ERROR_UNKNOWN_COMPONENT, got %d
\n
"
,
r
);
}
ok
(
state
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
state
);
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
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_NOTUSED
,
"Expected INSTALLSTATE_NOTUSED, got %d
\n
"
,
state
);
}
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"hi"
,
2
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
/* MSIINSTALLCONTEXT_USERMANAGED */
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERMANAGED
,
component
,
&
state
);
ok
(
r
==
ERROR_UNKNOWN_PRODUCT
,
"Expected ERROR_UNKNOWN_PRODUCT, got %d
\n
"
,
r
);
todo_wine
{
ok
(
state
==
0xdeadbeef
,
"Expected 0xdeadbeef, got %d
\n
"
,
state
);
}
res
=
RegSetValueExA
(
prodkey
,
"ManagedLocalPackage"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"msitest.msi"
,
11
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
0xdeadbeef
;
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERMANAGED
,
component
,
&
state
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
RegDeleteValueA
(
prodkey
,
"LocalPackage"
);
RegDeleteValueA
(
prodkey
,
"ManagedLocalPackage"
);
RegDeleteKeyA
(
prodkey
,
""
);
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
compkey
,
""
);
RegCloseKey
(
prodkey
);
RegCloseKey
(
compkey
);
}
START_TEST
(
msi
)
{
HMODULE
hmod
=
GetModuleHandle
(
"msi.dll"
);
...
...
@@ -664,4 +901,5 @@ START_TEST(msi)
test_filehash
();
test_MsiQueryProductState
();
test_MsiQueryFeatureState
();
test_MsiQueryComponentState
();
}
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