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
987c81ba
Commit
987c81ba
authored
Jan 25, 2013
by
Ludger Sprenker
Committed by
Alexandre Julliard
Jan 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowscodecs: Implement IPropertyBag2::GetPropertyInfo.
parent
71bd7fdf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
6 deletions
+88
-6
propertybag.c
dlls/windowscodecs/propertybag.c
+88
-4
propertybag.c
dlls/windowscodecs/tests/propertybag.c
+0
-2
No files found.
dlls/windowscodecs/propertybag.c
View file @
987c81ba
...
...
@@ -27,6 +27,7 @@
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wine/unicode.h"
#include "wincodecs_private.h"
...
...
@@ -38,6 +39,7 @@ typedef struct PropertyBag {
IPropertyBag2
IPropertyBag2_iface
;
LONG
ref
;
UINT
prop_count
;
PROPBAG2
*
properties
;
}
PropertyBag
;
static
inline
PropertyBag
*
impl_from_IPropertyBag2
(
IPropertyBag2
*
iface
)
...
...
@@ -87,6 +89,16 @@ static ULONG WINAPI PropertyBag_Release(IPropertyBag2 *iface)
if
(
ref
==
0
)
{
ULONG
i
;
if
(
This
->
properties
)
{
for
(
i
=
0
;
i
<
This
->
prop_count
;
i
++
)
{
HeapFree
(
GetProcessHeap
(),
0
,
This
->
properties
[
i
].
pstrName
);
}
}
HeapFree
(
GetProcessHeap
(),
0
,
This
->
properties
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
}
...
...
@@ -121,11 +133,55 @@ static HRESULT WINAPI PropertyBag_CountProperties(IPropertyBag2 *iface, ULONG *p
return
S_OK
;
}
static
HRESULT
copy_propbag2
(
PROPBAG2
*
dest
,
PROPBAG2
*
src
,
BOOL
useCoAlloc
)
{
dest
->
cfType
=
src
->
cfType
;
dest
->
clsid
=
src
->
clsid
;
dest
->
dwHint
=
src
->
dwHint
;
dest
->
dwType
=
src
->
dwType
;
dest
->
vt
=
src
->
vt
;
if
(
useCoAlloc
)
dest
->
pstrName
=
CoTaskMemAlloc
((
strlenW
(
src
->
pstrName
)
+
1
)
*
sizeof
(
WCHAR
));
else
dest
->
pstrName
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
strlenW
(
src
->
pstrName
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
dest
->
pstrName
)
return
E_OUTOFMEMORY
;
strcpyW
(
dest
->
pstrName
,
src
->
pstrName
);
return
S_OK
;
}
static
HRESULT
WINAPI
PropertyBag_GetPropertyInfo
(
IPropertyBag2
*
iface
,
ULONG
iProperty
,
ULONG
cProperties
,
PROPBAG2
*
pPropBag
,
ULONG
*
pcProperties
)
{
FIXME
(
"(%p,%u,%u,%p,%p): stub
\n
"
,
iface
,
iProperty
,
cProperties
,
pPropBag
,
pcProperties
);
return
E_NOTIMPL
;
HRESULT
res
=
S_OK
;
ULONG
i
;
PropertyBag
*
This
=
impl_from_IPropertyBag2
(
iface
);
TRACE
(
"(%p,%u,%u,%p,%p)
\n
"
,
iface
,
iProperty
,
cProperties
,
pPropBag
,
pcProperties
);
if
(
iProperty
>=
This
->
prop_count
&&
iProperty
>
0
)
return
WINCODEC_ERR_VALUEOUTOFRANGE
;
if
(
iProperty
+
cProperties
>
This
->
prop_count
)
return
WINCODEC_ERR_VALUEOUTOFRANGE
;
*
pcProperties
=
max
(
cProperties
,
This
->
prop_count
-
iProperty
);
for
(
i
=
0
;
i
<
*
pcProperties
;
i
++
)
{
res
=
copy_propbag2
(
pPropBag
+
i
,
This
->
properties
+
iProperty
+
i
,
TRUE
);
if
(
FAILED
(
res
))
{
do
{
CoTaskMemFree
(
pPropBag
[
--
i
].
pstrName
);
}
while
(
i
);
break
;
}
}
return
res
;
}
static
HRESULT
WINAPI
PropertyBag_LoadObject
(
IPropertyBag2
*
iface
,
LPCOLESTR
pstrName
,
...
...
@@ -149,6 +205,8 @@ static const IPropertyBag2Vtbl PropertyBag_Vtbl = {
HRESULT
CreatePropertyBag2
(
PROPBAG2
*
options
,
UINT
count
,
IPropertyBag2
**
ppPropertyBag2
)
{
UINT
i
;
HRESULT
res
=
S_OK
;
PropertyBag
*
This
;
This
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
PropertyBag
));
...
...
@@ -158,7 +216,33 @@ HRESULT CreatePropertyBag2(PROPBAG2 *options, UINT count,
This
->
ref
=
1
;
This
->
prop_count
=
count
;
*
ppPropertyBag2
=
&
This
->
IPropertyBag2_iface
;
if
(
count
==
0
)
{
This
->
properties
=
NULL
;
}
else
{
This
->
properties
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
PROPBAG2
)
*
count
);
if
(
!
This
->
properties
)
res
=
E_OUTOFMEMORY
;
else
for
(
i
=
0
;
i
<
count
;
i
++
)
{
res
=
copy_propbag2
(
This
->
properties
+
i
,
options
+
i
,
FALSE
);
if
(
FAILED
(
res
))
break
;
This
->
properties
[
i
].
dwHint
=
i
+
1
;
/* 0 means unset, so we start with 1 */
}
}
return
S_OK
;
if
(
FAILED
(
res
))
{
PropertyBag_Release
(
&
This
->
IPropertyBag2_iface
);
*
ppPropertyBag2
=
NULL
;
}
else
*
ppPropertyBag2
=
&
This
->
IPropertyBag2_iface
;
return
res
;
}
dlls/windowscodecs/tests/propertybag.c
View file @
987c81ba
...
...
@@ -239,7 +239,6 @@ static void test_empty_propertybag(void)
test_propertybag_countproperties
(
property
,
0
);
todo_wine
test_propertybag_getpropertyinfo
(
property
,
0
);
IPropertyBag2_Release
(
property
);
...
...
@@ -268,7 +267,6 @@ static void test_filled_propertybag(void)
test_propertybag_countproperties
(
property
,
2
);
todo_wine
test_propertybag_getpropertyinfo
(
property
,
2
);
todo_wine
...
...
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