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
91016652
Commit
91016652
authored
Feb 27, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Feb 27, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Change the property variant if the types don't match.
parent
47120f50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
27 deletions
+51
-27
suminfo.c
dlls/msi/suminfo.c
+51
-27
No files found.
dlls/msi/suminfo.c
View file @
91016652
...
...
@@ -34,6 +34,7 @@
#include "msidefs.h"
#include "msipriv.h"
#include "objidl.h"
#include "propvarutil.h"
#include "msiserver.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
msi
);
...
...
@@ -78,6 +79,10 @@ typedef struct {
#include "poppack.h"
static
HRESULT
(
WINAPI
*
pPropVariantChangeType
)
(
PROPVARIANT
*
ppropvarDest
,
REFPROPVARIANT
propvarSrc
,
PROPVAR_CHANGE_FLAGS
flags
,
VARTYPE
vt
);
#define SECT_HDR_SIZE (sizeof(PROPERTYSECTIONHEADER))
static
const
WCHAR
szSumInfo
[]
=
{
5
,
'S'
,
'u'
,
'm'
,
'm'
,
'a'
,
'r'
,
'y'
,
...
...
@@ -144,6 +149,22 @@ static UINT get_property_count( const PROPVARIANT *property )
return
n
;
}
static
UINT
propvar_changetype
(
PROPVARIANT
*
changed
,
PROPVARIANT
*
property
,
VARTYPE
vt
)
{
HRESULT
hr
;
HMODULE
propsys
=
LoadLibraryA
(
"propsys.dll"
);
pPropVariantChangeType
=
(
void
*
)
GetProcAddress
(
propsys
,
"PropVariantChangeType"
);
if
(
!
pPropVariantChangeType
)
{
ERR
(
"PropVariantChangeType function missing!
\n
"
);
return
ERROR_FUNCTION_FAILED
;
}
hr
=
pPropVariantChangeType
(
changed
,
property
,
0
,
vt
);
return
(
hr
==
S_OK
)
?
ERROR_SUCCESS
:
ERROR_FUNCTION_FAILED
;
}
/* FIXME: doesn't deal with endian conversion */
static
void
read_properties_from_data
(
PROPVARIANT
*
prop
,
LPBYTE
data
,
DWORD
sz
)
{
...
...
@@ -151,7 +172,8 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz
DWORD
i
;
int
size
;
PROPERTY_DATA
*
propdata
;
PROPVARIANT
*
property
;
PROPVARIANT
property
,
*
ptr
;
PROPVARIANT
changed
;
PROPERTYIDOFFSET
*
idofs
;
PROPERTYSECTIONHEADER
*
section_hdr
;
...
...
@@ -161,6 +183,12 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz
/* now set all the properties */
for
(
i
=
0
;
i
<
section_hdr
->
cProperties
;
i
++
)
{
if
(
idofs
[
i
].
propid
>=
MSI_MAX_PROPS
)
{
ERR
(
"Unknown property ID %d
\n
"
,
idofs
[
i
].
propid
);
break
;
}
type
=
get_type
(
idofs
[
i
].
propid
);
if
(
type
==
VT_EMPTY
)
{
...
...
@@ -170,45 +198,41 @@ static void read_properties_from_data( PROPVARIANT *prop, LPBYTE data, DWORD sz
propdata
=
(
PROPERTY_DATA
*
)
&
data
[
idofs
[
i
].
dwOffset
];
/* check the type is the same as we expect */
if
(
type
!=
propdata
->
type
)
{
ERR
(
"wrong type %d != %d
\n
"
,
type
,
propdata
->
type
);
break
;
}
/* check we don't run off the end of the data */
size
=
sz
-
idofs
[
i
].
dwOffset
-
sizeof
(
DWORD
);
if
(
sizeof
(
DWORD
)
>
size
||
(
type
==
VT_FILETIME
&&
sizeof
(
FILETIME
)
>
size
)
||
(
type
==
VT_LPSTR
&&
(
propdata
->
u
.
str
.
len
+
sizeof
(
DWORD
))
>
size
)
)
(
propdata
->
type
==
VT_FILETIME
&&
sizeof
(
FILETIME
)
>
size
)
||
(
propdata
->
type
==
VT_LPSTR
&&
(
propdata
->
u
.
str
.
len
+
sizeof
(
DWORD
))
>
size
)
)
{
ERR
(
"not enough data
\n
"
);
break
;
}
if
(
idofs
[
i
].
propid
>=
MSI_MAX_PROPS
)
{
ERR
(
"Unknown property ID %d
\n
"
,
idofs
[
i
].
propid
);
break
;
}
property
=
&
prop
[
idofs
[
i
].
propid
];
property
->
vt
=
type
;
if
(
type
==
VT_LPSTR
)
property
.
vt
=
propdata
->
type
;
if
(
propdata
->
type
==
VT_LPSTR
)
{
LPSTR
str
=
msi_alloc
(
propdata
->
u
.
str
.
len
);
memcpy
(
str
,
propdata
->
u
.
str
.
str
,
propdata
->
u
.
str
.
len
);
str
[
propdata
->
u
.
str
.
len
-
1
]
=
0
;
property
->
u
.
pszVal
=
str
;
property
.
u
.
pszVal
=
str
;
}
else
if
(
propdata
->
type
==
VT_FILETIME
)
property
.
u
.
filetime
=
propdata
->
u
.
ft
;
else
if
(
propdata
->
type
==
VT_I2
)
property
.
u
.
iVal
=
propdata
->
u
.
i2
;
else
if
(
propdata
->
type
==
VT_I4
)
property
.
u
.
lVal
=
propdata
->
u
.
i4
;
/* check the type is the same as we expect */
if
(
type
!=
propdata
->
type
)
{
propvar_changetype
(
&
changed
,
&
property
,
type
);
ptr
=
&
changed
;
}
else
if
(
type
==
VT_FILETIME
)
property
->
u
.
filetime
=
propdata
->
u
.
ft
;
else
if
(
type
==
VT_I2
)
property
->
u
.
iVal
=
propdata
->
u
.
i2
;
else
if
(
type
==
VT_I4
)
property
->
u
.
lVal
=
propdata
->
u
.
i4
;
else
ptr
=
&
property
;
memcpy
(
&
prop
[
idofs
[
i
].
propid
],
ptr
,
sizeof
(
PROPVARIANT
));
}
}
...
...
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