ReactOS 0.4.15-dev-7788-g1ad9096
msctf.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "shlwapi.h"
#include "shlguid.h"
#include "comcat.h"
#include "olectl.h"
#include "rpcproxy.h"
#include "msctf.h"
#include "inputscope.h"
#include "msctf_internal.h"
Include dependency graph for msctf.c:

Go to the source code of this file.

Classes

struct  CookieInternal
 
struct  ActivatedTextService
 
struct  AtsEntry
 
struct  tagClassFactory
 

Macros

#define COBJMACROS
 

Typedefs

typedef HRESULT(* LPFNCONSTRUCTOR) (IUnknown *pUnkOuter, IUnknown **ppvOut)
 
typedef struct tagClassFactory ClassFactory
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msctf)
 
static ClassFactoryimpl_from_IClassFactory (IClassFactory *iface)
 
static void ClassFactory_Destructor (ClassFactory *This)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_CreateInstance (IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL fLock)
 
static HRESULT ClassFactory_Constructor (LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
 
DWORD generate_Cookie (DWORD magic, LPVOID data)
 
DWORD get_Cookie_magic (DWORD id)
 
LPVOID get_Cookie_data (DWORD id)
 
LPVOID remove_Cookie (DWORD id)
 
DWORD enumerate_Cookie (DWORD magic, DWORD *index)
 
HRESULT advise_sink (struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie)
 
static void free_sink (Sink *sink)
 
HRESULT unadvise_sink (DWORD cookie)
 
void free_sinks (struct list *sink_list)
 
static HRESULT activate_given_ts (ActivatedTextService *actsvr, ITfThreadMgrEx *tm)
 
static HRESULT deactivate_given_ts (ActivatedTextService *actsvr)
 
static void deactivate_remove_conflicting_ts (REFCLSID catid)
 
HRESULT add_active_textservice (TF_LANGUAGEPROFILE *lp)
 
BOOL get_active_textservice (REFCLSID rclsid, TF_LANGUAGEPROFILE *profile)
 
HRESULT activate_textservices (ITfThreadMgrEx *tm)
 
HRESULT deactivate_textservices (void)
 
CLSID get_textservice_clsid (TfClientId tid)
 
HRESULT get_textservice_sink (TfClientId tid, REFCLSID iid, IUnknown **sink)
 
HRESULT set_textservice_sink (TfClientId tid, REFCLSID iid, IUnknown *sink)
 
BOOL WINAPI DllMain (HINSTANCE hinst, DWORD fdwReason, LPVOID fImpLoad)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
HRESULT WINAPI DllGetClassObject (REFCLSID clsid, REFIID iid, LPVOID *ppvOut)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 
HRESULT WINAPI TF_CreateThreadMgr (ITfThreadMgr **pptim)
 
HRESULT WINAPI TF_GetThreadMgr (ITfThreadMgr **pptim)
 
HRESULT WINAPI SetInputScope (HWND hwnd, InputScope inputscope)
 
HRESULT WINAPI SetInputScopes (HWND hwnd, const InputScope *pInputScopes, UINT cInputScopes, WCHAR **ppszPhraseList, UINT cPhrases, WCHAR *pszRegExp, WCHAR *pszSRGS)
 
HRESULT WINAPI TF_CreateInputProcessorProfiles (ITfInputProcessorProfiles **ppipr)
 
HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist (void)
 
HRESULT WINAPI TF_CreateLangBarMgr (ITfLangBarMgr **pppbm)
 
HRESULT WINAPI TF_CreateLangBarItemMgr (ITfLangBarItemMgr **pplbim)
 
HRESULT WINAPI TF_InitMlngInfo (void)
 

Variables

static HINSTANCE MSCTF_hinstance
 
static CookieInternalcookies
 
static UINT id_last
 
static UINT array_size
 
static struct list AtsList = LIST_INIT(AtsList)
 
static UINT activated = 0
 
DWORD tlsIndex = 0
 
TfClientId processId = 0
 
ITfCompartmentMgrglobalCompartmentMgr = NULL
 
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}
 
const WCHAR szwSystemCTFKey [] = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\','C','T','F',0}
 
struct {
   REFCLSID   clsid
 
