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
ac016925
Commit
ac016925
authored
Jul 12, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 12, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Fix and test reading and writing of VT_CF properties.
parent
7ce1bb89
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
6 deletions
+49
-6
stg_prop.c
dlls/ole32/stg_prop.c
+21
-6
stg_prop.c
dlls/ole32/tests/stg_prop.c
+28
-0
No files found.
dlls/ole32/stg_prop.c
View file @
ac016925
...
@@ -1142,19 +1142,18 @@ static HRESULT PropertyStorage_ReadProperty(PropertyStorage_impl *This,
...
@@ -1142,19 +1142,18 @@ static HRESULT PropertyStorage_ReadProperty(PropertyStorage_impl *This,
break
;
break
;
case
VT_CF
:
case
VT_CF
:
{
{
DWORD
len
=
0
,
t
ype
=
0
,
t
ag
=
0
;
DWORD
len
=
0
,
tag
=
0
;
StorageUtl_ReadDWord
(
data
,
0
,
&
len
);
StorageUtl_ReadDWord
(
data
,
0
,
&
len
);
StorageUtl_ReadDWord
(
data
,
4
,
&
tag
);
StorageUtl_ReadDWord
(
data
,
4
,
&
tag
);
StorageUtl_ReadDWord
(
data
,
8
,
&
type
);
if
(
len
>
8
)
if
(
tag
==
CFTAG_WINDOWS
&&
len
>
12
)
{
{
len
-=
8
;
prop
->
u
.
pclipdata
=
CoTaskMemAlloc
(
sizeof
(
CLIPDATA
));
prop
->
u
.
pclipdata
=
CoTaskMemAlloc
(
sizeof
(
CLIPDATA
));
prop
->
u
.
pclipdata
->
cbSize
=
len
;
prop
->
u
.
pclipdata
->
cbSize
=
len
;
prop
->
u
.
pclipdata
->
ulClipFmt
=
t
ype
;
prop
->
u
.
pclipdata
->
ulClipFmt
=
t
ag
;
prop
->
u
.
pclipdata
->
pClipData
=
CoTaskMemAlloc
(
len
);
prop
->
u
.
pclipdata
->
pClipData
=
CoTaskMemAlloc
(
len
);
memcpy
(
prop
->
u
.
pclipdata
->
pClipData
,
data
+
12
,
len
-
12
);
memcpy
(
prop
->
u
.
pclipdata
->
pClipData
,
data
+
8
,
len
);
TRACE
(
"returning %p, len %ld
\n
"
,
prop
->
u
.
pclipdata
->
pClipData
,
len
-
12
);
}
}
else
else
hr
=
STG_E_INVALIDPARAMETER
;
hr
=
STG_E_INVALIDPARAMETER
;
...
@@ -1727,6 +1726,22 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
...
@@ -1727,6 +1726,22 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
bytesWritten
=
count
;
bytesWritten
=
count
;
break
;
break
;
}
}
case
VT_CF
:
{
DWORD
cf_hdr
[
2
],
len
;
len
=
var
->
u
.
pclipdata
->
cbSize
;
StorageUtl_WriteDWord
((
LPBYTE
)
&
cf_hdr
[
0
],
0
,
len
+
8
);
StorageUtl_WriteDWord
((
LPBYTE
)
&
cf_hdr
[
1
],
0
,
var
->
u
.
pclipdata
->
ulClipFmt
);
hr
=
IStream_Write
(
This
->
stm
,
&
cf_hdr
,
sizeof
(
cf_hdr
),
&
count
);
if
(
FAILED
(
hr
))
goto
end
;
hr
=
IStream_Write
(
This
->
stm
,
&
var
->
u
.
pclipdata
->
pClipData
,
len
,
&
count
);
if
(
FAILED
(
hr
))
goto
end
;
bytesWritten
=
count
+
sizeof
cf_hdr
;
break
;
}
default:
default:
FIXME
(
"unsupported type: %d
\n
"
,
var
->
vt
);
FIXME
(
"unsupported type: %d
\n
"
,
var
->
vt
);
return
STG_E_INVALIDPARAMETER
;
return
STG_E_INVALIDPARAMETER
;
...
...
dlls/ole32/tests/stg_prop.c
View file @
ac016925
...
@@ -55,6 +55,8 @@ static void testProps(void)
...
@@ -55,6 +55,8 @@ static void testProps(void)
IPropertyStorage
*
propertyStorage
=
NULL
;
IPropertyStorage
*
propertyStorage
=
NULL
;
PROPSPEC
spec
;
PROPSPEC
spec
;
PROPVARIANT
var
;
PROPVARIANT
var
;
CLIPDATA
clipdata
;
unsigned
char
clipcontent
[]
=
"foobar"
;
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
if
(
!
GetTempFileNameW
(
szDot
,
szPrefix
,
0
,
filename
))
return
;
return
;
...
@@ -134,6 +136,18 @@ static void testProps(void)
...
@@ -134,6 +136,18 @@ static void testProps(void)
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* set a clipboard value */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PIDSI_THUMBNAIL
;
var
.
vt
=
VT_CF
;
clipdata
.
cbSize
=
sizeof
clipcontent
+
sizeof
(
ULONG
);
clipdata
.
ulClipFmt
=
CF_ENHMETAFILE
;
clipdata
.
pClipData
=
clipcontent
;
U
(
var
).
pclipdata
=
&
clipdata
;
hr
=
IPropertyStorage_WriteMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
,
0
);
ok
(
SUCCEEDED
(
hr
),
"WriteMultiple failed: 0x%08lx
\n
"
,
hr
);
/* check reading */
/* check reading */
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
0
,
NULL
,
NULL
);
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
0
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"ReadMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
...
@@ -164,6 +178,20 @@ static void testProps(void)
...
@@ -164,6 +178,20 @@ static void testProps(void)
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
"Didn't get expected type or value for property (got type %d, value %s)
\n
"
,
var
.
vt
,
U
(
var
).
pszVal
);
var
.
vt
,
U
(
var
).
pszVal
);
/* read clipboard format */
spec
.
ulKind
=
PRSPEC_PROPID
;
U
(
spec
).
propid
=
PIDSI_THUMBNAIL
;
hr
=
IPropertyStorage_ReadMultiple
(
propertyStorage
,
1
,
&
spec
,
&
var
);
ok
(
hr
==
S_OK
,
"ReadMultiple failed: 0x%08lx
\n
"
,
hr
);
ok
(
var
.
vt
==
VT_CF
,
"variant type wrong
\n
"
);
ok
(
U
(
var
).
pclipdata
->
ulClipFmt
==
CF_ENHMETAFILE
,
"clipboard type wrong
\n
"
);
ok
(
U
(
var
).
pclipdata
->
cbSize
==
sizeof
clipcontent
+
sizeof
(
ULONG
),
"clipboard size wrong
\n
"
);
ok
(
!
memcmp
(
U
(
var
).
pclipdata
->
pClipData
,
clipcontent
,
sizeof
clipcontent
),
"clipboard contents wrong
\n
"
);
ok
(
S_OK
==
PropVariantClear
(
&
var
),
"failed to clear variant
\n
"
);
/* check deleting */
/* check deleting */
hr
=
IPropertyStorage_DeleteMultiple
(
propertyStorage
,
0
,
NULL
);
hr
=
IPropertyStorage_DeleteMultiple
(
propertyStorage
,
0
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"DeleteMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
ok
(
SUCCEEDED
(
hr
),
"DeleteMultiple with 0 args failed: 0x%08lx
\n
"
,
hr
);
...
...
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