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
1130d590
Commit
1130d590
authored
Jul 02, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Jul 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Open the correct key and return INSTALLSTATE_ADVERTISED if it's missing.
parent
ceb4e6d4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
103 additions
and
48 deletions
+103
-48
msi.c
dlls/msi/msi.c
+2
-2
msipriv.h
dlls/msi/msipriv.h
+1
-0
registry.c
dlls/msi/registry.c
+60
-21
install.c
dlls/msi/tests/install.c
+28
-7
msi.c
dlls/msi/tests/msi.c
+12
-18
No files found.
dlls/msi/msi.c
View file @
1130d590
...
...
@@ -1260,9 +1260,9 @@ INSTALLSTATE WINAPI MsiQueryFeatureStateW(LPCWSTR szProduct, LPCWSTR szFeature)
return
r
;
/* now check if it's complete or advertised */
rc
=
MSIREG_OpenFeaturesKey
(
szProduct
,
&
hkey
,
FALSE
);
rc
=
MSIREG_Open
UserData
FeaturesKey
(
szProduct
,
&
hkey
,
FALSE
);
if
(
rc
!=
ERROR_SUCCESS
)
return
INSTALLSTATE_
UNKNOWN
;
return
INSTALLSTATE_
ADVERTISED
;
components
=
msi_reg_get_val_str
(
hkey
,
szFeature
);
RegCloseKey
(
hkey
);
...
...
dlls/msi/msipriv.h
View file @
1130d590
...
...
@@ -703,6 +703,7 @@ extern UINT MSIREG_OpenUserProductsKey(LPCWSTR szProduct, HKEY* key, BOOL create
extern
UINT
MSIREG_OpenUserPatchesKey
(
LPCWSTR
szPatch
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenFeatures
(
HKEY
*
key
);
extern
UINT
MSIREG_OpenFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenComponents
(
HKEY
*
key
);
extern
UINT
MSIREG_OpenUserComponentsKey
(
LPCWSTR
szComponent
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenComponentsKey
(
LPCWSTR
szComponent
,
HKEY
*
key
,
BOOL
create
);
...
...
dlls/msi/registry.c
View file @
1130d590
...
...
@@ -60,6 +60,16 @@ static const WCHAR szInstaller_Features[] = {
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'e'
,
'r'
,
'\\'
,
'F'
,
'e'
,
'a'
,
't'
,
'u'
,
'r'
,
'e'
,
's'
,
0
};
static
const
WCHAR
szUserDataFeatures_fmt
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'\\'
,
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'e'
,
'r'
,
'\\'
,
'U'
,
's'
,
'e'
,
'r'
,
'D'
,
'a'
,
't'
,
'a'
,
'\\'
,
'%'
,
's'
,
'\\'
,
'P'
,
'r'
,
'o'
,
'd'
,
'u'
,
'c'
,
't'
,
's'
,
'\\'
,
'%'
,
's'
,
'\\'
,
'F'
,
'e'
,
'a'
,
't'
,
'u'
,
'r'
,
'e'
,
's'
,
0
};
static
const
WCHAR
szInstaller_Features_fmt
[]
=
{
'S'
,
'o'
,
'f'
,
't'
,
'w'
,
'a'
,
'r'
,
'e'
,
'\\'
,
'M'
,
'i'
,
'c'
,
'r'
,
'o'
,
's'
,
'o'
,
'f'
,
't'
,
'\\'
,
...
...
@@ -411,6 +421,27 @@ BOOL msi_reg_get_val_dword( HKEY hkey, LPCWSTR name, DWORD *val)
return
r
==
ERROR_SUCCESS
&&
type
==
REG_DWORD
;
}
static
UINT
get_user_sid
(
LPWSTR
*
usersid
)
{
HANDLE
token
;
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
return
ERROR_FUNCTION_FAILED
;
size
=
sizeof
(
buf
);
if
(
!
GetTokenInformation
(
token
,
TokenUser
,
(
void
*
)
buf
,
size
,
&
size
))
return
ERROR_FUNCTION_FAILED
;
user
=
(
PTOKEN_USER
)
buf
;
if
(
!
ConvertSidToStringSidW
(
user
->
User
.
Sid
,
usersid
))
return
ERROR_FUNCTION_FAILED
;
return
ERROR_SUCCESS
;
}
UINT
MSIREG_OpenUninstallKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
)
{
UINT
rc
;
...
...
@@ -526,6 +557,35 @@ UINT MSIREG_OpenFeaturesKey(LPCWSTR szProduct, HKEY* key, BOOL create)
return
rc
;
}
UINT
MSIREG_OpenUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
)
{
UINT
rc
;
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
keypath
[
0x200
];
LPWSTR
usersid
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
szProduct
));
squash_guid
(
szProduct
,
squished_pc
);
TRACE
(
"squished (%s)
\n
"
,
debugstr_w
(
squished_pc
));
rc
=
get_user_sid
(
&
usersid
);
if
(
rc
!=
ERROR_SUCCESS
||
!
usersid
)
{
ERR
(
"Failed to retrieve user SID: %d
\n
"
,
rc
);
return
rc
;
}
sprintfW
(
keypath
,
szUserDataFeatures_fmt
,
usersid
,
squished_pc
);
if
(
create
)
rc
=
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
else
rc
=
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
msi_free
(
usersid
);
return
rc
;
}
UINT
MSIREG_OpenComponents
(
HKEY
*
key
)
{
return
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
szInstaller_Components
,
key
);
...
...
@@ -571,27 +631,6 @@ UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL create)
return
rc
;
}
static
UINT
get_user_sid
(
LPWSTR
*
usersid
)
{
HANDLE
token
;
BYTE
buf
[
1024
];
DWORD
size
;
PTOKEN_USER
user
;
if
(
!
OpenProcessToken
(
GetCurrentProcess
(),
TOKEN_QUERY
,
&
token
))
return
ERROR_FUNCTION_FAILED
;
size
=
sizeof
(
buf
);
if
(
!
GetTokenInformation
(
token
,
TokenUser
,
(
void
*
)
buf
,
size
,
&
size
))
return
ERROR_FUNCTION_FAILED
;
user
=
(
PTOKEN_USER
)
buf
;
if
(
!
ConvertSidToStringSidW
(
user
->
User
.
Sid
,
usersid
))
return
ERROR_FUNCTION_FAILED
;
return
ERROR_SUCCESS
;
}
UINT
MSIREG_OpenUserDataProductKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
)
{
UINT
rc
;
...
...
dlls/msi/tests/install.c
View file @
1130d590
...
...
@@ -1850,7 +1850,10 @@ static void test_publish(void)
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"feature"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"montecristo"
);
todo_wine
...
...
@@ -1905,7 +1908,10 @@ static void test_publish(void)
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"feature"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"montecristo"
);
todo_wine
...
...
@@ -1960,7 +1966,10 @@ static void test_publish(void)
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"feature"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"montecristo"
);
todo_wine
...
...
@@ -1986,10 +1995,16 @@ static void test_publish(void)
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"feature"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"montecristo"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}"
,
&
state
);
...
...
@@ -2067,10 +2082,16 @@ static void test_publish(void)
ok
(
state
==
INSTALLSTATE_DEFAULT
,
"Expected INSTALLSTATE_DEFAULT, got %d
\n
"
,
state
);
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"feature"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
state
=
MsiQueryFeatureState
(
"{7DF88A48-996F-4EC8-A022-BF956F9B2CBB}"
,
"montecristo"
);
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
}
r
=
MsiQueryComponentStateA
(
prodcode
,
NULL
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
"{DF2CBABC-3BCC-47E5-A998-448D1C0C895B}"
,
&
state
);
...
...
dlls/msi/tests/msi.c
View file @
1130d590
...
...
@@ -573,10 +573,7 @@ static void test_MsiQueryFeatureState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
}
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
...
...
@@ -606,28 +603,19 @@ static void test_MsiQueryFeatureState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
}
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"aaaaaaaaaaaaaaaaaaaaa"
,
22
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
}
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
res
=
RegSetValueExA
(
localkey
,
"feature"
,
0
,
REG_SZ
,
(
const
BYTE
*
)
comp_base85
,
21
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
}
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
Installer
\\
UserData
\\
"
);
lstrcatA
(
keypath
,
usersid
);
...
...
@@ -638,12 +626,18 @@ static void test_MsiQueryFeatureState(void)
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
ok
(
state
==
INSTALLSTATE_ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED, got %d
\n
"
,
state
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
""
,
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_
ADVERTISED
,
"Expected INSTALLSTATE_ADVERTISED
, got %d
\n
"
,
state
);
ok
(
state
==
INSTALLSTATE_
LOCAL
,
"Expected INSTALLSTATE_LOCAL
, got %d
\n
"
,
state
);
}
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
""
,
1
);
res
=
RegSetValueExA
(
compkey
,
prod_squashed
,
0
,
REG_SZ
,
(
const
BYTE
*
)
"
apple
"
,
1
);
ok
(
res
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
res
);
state
=
MsiQueryFeatureStateA
(
prodcode
,
"feature"
);
...
...
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