From 5a11999b8608b63b0c523cc49d819a00b83276e4 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Mon, 14 Jan 2008 11:56:36 +0000 Subject: [PATCH] mlang: Implement Rfc1766ToLcidW. --- dlls/mlang/mlang.c | 32 +++++++++++++++++++++++++++----- dlls/mlang/mlang.spec | 2 +- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index ac455e6ef03..42da54e8425 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -46,6 +46,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mlang); #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) static HRESULT MultiLanguage_create(IUnknown *pUnkOuter, LPVOID *ppObj); +static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum); static DWORD MLANG_tls_index; /* to store various per thead data */ @@ -761,6 +762,28 @@ static HRESULT lcid_from_rfc1766(IEnumRfc1766 *iface, LCID *lcid, LPCWSTR rfc176 return E_FAIL; } +HRESULT WINAPI Rfc1766ToLcidW(LCID *pLocale, LPCWSTR pszRfc1766) +{ + IEnumRfc1766 *enumrfc1766; + HRESULT hr; + + TRACE("(%p, %s)\n", pLocale, debugstr_w(pszRfc1766)); + + if (!pLocale || !pszRfc1766) + return E_INVALIDARG; + + *pLocale = 0; + + hr = EnumRfc1766_create(0, &enumrfc1766); + if (FAILED(hr)) + return hr; + + hr = lcid_from_rfc1766(enumrfc1766, pLocale, pszRfc1766); + IEnumRfc1766_Release(enumrfc1766); + + return hr; +} + /****************************************************************************** * MLANG ClassFactory */ @@ -1868,13 +1891,12 @@ static BOOL CALLBACK enum_locales_proc(LPWSTR locale) return TRUE; } -static HRESULT EnumRfc1766_create(MLang_impl* mlang, LANGID LangId, - IEnumRfc1766 **ppEnum) +static HRESULT EnumRfc1766_create(LANGID LangId, IEnumRfc1766 **ppEnum) { EnumRfc1766_impl *rfc; struct enum_locales_data data; - TRACE("%p, %04x, %p\n", mlang, LangId, ppEnum); + TRACE("%04x, %p\n", LangId, ppEnum); rfc = HeapAlloc( GetProcessHeap(), 0, sizeof(EnumRfc1766_impl) ); rfc->vtbl_IEnumRfc1766 = &IEnumRfc1766_vtbl; @@ -1918,7 +1940,7 @@ static HRESULT WINAPI fnIMultiLanguage_EnumRfc1766( ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); TRACE("%p %p\n", This, ppEnumRfc1766); - return EnumRfc1766_create(This, 0, ppEnumRfc1766); + return EnumRfc1766_create(0, ppEnumRfc1766); } /******************************************************************************/ @@ -2243,7 +2265,7 @@ static HRESULT WINAPI fnIMultiLanguage2_EnumRfc1766( ICOM_THIS_MULTI(MLang_impl, vtbl_IMultiLanguage, iface); TRACE("%p %p\n", This, ppEnumRfc1766); - return EnumRfc1766_create(This, LangId, ppEnumRfc1766); + return EnumRfc1766_create(LangId, ppEnumRfc1766); } static HRESULT WINAPI fnIMultiLanguage2_GetRfc1766Info( diff --git a/dlls/mlang/mlang.spec b/dlls/mlang/mlang.spec index 5b067ed2719..d087b3c675e 100644 --- a/dlls/mlang/mlang.spec +++ b/dlls/mlang/mlang.spec @@ -11,4 +11,4 @@ @ stdcall LcidToRfc1766A(long ptr long) @ stdcall LcidToRfc1766W(long ptr long) @ stub Rfc1766ToLcidA -@ stub Rfc1766ToLcidW +@ stdcall Rfc1766ToLcidW(ptr wstr)