Jacek Caban : oleaut32: Return error if VT_HRESULT is used as return type in DispCallFunc.
Alexandre Julliard
julliard at winehq.org
Tue Feb 12 13:58:12 CST 2013
Module: wine
Branch: master
Commit: 88367a3c58df9993164124c3abd558d6e4ffb12c
URL: http://source.winehq.org/git/wine.git/?a=commit;h=88367a3c58df9993164124c3abd558d6e4ffb12c
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Feb 12 14:52:30 2013 +0100
oleaut32: Return error if VT_HRESULT is used as return type in DispCallFunc.
---
dlls/oleaut32/tests/typelib.c | 16 ++++++++++++++++
dlls/oleaut32/typelib.c | 8 ++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 1bcc584..077c59c 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -923,6 +923,11 @@ static int WINAPI inst_func( void *inst, int a )
return a * 2;
}
+static HRESULT WINAPI ret_false_func(void)
+{
+ return S_FALSE;
+}
+
static const void *vtable[] = { NULL, NULL, NULL, inst_func };
static void test_DispCallFunc(void)
@@ -1038,6 +1043,17 @@ static void test_DispCallFunc(void)
ok( res == S_OK, "DispCallFunc failed %x\n", res );
ok( V_VT(&result) == VT_I4, "wrong result type %d\n", V_VT(&result) );
ok( V_I4(&result) == 6, "wrong result %08x\n", V_I4(&result) );
+
+ memset( &result, 0xcc, sizeof(result) );
+ res = DispCallFunc(NULL, (ULONG_PTR)ret_false_func, CC_STDCALL, VT_ERROR, 0, NULL, NULL, &result);
+ ok(res == S_OK, "DispCallFunc failed: %08x\n", res);
+ ok(V_VT(&result) == VT_ERROR, "V_VT(result) = %u\n", V_VT(&result));
+ ok(V_ERROR(&result) == S_FALSE, "V_ERROR(result) = %08x\n", V_ERROR(&result));
+
+ memset( &result, 0xcc, sizeof(result) );
+ res = DispCallFunc(NULL, (ULONG_PTR)ret_false_func, CC_STDCALL, VT_HRESULT, 0, NULL, NULL, &result);
+ ok(res == E_INVALIDARG, "DispCallFunc failed: %08x\n", res);
+ ok(V_VT(&result) == 0xcccc, "V_VT(result) = %u\n", V_VT(&result));
}
/* RegDeleteTreeW from dlls/advapi32/registry.c */
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index 97f07d2..0f3ca6b 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -6185,6 +6185,10 @@ DispCallFunc(
case VT_CY:
V_UI8(pvargResult) = call_method( func, argspos - 1, args + 1, &stack_offset );
break;
+ case VT_HRESULT:
+ WARN("invalid return type %u\n", vtReturn);
+ heap_free( args );
+ return E_INVALIDARG;
default:
V_UI4(pvargResult) = call_method( func, argspos - 1, args + 1, &stack_offset );
break;
@@ -6263,6 +6267,10 @@ DispCallFunc(
args[0] = (DWORD_PTR)pvargResult; /* arg 0 is a pointer to the result */
call_method( func, argspos, args );
break;
+ case VT_HRESULT:
+ WARN("invalid return type %u\n", vtReturn);
+ heap_free( args );
+ return E_INVALIDARG;
default:
V_UI8(pvargResult) = call_method( func, argspos - 1, args + 1 );
break;
More information about the wine-cvs
mailing list