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
254e76fc
Commit
254e76fc
authored
Mar 15, 2016
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 16, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32/tests: Some tests for IInitializeSpy.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
70a643d0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
135 additions
and
0 deletions
+135
-0
compobj.c
dlls/ole32/tests/compobj.c
+133
-0
objbase.h
include/objbase.h
+2
-0
No files found.
dlls/ole32/tests/compobj.c
View file @
254e76fc
...
...
@@ -3129,6 +3129,138 @@ static void test_CoGetCurrentLogicalThreadId(void)
ok
(
!
IsEqualGUID
(
&
id
,
&
GUID_NULL
),
"got null id
\n
"
);
}
static
HRESULT
WINAPI
testinitialize_QI
(
IInitializeSpy
*
iface
,
REFIID
riid
,
void
**
obj
)
{
if
(
IsEqualIID
(
riid
,
&
IID_IInitializeSpy
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IInitializeSpy_AddRef
(
iface
);
return
S_OK
;
}
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
testinitialize_AddRef
(
IInitializeSpy
*
iface
)
{
return
2
;
}
static
ULONG
WINAPI
testinitialize_Release
(
IInitializeSpy
*
iface
)
{
return
1
;
}
static
HRESULT
WINAPI
testinitialize_PreInitialize
(
IInitializeSpy
*
iface
,
DWORD
coinit
,
DWORD
aptrefs
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
testinitialize_PostInitialize
(
IInitializeSpy
*
iface
,
HRESULT
hr
,
DWORD
coinit
,
DWORD
aptrefs
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
testinitialize_PreUninitialize
(
IInitializeSpy
*
iface
,
DWORD
aptrefs
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
testinitialize_PostUninitialize
(
IInitializeSpy
*
iface
,
DWORD
aptrefs
)
{
ok
(
0
,
"unexpected call
\n
"
);
return
E_NOTIMPL
;
}
static
const
IInitializeSpyVtbl
testinitializevtbl
=
{
testinitialize_QI
,
testinitialize_AddRef
,
testinitialize_Release
,
testinitialize_PreInitialize
,
testinitialize_PostInitialize
,
testinitialize_PreUninitialize
,
testinitialize_PostUninitialize
};
static
IInitializeSpy
testinitialize
=
{
&
testinitializevtbl
};
static
void
test_IInitializeSpy
(
void
)
{
ULARGE_INTEGER
cookie
,
cookie1
,
cookie2
;
HRESULT
hr
;
hr
=
CoRegisterInitializeSpy
(
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
cookie
.
QuadPart
=
1
;
hr
=
CoRegisterInitializeSpy
(
NULL
,
&
cookie
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
ok
(
cookie
.
QuadPart
==
1
,
"got wrong cookie
\n
"
);
hr
=
CoRegisterInitializeSpy
(
&
testinitialize
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
cookie
.
HighPart
=
0
;
cookie
.
LowPart
=
1
;
hr
=
CoRegisterInitializeSpy
(
&
testinitialize
,
&
cookie
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
todo_wine
{
ok
(
cookie
.
HighPart
==
GetCurrentThreadId
(),
"got high part 0x%08x, expected 0x%08x
\n
"
,
cookie
.
HighPart
,
GetCurrentThreadId
());
ok
(
cookie
.
LowPart
==
0
,
"got wrong low part 0x%x
\n
"
,
cookie
.
LowPart
);
}
/* register same instance one more time */
cookie1
.
HighPart
=
0
;
cookie1
.
LowPart
=
0
;
hr
=
CoRegisterInitializeSpy
(
&
testinitialize
,
&
cookie1
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
cookie1
.
HighPart
==
GetCurrentThreadId
(),
"got high part 0x%08x, expected 0x%08x
\n
"
,
cookie1
.
HighPart
,
GetCurrentThreadId
());
ok
(
cookie1
.
LowPart
==
1
,
"got wrong low part 0x%x
\n
"
,
cookie1
.
LowPart
);
}
cookie2
.
HighPart
=
0
;
cookie2
.
LowPart
=
0
;
hr
=
CoRegisterInitializeSpy
(
&
testinitialize
,
&
cookie2
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
cookie2
.
HighPart
==
GetCurrentThreadId
(),
"got high part 0x%08x, expected 0x%08x
\n
"
,
cookie2
.
HighPart
,
GetCurrentThreadId
());
ok
(
cookie2
.
LowPart
==
2
,
"got wrong low part 0x%x
\n
"
,
cookie2
.
LowPart
);
}
hr
=
CoRevokeInitializeSpy
(
cookie1
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
CoRevokeInitializeSpy
(
cookie1
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
cookie1
.
HighPart
=
0
;
cookie1
.
LowPart
=
0
;
hr
=
CoRegisterInitializeSpy
(
&
testinitialize
,
&
cookie1
);
todo_wine
{
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
cookie1
.
HighPart
==
GetCurrentThreadId
(),
"got high part 0x%08x, expected 0x%08x
\n
"
,
cookie1
.
HighPart
,
GetCurrentThreadId
());
ok
(
cookie1
.
LowPart
==
1
,
"got wrong low part 0x%x
\n
"
,
cookie1
.
LowPart
);
}
hr
=
CoRevokeInitializeSpy
(
cookie
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
CoRevokeInitializeSpy
(
cookie1
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
CoRevokeInitializeSpy
(
cookie2
);
todo_wine
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
}
static
void
init_funcs
(
void
)
{
HMODULE
hOle32
=
GetModuleHandleA
(
"ole32"
);
...
...
@@ -3198,4 +3330,5 @@ START_TEST(compobj)
test_CoGetApartmentType
();
test_IMallocSpy
();
test_CoGetCurrentLogicalThreadId
();
test_IInitializeSpy
();
}
include/objbase.h
View file @
254e76fc
...
...
@@ -370,6 +370,8 @@ HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pClsidNew);
HRESULT
WINAPI
CoTreatAsClass
(
REFCLSID
clsidOld
,
REFCLSID
clsidNew
);
HRESULT
WINAPI
CoAllowSetForegroundWindow
(
IUnknown
*
pUnk
,
LPVOID
lpvReserved
);
HRESULT
WINAPI
CoGetObjectContext
(
REFIID
riid
,
LPVOID
*
ppv
);
HRESULT
WINAPI
CoRegisterInitializeSpy
(
IInitializeSpy
*
spy
,
ULARGE_INTEGER
*
cookie
);
HRESULT
WINAPI
CoRevokeInitializeSpy
(
ULARGE_INTEGER
cookie
);
HRESULT
WINAPI
CoCreateGuid
(
GUID
*
pguid
);
BOOL
WINAPI
CoIsOle1Class
(
REFCLSID
rclsid
);
...
...
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