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

Alexandre Julliard julliard at winehq.org
Thu Nov 29 15:09:38 CST 2018


Module: wine
Branch: stable
Commit: 9f19c3d4baae0de576ceeefc345de70148817ea1
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=9f19c3d4baae0de576ceeefc345de70148817ea1

Author: Jactry Zeng <jzeng at codeweavers.com>
Date:   Fri Sep  7 16:01:26 2018 +0800

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

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=43488
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 563bfdfc18605f4c1c43964378cf21d416426ab8)
Conflicts:
	dlls/riched20/tests/txtsrv.c
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/riched20/tests/txtsrv.c | 20 ++++++++++++++++++++
 dlls/riched20/txtsrv.c       | 30 ++++++++++++++++++++----------
 2 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c
index 73ca7cd..737eb96 100644
--- a/dlls/riched20/tests/txtsrv.c
+++ b/dlls/riched20/tests/txtsrv.c
@@ -949,6 +949,25 @@ static void test_QueryInterface(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;
@@ -979,6 +998,7 @@ START_TEST( txtsrv )
         test_TxGetNaturalSize();
         test_TxDraw();
         test_QueryInterface();
+        test_TxGetScroll();
     }
     if (wrapperCodeMem) VirtualFree(wrapperCodeMem, 0, MEM_RELEASE);
 }
diff --git a/dlls/riched20/txtsrv.c b/dlls/riched20/txtsrv.c
index eb61e4e..ee65621 100644
--- a/dlls/riched20/txtsrv.c
+++ b/dlls/riched20/txtsrv.c
@@ -182,11 +182,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetHScroll(ITextServices *iface, LONG
 {
    ITextServicesImpl *This = impl_from_ITextServices(iface);
 
-   *plMin = This->editor->horz_si.nMin;
-   *plMax = This->editor->horz_si.nMax;
-   *plPos = This->editor->horz_si.nPos;
-   *plPage = This->editor->horz_si.nPage;
-   *pfEnabled = (This->editor->styleFlags & WS_HSCROLL) != 0;
+   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,11 +200,16 @@ DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxGetVScroll(ITextServices *iface, LONG
 {
    ITextServicesImpl *This = impl_from_ITextServices(iface);
 
-   *plMin = This->editor->vert_si.nMin;
-   *plMax = This->editor->vert_si.nMax;
-   *plPos = This->editor->vert_si.nPos;
-   *plPage = This->editor->vert_si.nPage;
-   *pfEnabled = (This->editor->styleFlags & WS_VSCROLL) != 0;
+   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;
 }
 




More information about the wine-cvs mailing list