msctf: Make use of generated cookies in sinks to allow 64 bit compatibility.

This commit is contained in:
Aric Stewart 2009-04-22 11:14:19 -05:00 committed by Alexandre Julliard
parent e8a5325196
commit d7c154a8db
3 changed files with 24 additions and 4 deletions

View File

@ -382,7 +382,7 @@ static WINAPI HRESULT ContextSource_AdviseSink(ITfSource *iface,
return CONNECT_E_CANNOTCONNECT; return CONNECT_E_CANNOTCONNECT;
} }
list_add_head(&This->pTextEditSink ,&es->entry); list_add_head(&This->pTextEditSink ,&es->entry);
*pdwCookie = (DWORD)es; *pdwCookie = generate_Cookie(COOKIE_MAGIC_CONTEXTSINK, es);
} }
else else
{ {
@ -396,10 +396,18 @@ static WINAPI HRESULT ContextSource_AdviseSink(ITfSource *iface,
static WINAPI HRESULT ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static WINAPI HRESULT ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
ContextSink *sink = (ContextSink*)pdwCookie; ContextSink *sink;
Context *This = impl_from_ITfSourceVtbl(iface); Context *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_CONTEXTSINK)
return E_INVALIDARG;
sink = (ContextSink*)remove_Cookie(pdwCookie);
if (!sink)
return CONNECT_E_NOCONNECTION;
list_remove(&sink->entry); list_remove(&sink->entry);
free_sink(sink); free_sink(sink);

View File

@ -20,6 +20,10 @@
#ifndef __WINE_MSCTF_I_H #ifndef __WINE_MSCTF_I_H
#define __WINE_MSCTF_I_H #define __WINE_MSCTF_I_H
#define COOKIE_MAGIC_TMSINK 0x0010
#define COOKIE_MAGIC_CONTEXTSINK 0x0020
extern DWORD tlsIndex; extern DWORD tlsIndex;
extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);

View File

@ -365,7 +365,7 @@ static WINAPI HRESULT ThreadMgrSource_AdviseSink(ITfSource *iface,
return CONNECT_E_CANNOTCONNECT; return CONNECT_E_CANNOTCONNECT;
} }
list_add_head(&This->ThreadMgrEventSink,&tms->entry); list_add_head(&This->ThreadMgrEventSink,&tms->entry);
*pdwCookie = (DWORD)tms; *pdwCookie = generate_Cookie(COOKIE_MAGIC_TMSINK, tms);
} }
else else
{ {
@ -380,10 +380,18 @@ static WINAPI HRESULT ThreadMgrSource_AdviseSink(ITfSource *iface,
static WINAPI HRESULT ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) static WINAPI HRESULT ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
{ {
ThreadMgrSink *sink = (ThreadMgrSink*)pdwCookie; ThreadMgrSink *sink;
ThreadMgr *This = impl_from_ITfSourceVtbl(iface); ThreadMgr *This = impl_from_ITfSourceVtbl(iface);
TRACE("(%p) %x\n",This,pdwCookie); TRACE("(%p) %x\n",This,pdwCookie);
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_TMSINK)
return E_INVALIDARG;
sink = (ThreadMgrSink*)remove_Cookie(pdwCookie);
if (!sink)
return CONNECT_E_NOCONNECTION;
list_remove(&sink->entry); list_remove(&sink->entry);
free_sink(sink); free_sink(sink);