2009-02-03 20:17:04 +01:00
|
|
|
/*
|
|
|
|
* ITfInputProcessorProfiles implementation
|
|
|
|
*
|
|
|
|
* Copyright 2009 Aric Stewart, CodeWeavers
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#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"
|
2009-05-12 19:50:00 +02:00
|
|
|
#include "olectl.h"
|
2009-02-03 20:17:04 +01:00
|
|
|
|
|
|
|
#include "msctf.h"
|
|
|
|
#include "msctf_internal.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(msctf);
|
|
|
|
|
2009-02-13 15:41:13 +01:00
|
|
|
static const WCHAR szwLngp[] = {'L','a','n','g','u','a','g','e','P','r','o','f','i','l','e',0};
|
2009-06-25 10:00:06 +02:00
|
|
|
static const WCHAR szwEnable[] = {'E','n','a','b','l','e',0};
|
2009-02-13 15:41:13 +01:00
|
|
|
static const WCHAR szwTipfmt[] = {'%','s','\\','%','s',0};
|
|
|
|
static const WCHAR szwFullLangfmt[] = {'%','s','\\','%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0};
|
|
|
|
|
2009-06-26 10:03:30 +02:00
|
|
|
static const WCHAR szwAssemblies[] = {'A','s','s','e','m','b','l','i','e','s',0};
|
|
|
|
static const WCHAR szwDefault[] = {'D','e','f','a','u','l','t',0};
|
|
|
|
static const WCHAR szwProfile[] = {'P','r','o','f','i','l','e',0};
|
|
|
|
static const WCHAR szwDefaultFmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x','\\','%','s',0};
|
|
|
|
|
2009-02-03 20:17:04 +01:00
|
|
|
typedef struct tagInputProcessorProfiles {
|
2013-11-17 09:21:51 +01:00
|
|
|
ITfInputProcessorProfiles ITfInputProcessorProfiles_iface;
|
|
|
|
ITfSource ITfSource_iface;
|
2014-04-29 15:35:44 +02:00
|
|
|
ITfInputProcessorProfileMgr ITfInputProcessorProfileMgr_iface;
|
2009-05-13 21:45:44 +02:00
|
|
|
/* const ITfInputProcessorProfilesExVtbl *InputProcessorProfilesExVtbl; */
|
|
|
|
/* const ITfInputProcessorProfileSubstituteLayoutVtbl *InputProcessorProfileSubstituteLayoutVtbl; */
|
2009-02-03 20:17:04 +01:00
|
|
|
LONG refCount;
|
2009-02-03 20:17:19 +01:00
|
|
|
|
|
|
|
LANGID currentLanguage;
|
2009-05-12 19:50:00 +02:00
|
|
|
|
|
|
|
struct list LanguageProfileNotifySink;
|
2009-02-03 20:17:04 +01:00
|
|
|
} InputProcessorProfiles;
|
|
|
|
|
2009-02-20 20:52:55 +01:00
|
|
|
typedef struct tagProfilesEnumGuid {
|
2013-11-17 09:21:51 +01:00
|
|
|
IEnumGUID IEnumGUID_iface;
|
2009-02-20 20:52:55 +01:00
|
|
|
LONG refCount;
|
|
|
|
|
|
|
|
HKEY key;
|
|
|
|
DWORD next_index;
|
|
|
|
} ProfilesEnumGuid;
|
|
|
|
|
2009-02-20 20:53:06 +01:00
|
|
|
typedef struct tagEnumTfLanguageProfiles {
|
2013-11-17 09:21:51 +01:00
|
|
|
IEnumTfLanguageProfiles IEnumTfLanguageProfiles_iface;
|
2009-02-20 20:53:06 +01:00
|
|
|
LONG refCount;
|
|
|
|
|
|
|
|
HKEY tipkey;
|
|
|
|
DWORD tip_index;
|
|
|
|
WCHAR szwCurrentClsid[39];
|
|
|
|
|
|
|
|
HKEY langkey;
|
|
|
|
DWORD lang_index;
|
|
|
|
|
|
|
|
LANGID langid;
|
2009-02-23 21:22:38 +01:00
|
|
|
ITfCategoryMgr *catmgr;
|
2009-02-20 20:53:06 +01:00
|
|
|
} EnumTfLanguageProfiles;
|
|
|
|
|
2014-05-15 16:52:30 +02:00
|
|
|
typedef struct {
|
|
|
|
IEnumTfInputProcessorProfiles IEnumTfInputProcessorProfiles_iface;
|
|
|
|
LONG ref;
|
|
|
|
} EnumTfInputProcessorProfiles;
|
|
|
|
|
2009-02-20 20:52:55 +01:00
|
|
|
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut);
|
2016-07-19 09:47:24 +02:00
|
|
|
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out);
|
2009-02-20 20:52:55 +01:00
|
|
|
|
2014-05-15 16:52:30 +02:00
|
|
|
static inline EnumTfInputProcessorProfiles *impl_from_IEnumTfInputProcessorProfiles(IEnumTfInputProcessorProfiles *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, EnumTfInputProcessorProfiles, IEnumTfInputProcessorProfiles_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfInputProcessorProfiles_QueryInterface(IEnumTfInputProcessorProfiles *iface,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IEnumTfInputProcessorProfiles_iface;
|
|
|
|
}else if(IsEqualGUID(riid, &IID_IEnumTfInputProcessorProfiles)) {
|
|
|
|
TRACE("(%p)->(IID_IEnumTfInputProcessorProfiles %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IEnumTfInputProcessorProfiles_iface;
|
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumTfInputProcessorProfiles_AddRef(IEnumTfInputProcessorProfiles *iface)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
2022-02-15 07:29:05 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2014-05-15 16:52:30 +02:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumTfInputProcessorProfiles_Release(IEnumTfInputProcessorProfiles *iface)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
2022-02-15 07:29:05 +01:00
|
|
|
TRACE("(%p) ref=%ld\n", This, ref);
|
2014-05-15 16:52:30 +02:00
|
|
|
|
|
|
|
if(!ref)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfInputProcessorProfiles_Clone(IEnumTfInputProcessorProfiles *iface,
|
|
|
|
IEnumTfInputProcessorProfiles **ret)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
FIXME("(%p)->(%p)\n", This, ret);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfInputProcessorProfiles_Next(IEnumTfInputProcessorProfiles *iface, ULONG count,
|
|
|
|
TF_INPUTPROCESSORPROFILE *profile, ULONG *fetch)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%lu %p %p)\n", This, count, profile, fetch);
|
2014-05-15 16:52:30 +02:00
|
|
|
|
|
|
|
if(fetch)
|
|
|
|
*fetch = 0;
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfInputProcessorProfiles_Reset(IEnumTfInputProcessorProfiles *iface)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfInputProcessorProfiles_Skip(IEnumTfInputProcessorProfiles *iface, ULONG count)
|
|
|
|
{
|
|
|
|
EnumTfInputProcessorProfiles *This = impl_from_IEnumTfInputProcessorProfiles(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%lu)\n", This, count);
|
2014-05-15 16:52:30 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IEnumTfInputProcessorProfilesVtbl EnumTfInputProcessorProfilesVtbl = {
|
|
|
|
EnumTfInputProcessorProfiles_QueryInterface,
|
|
|
|
EnumTfInputProcessorProfiles_AddRef,
|
|
|
|
EnumTfInputProcessorProfiles_Release,
|
|
|
|
EnumTfInputProcessorProfiles_Clone,
|
|
|
|
EnumTfInputProcessorProfiles_Next,
|
|
|
|
EnumTfInputProcessorProfiles_Reset,
|
|
|
|
EnumTfInputProcessorProfiles_Skip
|
|
|
|
};
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfiles(ITfInputProcessorProfiles *iface)
|
2009-05-12 19:50:00 +02:00
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfiles_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline InputProcessorProfiles *impl_from_ITfSource(ITfSource *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfSource_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline ProfilesEnumGuid *impl_from_IEnumGUID(IEnumGUID *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, ProfilesEnumGuid, IEnumGUID_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline EnumTfLanguageProfiles *impl_from_IEnumTfLanguageProfiles(IEnumTfLanguageProfiles *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, EnumTfLanguageProfiles, IEnumTfLanguageProfiles_iface);
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
2009-02-03 20:17:04 +01:00
|
|
|
static void InputProcessorProfiles_Destructor(InputProcessorProfiles *This)
|
|
|
|
{
|
|
|
|
TRACE("destroying %p\n", This);
|
2009-05-12 19:50:00 +02:00
|
|
|
|
2016-05-04 19:42:07 +02:00
|
|
|
free_sinks(&This->LanguageProfileNotifySink);
|
2009-02-03 20:17:04 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
|
|
|
|
2009-02-13 15:41:13 +01:00
|
|
|
static void add_userkey( REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile)
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR buf2[39];
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
DWORD disposition = 0;
|
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
TRACE("\n");
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
|
|
|
StringFromGUID2(guidProfile, buf2, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwFullLangfmt,szwSystemTIPKey,buf,szwLngp,langid,buf2);
|
2009-02-13 15:41:13 +01:00
|
|
|
|
|
|
|
res = RegCreateKeyExW(HKEY_CURRENT_USER,fullkey, 0, NULL, 0,
|
|
|
|
KEY_READ | KEY_WRITE, NULL, &key, &disposition);
|
|
|
|
|
|
|
|
if (!res && disposition == REG_CREATED_NEW_KEY)
|
|
|
|
{
|
|
|
|
DWORD zero = 0x0;
|
2009-06-25 10:00:06 +02:00
|
|
|
RegSetValueExW(key, szwEnable, 0, REG_DWORD, (LPBYTE)&zero, sizeof(DWORD));
|
2009-02-13 15:41:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
2014-04-29 15:35:44 +02:00
|
|
|
static HRESULT WINAPI InputProcessorProfiles_QueryInterface(ITfInputProcessorProfiles *iface, REFIID iid, void **ppv)
|
2009-02-03 20:17:04 +01:00
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_ITfInputProcessorProfiles))
|
|
|
|
{
|
2014-04-29 15:35:44 +02:00
|
|
|
*ppv = &This->ITfInputProcessorProfiles_iface;
|
|
|
|
}
|
|
|
|
else if (IsEqualIID(iid, &IID_ITfInputProcessorProfileMgr))
|
|
|
|
{
|
|
|
|
*ppv = &This->ITfInputProcessorProfileMgr_iface;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
2009-05-12 19:50:00 +02:00
|
|
|
else if (IsEqualIID(iid, &IID_ITfSource))
|
|
|
|
{
|
2014-04-29 15:35:44 +02:00
|
|
|
*ppv = &This->ITfSource_iface;
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
2014-04-29 15:35:44 +02:00
|
|
|
else
|
2009-02-03 20:17:04 +01:00
|
|
|
{
|
2014-04-29 15:35:44 +02:00
|
|
|
*ppv = NULL;
|
|
|
|
WARN("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
2014-04-29 15:35:44 +02:00
|
|
|
ITfInputProcessorProfiles_AddRef(iface);
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InputProcessorProfiles_AddRef(ITfInputProcessorProfiles *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
return InterlockedIncrement(&This->refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InputProcessorProfiles_Release(ITfInputProcessorProfiles *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
ret = InterlockedDecrement(&This->refCount);
|
|
|
|
if (ret == 0)
|
|
|
|
InputProcessorProfiles_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* ITfInputProcessorProfiles functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_Register(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:41 +01:00
|
|
|
HKEY tipkey;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR fullkey[68];
|
|
|
|
|
|
|
|
TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwTipfmt,szwSystemTIPKey,buf);
|
2009-02-03 20:17:41 +01:00
|
|
|
|
|
|
|
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE,fullkey, 0, NULL, 0,
|
|
|
|
KEY_READ | KEY_WRITE, NULL, &tipkey, NULL) != ERROR_SUCCESS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
RegCloseKey(tipkey);
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_Unregister(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-20 15:00:34 +01:00
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR fullkey[68];
|
|
|
|
|
|
|
|
TRACE("(%p) %s\n",This,debugstr_guid(rclsid));
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwTipfmt,szwSystemTIPKey,buf);
|
2009-02-20 15:00:34 +01:00
|
|
|
|
|
|
|
RegDeleteTreeW(HKEY_LOCAL_MACHINE, fullkey);
|
|
|
|
RegDeleteTreeW(HKEY_CURRENT_USER, fullkey);
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_AddLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid,
|
|
|
|
LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc,
|
|
|
|
ULONG cchDesc, const WCHAR *pchIconFile, ULONG cchFile,
|
|
|
|
ULONG uIconIndex)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:50 +01:00
|
|
|
HKEY tipkey,fmtkey;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR fullkey[100];
|
|
|
|
ULONG res;
|
2009-02-13 15:41:13 +01:00
|
|
|
DWORD disposition = 0;
|
2009-02-03 20:17:50 +01:00
|
|
|
|
|
|
|
static const WCHAR fmt2[] = {'%','s','\\','0','x','%','0','8','x','\\','%','s',0};
|
|
|
|
static const WCHAR desc[] = {'D','e','s','c','r','i','p','t','i','o','n',0};
|
|
|
|
static const WCHAR icnf[] = {'I','c','o','n','F','i','l','e',0};
|
|
|
|
static const WCHAR icni[] = {'I','c','o','n','I','n','d','e','x',0};
|
|
|
|
|
2022-02-15 07:29:05 +01:00
|
|
|
TRACE("(%p) %s %x %s %s %s %li\n",This,debugstr_guid(rclsid), langid,
|
2009-02-03 20:17:50 +01:00
|
|
|
debugstr_guid(guidProfile), debugstr_wn(pchDesc,cchDesc),
|
|
|
|
debugstr_wn(pchIconFile,cchFile),uIconIndex);
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwTipfmt,szwSystemTIPKey,buf);
|
2009-02-03 20:17:50 +01:00
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,fullkey, 0, KEY_READ | KEY_WRITE,
|
|
|
|
&tipkey ) != ERROR_SUCCESS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
StringFromGUID2(guidProfile, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),fmt2,szwLngp,langid,buf);
|
2009-02-03 20:17:50 +01:00
|
|
|
|
|
|
|
res = RegCreateKeyExW(tipkey,fullkey, 0, NULL, 0, KEY_READ | KEY_WRITE,
|
2009-02-13 15:41:13 +01:00
|
|
|
NULL, &fmtkey, &disposition);
|
2009-02-03 20:17:50 +01:00
|
|
|
|
|
|
|
if (!res)
|
|
|
|
{
|
2009-02-13 15:41:13 +01:00
|
|
|
DWORD zero = 0x0;
|
2010-03-27 14:29:33 +01:00
|
|
|
RegSetValueExW(fmtkey, desc, 0, REG_SZ, (const BYTE*)pchDesc, cchDesc * sizeof(WCHAR));
|
|
|
|
RegSetValueExW(fmtkey, icnf, 0, REG_SZ, (const BYTE*)pchIconFile, cchFile * sizeof(WCHAR));
|
2009-02-03 20:17:50 +01:00
|
|
|
RegSetValueExW(fmtkey, icni, 0, REG_DWORD, (LPBYTE)&uIconIndex, sizeof(DWORD));
|
2009-02-13 15:41:13 +01:00
|
|
|
if (disposition == REG_CREATED_NEW_KEY)
|
2009-06-25 10:00:06 +02:00
|
|
|
RegSetValueExW(fmtkey, szwEnable, 0, REG_DWORD, (LPBYTE)&zero, sizeof(DWORD));
|
2009-02-03 20:17:50 +01:00
|
|
|
RegCloseKey(fmtkey);
|
2009-02-13 15:41:13 +01:00
|
|
|
|
|
|
|
add_userkey(rclsid, langid, guidProfile);
|
2009-02-03 20:17:50 +01:00
|
|
|
}
|
|
|
|
RegCloseKey(tipkey);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
return S_OK;
|
|
|
|
else
|
|
|
|
return E_FAIL;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_RemoveLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_EnumInputProcessorInfo(
|
|
|
|
ITfInputProcessorProfiles *iface, IEnumGUID **ppEnum)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
TRACE("(%p) %p\n",This,ppEnum);
|
|
|
|
return ProfilesEnumGuid_Constructor(ppEnum);
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_GetDefaultLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID langid, REFGUID catid,
|
|
|
|
CLSID *pclsid, GUID *pguidProfile)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-06-26 10:03:30 +02:00
|
|
|
WCHAR fullkey[168];
|
|
|
|
WCHAR buf[39];
|
|
|
|
HKEY hkey;
|
|
|
|
DWORD count;
|
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
TRACE("%p) %x %s %p %p\n",This, langid, debugstr_guid(catid),pclsid,pguidProfile);
|
|
|
|
|
|
|
|
if (!catid || !pclsid || !pguidProfile)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
StringFromGUID2(catid, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey, ARRAY_SIZE(fullkey), szwDefaultFmt, szwSystemCTFKey, szwAssemblies, langid, buf);
|
2009-06-26 10:03:30 +02:00
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, fullkey, 0, KEY_READ | KEY_WRITE,
|
|
|
|
&hkey ) != ERROR_SUCCESS)
|
|
|
|
return S_FALSE;
|
|
|
|
|
|
|
|
count = sizeof(buf);
|
|
|
|
res = RegQueryValueExW(hkey, szwDefault, 0, NULL, (LPBYTE)buf, &count);
|
|
|
|
if (res != ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
|
|
|
CLSIDFromString(buf,pclsid);
|
|
|
|
|
2021-10-19 10:30:38 +02:00
|
|
|
count = sizeof(buf);
|
2009-06-26 10:03:30 +02:00
|
|
|
res = RegQueryValueExW(hkey, szwProfile, 0, NULL, (LPBYTE)buf, &count);
|
|
|
|
if (res == ERROR_SUCCESS)
|
|
|
|
CLSIDFromString(buf,pguidProfile);
|
|
|
|
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_SetDefaultLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID langid, REFCLSID rclsid,
|
|
|
|
REFGUID guidProfiles)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-06-26 10:03:47 +02:00
|
|
|
WCHAR fullkey[168];
|
|
|
|
WCHAR buf[39];
|
|
|
|
HKEY hkey;
|
|
|
|
GUID catid;
|
|
|
|
HRESULT hr;
|
|
|
|
ITfCategoryMgr *catmgr;
|
|
|
|
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
|
|
|
|
&GUID_TFCAT_TIP_SPEECH,
|
|
|
|
&GUID_TFCAT_TIP_HANDWRITING };
|
|
|
|
|
|
|
|
TRACE("%p) %x %s %s\n",This, langid, debugstr_guid(rclsid),debugstr_guid(guidProfiles));
|
|
|
|
|
|
|
|
if (!rclsid || !guidProfiles)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
hr = CategoryMgr_Constructor(NULL,(IUnknown**)&catmgr);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return hr;
|
|
|
|
|
|
|
|
if (ITfCategoryMgr_FindClosestCategory(catmgr, rclsid,
|
|
|
|
&catid, tipcats, 3) != S_OK)
|
|
|
|
hr = ITfCategoryMgr_FindClosestCategory(catmgr, rclsid,
|
|
|
|
&catid, NULL, 0);
|
|
|
|
ITfCategoryMgr_Release(catmgr);
|
|
|
|
|
|
|
|
if (FAILED(hr))
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
StringFromGUID2(&catid, buf, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey, ARRAY_SIZE(fullkey), szwDefaultFmt, szwSystemCTFKey, szwAssemblies, langid, buf);
|
2009-06-26 10:03:47 +02:00
|
|
|
|
|
|
|
if (RegCreateKeyExW(HKEY_CURRENT_USER, fullkey, 0, NULL, 0, KEY_READ | KEY_WRITE,
|
|
|
|
NULL, &hkey, NULL ) != ERROR_SUCCESS)
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
|
|
|
RegSetValueExW(hkey, szwDefault, 0, REG_SZ, (LPBYTE)buf, sizeof(buf));
|
|
|
|
StringFromGUID2(guidProfiles, buf, 39);
|
|
|
|
RegSetValueExW(hkey, szwProfile, 0, REG_SZ, (LPBYTE)buf, sizeof(buf));
|
|
|
|
RegCloseKey(hkey);
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_ActivateLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfiles)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-05-07 21:27:41 +02:00
|
|
|
HRESULT hr;
|
|
|
|
BOOL enabled;
|
|
|
|
TF_LANGUAGEPROFILE LanguageProfile;
|
|
|
|
|
|
|
|
TRACE("(%p) %s %x %s\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfiles));
|
|
|
|
|
|
|
|
if (langid != This->currentLanguage) return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (get_active_textservice(rclsid,NULL))
|
|
|
|
{
|
|
|
|
TRACE("Already Active\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = ITfInputProcessorProfiles_IsEnabledLanguageProfile(iface, rclsid,
|
|
|
|
langid, guidProfiles, &enabled);
|
|
|
|
if (FAILED(hr) || !enabled)
|
|
|
|
{
|
|
|
|
TRACE("Not Enabled\n");
|
|
|
|
return E_FAIL;
|
|
|
|
}
|
|
|
|
|
|
|
|
LanguageProfile.clsid = *rclsid;
|
|
|
|
LanguageProfile.langid = langid;
|
|
|
|
LanguageProfile.guidProfile = *guidProfiles;
|
2015-06-07 08:25:42 +02:00
|
|
|
LanguageProfile.fActive = TRUE;
|
2009-05-07 21:27:41 +02:00
|
|
|
|
2015-06-07 08:25:42 +02:00
|
|
|
return add_active_textservice(&LanguageProfile);
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_GetActiveLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID *plangid,
|
|
|
|
GUID *pguidProfile)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-05-07 21:27:52 +02:00
|
|
|
TF_LANGUAGEPROFILE profile;
|
|
|
|
|
|
|
|
TRACE("(%p) %s %p %p\n",This,debugstr_guid(rclsid),plangid,pguidProfile);
|
|
|
|
|
|
|
|
if (!rclsid || !plangid || !pguidProfile)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
if (get_active_textservice(rclsid, &profile))
|
|
|
|
{
|
|
|
|
*plangid = profile.langid;
|
|
|
|
*pguidProfile = profile.guidProfile;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*pguidProfile = GUID_NULL;
|
|
|
|
return S_FALSE;
|
|
|
|
}
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_GetLanguageProfileDescription(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile, BSTR *pbstrProfile)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_GetCurrentLanguage(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID *plangid)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:19 +01:00
|
|
|
TRACE("(%p) 0x%x\n",This,This->currentLanguage);
|
|
|
|
|
|
|
|
if (!plangid)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
*plangid = This->currentLanguage;
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_ChangeCurrentLanguage(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID langid)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2016-05-04 19:42:07 +02:00
|
|
|
ITfLanguageProfileNotifySink *sink;
|
2009-08-31 16:31:27 +02:00
|
|
|
struct list *cursor;
|
|
|
|
BOOL accept;
|
|
|
|
|
2009-02-03 20:17:04 +01:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
2009-08-31 16:31:27 +02:00
|
|
|
|
2016-05-04 19:42:07 +02:00
|
|
|
SINK_FOR_EACH(cursor, &This->LanguageProfileNotifySink, ITfLanguageProfileNotifySink, sink)
|
2009-08-31 16:31:27 +02:00
|
|
|
{
|
|
|
|
accept = TRUE;
|
2016-05-04 19:42:07 +02:00
|
|
|
ITfLanguageProfileNotifySink_OnLanguageChange(sink, langid, &accept);
|
2009-08-31 16:31:27 +02:00
|
|
|
if (!accept)
|
2016-05-04 19:42:07 +02:00
|
|
|
return E_FAIL;
|
2009-08-31 16:31:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO: On successful language change call OnLanguageChanged sink */
|
2009-02-03 20:17:04 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_GetLanguageList(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID **ppLangId, ULONG *pulCount)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-06-25 10:00:45 +02:00
|
|
|
FIXME("Semi-STUB:(%p)\n",This);
|
|
|
|
*ppLangId = CoTaskMemAlloc(sizeof(LANGID));
|
|
|
|
**ppLangId = This->currentLanguage;
|
|
|
|
*pulCount = 1;
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_EnumLanguageProfiles(
|
|
|
|
ITfInputProcessorProfiles *iface, LANGID langid,
|
|
|
|
IEnumTfLanguageProfiles **ppEnum)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2016-07-19 09:47:24 +02:00
|
|
|
EnumTfLanguageProfiles *profenum;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2009-02-20 20:53:06 +01:00
|
|
|
TRACE("(%p) %x %p\n",This,langid,ppEnum);
|
2016-07-19 09:46:01 +02:00
|
|
|
|
|
|
|
if (!ppEnum)
|
|
|
|
return E_INVALIDARG;
|
2016-07-19 09:47:24 +02:00
|
|
|
hr = EnumTfLanguageProfiles_Constructor(langid, &profenum);
|
|
|
|
*ppEnum = &profenum->IEnumTfLanguageProfiles_iface;
|
2016-07-19 09:46:01 +02:00
|
|
|
|
2016-07-19 09:47:24 +02:00
|
|
|
return hr;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile, BOOL fEnable)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-17 17:25:28 +01:00
|
|
|
HKEY key;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR buf2[39];
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
TRACE("(%p) %s %x %s %i\n",This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), fEnable);
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
|
|
|
StringFromGUID2(guidProfile, buf2, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwFullLangfmt,szwSystemTIPKey,buf,szwLngp,langid,buf2);
|
2009-02-17 17:25:28 +01:00
|
|
|
|
|
|
|
res = RegOpenKeyExW(HKEY_CURRENT_USER, fullkey, 0, KEY_READ | KEY_WRITE, &key);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
{
|
2009-06-25 10:00:06 +02:00
|
|
|
RegSetValueExW(key, szwEnable, 0, REG_DWORD, (LPBYTE)&fEnable, sizeof(DWORD));
|
2009-02-17 17:25:28 +01:00
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_IsEnabledLanguageProfile(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile, BOOL *pfEnable)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-17 17:25:44 +01:00
|
|
|
HKEY key;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR buf2[39];
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
TRACE("(%p) %s, %i, %s, %p\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),pfEnable);
|
|
|
|
|
|
|
|
if (!pfEnable)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
|
|
|
StringFromGUID2(guidProfile, buf2, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwFullLangfmt,szwSystemTIPKey,buf,szwLngp,langid,buf2);
|
2009-02-17 17:25:44 +01:00
|
|
|
|
|
|
|
res = RegOpenKeyExW(HKEY_CURRENT_USER, fullkey, 0, KEY_READ | KEY_WRITE, &key);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
DWORD count = sizeof(DWORD);
|
2009-06-25 10:00:06 +02:00
|
|
|
res = RegQueryValueExW(key, szwEnable, 0, NULL, (LPBYTE)pfEnable, &count);
|
2009-02-17 17:25:44 +01:00
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res) /* Try Default */
|
|
|
|
{
|
|
|
|
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, fullkey, 0, KEY_READ | KEY_WRITE, &key);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
{
|
|
|
|
DWORD count = sizeof(DWORD);
|
2009-06-25 10:00:06 +02:00
|
|
|
res = RegQueryValueExW(key, szwEnable, 0, NULL, (LPBYTE)pfEnable, &count);
|
2009-02-17 17:25:44 +01:00
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
return S_OK;
|
|
|
|
else
|
|
|
|
return E_FAIL;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_EnableLanguageProfileByDefault(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile, BOOL fEnable)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-17 17:25:36 +01:00
|
|
|
HKEY key;
|
|
|
|
WCHAR buf[39];
|
|
|
|
WCHAR buf2[39];
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
ULONG res;
|
|
|
|
|
|
|
|
TRACE("(%p) %s %x %s %i\n",This,debugstr_guid(rclsid),langid,debugstr_guid(guidProfile),fEnable);
|
|
|
|
|
|
|
|
StringFromGUID2(rclsid, buf, 39);
|
|
|
|
StringFromGUID2(guidProfile, buf2, 39);
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),szwFullLangfmt,szwSystemTIPKey,buf,szwLngp,langid,buf2);
|
2009-02-17 17:25:36 +01:00
|
|
|
|
|
|
|
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, fullkey, 0, KEY_READ | KEY_WRITE, &key);
|
|
|
|
|
|
|
|
if (!res)
|
|
|
|
{
|
2009-06-25 10:00:06 +02:00
|
|
|
RegSetValueExW(key, szwEnable, 0, REG_DWORD, (LPBYTE)&fEnable, sizeof(DWORD));
|
2009-02-17 17:25:36 +01:00
|
|
|
RegCloseKey(key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return E_FAIL;
|
|
|
|
|
|
|
|
return S_OK;
|
2009-02-03 20:17:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfiles_SubstituteKeyboardLayout(
|
|
|
|
ITfInputProcessorProfiles *iface, REFCLSID rclsid, LANGID langid,
|
|
|
|
REFGUID guidProfile, HKL hKL)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfiles(iface);
|
2009-02-03 20:17:04 +01:00
|
|
|
FIXME("STUB:(%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
static const ITfInputProcessorProfilesVtbl InputProcessorProfilesVtbl =
|
2009-02-03 20:17:04 +01:00
|
|
|
{
|
|
|
|
InputProcessorProfiles_QueryInterface,
|
|
|
|
InputProcessorProfiles_AddRef,
|
|
|
|
InputProcessorProfiles_Release,
|
|
|
|
InputProcessorProfiles_Register,
|
|
|
|
InputProcessorProfiles_Unregister,
|
|
|
|
InputProcessorProfiles_AddLanguageProfile,
|
|
|
|
InputProcessorProfiles_RemoveLanguageProfile,
|
|
|
|
InputProcessorProfiles_EnumInputProcessorInfo,
|
|
|
|
InputProcessorProfiles_GetDefaultLanguageProfile,
|
|
|
|
InputProcessorProfiles_SetDefaultLanguageProfile,
|
|
|
|
InputProcessorProfiles_ActivateLanguageProfile,
|
|
|
|
InputProcessorProfiles_GetActiveLanguageProfile,
|
|
|
|
InputProcessorProfiles_GetLanguageProfileDescription,
|
|
|
|
InputProcessorProfiles_GetCurrentLanguage,
|
|
|
|
InputProcessorProfiles_ChangeCurrentLanguage,
|
|
|
|
InputProcessorProfiles_GetLanguageList,
|
|
|
|
InputProcessorProfiles_EnumLanguageProfiles,
|
|
|
|
InputProcessorProfiles_EnableLanguageProfile,
|
|
|
|
InputProcessorProfiles_IsEnabledLanguageProfile,
|
|
|
|
InputProcessorProfiles_EnableLanguageProfileByDefault,
|
|
|
|
InputProcessorProfiles_SubstituteKeyboardLayout
|
|
|
|
};
|
|
|
|
|
2014-04-29 15:35:44 +02:00
|
|
|
static inline InputProcessorProfiles *impl_from_ITfInputProcessorProfileMgr(ITfInputProcessorProfileMgr *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, InputProcessorProfiles, ITfInputProcessorProfileMgr_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_QueryInterface(ITfInputProcessorProfileMgr *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
|
|
|
return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, riid, ppv);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InputProcessorProfileMgr_AddRef(ITfInputProcessorProfileMgr *iface)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
|
|
|
return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI InputProcessorProfileMgr_Release(ITfInputProcessorProfileMgr *iface)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
|
|
|
return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_ActivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
|
|
|
|
LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%ld %x %s %s %p %lx)\n", This, dwProfileType, langid, debugstr_guid(clsid),
|
2014-04-29 15:35:44 +02:00
|
|
|
debugstr_guid(guidProfile), hkl, dwFlags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_DeactivateProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
|
|
|
|
LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%ld %x %s %s %p %lx)\n", This, dwProfileType, langid, debugstr_guid(clsid),
|
2014-04-29 15:35:44 +02:00
|
|
|
debugstr_guid(guidProfile), hkl, dwFlags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_GetProfile(ITfInputProcessorProfileMgr *iface, DWORD dwProfileType,
|
|
|
|
LANGID langid, REFCLSID clsid, REFGUID guidProfile, HKL hkl, TF_INPUTPROCESSORPROFILE *pProfile)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%ld %x %s %s %p %p)\n", This, dwProfileType, langid, debugstr_guid(clsid),
|
2014-04-29 15:35:44 +02:00
|
|
|
debugstr_guid(guidProfile), hkl, pProfile);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_EnumProfiles(ITfInputProcessorProfileMgr *iface, LANGID langid,
|
|
|
|
IEnumTfInputProcessorProfiles **ppEnum)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2014-05-15 16:52:30 +02:00
|
|
|
EnumTfInputProcessorProfiles *enum_profiles;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%x %p)\n", This, langid, ppEnum);
|
|
|
|
|
|
|
|
enum_profiles = HeapAlloc(GetProcessHeap(), 0, sizeof(*enum_profiles));
|
|
|
|
if(!enum_profiles)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
|
|
|
enum_profiles->IEnumTfInputProcessorProfiles_iface.lpVtbl = &EnumTfInputProcessorProfilesVtbl;
|
|
|
|
enum_profiles->ref = 1;
|
|
|
|
|
|
|
|
*ppEnum = &enum_profiles->IEnumTfInputProcessorProfiles_iface;
|
|
|
|
return S_OK;
|
2014-04-29 15:35:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_ReleaseInputProcessor(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%s %lx)\n", This, debugstr_guid(rclsid), dwFlags);
|
2014-04-29 15:35:44 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_RegisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
|
|
|
|
LANGID langid, REFGUID guidProfile, const WCHAR *pchDesc, ULONG cchDesc, const WCHAR *pchIconFile,
|
|
|
|
ULONG cchFile, ULONG uIconIndex, HKL hklsubstitute, DWORD dwPreferredLayout, BOOL bEnabledByDefault,
|
|
|
|
DWORD dwFlags)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%s %x %s %s %ld %s %lu %lu %p %lx %x %lx)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile),
|
2014-04-29 15:35:44 +02:00
|
|
|
debugstr_w(pchDesc), cchDesc, debugstr_w(pchIconFile), cchFile, uIconIndex, hklsubstitute, dwPreferredLayout,
|
|
|
|
bEnabledByDefault, dwFlags);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_UnregisterProfile(ITfInputProcessorProfileMgr *iface, REFCLSID rclsid,
|
|
|
|
LANGID langid, REFGUID guidProfile, DWORD dwFlags)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
2022-02-15 07:29:05 +01:00
|
|
|
FIXME("(%p)->(%s %x %s %lx)\n", This, debugstr_guid(rclsid), langid, debugstr_guid(guidProfile), dwFlags);
|
2014-04-29 15:35:44 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI InputProcessorProfileMgr_GetActiveProfile(ITfInputProcessorProfileMgr *iface, REFGUID catid,
|
|
|
|
TF_INPUTPROCESSORPROFILE *pProfile)
|
|
|
|
{
|
2021-03-02 01:31:26 +01:00
|
|
|
static int once;
|
|
|
|
|
|
|
|
if (!once++)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This = impl_from_ITfInputProcessorProfileMgr(iface);
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(catid), pProfile);
|
|
|
|
}
|
|
|
|
|
2014-04-29 15:35:44 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const ITfInputProcessorProfileMgrVtbl InputProcessorProfileMgrVtbl = {
|
|
|
|
InputProcessorProfileMgr_QueryInterface,
|
|
|
|
InputProcessorProfileMgr_AddRef,
|
|
|
|
InputProcessorProfileMgr_Release,
|
|
|
|
InputProcessorProfileMgr_ActivateProfile,
|
|
|
|
InputProcessorProfileMgr_DeactivateProfile,
|
|
|
|
InputProcessorProfileMgr_GetProfile,
|
|
|
|
InputProcessorProfileMgr_EnumProfiles,
|
|
|
|
InputProcessorProfileMgr_ReleaseInputProcessor,
|
|
|
|
InputProcessorProfileMgr_RegisterProfile,
|
|
|
|
InputProcessorProfileMgr_UnregisterProfile,
|
|
|
|
InputProcessorProfileMgr_GetActiveProfile
|
|
|
|
};
|
|
|
|
|
2009-05-12 19:50:00 +02:00
|
|
|
/*****************************************************
|
|
|
|
* ITfSource functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI IPPSource_QueryInterface(ITfSource *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
2013-11-17 09:22:17 +01:00
|
|
|
return ITfInputProcessorProfiles_QueryInterface(&This->ITfInputProcessorProfiles_iface, iid, ppvOut);
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IPPSource_AddRef(ITfSource *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
|
|
|
return ITfInputProcessorProfiles_AddRef(&This->ITfInputProcessorProfiles_iface);
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI IPPSource_Release(ITfSource *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
|
|
|
return ITfInputProcessorProfiles_Release(&This->ITfInputProcessorProfiles_iface);
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
2009-09-19 23:33:29 +02:00
|
|
|
static HRESULT WINAPI IPPSource_AdviseSink(ITfSource *iface,
|
2009-05-12 19:50:00 +02:00
|
|
|
REFIID riid, IUnknown *punk, DWORD *pdwCookie)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
2009-05-12 19:50:00 +02:00
|
|
|
|
|
|
|
TRACE("(%p) %s %p %p\n",This,debugstr_guid(riid),punk,pdwCookie);
|
|
|
|
|
|
|
|
if (!riid || !punk || !pdwCookie)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2009-05-12 19:50:08 +02:00
|
|
|
if (IsEqualIID(riid, &IID_ITfLanguageProfileNotifySink))
|
2016-05-04 19:42:07 +02:00
|
|
|
return advise_sink(&This->LanguageProfileNotifySink, &IID_ITfLanguageProfileNotifySink,
|
|
|
|
COOKIE_MAGIC_IPPSINK, punk, pdwCookie);
|
2009-05-12 19:50:08 +02:00
|
|
|
|
2016-05-04 19:42:07 +02:00
|
|
|
FIXME("(%p) Unhandled Sink: %s\n",This,debugstr_guid(riid));
|
|
|
|
return E_NOTIMPL;
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
2009-09-19 23:33:29 +02:00
|
|
|
static HRESULT WINAPI IPPSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie)
|
2009-05-12 19:50:00 +02:00
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
InputProcessorProfiles *This = impl_from_ITfSource(iface);
|
2009-05-12 19:50:00 +02:00
|
|
|
|
2022-02-15 07:29:05 +01:00
|
|
|
TRACE("(%p) %lx\n",This,pdwCookie);
|
2009-05-12 19:50:00 +02:00
|
|
|
|
|
|
|
if (get_Cookie_magic(pdwCookie)!=COOKIE_MAGIC_IPPSINK)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2016-05-04 19:42:07 +02:00
|
|
|
return unadvise_sink(pdwCookie);
|
2009-05-12 19:50:00 +02:00
|
|
|
}
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
static const ITfSourceVtbl InputProcessorProfilesSourceVtbl =
|
2009-05-12 19:50:00 +02:00
|
|
|
{
|
|
|
|
IPPSource_QueryInterface,
|
|
|
|
IPPSource_AddRef,
|
|
|
|
IPPSource_Release,
|
|
|
|
IPPSource_AdviseSink,
|
|
|
|
IPPSource_UnadviseSink,
|
|
|
|
};
|
|
|
|
|
2009-02-03 20:17:04 +01:00
|
|
|
HRESULT InputProcessorProfiles_Constructor(IUnknown *pUnkOuter, IUnknown **ppOut)
|
|
|
|
{
|
|
|
|
InputProcessorProfiles *This;
|
|
|
|
if (pUnkOuter)
|
|
|
|
return CLASS_E_NOAGGREGATION;
|
|
|
|
|
|
|
|
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(InputProcessorProfiles));
|
|
|
|
if (This == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
This->ITfInputProcessorProfiles_iface.lpVtbl= &InputProcessorProfilesVtbl;
|
|
|
|
This->ITfSource_iface.lpVtbl = &InputProcessorProfilesSourceVtbl;
|
2014-04-29 15:35:44 +02:00
|
|
|
This->ITfInputProcessorProfileMgr_iface.lpVtbl = &InputProcessorProfileMgrVtbl;
|
2009-02-03 20:17:04 +01:00
|
|
|
This->refCount = 1;
|
2009-02-03 20:17:19 +01:00
|
|
|
This->currentLanguage = GetUserDefaultLCID();
|
2009-02-03 20:17:04 +01:00
|
|
|
|
2009-05-12 19:50:00 +02:00
|
|
|
list_init(&This->LanguageProfileNotifySink);
|
|
|
|
|
2013-11-19 13:14:45 +01:00
|
|
|
*ppOut = (IUnknown *)&This->ITfInputProcessorProfiles_iface;
|
|
|
|
TRACE("returning %p\n", *ppOut);
|
2009-02-03 20:17:04 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
2009-02-20 20:52:55 +01:00
|
|
|
|
|
|
|
/**************************************************
|
2011-08-24 15:28:14 +02:00
|
|
|
* IEnumGUID implementation for ITfInputProcessorProfiles::EnumInputProcessorInfo
|
2009-02-20 20:52:55 +01:00
|
|
|
**************************************************/
|
|
|
|
static void ProfilesEnumGuid_Destructor(ProfilesEnumGuid *This)
|
|
|
|
{
|
|
|
|
TRACE("destroying %p\n", This);
|
|
|
|
RegCloseKey(This->key);
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProfilesEnumGuid_QueryInterface(IEnumGUID *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumGUID))
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
*ppvOut = &This->IEnumGUID_iface;
|
2009-02-20 20:52:55 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
2012-08-19 20:01:36 +02:00
|
|
|
IEnumGUID_AddRef(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ProfilesEnumGuid_AddRef(IEnumGUID *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
return InterlockedIncrement(&This->refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ProfilesEnumGuid_Release(IEnumGUID *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
ret = InterlockedDecrement(&This->refCount);
|
|
|
|
if (ret == 0)
|
|
|
|
ProfilesEnumGuid_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* IEnumGuid functions
|
|
|
|
*****************************************************/
|
|
|
|
static HRESULT WINAPI ProfilesEnumGuid_Next( LPENUMGUID iface,
|
|
|
|
ULONG celt, GUID *rgelt, ULONG *pceltFetched)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
ULONG fetched = 0;
|
|
|
|
|
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
|
|
|
if (rgelt == NULL) return E_POINTER;
|
|
|
|
|
|
|
|
if (This->key) while (fetched < celt)
|
|
|
|
{
|
|
|
|
LSTATUS res;
|
|
|
|
HRESULT hr;
|
|
|
|
WCHAR catid[39];
|
|
|
|
DWORD cName = 39;
|
|
|
|
|
|
|
|
res = RegEnumKeyExW(This->key, This->next_index, catid, &cName,
|
|
|
|
NULL, NULL, NULL, NULL);
|
|
|
|
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
|
|
|
++(This->next_index);
|
|
|
|
|
|
|
|
hr = CLSIDFromString(catid, rgelt);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
++fetched;
|
|
|
|
++rgelt;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pceltFetched) *pceltFetched = fetched;
|
|
|
|
return fetched == celt ? S_OK : S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProfilesEnumGuid_Skip( LPENUMGUID iface, ULONG celt)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
|
|
|
This->next_index += celt;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProfilesEnumGuid_Reset( LPENUMGUID iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
This->next_index = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ProfilesEnumGuid_Clone( LPENUMGUID iface,
|
|
|
|
IEnumGUID **ppenum)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *This = impl_from_IEnumGUID(iface);
|
2009-02-20 20:52:55 +01:00
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
|
|
|
if (ppenum == NULL) return E_POINTER;
|
|
|
|
|
|
|
|
res = ProfilesEnumGuid_Constructor(ppenum);
|
|
|
|
if (SUCCEEDED(res))
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
ProfilesEnumGuid *new_This = impl_from_IEnumGUID(*ppenum);
|
2009-02-20 20:52:55 +01:00
|
|
|
new_This->next_index = This->next_index;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
static const IEnumGUIDVtbl EnumGUIDVtbl =
|
|
|
|
{
|
2009-02-20 20:52:55 +01:00
|
|
|
ProfilesEnumGuid_QueryInterface,
|
|
|
|
ProfilesEnumGuid_AddRef,
|
|
|
|
ProfilesEnumGuid_Release,
|
|
|
|
ProfilesEnumGuid_Next,
|
|
|
|
ProfilesEnumGuid_Skip,
|
|
|
|
ProfilesEnumGuid_Reset,
|
|
|
|
ProfilesEnumGuid_Clone
|
|
|
|
};
|
|
|
|
|
|
|
|
static HRESULT ProfilesEnumGuid_Constructor(IEnumGUID **ppOut)
|
|
|
|
{
|
|
|
|
ProfilesEnumGuid *This;
|
|
|
|
|
|
|
|
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ProfilesEnumGuid));
|
|
|
|
if (This == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
This->IEnumGUID_iface.lpVtbl= &EnumGUIDVtbl;
|
2009-02-20 20:52:55 +01:00
|
|
|
This->refCount = 1;
|
|
|
|
|
|
|
|
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
|
|
|
|
KEY_READ | KEY_WRITE, NULL, &This->key, NULL) != ERROR_SUCCESS)
|
2011-12-06 21:53:20 +01:00
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2009-02-20 20:52:55 +01:00
|
|
|
return E_FAIL;
|
2011-12-06 21:53:20 +01:00
|
|
|
}
|
2009-02-20 20:52:55 +01:00
|
|
|
|
2013-11-19 13:14:45 +01:00
|
|
|
*ppOut = &This->IEnumGUID_iface;
|
|
|
|
TRACE("returning %p\n", *ppOut);
|
2009-02-20 20:52:55 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
2009-02-20 20:53:06 +01:00
|
|
|
|
|
|
|
/**************************************************
|
2011-08-24 15:28:14 +02:00
|
|
|
* IEnumTfLanguageProfiles implementation
|
2009-02-20 20:53:06 +01:00
|
|
|
**************************************************/
|
|
|
|
static void EnumTfLanguageProfiles_Destructor(EnumTfLanguageProfiles *This)
|
|
|
|
{
|
|
|
|
TRACE("destroying %p\n", This);
|
|
|
|
RegCloseKey(This->tipkey);
|
|
|
|
if (This->langkey)
|
|
|
|
RegCloseKey(This->langkey);
|
2009-02-23 21:22:38 +01:00
|
|
|
ITfCategoryMgr_Release(This->catmgr);
|
2009-02-20 20:53:06 +01:00
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfLanguageProfiles_QueryInterface(IEnumTfLanguageProfiles *iface, REFIID iid, LPVOID *ppvOut)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
|
|
|
|
2009-02-20 20:53:06 +01:00
|
|
|
*ppvOut = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(iid, &IID_IUnknown) || IsEqualIID(iid, &IID_IEnumTfLanguageProfiles))
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
*ppvOut = &This->IEnumTfLanguageProfiles_iface;
|
2009-02-20 20:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*ppvOut)
|
|
|
|
{
|
2012-08-19 20:01:36 +02:00
|
|
|
IEnumTfLanguageProfiles_AddRef(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
WARN("unsupported interface: %s\n", debugstr_guid(iid));
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumTfLanguageProfiles_AddRef(IEnumTfLanguageProfiles *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
return InterlockedIncrement(&This->refCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI EnumTfLanguageProfiles_Release(IEnumTfLanguageProfiles *iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
ULONG ret;
|
|
|
|
|
|
|
|
ret = InterlockedDecrement(&This->refCount);
|
|
|
|
if (ret == 0)
|
|
|
|
EnumTfLanguageProfiles_Destructor(This);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************
|
|
|
|
* IEnumGuid functions
|
|
|
|
*****************************************************/
|
|
|
|
static INT next_LanguageProfile(EnumTfLanguageProfiles *This, CLSID clsid, TF_LANGUAGEPROFILE *tflp)
|
|
|
|
{
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
ULONG res;
|
|
|
|
WCHAR profileid[39];
|
|
|
|
DWORD cName = 39;
|
|
|
|
GUID profile;
|
|
|
|
|
|
|
|
static const WCHAR fmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x',0};
|
|
|
|
|
|
|
|
if (This->langkey == NULL)
|
|
|
|
{
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),fmt,This->szwCurrentClsid,szwLngp,This->langid);
|
2009-02-20 20:53:06 +01:00
|
|
|
res = RegOpenKeyExW(This->tipkey, fullkey, 0, KEY_READ | KEY_WRITE, &This->langkey);
|
|
|
|
if (res)
|
|
|
|
{
|
|
|
|
This->langkey = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
This->lang_index = 0;
|
|
|
|
}
|
|
|
|
res = RegEnumKeyExW(This->langkey, This->lang_index, profileid, &cName,
|
|
|
|
NULL, NULL, NULL, NULL);
|
|
|
|
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA)
|
|
|
|
{
|
|
|
|
RegCloseKey(This->langkey);
|
|
|
|
This->langkey = NULL;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
++(This->lang_index);
|
|
|
|
|
|
|
|
if (tflp)
|
|
|
|
{
|
2009-02-23 21:22:38 +01:00
|
|
|
static const GUID * tipcats[3] = { &GUID_TFCAT_TIP_KEYBOARD,
|
|
|
|
&GUID_TFCAT_TIP_SPEECH,
|
|
|
|
&GUID_TFCAT_TIP_HANDWRITING };
|
2009-02-20 20:53:06 +01:00
|
|
|
res = CLSIDFromString(profileid, &profile);
|
|
|
|
if (FAILED(res)) return 0;
|
|
|
|
|
|
|
|
tflp->clsid = clsid;
|
|
|
|
tflp->langid = This->langid;
|
2009-05-07 21:27:41 +02:00
|
|
|
tflp->fActive = get_active_textservice(&clsid, NULL);
|
2009-02-20 20:53:06 +01:00
|
|
|
tflp->guidProfile = profile;
|
2009-02-23 21:22:38 +01:00
|
|
|
if (ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
|
|
|
|
&tflp->catid, tipcats, 3) != S_OK)
|
|
|
|
ITfCategoryMgr_FindClosestCategory(This->catmgr, &clsid,
|
|
|
|
&tflp->catid, NULL, 0);
|
2009-02-20 20:53:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfLanguageProfiles_Next(IEnumTfLanguageProfiles *iface,
|
|
|
|
ULONG ulCount, TF_LANGUAGEPROFILE *pProfile, ULONG *pcFetch)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
ULONG fetched = 0;
|
|
|
|
|
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
|
|
|
if (pProfile == NULL) return E_POINTER;
|
|
|
|
|
|
|
|
if (This->tipkey) while (fetched < ulCount)
|
|
|
|
{
|
|
|
|
LSTATUS res;
|
|
|
|
HRESULT hr;
|
|
|
|
DWORD cName = 39;
|
|
|
|
GUID clsid;
|
|
|
|
|
|
|
|
res = RegEnumKeyExW(This->tipkey, This->tip_index,
|
|
|
|
This->szwCurrentClsid, &cName, NULL, NULL, NULL, NULL);
|
|
|
|
if (res != ERROR_SUCCESS && res != ERROR_MORE_DATA) break;
|
|
|
|
++(This->tip_index);
|
|
|
|
hr = CLSIDFromString(This->szwCurrentClsid, &clsid);
|
|
|
|
if (FAILED(hr)) continue;
|
|
|
|
|
|
|
|
while ( fetched < ulCount)
|
|
|
|
{
|
|
|
|
INT res = next_LanguageProfile(This, clsid, pProfile);
|
|
|
|
if (res == 1)
|
|
|
|
{
|
|
|
|
++fetched;
|
|
|
|
++pProfile;
|
|
|
|
}
|
|
|
|
else if (res == -1)
|
|
|
|
break;
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pcFetch) *pcFetch = fetched;
|
|
|
|
return fetched == ulCount ? S_OK : S_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfLanguageProfiles_Skip( IEnumTfLanguageProfiles* iface, ULONG celt)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
FIXME("STUB (%p)\n",This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfLanguageProfiles_Reset( IEnumTfLanguageProfiles* iface)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2009-02-20 20:53:06 +01:00
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
This->tip_index = 0;
|
|
|
|
if (This->langkey)
|
|
|
|
RegCloseKey(This->langkey);
|
|
|
|
This->langkey = NULL;
|
|
|
|
This->lang_index = 0;
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI EnumTfLanguageProfiles_Clone( IEnumTfLanguageProfiles *iface,
|
|
|
|
IEnumTfLanguageProfiles **ppenum)
|
|
|
|
{
|
2013-11-17 09:21:51 +01:00
|
|
|
EnumTfLanguageProfiles *This = impl_from_IEnumTfLanguageProfiles(iface);
|
2016-07-19 09:47:24 +02:00
|
|
|
EnumTfLanguageProfiles *new_This;
|
2009-02-20 20:53:06 +01:00
|
|
|
HRESULT res;
|
|
|
|
|
|
|
|
TRACE("(%p)\n",This);
|
|
|
|
|
|
|
|
if (ppenum == NULL) return E_POINTER;
|
|
|
|
|
2016-07-19 09:47:24 +02:00
|
|
|
res = EnumTfLanguageProfiles_Constructor(This->langid, &new_This);
|
2009-02-20 20:53:06 +01:00
|
|
|
if (SUCCEEDED(res))
|
|
|
|
{
|
|
|
|
new_This->tip_index = This->tip_index;
|
|
|
|
lstrcpynW(new_This->szwCurrentClsid,This->szwCurrentClsid,39);
|
|
|
|
|
|
|
|
if (This->langkey)
|
|
|
|
{
|
|
|
|
WCHAR fullkey[168];
|
|
|
|
static const WCHAR fmt[] = {'%','s','\\','%','s','\\','0','x','%','0','8','x',0};
|
|
|
|
|
2019-06-12 09:41:05 +02:00
|
|
|
swprintf(fullkey,ARRAY_SIZE(fullkey),fmt,This->szwCurrentClsid,szwLngp,This->langid);
|
2009-02-20 20:53:06 +01:00
|
|
|
res = RegOpenKeyExW(new_This->tipkey, fullkey, 0, KEY_READ | KEY_WRITE, &This->langkey);
|
|
|
|
new_This->lang_index = This->lang_index;
|
|
|
|
}
|
2016-07-19 09:47:24 +02:00
|
|
|
*ppenum = &new_This->IEnumTfLanguageProfiles_iface;
|
2009-02-20 20:53:06 +01:00
|
|
|
}
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
static const IEnumTfLanguageProfilesVtbl EnumTfLanguageProfilesVtbl =
|
|
|
|
{
|
2009-02-20 20:53:06 +01:00
|
|
|
EnumTfLanguageProfiles_QueryInterface,
|
|
|
|
EnumTfLanguageProfiles_AddRef,
|
|
|
|
EnumTfLanguageProfiles_Release,
|
|
|
|
EnumTfLanguageProfiles_Clone,
|
|
|
|
EnumTfLanguageProfiles_Next,
|
|
|
|
EnumTfLanguageProfiles_Reset,
|
|
|
|
EnumTfLanguageProfiles_Skip
|
|
|
|
};
|
|
|
|
|
2016-07-19 09:47:24 +02:00
|
|
|
static HRESULT EnumTfLanguageProfiles_Constructor(LANGID langid, EnumTfLanguageProfiles **out)
|
2009-02-20 20:53:06 +01:00
|
|
|
{
|
2009-02-23 21:22:38 +01:00
|
|
|
HRESULT hr;
|
2009-02-20 20:53:06 +01:00
|
|
|
EnumTfLanguageProfiles *This;
|
|
|
|
|
|
|
|
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(EnumTfLanguageProfiles));
|
|
|
|
if (This == NULL)
|
|
|
|
return E_OUTOFMEMORY;
|
|
|
|
|
2013-11-17 09:21:51 +01:00
|
|
|
This->IEnumTfLanguageProfiles_iface.lpVtbl= &EnumTfLanguageProfilesVtbl;
|
2009-02-20 20:53:06 +01:00
|
|
|
This->refCount = 1;
|
|
|
|
This->langid = langid;
|
|
|
|
|
2009-02-23 21:22:38 +01:00
|
|
|
hr = CategoryMgr_Constructor(NULL,(IUnknown**)&This->catmgr);
|
|
|
|
if (FAILED(hr))
|
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(),0,This);
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
2009-02-20 20:53:06 +01:00
|
|
|
if (RegCreateKeyExW(HKEY_LOCAL_MACHINE, szwSystemTIPKey, 0, NULL, 0,
|
|
|
|
KEY_READ | KEY_WRITE, NULL, &This->tipkey, NULL) != ERROR_SUCCESS)
|
2011-12-06 21:53:20 +01:00
|
|
|
{
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
2009-02-20 20:53:06 +01:00
|
|
|
return E_FAIL;
|
2011-12-06 21:53:20 +01:00
|
|
|
}
|
2009-02-20 20:53:06 +01:00
|
|
|
|
2016-07-19 09:47:24 +02:00
|
|
|
*out = This;
|
|
|
|
TRACE("returning %p\n", *out);
|
2009-02-20 20:53:06 +01:00
|
|
|
return S_OK;
|
|
|
|
}
|