ucrtbase: Add support for r-value demangling in unDName.
[wine.git] / dlls / win32u / wrappers.c
blobaaabf51a2f8d2e5fa0320b4f982a5327fcce8dc8
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 #include "ntstatus.h"
22 #define WIN32_NO_STATUS
23 #include "win32u_private.h"
25 static const struct unix_funcs *unix_funcs;
27 INT WINAPI NtGdiAbortDoc( HDC hdc )
29 if (!unix_funcs) return 0;
30 return unix_funcs->pNtGdiAbortDoc( hdc );
33 BOOL WINAPI NtGdiAbortPath( HDC hdc )
35 if (!unix_funcs) return FALSE;
36 return unix_funcs->pNtGdiAbortPath( hdc );
39 BOOL WINAPI NtGdiAlphaBlend( HDC hdc_dst, int x_dst, int y_dst, int width_dst, int height_dst,
40 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
41 BLENDFUNCTION blend_function, HANDLE xform )
43 if (!unix_funcs) return FALSE;
44 return unix_funcs->pNtGdiAlphaBlend( hdc_dst, x_dst, y_dst, width_dst, height_dst, hdc_src,
45 x_src, y_src, width_src, height_src, blend_function, xform );
48 BOOL WINAPI NtGdiAngleArc( HDC hdc, INT x, INT y, DWORD radius, FLOAT start_angle, FLOAT sweep_angle )
50 if (!unix_funcs) return FALSE;
51 return unix_funcs->pNtGdiAngleArc( hdc, x, y, radius, start_angle, sweep_angle );
54 BOOL WINAPI NtGdiArcInternal( UINT type, HDC hdc, INT left, INT top, INT right, INT bottom,
55 INT xstart, INT ystart, INT xend, INT yend )
57 if (!unix_funcs) return FALSE;
58 return unix_funcs->pNtGdiArcInternal( type, hdc, left, top, right, bottom, xstart, ystart, xend, yend );
61 BOOL WINAPI NtGdiBeginPath( HDC hdc )
63 if (!unix_funcs) return FALSE;
64 return unix_funcs->pNtGdiBeginPath( hdc );
67 BOOL WINAPI NtGdiBitBlt( HDC hdc_dst, INT x_dst, INT y_dst, INT width, INT height, HDC hdc_src,
68 INT x_src, INT y_src, DWORD rop, DWORD bk_color, FLONG fl )
70 if (!unix_funcs) return FALSE;
71 return unix_funcs->pNtGdiBitBlt( hdc_dst, x_dst, y_dst, width, height, hdc_src, x_src, y_src,
72 rop, bk_color, fl );
75 BOOL WINAPI NtGdiCloseFigure( HDC hdc )
77 if (!unix_funcs) return FALSE;
78 return unix_funcs->pNtGdiCloseFigure( hdc );
81 BOOL WINAPI NtGdiComputeXformCoefficients( HDC hdc )
83 if (!unix_funcs) return FALSE;
84 return unix_funcs->pNtGdiComputeXformCoefficients( hdc );
87 HBITMAP WINAPI NtGdiCreateCompatibleBitmap( HDC hdc, INT width, INT height )
89 if (!unix_funcs) return 0;
90 return unix_funcs->pNtGdiCreateCompatibleBitmap( hdc, width, height );
93 HDC WINAPI NtGdiCreateCompatibleDC( HDC hdc )
95 if (!unix_funcs) return 0;
96 return unix_funcs->pNtGdiCreateCompatibleDC( hdc );
99 HBITMAP WINAPI NtGdiCreateDIBitmapInternal( HDC hdc, INT width, INT height, DWORD init,
100 const void *bits, const BITMAPINFO *data,
101 UINT coloruse, UINT max_info, UINT max_bits,
102 ULONG flags, HANDLE xform )
104 if (!unix_funcs) return 0;
105 return unix_funcs->pNtGdiCreateDIBitmapInternal( hdc, width, height, init, bits, data,
106 coloruse, max_info, max_bits, flags, xform );
109 HDC WINAPI NtGdiCreateMetafileDC( HDC hdc )
111 if (!unix_funcs) return 0;
112 return unix_funcs->pNtGdiCreateMetafileDC( hdc );
115 BOOL WINAPI NtGdiDeleteObjectApp( HGDIOBJ obj )
117 if (!unix_funcs) return FALSE;
118 return unix_funcs->pNtGdiDeleteObjectApp( obj );
121 LONG WINAPI NtGdiDoPalette( HGDIOBJ handle, WORD start, WORD count, void *entries,
122 DWORD func, BOOL inbound )
124 if (!unix_funcs) return 0;
125 return unix_funcs->pNtGdiDoPalette( handle, start, count, entries, func, inbound );
128 BOOL WINAPI NtGdiEllipse( HDC hdc, INT left, INT top, INT right, INT bottom )
130 if (!unix_funcs) return FALSE;
131 return unix_funcs->pNtGdiEllipse( hdc, left, top, right, bottom );
134 INT WINAPI NtGdiEndDoc( HDC hdc )
136 if (!unix_funcs) return SP_ERROR;
137 return unix_funcs->pNtGdiEndDoc( hdc );
140 BOOL WINAPI NtGdiEndPath( HDC hdc )
142 if (!unix_funcs) return FALSE;
143 return unix_funcs->pNtGdiEndPath( hdc );
146 INT WINAPI NtGdiEndPage( HDC hdc )
148 if (!unix_funcs) return SP_ERROR;
149 return unix_funcs->pNtGdiEndPage( hdc );
152 BOOL WINAPI NtGdiEnumFonts( HDC hdc, ULONG type, ULONG win32_compat, ULONG face_name_len,
153 const WCHAR *face_name, ULONG charset, ULONG *count, void *buf )
155 if (!unix_funcs) return FALSE;
156 return unix_funcs->pNtGdiEnumFonts( hdc, type, win32_compat, face_name_len, face_name,
157 charset, count, buf );
160 INT WINAPI NtGdiExcludeClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
162 if (!unix_funcs) return ERROR;
163 return unix_funcs->pNtGdiExcludeClipRect( hdc, left, top, right, bottom );
166 INT WINAPI NtGdiExtEscape( HDC hdc, WCHAR *driver, INT driver_id, INT escape, INT input_size,
167 const char *input, INT output_size, char *output )
169 if (!unix_funcs) return 0;
170 return unix_funcs->pNtGdiExtEscape( hdc, driver, driver_id, escape, input_size, input,
171 output_size, output );
174 BOOL WINAPI NtGdiExtFloodFill( HDC hdc, INT x, INT y, COLORREF color, UINT type )
176 if (!unix_funcs) return FALSE;
177 return unix_funcs->pNtGdiExtFloodFill( hdc, x, y, color, type );
180 BOOL WINAPI NtGdiExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *rect,
181 const WCHAR *str, UINT count, const INT *dx, DWORD cp )
183 if (!unix_funcs) return FALSE;
184 return unix_funcs->pNtGdiExtTextOutW( hdc, x, y, flags, rect, str, count, dx, cp );
187 INT WINAPI NtGdiExtSelectClipRgn( HDC hdc, HRGN region, INT mode )
189 if (!unix_funcs) return ERROR;
190 return unix_funcs->pNtGdiExtSelectClipRgn( hdc, region, mode );
193 BOOL WINAPI NtGdiFillPath( HDC hdc )
195 if (!unix_funcs) return FALSE;
196 return unix_funcs->pNtGdiFillPath( hdc );
199 BOOL WINAPI NtGdiFillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
201 if (!unix_funcs) return FALSE;
202 return unix_funcs->pNtGdiFillRgn( hdc, hrgn, hbrush );
205 BOOL WINAPI NtGdiFontIsLinked( HDC hdc )
207 if (!unix_funcs) return FALSE;
208 return unix_funcs->pNtGdiFontIsLinked( hdc );
211 BOOL WINAPI NtGdiFrameRgn( HDC hdc, HRGN hrgn, HBRUSH brush, INT width, INT height )
213 if (!unix_funcs) return FALSE;
214 return unix_funcs->pNtGdiFrameRgn( hdc, hrgn, brush, width, height );
217 BOOL WINAPI NtGdiGetAndSetDCDword( HDC hdc, UINT method, DWORD value, DWORD *result )
219 if (!unix_funcs) return FALSE;
220 return unix_funcs->pNtGdiGetAndSetDCDword( hdc, method, value, result );
223 INT WINAPI NtGdiGetAppClipBox( HDC hdc, RECT *rect )
225 if (!unix_funcs) return ERROR;
226 return unix_funcs->pNtGdiGetAppClipBox( hdc, rect );
229 UINT WINAPI NtGdiGetBoundsRect( HDC hdc, RECT *rect, UINT flags )
231 if (!unix_funcs) return 0;
232 return unix_funcs->pNtGdiGetBoundsRect( hdc, rect, flags );
235 BOOL WINAPI NtGdiGetCharABCWidthsW( HDC hdc, UINT first, UINT last, WCHAR *chars,
236 ULONG flags, void *buffer )
238 if (!unix_funcs) return FALSE;
239 return unix_funcs->pNtGdiGetCharABCWidthsW( hdc, first, last, chars, flags, buffer );
242 BOOL WINAPI NtGdiGetCharWidthW( HDC hdc, UINT first_char, UINT last_char, WCHAR *chars,
243 ULONG flags, void *buffer )
245 if (!unix_funcs) return FALSE;
246 return unix_funcs->pNtGdiGetCharWidthW( hdc, first_char, last_char, chars, flags, buffer );
249 BOOL WINAPI NtGdiGetCharWidthInfo( HDC hdc, struct char_width_info *info )
251 if (!unix_funcs) return FALSE;
252 return unix_funcs->pNtGdiGetCharWidthInfo( hdc, info );
255 INT WINAPI NtGdiGetDIBitsInternal( HDC hdc, HBITMAP hbitmap, UINT startscan, UINT lines,
256 void *bits, BITMAPINFO *info, UINT coloruse,
257 UINT max_bits, UINT max_info )
259 if (!unix_funcs) return 0;
260 return unix_funcs->pNtGdiGetDIBitsInternal( hdc, hbitmap, startscan, lines, bits, info, coloruse,
261 max_bits, max_info );
264 INT WINAPI NtGdiGetDeviceCaps( HDC hdc, INT cap )
266 if (!unix_funcs) return 0;
267 return unix_funcs->pNtGdiGetDeviceCaps( hdc, cap );
270 BOOL WINAPI NtGdiGetDeviceGammaRamp( HDC hdc, void *ptr )
272 if (!unix_funcs) return FALSE;
273 return unix_funcs->pNtGdiGetDeviceGammaRamp( hdc, ptr );
276 DWORD WINAPI NtGdiGetFontData( HDC hdc, DWORD table, DWORD offset, void *buffer, DWORD length )
278 if (!unix_funcs) return GDI_ERROR;
279 return unix_funcs->pNtGdiGetFontData( hdc, table, offset, buffer, length );
282 DWORD WINAPI NtGdiGetFontUnicodeRanges( HDC hdc, GLYPHSET *lpgs )
284 if (!unix_funcs) return 0;
285 return unix_funcs->pNtGdiGetFontUnicodeRanges( hdc, lpgs );
288 DWORD WINAPI NtGdiGetGlyphIndicesW( HDC hdc, const WCHAR *str, INT count,
289 WORD *indices, DWORD flags )
291 if (!unix_funcs) return GDI_ERROR;
292 return unix_funcs->pNtGdiGetGlyphIndicesW( hdc, str, count, indices, flags );
295 DWORD WINAPI NtGdiGetGlyphOutline( HDC hdc, UINT ch, UINT format, GLYPHMETRICS *metrics,
296 DWORD size, void *buffer, const MAT2 *mat2,
297 BOOL ignore_rotation )
299 if (!unix_funcs) return GDI_ERROR;
300 return unix_funcs->pNtGdiGetGlyphOutline( hdc, ch, format, metrics, size, buffer, mat2, ignore_rotation );
303 DWORD WINAPI NtGdiGetKerningPairs( HDC hdc, DWORD count, KERNINGPAIR *kern_pair )
305 if (!unix_funcs) return 0;
306 return unix_funcs->pNtGdiGetKerningPairs( hdc, count, kern_pair );
309 COLORREF WINAPI NtGdiGetNearestColor( HDC hdc, COLORREF color )
311 if (!unix_funcs) return CLR_INVALID;
312 return unix_funcs->pNtGdiGetNearestColor( hdc, color );
315 UINT WINAPI NtGdiGetOutlineTextMetricsInternalW( HDC hdc, UINT cbData,
316 OUTLINETEXTMETRICW *otm, ULONG opts )
318 if (!unix_funcs) return 0;
319 return unix_funcs->pNtGdiGetOutlineTextMetricsInternalW( hdc, cbData, otm, opts );
322 COLORREF WINAPI NtGdiGetPixel( HDC hdc, INT x, INT y )
324 if (!unix_funcs) return CLR_INVALID;
325 return unix_funcs->pNtGdiGetPixel( hdc, x, y );
328 INT WINAPI NtGdiGetRandomRgn( HDC hdc, HRGN region, INT code )
330 if (!unix_funcs) return -1;
331 return unix_funcs->pNtGdiGetRandomRgn( hdc, region, code );
334 BOOL WINAPI NtGdiGetRasterizerCaps( RASTERIZER_STATUS *status, UINT size )
336 if (!unix_funcs) return FALSE;
337 return unix_funcs->pNtGdiGetRasterizerCaps( status, size );
340 BOOL WINAPI NtGdiGetRealizationInfo( HDC hdc, struct font_realization_info *info )
342 if (!unix_funcs) return FALSE;
343 return unix_funcs->pNtGdiGetRealizationInfo( hdc, info );
346 UINT WINAPI NtGdiGetTextCharsetInfo( HDC hdc, FONTSIGNATURE *fs, DWORD flags )
348 if (!unix_funcs) return DEFAULT_CHARSET;
349 return unix_funcs->pNtGdiGetTextCharsetInfo( hdc, fs, flags );
352 BOOL WINAPI NtGdiGetTextExtentExW( HDC hdc, const WCHAR *str, INT count, INT max_ext,
353 INT *nfit, INT *dxs, SIZE *size, UINT flags )
355 if (!unix_funcs) return FALSE;
356 return unix_funcs->pNtGdiGetTextExtentExW( hdc, str, count, max_ext, nfit, dxs, size, flags );
359 INT WINAPI NtGdiGetTextFaceW( HDC hdc, INT count, WCHAR *name, BOOL alias_name )
361 if (!unix_funcs) return 0;
362 return unix_funcs->pNtGdiGetTextFaceW( hdc, count, name, alias_name );
365 BOOL WINAPI NtGdiGetTextMetricsW( HDC hdc, TEXTMETRICW *metrics, ULONG flags )
367 if (!unix_funcs) return FALSE;
368 return unix_funcs->pNtGdiGetTextMetricsW( hdc, metrics, flags );
371 BOOL WINAPI NtGdiGradientFill( HDC hdc, TRIVERTEX *vert_array, ULONG nvert,
372 void *grad_array, ULONG ngrad, ULONG mode )
374 if (!unix_funcs) return FALSE;
375 return unix_funcs->pNtGdiGradientFill( hdc, vert_array, nvert, grad_array, ngrad, mode );
378 INT WINAPI NtGdiIntersectClipRect( HDC hdc, INT left, INT top, INT right, INT bottom )
380 if (!unix_funcs) return ERROR;
381 return unix_funcs->pNtGdiIntersectClipRect( hdc, left, top, right, bottom );
384 BOOL WINAPI NtGdiInvertRgn( HDC hdc, HRGN hrgn )
386 if (!unix_funcs) return FALSE;
387 return unix_funcs->pNtGdiInvertRgn( hdc, hrgn );
390 BOOL WINAPI NtGdiLineTo( HDC hdc, INT x, INT y )
392 if (!unix_funcs) return FALSE;
393 return unix_funcs->pNtGdiLineTo( hdc, x, y );
396 BOOL WINAPI NtGdiMaskBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
397 HDC hdc_src, INT x_src, INT y_src, HBITMAP mask,
398 INT x_mask, INT y_mask, DWORD rop, DWORD bk_color )
400 if (!unix_funcs) return FALSE;
401 return unix_funcs->pNtGdiMaskBlt( hdc, x_dst, y_dst, width_dst, height_dst, hdc_src,
402 x_src, y_src, mask, x_mask, y_mask, rop, bk_color );
405 BOOL WINAPI NtGdiModifyWorldTransform( HDC hdc, const XFORM *xform, DWORD mode )
407 if (!unix_funcs) return FALSE;
408 return unix_funcs->pNtGdiModifyWorldTransform( hdc, xform, mode );
411 BOOL WINAPI NtGdiMoveTo( HDC hdc, INT x, INT y, POINT *pt )
413 if (!unix_funcs) return FALSE;
414 return unix_funcs->pNtGdiMoveTo( hdc, x, y, pt );
417 INT WINAPI NtGdiOffsetClipRgn( HDC hdc, INT x, INT y )
419 if (!unix_funcs) return ERROR;
420 return unix_funcs->pNtGdiOffsetClipRgn( hdc, x, y );
423 HDC WINAPI NtGdiOpenDCW( UNICODE_STRING *device, const DEVMODEW *devmode,
424 UNICODE_STRING *output, ULONG type, BOOL is_display,
425 HANDLE hspool, DRIVER_INFO_2W *driver_info, void *pdev )
427 if (!unix_funcs) return 0;
428 return unix_funcs->pNtGdiOpenDCW( device, devmode, output, type, is_display,
429 hspool, driver_info, pdev );
432 BOOL WINAPI NtGdiPatBlt( HDC hdc, INT left, INT top, INT width, INT height, DWORD rop )
434 if (!unix_funcs) return FALSE;
435 return unix_funcs->pNtGdiPatBlt( hdc, left, top, width, height, rop );
438 BOOL WINAPI NtGdiPlgBlt( HDC hdc, const POINT *point, HDC hdc_src, INT x_src, INT y_src,
439 INT width, INT height, HBITMAP mask, INT x_mask, INT y_mask,
440 DWORD bk_color )
442 if (!unix_funcs) return FALSE;
443 return unix_funcs->pNtGdiPlgBlt( hdc, point, hdc_src, x_src, y_src, width, height, mask,
444 x_mask, y_mask, bk_color );
447 BOOL WINAPI NtGdiPolyDraw( HDC hdc, const POINT *points, const BYTE *types, DWORD count )
449 if (!unix_funcs) return FALSE;
450 return unix_funcs->pNtGdiPolyDraw( hdc, points, types, count );
453 ULONG WINAPI NtGdiPolyPolyDraw( HDC hdc, const POINT *points, const ULONG *counts,
454 DWORD count, UINT function )
456 if (!unix_funcs) return 0;
457 return unix_funcs->pNtGdiPolyPolyDraw( hdc, points, counts, count, function );
460 BOOL WINAPI NtGdiPtVisible( HDC hdc, INT x, INT y )
462 if (!unix_funcs) return FALSE;
463 return unix_funcs->pNtGdiPtVisible( hdc, x, y );
466 BOOL WINAPI NtGdiRectVisible( HDC hdc, const RECT *rect )
468 if (!unix_funcs) return FALSE;
469 return unix_funcs->pNtGdiRectVisible( hdc, rect );
472 BOOL WINAPI NtGdiRectangle( HDC hdc, INT left, INT top, INT right, INT bottom )
474 if (!unix_funcs) return FALSE;
475 return unix_funcs->pNtGdiRectangle( hdc, left, top, right, bottom );
478 BOOL WINAPI NtGdiResetDC( HDC hdc, const DEVMODEW *devmode, BOOL *banding,
479 DRIVER_INFO_2W *driver_info, void *dev )
481 if (!unix_funcs) return FALSE;
482 return unix_funcs->pNtGdiResetDC( hdc, devmode, banding, driver_info, dev );
485 BOOL WINAPI NtGdiResizePalette( HPALETTE palette, UINT count )
487 if (!unix_funcs) return FALSE;
488 return unix_funcs->pNtGdiResizePalette( palette, count );
491 BOOL WINAPI NtGdiRestoreDC( HDC hdc, INT level )
493 if (!unix_funcs) return FALSE;
494 return unix_funcs->pNtGdiRestoreDC( hdc, level );
497 BOOL WINAPI NtGdiRoundRect( HDC hdc, INT left, INT top, INT right,
498 INT bottom, INT ell_width, INT ell_height )
500 if (!unix_funcs) return FALSE;
501 return unix_funcs->pNtGdiRoundRect( hdc, left, top, right, bottom, ell_width, ell_height );
504 BOOL WINAPI NtGdiScaleViewportExtEx( HDC hdc, INT x_num, INT x_denom,
505 INT y_num, INT y_denom, SIZE *size )
507 if (!unix_funcs) return FALSE;
508 return unix_funcs->pNtGdiScaleViewportExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
511 BOOL WINAPI NtGdiScaleWindowExtEx( HDC hdc, INT x_num, INT x_denom,
512 INT y_num, INT y_denom, SIZE *size )
514 if (!unix_funcs) return FALSE;
515 return unix_funcs->pNtGdiScaleWindowExtEx( hdc, x_num, x_denom, y_num, y_denom, size );
518 HGDIOBJ WINAPI NtGdiSelectBitmap( HDC hdc, HGDIOBJ handle )
520 if (!unix_funcs) return 0;
521 return unix_funcs->pNtGdiSelectBitmap( hdc, handle );
524 HGDIOBJ WINAPI NtGdiSelectBrush( HDC hdc, HGDIOBJ handle )
526 if (!unix_funcs) return 0;
527 return unix_funcs->pNtGdiSelectBrush( hdc, handle );
530 BOOL WINAPI NtGdiSelectClipPath( HDC hdc, INT mode )
532 if (!unix_funcs) return FALSE;
533 return unix_funcs->pNtGdiSelectClipPath( hdc, mode );
536 HGDIOBJ WINAPI NtGdiSelectFont( HDC hdc, HGDIOBJ handle )
538 if (!unix_funcs) return 0;
539 return unix_funcs->pNtGdiSelectFont( hdc, handle );
542 HGDIOBJ WINAPI NtGdiSelectPen( HDC hdc, HGDIOBJ handle )
544 if (!unix_funcs) return 0;
545 return unix_funcs->pNtGdiSelectPen( hdc, handle );
548 UINT WINAPI NtGdiSetBoundsRect( HDC hdc, const RECT *rect, UINT flags )
550 if (!unix_funcs) return 0;
551 return unix_funcs->pNtGdiSetBoundsRect( hdc, rect, flags );
554 INT WINAPI NtGdiSetDIBitsToDeviceInternal( HDC hdc, INT x_dst, INT y_dst, DWORD cx,
555 DWORD cy, INT x_src, INT y_src, UINT startscan,
556 UINT lines, const void *bits, const BITMAPINFO *bmi,
557 UINT coloruse, UINT max_bits, UINT max_info,
558 BOOL xform_coords, HANDLE xform )
560 if (!unix_funcs) return 0;
561 return unix_funcs->pNtGdiSetDIBitsToDeviceInternal( hdc, x_dst, y_dst, cx, cy, x_src, y_src,
562 startscan, lines, bits, bmi, coloruse,
563 max_bits, max_info, xform_coords, xform );
566 BOOL WINAPI NtGdiSetDeviceGammaRamp( HDC hdc, void *ptr )
568 if (!unix_funcs) return FALSE;
569 return unix_funcs->pNtGdiSetDeviceGammaRamp( hdc, ptr );
572 DWORD WINAPI NtGdiSetLayout( HDC hdc, LONG wox, DWORD layout )
574 if (!unix_funcs) return GDI_ERROR;
575 return unix_funcs->pNtGdiSetLayout( hdc, wox, layout );
578 COLORREF WINAPI NtGdiSetPixel( HDC hdc, INT x, INT y, COLORREF color )
580 if (!unix_funcs) return CLR_INVALID;
581 return unix_funcs->pNtGdiSetPixel( hdc, x, y, color );
584 UINT WINAPI NtGdiSetSystemPaletteUse( HDC hdc, UINT use )
586 if (!unix_funcs) return SYSPAL_ERROR;
587 return unix_funcs->pNtGdiSetSystemPaletteUse( hdc, use );
590 INT WINAPI NtGdiStartDoc( HDC hdc, const DOCINFOW *doc, BOOL *banding, INT job )
592 if (!unix_funcs) return SP_ERROR;
593 return unix_funcs->pNtGdiStartDoc( hdc, doc, banding, job );
596 INT WINAPI NtGdiStartPage( HDC hdc )
598 if (!unix_funcs) return SP_ERROR;
599 return unix_funcs->pNtGdiStartPage( hdc );
602 BOOL WINAPI NtGdiStretchBlt( HDC hdc, INT x_dst, INT y_dst, INT width_dst, INT height_dst,
603 HDC hdc_src, INT x_src, INT y_src, INT width_src, INT height_src,
604 DWORD rop, COLORREF bk_color )
606 if (!unix_funcs) return FALSE;
607 return unix_funcs->pNtGdiStretchBlt( hdc, x_dst, y_dst, width_dst, height_dst, hdc_src,
608 x_src, y_src, width_src, height_src, rop, bk_color );
611 INT WINAPI NtGdiStretchDIBitsInternal( HDC hdc, INT x_dst, INT y_dst, INT width_dst,
612 INT height_dst, INT x_src, INT y_src, INT width_src,
613 INT height_src, const void *bits, const BITMAPINFO *bmi,
614 UINT coloruse, DWORD rop, UINT max_info, UINT max_bits,
615 HANDLE xform )
617 if (!unix_funcs) return 0;
618 return unix_funcs->pNtGdiStretchDIBitsInternal( hdc, x_dst, y_dst, width_dst, height_dst,
619 x_src, y_src, width_src, height_src, bits, bmi,
620 coloruse, rop, max_info, max_bits, xform );
623 BOOL WINAPI NtGdiStrokeAndFillPath( HDC hdc )
625 if (!unix_funcs) return FALSE;
626 return unix_funcs->pNtGdiStrokeAndFillPath( hdc );
629 BOOL WINAPI NtGdiStrokePath( HDC hdc )
631 if (!unix_funcs) return FALSE;
632 return unix_funcs->pNtGdiStrokePath( hdc );
635 BOOL WINAPI NtGdiTransparentBlt( HDC hdc, int x_dst, int y_dst, int width_dst, int height_dst,
636 HDC hdc_src, int x_src, int y_src, int width_src, int height_src,
637 UINT color )
639 if (!unix_funcs) return FALSE;
640 return unix_funcs->pNtGdiTransparentBlt( hdc, x_dst, y_dst, width_dst, height_dst, hdc_src,
641 x_src, y_src, width_src, height_src, color );
644 BOOL WINAPI NtGdiUnrealizeObject( HGDIOBJ obj )
646 if (!unix_funcs) return FALSE;
647 return unix_funcs->pNtGdiUnrealizeObject( obj );
650 BOOL WINAPI NtGdiUpdateColors( HDC hdc )
652 if (!unix_funcs) return FALSE;
653 return unix_funcs->pNtGdiUpdateColors( hdc );
656 BOOL WINAPI NtGdiWidenPath( HDC hdc )
658 if (!unix_funcs) return FALSE;
659 return unix_funcs->pNtGdiWidenPath( hdc );
662 NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc )
664 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
665 return unix_funcs->pNtGdiDdDDICheckVidPnExclusiveOwnership( desc );
668 NTSTATUS WINAPI NtGdiDdDDICreateDCFromMemory( D3DKMT_CREATEDCFROMMEMORY *desc )
670 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
671 return unix_funcs->pNtGdiDdDDICreateDCFromMemory( desc );
674 NTSTATUS WINAPI NtGdiDdDDIDestroyDCFromMemory( const D3DKMT_DESTROYDCFROMMEMORY *desc )
676 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
677 return unix_funcs->pNtGdiDdDDIDestroyDCFromMemory( desc );
680 NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
682 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
683 return unix_funcs->pNtGdiDdDDIDestroyDevice( desc );
686 NTSTATUS WINAPI NtGdiDdDDIEscape( const D3DKMT_ESCAPE *desc )
688 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
689 return unix_funcs->pNtGdiDdDDIEscape( desc );
692 NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc )
694 if (!unix_funcs) return STATUS_NOT_SUPPORTED;
695 return unix_funcs->pNtGdiDdDDISetVidPnSourceOwner( desc );
698 HKL WINAPI NtUserActivateKeyboardLayout( HKL layout, UINT flags )
700 if (!unix_funcs) return 0;
701 return unix_funcs->pNtUserActivateKeyboardLayout( layout, flags );
704 ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code )
706 if (!unix_funcs) return 0;
707 return unix_funcs->pNtUserCallOneParam( arg, code );
710 ULONG_PTR WINAPI NtUserCallTwoParam( ULONG_PTR arg1, ULONG_PTR arg2, ULONG code )
712 if (!unix_funcs) return 0;
713 return unix_funcs->pNtUserCallTwoParam( arg1, arg2, code );
716 LONG WINAPI NtUserChangeDisplaySettings( UNICODE_STRING *devname, DEVMODEW *devmode, HWND hwnd,
717 DWORD flags, void *lparam )
719 if (!unix_funcs) return DISP_CHANGE_FAILED;
720 return unix_funcs->pNtUserChangeDisplaySettings( devname, devmode, hwnd, flags, lparam );
723 INT WINAPI NtUserCountClipboardFormats(void)
725 if (!unix_funcs) return 0;
726 return unix_funcs->pNtUserCountClipboardFormats();
729 NTSTATUS WINAPI NtUserEnumDisplayDevices( UNICODE_STRING *device, DWORD index,
730 DISPLAY_DEVICEW *info, DWORD flags )
732 if (!unix_funcs) return FALSE;
733 return unix_funcs->pNtUserEnumDisplayDevices( device, index, info, flags );
736 BOOL WINAPI NtUserEnumDisplayMonitors( HDC hdc, RECT *rect, MONITORENUMPROC proc, LPARAM lp )
738 if (!unix_funcs) return FALSE;
739 return unix_funcs->pNtUserEnumDisplayMonitors( hdc, rect, proc, lp );
742 BOOL WINAPI NtUserEnumDisplaySettings( UNICODE_STRING *device, DWORD mode,
743 DEVMODEW *dev_mode, DWORD flags )
745 if (!unix_funcs) return FALSE;
746 return unix_funcs->pNtUserEnumDisplaySettings( device, mode, dev_mode, flags );
749 LONG WINAPI NtUserGetDisplayConfigBufferSizes( UINT32 flags, UINT32 *num_path_info,
750 UINT32 *num_mode_info )
752 if (!unix_funcs) return ERROR_NOT_SUPPORTED;
753 return unix_funcs->pNtUserGetDisplayConfigBufferSizes( flags, num_path_info, num_mode_info );
756 UINT WINAPI NtUserGetKeyboardLayoutList( INT size, HKL *layouts )
758 if (!unix_funcs) return 0;
759 return unix_funcs->pNtUserGetKeyboardLayoutList( size, layouts );
762 INT WINAPI NtUserGetKeyNameText( LONG lparam, WCHAR *buffer, INT size )
764 if (!unix_funcs) return 0;
765 return unix_funcs->pNtUserGetKeyNameText( lparam, buffer, size );
768 INT WINAPI NtUserGetPriorityClipboardFormat( UINT *list, INT count )
770 if (!unix_funcs) return 0;
771 return unix_funcs->pNtUserGetPriorityClipboardFormat( list, count );
774 BOOL WINAPI NtUserGetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size )
776 if (!unix_funcs) return FALSE;
777 return unix_funcs->pNtUserGetUpdatedClipboardFormats( formats, size, out_size );
780 BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format )
782 if (!unix_funcs) return FALSE;
783 return unix_funcs->pNtUserIsClipboardFormatAvailable( format );
786 UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout )
788 if (!unix_funcs) return -1;
789 return unix_funcs->pNtUserMapVirtualKeyEx( code, type, layout );
792 BOOL WINAPI NtUserScrollDC( HDC hdc, INT dx, INT dy, const RECT *scroll, const RECT *clip,
793 HRGN ret_update_rgn, RECT *update_rect )
795 if (!unix_funcs) return FALSE;
796 return unix_funcs->pNtUserScrollDC( hdc, dx, dy, scroll, clip, ret_update_rgn, update_rect );
799 HPALETTE WINAPI NtUserSelectPalette( HDC hdc, HPALETTE hpal, WORD bkg )
801 if (!unix_funcs) return 0;
802 return unix_funcs->pNtUserSelectPalette( hdc, hpal, bkg );
805 BOOL WINAPI NtUserSetSysColors( INT count, const INT *colors, const COLORREF *values )
807 if (!unix_funcs) return FALSE;
808 return unix_funcs->pNtUserSetSysColors( count, colors, values );
811 INT WINAPI NtUserShowCursor( BOOL show )
813 if (!unix_funcs) return 0;
814 return unix_funcs->pNtUserShowCursor( show );
817 BOOL WINAPI NtUserSystemParametersInfo( UINT action, UINT val, PVOID ptr, UINT winini )
819 if (!unix_funcs) return FALSE;
820 return unix_funcs->pNtUserSystemParametersInfo( action, val, ptr, winini );
823 BOOL WINAPI NtUserSystemParametersInfoForDpi( UINT action, UINT val, PVOID ptr, UINT winini, UINT dpi )
825 if (!unix_funcs) return FALSE;
826 return unix_funcs->pNtUserSystemParametersInfoForDpi( action, val, ptr, winini, dpi );
829 INT WINAPI NtUserToUnicodeEx( UINT virt, UINT scan, const BYTE *state,
830 WCHAR *str, int size, UINT flags, HKL layout )
832 if (!unix_funcs) return 0;
833 return unix_funcs->pNtUserToUnicodeEx( virt, scan, state, str, size, flags, layout );
836 BOOL WINAPI NtUserUnregisterHotKey( HWND hwnd, INT id )
838 if (!unix_funcs) return FALSE;
839 return unix_funcs->pNtUserUnregisterHotKey( hwnd, id );
842 WORD WINAPI NtUserVkKeyScanEx( WCHAR chr, HKL layout )
844 if (!unix_funcs) return 0;
845 return unix_funcs->pNtUserVkKeyScanEx( chr, layout );
848 DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc )
850 if (!unix_funcs) return 0;
851 return unix_funcs->pGetDCHook( hdc, proc );
854 BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC proc, DWORD_PTR data )
856 if (!unix_funcs) return FALSE;
857 return unix_funcs->pSetDCHook( hdc, proc, data );
860 INT WINAPI SetDIBits( HDC hdc, HBITMAP hbitmap, UINT startscan,
861 UINT lines, const void *bits, const BITMAPINFO *info,
862 UINT coloruse )
864 if (!unix_funcs) return 0;
865 return unix_funcs->pSetDIBits( hdc, hbitmap, startscan, lines, bits, info, coloruse );
868 WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
870 if (!unix_funcs) return 0;
871 return unix_funcs->pSetHookFlags( hdc, flags );
874 BOOL CDECL __wine_get_icm_profile( HDC hdc, BOOL allow_default, DWORD *size, WCHAR *filename )
876 if (!unix_funcs) return FALSE;
877 return unix_funcs->get_icm_profile( hdc, allow_default, size, filename );
880 void CDECL __wine_set_visible_region( HDC hdc, HRGN hrgn, const RECT *vis_rect, const RECT *device_rect,
881 struct window_surface *surface )
883 if (!unix_funcs) return;
884 unix_funcs->set_visible_region( hdc, hrgn, vis_rect, device_rect, surface );
887 BOOL CDECL __wine_get_brush_bitmap_info( HBRUSH handle, BITMAPINFO *info, void *bits, UINT *usage )
889 if (!unix_funcs) return FALSE;
890 return unix_funcs->get_brush_bitmap_info( handle, info, bits, usage );
893 BOOL CDECL __wine_get_file_outline_text_metric( const WCHAR *path, OUTLINETEXTMETRICW *otm )
895 if (!unix_funcs) return FALSE;
896 return unix_funcs->get_file_outline_text_metric( path, otm );
899 const struct vulkan_funcs * CDECL __wine_get_vulkan_driver(UINT version)
901 if (!unix_funcs) return NULL;
902 return unix_funcs->get_vulkan_driver( version );
905 struct opengl_funcs * CDECL __wine_get_wgl_driver( HDC hdc, UINT version )
907 if (!unix_funcs) return NULL;
908 return unix_funcs->get_wgl_driver( hdc, version );
911 /***********************************************************************
912 * __wine_set_display_driver (win32u.@)
914 void CDECL __wine_set_display_driver( struct user_driver_funcs *funcs, UINT version )
916 if (!unix_funcs) return;
917 return unix_funcs->set_display_driver( funcs, version );
920 static void *get_user_proc( const char *name, BOOL force_load )
922 ANSI_STRING name_str;
923 FARPROC proc = NULL;
924 static HMODULE user32;
926 if (!user32)
928 UNICODE_STRING str;
929 NTSTATUS status;
930 RtlInitUnicodeString( &str, L"user32.dll" );
931 status = force_load
932 ? LdrLoadDll( NULL, 0, &str, &user32 )
933 : LdrGetDllHandle( NULL, 0, &str, &user32 );
934 if (status < 0) return NULL;
936 RtlInitAnsiString( &name_str, name );
937 LdrGetProcedureAddress( user32, &name_str, 0, (void**)&proc );
938 return proc;
941 static HWND WINAPI call_GetDesktopWindow(void)
943 static HWND (WINAPI *pGetDesktopWindow)(void);
944 if (!pGetDesktopWindow)
945 pGetDesktopWindow = get_user_proc( "GetDesktopWindow", TRUE );
946 return pGetDesktopWindow ? pGetDesktopWindow() : NULL;
949 static BOOL WINAPI call_GetWindowRect( HWND hwnd, LPRECT rect )
951 static BOOL (WINAPI *pGetWindowRect)( HWND hwnd, LPRECT rect );
952 if (!pGetWindowRect)
953 pGetWindowRect = get_user_proc( "GetWindowRect", FALSE );
954 return pGetWindowRect && pGetWindowRect( hwnd, rect );
957 static BOOL WINAPI call_RedrawWindow( HWND hwnd, const RECT *rect, HRGN rgn, UINT flags )
959 static BOOL (WINAPI *pRedrawWindow)( HWND, const RECT*, HRGN, UINT );
960 if (!pRedrawWindow)
961 pRedrawWindow = get_user_proc( "RedrawWindow", FALSE );
962 return pRedrawWindow && pRedrawWindow( hwnd, rect, rgn, flags );
965 static LRESULT WINAPI call_SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
966 UINT flags, UINT timeout, PDWORD_PTR res_ptr )
968 static LRESULT (WINAPI *pSendMessageTimeoutW)( HWND, UINT, WPARAM, LPARAM, UINT, UINT, PDWORD_PTR );
969 if (!pSendMessageTimeoutW) pSendMessageTimeoutW = get_user_proc( "SendMessageTimeoutW", FALSE );
970 if (!pSendMessageTimeoutW) return 0;
971 return pSendMessageTimeoutW( hwnd, msg, wparam, lparam, flags, timeout, res_ptr );
974 static HWND WINAPI call_WindowFromDC( HDC hdc )
976 static HWND (WINAPI *pWindowFromDC)( HDC );
977 if (!pWindowFromDC)
978 pWindowFromDC = get_user_proc( "WindowFromDC", FALSE );
979 return pWindowFromDC ? pWindowFromDC( hdc ) : NULL;
982 static const struct user_callbacks user_funcs =
984 call_GetDesktopWindow,
985 call_GetWindowRect,
986 call_RedrawWindow,
987 call_SendMessageTimeoutW,
988 call_WindowFromDC,
991 extern void wrappers_init( unixlib_handle_t handle )
993 const void *args = &user_funcs;
994 if (!__wine_unix_call( handle, 1, &args )) unix_funcs = args;