msctf: Generate TfEditCookies for edit sessions.

This commit is contained in:
Aric Stewart 2009-05-20 14:46:50 -05:00 committed by Alexandre Julliard
parent a5006e7eb4
commit bdb54fdaf2
1 changed files with 15 additions and 2 deletions

View File

@ -668,6 +668,8 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
{
TextStoreACPSink *This = (TextStoreACPSink *)iface;
HRESULT hr;
EditCookie *cookie;
TfEditCookie ec;
TRACE("(%p) %x\n",This, dwLockFlags);
@ -677,12 +679,23 @@ static HRESULT WINAPI TextStoreACPSink_OnLockGranted(ITextStoreACPSink *iface,
return E_FAIL;
}
/* TODO: generate and use an edit cookie */
hr = ITfEditSession_DoEditSession(This->pContext->currentEditSession, 0xdeadcafe);
cookie = HeapAlloc(GetProcessHeap(),0,sizeof(EditCookie));
if (!cookie)
return E_OUTOFMEMORY;
cookie->lockType = dwLockFlags;
cookie->pOwningContext = This->pContext;
ec = generate_Cookie(COOKIE_MAGIC_EDITCOOKIE, cookie);
hr = ITfEditSession_DoEditSession(This->pContext->currentEditSession, ec);
ITfEditSession_Release(This->pContext->currentEditSession);
This->pContext->currentEditSession = NULL;
/* Edit Cookie is only valid during the edit session */
cookie = remove_Cookie(ec);
HeapFree(GetProcessHeap(),0,cookie);
return hr;
}