From ba69aebd3eb2b5b4063dcf9a377147cc25dec35a Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Mon, 22 Jun 2009 12:02:49 +0900 Subject: [PATCH] msctf: Implement ITfCompartmentMgr::GetCompartment. --- dlls/msctf/compartmentmgr.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/dlls/msctf/compartmentmgr.c b/dlls/msctf/compartmentmgr.c index 09b71b10871..53794956b0d 100644 --- a/dlls/msctf/compartmentmgr.c +++ b/dlls/msctf/compartmentmgr.c @@ -153,8 +153,39 @@ static HRESULT WINAPI CompartmentMgr_GetCompartment(ITfCompartmentMgr *iface, REFGUID rguid, ITfCompartment **ppcomp) { CompartmentMgr *This = (CompartmentMgr *)iface; - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + CompartmentValue* value; + struct list *cursor; + HRESULT hr; + + TRACE("(%p) %s %p\n",This,debugstr_guid(rguid),ppcomp); + + LIST_FOR_EACH(cursor, &This->values) + { + value = LIST_ENTRY(cursor,CompartmentValue,entry); + if (IsEqualGUID(rguid,&value->guid)) + { + ITfCompartment_AddRef(value->compartment); + *ppcomp = value->compartment; + return S_OK; + } + } + + value = HeapAlloc(GetProcessHeap(),0,sizeof(CompartmentValue)); + value->guid = *rguid; + value->owner = 0; + hr = Compartment_Constructor(value,&value->compartment); + if (SUCCEEDED(hr)) + { + list_add_head(&This->values,&value->entry); + ITfCompartment_AddRef(value->compartment); + *ppcomp = value->compartment; + } + else + { + HeapFree(GetProcessHeap(),0,value); + *ppcomp = NULL; + } + return hr; } static HRESULT WINAPI CompartmentMgr_ClearCompartment(ITfCompartmentMgr *iface,