   LPFNCONSTRUCTOR   ctor
 
ClassesTable []
 
static const IClassFactoryVtbl ClassFactoryVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 24 of file msctf.c.

Typedef Documentation

◆ ClassFactory

◆ LPFNCONSTRUCTOR

typedef HRESULT(* LPFNCONSTRUCTOR) (IUnknown *pUnkOuter, IUnknown **ppvOut)

Definition at line 79 of file msctf.c.

Function Documentation

◆ activate_given_ts()

static HRESULT activate_given_ts ( ActivatedTextService actsvr,
ITfThreadMgrEx tm 
)
static

Definition at line 336 of file msctf.c.

337{
338 HRESULT hr;
339
340 /* Already Active? */
341 if (actsvr->pITfTextInputProcessor)
342 return S_OK;
343
344 hr = CoCreateInstance (&actsvr->LanguageProfile.clsid, NULL, CLSCTX_INPROC_SERVER,
345 &IID_ITfTextInputProcessor, (void**)&actsvr->pITfTextInputProcessor);
346 if (FAILED(hr)) return hr;
347
348 hr = ITfTextInputProcessor_Activate(actsvr->pITfTextInputProcessor, (ITfThreadMgr *)tm, actsvr->tid);
349 if (FAILED(hr))
350 {
351 ITfTextInputProcessor_Release(actsvr->pITfTextInputProcessor);
353 return hr;
354 }
355
356 actsvr->pITfThreadMgrEx = tm;
357 ITfThreadMgrEx_AddRef(tm);
358 return hr;
359}
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT hr
Definition: shlfolder.c:183
TF_LANGUAGEPROFILE LanguageProfile
Definition: msctf.c:52
ITfTextInputProcessor * pITfTextInputProcessor
Definition: msctf.c:53
TfClientId tid
Definition: msctf.c:56
ITfThreadMgrEx * pITfThreadMgrEx
Definition: msctf.c:54
Definition: time.h:68

Referenced by activate_textservices(), and add_active_textservice().

◆ activate_textservices()

HRESULT activate_textservices ( ITfThreadMgrEx tm)

Definition at line 475 of file msctf.c.

476{
477 HRESULT hr = S_OK;
478 AtsEntry *ats;
479
480 activated ++;
481 if (activated > 1)
482 return S_OK;
483
485 {
486 hr = activate_given_ts(ats->ats, tm);
487 if (FAILED(hr))
488 FIXME("Failed to activate text service\n");
489 }
490 return hr;
491}
#define FIXME(fmt,...)
Definition: debug.h:111
uint32_t entry
Definition: isohybrid.c:63
static UINT activated
Definition: msctf.c:70
static struct list AtsList
Definition: msctf.c:69
static HRESULT activate_given_ts(ActivatedTextService *actsvr, ITfThreadMgrEx *tm)
Definition: msctf.c:336
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: msctf.c:60
ActivatedTextService * ats
Definition: msctf.c:62

Referenced by ThreadMgr_ActivateEx().

◆ add_active_textservice()

HRESULT add_active_textservice ( TF_LANGUAGEPROFILE lp)

Definition at line 395 of file msctf.c.

396{
397 ActivatedTextService *actsvr;
398 ITfCategoryMgr *catmgr;
401 ITfClientId *clientid;
402
403 if (!tm) return E_UNEXPECTED;
404
405 actsvr = HeapAlloc(GetProcessHeap(),0,sizeof(ActivatedTextService));
406 if (!actsvr) return E_OUTOFMEMORY;
407
408 ITfThreadMgrEx_QueryInterface(tm, &IID_ITfClientId, (void **)&clientid);
409 ITfClientId_GetClientId(clientid, &lp->clsid, &actsvr->tid);
410 ITfClientId_Release(clientid);
411
412 if (!actsvr->tid)
413 {
414 HeapFree(GetProcessHeap(),0,actsvr);
415 return E_OUTOFMEMORY;
416 }
417
419 actsvr->LanguageProfile = *lp;
420 actsvr->pITfKeyEventSink = NULL;
421
422 /* get TIP category */
424 {
426
427 ITfCategoryMgr_FindClosestCategory(catmgr,
428 &actsvr->LanguageProfile.clsid, &actsvr->LanguageProfile.catid,
429 list, 3);
430
431 ITfCategoryMgr_Release(catmgr);
432 }
433 else
434 {
435 ERR("CategoryMgr construction failed\n");
437 }
438
441
442 if (activated > 0)
443 activate_given_ts(actsvr, tm);
444
445 entry = HeapAlloc(GetProcessHeap(),0,sizeof(AtsEntry));
446
447 if (!entry)
448 {
449 HeapFree(GetProcessHeap(),0,actsvr);
450 return E_OUTOFMEMORY;
451 }
452
453 entry->ats = actsvr;
454 list_add_head(&AtsList, &entry->entry);
455
456 return S_OK;
457}
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
#define ERR(fmt,...)
Definition: debug.h:110
HRESULT CategoryMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
Definition: categorymgr.c:413
Definition: list.h:37
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
LPVOID WINAPI TlsGetValue(IN DWORD Index)
Definition: thread.c:1240
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define GUID_NULL
Definition: ks.h:106
DWORD tlsIndex
Definition: msctf.c:72
static void deactivate_remove_conflicting_ts(REFCLSID catid)
Definition: msctf.c:377
EXTERN_C const GUID GUID_TFCAT_TIP_KEYBOARD
Definition: msctf.idl:99
EXTERN_C const GUID GUID_TFCAT_TIP_SPEECH
Definition: msctf.idl:100
EXTERN_C const GUID GUID_TFCAT_TIP_HANDWRITING
Definition: msctf.idl:101
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
ITfKeyEventSink * pITfKeyEventSink
Definition: msctf.c:55
#define E_UNEXPECTED
Definition: winerror.h:2456

Referenced by InputProcessorProfiles_ActivateLanguageProfile().

◆ advise_sink()

HRESULT advise_sink ( struct list sink_list,
REFIID  riid,
DWORD  cookie_magic,
IUnknown unk,
DWORD cookie 
)

Definition at line 285 of file msctf.c.

286{
287 Sink *sink;
288
289 sink = HeapAlloc(GetProcessHeap(), 0, sizeof(*sink));
290 if (!sink)
291 return E_OUTOFMEMORY;
292
293 if (FAILED(IUnknown_QueryInterface(unk, riid, (void**)&sink->interfaces.pIUnknown)))
294 {
297 }
298
299 list_add_head(sink_list, &sink->entry);
300 *cookie = generate_Cookie(cookie_magic, sink);
301 TRACE("cookie %x\n", *cookie);
302 return S_OK;
303}
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
REFIID riid
Definition: atlbase.h:39
DWORD generate_Cookie(DWORD magic, LPVOID data)
Definition: msctf.c:189
#define CONNECT_E_CANNOTCONNECT
Definition: olectl.h:253
#define TRACE(s)
Definition: solgame.cpp:4
Definition: cookie.c:34

Referenced by CompartmentSource_AdviseSink(), ContextSource_AdviseSink(), DocumentMgrSource_AdviseSink(), IPPSource_AdviseSink(), and ThreadMgrSource_AdviseSink().

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 124 of file msctf.c.

125{
127 return InterlockedIncrement(&This->ref);
128}
#define InterlockedIncrement
Definition: armddk.h:53
static ClassFactory * impl_from_IClassFactory(IClassFactory *iface)
Definition: msctf.c:100

◆ ClassFactory_Constructor()

static HRESULT ClassFactory_Constructor ( LPFNCONSTRUCTOR  ctor,
LPVOID ppvOut 
)
static

Definition at line 175 of file msctf.c.

176{
178 This->IClassFactory_iface.lpVtbl = &ClassFactoryVtbl;
179 This->ref = 1;
180 This->ctor = ctor;
181 *ppvOut = &This->IClassFactory_iface;
182 TRACE("Created class factory %p\n", This);
183 return S_OK;
184}
static const IClassFactoryVtbl ClassFactoryVtbl
Definition: msctf.c:164
LPFNCONSTRUCTOR ctor
Definition: msctf.c:83

Referenced by DllGetClassObject().

◆ ClassFactory_CreateInstance()

static HRESULT WINAPI ClassFactory_CreateInstance ( IClassFactory iface,
IUnknown punkOuter,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 140 of file msctf.c.

141{
143 HRESULT ret;
144 IUnknown *obj;
145
146 TRACE("(%p, %p, %s, %p)\n", iface, punkOuter, debugstr_guid(iid), ppvOut);
147 ret = This->ctor(punkOuter, &obj);
148 if (FAILED(ret))
149 return ret;
150 ret = IUnknown_QueryInterface(obj, iid, ppvOut);
151 IUnknown_Release(obj);
152 return ret;
153}
#define debugstr_guid
Definition: kernel32.h:35
int ret

◆ ClassFactory_Destructor()

static void ClassFactory_Destructor ( ClassFactory This)
static

Definition at line 105 of file msctf.c.

106{
107 TRACE("Destroying class factory %p\n", This);
109}

Referenced by ClassFactory_Release().

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  fLock 
)
static

Definition at line 155 of file msctf.c.

156{
158
159 TRACE("(%p)->(%x)\n", This, fLock);
160
161 return S_OK;
162}

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
LPVOID ppvOut 
)
static

