ReactOS  0.4.14-dev-376-gaedba84
compartmentmgr.c File Reference
#include <stdarg.h>
#include "wine/debug.h"
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winuser.h"
#include "shlwapi.h"
#include "winerror.h"
#include "objbase.h"
#include "oleauto.h"
#include "olectl.h"
#include "msctf.h"
#include "msctf_internal.h"
Include dependency graph for compartmentmgr.c:

Go to the source code of this file.

Classes

struct  tagCompartmentValue
 
struct  tagCompartmentMgr
 
struct  tagCompartmentEnumGuid
 
struct  tagCompartment
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct tagCompartmentValue CompartmentValue
 
typedef struct tagCompartmentMgr CompartmentMgr
 
typedef struct tagCompartmentEnumGuid CompartmentEnumGuid
 
typedef struct tagCompartment Compartment
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msctf)
 
static HRESULT CompartmentEnumGuid_Constructor (struct list *values, IEnumGUID **ppOut)
 
static HRESULT Compartment_Constructor (CompartmentValue *value, ITfCompartment **ppOut)
 
static CompartmentMgrimpl_from_ITfCompartmentMgr (ITfCompartmentMgr *iface)
 
static Compartmentimpl_from_ITfCompartment (ITfCompartment *iface)
 
static Compartmentimpl_from_ITfSource (ITfSource *iface)
 
static CompartmentEnumGuidimpl_from_IEnumGUID (IEnumGUID *iface)
 
HRESULT CompartmentMgr_Destructor (ITfCompartmentMgr *iface)
 
