2 * Window related functions
4 * Copyright 1993, 1994 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #define WIN32_NO_STATUS
28 #include "win32u_private.h"
29 #include "wine/server.h"
32 /***********************************************************************
33 * NtUserGetProp (win32u.@)
35 * NOTE Native allows only ATOMs as the second argument. We allow strings
36 * to save extra server call in GetPropW.
38 HANDLE WINAPI
NtUserGetProp( HWND hwnd
, const WCHAR
*str
)
42 SERVER_START_REQ( get_window_property
)
44 req
->window
= wine_server_user_handle( hwnd
);
45 if (IS_INTRESOURCE(str
)) req
->atom
= LOWORD(str
);
46 else wine_server_add_data( req
, str
, lstrlenW(str
) * sizeof(WCHAR
) );
47 if (!wine_server_call_err( req
)) ret
= reply
->data
;
53 /*****************************************************************************
54 * NtUserSetProp (win32u.@)
56 * NOTE Native allows only ATOMs as the second argument. We allow strings
57 * to save extra server call in SetPropW.
59 BOOL WINAPI
NtUserSetProp( HWND hwnd
, const WCHAR
*str
, HANDLE handle
)
63 SERVER_START_REQ( set_window_property
)
65 req
->window
= wine_server_user_handle( hwnd
);
66 req
->data
= (ULONG_PTR
)handle
;
67 if (IS_INTRESOURCE(str
)) req
->atom
= LOWORD(str
);
68 else wine_server_add_data( req
, str
, lstrlenW(str
) * sizeof(WCHAR
) );
69 ret
= !wine_server_call_err( req
);
76 /***********************************************************************
77 * NtUserRemoveProp (win32u.@)
79 * NOTE Native allows only ATOMs as the second argument. We allow strings
80 * to save extra server call in RemovePropW.
82 HANDLE WINAPI
NtUserRemoveProp( HWND hwnd
, const WCHAR
*str
)
86 SERVER_START_REQ( remove_window_property
)
88 req
->window
= wine_server_user_handle( hwnd
);
89 if (IS_INTRESOURCE(str
)) req
->atom
= LOWORD(str
);
90 else wine_server_add_data( req
, str
, lstrlenW(str
) * sizeof(WCHAR
) );
91 if (!wine_server_call_err( req
)) ret
= reply
->data
;
99 /*****************************************************************************
100 * NtUserGetLayeredWindowAttributes (win32u.@)
102 BOOL WINAPI
NtUserGetLayeredWindowAttributes( HWND hwnd
, COLORREF
*key
, BYTE
*alpha
, DWORD
*flags
)
106 SERVER_START_REQ( get_window_layered_info
)
108 req
->handle
= wine_server_user_handle( hwnd
);
109 if ((ret
= !wine_server_call_err( req
)))
111 if (key
) *key
= reply
->color_key
;
112 if (alpha
) *alpha
= reply
->alpha
;
113 if (flags
) *flags
= reply
->flags
;
121 /*****************************************************************************
122 * NtUserBuildHwndList (win32u.@)
124 NTSTATUS WINAPI
NtUserBuildHwndList( HDESK desktop
, ULONG unk2
, ULONG unk3
, ULONG unk4
,
125 ULONG thread_id
, ULONG count
, HWND
*buffer
, ULONG
*size
)
127 user_handle_t
*list
= (user_handle_t
*)buffer
;
131 SERVER_START_REQ( get_window_children
)
133 req
->desktop
= wine_server_obj_handle( desktop
);
134 req
->tid
= thread_id
;
135 if (count
) wine_server_set_reply( req
, list
, (count
- 1) * sizeof(user_handle_t
) );
136 status
= wine_server_call( req
);
137 if (status
&& status
!= STATUS_BUFFER_TOO_SMALL
) return status
;
138 *size
= reply
->count
+ 1;
141 if (*size
> count
) return STATUS_BUFFER_TOO_SMALL
;
143 /* start from the end since HWND is potentially larger than user_handle_t */
144 for (i
= *size
- 2; i
>= 0; i
--)
145 buffer
[i
] = wine_server_ptr_handle( list
[i
] );
146 buffer
[*size
- 1] = HWND_BOTTOM
;
147 return STATUS_SUCCESS
;