4 * Copyright 2021 Jacek Caban for CodeWeavers
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
21 #ifndef __WINE_WIN32U_PRIVATE
22 #define __WINE_WIN32U_PRIVATE
30 #include "wine/gdi_driver.h"
31 #include "wine/unixlib.h"
32 #include "wine/debug.h"
33 #include "wine/server.h"
37 /* Wine-specific functions */
38 BOOL (CDECL
*get_file_outline_text_metric
)( const WCHAR
*path
, OUTLINETEXTMETRICW
*otm
);
39 BOOL (CDECL
*get_icm_profile
)( HDC hdc
, BOOL allow_default
, DWORD
*size
, WCHAR
*filename
);
40 BOOL (CDECL
*wine_send_input
)( HWND hwnd
, const INPUT
*input
, const RAWINPUT
*rawinput
);
44 extern UINT
enum_clipboard_formats( UINT format
) DECLSPEC_HIDDEN
;
45 extern void release_clipboard_owner( HWND hwnd
) DECLSPEC_HIDDEN
;
48 extern HICON
alloc_cursoricon_handle( BOOL is_icon
) DECLSPEC_HIDDEN
;
49 extern BOOL
get_clip_cursor( RECT
*rect
) DECLSPEC_HIDDEN
;
50 extern ULONG_PTR
get_icon_param( HICON handle
) DECLSPEC_HIDDEN
;
51 extern ULONG_PTR
set_icon_param( HICON handle
, ULONG_PTR param
) DECLSPEC_HIDDEN
;
54 extern struct window_surface dummy_surface DECLSPEC_HIDDEN
;
55 extern BOOL
create_dib_surface( HDC hdc
, const BITMAPINFO
*info
) DECLSPEC_HIDDEN
;
56 extern void create_offscreen_window_surface( const RECT
*visible_rect
,
57 struct window_surface
**surface
) DECLSPEC_HIDDEN
;
58 extern void erase_now( HWND hwnd
, UINT rdw_flags
) DECLSPEC_HIDDEN
;
59 extern void flush_window_surfaces( BOOL idle
) DECLSPEC_HIDDEN
;
60 extern void move_window_bits( HWND hwnd
, struct window_surface
*old_surface
,
61 struct window_surface
*new_surface
,
62 const RECT
*visible_rect
, const RECT
*old_visible_rect
,
63 const RECT
*window_rect
, const RECT
*valid_rects
) DECLSPEC_HIDDEN
;
64 extern void move_window_bits_parent( HWND hwnd
, HWND parent
, const RECT
*window_rect
,
65 const RECT
*valid_rects
) DECLSPEC_HIDDEN
;
66 extern void register_window_surface( struct window_surface
*old
,
67 struct window_surface
*new ) DECLSPEC_HIDDEN
;
70 extern LRESULT
default_window_proc( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
,
71 BOOL ansi
) DECLSPEC_HIDDEN
;
72 extern LRESULT
desktop_window_proc( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
73 extern BOOL
draw_menu_button( HWND hwnd
, HDC dc
, RECT
*r
, enum NONCLIENT_BUTTON_TYPE
, BOOL down
, BOOL grayed
) DECLSPEC_HIDDEN
;
74 extern BOOL
draw_frame_menu( HDC dc
, RECT
*r
, UINT flags
) DECLSPEC_HIDDEN
;
75 extern BOOL
draw_nc_sys_button( HWND hwnd
, HDC hdc
, BOOL down
) DECLSPEC_HIDDEN
;
76 extern BOOL
draw_rect_edge( HDC hdc
, RECT
*rc
, UINT uType
, UINT uFlags
, UINT width
) DECLSPEC_HIDDEN
;
77 extern void fill_rect( HDC dc
, const RECT
*rect
, HBRUSH hbrush
) DECLSPEC_HIDDEN
;
78 extern void get_sys_popup_pos( HWND hwnd
, RECT
*rect
) DECLSPEC_HIDDEN
;
79 extern LRESULT
handle_nc_hit_test( HWND hwnd
, POINT pt
) DECLSPEC_HIDDEN
;
82 extern LRESULT
call_current_hook( HHOOK hhook
, INT code
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
83 extern LRESULT
call_hooks( INT id
, INT code
, WPARAM wparam
, LPARAM lparam
,
84 size_t lparam_size
) DECLSPEC_HIDDEN
;
85 extern BOOL
is_hooked( INT id
) DECLSPEC_HIDDEN
;
86 extern BOOL
unhook_windows_hook( INT id
, HOOKPROC proc
) DECLSPEC_HIDDEN
;
89 extern void cleanup_imm_thread(void) DECLSPEC_HIDDEN
;
90 extern HWND
get_default_ime_window( HWND hwnd
) DECLSPEC_HIDDEN
;
91 extern HIMC
get_default_input_context(void) DECLSPEC_HIDDEN
;
92 extern HIMC
get_window_input_context( HWND hwnd
) DECLSPEC_HIDDEN
;
93 extern BOOL
register_imm_window( HWND hwnd
) DECLSPEC_HIDDEN
;
94 extern void unregister_imm_window( HWND hwnd
) DECLSPEC_HIDDEN
;
97 extern BOOL
destroy_caret(void) DECLSPEC_HIDDEN
;
98 extern LONG global_key_state_counter DECLSPEC_HIDDEN
;
99 extern HWND
get_active_window(void) DECLSPEC_HIDDEN
;
100 extern HWND
get_capture(void) DECLSPEC_HIDDEN
;
101 extern BOOL
get_cursor_pos( POINT
*pt
) DECLSPEC_HIDDEN
;
102 extern HWND
get_focus(void) DECLSPEC_HIDDEN
;
103 extern DWORD
get_input_state(void) DECLSPEC_HIDDEN
;
104 extern HWND
get_progman_window(void) DECLSPEC_HIDDEN
;
105 extern HWND
get_shell_window(void) DECLSPEC_HIDDEN
;
106 extern HWND
get_taskman_window(void) DECLSPEC_HIDDEN
;
107 extern BOOL WINAPI
release_capture(void) DECLSPEC_HIDDEN
;
108 extern BOOL
set_capture_window( HWND hwnd
, UINT gui_flags
, HWND
*prev_ret
) DECLSPEC_HIDDEN
;
109 extern BOOL
set_caret_blink_time( unsigned int time
) DECLSPEC_HIDDEN
;
110 extern BOOL
set_caret_pos( int x
, int y
) DECLSPEC_HIDDEN
;
111 extern BOOL
set_foreground_window( HWND hwnd
, BOOL mouse
) DECLSPEC_HIDDEN
;
112 extern HWND
set_progman_window( HWND hwnd
) DECLSPEC_HIDDEN
;
113 extern HWND
set_taskman_window( HWND hwnd
) DECLSPEC_HIDDEN
;
114 extern void toggle_caret( HWND hwnd
) DECLSPEC_HIDDEN
;
115 extern void update_mouse_tracking_info( HWND hwnd
) DECLSPEC_HIDDEN
;
118 extern HMENU
create_menu( BOOL is_popup
) DECLSPEC_HIDDEN
;
119 extern BOOL
draw_menu_bar( HWND hwnd
) DECLSPEC_HIDDEN
;
120 extern UINT
draw_nc_menu_bar( HDC hdc
, RECT
*rect
, HWND hwnd
) DECLSPEC_HIDDEN
;
121 extern void end_menu( HWND hwnd
) DECLSPEC_HIDDEN
;
122 extern HMENU
get_menu( HWND hwnd
) DECLSPEC_HIDDEN
;
123 extern UINT
get_menu_bar_height( HWND hwnd
, UINT width
, INT org_x
, INT org_y
) DECLSPEC_HIDDEN
;
124 extern BOOL
get_menu_info( HMENU handle
, MENUINFO
*info
) DECLSPEC_HIDDEN
;
125 extern INT
get_menu_item_count( HMENU handle
) DECLSPEC_HIDDEN
;
126 extern UINT
get_menu_state( HMENU handle
, UINT item_id
, UINT flags
) DECLSPEC_HIDDEN
;
127 extern HMENU
get_window_sys_sub_menu( HWND hwnd
) DECLSPEC_HIDDEN
;
128 extern BOOL
is_menu( HMENU handle
) DECLSPEC_HIDDEN
;
129 extern HWND
is_menu_active(void) DECLSPEC_HIDDEN
;
130 extern LRESULT
popup_menu_window_proc( HWND hwnd
, UINT message
, WPARAM wparam
,
131 LPARAM lparam
) DECLSPEC_HIDDEN
;
132 extern BOOL
set_window_menu( HWND hwnd
, HMENU handle
) DECLSPEC_HIDDEN
;
133 extern void track_keyboard_menu_bar( HWND hwnd
, UINT wparam
, WCHAR ch
) DECLSPEC_HIDDEN
;
134 extern void track_mouse_menu_bar( HWND hwnd
, INT ht
, int x
, int y
) DECLSPEC_HIDDEN
;
137 extern BOOL
kill_system_timer( HWND hwnd
, UINT_PTR id
) DECLSPEC_HIDDEN
;
138 extern BOOL
reply_message_result( LRESULT result
) DECLSPEC_HIDDEN
;
139 extern NTSTATUS
send_hardware_message( HWND hwnd
, const INPUT
*input
, const RAWINPUT
*rawinput
,
140 UINT flags
) DECLSPEC_HIDDEN
;
141 extern LRESULT
send_internal_message_timeout( DWORD dest_pid
, DWORD dest_tid
, UINT msg
, WPARAM wparam
,
142 LPARAM lparam
, UINT flags
, UINT timeout
,
143 PDWORD_PTR res_ptr
) DECLSPEC_HIDDEN
;
144 extern LRESULT
send_message( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
) DECLSPEC_HIDDEN
;
145 extern BOOL
send_notify_message( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
, BOOL ansi
) DECLSPEC_HIDDEN
;
146 extern LRESULT
send_message_timeout( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
,
147 UINT flags
, UINT timeout
, BOOL ansi
) DECLSPEC_HIDDEN
;
150 extern BOOL
process_rawinput_message( MSG
*msg
, UINT hw_id
, const struct hardware_msg_data
*msg_data
) DECLSPEC_HIDDEN
;
151 extern BOOL
rawinput_device_get_usages( HANDLE handle
, USHORT
*usage_page
, USHORT
*usage
) DECLSPEC_HIDDEN
;
154 extern void draw_nc_scrollbar( HWND hwnd
, HDC hdc
, BOOL draw_horizontal
, BOOL draw_vertical
) DECLSPEC_HIDDEN
;
155 extern BOOL
get_scroll_info( HWND hwnd
, INT bar
, SCROLLINFO
*info
) DECLSPEC_HIDDEN
;
156 extern void handle_scroll_event( HWND hwnd
, INT bar
, UINT msg
, POINT pt
) DECLSPEC_HIDDEN
;
157 extern LRESULT
scroll_bar_window_proc( HWND hwnd
, UINT msg
, WPARAM wparam
, LPARAM lparam
,
158 BOOL ansi
) DECLSPEC_HIDDEN
;
159 extern void set_standard_scroll_painted( HWND hwnd
, int bar
, BOOL painted
) DECLSPEC_HIDDEN
;
160 extern void track_scroll_bar( HWND hwnd
, int scrollbar
, POINT pt
) DECLSPEC_HIDDEN
;
163 extern BOOL enable_thunk_lock DECLSPEC_HIDDEN
;
164 extern HBRUSH
get_55aa_brush(void) DECLSPEC_HIDDEN
;
165 extern DWORD
get_dialog_base_units(void) DECLSPEC_HIDDEN
;
166 extern LONG
get_char_dimensions( HDC hdc
, TEXTMETRICW
*metric
, int *height
) DECLSPEC_HIDDEN
;
167 extern INT
get_display_depth( UNICODE_STRING
*name
) DECLSPEC_HIDDEN
;
168 extern RECT
get_display_rect( const WCHAR
*display
) DECLSPEC_HIDDEN
;
169 extern UINT
get_monitor_dpi( HMONITOR monitor
) DECLSPEC_HIDDEN
;
170 extern BOOL
get_monitor_info( HMONITOR handle
, MONITORINFO
*info
) DECLSPEC_HIDDEN
;
171 extern UINT
get_win_monitor_dpi( HWND hwnd
) DECLSPEC_HIDDEN
;
172 extern RECT
get_primary_monitor_rect( UINT dpi
) DECLSPEC_HIDDEN
;
173 extern DWORD
get_process_layout(void) DECLSPEC_HIDDEN
;
174 extern COLORREF
get_sys_color( int index
) DECLSPEC_HIDDEN
;
175 extern HBRUSH
get_sys_color_brush( unsigned int index
) DECLSPEC_HIDDEN
;
176 extern HPEN
get_sys_color_pen( unsigned int index
) DECLSPEC_HIDDEN
;
177 extern UINT
get_system_dpi(void) DECLSPEC_HIDDEN
;
178 extern int get_system_metrics( int index
) DECLSPEC_HIDDEN
;
179 extern UINT
get_thread_dpi(void) DECLSPEC_HIDDEN
;
180 extern DPI_AWARENESS
get_thread_dpi_awareness(void) DECLSPEC_HIDDEN
;
181 extern RECT
get_virtual_screen_rect( UINT dpi
) DECLSPEC_HIDDEN
;
182 extern BOOL
is_exiting_thread( DWORD tid
) DECLSPEC_HIDDEN
;
183 extern POINT
map_dpi_point( POINT pt
, UINT dpi_from
, UINT dpi_to
) DECLSPEC_HIDDEN
;
184 extern RECT
map_dpi_rect( RECT rect
, UINT dpi_from
, UINT dpi_to
) DECLSPEC_HIDDEN
;
185 extern BOOL
message_beep( UINT i
) DECLSPEC_HIDDEN
;
186 extern POINT
point_phys_to_win_dpi( HWND hwnd
, POINT pt
) DECLSPEC_HIDDEN
;
187 extern POINT
point_thread_to_win_dpi( HWND hwnd
, POINT pt
) DECLSPEC_HIDDEN
;
188 extern RECT
rect_thread_to_win_dpi( HWND hwnd
, RECT rect
) DECLSPEC_HIDDEN
;
189 extern HMONITOR
monitor_from_point( POINT pt
, UINT flags
, UINT dpi
) DECLSPEC_HIDDEN
;
190 extern HMONITOR
monitor_from_rect( const RECT
*rect
, UINT flags
, UINT dpi
) DECLSPEC_HIDDEN
;
191 extern HMONITOR
monitor_from_window( HWND hwnd
, UINT flags
, UINT dpi
) DECLSPEC_HIDDEN
;
192 extern void user_lock(void) DECLSPEC_HIDDEN
;
193 extern void user_unlock(void) DECLSPEC_HIDDEN
;
194 extern void user_check_not_lock(void) DECLSPEC_HIDDEN
;
198 extern HDWP
begin_defer_window_pos( INT count
) DECLSPEC_HIDDEN
;
199 extern BOOL
client_to_screen( HWND hwnd
, POINT
*pt
) DECLSPEC_HIDDEN
;
200 extern void destroy_thread_windows(void) DECLSPEC_HIDDEN
;
201 extern LRESULT
destroy_window( HWND hwnd
) DECLSPEC_HIDDEN
;
202 extern BOOL
enable_window( HWND hwnd
, BOOL enable
) DECLSPEC_HIDDEN
;
203 extern BOOL
get_client_rect( HWND hwnd
, RECT
*rect
) DECLSPEC_HIDDEN
;
204 extern HWND
get_desktop_window(void) DECLSPEC_HIDDEN
;
205 extern UINT
get_dpi_for_window( HWND hwnd
) DECLSPEC_HIDDEN
;
206 extern HWND
get_full_window_handle( HWND hwnd
) DECLSPEC_HIDDEN
;
207 extern HWND
get_parent( HWND hwnd
) DECLSPEC_HIDDEN
;
208 extern HWND
get_hwnd_message_parent(void) DECLSPEC_HIDDEN
;
209 extern DPI_AWARENESS_CONTEXT
get_window_dpi_awareness_context( HWND hwnd
) DECLSPEC_HIDDEN
;
210 extern MINMAXINFO
get_min_max_info( HWND hwnd
) DECLSPEC_HIDDEN
;
211 extern DWORD
get_window_context_help_id( HWND hwnd
) DECLSPEC_HIDDEN
;
212 extern HWND
get_window_relative( HWND hwnd
, UINT rel
) DECLSPEC_HIDDEN
;
213 extern DWORD
get_window_thread( HWND hwnd
, DWORD
*process
) DECLSPEC_HIDDEN
;
214 extern HWND
is_current_process_window( HWND hwnd
) DECLSPEC_HIDDEN
;
215 extern HWND
is_current_thread_window( HWND hwnd
) DECLSPEC_HIDDEN
;
216 extern BOOL
is_desktop_window( HWND hwnd
) DECLSPEC_HIDDEN
;
217 extern BOOL
is_iconic( HWND hwnd
) DECLSPEC_HIDDEN
;
218 extern BOOL
is_window_drawable( HWND hwnd
, BOOL icon
) DECLSPEC_HIDDEN
;
219 extern BOOL
is_window_enabled( HWND hwnd
) DECLSPEC_HIDDEN
;
220 extern BOOL
is_window_unicode( HWND hwnd
) DECLSPEC_HIDDEN
;
221 extern BOOL
is_window_visible( HWND hwnd
) DECLSPEC_HIDDEN
;
222 extern BOOL
is_zoomed( HWND hwnd
) DECLSPEC_HIDDEN
;
223 extern DWORD
get_window_long( HWND hwnd
, INT offset
) DECLSPEC_HIDDEN
;
224 extern ULONG_PTR
get_window_long_ptr( HWND hwnd
, INT offset
, BOOL ansi
) DECLSPEC_HIDDEN
;
225 extern BOOL
get_window_rect( HWND hwnd
, RECT
*rect
, UINT dpi
) DECLSPEC_HIDDEN
;
226 enum coords_relative
;
227 extern BOOL
get_window_rects( HWND hwnd
, enum coords_relative relative
, RECT
*window_rect
,
228 RECT
*client_rect
, UINT dpi
) DECLSPEC_HIDDEN
;
229 extern HWND
*list_window_children( HDESK desktop
, HWND hwnd
, UNICODE_STRING
*class,
230 DWORD tid
) DECLSPEC_HIDDEN
;
231 extern int map_window_points( HWND hwnd_from
, HWND hwnd_to
, POINT
*points
, UINT count
,
232 UINT dpi
) DECLSPEC_HIDDEN
;
233 extern void map_window_region( HWND from
, HWND to
, HRGN hrgn
) DECLSPEC_HIDDEN
;
234 extern BOOL
screen_to_client( HWND hwnd
, POINT
*pt
) DECLSPEC_HIDDEN
;
235 extern LONG_PTR
set_window_long( HWND hwnd
, INT offset
, UINT size
, LONG_PTR newval
,
236 BOOL ansi
) DECLSPEC_HIDDEN
;
237 extern BOOL
set_window_pos( WINDOWPOS
*winpos
, int parent_x
, int parent_y
) DECLSPEC_HIDDEN
;
238 extern ULONG
set_window_style( HWND hwnd
, ULONG set_bits
, ULONG clear_bits
) DECLSPEC_HIDDEN
;
239 extern BOOL
show_owned_popups( HWND owner
, BOOL show
) DECLSPEC_HIDDEN
;
240 extern void update_window_state( HWND hwnd
) DECLSPEC_HIDDEN
;
241 extern HWND
window_from_point( HWND hwnd
, POINT pt
, INT
*hittest
) DECLSPEC_HIDDEN
;
243 /* to release pointers retrieved by win_get_ptr */
244 static inline void release_win_ptr( struct tagWND
*ptr
)
249 extern void wrappers_init( unixlib_handle_t handle
) DECLSPEC_HIDDEN
;
250 extern void gdi_init(void) DECLSPEC_HIDDEN
;
251 extern NTSTATUS
callbacks_init( void *args
) DECLSPEC_HIDDEN
;
252 extern void winstation_init(void) DECLSPEC_HIDDEN
;
253 extern void sysparams_init(void) DECLSPEC_HIDDEN
;
254 extern int muldiv( int a
, int b
, int c
) DECLSPEC_HIDDEN
;
256 extern HKEY
reg_create_key( HKEY root
, const WCHAR
*name
, ULONG name_len
,
257 DWORD options
, DWORD
*disposition
) DECLSPEC_HIDDEN
;
258 extern HKEY
reg_open_hkcu_key( const char *name
) DECLSPEC_HIDDEN
;
259 extern HKEY
reg_open_key( HKEY root
, const WCHAR
*name
, ULONG name_len
) DECLSPEC_HIDDEN
;
260 extern ULONG
query_reg_value( HKEY hkey
, const WCHAR
*name
,
261 KEY_VALUE_PARTIAL_INFORMATION
*info
, ULONG size
) DECLSPEC_HIDDEN
;
262 extern ULONG
query_reg_ascii_value( HKEY hkey
, const char *name
,
263 KEY_VALUE_PARTIAL_INFORMATION
*info
, ULONG size
) DECLSPEC_HIDDEN
;
264 extern void set_reg_ascii_value( HKEY hkey
, const char *name
, const char *value
) DECLSPEC_HIDDEN
;
265 extern BOOL
set_reg_value( HKEY hkey
, const WCHAR
*name
, UINT type
, const void *value
,
266 DWORD count
) DECLSPEC_HIDDEN
;
267 extern BOOL
reg_delete_tree( HKEY parent
, const WCHAR
*name
, ULONG name_len
) DECLSPEC_HIDDEN
;
268 extern void reg_delete_value( HKEY hkey
, const WCHAR
*name
) DECLSPEC_HIDDEN
;
270 extern HKEY hkcu_key DECLSPEC_HIDDEN
;
272 extern const struct user_driver_funcs
*user_driver DECLSPEC_HIDDEN
;
274 static inline BOOL
set_ntstatus( NTSTATUS status
)
276 if (status
) RtlSetLastWin32Error( RtlNtStatusToDosError( status
));
280 static inline WCHAR
win32u_towupper( WCHAR ch
)
282 return RtlUpcaseUnicodeChar( ch
);
285 extern CPTABLEINFO ansi_cp DECLSPEC_HIDDEN
;
287 CPTABLEINFO
*get_cptable( WORD cp
) DECLSPEC_HIDDEN
;
288 const NLS_LOCALE_DATA
*get_locale_data( LCID lcid
) DECLSPEC_HIDDEN
;
289 extern BOOL
translate_charset_info( DWORD
*src
, CHARSETINFO
*cs
, DWORD flags
) DECLSPEC_HIDDEN
;
290 DWORD
win32u_mbtowc( CPTABLEINFO
*info
, WCHAR
*dst
, DWORD dstlen
, const char *src
,
291 DWORD srclen
) DECLSPEC_HIDDEN
;
292 DWORD
win32u_wctomb( CPTABLEINFO
*info
, char *dst
, DWORD dstlen
, const WCHAR
*src
,
293 DWORD srclen
) DECLSPEC_HIDDEN
;
294 DWORD
win32u_wctomb_size( CPTABLEINFO
*info
, const WCHAR
*src
, DWORD srclen
) DECLSPEC_HIDDEN
;
295 DWORD
win32u_mbtowc_size( CPTABLEINFO
*info
, const char *src
, DWORD srclen
) DECLSPEC_HIDDEN
;
297 static inline WCHAR
*win32u_wcsdup( const WCHAR
*str
)
299 DWORD size
= (lstrlenW( str
) + 1) * sizeof(WCHAR
);
300 WCHAR
*ret
= malloc( size
);
301 if (ret
) memcpy( ret
, str
, size
);
305 static inline WCHAR
*towstr( const char *str
)
307 DWORD len
= strlen( str
) + 1;
308 WCHAR
*ret
= malloc( len
* sizeof(WCHAR
) );
309 if (ret
) win32u_mbtowc( &ansi_cp
, ret
, len
, str
, len
);
313 #define towupper(c) win32u_towupper(c)
314 #define wcsdup(s) win32u_wcsdup(s)
316 static inline void ascii_to_unicode( WCHAR
*dst
, const char *src
, size_t len
)
318 while (len
--) *dst
++ = (unsigned char)*src
++;
321 static inline UINT
asciiz_to_unicode( WCHAR
*dst
, const char *src
)
324 while ((*p
++ = *src
++));
325 return (p
- dst
) * sizeof(WCHAR
);
328 static inline BOOL
is_win9x(void)
330 return NtCurrentTeb()->Peb
->OSPlatformId
== VER_PLATFORM_WIN32s
;
333 static inline ULONG_PTR
zero_bits(void)
336 return !NtCurrentTeb()->WowTebOffset
? 0 : 0x7fffffff;
342 static inline const char *debugstr_us( const UNICODE_STRING
*us
)
344 if (!us
) return "<null>";
345 return debugstr_wn( us
->Buffer
, us
->Length
/ sizeof(WCHAR
) );
348 static inline const char *debugstr_color( COLORREF color
)
350 if (color
& (1 << 24)) /* PALETTEINDEX */
351 return wine_dbg_sprintf( "PALETTEINDEX(%u)", LOWORD(color
) );
352 if (color
>> 16 == 0x10ff) /* DIBINDEX */
353 return wine_dbg_sprintf( "DIBINDEX(%u)", LOWORD(color
) );
354 return wine_dbg_sprintf( "RGB(%02x,%02x,%02x)", GetRValue(color
), GetGValue(color
), GetBValue(color
) );
357 #endif /* __WINE_WIN32U_PRIVATE */