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
25aff05e
Commit
25aff05e
authored
Jul 28, 2006
by
Robert Shearman
Committed by
Alexandre Julliard
Jul 28, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Add validation for parameters in IPictureDisp::Invoke.
Add some tests for IPictureDisp::Invoke.
parent
18732f85
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
103 additions
and
0 deletions
+103
-0
olepicture.c
dlls/oleaut32/olepicture.c
+37
-0
olepicture.c
dlls/oleaut32/tests/olepicture.c
+66
-0
No files found.
dlls/oleaut32/olepicture.c
View file @
25aff05e
...
...
@@ -2048,6 +2048,43 @@ static HRESULT WINAPI OLEPictureImpl_Invoke(
UINT
*
puArgErr
)
{
OLEPictureImpl
*
This
=
impl_from_IDispatch
(
iface
);
/* validate parameters */
if
(
!
IsEqualIID
(
riid
,
&
IID_NULL
))
{
ERR
(
"riid was %s instead of IID_NULL
\n
"
,
debugstr_guid
(
riid
));
return
DISP_E_UNKNOWNNAME
;
}
if
(
!
pDispParams
)
{
ERR
(
"null pDispParams not allowed
\n
"
);
return
DISP_E_PARAMNOTOPTIONAL
;
}
if
(
wFlags
&
DISPATCH_PROPERTYGET
)
{
if
(
!
pVarResult
)
{
ERR
(
"null pVarResult not allowed when DISPATCH_PROPERTYGET specified
\n
"
);
return
DISP_E_PARAMNOTOPTIONAL
;
}
}
else
if
(
wFlags
&
DISPATCH_PROPERTYPUT
)
{
if
(
pDispParams
->
cArgs
!=
1
)
{
ERR
(
"param count for DISPATCH_PROPERTYPUT was %d instead of 1
\n
"
,
pDispParams
->
cArgs
);
return
DISP_E_BADPARAMCOUNT
;
}
}
else
{
ERR
(
"one of DISPATCH_PROPERTYGET or DISPATCH_PROPERTYPUT must be specified
\n
"
);
return
DISP_E_MEMBERNOTFOUND
;
}
if
(
dispIdMember
==
DISPID_PICT_TYPE
)
{
TRACE
(
"DISPID_PICT_TYPE
\n
"
);
...
...
dlls/oleaut32/tests/olepicture.c
View file @
25aff05e
...
...
@@ -44,6 +44,8 @@ static HMODULE hOleaut32;
static
HRESULT
(
WINAPI
*
pOleLoadPicture
)(
LPSTREAM
,
LONG
,
BOOL
,
REFIID
,
LPVOID
*
);
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08lx\n", hr)
/* 1x1 pixel gif */
static
const
unsigned
char
gifimage
[
35
]
=
{
0x47
,
0x49
,
0x46
,
0x38
,
0x37
,
0x61
,
0x01
,
0x00
,
0x01
,
0x00
,
0x80
,
0x00
,
0x00
,
0xff
,
0xff
,
0xff
,
...
...
@@ -285,6 +287,68 @@ static void test_empty_image_2(void) {
IPicture_Release
(
pic
);
}
static
void
test_Invoke
(
void
)
{
IPictureDisp
*
picdisp
;
HRESULT
hr
;
VARIANTARG
vararg
;
DISPPARAMS
dispparams
;
VARIANT
varresult
;
IStream
*
stream
;
HGLOBAL
hglob
;
void
*
data
;
hglob
=
GlobalAlloc
(
0
,
sizeof
(
gifimage
));
data
=
GlobalLock
(
hglob
);
memcpy
(
data
,
gifimage
,
sizeof
(
gifimage
));
GlobalUnlock
(
hglob
);
hr
=
CreateStreamOnHGlobal
(
hglob
,
FALSE
,
&
stream
);
ok_ole_success
(
hr
,
"CreateStreamOnHGlobal"
);
hr
=
pOleLoadPicture
(
stream
,
sizeof
(
gifimage
),
TRUE
,
&
IID_IPictureDisp
,
(
void
**
)
&
picdisp
);
IStream_Release
(
stream
);
ok_ole_success
(
hr
,
"OleLoadPicture"
);
V_VT
(
&
vararg
)
=
VT_BOOL
;
V_BOOL
(
&
vararg
)
=
VARIANT_FALSE
;
dispparams
.
cNamedArgs
=
0
;
dispparams
.
rgdispidNamedArgs
=
NULL
;
dispparams
.
cArgs
=
1
;
dispparams
.
rgvarg
=
&
vararg
;
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_IPictureDisp
,
0
,
DISPATCH_PROPERTYPUT
,
&
dispparams
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_UNKNOWNNAME
,
"IPictureDisp_Invoke should have returned DISP_E_UNKNOWNNAME instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_IUnknown
,
0
,
DISPATCH_PROPERTYPUT
,
&
dispparams
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_UNKNOWNNAME
,
"IPictureDisp_Invoke should have returned DISP_E_UNKNOWNNAME instead of 0x%08lx
\n
"
,
hr
);
dispparams
.
cArgs
=
0
;
dispparams
.
rgvarg
=
NULL
;
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYPUT
,
&
dispparams
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_BADPARAMCOUNT
,
"IPictureDisp_Invoke should have returned DISP_E_BADPARAMCOUNT instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYPUT
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_PARAMNOTOPTIONAL
,
"IPictureDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYGET
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_PARAMNOTOPTIONAL
,
"IPictureDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYGET
,
NULL
,
&
varresult
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_PARAMNOTOPTIONAL
,
"IPictureDisp_Invoke should have returned DISP_E_PARAMNOTOPTIONAL instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYGET
,
&
dispparams
,
&
varresult
,
NULL
,
NULL
);
ok_ole_success
(
hr
,
"IPictureDisp_Invoke"
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
DISPID_PICT_HPAL
,
&
IID_NULL
,
0
,
DISPATCH_METHOD
,
&
dispparams
,
&
varresult
,
NULL
,
NULL
);
ok
(
hr
==
DISP_E_MEMBERNOTFOUND
,
"IPictureDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08lx
\n
"
,
hr
);
hr
=
IPictureDisp_Invoke
(
picdisp
,
0xdeadbeef
,
&
IID_NULL
,
0
,
DISPATCH_PROPERTYGET
,
&
dispparams
,
&
varresult
,
NULL
,
NULL
);
todo_wine
{
ok
(
hr
==
DISP_E_MEMBERNOTFOUND
,
"IPictureDisp_Invoke should have returned DISP_E_MEMBERNOTFOUND instead of 0x%08lx
\n
"
,
hr
);
}
IPictureDisp_Release
(
picdisp
);
}
START_TEST
(
olepicture
)
{
hOleaut32
=
LoadLibraryA
(
"oleaut32.dll"
);
...
...
@@ -302,6 +366,8 @@ START_TEST(olepicture)
*/
test_empty_image
();
test_empty_image_2
();
test_Invoke
();
}
...
...
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