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
ee706d3d
Commit
ee706d3d
authored
Sep 04, 2010
by
Alexandre Goujon
Committed by
Alexandre Julliard
Sep 09, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avifil32: Fix EditStreamSetInfo wine checks.
parent
bb9a6ea2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
15 deletions
+106
-15
api.c
dlls/avifil32/api.c
+4
-3
editstream.c
dlls/avifil32/editstream.c
+2
-10
api.c
dlls/avifil32/tests/api.c
+100
-2
No files found.
dlls/avifil32/api.c
View file @
ee706d3d
...
...
@@ -2150,9 +2150,7 @@ HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
TRACE
(
"(%p,%p,%d)
\n
"
,
pstream
,
asi
,
size
);
if
(
pstream
==
NULL
)
return
AVIERR_BADHANDLE
;
if
((
DWORD
)
size
<
sizeof
(
AVISTREAMINFOA
))
if
(
size
>=
0
&&
size
<
sizeof
(
AVISTREAMINFOA
))
return
AVIERR_BADSIZE
;
memcpy
(
&
asiw
,
asi
,
sizeof
(
asiw
)
-
sizeof
(
asiw
.
szName
));
...
...
@@ -2173,6 +2171,9 @@ HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
TRACE
(
"(%p,%p,%d)
\n
"
,
pstream
,
asi
,
size
);
if
(
size
>=
0
&&
size
<
sizeof
(
AVISTREAMINFOA
))
return
AVIERR_BADSIZE
;
hr
=
IAVIStream_QueryInterface
(
pstream
,
&
IID_IAVIEditStream
,(
LPVOID
*
)
&
pEdit
);
if
(
SUCCEEDED
(
hr
)
&&
pEdit
!=
NULL
)
{
hr
=
IAVIEditStream_SetInfo
(
pEdit
,
asi
,
size
);
...
...
dlls/avifil32/editstream.c
View file @
ee706d3d
...
...
@@ -775,23 +775,15 @@ static HRESULT WINAPI IAVIEditStream_fnSetInfo(IAVIEditStream*iface,
TRACE
(
"(%p,%p,%d)
\n
"
,
iface
,
asi
,
size
);
/* check parameters */
if
(
asi
==
NULL
)
return
AVIERR_BADPARAM
;
if
(
size
!=
sizeof
(
AVISTREAMINFOW
))
if
(
size
>=
0
&&
size
<
sizeof
(
AVISTREAMINFOW
))
return
AVIERR_BADSIZE
;
if
(
asi
->
dwScale
==
0
||
asi
->
dwRate
==
0
||
(
LONG
)
asi
->
dwQuality
<
-
1
||
asi
->
dwQuality
>
ICQUALITY_HIGH
)
return
AVIERR_ERROR
;
This
->
sInfo
.
wLanguage
=
asi
->
wLanguage
;
This
->
sInfo
.
wPriority
=
asi
->
wPriority
;
This
->
sInfo
.
dwStart
=
asi
->
dwStart
;
if
(
asi
->
dwRate
!=
0
)
This
->
sInfo
.
dwRate
=
asi
->
dwRate
;
if
(
asi
->
dwScale
!=
0
)
This
->
sInfo
.
dwScale
=
asi
->
dwScale
;
if
(
asi
->
dwQuality
<=
ICQUALITY_HIGH
)
This
->
sInfo
.
dwQuality
=
ICQUALITY_HIGH
;
This
->
sInfo
.
dwQuality
=
asi
->
dwQuality
;
CopyRect
(
&
This
->
sInfo
.
rcFrame
,
&
asi
->
rcFrame
);
memcpy
(
This
->
sInfo
.
szName
,
asi
->
szName
,
sizeof
(
asi
->
szName
));
This
->
sInfo
.
dwEditCount
++
;
...
...
dlls/avifil32/tests/api.c
View file @
ee706d3d
...
...
@@ -194,11 +194,11 @@ static void test_AVISaveOptions(void)
SetLastError
(
0xdeadbeef
);
hres
=
EditStreamSetNameA
(
streams
[
0
],
winetest0
);
todo_wine
ok
(
hres
==
AVIERR_OK
,
"0: got 0x%x (expected AVIERR_OK)
\n
"
,
hres
);
ok
(
hres
==
AVIERR_OK
,
"0: got 0x%x (expected AVIERR_OK)
\n
"
,
hres
);
SetLastError
(
0xdeadbeef
);
hres
=
EditStreamSetNameA
(
streams
[
1
],
winetest1
);
todo_wine
ok
(
hres
==
AVIERR_OK
,
"1: got 0x%x (expected AVIERR_OK)
\n
"
,
hres
);
ok
(
hres
==
AVIERR_OK
,
"1: got 0x%x (expected AVIERR_OK)
\n
"
,
hres
);
if
(
winetest_interactive
)
{
SetLastError
(
0xdeadbeef
);
...
...
@@ -223,6 +223,103 @@ static void test_AVISaveOptions(void)
/* ########################### */
static
void
test_EditStreamSetInfo
(
void
)
{
PAVISTREAM
stream
=
NULL
;
HRESULT
hres
;
AVISTREAMINFO
info
,
info2
;
hres
=
CreateEditableStream
(
&
stream
,
NULL
);
ok
(
hres
==
AVIERR_OK
,
"got 0x%08X, expected AVIERR_OK
\n
"
,
hres
);
if
(
0
)
/* Crashing - first parameter not checked */
hres
=
EditStreamSetInfo
(
NULL
,
&
info
,
sizeof
(
AVISTREAMINFO
)
);
/* Size parameter is somehow checked (notice the crash with size=-1 below) */
hres
=
EditStreamSetInfo
(
stream
,
NULL
,
0
);
ok
(
hres
==
AVIERR_BADSIZE
,
"got 0x%08X, expected AVIERR_BADSIZE
\n
"
,
hres
);
hres
=
EditStreamSetInfo
(
stream
,
NULL
,
sizeof
(
AVISTREAMINFO
)
-
1
);
ok
(
hres
==
AVIERR_BADSIZE
,
"got 0x%08X, expected AVIERR_BADSIZE
\n
"
,
hres
);
if
(
0
)
{
/* Crashing - second parameter not checked */
hres
=
EditStreamSetInfo
(
stream
,
NULL
,
sizeof
(
AVISTREAMINFO
)
);
hres
=
EditStreamSetInfo
(
stream
,
NULL
,
-
1
);
ok
(
hres
==
AVIERR_BADSIZE
,
"got 0x%08X, expected AVIERR_BADSIZE
\n
"
,
hres
);
}
hres
=
AVIStreamInfo
(
stream
,
&
info
,
sizeof
(
AVISTREAMINFO
)
);
ok
(
hres
==
0
,
"got 0x%08X, expected 0
\n
"
,
hres
);
/* Does the function check what's it's updating ? */
#define IS_INFO_UPDATED(m) do { \
hres = EditStreamSetInfo(stream, &info, sizeof(AVISTREAMINFO) ); \
ok( hres == 0, "got 0x%08X, expected 0\n", hres); \
hres = AVIStreamInfo(stream, &info2, sizeof(AVISTREAMINFO) ); \
ok( hres == 0, "got 0x%08X, expected 0\n", hres); \
ok( info2.m == info.m, "EditStreamSetInfo did not update "#m" parameter\n" ); \
} while(0)
info
.
dwStart
++
;
IS_INFO_UPDATED
(
dwStart
);
info
.
dwStart
=
0
;
IS_INFO_UPDATED
(
dwStart
);
info
.
wPriority
++
;
IS_INFO_UPDATED
(
wPriority
);
info
.
wPriority
=
0
;
IS_INFO_UPDATED
(
wPriority
);
info
.
wLanguage
++
;
IS_INFO_UPDATED
(
wLanguage
);
info
.
wLanguage
=
0
;
IS_INFO_UPDATED
(
wLanguage
);
info
.
dwScale
++
;
IS_INFO_UPDATED
(
dwScale
);
info
.
dwScale
=
0
;
IS_INFO_UPDATED
(
dwScale
);
info
.
dwRate
++
;
IS_INFO_UPDATED
(
dwRate
);
info
.
dwRate
=
0
;
IS_INFO_UPDATED
(
dwRate
);
info
.
dwQuality
++
;
IS_INFO_UPDATED
(
dwQuality
);
info
.
dwQuality
=
0
;
IS_INFO_UPDATED
(
dwQuality
);
info
.
dwQuality
=
-
2
;
IS_INFO_UPDATED
(
dwQuality
);
info
.
dwQuality
=
ICQUALITY_HIGH
+
1
;
IS_INFO_UPDATED
(
dwQuality
);
info
.
rcFrame
.
left
=
0
;
IS_INFO_UPDATED
(
rcFrame
.
left
);
info
.
rcFrame
.
top
=
0
;
IS_INFO_UPDATED
(
rcFrame
.
top
);
info
.
rcFrame
.
right
=
0
;
IS_INFO_UPDATED
(
rcFrame
.
right
);
info
.
rcFrame
.
bottom
=
0
;
IS_INFO_UPDATED
(
rcFrame
.
bottom
);
info
.
rcFrame
.
left
=
-
1
;
IS_INFO_UPDATED
(
rcFrame
.
left
);
info
.
rcFrame
.
top
=
-
1
;
IS_INFO_UPDATED
(
rcFrame
.
top
);
info
.
rcFrame
.
right
=
-
1
;
IS_INFO_UPDATED
(
rcFrame
.
right
);
info
.
rcFrame
.
bottom
=
-
1
;
IS_INFO_UPDATED
(
rcFrame
.
bottom
);
AVIStreamRelease
(
stream
);
#undef IS_INFO_UPDATED
}
static
void
init_test_struct
(
COMMON_AVI_HEADERS
*
cah
)
{
memcpy
(
cah
->
fh
,
deffh
,
sizeof
(
deffh
));
...
...
@@ -451,6 +548,7 @@ START_TEST(api)
{
AVIFileInit
();
test_EditStreamSetInfo
();
test_AVISaveOptions
();
test_default_data
();
test_amh_corruption
();
...
...
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