Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
1d099334
Commit
1d099334
authored
Nov 01, 2007
by
Rob Shearman
Committed by
Alexandre Julliard
Nov 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add tests for CoGetObjectContext.
parent
2eb10c2e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
0 deletions
+57
-0
compobj.c
dlls/ole32/tests/compobj.c
+57
-0
No files found.
dlls/ole32/tests/compobj.c
View file @
1d099334
...
...
@@ -33,6 +33,7 @@
/* functions that are not present on all versions of Windows */
HRESULT
(
WINAPI
*
pCoInitializeEx
)(
LPVOID
lpReserved
,
DWORD
dwCoInit
);
HRESULT
(
WINAPI
*
pCoGetObjectContext
)(
REFIID
riid
,
LPVOID
*
ppv
);
#define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
#define ok_more_than_one_lock() ok(cLocks > 0, "Number of locks should be > 0, but actually is %d\n", cLocks)
...
...
@@ -938,10 +939,65 @@ static void test_CoFreeUnusedLibraries(void)
CoUninitialize
();
}
static
void
test_CoGetObjectContext
(
void
)
{
HRESULT
hr
;
ULONG
refs
;
IComThreadingInfo
*
pComThreadingInfo
;
APTTYPE
apttype
;
THDTYPE
thdtype
;
if
(
!
pCoGetObjectContext
)
{
skip
(
"CoGetObjectContext not present
\n
"
);
return
;
}
hr
=
pCoGetObjectContext
(
&
IID_IComThreadingInfo
,
(
void
**
)
&
pComThreadingInfo
);
ok
(
hr
==
CO_E_NOTINITIALIZED
,
"CoGetObjectContext should have returned CO_E_NOTINITIALIZED instead of 0x%08x
\n
"
,
hr
);
ok
(
pComThreadingInfo
==
NULL
,
"pComThreadingInfo should have been set to NULL
\n
"
);
pCoInitializeEx
(
NULL
,
COINIT_APARTMENTTHREADED
);
hr
=
pCoGetObjectContext
(
&
IID_IComThreadingInfo
,
(
void
**
)
&
pComThreadingInfo
);
ok_ole_success
(
hr
,
"CoGetObjectContext"
);
hr
=
IComThreadingInfo_GetCurrentApartmentType
(
pComThreadingInfo
,
&
apttype
);
ok_ole_success
(
hr
,
"IComThreadingInfo_GetCurrentApartmentType"
);
ok
(
apttype
==
APTTYPE_MAINSTA
,
"apartment type should be APTTYPE_MAINSTA instead of %d
\n
"
,
apttype
);
hr
=
IComThreadingInfo_GetCurrentThreadType
(
pComThreadingInfo
,
&
thdtype
);
ok_ole_success
(
hr
,
"IComThreadingInfo_GetCurrentThreadType"
);
ok
(
thdtype
==
THDTYPE_PROCESSMESSAGES
,
"thread type should be THDTYPE_PROCESSMESSAGES instead of %d
\n
"
,
thdtype
);
refs
=
IComThreadingInfo_Release
(
pComThreadingInfo
);
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
CoUninitialize
();
pCoInitializeEx
(
NULL
,
COINIT_MULTITHREADED
);
hr
=
pCoGetObjectContext
(
&
IID_IComThreadingInfo
,
(
void
**
)
&
pComThreadingInfo
);
ok_ole_success
(
hr
,
"CoGetObjectContext"
);
hr
=
IComThreadingInfo_GetCurrentApartmentType
(
pComThreadingInfo
,
&
apttype
);
ok_ole_success
(
hr
,
"IComThreadingInfo_GetCurrentApartmentType"
);
ok
(
apttype
==
APTTYPE_MTA
,
"apartment type should be APTTYPE_MTA instead of %d
\n
"
,
apttype
);
hr
=
IComThreadingInfo_GetCurrentThreadType
(
pComThreadingInfo
,
&
thdtype
);
ok_ole_success
(
hr
,
"IComThreadingInfo_GetCurrentThreadType"
);
ok
(
thdtype
==
THDTYPE_BLOCKMESSAGES
,
"thread type should be THDTYPE_BLOCKMESSAGES instead of %d
\n
"
,
thdtype
);
refs
=
IComThreadingInfo_Release
(
pComThreadingInfo
);
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
CoUninitialize
();
}
START_TEST
(
compobj
)
{
HMODULE
hOle32
=
GetModuleHandle
(
"ole32"
);
pCoGetObjectContext
=
(
void
*
)
GetProcAddress
(
hOle32
,
"CoGetObjectContext"
);
if
(
!
(
pCoInitializeEx
=
(
void
*
)
GetProcAddress
(
hOle32
,
"CoInitializeEx"
)))
{
trace
(
"You need DCOM95 installed to run this test
\n
"
);
...
...
@@ -964,4 +1020,5 @@ START_TEST(compobj)
test_CoRegisterClassObject
();
test_registered_object_thread_affinity
();
test_CoFreeUnusedLibraries
();
test_CoGetObjectContext
();
}
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