static HRESULT WINAPI CompartmentMgr_QueryInterface (ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI CompartmentMgr_AddRef (ITfCompartmentMgr *iface)
 
static ULONG WINAPI CompartmentMgr_Release (ITfCompartmentMgr *iface)
 
static HRESULT WINAPI CompartmentMgr_GetCompartment (ITfCompartmentMgr *iface, REFGUID rguid, ITfCompartment **ppcomp)
 
static HRESULT WINAPI CompartmentMgr_ClearCompartment (ITfCompartmentMgr *iface, TfClientId tid, REFGUID rguid)
 
static HRESULT WINAPI CompartmentMgr_EnumCompartments (ITfCompartmentMgr *iface, IEnumGUID **ppEnum)
 
HRESULT CompartmentMgr_Constructor (IUnknown *pUnkOuter, REFIID riid, IUnknown **ppOut)
 
static void CompartmentEnumGuid_Destructor (CompartmentEnumGuid *This)
 
static HRESULT WINAPI CompartmentEnumGuid_QueryInterface (IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI CompartmentEnumGuid_AddRef (IEnumGUID *iface)
 
static ULONG WINAPI CompartmentEnumGuid_Release (IEnumGUID *iface)
 
static HRESULT WINAPI CompartmentEnumGuid_Next (IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched)
 
static HRESULT WINAPI CompartmentEnumGuid_Skip (IEnumGUID *iface, ULONG celt)
 
static HRESULT WINAPI CompartmentEnumGuid_Reset (IEnumGUID *iface)
 
static HRESULT WINAPI CompartmentEnumGuid_Clone (IEnumGUID *iface, IEnumGUID **ppenum)
 
static void Compartment_Destructor (Compartment *This)
 
static HRESULT WINAPI Compartment_QueryInterface (ITfCompartment *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI Compartment_AddRef (ITfCompartment *iface)
 
static ULONG WINAPI Compartment_Release (ITfCompartment *iface)
 
static HRESULT WINAPI Compartment_SetValue (ITfCompartment *iface, TfClientId tid, const VARIANT *pvarValue)
 
static HRESULT WINAPI Compartment_GetValue (ITfCompartment *iface, VARIANT *pvarValue)
 
static HRESULT WINAPI CompartmentSource_QueryInterface (ITfSource *iface, REFIID iid, LPVOID *ppvOut)
 
static ULONG WINAPI CompartmentSource_AddRef (ITfSource *iface)
 
static ULONG WINAPI CompartmentSource_Release (ITfSource *iface)
 
static HRESULT WINAPI CompartmentSource_AdviseSink (ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie)
 
static HRESULT WINAPI CompartmentSource_UnadviseSink (ITfSource *iface, DWORD pdwCookie)
 

Variables

static const ITfCompartmentMgrVtbl CompartmentMgrVtbl
 
static const IEnumGUIDVtbl EnumGUIDVtbl
 
static const ITfCompartmentVtbl CompartmentVtbl
 
static const ITfSourceVtbl CompartmentSourceVtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 23 of file compartmentmgr.c.

Typedef Documentation

◆ Compartment

◆ CompartmentEnumGuid

◆ CompartmentMgr

◆ CompartmentValue

Function Documentation

◆ Compartment_AddRef()

static ULONG WINAPI Compartment_AddRef ( ITfCompartment iface)
static

Definition at line 466 of file compartmentmgr.c.

467 {
469  return InterlockedIncrement(&This->refCount);
470 }
#define InterlockedIncrement
Definition: armddk.h:53
static Compartment * impl_from_ITfCompartment(ITfCompartment *iface)

◆ Compartment_Constructor()

static HRESULT Compartment_Constructor ( CompartmentValue value,
ITfCompartment **  ppOut 
)
static

Definition at line 605 of file compartmentmgr.c.

606 {
607  Compartment *This;
608 
610  if (This == NULL)
611  return E_OUTOFMEMORY;
612 
613  This->ITfCompartment_iface.lpVtbl= &CompartmentVtbl;
614  This->ITfSource_iface.lpVtbl = &CompartmentSourceVtbl;
615  This->refCount = 1;
616 
617  This->valueData = valueData;
618  VariantInit(&This->variant);
619 
620  list_init(&This->CompartmentEventSink);
621 
622  *ppOut = &This->ITfCompartment_iface;
623  TRACE("returning %p\n", *ppOut);
624  return S_OK;
625 }
static const ITfSourceVtbl CompartmentSourceVtbl
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const ITfCompartmentVtbl CompartmentVtbl
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

Referenced by CompartmentMgr_GetCompartment().

◆ Compartment_Destructor()

static void Compartment_Destructor ( Compartment This)
static

Definition at line 433 of file compartmentmgr.c.

434 {
435  TRACE("destroying %p\n", This);
436  VariantClear(&This->variant);
437  free_sinks(&This->CompartmentEventSink);
439 }
void free_sinks(struct list *sink_list)
Definition: msctf.c:324
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by Compartment_Release().

◆ Compartment_GetValue()

static HRESULT WINAPI Compartment_GetValue ( ITfCompartment iface,
VARIANT pvarValue 
)
static

Definition at line 521 of file compartmentmgr.c.

523 {
525  TRACE("(%p) %p\n",This, pvarValue);
526 
527  if (!pvarValue)
528  return E_INVALIDARG;
529 
530  VariantInit(pvarValue);
531  if (V_VT(&This->variant) == VT_EMPTY) return S_FALSE;
532  return VariantCopy(pvarValue,&This->variant);
533 }
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:571
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define V_VT(A)
Definition: oleauto.h:211
HRESULT WINAPI VariantCopy(VARIANTARG *pvargDest, VARIANTARG *pvargSrc)
Definition: variant.c:751
static Compartment * impl_from_ITfCompartment(ITfCompartment *iface)

◆ Compartment_QueryInterface()

static HRESULT WINAPI Compartment_QueryInterface ( ITfCompartment iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 441 of file compartmentmgr.c.

442 {
444 
445  *ppvOut = NULL;
446 
447  if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartment))
448  {
449  *ppvOut = &This->ITfCompartment_iface;
450  }
451  else if (IsEqualIID(iid, &IID_ITfSource))
452  {
453  *ppvOut = &This->ITfSource_iface;
454  }
455 
456  if (*ppvOut)
457  {
458  ITfCompartment_AddRef(iface);
459  return S_OK;
460  }
461 
462  WARN("unsupported interface: %s\n", debugstr_guid(iid));
463  return E_NOINTERFACE;
464 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static Compartment * impl_from_ITfCompartment(ITfCompartment *iface)

◆ Compartment_Release()

static ULONG WINAPI Compartment_Release ( ITfCompartment iface)
static

Definition at line 472 of file compartmentmgr.c.

473 {
475  ULONG ret;
476 
477  ret = InterlockedDecrement(&This->refCount);
478  if (ret == 0)
480  return ret;
481 }
static void Compartment_Destructor(Compartment *This)
int ret
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
static Compartment * impl_from_ITfCompartment(ITfCompartment *iface)

◆ Compartment_SetValue()

static HRESULT WINAPI Compartment_SetValue ( ITfCompartment iface,
TfClientId  tid,
const VARIANT pvarValue 
)
static

Definition at line 483 of file compartmentmgr.c.

485 {
488  struct list *cursor;
489 
490  TRACE("(%p) %i %p\n",This,tid,pvarValue);
491 
492  if (!pvarValue)
493  return E_INVALIDARG;
494 
495  if (!(V_VT(pvarValue) == VT_BSTR || V_VT(pvarValue) == VT_I4 ||
496  V_VT(pvarValue) == VT_UNKNOWN))
497  return E_INVALIDARG;
498 
499  if (!This->valueData->owner)
500  This->valueData->owner = tid;
501 
502  VariantClear(&This->variant);
503 
504  /* Shallow copy of value and type */
505  This->variant = *pvarValue;
506 
507  if (V_VT(pvarValue) == VT_BSTR)
508  V_BSTR(&This->variant) = SysAllocStringByteLen((char*)V_BSTR(pvarValue),
509  SysStringByteLen(V_BSTR(pvarValue)));
510  else if (V_VT(pvarValue) == VT_UNKNOWN)
511  IUnknown_AddRef(V_UNKNOWN(&This->variant));
512 
513  SINK_FOR_EACH(cursor, &This->CompartmentEventSink, ITfCompartmentEventSink, sink)
514  {
515  ITfCompartmentEventSink_OnChange(sink, &This->valueData->guid);
516  }
517 
518  return S_OK;
519 }
Definition: compat.h:1947
#define SINK_FOR_EACH(cursor, list, type, elem)
UINT WINAPI SysStringByteLen(BSTR str)
Definition: oleaut.c:218
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define E_INVALIDARG
Definition: ddrawi.h:101
BSTR WINAPI DECLSPEC_HOTPATCH SysAllocStringByteLen(LPCSTR str, UINT len)
Definition: oleaut.c:431
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
Definition: _list.h:228
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_BSTR(A)
Definition: oleauto.h:226
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
static TfClientId tid
static Compartment * impl_from_ITfCompartment(ITfCompartment *iface)

◆ CompartmentEnumGuid_AddRef()

static ULONG WINAPI CompartmentEnumGuid_AddRef ( IEnumGUID iface)
static

Definition at line 317 of file compartmentmgr.c.

318 {
320  return InterlockedIncrement(&This->refCount);
321 }
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
#define InterlockedIncrement
Definition: armddk.h:53

◆ CompartmentEnumGuid_Clone()

static HRESULT WINAPI CompartmentEnumGuid_Clone ( IEnumGUID iface,
IEnumGUID **  ppenum 
)
static

Definition at line 381 of file compartmentmgr.c.

383 {
385  HRESULT res;
386 
387  TRACE("(%p)\n",This);
388 
389  if (ppenum == NULL) return E_POINTER;
390 
391  res = CompartmentEnumGuid_Constructor(This->values, ppenum);
392  if (SUCCEEDED(res))
393  {
394  CompartmentEnumGuid *new_This = impl_from_IEnumGUID(*ppenum);
395  new_This->cursor = This->cursor;
396  }
397  return res;
398 }
static HRESULT CompartmentEnumGuid_Constructor(struct list *values, IEnumGUID **ppOut)
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
GLuint res
Definition: glext.h:9613
#define E_POINTER
Definition: winerror.h:2365
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ CompartmentEnumGuid_Constructor()

static HRESULT CompartmentEnumGuid_Constructor ( struct list values,
IEnumGUID **  ppOut 
)
static

Definition at line 411 of file compartmentmgr.c.

412 {
414 
416  if (This == NULL)
417  return E_OUTOFMEMORY;
418 
419  This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl;
420  This->refCount = 1;
421 
422  This->values = values;
423  This->cursor = list_head(values);
424 
425  *ppOut = &This->IEnumGUID_iface;
426  TRACE("returning %p\n", *ppOut);
427  return S_OK;
428 }
GLboolean GLenum GLenum GLvoid * values
Definition: glext.h:5666
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
static const IEnumGUIDVtbl EnumGUIDVtbl
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123

Referenced by CompartmentEnumGuid_Clone(), and CompartmentMgr_EnumCompartments().

◆ CompartmentEnumGuid_Destructor()

static void CompartmentEnumGuid_Destructor ( CompartmentEnumGuid This)
static

Definition at line 291 of file compartmentmgr.c.

292 {
293  TRACE("destroying %p\n", This);
295 }
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by CompartmentEnumGuid_Release().

◆ CompartmentEnumGuid_Next()

static HRESULT WINAPI CompartmentEnumGuid_Next ( IEnumGUID iface,
ULONG  celt,
GUID rgelt,
ULONG pceltFetched 
)
static

Definition at line 337 of file compartmentmgr.c.

339 {
341  ULONG fetched = 0;
342 
343  TRACE("(%p)\n",This);
344 
345  if (rgelt == NULL) return E_POINTER;
346 
347  while (fetched < celt && This->cursor)
348  {
350  if (!value)
351  break;
352 
353  This->cursor = list_next(This->values,This->cursor);
354  *rgelt = value->guid;
355 
356  ++fetched;
357  ++rgelt;
358  }
359 
360  if (pceltFetched) *pceltFetched = fetched;
361  return fetched == celt ? S_OK : S_FALSE;
362 }
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115
unsigned int ULONG
Definition: retypes.h:1
#define LIST_ENTRY(type)
Definition: queue.h:175
#define E_POINTER
Definition: winerror.h:2365

◆ CompartmentEnumGuid_QueryInterface()

static HRESULT WINAPI CompartmentEnumGuid_QueryInterface ( IEnumGUID iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 297 of file compartmentmgr.c.

298 {
300  *ppvOut = NULL;
301 
302  if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID))
303  {
304  *ppvOut = &This->IEnumGUID_iface;
305  }
306 
307  if (*ppvOut)
308  {
309  IEnumGUID_AddRef(iface);
310  return S_OK;
311  }
312 
313  WARN("unsupported interface: %s\n", debugstr_guid(iid));
314  return E_NOINTERFACE;
315 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WARN(fmt,...)
Definition: debug.h:111
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ CompartmentEnumGuid_Release()

static ULONG WINAPI CompartmentEnumGuid_Release ( IEnumGUID iface)
static

Definition at line 323 of file compartmentmgr.c.

324 {
326  ULONG ret;
327 
328  ret = InterlockedDecrement(&This->refCount);
329  if (ret == 0)
331  return ret;
332 }
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
int ret
#define InterlockedDecrement
Definition: armddk.h:52
static void CompartmentEnumGuid_Destructor(CompartmentEnumGuid *This)
unsigned int ULONG
Definition: retypes.h:1

◆ CompartmentEnumGuid_Reset()

static HRESULT WINAPI CompartmentEnumGuid_Reset ( IEnumGUID iface)
static

Definition at line 373 of file compartmentmgr.c.

374 {
376  TRACE("(%p)\n",This);
377  This->cursor = list_head(This->values);
378  return S_OK;
379 }
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59

◆ CompartmentEnumGuid_Skip()

static HRESULT WINAPI CompartmentEnumGuid_Skip ( IEnumGUID iface,
ULONG  celt 
)
static

Definition at line 364 of file compartmentmgr.c.

365 {
367  TRACE("(%p)\n",This);
368 
369  This->cursor = list_next(This->values,This->cursor);
370  return S_OK;
371 }
static CompartmentEnumGuid * impl_from_IEnumGUID(IEnumGUID *iface)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115

◆ CompartmentMgr_AddRef()

static ULONG WINAPI CompartmentMgr_AddRef ( ITfCompartmentMgr iface)
static

Definition at line 144 of file compartmentmgr.c.

145 {
147  if (This->pUnkOuter)
148  return IUnknown_AddRef(This->pUnkOuter);
149  else
150  return InterlockedIncrement(&This->refCount);
151 }
#define InterlockedIncrement
Definition: armddk.h:53
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)

◆ CompartmentMgr_ClearCompartment()

static HRESULT WINAPI CompartmentMgr_ClearCompartment ( ITfCompartmentMgr iface,
TfClientId  tid,
REFGUID  rguid 
)
static

Definition at line 208 of file compartmentmgr.c.

210 {
212  struct list *cursor;
213 
214  TRACE("(%p) %i %s\n",This,tid,debugstr_guid(rguid));
215 
216  LIST_FOR_EACH(cursor, &This->values)
217  {
219  if (IsEqualGUID(rguid,&value->guid))
220  {
221  if (value->owner && tid != value->owner)
222  return E_UNEXPECTED;
224  ITfCompartment_Release(value->compartment);
226  return S_OK;
227  }
228  }
229 
230  return CONNECT_E_NOCONNECTION;
231 }
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
#define debugstr_guid
Definition: kernel32.h:35
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
#define E_UNEXPECTED
Definition: winerror.h:2456
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
#define LIST_ENTRY(type)
Definition: queue.h:175
static TfClientId tid
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ CompartmentMgr_Constructor()

HRESULT CompartmentMgr_Constructor ( IUnknown pUnkOuter,
REFIID  riid,
IUnknown **  ppOut 
)

Definition at line 254 of file compartmentmgr.c.

255 {
257 
258  if (!ppOut)
259  return E_POINTER;
260 
261  if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
262  return CLASS_E_NOAGGREGATION;
263 
265  if (This == NULL)
266  return E_OUTOFMEMORY;
267 
268  This->ITfCompartmentMgr_iface.lpVtbl = &CompartmentMgrVtbl;
269  This->pUnkOuter = pUnkOuter;
270  list_init(&This->values);
271 
272  if (pUnkOuter)
273  {
274  *ppOut = (IUnknown*)&This->ITfCompartmentMgr_iface;
275  TRACE("returning %p\n", *ppOut);
276  return S_OK;
277  }
278  else
279  {
280  HRESULT hr;
281  hr = ITfCompartmentMgr_QueryInterface(&This->ITfCompartmentMgr_iface, riid, (void**)ppOut);
282  if (FAILED(hr))
284  return hr;
285  }
286 }
HRESULT hr
Definition: shlfolder.c:183
REFIID riid
Definition: precomp.h:44
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
static const ITfCompartmentMgrVtbl CompartmentMgrVtbl
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define S_OK
Definition: intsafe.h:59
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define E_POINTER
Definition: winerror.h:2365
#define HeapFree(x, y, z)
Definition: compat.h:402
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

Referenced by Context_Constructor(), DocumentMgr_Constructor(), ThreadMgr_Constructor(), and ThreadMgr_GetGlobalCompartment().

◆ CompartmentMgr_Destructor()

HRESULT CompartmentMgr_Destructor ( ITfCompartmentMgr iface)

Definition at line 99 of file compartmentmgr.c.

100 {
102  struct list *cursor, *cursor2;
103 
104  LIST_FOR_EACH_SAFE(cursor, cursor2, &This->values)
105  {
108  ITfCompartment_Release(value->compartment);
110  }
111 
113  return S_OK;
114 }
#define LIST_FOR_EACH_SAFE(cursor, cursor2, list)
Definition: list.h:192
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define GetProcessHeap()
Definition: compat.h:403
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
#define LIST_ENTRY(type)
Definition: queue.h:175
#define HeapFree(x, y, z)
Definition: compat.h:402

Referenced by CompartmentMgr_Release(), Context_Destructor(), DocumentMgr_Destructor(), and ThreadMgr_Destructor().

◆ CompartmentMgr_EnumCompartments()

static HRESULT WINAPI CompartmentMgr_EnumCompartments ( ITfCompartmentMgr iface,
IEnumGUID **  ppEnum 
)
static

Definition at line 233 of file compartmentmgr.c.

235 {
237 
238  TRACE("(%p) %p\n",This,ppEnum);
239  if (!ppEnum)
240  return E_INVALIDARG;
241  return CompartmentEnumGuid_Constructor(&This->values, ppEnum);
242 }
static HRESULT CompartmentEnumGuid_Constructor(struct list *values, IEnumGUID **ppOut)
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)

◆ CompartmentMgr_GetCompartment()

static HRESULT WINAPI CompartmentMgr_GetCompartment ( ITfCompartmentMgr iface,
REFGUID  rguid,
ITfCompartment **  ppcomp 
)
static

Definition at line 169 of file compartmentmgr.c.

171 {
174  struct list *cursor;
175  HRESULT hr;
176 
177  TRACE("(%p) %s %p\n",This,debugstr_guid(rguid),ppcomp);
178 
179  LIST_FOR_EACH(cursor, &This->values)
180  {
182  if (IsEqualGUID(rguid,&value->guid))
183  {
184  ITfCompartment_AddRef(value->compartment);
185  *ppcomp = value->compartment;
186  return S_OK;
187  }
188  }
189 
191  value->guid = *rguid;
192  value->owner = 0;
193  hr = Compartment_Constructor(value,&value->compartment);
194  if (SUCCEEDED(hr))
195  {
196  list_add_head(&This->values,&value->entry);
197  ITfCompartment_AddRef(value->compartment);
198  *ppcomp = value->compartment;
199  }
200  else
201  {
203  *ppcomp = NULL;
204  }
205  return hr;
206 }
HRESULT hr
Definition: shlfolder.c:183
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
#define LIST_FOR_EACH(cursor, list)
Definition: list.h:188
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
const char cursor[]
Definition: icontest.c:13
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
#define LIST_ENTRY(type)
Definition: queue.h:175
#define HeapFree(x, y, z)
Definition: compat.h:402
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static HRESULT Compartment_Constructor(CompartmentValue *value, ITfCompartment **ppOut)

◆ CompartmentMgr_QueryInterface()

static HRESULT WINAPI CompartmentMgr_QueryInterface ( ITfCompartmentMgr iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 119 of file compartmentmgr.c.

120 {
122  if (This->pUnkOuter)
123  return IUnknown_QueryInterface(This->pUnkOuter, iid, ppvOut);
124  else
125  {
126  *ppvOut = NULL;
127 
128  if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfCompartmentMgr))
129  {
130  *ppvOut = &This->ITfCompartmentMgr_iface;
131  }
132 
133  if (*ppvOut)
134  {
135  ITfCompartmentMgr_AddRef(iface);
136  return S_OK;
137  }
138 
139  WARN("unsupported interface: %s\n", debugstr_guid(iid));
140  return E_NOINTERFACE;
141  }
142 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ CompartmentMgr_Release()

static ULONG WINAPI CompartmentMgr_Release ( ITfCompartmentMgr iface)
static

Definition at line 153 of file compartmentmgr.c.

154 {
156  if (This->pUnkOuter)
157  return IUnknown_Release(This->pUnkOuter);
158  else
159  {
160  ULONG ret;
161 
162  ret = InterlockedDecrement(&This->refCount);
163  if (ret == 0)
165  return ret;
166  }
167 }
int ret
#define InterlockedDecrement
Definition: armddk.h:52
HRESULT CompartmentMgr_Destructor(ITfCompartmentMgr *iface)
static CompartmentMgr * impl_from_ITfCompartmentMgr(ITfCompartmentMgr *iface)
unsigned int ULONG
Definition: retypes.h:1

◆ CompartmentSource_AddRef()

static ULONG WINAPI CompartmentSource_AddRef ( ITfSource iface)
static

Definition at line 554 of file compartmentmgr.c.

555 {
557  return ITfCompartment_AddRef(&This->ITfCompartment_iface);
558 }
static Compartment * impl_from_ITfSource(ITfSource *iface)

◆ CompartmentSource_AdviseSink()

static HRESULT WINAPI CompartmentSource_AdviseSink ( ITfSource iface,
REFIID  riid,
IUnknown punk,
DWORD pdwCookie 
)
static

Definition at line 566 of file compartmentmgr.c.

568 {
570 
571  TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
572 
573  if (!riid || !punk || !pdwCookie)
574  return E_INVALIDARG;
575 
576  if (IsEqualIID(riid, &IID_ITfCompartmentEventSink))
577  return advise_sink(&This->CompartmentEventSink, &IID_ITfCompartmentEventSink,
578  COOKIE_MAGIC_COMPARTMENTSINK, punk, pdwCookie);
579 
580  FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
581  return E_NOTIMPL;
582 }
static Compartment * impl_from_ITfSource(ITfSource *iface)
REFIID riid
Definition: precomp.h:44
HRESULT advise_sink(struct list *sink_list, REFIID riid, DWORD cookie_magic, IUnknown *unk, DWORD *cookie)
Definition: msctf.c:285
#define COOKIE_MAGIC_COMPARTMENTSINK
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_INVALIDARG
Definition: ddrawi.h:101
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define E_NOTIMPL
Definition: ddrawi.h:99
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95

◆ CompartmentSource_QueryInterface()

static HRESULT WINAPI CompartmentSource_QueryInterface ( ITfSource iface,
REFIID  iid,
LPVOID ppvOut 
)
static

Definition at line 548 of file compartmentmgr.c.

549 {
551  return ITfCompartment_QueryInterface(&This->ITfCompartment_iface, iid, ppvOut);
552 }
static Compartment * impl_from_ITfSource(ITfSource *iface)

◆ CompartmentSource_Release()

static ULONG WINAPI CompartmentSource_Release ( ITfSource iface)
static

Definition at line 560 of file compartmentmgr.c.

561 {
563  return ITfCompartment_Release(&This->ITfCompartment_iface);
564 }
static Compartment * impl_from_ITfSource(ITfSource *iface)

◆ CompartmentSource_UnadviseSink()

static HRESULT WINAPI CompartmentSource_UnadviseSink ( ITfSource iface,
DWORD  pdwCookie 
)
static

Definition at line 584 of file compartmentmgr.c.

585 {
587 
588  TRACE("(%p) %x\n",This,pdwCookie);
589 
591  return E_INVALIDARG;
592 
593  return unadvise_sink(pdwCookie);
594 }
static Compartment * impl_from_ITfSource(ITfSource *iface)
DWORD get_Cookie_magic(DWORD id)
Definition: msctf.c:233
#define COOKIE_MAGIC_COMPARTMENTSINK
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT unadvise_sink(DWORD cookie)
Definition: msctf.c:312

◆ impl_from_IEnumGUID()

static CompartmentEnumGuid* impl_from_IEnumGUID ( IEnumGUID iface)
inlinestatic

Definition at line 94 of file compartmentmgr.c.

95 {
96  return CONTAINING_RECORD(iface, CompartmentEnumGuid, IEnumGUID_iface);
97 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by CompartmentEnumGuid_AddRef(), CompartmentEnumGuid_Clone(), CompartmentEnumGuid_Next(), CompartmentEnumGuid_QueryInterface(), CompartmentEnumGuid_Release(), CompartmentEnumGuid_Reset(), and CompartmentEnumGuid_Skip().

◆ impl_from_ITfCompartment()

static Compartment* impl_from_ITfCompartment ( ITfCompartment iface)
inlinestatic

Definition at line 84 of file compartmentmgr.c.

85 {
86  return CONTAINING_RECORD(iface, Compartment, ITfCompartment_iface);
87 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by Compartment_AddRef(), Compartment_GetValue(), Compartment_QueryInterface(), Compartment_Release(), and Compartment_SetValue().

◆ impl_from_ITfCompartmentMgr()

static CompartmentMgr* impl_from_ITfCompartmentMgr ( ITfCompartmentMgr iface)
inlinestatic

Definition at line 79 of file compartmentmgr.c.

80 {
81  return CONTAINING_RECORD(iface, CompartmentMgr, ITfCompartmentMgr_iface);
82 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by CompartmentMgr_AddRef(), CompartmentMgr_ClearCompartment(), CompartmentMgr_Destructor(), CompartmentMgr_EnumCompartments(), CompartmentMgr_GetCompartment(), CompartmentMgr_QueryInterface(), and CompartmentMgr_Release().

◆ impl_from_ITfSource()

static Compartment* impl_from_ITfSource ( ITfSource iface)
inlinestatic

Definition at line 89 of file compartmentmgr.c.

90 {
91  return CONTAINING_RECORD(iface, Compartment, ITfSource_iface);
92 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by CompartmentSource_AddRef(), CompartmentSource_AdviseSink(), CompartmentSource_QueryInterface(), CompartmentSource_Release(), and CompartmentSource_UnadviseSink().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msctf  )

Variable Documentation

◆ CompartmentMgrVtbl

const ITfCompartmentMgrVtbl CompartmentMgrVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI CompartmentMgr_QueryInterface(ITfCompartmentMgr *iface, REFIID iid, LPVOID *ppvOut)
static HRESULT WINAPI CompartmentMgr_EnumCompartments(ITfCompartmentMgr *iface, IEnumGUID **ppEnum)
static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface, TfClientId tid, REFGUID rguid)
static ULONG WINAPI CompartmentMgr_AddRef(ITfCompartmentMgr *iface)
static ULONG WINAPI CompartmentMgr_Release(ITfCompartmentMgr *iface)
static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, REFGUID rguid, ITfCompartment **ppcomp)

Definition at line 244 of file compartmentmgr.c.

Referenced by CompartmentMgr_Constructor().

◆ CompartmentSourceVtbl

const ITfSourceVtbl CompartmentSourceVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI CompartmentSource_AdviseSink(ITfSource *iface, REFIID riid, IUnknown *punk, DWORD *pdwCookie)
static ULONG WINAPI CompartmentSource_AddRef(ITfSource *iface)
static HRESULT WINAPI CompartmentSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
static HRESULT WINAPI CompartmentSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
static ULONG WINAPI CompartmentSource_Release(ITfSource *iface)

Definition at line 596 of file compartmentmgr.c.

Referenced by Compartment_Constructor().

◆ CompartmentVtbl

const ITfCompartmentVtbl CompartmentVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI Compartment_SetValue(ITfCompartment *iface, TfClientId tid, const VARIANT *pvarValue)
static ULONG WINAPI Compartment_Release(ITfCompartment *iface)
static ULONG WINAPI Compartment_AddRef(ITfCompartment *iface)
static HRESULT WINAPI Compartment_GetValue(ITfCompartment *iface, VARIANT *pvarValue)
static HRESULT WINAPI Compartment_QueryInterface(ITfCompartment *iface, REFIID iid, LPVOID *ppvOut)

Definition at line 535 of file compartmentmgr.c.

Referenced by Compartment_Constructor().

◆ EnumGUIDVtbl

const IEnumGUIDVtbl EnumGUIDVtbl
static
Initial value:
=
{
}
static ULONG WINAPI CompartmentEnumGuid_Release(IEnumGUID *iface)
static HRESULT WINAPI CompartmentEnumGuid_Skip(IEnumGUID *iface, ULONG celt)
static HRESULT WINAPI CompartmentEnumGuid_Next(IEnumGUID *iface, ULONG celt, GUID *rgelt, ULONG *pceltFetched)
static ULONG WINAPI CompartmentEnumGuid_AddRef(IEnumGUID *iface)
static HRESULT WINAPI CompartmentEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
static HRESULT WINAPI CompartmentEnumGuid_Reset(IEnumGUID *iface)
static HRESULT WINAPI CompartmentEnumGuid_Clone(IEnumGUID *iface, IEnumGUID **ppenum)

Definition at line 400 of file compartmentmgr.c.

Referenced by CompartmentEnumGuid_Constructor().