Zebediah Figura : strmbase: Fix implementation of IVideoWindow::get_Caption().

Alexandre Julliard julliard at winehq.org
Tue Oct 8 16:05:56 CDT 2019


Module: wine
Branch: master
Commit: 058926db97d657b3b2907e12a3cc8906c524d82e
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=058926db97d657b3b2907e12a3cc8906c524d82e

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Oct  7 18:55:42 2019 -0500

strmbase: Fix implementation of IVideoWindow::get_Caption().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/strmbase/window.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/dlls/strmbase/window.c b/dlls/strmbase/window.c
index b7c0bae47b..4ecc81c24e 100644
--- a/dlls/strmbase/window.c
+++ b/dlls/strmbase/window.c
@@ -297,15 +297,24 @@ HRESULT WINAPI BaseControlWindowImpl_put_Caption(IVideoWindow *iface, BSTR strCa
     return S_OK;
 }
 
-HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *strCaption)
+HRESULT WINAPI BaseControlWindowImpl_get_Caption(IVideoWindow *iface, BSTR *caption)
 {
-    BaseControlWindow*  This = impl_from_IVideoWindow(iface);
+    BaseControlWindow *window = impl_from_IVideoWindow(iface);
+    WCHAR *str;
+    int len;
 
-    TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
+    TRACE("window %p, caption %p.\n", window, caption);
 
-    GetWindowTextW(This->baseWindow.hWnd, (LPWSTR)strCaption, 100);
+    *caption = NULL;
 
-    return S_OK;
+    len = GetWindowTextLengthW(window->baseWindow.hWnd) + 1;
+    if (!(str = heap_alloc(len * sizeof(WCHAR))))
+        return E_OUTOFMEMORY;
+
+    GetWindowTextW(window->baseWindow.hWnd, str, len);
+    *caption = SysAllocString(str);
+    heap_free(str);
+    return *caption ? S_OK : E_OUTOFMEMORY;
 }
 
 HRESULT WINAPI BaseControlWindowImpl_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle)




More information about the wine-cvs mailing list