Definition at line 111 of file msctf.c.

112{
113 *ppvOut = NULL;
115 IClassFactory_AddRef(iface);
116 *ppvOut = iface;
117 return S_OK;
118 }
119
120 WARN("Unknown interface %s\n", debugstr_guid(riid));
121 return E_NOINTERFACE;
122}
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define WARN(fmt,...)
Definition: debug.h:112
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 130 of file msctf.c.

131{
134
135 if (ret == 0)
137 return ret;
138}
#define InterlockedDecrement
Definition: armddk.h:52
static void ClassFactory_Destructor(ClassFactory *This)
Definition: msctf.c:105
uint32_t ULONG
Definition: typedefs.h:59

◆ deactivate_given_ts()

static HRESULT deactivate_given_ts ( ActivatedTextService actsvr)
static

Definition at line 361 of file msctf.c.

362{
363 HRESULT hr = S_OK;
364
365 if (actsvr->pITfTextInputProcessor)
366 {
367 hr = ITfTextInputProcessor_Deactivate(actsvr->pITfTextInputProcessor);
368 ITfTextInputProcessor_Release(actsvr->pITfTextInputProcessor);
369 ITfThreadMgrEx_Release(actsvr->pITfThreadMgrEx);
371 actsvr->pITfThreadMgrEx = NULL;
372 }
373
374 return hr;
375}

Referenced by deactivate_remove_conflicting_ts(), and deactivate_textservices().

