oleacc: implemented GetRoleText[A/W]

Nikolay Sivov bunglehead at gmail.com
Fri Sep 12 17:01:24 CDT 2008


Requested in 15229

Changelog:
    - GetRoleText implemented. Resource stored in oleacc.

>From 0e951588672d8ef245873792138e3a4d7ee2fff7 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sat, 13 Sep 2008 00:17:15 +0400
Subject:  Implemented GetRoleText[A/W]

---
 dlls/oleacc/Makefile.in  |    4 ++-
 dlls/oleacc/main.c       |   62 ++++++++++++++++++++++++++++++++
 dlls/oleacc/oleacc.rc    |   89 ++++++++++++++++++++++++++++++++++++++++++++++
 dlls/oleacc/oleacc.spec  |    4 +-
 dlls/oleacc/oleacc_En.rc |   89 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 245 insertions(+), 3 deletions(-)

diff --git a/dlls/oleacc/Makefile.in b/dlls/oleacc/Makefile.in
index 5822916..882edcb 100644
--- a/dlls/oleacc/Makefile.in
+++ b/dlls/oleacc/Makefile.in
@@ -4,11 +4,13 @@ SRCDIR    = @srcdir@
 VPATH     = @srcdir@
 MODULE    = oleacc.dll
 IMPORTLIB = oleacc
-IMPORTS   = kernel32
+IMPORTS   = kernel32 user32
 
 C_SRCS = \
 	main.c
 
+RC_SRCS = oleacc.rc
+
 @MAKE_DLL_RULES@
 
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/dlls/oleacc/main.c b/dlls/oleacc/main.c
index 9a6f765..6ec9b4c 100644
--- a/dlls/oleacc/main.c
+++ b/dlls/oleacc/main.c
@@ -28,6 +28,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(oleacc);
 
+static HINSTANCE oleacc_handle = 0;
+
 HRESULT WINAPI CreateStdAccessibleObject( HWND hwnd, LONG idObject,
                              REFIID riidInterface, void** ppvObject )
 {
@@ -50,6 +52,20 @@ HRESULT WINAPI AccessibleObjectFromWindow( HWND hwnd, DWORD dwObjectID,
     return E_NOTIMPL;
 }
 
+BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
+                    LPVOID lpvReserved)
+{
+    TRACE("%p, %d, %p\n", hinstDLL, fdwReason, lpvReserved);
+
+    switch (fdwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            oleacc_handle = hinstDLL;
+            break;
+    }
+    return TRUE;
+}
+
 HRESULT WINAPI DllRegisterServer(void)
 {
     FIXME("\n");
@@ -67,3 +83,49 @@ void WINAPI GetOleaccVersionInfo(DWORD* pVersion, DWORD* pBuild)
     *pVersion = MAKELONG(2,4); /* Windows XP version of oleacc: 4.2.5406.0 */
     *pBuild = MAKELONG(0,5406);
 }
