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
70be1e77
Commit
70be1e77
authored
Nov 03, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Nov 04, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Factor out the code to open a product key.
parent
f12b9cea
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
89 additions
and
114 deletions
+89
-114
action.c
dlls/msi/action.c
+4
-7
msi.c
dlls/msi/msi.c
+40
-37
msipriv.h
dlls/msi/msipriv.h
+2
-3
registry.c
dlls/msi/registry.c
+33
-60
source.c
dlls/msi/source.c
+7
-5
upgrade.c
dlls/msi/upgrade.c
+3
-2
No files found.
dlls/msi/action.c
View file @
70be1e77
...
@@ -3582,22 +3582,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
...
@@ -3582,22 +3582,19 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package)
if
(
!
msi_check_publish
(
package
))
if
(
!
msi_check_publish
(
package
))
return
ERROR_SUCCESS
;
return
ERROR_SUCCESS
;
if
(
package
->
Context
==
MSIINSTALLCONTEXT_MACHINE
)
rc
=
MSIREG_OpenProductKey
(
package
->
ProductCode
,
package
->
Context
,
{
&
hukey
,
TRUE
);
rc
=
MSIREG_OpenLocalClassesProductKey
(
package
->
ProductCode
,
&
hukey
,
TRUE
);
if
(
rc
!=
ERROR_SUCCESS
)
if
(
rc
!=
ERROR_SUCCESS
)
goto
end
;
goto
end
;
if
(
package
->
Context
==
MSIINSTALLCONTEXT_MACHINE
)
{
rc
=
MSIREG_OpenLocalUserDataProductKey
(
package
->
ProductCode
,
&
hudkey
,
TRUE
);
rc
=
MSIREG_OpenLocalUserDataProductKey
(
package
->
ProductCode
,
&
hudkey
,
TRUE
);
if
(
rc
!=
ERROR_SUCCESS
)
if
(
rc
!=
ERROR_SUCCESS
)
goto
end
;
goto
end
;
}
}
else
else
{
{
rc
=
MSIREG_OpenUserProductsKey
(
package
->
ProductCode
,
&
hukey
,
TRUE
);
if
(
rc
!=
ERROR_SUCCESS
)
goto
end
;
rc
=
MSIREG_OpenUserDataProductKey
(
package
->
ProductCode
,
&
hudkey
,
TRUE
);
rc
=
MSIREG_OpenUserDataProductKey
(
package
->
ProductCode
,
&
hudkey
,
TRUE
);
if
(
rc
!=
ERROR_SUCCESS
)
if
(
rc
!=
ERROR_SUCCESS
)
goto
end
;
goto
end
;
...
...
dlls/msi/msi.c
View file @
70be1e77
...
@@ -51,11 +51,14 @@ static UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
...
@@ -51,11 +51,14 @@ static UINT msi_locate_product(LPCWSTR szProduct, MSIINSTALLCONTEXT *context)
*
context
=
MSIINSTALLCONTEXT_NONE
;
*
context
=
MSIINSTALLCONTEXT_NONE
;
if
(
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
if
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
*
context
=
MSIINSTALLCONTEXT_USERMANAGED
;
*
context
=
MSIINSTALLCONTEXT_USERMANAGED
;
else
if
(
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
else
if
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_MACHINE
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
*
context
=
MSIINSTALLCONTEXT_MACHINE
;
*
context
=
MSIINSTALLCONTEXT_MACHINE
;
else
if
(
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
else
if
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
*
context
=
MSIINSTALLCONTEXT_USERUNMANAGED
;
*
context
=
MSIINSTALLCONTEXT_USERUNMANAGED
;
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
...
@@ -644,9 +647,12 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
...
@@ -644,9 +647,12 @@ UINT WINAPI MsiGetProductCodeW(LPCWSTR szComponent, LPWSTR szBuffer)
sz
=
GUID_SIZE
;
sz
=
GUID_SIZE
;
unsquash_guid
(
squished_prod
,
szBuffer
);
unsquash_guid
(
squished_prod
,
szBuffer
);
if
(
MSIREG_OpenLocalManagedProductKey
(
szBuffer
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
||
if
(
MSIREG_OpenProductKey
(
szBuffer
,
MSIINSTALLCONTEXT_USERMANAGED
,
MSIREG_OpenUserProductsKey
(
szBuffer
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
||
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenLocalClassesProductKey
(
szBuffer
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
)
MSIREG_OpenProductKey
(
szBuffer
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenProductKey
(
szBuffer
,
MSIINSTALLCONTEXT_MACHINE
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
)
{
{
RegCloseKey
(
prodkey
);
RegCloseKey
(
prodkey
);
rc
=
ERROR_SUCCESS
;
rc
=
ERROR_SUCCESS
;
...
@@ -716,17 +722,15 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
...
@@ -716,17 +722,15 @@ static UINT WINAPI MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute,
if
(
!
squash_guid
(
szProduct
,
squished_pc
))
if
(
!
squash_guid
(
szProduct
,
squished_pc
))
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
r
=
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
prodkey
,
FALSE
);
if
((
r
=
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
if
(
r
!=
ERROR_SUCCESS
)
&
prodkey
,
FALSE
))
!=
ERROR_SUCCESS
&&
{
(
r
=
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
r
=
MSIREG_OpenUserProductsKey
(
szProduct
,
&
prodkey
,
FALSE
);
&
prodkey
,
FALSE
))
!=
ERROR_SUCCESS
&&
if
(
r
!=
ERROR_SUCCESS
)
(
r
=
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_MACHINE
,
&
prodkey
,
FALSE
))
==
ERROR_SUCCESS
)
{
{
r
=
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
prodkey
,
FALSE
);
if
(
r
==
ERROR_SUCCESS
)
classes
=
TRUE
;
classes
=
TRUE
;
}
}
}
if
(
classes
)
if
(
classes
)
MSIREG_OpenLocalSystemProductKey
(
szProduct
,
&
userdata
,
FALSE
);
MSIREG_OpenLocalSystemProductKey
(
szProduct
,
&
userdata
,
FALSE
);
...
@@ -1034,8 +1038,10 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
...
@@ -1034,8 +1038,10 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
if
(
dwContext
==
MSIINSTALLCONTEXT_MACHINE
&&
szUserSid
)
if
(
dwContext
==
MSIINSTALLCONTEXT_MACHINE
&&
szUserSid
)
return
ERROR_INVALID_PARAMETER
;
return
ERROR_INVALID_PARAMETER
;
MSIREG_OpenLocalManagedProductKey
(
szProductCode
,
&
managed
,
FALSE
);
MSIREG_OpenProductKey
(
szProductCode
,
MSIINSTALLCONTEXT_USERMANAGED
,
MSIREG_OpenUserProductsKey
(
szProductCode
,
&
prod
,
FALSE
);
&
managed
,
FALSE
);
MSIREG_OpenProductKey
(
szProductCode
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
&
prod
,
FALSE
);
if
(
dwContext
==
MSIINSTALLCONTEXT_USERUNMANAGED
)
if
(
dwContext
==
MSIINSTALLCONTEXT_USERUNMANAGED
)
{
{
...
@@ -1057,7 +1063,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
...
@@ -1057,7 +1063,7 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid,
{
{
package
=
INSTALLPROPERTY_LOCALPACKAGEW
;
package
=
INSTALLPROPERTY_LOCALPACKAGEW
;
MSIREG_OpenLocalSystemProductKey
(
szProductCode
,
&
props
,
FALSE
);
MSIREG_OpenLocalSystemProductKey
(
szProductCode
,
&
props
,
FALSE
);
MSIREG_Open
LocalClassesProductKey
(
szProductCode
,
&
classes
,
FALSE
);
MSIREG_Open
ProductKey
(
szProductCode
,
dwContext
,
&
classes
,
FALSE
);
if
(
!
props
&&
!
classes
)
if
(
!
props
&&
!
classes
)
goto
done
;
goto
done
;
...
@@ -1271,13 +1277,7 @@ static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
...
@@ -1271,13 +1277,7 @@ static BOOL msi_comp_find_prod_key(LPCWSTR prodcode, MSIINSTALLCONTEXT context)
UINT
r
;
UINT
r
;
HKEY
hkey
;
HKEY
hkey
;
if
(
context
==
MSIINSTALLCONTEXT_MACHINE
)
r
=
MSIREG_OpenProductKey
(
prodcode
,
context
,
&
hkey
,
FALSE
);
r
=
MSIREG_OpenLocalClassesProductKey
(
prodcode
,
&
hkey
,
FALSE
);
else
if
(
context
==
MSIINSTALLCONTEXT_USERUNMANAGED
)
r
=
MSIREG_OpenUserProductsKey
(
prodcode
,
&
hkey
,
FALSE
);
else
r
=
MSIREG_OpenLocalManagedProductKey
(
prodcode
,
&
hkey
,
FALSE
);
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
return
(
r
==
ERROR_SUCCESS
);
return
(
r
==
ERROR_SUCCESS
);
}
}
...
@@ -1430,17 +1430,15 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
...
@@ -1430,17 +1430,15 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
if
(
lstrlenW
(
szProduct
)
!=
GUID_SIZE
-
1
)
if
(
lstrlenW
(
szProduct
)
!=
GUID_SIZE
-
1
)
return
INSTALLSTATE_INVALIDARG
;
return
INSTALLSTATE_INVALIDARG
;
r
=
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
prodkey
,
FALSE
);
if
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
if
(
r
!=
ERROR_SUCCESS
)
&
prodkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
{
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
r
=
MSIREG_OpenUserProductsKey
(
szProduct
,
&
prodkey
,
FALSE
);
&
prodkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
if
(
r
!=
ERROR_SUCCESS
)
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_MACHINE
,
&
prodkey
,
FALSE
)
==
ERROR_SUCCESS
)
{
{
r
=
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
prodkey
,
FALSE
);
if
(
r
==
ERROR_SUCCESS
)
user
=
FALSE
;
user
=
FALSE
;
}
}
}
if
(
user
)
if
(
user
)
{
{
...
@@ -1797,8 +1795,10 @@ static INSTALLSTATE WINAPI MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szCom
...
@@ -1797,8 +1795,10 @@ static INSTALLSTATE WINAPI MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szCom
}
}
if
(
state
!=
INSTALLSTATE_LOCAL
&&
if
(
state
!=
INSTALLSTATE_LOCAL
&&
(
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
))
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_MACHINE
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
))
{
{
RegCloseKey
(
hkey
);
RegCloseKey
(
hkey
);
...
@@ -2431,9 +2431,12 @@ static USERINFOSTATE WINAPI MSI_GetUserInfo(LPCWSTR szProduct,
...
@@ -2431,9 +2431,12 @@ static USERINFOSTATE WINAPI MSI_GetUserInfo(LPCWSTR szProduct,
if
(
!
szProduct
||
!
squash_guid
(
szProduct
,
squished_pc
))
if
(
!
szProduct
||
!
squash_guid
(
szProduct
,
squished_pc
))
return
USERINFOSTATE_INVALIDARG
;
return
USERINFOSTATE_INVALIDARG
;
if
(
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
if
(
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
)
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
&&
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_MACHINE
,
&
hkey
,
FALSE
)
!=
ERROR_SUCCESS
)
{
{
return
USERINFOSTATE_UNKNOWN
;
return
USERINFOSTATE_UNKNOWN
;
}
}
...
...
dlls/msi/msipriv.h
View file @
70be1e77
...
@@ -764,7 +764,8 @@ extern BOOL encode_base85_guid(GUID *,LPWSTR);
...
@@ -764,7 +764,8 @@ extern BOOL encode_base85_guid(GUID *,LPWSTR);
extern
BOOL
decode_base85_guid
(
LPCWSTR
,
GUID
*
);
extern
BOOL
decode_base85_guid
(
LPCWSTR
,
GUID
*
);
extern
UINT
MSIREG_OpenUninstallKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUninstallKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_DeleteUninstallKey
(
LPCWSTR
szProduct
);
extern
UINT
MSIREG_DeleteUninstallKey
(
LPCWSTR
szProduct
);
extern
UINT
MSIREG_OpenUserProductsKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenProductKey
(
LPCWSTR
szProduct
,
MSIINSTALLCONTEXT
context
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUserPatchesKey
(
LPCWSTR
szPatch
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUserPatchesKey
(
LPCWSTR
szPatch
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
...
@@ -786,9 +787,7 @@ extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct);
...
@@ -786,9 +787,7 @@ extern UINT MSIREG_DeleteUserProductKey(LPCWSTR szProduct);
extern
UINT
MSIREG_DeleteUserDataProductKey
(
LPCWSTR
szProduct
);
extern
UINT
MSIREG_DeleteUserDataProductKey
(
LPCWSTR
szProduct
);
extern
UINT
MSIREG_OpenLocalSystemProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalSystemProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalSystemComponentKey
(
LPCWSTR
szComponent
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalSystemComponentKey
(
LPCWSTR
szComponent
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalClassesProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalClassesFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalClassesFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalManagedProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenManagedFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenManagedFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_OpenLocalUserDataFeaturesKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
);
extern
UINT
MSIREG_DeleteUserFeaturesKey
(
LPCWSTR
szProduct
);
extern
UINT
MSIREG_DeleteUserFeaturesKey
(
LPCWSTR
szProduct
);
...
...
dlls/msi/registry.c
View file @
70be1e77
...
@@ -525,25 +525,48 @@ UINT MSIREG_DeleteUninstallKey(LPCWSTR szProduct)
...
@@ -525,25 +525,48 @@ UINT MSIREG_DeleteUninstallKey(LPCWSTR szProduct)
return
RegDeleteTreeW
(
HKEY_LOCAL_MACHINE
,
keypath
);
return
RegDeleteTreeW
(
HKEY_LOCAL_MACHINE
,
keypath
);
}
}
UINT
MSIREG_OpenUserProductsKey
(
LPCWSTR
szProduct
,
HKEY
*
key
,
BOOL
create
)
UINT
MSIREG_OpenProductKey
(
LPCWSTR
szProduct
,
MSIINSTALLCONTEXT
context
,
HKEY
*
key
,
BOOL
create
)
{
{
UINT
rc
;
UINT
r
;
LPWSTR
usersid
;
HKEY
root
=
HKEY_LOCAL_MACHINE
;
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
keypath
[
0x200
];
WCHAR
keypath
[
MAX_PATH
];
TRACE
(
"%s
\n
"
,
debugstr_w
(
szProduct
));
TRACE
(
"(%s, %d, %d)
\n
"
,
debugstr_w
(
szProduct
),
context
,
create
);
if
(
!
squash_guid
(
szProduct
,
squished_pc
))
if
(
!
squash_guid
(
szProduct
,
squished_pc
))
return
ERROR_FUNCTION_FAILED
;
return
ERROR_FUNCTION_FAILED
;
TRACE
(
"squished (%s)
\n
"
,
debugstr_w
(
squished_pc
));
TRACE
(
"squished (%s)
\n
"
,
debugstr_w
(
squished_pc
));
sprintfW
(
keypath
,
szUserProduct_fmt
,
squished_pc
);
if
(
context
==
MSIINSTALLCONTEXT_MACHINE
)
{
sprintfW
(
keypath
,
szInstaller_LocalClassesProd_fmt
,
squished_pc
);
}
else
if
(
context
==
MSIINSTALLCONTEXT_USERUNMANAGED
)
{
root
=
HKEY_CURRENT_USER
;
sprintfW
(
keypath
,
szUserProduct_fmt
,
squished_pc
);
}
else
{
r
=
get_user_sid
(
&
usersid
);
if
(
r
!=
ERROR_SUCCESS
||
!
usersid
)
{
ERR
(
"Failed to retrieve user SID: %d
\n
"
,
r
);
return
r
;
}
sprintfW
(
keypath
,
szInstaller_LocalManagedProd_fmt
,
usersid
,
squished_pc
);
LocalFree
(
usersid
);
}
if
(
create
)
if
(
create
)
rc
=
RegCreateKeyW
(
HKEY_CURRENT_USER
,
keypath
,
key
);
return
RegCreateKeyW
(
root
,
keypath
,
key
);
else
rc
=
RegOpenKeyW
(
HKEY_CURRENT_USER
,
keypath
,
key
);
return
rc
;
return
RegOpenKeyW
(
root
,
keypath
,
key
)
;
}
}
UINT
MSIREG_DeleteUserProductKey
(
LPCWSTR
szProduct
)
UINT
MSIREG_DeleteUserProductKey
(
LPCWSTR
szProduct
)
...
@@ -1068,26 +1091,6 @@ UINT MSIREG_OpenLocalSystemComponentKey(LPCWSTR szComponent, HKEY *key, BOOL cre
...
@@ -1068,26 +1091,6 @@ UINT MSIREG_OpenLocalSystemComponentKey(LPCWSTR szComponent, HKEY *key, BOOL cre
return
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
return
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
}
}
UINT
MSIREG_OpenLocalClassesProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
)
{
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
keypath
[
0x200
];
TRACE
(
"%s
\n
"
,
debugstr_w
(
szProductCode
));
if
(
!
squash_guid
(
szProductCode
,
squished_pc
))
return
ERROR_FUNCTION_FAILED
;
TRACE
(
"squished (%s)
\n
"
,
debugstr_w
(
squished_pc
));
sprintfW
(
keypath
,
szInstaller_LocalClassesProd_fmt
,
squished_pc
);
if
(
create
)
return
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
return
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
}
UINT
MSIREG_DeleteLocalClassesProductKey
(
LPCWSTR
szProductCode
)
UINT
MSIREG_DeleteLocalClassesProductKey
(
LPCWSTR
szProductCode
)
{
{
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
squished_pc
[
GUID_SIZE
];
...
@@ -1142,36 +1145,6 @@ UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
...
@@ -1142,36 +1145,6 @@ UINT MSIREG_DeleteLocalClassesFeaturesKey(LPCWSTR szProductCode)
return
RegDeleteTreeW
(
HKEY_LOCAL_MACHINE
,
keypath
);
return
RegDeleteTreeW
(
HKEY_LOCAL_MACHINE
,
keypath
);
}
}
UINT
MSIREG_OpenLocalManagedProductKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
)
{
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
keypath
[
0x200
];
LPWSTR
usersid
;
UINT
r
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
szProductCode
));
if
(
!
squash_guid
(
szProductCode
,
squished_pc
))
return
ERROR_FUNCTION_FAILED
;
TRACE
(
"squished (%s)
\n
"
,
debugstr_w
(
squished_pc
));
r
=
get_user_sid
(
&
usersid
);
if
(
r
!=
ERROR_SUCCESS
||
!
usersid
)
{
ERR
(
"Failed to retrieve user SID: %d
\n
"
,
r
);
return
r
;
}
sprintfW
(
keypath
,
szInstaller_LocalManagedProd_fmt
,
usersid
,
squished_pc
);
LocalFree
(
usersid
);
if
(
create
)
return
RegCreateKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
return
RegOpenKeyW
(
HKEY_LOCAL_MACHINE
,
keypath
,
key
);
}
UINT
MSIREG_OpenManagedFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
)
UINT
MSIREG_OpenManagedFeaturesKey
(
LPCWSTR
szProductCode
,
HKEY
*
key
,
BOOL
create
)
{
{
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
squished_pc
[
GUID_SIZE
];
...
...
dlls/msi/source.c
View file @
70be1e77
...
@@ -64,21 +64,21 @@ static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions,
...
@@ -64,21 +64,21 @@ static UINT OpenSourceKey(LPCWSTR szProduct, HKEY* key, DWORD dwOptions,
if
(
dwOptions
&
MSICODE_PATCH
)
if
(
dwOptions
&
MSICODE_PATCH
)
rc
=
MSIREG_OpenUserPatchesKey
(
szProduct
,
&
rootkey
,
create
);
rc
=
MSIREG_OpenUserPatchesKey
(
szProduct
,
&
rootkey
,
create
);
else
else
rc
=
MSIREG_Open
UserProductsKey
(
szProduc
t
,
&
rootkey
,
create
);
rc
=
MSIREG_Open
ProductKey
(
szProduct
,
contex
t
,
&
rootkey
,
create
);
}
}
else
if
(
context
==
MSIINSTALLCONTEXT_USERMANAGED
)
else
if
(
context
==
MSIINSTALLCONTEXT_USERMANAGED
)
{
{
if
(
dwOptions
&
MSICODE_PATCH
)
if
(
dwOptions
&
MSICODE_PATCH
)
rc
=
MSIREG_OpenUserPatchesKey
(
szProduct
,
&
rootkey
,
create
);
rc
=
MSIREG_OpenUserPatchesKey
(
szProduct
,
&
rootkey
,
create
);
else
else
rc
=
MSIREG_Open
LocalManagedProductKey
(
szProduc
t
,
&
rootkey
,
create
);
rc
=
MSIREG_Open
ProductKey
(
szProduct
,
contex
t
,
&
rootkey
,
create
);
}
}
else
if
(
context
==
MSIINSTALLCONTEXT_MACHINE
)
else
if
(
context
==
MSIINSTALLCONTEXT_MACHINE
)
{
{
if
(
dwOptions
&
MSICODE_PATCH
)
if
(
dwOptions
&
MSICODE_PATCH
)
rc
=
MSIREG_OpenPatchesKey
(
szProduct
,
&
rootkey
,
create
);
rc
=
MSIREG_OpenPatchesKey
(
szProduct
,
&
rootkey
,
create
);
else
else
rc
=
MSIREG_Open
LocalClassesProductKey
(
szProduc
t
,
&
rootkey
,
create
);
rc
=
MSIREG_Open
ProductKey
(
szProduct
,
contex
t
,
&
rootkey
,
create
);
}
}
if
(
rc
!=
ERROR_SUCCESS
)
if
(
rc
!=
ERROR_SUCCESS
)
...
@@ -903,12 +903,14 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
...
@@ -903,12 +903,14 @@ UINT WINAPI MsiSourceListAddSourceW( LPCWSTR szProduct, LPCWSTR szUserName,
msi_free
(
psid
);
msi_free
(
psid
);
}
}
r
=
MSIREG_OpenLocalManagedProductKey
(
szProduct
,
&
hkey
,
FALSE
);
r
=
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERMANAGED
,
&
hkey
,
FALSE
);
if
(
r
==
ERROR_SUCCESS
)
if
(
r
==
ERROR_SUCCESS
)
context
=
MSIINSTALLCONTEXT_USERMANAGED
;
context
=
MSIINSTALLCONTEXT_USERMANAGED
;
else
else
{
{
r
=
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
);
r
=
MSIREG_OpenProductKey
(
szProduct
,
MSIINSTALLCONTEXT_USERUNMANAGED
,
&
hkey
,
FALSE
);
if
(
r
!=
ERROR_SUCCESS
)
if
(
r
!=
ERROR_SUCCESS
)
return
ERROR_UNKNOWN_PRODUCT
;
return
ERROR_UNKNOWN_PRODUCT
;
...
...
dlls/msi/upgrade.c
View file @
70be1e77
...
@@ -136,8 +136,9 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
...
@@ -136,8 +136,9 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
HKEY
hukey
;
HKEY
hukey
;
INT
r
;
INT
r
;
unsquash_guid
(
product
,
productid
);
unsquash_guid
(
product
,
productid
);
rc
=
MSIREG_OpenUserProductsKey
(
productid
,
&
hukey
,
FALSE
);
rc
=
MSIREG_OpenProductKey
(
productid
,
package
->
Context
,
&
hukey
,
FALSE
);
if
(
rc
!=
ERROR_SUCCESS
)
if
(
rc
!=
ERROR_SUCCESS
)
{
{
rc
=
ERROR_SUCCESS
;
rc
=
ERROR_SUCCESS
;
...
...
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