mlang: Add a stub implementation of IMultiLanguage3::DetectOutboundCodePageInIStream.

This commit is contained in:
Hans Leidekker 2014-12-18 16:33:03 +01:00 committed by Alexandre Julliard
parent 88778ec0b8
commit e11f91ed8d
3 changed files with 246 additions and 7 deletions

View File

@ -3064,10 +3064,17 @@ static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePage(
{
MLang_impl *This = impl_from_IMultiLanguage3( iface );
FIXME("(%p)->(%08x %s %u %p %u %p %p %p)\n", This, dwFlags, debugstr_w(lpWideCharStr),
cchWideChar, puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
return E_NOTIMPL;
FIXME("(%p)->(%08x %s %p %u %p %p(%u) %s)\n", This, dwFlags, debugstr_w(lpWideCharStr),
puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, pnDetectedCodePages ? *pnDetectedCodePages : 0,
debugstr_w(lpSpecialChar));
if (!puiDetectedCodePages || !pnDetectedCodePages || !*pnDetectedCodePages)
return E_INVALIDARG;
puiDetectedCodePages[0] = CP_UTF8;
*pnDetectedCodePages = 1;
return S_OK;
}
static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePageInIStream(
@ -3082,10 +3089,17 @@ static HRESULT WINAPI fnIMultiLanguage3_DetectOutboundCodePageInIStream(
{
MLang_impl *This = impl_from_IMultiLanguage3( iface );
FIXME("(%p)->(%08x %p %p %u %p %p %p)\n", This, dwFlags, pStrIn,
FIXME("(%p)->(%08x %p %p %u %p %p(%u) %s)\n", This, dwFlags, pStrIn,
puiPreferredCodePages, nPreferredCodePages, puiDetectedCodePages,
pnDetectedCodePages, lpSpecialChar);
return E_NOTIMPL;
pnDetectedCodePages, pnDetectedCodePages ? *pnDetectedCodePages : 0,
debugstr_w(lpSpecialChar));
if (!puiDetectedCodePages || !pnDetectedCodePages || !*pnDetectedCodePages)
return E_INVALIDARG;
puiDetectedCodePages[0] = CP_UTF8;
*pnDetectedCodePages = 1;
return S_OK;
}
static const IMultiLanguage3Vtbl IMultiLanguage3_vtbl =

View File

@ -1984,10 +1984,214 @@ todo_wine
IMLangConvertCharset_Release(convert);
}
static const char stream_data[] = "VCARD2.1test;test";
static ULONG stream_pos;
static HRESULT WINAPI stream_QueryInterface(IStream *iface, REFIID riid, void **obj)
{
ok(FALSE, "unexpected call\n");
return E_NOINTERFACE;
}
static ULONG WINAPI stream_AddRef(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return 2;
}
static ULONG WINAPI stream_Release(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return 1;
}
static HRESULT WINAPI stream_Read(IStream *iface, void *buf, ULONG len, ULONG *read)
{
ULONG size;
if (stream_pos == sizeof(stream_data) - 1)
{
*read = 0;
return S_FALSE;
}
size = min(sizeof(stream_data) - 1 - stream_pos, len);
memcpy(buf, stream_data + stream_pos, size);
stream_pos += size;
*read = size;
return S_OK;
}
static HRESULT WINAPI stream_Write(IStream *iface, const void *buf, ULONG len, ULONG *written)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Seek(IStream *iface, LARGE_INTEGER move, DWORD origin,
ULARGE_INTEGER *newpos)
{
if (origin == STREAM_SEEK_SET)
stream_pos = move.QuadPart;
else if (origin == STREAM_SEEK_CUR)
stream_pos += move.QuadPart;
else if (origin == STREAM_SEEK_END)
stream_pos = sizeof(stream_data) - 1 - move.QuadPart;
if (newpos) newpos->QuadPart = stream_pos;
return S_OK;
}
static HRESULT WINAPI stream_SetSize(IStream *iface, ULARGE_INTEGER newsize)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_CopyTo(IStream *iface, IStream *stream, ULARGE_INTEGER len,
ULARGE_INTEGER *read, ULARGE_INTEGER *written)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Commit(IStream *iface, DWORD flags)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Revert(IStream *iface)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_LockRegion(IStream *iface, ULARGE_INTEGER offset,
ULARGE_INTEGER len, DWORD locktype)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_UnlockRegion(IStream *iface, ULARGE_INTEGER offset,
ULARGE_INTEGER len, DWORD locktype)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Stat(IStream *iface, STATSTG *stg, DWORD flag)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static HRESULT WINAPI stream_Clone(IStream *iface, IStream **stream)
{
ok(FALSE, "unexpected call\n");
return E_NOTIMPL;
}
static const IStreamVtbl stream_vtbl =
{
stream_QueryInterface,
stream_AddRef,
stream_Release,
stream_Read,
stream_Write,
stream_Seek,
stream_SetSize,
stream_CopyTo,
stream_Commit,
stream_Revert,
stream_LockRegion,
stream_UnlockRegion,
stream_Stat,
stream_Clone
};
static IStream test_stream = { &stream_vtbl };
static void test_DetectOutboundCodePageInIStream(IMultiLanguage3 *ml)
{
HRESULT hr;
UINT nb_detected, detected[4];
UINT preferred[] = {1250,1251,1252,65001};
UINT preferred2[] = {1250,1251,1252};
nb_detected = 0;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
nb_detected = 1;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), NULL, &nb_detected, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
nb_detected = 1;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
ok(nb_detected == 1, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
nb_detected = 2;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 2, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
nb_detected = 3;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
nb_detected = 4;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred,
sizeof(preferred)/sizeof(preferred[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
ok(detected[3] == 0, "got %u\n", detected[3]);
nb_detected = 3;
memset(detected, 0, sizeof(detected));
hr = IMultiLanguage3_DetectOutboundCodePageInIStream(ml,
MLDETECTF_PRESERVE_ORDER, &test_stream, preferred2,
sizeof(preferred2)/sizeof(preferred2[0]), detected, &nb_detected, NULL);
ok(hr == S_OK, "got %08x\n", hr);
todo_wine ok(nb_detected == 3, "got %u\n", nb_detected);
ok(detected[0] == 65001, "got %u\n", detected[0]);
todo_wine ok(detected[1] == 65000, "got %u\n", detected[1]);
todo_wine ok(detected[2] == 1200, "got %u\n", detected[2]);
}
START_TEST(mlang)
{
IMultiLanguage *iML = NULL;
IMultiLanguage2 *iML2 = NULL;
IMultiLanguage3 *iML3 = NULL;
IMLangFontLink *iMLFL = NULL;
IMLangFontLink2 *iMLFL2 = NULL;
HRESULT ret;
@ -2070,5 +2274,14 @@ START_TEST(mlang)
test_CodePageToScriptID(iMLFL2);
IMLangFontLink2_Release(iMLFL2);
trace("IMultiLanguage3\n");
ret = CoCreateInstance(&CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER,
&IID_IMultiLanguage3, (void **)&iML3);
if (ret == S_OK)
{
test_DetectOutboundCodePageInIStream(iML3);
IMultiLanguage3_Release(iML3);
}
CoUninitialize();
}

View File

@ -386,6 +386,18 @@ interface IMLangConvertCharset : IUnknown
MLCONVCHARF_DETECTJPN = 32
} MLCONVCHAR;
typedef enum tagMLCPF
{
MLDETECTF_MAILNEWS = 0x0001,
MLDETECTF_BROWSER = 0x0002,
MLDETECTF_VALID = 0x0004,
MLDETECTF_VALID_NLS = 0x0008,
MLDETECTF_PRESERVE_ORDER = 0x0010,
MLDETECTF_PREFERRED_ONLY = 0x0020,
MLDETECTF_FILTER_SPECIALCHAR = 0x0040,
MLDETECTF_EURO_UTF8 = 0x0080
} MLCP;
HRESULT Initialize(
[in] UINT uiSrcCodePage,
[in] UINT uiDstCodePage,