◆ deactivate_remove_conflicting_ts()

static void deactivate_remove_conflicting_ts ( REFCLSID  catid)
static

Definition at line 377 of file msctf.c.

378{
379 AtsEntry *ats, *cursor2;
380
382 {
384 {
386 list_remove(&ats->entry);
387 HeapFree(GetProcessHeap(),0,ats->ats);
388 HeapFree(GetProcessHeap(),0,ats);
389 /* we are guaranteeing there is only 1 */
390 break;
391 }
392 }
393}
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static HRESULT deactivate_given_ts(ActivatedTextService *actsvr)
Definition: msctf.c:361
GUID catid
Definition: msctf.idl:647
#define IsEqualCLSID(rclsid1, rclsid2)
Definition: guiddef.h:96
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct list entry
Definition: msctf.c:61

Referenced by add_active_textservice().

◆ deactivate_textservices()

HRESULT deactivate_textservices ( void  )

Definition at line 493 of file msctf.c.

494{
495 AtsEntry *ats;
496
497 if (activated > 0)
498 activated --;
499
500 if (activated == 0)
503
504 return S_OK;
505}

Referenced by ThreadMgr_Deactivate().

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 576 of file msctf.c.

577{
578 return S_FALSE;
579}
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  clsid,
REFIID  iid,
LPVOID ppvOut 
)

Definition at line 584 of file msctf.c.

585{
586 int i;
587
588 *ppvOut = NULL;
590 return E_NOINTERFACE;
591
592 for (i = 0; ClassesTable[i].clsid != NULL; i++)
595 }
596 FIXME("CLSID %s not supported\n", debugstr_guid(clsid));
598}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
REFCLSID clsid
Definition: msctf.c:82
static const struct @486 ClassesTable[]
static HRESULT ClassFactory_Constructor(LPFNCONSTRUCTOR ctor, LPVOID *ppvOut)
Definition: msctf.c:175
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hinst,
DWORD  fdwReason,
LPVOID  fImpLoad 
)

Definition at line 554 of file msctf.c.

555{
556 TRACE("%p 0x%x %p\n", hinst, fdwReason, fImpLoad);
557 switch (fdwReason)
558 {
559 case DLL_WINE_PREATTACH:
560 return FALSE; /* prefer native version */
563 tlsIndex = TlsAlloc();
564 break;
566 if (fImpLoad) break;
568 break;
569 }
570 return TRUE;
571}
DWORD LPVOID fImpLoad
Definition: misc.cpp:155
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
DWORD WINAPI TlsAlloc(VOID)
Definition: thread.c:1100
BOOL WINAPI TlsFree(IN DWORD Index)
Definition: thread.c:1166
static HINSTANCE hinst
Definition: edit.c:551
static HINSTANCE MSCTF_hinstance
Definition: msctf.c:42

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 603 of file msctf.c.

604{
606}
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 611 of file msctf.c.

612{
614}
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ enumerate_Cookie()

DWORD enumerate_Cookie ( DWORD  magic,
DWORD index 
)

Definition at line 273 of file msctf.c.

274{
275 unsigned int i;
276 for (i = *index; i < id_last; i++)
277 if (cookies[i].id != 0 && cookies[i].magic == magic)
278 {
279 *index = (i+1);
280 return cookies[i].id;
281 }
282 return 0x0;
283}
GLuint index
Definition: glext.h:6031
static UINT id_last
Definition: msctf.c:66
static CookieInternal * cookies
Definition: msctf.c:65
u32_t magic(void)
DWORD id
Definition: msctf.c:46

Referenced by CategoryMgr_RegisterGUID().

◆ free_sink()

static void free_sink ( Sink sink)
static

Definition at line 305 of file msctf.c.

306{
307 list_remove(&sink->entry);
308 IUnknown_Release(sink->interfaces.pIUnknown);
310}

Referenced by free_sinks(), and unadvise_sink().

◆ free_sinks()

void free_sinks ( struct list sink_list)

Definition at line 324 of file msctf.c.

325{
326 while(!list_empty(sink_list))
327 {
328 Sink* sink = LIST_ENTRY(sink_list->next, Sink, entry);
330 }
331}
static int list_empty(struct list_entry *head)
Definition: list.h:58
struct list * next
Definition: list.h:38
static void free_sink(Sink *sink)
Definition: msctf.c:305
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by Compartment_Destructor(), Context_Destructor(), DocumentMgr_Destructor(), InputProcessorProfiles_Destructor(), and ThreadMgr_Destructor().

◆ generate_Cookie()

DWORD generate_Cookie ( DWORD  magic,
LPVOID  data 
)

Definition at line 189 of file msctf.c.

