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
7f882508
Commit
7f882508
authored
Dec 14, 2012
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 14, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32: Added a test for prop getter invocation with different flags.
parent
86cb15b2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
153 additions
and
26 deletions
+153
-26
test_reg.idl
dlls/oleaut32/tests/test_reg.idl
+8
-0
typelib.c
dlls/oleaut32/tests/typelib.c
+145
-26
No files found.
dlls/oleaut32/tests/test_reg.idl
View file @
7f882508
...
@@ -127,4 +127,12 @@ library register_test
...
@@ -127,4 +127,12 @@ library register_test
interface
Iole_from_disp
;
interface
Iole_from_disp
;
}
}
[
uuid
(
f1b68c3b
-
02
a3
-
4110
-
bc4c
-
cf9bc7e7f177
)
]
interface
IInvokeTest
:
IDispatch
{
[
propget
,
id
(
DISPID_VALUE
)
]
LONG
test
(
[
in
]
LONG
i
)
;
}
}
}
dlls/oleaut32/tests/typelib.c
View file @
7f882508
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
*/
*/
#define COBJMACROS
#define COBJMACROS
#define CONST_VTABLE
#include <wine/test.h>
#include <wine/test.h>
#include <stdarg.h>
#include <stdarg.h>
...
@@ -64,6 +65,74 @@ static WCHAR wszguid[] = {'g','u','i','d',0};
...
@@ -64,6 +65,74 @@ static WCHAR wszguid[] = {'g','u','i','d',0};
static
const
int
is_win64
=
sizeof
(
void
*
)
>
sizeof
(
int
);
static
const
int
is_win64
=
sizeof
(
void
*
)
>
sizeof
(
int
);
static
HRESULT
WINAPI
invoketest_QueryInterface
(
IInvokeTest
*
iface
,
REFIID
riid
,
void
**
ret
)
{
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IDispatch
)
||
IsEqualIID
(
riid
,
&
IID_IInvokeTest
))
{
*
ret
=
iface
;
return
S_OK
;
}
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
invoketest_AddRef
(
IInvokeTest
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
invoketest_Release
(
IInvokeTest
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
invoketest_GetTypeInfoCount
(
IInvokeTest
*
iface
,
UINT
*
cnt
)
{
ok
(
0
,
"unexpected call
\n
"
);
*
cnt
=
0
;
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
invoketest_GetTypeInfo
(
IInvokeTest
*
iface
,
UINT
index
,
LCID
lcid
,
ITypeInfo
**
ti
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
invoketest_GetIDsOfNames
(
IInvokeTest
*
iface
,
REFIID
riid
,
LPOLESTR
*
names
,
UINT
cnt
,
LCID
lcid
,
DISPID
*
dispid
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
invoketest_Invoke
(
IInvokeTest
*
iface
,
DISPID
dispid
,
REFIID
riid
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dispparams
,
VARIANT
*
res
,
EXCEPINFO
*
ei
,
UINT
*
argerr
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
LONG
WINAPI
invoketest_get_test
(
IInvokeTest
*
iface
,
LONG
i
)
{
return
i
+
1
;
}
static
const
IInvokeTestVtbl
invoketestvtbl
=
{
invoketest_QueryInterface
,
invoketest_AddRef
,
invoketest_Release
,
invoketest_GetTypeInfoCount
,
invoketest_GetTypeInfo
,
invoketest_GetIDsOfNames
,
invoketest_Invoke
,
invoketest_get_test
};
static
IInvokeTest
invoketest
=
{
&
invoketestvtbl
};
static
void
init_function_pointers
(
void
)
static
void
init_function_pointers
(
void
)
{
{
HMODULE
hmod
=
GetModuleHandleA
(
"oleaut32.dll"
);
HMODULE
hmod
=
GetModuleHandleA
(
"oleaut32.dll"
);
...
@@ -534,6 +603,27 @@ static void test_CreateDispTypeInfo(void)
...
@@ -534,6 +603,27 @@ static void test_CreateDispTypeInfo(void)
SysFreeString
(
methdata
[
3
].
szName
);
SysFreeString
(
methdata
[
3
].
szName
);
}
}
static
const
char
*
create_test_typelib
(
int
res_no
)
{
static
char
filename
[
MAX_PATH
];
HANDLE
file
;
HRSRC
res
;
void
*
ptr
;
DWORD
written
;
GetTempFileNameA
(
"."
,
"tlb"
,
0
,
filename
);
file
=
CreateFile
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"file creation failed
\n
"
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
NULL
;
res
=
FindResource
(
GetModuleHandle
(
0
),
MAKEINTRESOURCE
(
res_no
),
"TYPELIB"
);
ok
(
res
!=
0
,
"couldn't find resource
\n
"
);
ptr
=
LockResource
(
LoadResource
(
GetModuleHandle
(
0
),
res
));
WriteFile
(
file
,
ptr
,
SizeofResource
(
GetModuleHandle
(
0
),
res
),
&
written
,
NULL
);
ok
(
written
==
SizeofResource
(
GetModuleHandle
(
0
),
res
),
"couldn't write resource
\n
"
);
CloseHandle
(
file
);
return
filename
;
}
static
void
test_TypeInfo
(
void
)
static
void
test_TypeInfo
(
void
)
{
{
ITypeLib
*
pTypeLib
;
ITypeLib
*
pTypeLib
;
...
@@ -549,9 +639,11 @@ static void test_TypeInfo(void)
...
@@ -549,9 +639,11 @@ static void test_TypeInfo(void)
DISPID
dispidMember
;
DISPID
dispidMember
;
DISPPARAMS
dispparams
;
DISPPARAMS
dispparams
;
GUID
bogusguid
=
{
0x806afb4f
,
0x13f7
,
0x42d2
,{
0x89
,
0x2c
,
0x6c
,
0x97
,
0xc3
,
0x6a
,
0x36
,
0xc1
}};
GUID
bogusguid
=
{
0x806afb4f
,
0x13f7
,
0x42d2
,{
0x89
,
0x2c
,
0x6c
,
0x97
,
0xc3
,
0x6a
,
0x36
,
0xc1
}};
VARIANT
var
;
VARIANT
var
,
res
,
args
[
2
]
;
UINT
count
;
UINT
count
,
i
;
TYPEKIND
kind
;
TYPEKIND
kind
;
const
char
*
filenameA
;
WCHAR
filename
[
MAX_PATH
];
hr
=
LoadTypeLib
(
wszStdOle2
,
&
pTypeLib
);
hr
=
LoadTypeLib
(
wszStdOle2
,
&
pTypeLib
);
ok_ole_success
(
hr
,
LoadTypeLib
);
ok_ole_success
(
hr
,
LoadTypeLib
);
...
@@ -714,6 +806,53 @@ static void test_TypeInfo(void)
...
@@ -714,6 +806,53 @@ static void test_TypeInfo(void)
ITypeInfo_Release
(
pTypeInfo
);
ITypeInfo_Release
(
pTypeInfo
);
ITypeLib_Release
(
pTypeLib
);
ITypeLib_Release
(
pTypeLib
);
filenameA
=
create_test_typelib
(
3
);
MultiByteToWideChar
(
CP_ACP
,
0
,
filenameA
,
-
1
,
filename
,
MAX_PATH
);
hr
=
LoadTypeLib
(
filename
,
&
pTypeLib
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITypeLib_GetTypeInfoOfGuid
(
pTypeLib
,
&
IID_IInvokeTest
,
&
pTypeInfo
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
dispparams
.
cArgs
=
1
;
dispparams
.
cNamedArgs
=
0
;
dispparams
.
rgdispidNamedArgs
=
NULL
;
dispparams
.
rgvarg
=
args
;
V_VT
(
&
args
[
0
])
=
VT_I4
;
V_I4
(
&
args
[
0
])
=
0
;
V_VT
(
&
res
)
=
VT_EMPTY
;
i
=
0
;
V_VT
(
&
res
)
=
VT_EMPTY
;
V_I4
(
&
res
)
=
0
;
/* call propget with DISPATCH_METHOD|DISPATCH_PROPERTYGET flags */
hr
=
ITypeInfo_Invoke
(
pTypeInfo
,
&
invoketest
,
DISPID_VALUE
,
DISPATCH_METHOD
|
DISPATCH_PROPERTYGET
,
&
dispparams
,
&
res
,
NULL
,
&
i
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
V_VT
(
&
res
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
res
));
ok
(
V_I4
(
&
res
)
==
1
,
"got %d
\n
"
,
V_I4
(
&
res
));
i
=
0
;
/* call propget with DISPATCH_METHOD flags */
hr
=
ITypeInfo_Invoke
(
pTypeInfo
,
&
invoketest
,
DISPID_VALUE
,
DISPATCH_METHOD
,
&
dispparams
,
&
res
,
NULL
,
&
i
);
ok
(
hr
==
DISP_E_MEMBERNOTFOUND
,
"got 0x%08x, %d
\n
"
,
hr
,
i
);
i
=
0
;
V_VT
(
&
res
)
=
VT_EMPTY
;
V_I4
(
&
res
)
=
0
;
hr
=
ITypeInfo_Invoke
(
pTypeInfo
,
&
invoketest
,
DISPID_VALUE
,
DISPATCH_PROPERTYGET
,
&
dispparams
,
&
res
,
NULL
,
&
i
);
ok
(
hr
==
S_OK
,
"got 0x%08x, %d
\n
"
,
hr
,
i
);
ok
(
V_VT
(
&
res
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
res
));
ok
(
V_I4
(
&
res
)
==
1
,
"got %d
\n
"
,
V_I4
(
&
res
));
ITypeInfo_Release
(
pTypeInfo
);
ITypeLib_Release
(
pTypeLib
);
DeleteFileA
(
filenameA
);
}
}
static
int
WINAPI
int_func
(
int
a0
,
int
a1
,
int
a2
,
int
a3
,
int
a4
)
static
int
WINAPI
int_func
(
int
a0
,
int
a1
,
int
a2
,
int
a3
,
int
a4
)
...
@@ -2722,27 +2861,6 @@ static void test_dump_typelib(const char *name)
...
@@ -2722,27 +2861,6 @@ static void test_dump_typelib(const char *name)
#endif
#endif
static
const
char
*
create_test_typelib
(
int
res_no
)
{
static
char
filename
[
MAX_PATH
];
HANDLE
file
;
HRSRC
res
;
void
*
ptr
;
DWORD
written
;
GetTempFileNameA
(
"."
,
"tlb"
,
0
,
filename
);
file
=
CreateFile
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"file creation failed
\n
"
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
NULL
;
res
=
FindResource
(
GetModuleHandle
(
0
),
MAKEINTRESOURCE
(
res_no
),
"TYPELIB"
);
ok
(
res
!=
0
,
"couldn't find resource
\n
"
);
ptr
=
LockResource
(
LoadResource
(
GetModuleHandle
(
0
),
res
));
WriteFile
(
file
,
ptr
,
SizeofResource
(
GetModuleHandle
(
0
),
res
),
&
written
,
NULL
);
ok
(
written
==
SizeofResource
(
GetModuleHandle
(
0
),
res
),
"couldn't write resource
\n
"
);
CloseHandle
(
file
);
return
filename
;
}
static
void
test_create_typelib_lcid
(
LCID
lcid
)
static
void
test_create_typelib_lcid
(
LCID
lcid
)
{
{
char
filename
[
MAX_PATH
];
char
filename
[
MAX_PATH
];
...
@@ -2813,7 +2931,7 @@ static void test_register_typelib(BOOL system_registration)
...
@@ -2813,7 +2931,7 @@ static void test_register_typelib(BOOL system_registration)
{
{
TYPEKIND
kind
;
TYPEKIND
kind
;
WORD
flags
;
WORD
flags
;
}
attrs
[
1
1
]
=
}
attrs
[
1
2
]
=
{
{
{
TKIND_INTERFACE
,
0
},
{
TKIND_INTERFACE
,
0
},
{
TKIND_INTERFACE
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_INTERFACE
,
TYPEFLAG_FDISPATCHABLE
},
...
@@ -2825,7 +2943,8 @@ static void test_register_typelib(BOOL system_registration)
...
@@ -2825,7 +2943,8 @@ static void test_register_typelib(BOOL system_registration)
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
|
TYPEFLAG_FDUAL
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
|
TYPEFLAG_FDUAL
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
}
{
TKIND_DISPATCH
,
TYPEFLAG_FDISPATCHABLE
},
{
TKIND_INTERFACE
,
TYPEFLAG_FDISPATCHABLE
}
};
};
trace
(
"Starting %s typelib registration tests
\n
"
,
trace
(
"Starting %s typelib registration tests
\n
"
,
...
@@ -2857,7 +2976,7 @@ static void test_register_typelib(BOOL system_registration)
...
@@ -2857,7 +2976,7 @@ static void test_register_typelib(BOOL system_registration)
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"got %08x
\n
"
,
hr
);
count
=
ITypeLib_GetTypeInfoCount
(
typelib
);
count
=
ITypeLib_GetTypeInfoCount
(
typelib
);
ok
(
count
==
1
1
,
"got %d
\n
"
,
count
);
ok
(
count
==
1
2
,
"got %d
\n
"
,
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
{
...
...
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