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
383a8a5b
Commit
383a8a5b
authored
Dec 05, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Dec 05, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Reimplement MsiGetComponentPath.
parent
ced84f5b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
67 deletions
+51
-67
msi.c
dlls/msi/msi.c
+51
-25
msi.c
dlls/msi/tests/msi.c
+0
-39
package.c
dlls/msi/tests/package.c
+0
-3
No files found.
dlls/msi/msi.c
View file @
383a8a5b
...
...
@@ -1240,52 +1240,78 @@ UINT WINAPI MsiVerifyPackageW( LPCWSTR szPackage )
static
INSTALLSTATE
WINAPI
MSI_GetComponentPath
(
LPCWSTR
szProduct
,
LPCWSTR
szComponent
,
awstring
*
lpPathBuf
,
LPDWORD
pcchBuf
)
{
WCHAR
squished_pc
[
GUID_SIZE
]
,
squished_comp
[
GUID_SIZE
]
;
UINT
rc
;
HKEY
hkey
=
0
;
WCHAR
squished_pc
[
GUID_SIZE
];
WCHAR
squished_comp
[
GUID_SIZE
]
;
HKEY
hkey
;
LPWSTR
path
=
NULL
;
INSTALLSTATE
r
;
INSTALLSTATE
state
;
DWORD
version
;
static
const
WCHAR
wininstaller
[]
=
{
'W'
,
'i'
,
'n'
,
'd'
,
'o'
,
'w'
,
's'
,
'I'
,
'n'
,
's'
,
't'
,
'a'
,
'l'
,
'l'
,
'e'
,
'r'
,
0
};
TRACE
(
"%s %s %p %p
\n
"
,
debugstr_w
(
szProduct
),
debugstr_w
(
szComponent
),
lpPathBuf
->
str
.
w
,
pcchBuf
);
if
(
!
szProduct
||
!
szComponent
)
if
(
!
szProduct
||
!
szComponent
)
return
INSTALLSTATE_INVALIDARG
;
if
(
lpPathBuf
->
str
.
w
&&
!
pcchBuf
)
if
(
lpPathBuf
->
str
.
w
&&
!
pcchBuf
)
return
INSTALLSTATE_INVALIDARG
;
if
(
!
squash_guid
(
szProduct
,
squished_pc
)
||
!
squash_guid
(
szComponent
,
squished_comp
))
if
(
!
squash_guid
(
szProduct
,
squished_pc
)
||
!
squash_guid
(
szComponent
,
squished_comp
))
return
INSTALLSTATE_INVALIDARG
;
rc
=
MSIREG_OpenProductsKey
(
szProduct
,
&
hkey
,
FALSE
);
if
(
rc
!=
ERROR_SUCCESS
)
return
INSTALLSTATE_UNKNOWN
;
state
=
INSTALLSTATE_UNKNOWN
;
if
(
MSIREG_OpenLocalSystemComponentKey
(
szComponent
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenUserDataComponentKey
(
szComponent
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
{
path
=
msi_reg_get_val_str
(
hkey
,
squished_pc
);
RegCloseKey
(
hkey
);
rc
=
MSIREG_OpenComponentsKey
(
szComponent
,
&
hkey
,
FALSE
);
if
(
rc
!=
ERROR_SUCCESS
)
return
INSTALLSTATE_UNKNOWN
;
state
=
INSTALLSTATE_ABSENT
;
path
=
msi_reg_get_val_str
(
hkey
,
squished_pc
);
if
((
MSIREG_OpenLocalSystemProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenUserDataProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
&&
msi_reg_get_val_dword
(
hkey
,
wininstaller
,
&
version
)
&&
GetFileAttributesW
(
path
)
!=
INVALID_FILE_ATTRIBUTES
)
{
RegCloseKey
(
hkey
);
state
=
INSTALLSTATE_LOCAL
;
}
}
TRACE
(
"found path of (%s:%s)(%s)
\n
"
,
debugstr_w
(
szComponent
),
debugstr_w
(
szProduct
),
debugstr_w
(
path
));
if
(
state
!=
INSTALLSTATE_LOCAL
&&
(
MSIREG_OpenUserProductsKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenLocalClassesProductKey
(
szProduct
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
))
{
RegCloseKey
(
hkey
);
if
(
MSIREG_OpenLocalSystemComponentKey
(
szComponent
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
||
MSIREG_OpenUserDataComponentKey
(
szComponent
,
&
hkey
,
FALSE
)
==
ERROR_SUCCESS
)
{
msi_free
(
path
);
path
=
msi_reg_get_val_str
(
hkey
,
squished_pc
);
RegCloseKey
(
hkey
);
state
=
INSTALLSTATE_ABSENT
;
if
(
GetFileAttributesW
(
path
)
!=
INVALID_FILE_ATTRIBUTES
)
state
=
INSTALLSTATE_LOCAL
;
}
}
if
(
!
path
)
return
INSTALLSTATE_UNKNOWN
;
if
(
path
[
0
])
r
=
INSTALLSTATE_LOCAL
;
else
r
=
INSTALLSTATE_NOTUSED
;
msi_strcpy_to_awstring
(
path
,
lpPathBuf
,
pcchBuf
);
if
(
state
==
INSTALLSTATE_LOCAL
&&
!*
path
)
state
=
INSTALLSTATE_NOTUSED
;
msi_free
(
path
);
return
r
;
msi_strcpy_to_awstring
(
path
,
lpPathBuf
,
pcchBuf
);
msi_free
(
path
);
return
state
;
}
/******************************************************************
...
...
dlls/msi/tests/msi.c
View file @
383a8a5b
...
...
@@ -1044,12 +1044,9 @@ static void test_MsiGetComponentPath(void)
/* product value exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
...
...
@@ -1066,24 +1063,18 @@ static void test_MsiGetComponentPath(void)
/* install properties key exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
create_file
(
"C:
\\
imapath"
,
"C:
\\
imapath"
,
11
);
/* file exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
compkey
,
""
);
...
...
@@ -1114,12 +1105,9 @@ static void test_MsiGetComponentPath(void)
/* product value exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
...
...
@@ -1136,24 +1124,18 @@ static void test_MsiGetComponentPath(void)
/* install properties key exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
create_file
(
"C:
\\
imapath"
,
"C:
\\
imapath"
,
11
);
/* file exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
compkey
,
""
);
...
...
@@ -1199,12 +1181,9 @@ static void test_MsiGetComponentPath(void)
/* product value exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
lstrcpyA
(
keypath
,
"Software
\\
Microsoft
\\
Windows
\\
CurrentVersion
\\
"
);
lstrcatA
(
keypath
,
"Installer
\\
UserData
\\
S-1-5-18
\\
Products
\\
"
);
...
...
@@ -1221,24 +1200,18 @@ static void test_MsiGetComponentPath(void)
/* install properties key exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
create_file
(
"C:
\\
imapath"
,
"C:
\\
imapath"
,
11
);
/* file exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
prodkey
,
""
);
...
...
@@ -1283,24 +1256,18 @@ static void test_MsiGetComponentPath(void)
/* product value exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
create_file
(
"C:
\\
imapath"
,
"C:
\\
imapath"
,
11
);
/* file exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
prodkey
,
""
);
...
...
@@ -1341,24 +1308,18 @@ static void test_MsiGetComponentPath(void)
/* product value exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
create_file
(
"C:
\\
imapath"
,
"C:
\\
imapath"
,
11
);
/* file exists */
size
=
MAX_PATH
;
state
=
MsiGetComponentPathA
(
prodcode
,
component
,
path
,
&
size
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_LOCAL
,
"Expected INSTALLSTATE_LOCAL, got %d
\n
"
,
state
);
ok
(
!
lstrcmpA
(
path
,
"C:
\\
imapath"
),
"Expected C:
\\
imapath, got %s
\n
"
,
path
);
ok
(
size
==
10
,
"Expected 10, got %d
\n
"
,
size
);
}
RegDeleteValueA
(
compkey
,
prod_squashed
);
RegDeleteKeyA
(
prodkey
,
""
);
...
...
dlls/msi/tests/package.c
View file @
383a8a5b
...
...
@@ -3780,10 +3780,7 @@ static void test_states(void)
action
=
0xdeadbee
;
r
=
MsiGetFeatureState
(
hpkg
,
"five"
,
&
state
,
&
action
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
state
==
INSTALLSTATE_ABSENT
,
"Expected INSTALLSTATE_ABSENT, got %d
\n
"
,
state
);
}
ok
(
action
==
INSTALLSTATE_UNKNOWN
,
"Expected INSTALLSTATE_UNKNOWN, got %d
\n
"
,
action
);
state
=
0xdeadbee
;
...
...
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