Module: wine Branch: master Commit: f21e9c2aa89a12db3dda5493556fd2195b6f1468 URL: http://source.winehq.org/git/wine.git/?a=commit;h=f21e9c2aa89a12db3dda549355...
Author: Rob Shearman rob@codeweavers.com Date: Wed May 23 19:12:59 2007 +0100
mlang: Implement ConvertINetString.
---
dlls/mlang/mlang.c | 41 +++++++++++++++++++++++++++++++++++++++-- 1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c index 8133744..6d5142b 100644 --- a/dlls/mlang/mlang.c +++ b/dlls/mlang/mlang.c @@ -601,9 +601,46 @@ HRESULT WINAPI ConvertINetString( LPINT pcDstSize ) { - FIXME("%p %d %d %s %p %p %p: stub!\n", pdwMode, dwSrcEncoding, dwDstEncoding, + TRACE("%p %d %d %s %p %p %p\n", pdwMode, dwSrcEncoding, dwDstEncoding, debugstr_a(pSrcStr), pcSrcSize, pDstStr, pcDstSize); - return E_NOTIMPL; + + if (dwSrcEncoding == CP_UNICODE) + { + INT cSrcSizeW; + if (pcSrcSize && *pcSrcSize != -1) + { + cSrcSizeW = *pcSrcSize / sizeof(WCHAR); + pcSrcSize = &cSrcSizeW; + } + return ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, (LPCWSTR)pSrcStr, pcSrcSize, pDstStr, pcDstSize); + } + else if (dwDstEncoding == CP_UNICODE) + { + HRESULT hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, (LPWSTR)pDstStr, pcDstSize); + *pcDstSize *= sizeof(WCHAR); + return hr; + } + else + { + INT cDstSizeW; + LPWSTR pDstStrW; + HRESULT hr; + + TRACE("convert %s from %d to %d\n", debugstr_a(pSrcStr), dwSrcEncoding, dwDstEncoding); + + hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, NULL, &cDstSizeW); + if (hr != S_OK) + return hr; + + pDstStrW = HeapAlloc(GetProcessHeap(), 0, cDstSizeW * sizeof(WCHAR)); + hr = ConvertINetMultiByteToUnicode(pdwMode, dwSrcEncoding, pSrcStr, pcSrcSize, pDstStrW, &cDstSizeW); + if (hr != S_OK) + return hr; + + hr = ConvertINetUnicodeToMultiByte(pdwMode, dwDstEncoding, pDstStrW, &cDstSizeW, pDstStr, pcDstSize); + HeapFree(GetProcessHeap(), 0, pDstStrW); + return hr; + } }
static HRESULT GetFamilyCodePage(