190{
191 UINT i;
192
193 /* try to reuse IDs if possible */
194 for (i = 0; i < id_last; i++)
195 if (cookies[i].id == 0) break;
196
197 if (i == array_size)
198 {
199 if (!array_size)
200 {
202 if (!cookies)
203 {
204 ERR("Out of memory, Unable to alloc cookies array\n");
205 return 0;
206 }
207 array_size = 10;
208 }
209 else
210 {
212 sizeof(CookieInternal) * (array_size * 2));
213 if (!new_cookies)
214 {
215 ERR("Out of memory, Unable to realloc cookies array\n");
216 return 0;
217 }
218 cookies = new_cookies;
219 array_size *= 2;
220 }
221 }
222
223 cookies[i].id = i + 1; /* a return of 0 is used for failure */
224 cookies[i].magic = magic;
225 cookies[i].data = data;
226
227 if (i == id_last)
228 id_last++;
229
230 return cookies[i].id;
231}
#define HeapReAlloc
Definition: compat.h:734
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static UINT array_size
Definition: msctf.c:67
unsigned int UINT
Definition: ndis.h:50
LPVOID data
Definition: msctf.c:48
DWORD magic
Definition: msctf.c:47

Referenced by advise_sink(), CategoryMgr_RegisterGUID(), Context_Constructor(), and TextStoreACPSink_OnLockGranted().

◆ get_active_textservice()

BOOL get_active_textservice ( REFCLSID  rclsid,
TF_LANGUAGEPROFILE profile 
)

Definition at line 459 of file msctf.c.

460{
461 AtsEntry *ats;
462
464 {
465 if (IsEqualCLSID(rclsid,&ats->ats->LanguageProfile.clsid))
466 {
467 if (profile)
468 *profile = ats->ats->LanguageProfile;
469 return TRUE;
470 }
471 }
472 return FALSE;
473}
#define profile
Definition: kernel32.h:12

Referenced by InputProcessorProfiles_ActivateLanguageProfile(), InputProcessorProfiles_GetActiveLanguageProfile(), and next_LanguageProfile().

◆ get_Cookie_data()

LPVOID get_Cookie_data ( DWORD  id)

Definition at line 246 of file msctf.c.

247{
248 UINT index = id - 1;
249
250 if (index >= id_last)
251 return NULL;
252
253 if (cookies[index].id == 0)
254 return NULL;
255
256 return cookies[index].data;
257}
#define index(s, c)
Definition: various.h:29

Referenced by CategoryMgr_GetGUID(), CategoryMgr_IsEqualTfGuidAtom(), CategoryMgr_RegisterGUID(), Context_GetEnd(), Context_GetSelection(), Context_GetStart(), and InsertAtSelection_InsertTextAtSelection().

◆ get_Cookie_magic()

◆ get_textservice_clsid()

CLSID get_textservice_clsid ( TfClientId  tid)

Definition at line 507 of file msctf.c.

508{
509 AtsEntry *ats;
510
512 if (ats->ats->tid == tid)
513 return ats->ats->LanguageProfile.clsid;
514 return GUID_NULL;
515}
static TfClientId tid

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ get_textservice_sink()

HRESULT get_textservice_sink ( TfClientId  tid,
REFCLSID  iid,
IUnknown **  sink 
)

Definition at line 517 of file msctf.c.

518{
519 AtsEntry *ats;
520
521 if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
522 return E_NOINTERFACE;
523
525 if (ats->ats->tid == tid)
526 {
528 return S_OK;
529 }
530
531 return E_FAIL;
532}
#define E_FAIL
Definition: ddrawi.h:102

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ impl_from_IClassFactory()

static ClassFactory * impl_from_IClassFactory ( IClassFactory iface)
inlinestatic

Definition at line 100 of file msctf.c.

101{
102 return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
103}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by ClassFactory_AddRef(), ClassFactory_CreateInstance(), ClassFactory_LockServer(), and ClassFactory_Release().

◆ remove_Cookie()

LPVOID remove_Cookie ( DWORD  id)

Definition at line 259 of file msctf.c.

260{
261 UINT index = id - 1;
262
263 if (index >= id_last)
264 return NULL;
265
266 if (cookies[index].id == 0)
267 return NULL;
268
269 cookies[index].id = 0;
270 return cookies[index].data;
271}

Referenced by Context_Destructor(), TextStoreACPSink_OnLockGranted(), and unadvise_sink().

◆ set_textservice_sink()

HRESULT set_textservice_sink ( TfClientId  tid,
REFCLSID  iid,
IUnknown sink 
)

Definition at line 534 of file msctf.c.

535{
536 AtsEntry *ats;
537
538 if (!IsEqualCLSID(iid,&IID_ITfKeyEventSink))
539 return E_NOINTERFACE;
540
542 if (ats->ats->tid == tid)
543 {
545 return S_OK;
546 }
547
548 return E_FAIL;
549}

Referenced by KeystrokeMgr_AdviseKeyEventSink(), and KeystrokeMgr_UnadviseKeyEventSink().

◆ SetInputScope()

HRESULT WINAPI SetInputScope ( HWND  hwnd,
InputScope  inputscope 
)

Definition at line 642 of file msctf.c.

643{
644 FIXME("STUB: %p %i\n",hwnd,inputscope);
645 return S_OK;
646}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023

