Nikolay Sivov : user32: Implement GetListBoxInfo().

Alexandre Julliard julliard at winehq.org
Tue May 7 15:54:05 CDT 2013


Module: wine
Branch: master
Commit: 8f7779fc3b1ba7bf454a065181a783d32601278a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8f7779fc3b1ba7bf454a065181a783d32601278a

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue May  7 21:18:43 2013 +0400

user32: Implement GetListBoxInfo().

---

 dlls/user32/listbox.c       |   11 ++++++---
 dlls/user32/tests/listbox.c |   44 +++++++++++++++++++++++++++++++++++++++++++
 dlls/user32/user32.spec     |    2 +-
 3 files changed, 52 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c
index 64691e4..5a78dda 100644
--- a/dlls/user32/listbox.c
+++ b/dlls/user32/listbox.c
@@ -27,8 +27,6 @@
  * If you discover missing features, or bugs, please note them below.
  *
  * TODO:
- *    - GetListBoxInfo()
- *    - LB_GETLISTBOXINFO
  *    - LBS_NODATA
  */
 
@@ -2955,8 +2953,7 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
         return LB_OKAY;
 
     case LB_GETLISTBOXINFO:
-        FIXME("LB_GETLISTBOXINFO: stub!\n");
-        return 0;
+        return descr->page_size;
 
     case WM_DESTROY:
         return LISTBOX_Destroy( descr );
@@ -3149,3 +3146,9 @@ LRESULT ListBoxWndProc_common( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
     return unicode ? DefWindowProcW( hwnd, msg, wParam, lParam ) :
                      DefWindowProcA( hwnd, msg, wParam, lParam );
 }
+
+DWORD WINAPI GetListBoxInfo(HWND hwnd)
+{
+    TRACE("%p\n", hwnd);
+    return SendMessageW(hwnd, LB_GETLISTBOXINFO, 0, 0);
+}
diff --git a/dlls/user32/tests/listbox.c b/dlls/user32/tests/listbox.c
index 5d96f5c..0a000cc 100644
--- a/dlls/user32/tests/listbox.c
+++ b/dlls/user32/tests/listbox.c
@@ -1545,6 +1545,49 @@ static void test_set_count( void )
     DestroyWindow( parent );
 }
 
+static DWORD (WINAPI *pGetListBoxInfo)(HWND);
+static int lb_getlistboxinfo;
+
+static LRESULT WINAPI listbox_subclass_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    WNDPROC oldproc = (WNDPROC)GetWindowLongPtrA(hwnd, GWLP_USERDATA);
+
+    if (message == LB_GETLISTBOXINFO)
+        lb_getlistboxinfo++;
+
+    return CallWindowProcA(oldproc, hwnd, message, wParam, lParam);
+}
+
+static void test_GetListBoxInfo(void)
+{
+    HWND listbox, parent;
+    WNDPROC oldproc;
+    DWORD ret;
+
+    pGetListBoxInfo = (void*)GetProcAddress(GetModuleHandle("user32"), "GetListBoxInfo");
+
+    if (!pGetListBoxInfo)
+    {
+        win_skip("GetListBoxInfo() not available\n");
+        return;
+    }
+
+    parent = create_parent();
+    listbox = create_listbox(WS_CHILD | WS_VISIBLE, parent);
+
+    oldproc = (WNDPROC)SetWindowLongPtrA(listbox, GWLP_WNDPROC, (LONG_PTR)listbox_subclass_proc);
+    SetWindowLongPtrA(listbox, GWLP_USERDATA, (LONG_PTR)oldproc);
+
+    lb_getlistboxinfo = 0;
+    ret = pGetListBoxInfo(listbox);
+    ok(ret > 0, "got %d\n", ret);
+todo_wine
+    ok(lb_getlistboxinfo == 0, "got %d\n", lb_getlistboxinfo);
+
+    DestroyWindow(listbox);
+    DestroyWindow(parent);
+}
+
 START_TEST(listbox)
 {
   const struct listbox_test SS =
@@ -1624,4 +1667,5 @@ START_TEST(listbox)
   test_listbox_LB_DIR();
   test_listbox_dlgdir();
   test_set_count();
+  test_GetListBoxInfo();
 }
diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec
index 1ad59d9..4b1f4b5 100644
--- a/dlls/user32/user32.spec
+++ b/dlls/user32/user32.spec
@@ -308,7 +308,7 @@
 @ stdcall GetLastActivePopup(long)
 @ stdcall GetLastInputInfo(ptr)
 @ stdcall GetLayeredWindowAttributes(long ptr ptr ptr)
-# @ stub GetListBoxInfo
+@ stdcall GetListBoxInfo(long)
 @ stdcall GetMenu(long)
 @ stdcall GetMenuBarInfo(long long long ptr)
 @ stdcall GetMenuCheckMarkDimensions()




More information about the wine-cvs mailing list