win32u: Move reply_message_result implementation from user32.
[wine.git] / dlls / win32u / win32u_private.h
blobe2e40ff084d9ae77e9814b2d479b167eaf18eab6
1 /*
2 * Unix call wrappers
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
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include "windef.h"
27 #include "winbase.h"
28 #include "ntgdi.h"
29 #include "ntuser.h"
30 #include "wine/gdi_driver.h"
31 #include "wine/unixlib.h"
32 #include "wine/debug.h"
34 extern const struct user_callbacks *user_callbacks DECLSPEC_HIDDEN;
36 struct unix_funcs
38 /* win32u functions */
39 INT (WINAPI *pNtGdiAbortDoc)( HDC hdc );
40 BOOL (WINAPI *pNtGdiAbortPath)( HDC hdc );
41 BOOL (WINAPI *pNtGdiAlphaBlend)( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int height_dst,
42 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
43 BLENDFUNCTION blend_function, HANDLE xform );
44 BOOL (WINAPI *pNtGdiAngleArc)( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_angle,
45 FLOAT sweep_angle );
46 BOOL (WINAPI *pNtGdiArcInternal)( UINT type, HDC hdc, INT left, INT top, INT right, INT bottom,
47 INT xstart, INT ystart, INT xend, INT yend );
48 BOOL (WINAPI *pNtGdiBeginPath)( HDC hdc );
49 BOOL (WINAPI *pNtGdiBitBlt)( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height, HDC hdc_src,
50 INT x_src, INT y_src, DWORD rop, DWORD bk_color, FLONG fl );
51 BOOL (WINAPI *pNtGdiCloseFigure)( HDC hdc );
52 BOOL (WINAPI *pNtGdiComputeXformCoefficients)( HDC hdc );
53 HBITMAP (WINAPI *pNtGdiCreateCompatibleBitmap)( HDC hdc, INT width, INT height );
54 HDC (WINAPI *pNtGdiCreateCompatibleDC)( HDC hdc );
55 HBITMAP (WINAPI *pNtGdiCreateDIBitmapInternal)( HDC hdc, INT width, INT height, DWORD init,
56 const void *bits, const BITMAPINFO *data,
57 UINT coloruse, UINT max_info, UINT max_bits,
58 ULONG flags, HANDLE xform );
59 HDC (WINAPI *pNtGdiCreateMetafileDC)( HDC hdc );
60 NTSTATUS (WINAPI *pNtGdiDdDDICheckVidPnExclusiveOwnership)( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc );
61 NTSTATUS (WINAPI *pNtGdiDdDDICreateDCFromMemory)( D3DKMT_CREATEDCFROMMEMORY *desc );
62 NTSTATUS (WINAPI *pNtGdiDdDDIDestroyDCFromMemory)( const D3DKMT_DESTROYDCFROMMEMORY *desc );
63 NTSTATUS (WINAPI *pNtGdiDdDDIDestroyDevice)( const D3DKMT_DESTROYDEVICE *desc );
64 NTSTATUS (WINAPI *pNtGdiDdDDIEscape)( const D3DKMT_ESCAPE *desc );
65 NTSTATUS (WINAPI *pNtGdiDdDDISetVidPnSourceOwner)( const D3DKMT_SETVIDPNSOURCEOWNER *desc );
66 BOOL (WINAPI *pNtGdiDeleteObjectApp)( HGDIOBJ obj );
67 LONG (WINAPI *pNtGdiDoPalette)( HGDIOBJ handle, WORD start, WORD count, void *entries,
68 DWORD func, BOOL inbound );
69 BOOL (WINAPI *pNtGdiEllipse)( HDC hdc, INT left, INT top, INT right, INT bottom );
70 INT (WINAPI *pNtGdiEndDoc)(HDC hdc);
71 BOOL (WINAPI *pNtGdiEndPath)( HDC hdc );
72 INT (WINAPI *pNtGdiEndPage)( HDC hdc );
73 BOOL (WINAPI *pNtGdiEnumFonts)( HDC hdc, ULONG type, ULONG win32_compat, ULONG face_name_len,
74 const WCHAR *face_name, ULONG charset, ULONG *count, void *buf );
75 INT (WINAPI *pNtGdiExcludeClipRect)( HDC hdc, INT left, INT top, INT right, INT bottom );
76 INT (WINAPI *pNtGdiExtEscape)( HDC hdc, WCHAR *driver, INT driver_id, INT escape, INT input_size,
77 const char *input, INT output_size, char *output );
78 BOOL (WINAPI *pNtGdiExtFloodFill)( HDC hdc, INT x, INT y, COLORREF color, UINT type );
79 BOOL (WINAPI *pNtGdiExtTextOutW)( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
80 const WCHAR *str, UINT count, const INT *dx, DWORD cp );
81 INT (WINAPI *pNtGdiExtSelectClipRgn)( HDC hdc, HRGN region, INT mode );
82 BOOL (WINAPI *pNtGdiFillPath)( HDC hdc );
83 BOOL (WINAPI *pNtGdiFillRgn)( HDC hdc, HRGN hrgn, HBRUSH hbrush );
84 BOOL (WINAPI *pNtGdiFontIsLinked)( HDC hdc );
85 BOOL (WINAPI *pNtGdiFrameRgn)( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height );
86 BOOL (WINAPI *pNtGdiGetAndSetDCDword)( HDC hdc, UINT method, DWORD value, DWORD *result );
87 INT (WINAPI *pNtGdiGetAppClipBox)( HDC hdc, RECT *rect );
88 UINT (WINAPI *pNtGdiGetBoundsRect)( HDC hdc, RECT *rect, UINT flags );
89 BOOL (WINAPI *pNtGdiGetCharABCWidthsW)( HDC hdc, UINT first, UINT last, WCHAR *chars,
90 ULONG flags, void *buffer );
91 BOOL (WINAPI *pNtGdiGetCharWidthW)( HDC hdc, UINT first_char, UINT last_char, WCHAR *chars,
92 ULONG flags, void *buffer );
93 BOOL (WINAPI *pNtGdiGetCharWidthInfo)( HDC hdc, struct char_width_info *info );
94 INT (WINAPI *pNtGdiGetDIBitsInternal)( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines,
95 void *bits, BITMAPINFO *info, UINT coloruse,
96 UINT max_bits, UINT max_info );
97 INT (WINAPI *pNtGdiGetDeviceCaps)( HDC hdc, INT cap );
98 BOOL (WINAPI *pNtGdiGetDeviceGammaRamp)( HDC hdc, void *ptr );
99 DWORD (WINAPI *pNtGdiGetFontData)( HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length );
100 DWORD (WINAPI *pNtGdiGetFontUnicodeRanges)( HDC hdc, GLYPHSET *lpgs );
101 DWORD (WINAPI *pNtGdiGetGlyphIndicesW)( HDC hdc, const WCHAR *str, INT count,
102 WORD *indices, DWORD flags );
103 DWORD (WINAPI *pNtGdiGetGlyphOutline)( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics,
104 DWORD size, void *buffer, const MAT2 *mat2,
105 BOOL ignore_rotation );
106 DWORD (WINAPI *pNtGdiGetKerningPairs)( HDC hdc, DWORD count, KERNINGPAIR *kern_pair );
107 COLORREF (WINAPI *pNtGdiGetNearestColor)( HDC hdc, COLORREF color );
108 UINT (WINAPI *pNtGdiGetOutlineTextMetricsInternalW)( HDC hdc, UINT cbData,
109 OUTLINETEXTMETRICW *otm, ULONG opts );
110 COLORREF (WINAPI *pNtGdiGetPixel)( HDC hdc, INT x, INT y );
111 INT (WINAPI *pNtGdiGetRandomRgn)( HDC hdc, HRGN region, INT code );
112 BOOL (WINAPI *pNtGdiGetRasterizerCaps)( RASTERIZER_STATUS *status, UINT size );
113 BOOL (WINAPI *pNtGdiGetRealizationInfo)( HDC hdc, struct font_realization_info *info );
114 UINT (WINAPI *pNtGdiGetTextCharsetInfo)( HDC hdc, FONTSIGNATURE *fs, DWORD flags );
115 BOOL (WINAPI *pNtGdiGetTextExtentExW)( HDC hdc, const WCHAR *str, INT count, INT max_ext,
116 INT *nfit, INT *dxs, SIZE *size, UINT flags );
117 INT (WINAPI *pNtGdiGetTextFaceW)( HDC hdc, INT count, WCHAR *name, BOOL alias_name );
118 BOOL (WINAPI *pNtGdiGetTextMetricsW)( HDC hdc, TEXTMETRICW *metrics, ULONG flags );
119 BOOL (WINAPI *pNtGdiGradientFill)( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
120 void *grad_array, ULONG ngrad, ULONG mode );
121 INT (WINAPI *pNtGdiIntersectClipRect)( HDC hdc, INT left, INT top, INT right, INT bottom );
122 BOOL (WINAPI *pNtGdiInvertRgn)( HDC hdc, HRGN hrgn );
123 BOOL (WINAPI *pNtGdiLineTo)( HDC hdc, INT x, INT y );
124 BOOL (WINAPI *pNtGdiMaskBlt)( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
125 HDC hdc_src, INT x_src, INT y_src, HBITMAP mask,
126 INT x_mask, INT y_mask, DWORD rop, DWORD bk_color );
127 BOOL (WINAPI *pNtGdiModifyWorldTransform)( HDC hdc, const XFORM *xform, DWORD mode );
128 BOOL (WINAPI *pNtGdiMoveTo)( HDC hdc, INT x, INT y, POINT *pt );
129 INT (WINAPI *pNtGdiOffsetClipRgn)( HDC hdc, INT x, INT y );
130 HDC (WINAPI *pNtGdiOpenDCW)( UNICODE_STRING *device, const DEVMODEW *devmode,
131 UNICODE_STRING *output, ULONG type, BOOL is_display,
132 HANDLE hspool, DRIVER_INFO_2W *driver_info, void *pdev );
133 BOOL (WINAPI *pNtGdiPatBlt)( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop );
134 BOOL (WINAPI *pNtGdiPlgBlt)( HDC hdc, const POINT *point, HDC hdc_src, INT x_src, INT y_src,
135 INT width, INT height, HBITMAP mask, INT x_mask, INT y_mask,
136 DWORD bk_color );
137 BOOL (WINAPI *pNtGdiPolyDraw)(HDC hdc, const POINT *points, const BYTE *types, DWORD count );
138 ULONG (WINAPI *pNtGdiPolyPolyDraw)( HDC hdc, const POINT *points, const UINT *counts,
139 DWORD count, UINT function );
140 BOOL (WINAPI *pNtGdiPtVisible)( HDC hdc, INT x, INT y );
141 BOOL (WINAPI *pNtGdiRectVisible)( HDC hdc, const RECT *rect );
142 BOOL (WINAPI *pNtGdiRectangle)( HDC hdc, INT left, INT top, INT right, INT bottom );
143 BOOL (WINAPI *pNtGdiResetDC)( HDC hdc, const DEVMODEW *devmode, BOOL *banding,
144 DRIVER_INFO_2W *driver_info, void *dev );
145 BOOL (WINAPI *pNtGdiResizePalette)( HPALETTE palette, UINT count );
146 BOOL (WINAPI *pNtGdiRestoreDC)( HDC hdc, INT level );
147 BOOL (WINAPI *pNtGdiRoundRect)( HDC hdc, INT left, INT top, INT right,
148 INT bottom, INT ell_width, INT ell_height );
149 BOOL (WINAPI *pNtGdiScaleViewportExtEx)( HDC hdc, INT x_num, INT x_denom,
150 INT y_num, INT y_denom, SIZE *size );
151 BOOL (WINAPI *pNtGdiScaleWindowExtEx)( HDC hdc, INT x_num, INT x_denom,
152 INT y_num, INT y_denom, SIZE *size );
153 HGDIOBJ (WINAPI *pNtGdiSelectBitmap)( HDC hdc, HGDIOBJ handle );
154 HGDIOBJ (WINAPI *pNtGdiSelectBrush)( HDC hdc, HGDIOBJ handle );
155 BOOL (WINAPI *pNtGdiSelectClipPath)( HDC hdc, INT mode );
156 HGDIOBJ (WINAPI *pNtGdiSelectFont)( HDC hdc, HGDIOBJ handle );
157 HGDIOBJ (WINAPI *pNtGdiSelectPen)( HDC hdc, HGDIOBJ handle );
158 UINT (WINAPI *pNtGdiSetBoundsRect)( HDC hdc, const RECT *rect, UINT flags );
159 INT (WINAPI *pNtGdiSetDIBitsToDeviceInternal)( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
160 DWORD cy, INT x_src, INT y_src, UINT startscan,
161 UINT lines, const void *bits, const BITMAPINFO *bmi,
162 UINT coloruse, UINT max_bits, UINT max_info,
163 BOOL xform_coords, HANDLE xform );
164 BOOL (WINAPI *pNtGdiSetDeviceGammaRamp)( HDC hdc, void *ptr );
165 DWORD (WINAPI *pNtGdiSetLayout)( HDC hdc, LONG wox, DWORD layout );
166 COLORREF (WINAPI *pNtGdiSetPixel)( HDC hdc, INT x, INT y, COLORREF color );
167 UINT (WINAPI *pNtGdiSetSystemPaletteUse)( HDC hdc, UINT use );
168 INT (WINAPI *pNtGdiStartDoc)( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job );
169 INT (WINAPI *pNtGdiStartPage)( HDC hdc );
170 BOOL (WINAPI *pNtGdiStretchBlt)( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
171 HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
172 DWORD rop, COLORREF bk_color );
173 INT (WINAPI *pNtGdiStretchDIBitsInternal)( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
174 INT height_dst, INT x_src, INT y_src, INT width_src,
175 INT height_src, const void *bits, const BITMAPINFO *bmi,
176 UINT coloruse, DWORD rop, UINT max_info, UINT max_bits,
177 HANDLE xform );
178 BOOL (WINAPI *pNtGdiStrokeAndFillPath)( HDC hdc );
179 BOOL (WINAPI *pNtGdiStrokePath)( HDC hdc );
180 BOOL (WINAPI *pNtGdiTransparentBlt)( HDC hdc, int x_dst, int y_dst, int width_dst, int height_dst,
181 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
182 UINT color );
183 BOOL (WINAPI *pNtGdiUnrealizeObject)( HGDIOBJ obj );
184 BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc );
185 BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc );
186 HKL (WINAPI *pNtUserActivateKeyboardLayout)( HKL layout, UINT flags );
187 HDC (WINAPI *pNtUserBeginPaint)( HWND hwnd, PAINTSTRUCT *ps );
188 ULONG_PTR (WINAPI *pNtUserCallHwnd)( HWND hwnd, DWORD code );
189 ULONG_PTR (WINAPI *pNtUserCallHwndParam)( HWND hwnd, DWORD_PTR param, DWORD code );
190 LRESULT (WINAPI *pNtUserCallNextHookEx)( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam );
191 ULONG_PTR (WINAPI *pNtUserCallNoParam)( ULONG code );
192 ULONG_PTR (WINAPI *pNtUserCallOneParam)( ULONG_PTR arg, ULONG code );
193 ULONG_PTR (WINAPI *pNtUserCallTwoParam)( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code );
194 LONG (WINAPI *pNtUserChangeDisplaySettings)( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd,
195 DWORD flags, void *lparam );
196 BOOL (WINAPI *pNtUserClipCursor)( const RECT *rect );
197 INT (WINAPI *pNtUserCountClipboardFormats)(void);
198 HWND (WINAPI *pNtUserCreateWindowEx)( DWORD ex_style, UNICODE_STRING *class_name,
199 UNICODE_STRING *version, UNICODE_STRING *window_name,
200 DWORD style, INT x, INT y, INT width, INT height,
201 HWND parent, HMENU menu, HINSTANCE instance, void *params,
202 DWORD flags, CBT_CREATEWNDW *cbtc, DWORD unk, BOOL ansi );
203 HDWP (WINAPI *pNtUserDeferWindowPosAndBand)( HDWP hdwp, HWND hwnd, HWND after,
204 INT x, INT y, INT cx, INT cy,
205 UINT flags, UINT unk1, UINT unk2 );
206 BOOL (WINAPI *pNtUserDestroyCursor)( HCURSOR cursor, ULONG arg );
207 BOOL (WINAPI *pNtUserDestroyMenu)( HMENU handle );
208 BOOL (WINAPI *pNtUserDestroyWindow)( HWND hwnd );
209 LRESULT (WINAPI *pNtUserDispatchMessage)( const MSG *msg );
210 BOOL (WINAPI *pNtUserDrawIconEx)( HDC hdc, INT x0, INT y0, HICON icon, INT width,
211 INT height, UINT istep, HBRUSH hbr, UINT flags );
212 BOOL (WINAPI *pNtUserEndDeferWindowPosEx)( HDWP hdwp, BOOL async );
213 BOOL (WINAPI *pNtUserEndPaint)( HWND hwnd, const PAINTSTRUCT *ps );
214 NTSTATUS (WINAPI *pNtUserEnumDisplayDevices)( UNICODE_STRING *device, DWORD index,
215 DISPLAY_DEVICEW *info, DWORD flags );
216 BOOL (WINAPI *pNtUserEnumDisplayMonitors)( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp );
217 BOOL (WINAPI *pNtUserEnumDisplaySettings)( UNICODE_STRING *device, DWORD mode,
218 DEVMODEW *dev_mode, DWORD flags );
219 BOOL (WINAPI *pNtUserFlashWindowEx)( FLASHWINFO *info );
220 SHORT (WINAPI *pNtUserGetAsyncKeyState)( INT key );
221 ATOM (WINAPI *pNtUserGetClassInfoEx)( HINSTANCE instance, UNICODE_STRING *name, WNDCLASSEXW *wc,
222 struct client_menu_name *menu_name, BOOL ansi );
223 BOOL (WINAPI *pNtUserGetCursorInfo)( CURSORINFO *info );
224 HDC (WINAPI *pNtUserGetDCEx)( HWND hwnd, HRGN clip_rgn, DWORD flags );
225 LONG (WINAPI *pNtUserGetDisplayConfigBufferSizes)( UINT32 flags, UINT32 *num_path_info,
226 UINT32 *num_mode_info );
227 BOOL (WINAPI *pNtUserGetIconInfo)( HICON icon, ICONINFO *info, UNICODE_STRING *module,
228 UNICODE_STRING *res_name, DWORD *bpp, LONG unk );
229 INT (WINAPI *pNtUserGetKeyNameText)( LONG lparam, WCHAR *buffer, INT size );
230 UINT (WINAPI *pNtUserGetKeyboardLayoutList)( INT size, HKL *layouts );
231 INT (WINAPI *pNtUserGetPriorityClipboardFormat)( UINT *list, INT count );
232 DWORD (WINAPI *pNtUserGetQueueStatus)( UINT flags );
233 BOOL (WINAPI *pNtUserGetUpdateRect)( HWND hwnd, RECT *rect, BOOL erase );
234 INT (WINAPI *pNtUserGetUpdateRgn)( HWND hwnd, HRGN hrgn, BOOL erase );
235 BOOL (WINAPI *pNtUserGetUpdatedClipboardFormats)( UINT *formats, UINT size, UINT *out_size );
236 BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format );
237 UINT (WINAPI *pNtUserMapVirtualKeyEx)( UINT code, UINT type, HKL layout );
238 BOOL (WINAPI *pNtUserMessageCall)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
239 ULONG_PTR result_info, DWORD type, BOOL ansi );
240 BOOL (WINAPI *pNtUserMoveWindow)( HWND hwnd, INT x, INT y, INT cx, INT cy, BOOL repaint );
241 BOOL (WINAPI *pNtUserRedrawWindow)( HWND hwnd, const RECT *rect, HRGN hrgn, UINT flags );
242 ATOM (WINAPI *pNtUserRegisterClassExWOW)( const WNDCLASSEXW *wc, UNICODE_STRING *name,
243 UNICODE_STRING *version,
244 struct client_menu_name *client_menu_name,
245 DWORD fnid, DWORD flags, DWORD *wow );
246 BOOL (WINAPI *pNtUserRegisterHotKey)( HWND hwnd, INT id, UINT modifiers, UINT vk );
247 INT (WINAPI *pNtUserReleaseDC)( HWND hwnd, HDC hdc );
248 BOOL (WINAPI *pNtUserScrollDC)( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
249 HRGN ret_update_rgn, RECT *update_rect );
250 HPALETTE (WINAPI *pNtUserSelectPalette)( HDC hdc, HPALETTE hpal, WORD bkg );
251 HWND (WINAPI *pNtUserSetActiveWindow)( HWND hwnd );
252 HWND (WINAPI *pNtUserSetCapture)( HWND hwnd );
253 DWORD (WINAPI *pNtUserSetClassLong)( HWND hwnd, INT offset, LONG newval, BOOL ansi );
254 ULONG_PTR (WINAPI *pNtUserSetClassLongPtr)( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
255 WORD (WINAPI *pNtUserSetClassWord)( HWND hwnd, INT offset, WORD newval );
256 HCURSOR (WINAPI *pNtUserSetCursor)( HCURSOR cursor );
257 BOOL (WINAPI *pNtUserSetCursorIconData)( HCURSOR cursor, UNICODE_STRING *module,
258 UNICODE_STRING *res_name, struct cursoricon_desc *desc );
259 BOOL (WINAPI *pNtUserSetCursorPos)( INT x, INT y );
260 HWND (WINAPI *pNtUserSetFocus)( HWND hwnd );
261 BOOL (WINAPI *pNtUserSetLayeredWindowAttributes)( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags );
262 HWND (WINAPI *pNtUserSetParent)( HWND hwnd, HWND parent );
263 BOOL (WINAPI *pNtUserSetSysColors)( INT count, const INT *colors, const COLORREF *values );
264 LONG (WINAPI *pNtUserSetWindowLong)( HWND hwnd, INT offset, LONG newval, BOOL ansi );
265 LONG_PTR (WINAPI *pNtUserSetWindowLongPtr)( HWND hwnd, INT offset, LONG_PTR newval, BOOL ansi );
266 BOOL (WINAPI *pNtUserSetWindowPos)( HWND hwnd, HWND after, INT x, INT y, INT cx, INT cy, UINT flags );
267 int (WINAPI *pNtUserSetWindowRgn)( HWND hwnd, HRGN hrgn, BOOL redraw );
268 WORD (WINAPI *pNtUserSetWindowWord)( HWND hwnd, INT offset, WORD newval );
269 INT (WINAPI *pNtUserShowCursor)( BOOL show );
270 BOOL (WINAPI *pNtUserShowWindow)( HWND hwnd, INT cmd );
271 BOOL (WINAPI *pNtUserShowWindowAsync)( HWND hwnd, INT cmd );
272 BOOL (WINAPI *pNtUserSystemParametersInfo)( UINT action, UINT val, PVOID ptr, UINT winini );
273 BOOL (WINAPI *pNtUserSystemParametersInfoForDpi)( UINT action, UINT val, PVOID ptr,
274 UINT winini, UINT dpi );
275 INT (WINAPI *pNtUserToUnicodeEx)( UINT virt, UINT scan, const BYTE *state,
276 WCHAR *str, int size, UINT flags, HKL layout );
277 BOOL (WINAPI *pNtUserUnregisterClass)( UNICODE_STRING *name, HINSTANCE instance,
278 struct client_menu_name *client_menu_name );
279 BOOL (WINAPI *pNtUserUnregisterHotKey)( HWND hwnd, INT id );
280 BOOL (WINAPI *pNtUserUpdateLayeredWindow)( HWND hwnd, HDC hdc_dst, const POINT *pts_dst,
281 const SIZE *size, HDC hdc_src, const POINT *pts_src,
282 COLORREF key, const BLENDFUNCTION *blend,
283 DWORD flags, const RECT *dirty );
284 WORD (WINAPI *pNtUserVkKeyScanEx)( WCHAR chr, HKL layout );
285 HWND (WINAPI *pNtUserWindowFromPoint)( LONG x, LONG y );
287 /* Wine-specific functions */
288 INT (WINAPI *pSetDIBits)( HDC hdc, HBITMAP hbitmap, UINT startscan,
289 UINT lines, const void *bits, const BITMAPINFO *info,
290 UINT coloruse );
291 BOOL (CDECL *get_brush_bitmap_info)( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage );
292 BOOL (CDECL *get_file_outline_text_metric)( const WCHAR *path, OUTLINETEXTMETRICW *otm );
293 BOOL (CDECL *get_icm_profile)( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename );
294 const struct vulkan_funcs * (CDECL *get_vulkan_driver)( UINT version );
295 struct opengl_funcs * (CDECL *get_wgl_driver)( HDC hdc, UINT version );
296 void (CDECL *set_display_driver)( struct user_driver_funcs *funcs, UINT version );
299 /* clipboard.c */
300 extern void release_clipboard_owner( HWND hwnd ) DECLSPEC_HIDDEN;
302 /* cursoricon.c */
303 extern HICON alloc_cursoricon_handle( BOOL is_icon ) DECLSPEC_HIDDEN;
304 extern BOOL get_clip_cursor( RECT *rect ) DECLSPEC_HIDDEN;
305 extern ULONG_PTR get_icon_param( HICON handle ) DECLSPEC_HIDDEN;
306 extern ULONG_PTR set_icon_param( HICON handle, ULONG_PTR param ) DECLSPEC_HIDDEN;
308 /* dce.c */
309 extern struct window_surface dummy_surface DECLSPEC_HIDDEN;
310 extern BOOL create_dib_surface( HDC hdc, const BITMAPINFO *info ) DECLSPEC_HIDDEN;
311 extern void create_offscreen_window_surface( const RECT *visible_rect,
312 struct window_surface **surface ) DECLSPEC_HIDDEN;
313 extern void erase_now( HWND hwnd, UINT rdw_flags ) DECLSPEC_HIDDEN;
314 extern void flush_window_surfaces( BOOL idle ) DECLSPEC_HIDDEN;
315 extern void move_window_bits( HWND hwnd, struct window_surface *old_surface,
316 struct window_surface *new_surface,
317 const RECT *visible_rect, const RECT *old_visible_rect,
318 const RECT *window_rect, const RECT *valid_rects ) DECLSPEC_HIDDEN;
319 extern void move_window_bits_parent( HWND hwnd, HWND parent, const RECT *window_rect,
320 const RECT *valid_rects ) DECLSPEC_HIDDEN;
321 extern void register_window_surface( struct window_surface *old,
322 struct window_surface *new ) DECLSPEC_HIDDEN;
324 /* hook.c */
325 extern LRESULT call_current_hook( HHOOK hhook, INT code, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
326 extern LRESULT call_hooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ) DECLSPEC_HIDDEN;
327 extern BOOL unhook_windows_hook( INT id, HOOKPROC proc ) DECLSPEC_HIDDEN;
329 /* input.c */
330 extern LONG global_key_state_counter DECLSPEC_HIDDEN;
331 extern HWND get_active_window(void) DECLSPEC_HIDDEN;
332 extern BOOL get_cursor_pos( POINT *pt ) DECLSPEC_HIDDEN;
333 extern HWND get_focus(void) DECLSPEC_HIDDEN;
334 extern DWORD get_input_state(void) DECLSPEC_HIDDEN;
335 extern BOOL WINAPI release_capture(void) DECLSPEC_HIDDEN;
336 extern BOOL set_capture_window( HWND hwnd, UINT gui_flags, HWND *prev_ret ) DECLSPEC_HIDDEN;
337 extern BOOL set_foreground_window( HWND hwnd, BOOL mouse ) DECLSPEC_HIDDEN;
339 /* menu.c */
340 extern HMENU create_menu(void) DECLSPEC_HIDDEN;
341 extern HMENU get_menu( HWND hwnd ) DECLSPEC_HIDDEN;
343 /* message.c */
344 extern LRESULT dispatch_message( const MSG *msg, BOOL ansi ) DECLSPEC_HIDDEN;
345 extern BOOL kill_system_timer( HWND hwnd, UINT_PTR id ) DECLSPEC_HIDDEN;
346 extern LRESULT post_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
347 extern BOOL reply_message_result( LRESULT result, MSG *msg ) DECLSPEC_HIDDEN;
348 extern LRESULT send_message( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ) DECLSPEC_HIDDEN;
350 /* sysparams.c */
351 extern RECT get_display_rect( const WCHAR *display ) DECLSPEC_HIDDEN;
352 extern UINT get_monitor_dpi( HMONITOR monitor ) DECLSPEC_HIDDEN;
353 extern BOOL get_monitor_info( HMONITOR handle, MONITORINFO *info ) DECLSPEC_HIDDEN;
354 extern UINT get_win_monitor_dpi( HWND hwnd ) DECLSPEC_HIDDEN;
355 extern RECT get_primary_monitor_rect( UINT dpi ) DECLSPEC_HIDDEN;
356 extern UINT get_system_dpi(void) DECLSPEC_HIDDEN;
357 extern int get_system_metrics( int index ) DECLSPEC_HIDDEN;
358 extern UINT get_thread_dpi(void) DECLSPEC_HIDDEN;
359 extern DPI_AWARENESS get_thread_dpi_awareness(void) DECLSPEC_HIDDEN;
360 extern RECT get_virtual_screen_rect( UINT dpi ) DECLSPEC_HIDDEN;
361 extern BOOL is_exiting_thread( DWORD tid ) DECLSPEC_HIDDEN;
362 extern POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN;
363 extern RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN;
364 extern HMONITOR monitor_from_point( POINT pt, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN;
365 extern HMONITOR monitor_from_rect( const RECT *rect, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN;
366 extern HMONITOR monitor_from_window( HWND hwnd, DWORD flags, UINT dpi ) DECLSPEC_HIDDEN;
367 extern DPI_AWARENESS_CONTEXT set_thread_dpi_awareness_context( DPI_AWARENESS_CONTEXT context ) DECLSPEC_HIDDEN;
368 extern void user_lock(void) DECLSPEC_HIDDEN;
369 extern void user_unlock(void) DECLSPEC_HIDDEN;
370 extern void user_check_not_lock(void) DECLSPEC_HIDDEN;
372 /* window.c */
373 struct tagWND;
374 extern HDWP begin_defer_window_pos( INT count ) DECLSPEC_HIDDEN;
375 extern void destroy_thread_windows(void) DECLSPEC_HIDDEN;
376 extern LRESULT destroy_window( HWND hwnd ) DECLSPEC_HIDDEN;
377 extern BOOL get_client_rect( HWND hwnd, RECT *rect ) DECLSPEC_HIDDEN;
378 extern HWND get_desktop_window(void) DECLSPEC_HIDDEN;
379 extern UINT get_dpi_for_window( HWND hwnd ) DECLSPEC_HIDDEN;
380 extern HWND get_full_window_handle( HWND hwnd ) DECLSPEC_HIDDEN;
381 extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN;
382 extern DPI_AWARENESS_CONTEXT get_window_dpi_awareness_context( HWND hwnd ) DECLSPEC_HIDDEN;
383 extern BOOL get_window_placement( HWND hwnd, WINDOWPLACEMENT *placement ) DECLSPEC_HIDDEN;
384 extern DWORD get_window_thread( HWND hwnd, DWORD *process ) DECLSPEC_HIDDEN;
385 extern HWND is_current_process_window( HWND hwnd ) DECLSPEC_HIDDEN;
386 extern HWND is_current_thread_window( HWND hwnd ) DECLSPEC_HIDDEN;
387 extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN;
388 extern BOOL is_iconic( HWND hwnd ) DECLSPEC_HIDDEN;
389 extern BOOL is_window_unicode( HWND hwnd ) DECLSPEC_HIDDEN;
390 extern DWORD get_window_long( HWND hwnd, INT offset ) DECLSPEC_HIDDEN;
391 extern BOOL get_window_rect( HWND hwnd, RECT *rect, UINT dpi ) DECLSPEC_HIDDEN;
392 enum coords_relative;
393 extern BOOL get_window_rects( HWND hwnd, enum coords_relative relative, RECT *window_rect,
394 RECT *client_rect, UINT dpi ) DECLSPEC_HIDDEN;
395 extern HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *class,
396 DWORD tid ) DECLSPEC_HIDDEN;
397 extern int map_window_points( HWND hwnd_from, HWND hwnd_to, POINT *points, UINT count,
398 UINT dpi ) DECLSPEC_HIDDEN;
399 extern void map_window_region( HWND from, HWND to, HRGN hrgn ) DECLSPEC_HIDDEN;
400 extern LONG_PTR set_window_long( HWND hwnd, INT offset, UINT size, LONG_PTR newval,
401 BOOL ansi ) DECLSPEC_HIDDEN;
402 extern BOOL set_window_pos( WINDOWPOS *winpos, int parent_x, int parent_y ) DECLSPEC_HIDDEN;
403 extern ULONG set_window_style( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN;
404 extern void update_window_state( HWND hwnd ) DECLSPEC_HIDDEN;
406 /* to release pointers retrieved by win_get_ptr */
407 static inline void release_win_ptr( struct tagWND *ptr )
409 user_unlock();
412 extern void wrappers_init( unixlib_handle_t handle ) DECLSPEC_HIDDEN;
413 extern NTSTATUS gdi_init(void) DECLSPEC_HIDDEN;
414 extern NTSTATUS callbacks_init( void *args ) DECLSPEC_HIDDEN;
415 extern void winstation_init(void) DECLSPEC_HIDDEN;
416 extern void sysparams_init(void) DECLSPEC_HIDDEN;
418 extern HKEY reg_create_key( HKEY root, const WCHAR *name, ULONG name_len,
419 DWORD options, DWORD *disposition ) DECLSPEC_HIDDEN;
420 extern HKEY reg_open_hkcu_key( const char *name ) DECLSPEC_HIDDEN;
421 extern HKEY reg_open_key( HKEY root, const WCHAR *name, ULONG name_len ) DECLSPEC_HIDDEN;
422 extern ULONG query_reg_value( HKEY hkey, const WCHAR *name,
423 KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) DECLSPEC_HIDDEN;
424 extern ULONG query_reg_ascii_value( HKEY hkey, const char *name,
425 KEY_VALUE_PARTIAL_INFORMATION *info, ULONG size ) DECLSPEC_HIDDEN;
426 extern void set_reg_ascii_value( HKEY hkey, const char *name, const char *value ) DECLSPEC_HIDDEN;
427 extern BOOL set_reg_value( HKEY hkey, const WCHAR *name, UINT type, const void *value,
428 DWORD count ) DECLSPEC_HIDDEN;
429 extern BOOL reg_delete_tree( HKEY parent, const WCHAR *name, ULONG name_len ) DECLSPEC_HIDDEN;
430 extern void reg_delete_value( HKEY hkey, const WCHAR *name ) DECLSPEC_HIDDEN;
432 extern HKEY hkcu_key DECLSPEC_HIDDEN;
434 static inline struct user_thread_info *get_user_thread_info(void)
436 return (struct user_thread_info *)NtCurrentTeb()->Win32ClientInfo;
439 extern const struct user_driver_funcs *user_driver DECLSPEC_HIDDEN;
441 static inline NTSTATUS user32_call( ULONG id, void *args, ULONG len )
443 /* FIXME: use KeUserModeCallback instead */
444 NTSTATUS (WINAPI *func)(void *, ULONG) = ((void **)NtCurrentTeb()->Peb->KernelCallbackTable)[id];
445 return func( args, len );
448 static inline BOOL set_ntstatus( NTSTATUS status )
450 if (status) SetLastError( RtlNtStatusToDosError( status ));
451 return !status;
454 static inline WCHAR win32u_towupper( WCHAR ch )
456 return RtlUpcaseUnicodeChar( ch );
459 static inline LONG win32u_wcstol( LPCWSTR s, LPWSTR *end, INT base )
461 BOOL negative = FALSE, empty = TRUE;
462 LONG ret = 0;
464 if (base < 0 || base == 1 || base > 36) return 0;
465 if (end) *end = (WCHAR *)s;
466 while (*s == ' ' || *s == '\t') s++;
468 if (*s == '-')
470 negative = TRUE;
471 s++;
473 else if (*s == '+') s++;
475 if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
477 base = 16;
478 s += 2;
480 if (base == 0) base = s[0] != '0' ? 10 : 8;
482 while (*s)
484 int v;
486 if ('0' <= *s && *s <= '9') v = *s - '0';
487 else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
488 else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
489 else break;
490 if (v >= base) break;
491 if (negative) v = -v;
492 s++;
493 empty = FALSE;
495 if (!negative && (ret > MAXLONG / base || ret * base > MAXLONG - v))
496 ret = MAXLONG;
497 else if (negative && (ret < (LONG)MINLONG / base || ret * base < (LONG)(MINLONG - v)))
498 ret = MINLONG;
499 else
500 ret = ret * base + v;
503 if (end && !empty) *end = (WCHAR *)s;
504 return ret;
507 static inline ULONG win32u_wcstoul( const WCHAR *s, WCHAR **end, int base )
509 BOOL negative = FALSE, empty = TRUE;
510 ULONG ret = 0;
512 if (base < 0 || base == 1 || base > 36) return 0;
513 if (end) *end = (WCHAR *)s;
514 while (*s == ' ' || *s == '\t') s++;
516 if (*s == '-')
518 negative = TRUE;
519 s++;
521 else if (*s == '+') s++;
523 if ((base == 0 || base == 16) && s[0] == '0' && (s[1] == 'x' || s[1] == 'X'))
525 base = 16;
526 s += 2;
528 if (base == 0) base = s[0] != '0' ? 10 : 8;
530 while (*s)
532 int v;
534 if ('0' <= *s && *s <= '9') v = *s - '0';
535 else if ('A' <= *s && *s <= 'Z') v = *s - 'A' + 10;
536 else if ('a' <= *s && *s <= 'z') v = *s - 'a' + 10;
537 else break;
538 if (v >= base) break;
539 s++;
540 empty = FALSE;
542 if (ret > MAXDWORD / base || ret * base > MAXDWORD - v)
543 ret = MAXDWORD;
544 else
545 ret = ret * base + v;
548 if (end && !empty) *end = (WCHAR *)s;
549 return negative ? -ret : ret;
552 #define towupper(c) win32u_towupper(c)
553 #define wcstol(s,e,b) win32u_wcstol(s,e,b)
554 #define wcstoul(s,e,b) win32u_wcstoul(s,e,b)
556 static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len )
558 while (len--) *dst++ = (unsigned char)*src++;
561 static inline UINT asciiz_to_unicode( WCHAR *dst, const char *src )
563 WCHAR *p = dst;
564 while ((*p++ = *src++));
565 return (p - dst) * sizeof(WCHAR);
568 DWORD win32u_mbtowc( CPTABLEINFO *info, WCHAR *dst, DWORD dstlen, const char *src,
569 DWORD srclen ) DECLSPEC_HIDDEN;
570 DWORD win32u_wctomb( CPTABLEINFO *info, char *dst, DWORD dstlen, const WCHAR *src,
571 DWORD srclen ) DECLSPEC_HIDDEN;
573 static inline BOOL is_win9x(void)
575 return NtCurrentTeb()->Peb->OSPlatformId == VER_PLATFORM_WIN32s;
578 static inline void init_unicode_string( UNICODE_STRING *str, const WCHAR *data )
580 str->Length = lstrlenW(data) * sizeof(WCHAR);
581 str->MaximumLength = str->Length + sizeof(WCHAR);
582 str->Buffer = (WCHAR *)data;
585 static inline const char *debugstr_us( const UNICODE_STRING *us )
587 if (!us) return "<null>";
588 return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) );
591 #endif /* __WINE_WIN32U_PRIVATE */