◆ SetInputScopes()

HRESULT WINAPI SetInputScopes ( HWND  hwnd,
const InputScope pInputScopes,
UINT  cInputScopes,
WCHAR **  ppszPhraseList,
UINT  cPhrases,
WCHAR pszRegExp,
WCHAR pszSRGS 
)

Definition at line 651 of file msctf.c.

654{
655 UINT i;
656 FIXME("STUB: %p ... %s %s\n",hwnd, debugstr_w(pszRegExp), debugstr_w(pszSRGS));
657 for (i = 0; i < cInputScopes; i++)
658 TRACE("\tScope[%u] = %i\n",i,pInputScopes[i]);
659 for (i = 0; i < cPhrases; i++)
660 TRACE("\tPhrase[%u] = %s\n",i,debugstr_w(ppszPhraseList[i]));
661
662 return S_OK;
663}
#define debugstr_w
Definition: kernel32.h:32

◆ TF_CreateInputProcessorProfiles()

HRESULT WINAPI TF_CreateInputProcessorProfiles ( ITfInputProcessorProfiles **  ppipr)

Definition at line 668 of file msctf.c.

670{
672}
HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)

Referenced by CheckCloseMenuAvailable(), and CicProfile::InitProfileInstance().

◆ TF_CreateLangBarItemMgr()

HRESULT WINAPI TF_CreateLangBarItemMgr ( ITfLangBarItemMgr **  pplbim)

Definition at line 692 of file msctf.c.

693{
694 FIXME("stub %p\n", pplbim);
695 *pplbim = NULL;
696
697 return E_NOTIMPL;
698}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ TF_CreateLangBarMgr()

HRESULT WINAPI TF_CreateLangBarMgr ( ITfLangBarMgr **  pppbm)

Definition at line 686 of file msctf.c.

687{
688 TRACE("\n");
689 return LangBarMgr_Constructor(NULL,(IUnknown**)pppbm);
690}
HRESULT LangBarMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
Definition: langbarmgr.c:182

Referenced by CTipbarWnd::CTipbarWnd(), DoCloseLangbar(), and Imm32TF_CreateLangBarMgr().

◆ TF_CreateThreadMgr()

HRESULT WINAPI TF_CreateThreadMgr ( ITfThreadMgr **  pptim)

Definition at line 619 of file msctf.c.

620{
621 TRACE("\n");
622 return ThreadMgr_Constructor(NULL,(IUnknown**)pptim);
623}
HRESULT ThreadMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut) DECLSPEC_HIDDEN
Definition: threadmgr.c:1342

Referenced by CicBridge::InitIMMX().

◆ TF_GetThreadMgr()

HRESULT WINAPI TF_GetThreadMgr ( ITfThreadMgr **  pptim)

Definition at line 628 of file msctf.c.

629{
630 TRACE("\n");
631 *pptim = TlsGetValue(tlsIndex);
632
633 if (*pptim)
634 ITfThreadMgr_AddRef(*pptim);
635
636 return S_OK;
637}

Referenced by CtfImeProcessCicHotkey(), and DocumentMgr_Destructor().

◆ TF_InitMlngInfo()

HRESULT WINAPI TF_InitMlngInfo ( void  )

Definition at line 704 of file msctf.c.

705{
706 FIXME("stub\n");
707 return S_OK;
708}

Referenced by CLBarInatItem::CLBarInatItem(), and CLBarInatItem::InitMenu().

◆ TF_InvalidAssemblyListCacheIfExist()

HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist ( void  )

Definition at line 677 of file msctf.c.

678{
679 FIXME("Stub\n");
680 return S_OK;
681}

Referenced by Imm32TF_InvalidAssemblyListCacheIfExist(), and CRegWatcher::UpdateSpTip().

◆ unadvise_sink()

HRESULT unadvise_sink ( DWORD  cookie)

Definition at line 312 of file msctf.c.

313{
314 Sink *sink;
315
317 if (!sink)
319
321 return S_OK;
322}
LPVOID remove_Cookie(DWORD id)
Definition: msctf.c:259
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251

Referenced by CompartmentSource_UnadviseSink(), ContextSource_UnadviseSink(), DocumentMgrSource_UnadviseSink(), IPPSource_UnadviseSink(), and ThreadMgrSource_UnadviseSink().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msctf  )

Variable Documentation

◆ activated

◆ array_size

◆ AtsList

◆ 

const struct { ... } ClassesTable[]
Initial value:
= {
}
HRESULT DisplayAttributeMgr_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
EXTERN_C const CLSID CLSID_TF_InputProcessorProfiles
Definition: msctf.idl:82
EXTERN_C const CLSID CLSID_TF_LangBarMgr
Definition: msctf.idl:83
EXTERN_C const CLSID CLSID_TF_ThreadMgr
Definition: msctf.idl:81
EXTERN_C const CLSID CLSID_TF_CategoryMgr
Definition: msctf.idl:84
EXTERN_C const CLSID CLSID_TF_DisplayAttributeMgr
Definition: msctf.idl:85

