Commit 6b78e24a authored by Alexandre Julliard's avatar Alexandre Julliard

user32: Move EnumProps16 to wnd16.c.

parent 15000f32
......@@ -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;
}
......@@ -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)
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment