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
37d27c38
Commit
37d27c38
authored
Jan 14, 2009
by
Andrey Turkin
Committed by
Alexandre Julliard
Jan 15, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add IContextCallback interface to context object.
parent
ba48d378
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
24 deletions
+92
-24
compobj.c
dlls/ole32/compobj.c
+92
-20
compobj.c
dlls/ole32/tests/compobj.c
+0
-4
No files found.
dlls/ole32/compobj.c
View file @
37d27c38
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
#include "objbase.h"
#include "objbase.h"
#include "ole2.h"
#include "ole2.h"
#include "ole2ver.h"
#include "ole2ver.h"
#include "ctxtcall.h"
#include "compobj_private.h"
#include "compobj_private.h"
...
@@ -3703,19 +3704,37 @@ HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChann
...
@@ -3703,19 +3704,37 @@ HRESULT WINAPI CoRegisterChannelHook(REFGUID guidExtension, IChannelHook *pChann
typedef
struct
Context
typedef
struct
Context
{
{
const
IComThreadingInfoVtbl
*
lpVtbl
;
const
IComThreadingInfoVtbl
*
lpVtbl
;
const
IContextCallbackVtbl
*
lpCallbackVtbl
;
LONG
refs
;
LONG
refs
;
APTTYPE
apttype
;
APTTYPE
apttype
;
}
Context
;
}
Context
;
static
HRESULT
WINAPI
Context_QueryInterface
(
IComThreadingInfo
*
iface
,
REFIID
riid
,
LPVOID
*
ppv
)
static
inline
Context
*
impl_from_IComThreadingInfo
(
IComThreadingInfo
*
iface
)
{
return
(
Context
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
Context
,
lpVtbl
));
}
static
inline
Context
*
impl_from_IContextCallback
(
IContextCallback
*
iface
)
{
return
(
Context
*
)((
char
*
)
iface
-
FIELD_OFFSET
(
Context
,
lpCallbackVtbl
));
}
static
HRESULT
Context_QueryInterface
(
Context
*
iface
,
REFIID
riid
,
LPVOID
*
ppv
)
{
{
*
ppv
=
NULL
;
*
ppv
=
NULL
;
if
(
IsEqualIID
(
riid
,
&
IID_IComThreadingInfo
)
||
if
(
IsEqualIID
(
riid
,
&
IID_IComThreadingInfo
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
{
*
ppv
=
iface
;
*
ppv
=
&
iface
->
lpVtbl
;
IUnknown_AddRef
(
iface
);
}
else
if
(
IsEqualIID
(
riid
,
&
IID_IContextCallback
))
{
*
ppv
=
&
iface
->
lpCallbackVtbl
;
}
if
(
*
ppv
)
{
IUnknown_AddRef
((
IUnknown
*
)
*
ppv
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -3723,24 +3742,40 @@ static HRESULT WINAPI Context_QueryInterface(IComThreadingInfo *iface, REFIID ri
...
@@ -3723,24 +3742,40 @@ static HRESULT WINAPI Context_QueryInterface(IComThreadingInfo *iface, REFIID ri
return
E_NOINTERFACE
;
return
E_NOINTERFACE
;
}
}
static
ULONG
WINAPI
Context_AddRef
(
IComThreadingInfo
*
iface
)
static
ULONG
Context_AddRef
(
Context
*
This
)
{
{
Context
*
This
=
(
Context
*
)
iface
;
return
InterlockedIncrement
(
&
This
->
refs
);
return
InterlockedIncrement
(
&
This
->
refs
);
}
}
static
ULONG
WINAPI
Context_Release
(
IComThreadingInfo
*
iface
)
static
ULONG
Context_Release
(
Context
*
This
)
{
{
Context
*
This
=
(
Context
*
)
iface
;
ULONG
refs
=
InterlockedDecrement
(
&
This
->
refs
);
ULONG
refs
=
InterlockedDecrement
(
&
This
->
refs
);
if
(
!
refs
)
if
(
!
refs
)
HeapFree
(
GetProcessHeap
(),
0
,
This
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
refs
;
return
refs
;
}
}
static
HRESULT
WINAPI
Context_GetCurrentApartmentType
(
IComThreadingInfo
*
iface
,
APTTYPE
*
apttype
)
static
HRESULT
WINAPI
Context_CTI_QueryInterface
(
IComThreadingInfo
*
iface
,
REFIID
riid
,
LPVOID
*
ppv
)
{
Context
*
This
=
impl_from_IComThreadingInfo
(
iface
);
return
Context_QueryInterface
(
This
,
riid
,
ppv
);
}
static
ULONG
WINAPI
Context_CTI_AddRef
(
IComThreadingInfo
*
iface
)
{
Context
*
This
=
impl_from_IComThreadingInfo
(
iface
);
return
Context_AddRef
(
This
);
}
static
ULONG
WINAPI
Context_CTI_Release
(
IComThreadingInfo
*
iface
)
{
Context
*
This
=
impl_from_IComThreadingInfo
(
iface
);
return
Context_Release
(
This
);
}
static
HRESULT
WINAPI
Context_CTI_GetCurrentApartmentType
(
IComThreadingInfo
*
iface
,
APTTYPE
*
apttype
)
{
{
Context
*
This
=
(
Context
*
)
iface
;
Context
*
This
=
impl_from_IComThreadingInfo
(
iface
)
;
TRACE
(
"(%p)
\n
"
,
apttype
);
TRACE
(
"(%p)
\n
"
,
apttype
);
...
@@ -3748,9 +3783,9 @@ static HRESULT WINAPI Context_GetCurrentApartmentType(IComThreadingInfo *iface,
...
@@ -3748,9 +3783,9 @@ static HRESULT WINAPI Context_GetCurrentApartmentType(IComThreadingInfo *iface,
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
Context_GetCurrentThreadType
(
IComThreadingInfo
*
iface
,
THDTYPE
*
thdtype
)
static
HRESULT
WINAPI
Context_
CTI_
GetCurrentThreadType
(
IComThreadingInfo
*
iface
,
THDTYPE
*
thdtype
)
{
{
Context
*
This
=
(
Context
*
)
iface
;
Context
*
This
=
impl_from_IComThreadingInfo
(
iface
)
;
TRACE
(
"(%p)
\n
"
,
thdtype
);
TRACE
(
"(%p)
\n
"
,
thdtype
);
...
@@ -3767,13 +3802,13 @@ static HRESULT WINAPI Context_GetCurrentThreadType(IComThreadingInfo *iface, THD
...
@@ -3767,13 +3802,13 @@ static HRESULT WINAPI Context_GetCurrentThreadType(IComThreadingInfo *iface, THD
return
S_OK
;
return
S_OK
;
}
}
static
HRESULT
WINAPI
Context_GetCurrentLogicalThreadId
(
IComThreadingInfo
*
iface
,
GUID
*
logical_thread_id
)
static
HRESULT
WINAPI
Context_
CTI_
GetCurrentLogicalThreadId
(
IComThreadingInfo
*
iface
,
GUID
*
logical_thread_id
)
{
{
FIXME
(
"(%p): stub
\n
"
,
logical_thread_id
);
FIXME
(
"(%p): stub
\n
"
,
logical_thread_id
);
return
E_NOTIMPL
;
return
E_NOTIMPL
;
}
}
static
HRESULT
WINAPI
Context_SetCurrentLogicalThreadId
(
IComThreadingInfo
*
iface
,
REFGUID
logical_thread_id
)
static
HRESULT
WINAPI
Context_
CTI_
SetCurrentLogicalThreadId
(
IComThreadingInfo
*
iface
,
REFGUID
logical_thread_id
)
{
{
FIXME
(
"(%s): stub
\n
"
,
debugstr_guid
(
logical_thread_id
));
FIXME
(
"(%s): stub
\n
"
,
debugstr_guid
(
logical_thread_id
));
return
E_NOTIMPL
;
return
E_NOTIMPL
;
...
@@ -3781,15 +3816,51 @@ static HRESULT WINAPI Context_SetCurrentLogicalThreadId(IComThreadingInfo *iface
...
@@ -3781,15 +3816,51 @@ static HRESULT WINAPI Context_SetCurrentLogicalThreadId(IComThreadingInfo *iface
static
const
IComThreadingInfoVtbl
Context_Threading_Vtbl
=
static
const
IComThreadingInfoVtbl
Context_Threading_Vtbl
=
{
{
Context_QueryInterface
,
Context_
CTI_
QueryInterface
,
Context_AddRef
,
Context_
CTI_
AddRef
,
Context_Release
,
Context_
CTI_
Release
,
Context_GetCurrentApartmentType
,
Context_
CTI_
GetCurrentApartmentType
,
Context_GetCurrentThreadType
,
Context_
CTI_
GetCurrentThreadType
,
Context_GetCurrentLogicalThreadId
,
Context_
CTI_
GetCurrentLogicalThreadId
,
Context_SetCurrentLogicalThreadId
Context_
CTI_
SetCurrentLogicalThreadId
};
};
static
HRESULT
WINAPI
Context_CC_QueryInterface
(
IContextCallback
*
iface
,
REFIID
riid
,
LPVOID
*
ppv
)
{
Context
*
This
=
impl_from_IContextCallback
(
iface
);
return
Context_QueryInterface
(
This
,
riid
,
ppv
);
}
static
ULONG
WINAPI
Context_CC_AddRef
(
IContextCallback
*
iface
)
{
Context
*
This
=
impl_from_IContextCallback
(
iface
);
return
Context_AddRef
(
This
);
}
static
ULONG
WINAPI
Context_CC_Release
(
IContextCallback
*
iface
)
{
Context
*
This
=
impl_from_IContextCallback
(
iface
);
return
Context_Release
(
This
);
}
static
HRESULT
WINAPI
Context_CC_ContextCallback
(
IContextCallback
*
iface
,
PFNCONTEXTCALL
pCallback
,
ComCallData
*
param
,
REFIID
riid
,
int
method
,
IUnknown
*
punk
)
{
Context
*
This
=
impl_from_IContextCallback
(
iface
);
FIXME
(
"(%p/%p)->(%p, %p, %s, %d, %p)
\n
"
,
This
,
iface
,
pCallback
,
param
,
debugstr_guid
(
riid
),
method
,
punk
);
return
E_NOTIMPL
;
}
static
const
IContextCallbackVtbl
Context_Callback_Vtbl
=
{
Context_CC_QueryInterface
,
Context_CC_AddRef
,
Context_CC_Release
,
Context_CC_ContextCallback
};
/***********************************************************************
/***********************************************************************
* CoGetObjectContext [OLE32.@]
* CoGetObjectContext [OLE32.@]
*
*
...
@@ -3823,6 +3894,7 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
...
@@ -3823,6 +3894,7 @@ HRESULT WINAPI CoGetObjectContext(REFIID riid, void **ppv)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
context
->
lpVtbl
=
&
Context_Threading_Vtbl
;
context
->
lpVtbl
=
&
Context_Threading_Vtbl
;
context
->
lpCallbackVtbl
=
&
Context_Callback_Vtbl
;
context
->
refs
=
1
;
context
->
refs
=
1
;
if
(
apt
->
multi_threaded
)
if
(
apt
->
multi_threaded
)
context
->
apttype
=
APTTYPE_MTA
;
context
->
apttype
=
APTTYPE_MTA
;
...
...
dlls/ole32/tests/compobj.c
View file @
37d27c38
...
@@ -1001,9 +1001,7 @@ static void test_CoGetObjectContext(void)
...
@@ -1001,9 +1001,7 @@ static void test_CoGetObjectContext(void)
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
hr
=
pCoGetObjectContext
(
&
IID_IContextCallback
,
(
void
**
)
&
pContextCallback
);
hr
=
pCoGetObjectContext
(
&
IID_IContextCallback
,
(
void
**
)
&
pContextCallback
);
todo_wine
{
ok_ole_success
(
hr
,
"CoGetObjectContext(ContextCallback)"
);
ok_ole_success
(
hr
,
"CoGetObjectContext(ContextCallback)"
);
}
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
...
@@ -1030,9 +1028,7 @@ static void test_CoGetObjectContext(void)
...
@@ -1030,9 +1028,7 @@ static void test_CoGetObjectContext(void)
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
ok
(
refs
==
0
,
"pComThreadingInfo should have 0 refs instead of %d refs
\n
"
,
refs
);
hr
=
pCoGetObjectContext
(
&
IID_IContextCallback
,
(
void
**
)
&
pContextCallback
);
hr
=
pCoGetObjectContext
(
&
IID_IContextCallback
,
(
void
**
)
&
pContextCallback
);
todo_wine
{
ok_ole_success
(
hr
,
"CoGetObjectContext(ContextCallback)"
);
ok_ole_success
(
hr
,
"CoGetObjectContext(ContextCallback)"
);
}
if
(
hr
==
S_OK
)
if
(
hr
==
S_OK
)
{
{
...
...
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