+
+UINT WINAPI GetRoleTextW(DWORD role, LPWSTR lpRole, UINT rolemax)
+{
+    HGLOBAL hmem;
+    HRSRC hrsrc;
+    unsigned int id;
+    const WCHAR *p;
+    INT ret;
+
+    TRACE("%u %p %u\n", role, lpRole, rolemax);
+
+    hrsrc = FindResourceW(oleacc_handle, MAKEINTRESOURCEW((LOWORD(role) >> 4) + 1),
+                          (LPWSTR)RT_STRING);
+    if (!hrsrc) return 0;
+    hmem = LoadResource(oleacc_handle, hrsrc);
+    if (!hmem) return 0;
+
+    p = LockResource(hmem);
+    id = role & 0x000f;
+    while (id--) p += *p + 1;
+
+    /* return role text length */
+    if(!lpRole)
+        return *p;
+
+    ret = LoadStringW(oleacc_handle, role, lpRole, rolemax);
+    if(!(ret > 0))
+        return 0;
+
+    return ret;
+}
+
+UINT WINAPI GetRoleTextA(DWORD role, LPSTR lpRole, UINT rolemax)
+{
+    INT ret;
+
+    TRACE("%u %p %u\n", role, lpRole, rolemax);
+
+    /* get length (without trailing NULL) */
+    ret = GetRoleTextW(role, NULL, rolemax);
+
+    if(!lpRole)
+        return ret;
+
+    return LoadStringA(oleacc_handle, role, lpRole, min(rolemax, ret + 1));
+}
diff --git a/dlls/oleacc/oleacc.rc b/dlls/oleacc/oleacc.rc
new file mode 100644
index 0000000..c955ed7
--- /dev/null
+++ b/dlls/oleacc/oleacc.rc
@@ -0,0 +1,89 @@
+/*
+ * Top level resource file for oleacc
+ *
+ * Copyright 2008 Nikolay Sivov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "windef.h"
+
+/* string ids equal to corresponding ROLE_* values */
+#define IDS_ROLE_SYSTEM_TITLEBAR    1
+#define IDS_ROLE_SYSTEM_MENUBAR     2
+#define IDS_ROLE_SYSTEM_SCROLLBAR   3
+#define IDS_ROLE_SYSTEM_GRIP        4
+#define IDS_ROLE_SYSTEM_SOUND       5
+#define IDS_ROLE_SYSTEM_CURSOR      6
+#define IDS_ROLE_SYSTEM_CARET       7
+#define IDS_ROLE_SYSTEM_ALERT       8
+#define IDS_ROLE_SYSTEM_WINDOW      9
+#define IDS_ROLE_SYSTEM_CLIENT      10
+#define IDS_ROLE_SYSTEM_MENUPOPUP   11
+#define IDS_ROLE_SYSTEM_MENUITEM    12
+#define IDS_ROLE_SYSTEM_TOOLTIP     13
+#define IDS_ROLE_SYSTEM_APPLICATION 14
+#define IDS_ROLE_SYSTEM_DOCUMENT    15
+#define IDS_ROLE_SYSTEM_PANE        16
+#define IDS_ROLE_SYSTEM_CHART       17
+#define IDS_ROLE_SYSTEM_DIALOG      18
+#define IDS_ROLE_SYSTEM_BORDER      19
+#define IDS_ROLE_SYSTEM_GROUPING    20
+#define IDS_ROLE_SYSTEM_SEPARATOR   21
+#define IDS_ROLE_SYSTEM_TOOLBAR     22
+#define IDS_ROLE_SYSTEM_STATUSBAR   23
+#define IDS_ROLE_SYSTEM_TABLE       24
+#define IDS_ROLE_SYSTEM_COLUMNHEADER 25
+#define IDS_ROLE_SYSTEM_ROWHEADER    26
+#define IDS_ROLE_SYSTEM_COLUMN       27
+#define IDS_ROLE_SYSTEM_ROW          28
+#define IDS_ROLE_SYSTEM_CELL         29
+#define IDS_ROLE_SYSTEM_LINK         30
+#define IDS_ROLE_SYSTEM_HELPBALLOON  31
+#define IDS_ROLE_SYSTEM_CHARACTER    32
+#define IDS_ROLE_SYSTEM_LIST         33
+#define IDS_ROLE_SYSTEM_LISTITEM     34
+#define IDS_ROLE_SYSTEM_OUTLINE      35
+#define IDS_ROLE_SYSTEM_OUTLINEITEM  36
+#define IDS_ROLE_SYSTEM_PAGETAB      37
+#define IDS_ROLE_SYSTEM_PROPERTYPAGE 38
+#define IDS_ROLE_SYSTEM_INDICATOR    39
+#define IDS_ROLE_SYSTEM_GRAPHIC      40
+#define IDS_ROLE_SYSTEM_STATICTEXT   41
+#define IDS_ROLE_SYSTEM_TEXT         42
+#define IDS_ROLE_SYSTEM_PUSHBUTTON   43
+#define IDS_ROLE_SYSTEM_CHECKBUTTON  44
+#define IDS_ROLE_SYSTEM_RADIOBUTTON  45
+#define IDS_ROLE_SYSTEM_COMBOBOX     46
+#define IDS_ROLE_SYSTEM_DROPLIST     47
+#define IDS_ROLE_SYSTEM_PROGRESSBAR  48
+#define IDS_ROLE_SYSTEM_DIAL         49
+#define IDS_ROLE_SYSTEM_HOTKEYFIELD  50
+#define IDS_ROLE_SYSTEM_SLIDER       51
+#define IDS_ROLE_SYSTEM_SPINBUTTON   52
+#define IDS_ROLE_SYSTEM_DIAGRAM      53
+#define IDS_ROLE_SYSTEM_ANIMATION    54
+#define IDS_ROLE_SYSTEM_EQUATION     55
+#define IDS_ROLE_SYSTEM_BUTTONDROPDOWN 56
+#define IDS_ROLE_SYSTEM_BUTTONMENU   57
+#define IDS_ROLE_SYSTEM_BUTTONDROPDOWNGRID 58
+#define IDS_ROLE_SYSTEM_WHITESPACE   59
+#define IDS_ROLE_SYSTEM_PAGETABLIST  60
+#define IDS_ROLE_SYSTEM_CLOCK        61
+#define IDS_ROLE_SYSTEM_SPLITBUTTON  62
+#define IDS_ROLE_SYSTEM_IPADDRESS    63
+#define IDS_ROLE_SYSTEM_OUTLINEBUTTON 64
+
+#include "oleacc_En.rc"
diff --git a/dlls/oleacc/oleacc.spec b/dlls/oleacc/oleacc.spec
index 23b84b3..75b743a 100644
--- a/dlls/oleacc/oleacc.spec
+++ b/dlls/oleacc/oleacc.spec
@@ -8,8 +8,8 @@
 @ stdcall -private DllRegisterServer()
 @ stdcall -private DllUnregisterServer()
 @ stdcall GetOleaccVersionInfo(ptr ptr)
