[PATCH v2 5/7] oleacc: Add get_value function for edit client accessible object.

Connor McAdams cmcadams at codeweavers.com
Wed Sep 22 15:12:39 CDT 2021


Signed-off-by: Connor McAdams <cmcadams at codeweavers.com>
---
 dlls/oleacc/client.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/dlls/oleacc/client.c b/dlls/oleacc/client.c
index 9d5da15e624..a5620a4f24c 100644
--- a/dlls/oleacc/client.c
+++ b/dlls/oleacc/client.c
@@ -46,6 +46,7 @@ struct win_class_vtbl {
     HRESULT (*get_state)(Client *, INT *);
     HRESULT (*get_name)(Client *, BSTR *);
     HRESULT (*get_kbd_shortcut)(Client *, BSTR *);
+    HRESULT (*get_value)(Client *, BSTR *);
 };
 
 static HRESULT acc_client_get_name_str(WCHAR *name, UINT len, BSTR *pszName)
@@ -237,6 +238,10 @@ static HRESULT WINAPI Client_get_accValue(IAccessible *iface, VARIANT varID, BST
     *pszValue = NULL;
     if(convert_child_id(&varID) != CHILDID_SELF)
         return E_INVALIDARG;
+
+    if (This->vtbl && This->vtbl->get_value)
+        return This->vtbl->get_value(This, pszValue);
+
     return S_FALSE;
 }
 
@@ -799,10 +804,32 @@ static HRESULT edit_get_kbd_shortcut(Client *client, BSTR *out_kbd_shortcut)
     return acc_client_get_kbd_shortcut_str(name, len, out_kbd_shortcut);
 }
 
+static HRESULT edit_get_value(Client *client, BSTR *out_value)
+{
+    WCHAR *buf;
+    UINT len;
+
+    TRACE("(%p, %p)\n", client, out_value);
+
+    if (GetWindowLongW(client->hwnd, GWL_STYLE) & ES_PASSWORD)
+        return E_ACCESSDENIED;
+
+    len = SendMessageW(client->hwnd, WM_GETTEXTLENGTH, 0, 0);
+    buf = heap_alloc_zero((len + 1) * sizeof(*buf));
+    if (!buf) return E_OUTOFMEMORY;
+
+    SendMessageW(client->hwnd, WM_GETTEXT, len + 1, (LPARAM)buf);
+    *out_value = SysAllocString(buf);
+    heap_free(buf);
+
+    return S_OK;
+}
+
 const win_class_vtbl edit_class_vtbl = {
     edit_get_state,
     edit_get_name,
     edit_get_kbd_shortcut,
+    edit_get_value,
 };
 
 HRESULT create_edit_client_object(HWND hwnd, const IID *iid, void **obj)
-- 
2.25.1




More information about the wine-devel mailing list