Referenced by DllGetClassObject().

◆ ClassFactoryVtbl

const IClassFactoryVtbl ClassFactoryVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
Definition: msctf.c:155
static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *punkOuter, REFIID iid, LPVOID *ppvOut)
Definition: msctf.c:140
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: msctf.c:130
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppvOut)
Definition: msctf.c:111
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: msctf.c:124

Definition at line 164 of file msctf.c.

Referenced by ClassFactory_Constructor().

◆ clsid

REFCLSID clsid

Definition at line 82 of file msctf.c.

Referenced by _create_object(), CFSFolder::_CreateExtensionUIObject(), CFSDropTarget::_DoDrop(), CFSFolder::_GetDropTarget(), CFSFolder::_GetIconHandler(), actctx_get_miscstatus(), ACTION_PublishFeatures(), add_icon_to_control(), add_progid_record(), AssocCreate(), AtlComModuleRegisterServer(), ATL::AtlComModuleRegisterServer(), ATL::AtlComModuleUnregisterServer(), AtlGetObjectSourceInterface(), AtlModuleRegisterServer(), AtlModuleUnregisterServer(), ATL::AtlRegisterClassCategoriesHelper(), AtlRegisterClassCategoriesHelper(), AVIFILE_CreateClassFactory(), BindProtocol_StartEx(), BitmapDecoderInfo_Constructor(), BitmapEncoderInfo_Constructor(), CShellBrowser::BrowseToPIDL(), call_script(), ClassMoniker_CreateFromDisplayName(), ClassMoniker_IsEqual(), CLRCreateInstance(), clsid_from_string_reg(), CLSIDEnumGUID_Next(), CLSIDFromProgID(), CLSIDFromProgIDEx(), ATL::CComPtr< T >::CoCreateInstance(), CoCreateInstanceEx(), CoGetInstanceFromFile(), CoIsOle1Class(), COM_OpenKeyForAppIdFromCLSID(), COM_OpenKeyForCLSID(), create_activex_object(), create_automatic_entry(), IPCtrlWindow< BASE, SMARTPTR >::create_control(), create_engine(), create_instance(), create_mime_object(), create_object(), create_plugin_host(), create_proxy(), create_stub(), CreateComponentEnumerator(), CreateComponentInfo(), CreateFilterInstanceAndLoadFile(), SIfacePtr< T >::CreateInstance(), CustomMarshal_GetUnmarshalClass(), d3drm1_CreateObject(), d3drm2_CreateObject(), d3drm3_CreateObject(), DataCache_Construct(), DataCache_GetClassID(), DataCache_InitNew(), DataCache_Load(), db_initialize(), DECLARE_INTERFACE_(), DefaultHandler_Construct(), DefaultHandler_IPersistStorage_GetClassID(), DEVENUM_IEnumMoniker_Next(), DEVENUM_IMediaCatMoniker_IsEqual(), DllGetClassObject(), dochost_object_available(), DOMClassFactory_Create(), dump_template(), CDefaultContextMenu::EnumerateDynamicContextHandlerForKey(), EnumTfLanguageProfiles_Next(), FileMonikerImpl_IsEqual(), FilterGraph2_Connect(), FilterMapper_EnumMatchingFilters(), FilterMapper_RegisterFilter(), FilterMapper_RegisterFilterInstance(), FindExeCplClass(), FM2_WriteClsid(), format_clsid(), FormatConverterInfo_Constructor(), GdipSaveImageToStream(), get_component_info(), get_decoder_info(), get_default_source(), get_elem_clsid(), get_encoder_clsid(), get_engine_clsid(), get_facbuf_for_iid(), get_mime_clsid(), get_mime_filter(), get_moniker_comparison_data(), get_moniker_for_progid_display_name(), get_msxml_version(), get_protocol_cf(), get_protocol_handler(), get_storage(), CRegFolder::GetDetailsOf(), CRegFolder::GetDisplayNameOf(), GetFileSourceFilter(), COpenControlPanel::GetPath(), CSearchBar::GetSearchResultsFolder(), GetSplitter(), CQueryAssociations::GetString(), implicit_mta_proc(), init_session(), CRShellClassFactory::Initialize(), InitIconOverlays(), InitPropVariantFromCLSID(), InitShellServices(), InputProcessorProfileMgr_ActivateProfile(), InputProcessorProfileMgr_DeactivateProfile(), InputProcessorProfileMgr_GetProfile(), insert_static_object(), CSearchBar::Invoke(), IPropertyStorage_fnSetClass(), is_clsid_supported(), CImageDx::IsExtensionSupported(), IsNamespaceExtensionHidden(), CDefaultContextMenu::IsShellExtensionAlreadyLoaded(), ItemMonikerImpl_IsEqual(), iterate_all_classes(), IUnknown_GetClassID(), CLangBarItemList::Load(), CDefaultContextMenu::LoadDynamicContextMenuHandler(), local_server_GetClassID(), MediaStreamFilterImpl_GetClassID(), MetadataReaderInfo_Constructor(), MetadataReaderInfo_GetCLSID(), MkProtocol_StartEx(), msi_create_component_advertise_string(), NdrDllRegisterProxy(), NdrDllUnregisterProxy(), next_LanguageProfile(), OLECONVERT_GetOLE10ProgID(), OleCreateDefaultHandler(), OleCreateEmbeddingHelper(), OleCreateFromFile(), OleCreateFromFileEx(), OleCreateStaticFromData(), OleDoAutoConvert(), OleLoadFromStream(), OleRegEnumFormatEtc(), OleRegEnumVerbs(), OleRegGetMiscStatus(), OleRegGetUserType(), OleSaveToStream(), CActiveLanguageProfileNotifySink::OnActivated(), CTrayBandSite::OnLoad(), COpenControlPanel::Open(), parse_add_interface_class(), parse_classid(), PixelFormatInfo_Constructor(), pointer_default(), process_data(), ProfileActivationSink_OnActivated(), ProgIDFromCLSID(), PropertyStorage_ReadHeaderFromStream(), ReadFmtUserTypeStg(), reg_context_menu_handler(), reg_icon_overlay(), reg_prop_sheet_handler(), register_clsid(), register_codec(), register_dsound_devices(), register_legacy_filters(), register_namespace(), register_progid(), register_ps_clsid_thread(), RegisterComponent(), RPC_StartLocalServer(), SSOThread::Run(), run_script(), RuntimeHost_GetInterface(), ATL::CImage::Save(), CImageDx::SaveDx(), CRegFolder::SetNameOf(), setup_edit_mode(), SetupRegisterClass(), SHCreatePropSheetExtArrayEx(), SHELL32_BindToSF(), SHELL32_CoCreateInitSF(), SHGetObjectCompatFlags(), CShellDispatch::ShowBrowserBar(), SHSkipJunction(), START_TEST(), statusclb_OnProgress(), statusclb_OnStartBinding(), statusclb_OnStopBinding(), StgCreatePropStg(), Storage_SetClass(), STORAGE_WriteCompObj(), StorageBaseImpl_SetClass(), SxsLookupClrGuid(), test1_GetClassID(), test_CLSIDFromProgID(), test_CLSIDFromProgIDWrap(), test_CLSIDFromString(), test_CoGetInstanceFromFile(), test_CoGetPSClsid(), test_CoGetStandardMarshal(), test_com_aggregation(), test_CoRegisterPSClsid(), test_CreateBody(), test_data_cache(), test_data_cache_init(), test_data_cache_initnew(), test_data_cache_save_data(), test_decoder_info(), test_default_handler(), test_delegated_methods(), test_desktop_IPersist(), test_destroy_callback(), test_devenum(), test_early_abort(), test_find_com_redirection(), test_find_progid_redirection(), test_find_surrogate(), test_FolderShortcut(), test_freethreadedmarshaler(), test_iface_ptr(), test_InitPropVariantFromCLSID(), test_IUnknown_GetClassID(), test_IWinHttpRequest_Invoke(), test_legacy_filter_registration(), test_local_server(), test_marshal_channel_buffer(), test_media_streams(), test_metadata_APE(), test_metadata_GIF_comment(), test_multi_encoder(), test_object(), test_OleCreateStaticFromData(), test_OleDoAutoConvert(), test_pack_FILEDESCRIPTORA(), test_pack_FILEDESCRIPTORW(), test_pack_SHDESCRIPTIONID(), test_persist_GetClassId(), test_persiststream(), test_PropVariantCompare(), test_proxybuffer(), test_ReadClassStm(), test_reader_info(), test_SHGetObjectCompatFlags(), test_ShortcutFolder(), test_stub(), test_stubbuffer(), test_supported_encoders(), TestModuleRegistry(), testpersist_GetClassID(), UIINSERTOBJECTDLG_OnOpen(), UIINSERTOBJECTDLG_PopulateObjectTypes(), unregister_clsid(), UnregisterComponent(), URLMoniker_IsEqual(), vmr_create(), WriteFmtUserTypeStg(), and wWinMain().

◆ cookies

◆ ctor

◆ globalCompartmentMgr

ITfCompartmentMgr* globalCompartmentMgr = NULL

Definition at line 74 of file msctf.c.

Referenced by ThreadMgr_GetGlobalCompartment().

◆ id_last

UINT id_last
static

◆ MSCTF_hinstance

HINSTANCE MSCTF_hinstance
static

Definition at line 42 of file msctf.c.

Referenced by DllMain(), DllRegisterServer(), and DllUnregisterServer().

◆ processId

TfClientId processId = 0

Definition at line 73 of file msctf.c.

Referenced by ThreadMgr_ActivateEx().

◆ szwSystemCTFKey

const WCHAR szwSystemCTFKey = {'S','O','F','T','W','A','R','E','\\','M','i','c','r','o','s','o','f','t','\\','C','T','F',0}

◆ szwSystemTIPKey

◆ tlsIndex