riched20: Handle NULL in ITextServices::{TxGetHScroll, TxGetVScroll}.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43488
Signed-off-by: Jactry Zeng <jzeng@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jactry Zeng 2018-09-07 16:01:26 +08:00 committed by Alexandre Julliard
parent 0c049b6791
commit 563bfdfc18
2 changed files with 40 additions and 10 deletions

View File

@ -990,6 +990,25 @@ static void test_default_format(void)
ITextHost_Release(host);
}
static void test_TxGetScroll(void)
{
ITextServices *txtserv;
ITextHost *host;
HRESULT ret;
if (!init_texthost(&txtserv, &host))
return;
ret = ITextServices_TxGetHScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
ok(ret == S_OK, "ITextSerHices_GetVScroll failed: 0x%08x.\n", ret);
ret = ITextServices_TxGetVScroll(txtserv, NULL, NULL, NULL, NULL, NULL);
ok(ret == S_OK, "ITextServices_GetVScroll failed: 0x%08x.\n", ret);
ITextServices_Release(txtserv);
ITextHost_Release(host);
}
START_TEST( txtsrv )
{
ITextServices *txtserv;
@ -1021,6 +1040,7 @@ START_TEST( txtsrv )
test_TxDraw();
test_QueryInterface();
test_default_format();
test_TxGetScroll();
}
if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
}

View File

@ -182,10 +182,15 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG
{
ITextServicesImpl *This = impl_from_ITextServices(iface);
if (plMin)
*plMin = This->editor->horz_si.nMin;
if (plMax)
*plMax = This->editor->horz_si.nMax;
if (plPos)
*plPos = This->editor->horz_si.nPos;
if (plPage)
*plPage = This->editor->horz_si.nPage;
if (pfEnabled)
*pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
return S_OK;
}
@ -195,10 +200,15 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG
{
ITextServicesImpl *This = impl_from_ITextServices(iface);
if (plMin)
*plMin = This->editor->vert_si.nMin;
if (plMax)
*plMax = This->editor->vert_si.nMax;
if (plPos)
*plPos = This->editor->vert_si.nPos;
if (plPage)
*plPage = This->editor->vert_si.nPage;
if (pfEnabled)
*pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
return S_OK;
}