Author: dchapyshev Date: Wed May 6 12:47:39 2009 New Revision: 40814
URL: http://svn.reactos.org/svn/reactos?rev=40814&view=rev Log: - Sync itss and msctf with Wine 1.1.20
Added: trunk/reactos/dll/win32/msctf/msctf_local.idl (with props) Modified: trunk/reactos/dll/win32/itss/itss.rbuild trunk/reactos/dll/win32/itss/protocol.c trunk/reactos/dll/win32/msctf/context.c trunk/reactos/dll/win32/msctf/documentmgr.c trunk/reactos/dll/win32/msctf/msctf.c trunk/reactos/dll/win32/msctf/msctf.rbuild trunk/reactos/dll/win32/msctf/msctf_internal.h trunk/reactos/dll/win32/msctf/threadmgr.c
Modified: trunk/reactos/dll/win32/itss/itss.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/itss.rbuild?... ============================================================================== --- trunk/reactos/dll/win32/itss/itss.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/itss.rbuild [iso-8859-1] Wed May 6 12:47:39 2009 @@ -1,5 +1,5 @@ <group> -<module name="itss" type="win32dll" baseaddress="${BASEADDRESS_ITSS}" installbase="system32" installname="itss.dll" crt="msvcrt"> +<module name="itss" type="win32dll" baseaddress="${BASEADDRESS_ITSS}" installbase="system32" installname="itss.dll" crt="msvcrt" allowwarnings="true"> <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <importlibrary definition="itss.spec" /> <include base="itss">.</include>
Modified: trunk/reactos/dll/win32/itss/protocol.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/itss/protocol.c?r... ============================================================================== --- trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/itss/protocol.c [iso-8859-1] Wed May 6 12:47:39 2009 @@ -137,7 +137,7 @@
static HRESULT WINAPI ITSProtocol_Start(IInternetProtocol *iface, LPCWSTR szUrl, IInternetProtocolSink *pOIProtSink, IInternetBindInfo *pOIBindInfo, - DWORD grfPI, DWORD dwReserved) + DWORD grfPI, HANDLE_PTR dwReserved) { ITSProtocol *This = PROTOCOL_THIS(iface); BINDINFO bindinfo; @@ -151,7 +151,7 @@
static const WCHAR separator[] = {':',':',0};
- TRACE("(%p)->(%s %p %p %08x %d)\n", This, debugstr_w(szUrl), pOIProtSink, + TRACE("(%p)->(%s %p %p %08x %lx)\n", This, debugstr_w(szUrl), pOIProtSink, pOIBindInfo, grfPI, dwReserved);
ptr = skip_schema(szUrl);
Modified: trunk/reactos/dll/win32/msctf/context.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/context.c?r... ============================================================================== --- trunk/reactos/dll/win32/msctf/context.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/context.c [iso-8859-1] Wed May 6 12:47:39 2009 @@ -382,7 +382,7 @@ return CONNECT_E_CANNOTCONNECT; } list_add_head(&This->pTextEditSink ,&es->entry); - *pdwCookie = (DWORD)es; + *pdwCookie = generate_Cookie(COOKIE_MAGIC_CONTEXTSINK, es); } else { @@ -396,9 +396,17 @@
static WINAPI HRESULT ContextSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { - ContextSink *sink = (ContextSink*)pdwCookie; + ContextSink *sink; Context *This = impl_from_ITfSourceVtbl(iface); + 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); free_sink(sink);
Modified: trunk/reactos/dll/win32/msctf/documentmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/documentmgr... ============================================================================== --- trunk/reactos/dll/win32/msctf/documentmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/documentmgr.c [iso-8859-1] Wed May 6 12:47:39 2009 @@ -167,7 +167,7 @@ if (dwFlags) return E_INVALIDARG;
- if (This->contextStack[0] == NULL) /* Cannot pop last context */ + if (This->contextStack[1] == NULL) /* Cannot pop last context */ return E_FAIL;
ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink,This->contextStack[0]); @@ -199,14 +199,21 @@ static HRESULT WINAPI DocumentMgr_GetBase(ITfDocumentMgr *iface, ITfContext **ppic) { DocumentMgr *This = (DocumentMgr *)iface; + ITfContext *tgt; + TRACE("(%p)\n",This); if (!ppic) return E_INVALIDARG;
if (This->contextStack[1]) - ITfContext_AddRef(This->contextStack[1]); - - *ppic = This->contextStack[1]; + tgt = This->contextStack[1]; + else + tgt = This->contextStack[0]; + + if (tgt) + ITfContext_AddRef(tgt); + + *ppic = tgt;
return S_OK; }
Modified: trunk/reactos/dll/win32/msctf/msctf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.c?rev... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.c [iso-8859-1] Wed May 6 12:47:39 2009 @@ -43,6 +43,17 @@
static HINSTANCE MSCTF_hinstance;
+typedef struct +{ + DWORD id; + DWORD magic; + LPVOID data; +} CookieInternal; + +static CookieInternal *cookies; +static UINT id_last; +static UINT array_size; + DWORD tlsIndex = 0;
const WCHAR szwSystemTIPKey[] = {'S','O','F','T','W','A','R','E','\','M','i','c','r','o','s','o','f','t','\','C','T','F','\','T','I','P',0}; @@ -152,6 +163,93 @@ TRACE("Created class factory %p\n", This); MSCTF_refCount++; return S_OK; +} + +/************************************************************************* + * DWORD Cookie Management + */ +DWORD generate_Cookie(DWORD magic, LPVOID data) +{ + int i; + + /* try to reuse IDs if possible */ + for (i = 0; i < id_last; i++) + if (cookies[i].id == 0) break; + + if (i == array_size) + { + if (!array_size) + { + cookies = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(CookieInternal) * 10); + if (!cookies) + { + ERR("Out of memory, Unable to alloc cookies array\n"); + return 0; + } + array_size = 10; + } + else + { + CookieInternal *new_cookies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cookies, + sizeof(CookieInternal) * (array_size * 2)); + if (!new_cookies) + { + ERR("Out of memory, Unable to realloc cookies array\n"); + return 0; + } + cookies = new_cookies; + array_size *= 2; + } + } + + cookies[i].id = i + 1; /* a return of 0 is used for failure */ + cookies[i].magic = magic; + cookies[i].data = data; + + if (i == id_last) + id_last++; + + return cookies[i].id; +} + +DWORD get_Cookie_magic(DWORD id) +{ + UINT index = id - 1; + + if (index >= id_last) + return 0; + + if (cookies[index].id == 0) + return 0; + + return cookies[index].magic; +} + +LPVOID get_Cookie_data(DWORD id) +{ + UINT index = id - 1; + + if (index >= id_last) + return NULL; + + if (cookies[index].id == 0) + return NULL; + + return cookies[index].data; +} + +LPVOID remove_Cookie(DWORD id) +{ + UINT index = id - 1; + + if (index >= id_last) + return NULL; + + if (cookies[index].id == 0) + return NULL; + + cookies[index].id = 0; + return cookies[index].data; }
/*************************************************************************
Modified: trunk/reactos/dll/win32/msctf/msctf.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf.rbuil... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf.rbuild [iso-8859-1] Wed May 6 12:47:39 2009 @@ -1,3 +1,6 @@ +<?xml version="1.0"?> +<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd"> +<group> <module name="msctf" type="win32dll" baseaddress="${BASEADDRESS_MSCTF}" installbase="system32" installname="msctf.dll" allowwarnings="true"> <autoregister infsection="OleControlDlls" type="DllRegisterServer" /> <importlibrary definition="msctf.spec" /> @@ -21,3 +24,7 @@ <library>kernel32</library> <library>ntdll</library> </module> +<module name="msctf_local_interface" type="idlinterface"> + <file>msctf_local.idl</file> +</module> +</group>
Modified: trunk/reactos/dll/win32/msctf/msctf_internal.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf_inter... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/msctf_internal.h [iso-8859-1] Wed May 6 12:47:39 2009 @@ -20,6 +20,10 @@
#ifndef __WINE_MSCTF_I_H #define __WINE_MSCTF_I_H + +#define COOKIE_MAGIC_TMSINK 0x0010 +#define COOKIE_MAGIC_CONTEXTSINK 0x0020 + extern DWORD tlsIndex;
extern HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); @@ -28,5 +32,11 @@ extern HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut); extern HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut);
+/* cookie function */ +extern DWORD generate_Cookie(DWORD magic, LPVOID data); +extern DWORD get_Cookie_magic(DWORD id); +extern LPVOID get_Cookie_data(DWORD id); +extern LPVOID remove_Cookie(DWORD id); + extern const WCHAR szwSystemTIPKey[]; #endif /* __WINE_MSCTF_I_H */
Added: trunk/reactos/dll/win32/msctf/msctf_local.idl URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/msctf_local... ============================================================================== --- trunk/reactos/dll/win32/msctf/msctf_local.idl (added) +++ trunk/reactos/dll/win32/msctf/msctf_local.idl [iso-8859-1] Wed May 6 12:47:39 2009 @@ -1,0 +1,2 @@ + +#include "msctf.idl"
Propchange: trunk/reactos/dll/win32/msctf/msctf_local.idl ------------------------------------------------------------------------------ svn:eol-style = native
Modified: trunk/reactos/dll/win32/msctf/threadmgr.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msctf/threadmgr.c... ============================================================================== --- trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msctf/threadmgr.c [iso-8859-1] Wed May 6 12:47:39 2009 @@ -59,6 +59,7 @@ typedef struct tagACLMulti { const ITfThreadMgrVtbl *ThreadMgrVtbl; const ITfSourceVtbl *SourceVtbl; + const ITfKeystrokeMgrVtbl *KeystrokeMgrVtbl; LONG refCount;
const ITfThreadMgrEventSinkVtbl *ThreadMgrEventSinkVtbl; /* internal */ @@ -79,6 +80,11 @@ return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,SourceVtbl)); }
+static inline ThreadMgr *impl_from_ITfKeystrokeMgrVtbl(ITfKeystrokeMgr *iface) +{ + return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,KeystrokeMgrVtbl)); +} + static inline ThreadMgr *impl_from_ITfThreadMgrEventSink(ITfThreadMgrEventSink *iface) { return (ThreadMgr *)((char *)iface - FIELD_OFFSET(ThreadMgr,ThreadMgrEventSinkVtbl)); @@ -153,6 +159,10 @@ { *ppvOut = &This->SourceVtbl; } + else if (IsEqualIID(iid, &IID_ITfKeystrokeMgr)) + { + *ppvOut = &This->KeystrokeMgrVtbl; + }
if (*ppvOut) { @@ -196,6 +206,14 @@ { ThreadMgr *This = (ThreadMgr *)iface; FIXME("STUB:(%p)\n",This); + + if (This->focus) + { + ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, 0, This->focus); + ITfDocumentMgr_Release(This->focus); + This->focus = 0; + } + return E_NOTIMPL; }
@@ -246,7 +264,7 @@ if (!pdimFocus || FAILED(IUnknown_QueryInterface(pdimFocus,&IID_ITfDocumentMgr,(LPVOID*) &check))) return E_INVALIDARG;
- ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, This->focus, check); + ITfThreadMgrEventSink_OnSetFocus((ITfThreadMgrEventSink*)&This->ThreadMgrEventSinkVtbl, check, This->focus);
if (This->focus) ITfDocumentMgr_Release(This->focus); @@ -357,7 +375,7 @@ return CONNECT_E_CANNOTCONNECT; } list_add_head(&This->ThreadMgrEventSink,&tms->entry); - *pdwCookie = (DWORD)tms; + *pdwCookie = generate_Cookie(COOKIE_MAGIC_TMSINK, tms); } else { @@ -372,9 +390,17 @@
static WINAPI HRESULT ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { - ThreadMgrSink *sink = (ThreadMgrSink*)pdwCookie; + ThreadMgrSink *sink; ThreadMgr *This = impl_from_ITfSourceVtbl(iface); + 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); free_sink(sink); @@ -390,6 +416,163 @@
ThreadMgrSource_AdviseSink, ThreadMgrSource_UnadviseSink, +}; + +/***************************************************** + * ITfKeystrokeMgr functions + *****************************************************/ + +static HRESULT WINAPI KeystrokeMgr_QueryInterface(ITfKeystrokeMgr *iface, REFIID iid, LPVOID *ppvOut) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + return ThreadMgr_QueryInterface((ITfThreadMgr *)This, iid, *ppvOut); +} + +static ULONG WINAPI KeystrokeMgr_AddRef(ITfKeystrokeMgr *iface) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + return ThreadMgr_AddRef((ITfThreadMgr*)This); +} + +static ULONG WINAPI KeystrokeMgr_Release(ITfKeystrokeMgr *iface) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + return ThreadMgr_Release((ITfThreadMgr *)This); +} + +static HRESULT WINAPI KeystrokeMgr_AdviseKeyEventSink(ITfKeystrokeMgr *iface, + TfClientId tid, ITfKeyEventSink *pSink, BOOL fForeground) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_UnadviseKeyEventSink(ITfKeystrokeMgr *iface, + TfClientId tid) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_GetForeground(ITfKeystrokeMgr *iface, + CLSID *pclsid) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_TestKeyDown(ITfKeystrokeMgr *iface, + WPARAM wParam, LPARAM lParam, BOOL *pfEaten) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_TestKeyUp(ITfKeystrokeMgr *iface, + WPARAM wParam, LPARAM lParam, BOOL *pfEaten) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_KeyDown(ITfKeystrokeMgr *iface, + WPARAM wParam, LPARAM lParam, BOOL *pfEaten) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_KeyUp(ITfKeystrokeMgr *iface, + WPARAM wParam, LPARAM lParam, BOOL *pfEaten) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_GetPreservedKey(ITfKeystrokeMgr *iface, + ITfContext *pic, const TF_PRESERVEDKEY *pprekey, GUID *pguid) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_IsPreservedKey(ITfKeystrokeMgr *iface, + REFGUID rguid, const TF_PRESERVEDKEY *pprekey, BOOL *pfRegistered) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_PreserveKey(ITfKeystrokeMgr *iface, + TfClientId tid, REFGUID rguid, const TF_PRESERVEDKEY *prekey, + const WCHAR *pchDesc, ULONG cchDesc) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_UnpreserveKey(ITfKeystrokeMgr *iface, + REFGUID rguid, const TF_PRESERVEDKEY *pprekey) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_SetPreservedKeyDescription(ITfKeystrokeMgr *iface, + REFGUID rguid, const WCHAR *pchDesc, ULONG cchDesc) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_GetPreservedKeyDescription(ITfKeystrokeMgr *iface, + REFGUID rguid, BSTR *pbstrDesc) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static HRESULT WINAPI KeystrokeMgr_SimulatePreservedKey(ITfKeystrokeMgr *iface, + ITfContext *pic, REFGUID rguid, BOOL *pfEaten) +{ + ThreadMgr *This = impl_from_ITfKeystrokeMgrVtbl(iface); + FIXME("STUB:(%p)\n",This); + return E_NOTIMPL; +} + +static const ITfKeystrokeMgrVtbl ThreadMgr_KeystrokeMgrVtbl = +{ + KeystrokeMgr_QueryInterface, + KeystrokeMgr_AddRef, + KeystrokeMgr_Release, + + KeystrokeMgr_AdviseKeyEventSink, + KeystrokeMgr_UnadviseKeyEventSink, + KeystrokeMgr_GetForeground, + KeystrokeMgr_TestKeyDown, + KeystrokeMgr_TestKeyUp, + KeystrokeMgr_KeyDown, + KeystrokeMgr_KeyUp, + KeystrokeMgr_GetPreservedKey, + KeystrokeMgr_IsPreservedKey, + KeystrokeMgr_PreserveKey, + KeystrokeMgr_UnpreserveKey, + KeystrokeMgr_SetPreservedKeyDescription, + KeystrokeMgr_GetPreservedKeyDescription, + KeystrokeMgr_SimulatePreservedKey };
/***************************************************** @@ -534,6 +717,7 @@
This->ThreadMgrVtbl= &ThreadMgr_ThreadMgrVtbl; This->SourceVtbl = &ThreadMgr_SourceVtbl; + This->KeystrokeMgrVtbl= &ThreadMgr_KeystrokeMgrVtbl; This->ThreadMgrEventSinkVtbl = &ThreadMgr_ThreadMgrEventSinkVtbl; This->refCount = 1; TlsSetValue(tlsIndex,This);