Module: wine Branch: master Commit: 6b78e24a098a10ce91b53eeb26eca36a85e66aa6 URL: http://source.winehq.org/git/wine.git/?a=commit;h=6b78e24a098a10ce91b53eeb26...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Dec 17 17:24:16 2009 +0100
user32: Move EnumProps16 to wnd16.c.
---
dlls/user32/property.c | 45 +---------------------------------- dlls/user32/wnd16.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 44 deletions(-)
diff --git a/dlls/user32/property.c b/dlls/user32/property.c index d5b1bfd..52f389e 100644 --- a/dlls/user32/property.c +++ b/dlls/user32/property.c @@ -26,9 +26,8 @@
#include "windef.h" #include "winbase.h" -#include "wownt32.h" +#include "winuser.h" #include "wine/unicode.h" -#include "wine/winuser16.h" #include "wine/server.h"
/* size of buffer needed to store an atom string */ @@ -252,45 +251,3 @@ INT WINAPI EnumPropsExW(HWND hwnd, PROPENUMPROCEXW func, LPARAM lParam) } return ret; } - - -/*********************************************************************** - * EnumProps (USER.27) - */ -INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) -{ - int ret = -1, i, count; - property_data_t *list = get_properties( HWND_32(hwnd), &count ); - - if (list) - { - char string[ATOM_BUFFER_SIZE]; - SEGPTR segptr = MapLS( string ); - WORD args[4]; - DWORD result; - - for (i = 0; i < count; i++) - { - if (list[i].string) /* it was a string originally */ - { - if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue; - args[3] = hwnd; - args[2] = SELECTOROF(segptr); - args[1] = OFFSETOF(segptr); - args[0] = LOWORD(list[i].data); - } - else - { - args[3] = hwnd; - args[2] = 0; - args[1] = list[i].atom; - args[0] = LOWORD(list[i].data); - } - WOWCallback16Ex( (DWORD)func, WCB16_PASCAL, sizeof(args), args, &result ); - if (!(ret = LOWORD(result))) break; - } - UnMapLS( segptr ); - HeapFree( GetProcessHeap(), 0, list ); - } - return ret; -} diff --git a/dlls/user32/wnd16.c b/dlls/user32/wnd16.c index 4c2f2f2..4873be7 100644 --- a/dlls/user32/wnd16.c +++ b/dlls/user32/wnd16.c @@ -22,6 +22,10 @@ #include "wownt32.h" #include "win.h" #include "user_private.h" +#include "wine/server.h" + +/* size of buffer needed to store an atom string */ +#define ATOM_BUFFER_SIZE 256
/* handle <--> handle16 conversions */ #define HANDLE_16(h32) (LOWORD(h32)) @@ -158,6 +162,64 @@ BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle ) }
+/*********************************************************************** + * EnumProps (USER.27) + */ +INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) +{ + int ret = -1, i, count, total = 32; + property_data_t *list; + + while (total) + { + if (!(list = HeapAlloc( GetProcessHeap(), 0, total * sizeof(*list) ))) break; + count = 0; + SERVER_START_REQ( get_window_properties ) + { + req->window = wine_server_user_handle( HWND_32(hwnd) ); + wine_server_set_reply( req, list, total * sizeof(*list) ); + if (!wine_server_call( req )) count = reply->total; + } + SERVER_END_REQ; + + if (count && count <= total) + { + char string[ATOM_BUFFER_SIZE]; + SEGPTR segptr = MapLS( string ); + WORD args[4]; + DWORD result; + + for (i = 0; i < count; i++) + { + if (list[i].string) /* it was a string originally */ + { + if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue; + args[3] = hwnd; + args[2] = SELECTOROF(segptr); + args[1] = OFFSETOF(segptr); + args[0] = LOWORD(list[i].data); + } + else + { + args[3] = hwnd; + args[2] = 0; + args[1] = list[i].atom; + args[0] = LOWORD(list[i].data); + } + WOWCallback16Ex( (DWORD)func, WCB16_PASCAL, sizeof(args), args, &result ); + if (!(ret = LOWORD(result))) break; + } + UnMapLS( segptr ); + HeapFree( GetProcessHeap(), 0, list ); + break; + } + HeapFree( GetProcessHeap(), 0, list ); + total = count; /* restart with larger buffer */ + } + return ret; +} + + /************************************************************************** * ClientToScreen (USER.28) */