-@ stub GetRoleTextA
-@ stub GetRoleTextW
+@ stdcall GetRoleTextA(long ptr long)
+@ stdcall GetRoleTextW(long wstr long)
 @ stub GetStateTextA
 @ stub GetStateTextW
 @ stub IID_IAccessible
diff --git a/dlls/oleacc/oleacc_En.rc b/dlls/oleacc/oleacc_En.rc
new file mode 100644
index 0000000..b5ec8a5
--- /dev/null
+++ b/dlls/oleacc/oleacc_En.rc
@@ -0,0 +1,89 @@
+/*
+ * English resources for oleacc
+ *
+ * Copyright 2008 Nikolay Sivov
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+
+STRINGTABLE DISCARDABLE
+{
+    IDS_ROLE_SYSTEM_TITLEBAR    "title bar"
+    IDS_ROLE_SYSTEM_MENUBAR     "menu bar"
+    IDS_ROLE_SYSTEM_SCROLLBAR   "scroll bar"
+    IDS_ROLE_SYSTEM_GRIP        "grip"
+    IDS_ROLE_SYSTEM_SOUND       "sound"
+    IDS_ROLE_SYSTEM_CURSOR      "cursor"
+    IDS_ROLE_SYSTEM_CARET       "caret"
+    IDS_ROLE_SYSTEM_ALERT       "alert"
+    IDS_ROLE_SYSTEM_WINDOW      "window"
+    IDS_ROLE_SYSTEM_CLIENT      "client"
+    IDS_ROLE_SYSTEM_MENUPOPUP   "popup menu"
+    IDS_ROLE_SYSTEM_MENUITEM    "menu item"
+    IDS_ROLE_SYSTEM_TOOLTIP     "tool tip"
+    IDS_ROLE_SYSTEM_APPLICATION "application"
+    IDS_ROLE_SYSTEM_DOCUMENT    "document"
+    IDS_ROLE_SYSTEM_PANE        "pane"
+    IDS_ROLE_SYSTEM_CHART       "chart"
+    IDS_ROLE_SYSTEM_DIALOG      "dialog"
+    IDS_ROLE_SYSTEM_BORDER      "border"
+    IDS_ROLE_SYSTEM_GROUPING    "grouping"
+    IDS_ROLE_SYSTEM_SEPARATOR   "separator"
+    IDS_ROLE_SYSTEM_TOOLBAR     "tool bar"
+    IDS_ROLE_SYSTEM_STATUSBAR   "status bar"
+    IDS_ROLE_SYSTEM_TABLE        "table"
+    IDS_ROLE_SYSTEM_COLUMNHEADER "column header"
+    IDS_ROLE_SYSTEM_ROWHEADER    "row header"
+    IDS_ROLE_SYSTEM_COLUMN       "column"
+    IDS_ROLE_SYSTEM_ROW          "row"
+    IDS_ROLE_SYSTEM_CELL         "cell"
+    IDS_ROLE_SYSTEM_LINK         "link"
+    IDS_ROLE_SYSTEM_HELPBALLOON  "help balloon"
+    IDS_ROLE_SYSTEM_CHARACTER    "character"
+    IDS_ROLE_SYSTEM_LIST         "list"
+    IDS_ROLE_SYSTEM_LISTITEM     "list item"
+    IDS_ROLE_SYSTEM_OUTLINE      "outline"
+    IDS_ROLE_SYSTEM_OUTLINEITEM  "outline item"
+    IDS_ROLE_SYSTEM_PAGETAB      "page tab"
+    IDS_ROLE_SYSTEM_PROPERTYPAGE "property page"
+    IDS_ROLE_SYSTEM_INDICATOR    "indicator"
+    IDS_ROLE_SYSTEM_GRAPHIC      "graphic"
+    IDS_ROLE_SYSTEM_STATICTEXT   "static text"
+    IDS_ROLE_SYSTEM_TEXT         "text"
+    IDS_ROLE_SYSTEM_PUSHBUTTON   "push button"
+    IDS_ROLE_SYSTEM_CHECKBUTTON  "check button"
+    IDS_ROLE_SYSTEM_RADIOBUTTON  "radio button"
+    IDS_ROLE_SYSTEM_COMBOBOX     "combo box"
+    IDS_ROLE_SYSTEM_DROPLIST     "drop down"
+    IDS_ROLE_SYSTEM_PROGRESSBAR  "progress bar"
+    IDS_ROLE_SYSTEM_DIAL         "dial"
+    IDS_ROLE_SYSTEM_HOTKEYFIELD  "hot key field"
+    IDS_ROLE_SYSTEM_SLIDER       "slider"
+    IDS_ROLE_SYSTEM_SPINBUTTON   "spin box"
+    IDS_ROLE_SYSTEM_DIAGRAM      "diagram"
+    IDS_ROLE_SYSTEM_ANIMATION    "animation"
+    IDS_ROLE_SYSTEM_EQUATION     "equation"
+    IDS_ROLE_SYSTEM_BUTTONDROPDOWN "drop down button"
+    IDS_ROLE_SYSTEM_BUTTONMENU   "menu button"
+    IDS_ROLE_SYSTEM_BUTTONDROPDOWNGRID "grid drop down button"
+    IDS_ROLE_SYSTEM_WHITESPACE   "white space"
+    IDS_ROLE_SYSTEM_PAGETABLIST  "page tab list"
+    IDS_ROLE_SYSTEM_CLOCK        "clock"
+    IDS_ROLE_SYSTEM_SPLITBUTTON  "split button"
+    IDS_ROLE_SYSTEM_IPADDRESS    "IP address"
+    IDS_ROLE_SYSTEM_OUTLINEBUTTON "outline button"
+}
-- 
1.4.4.4






More information about the wine-patches mailing list