2001-07-27 21:37:31 +02:00
|
|
|
/*
|
|
|
|
* Graphics driver management functions
|
|
|
|
*
|
2004-02-12 03:17:51 +01:00
|
|
|
* Copyright 1994 Bob Amstadt
|
|
|
|
* Copyright 1996, 2001 Alexandre Julliard
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-07-27 21:37:31 +02:00
|
|
|
*/
|
|
|
|
|
2021-09-29 14:09:21 +02:00
|
|
|
#if 0
|
|
|
|
#pragma makedep unix
|
|
|
|
#endif
|
|
|
|
|
2011-03-16 21:45:39 +01:00
|
|
|
#include <assert.h>
|
2021-10-04 16:03:13 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2019-03-14 09:49:14 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2021-07-09 15:28:26 +02:00
|
|
|
#include "ntgdi_private.h"
|
2022-02-17 15:42:36 +01:00
|
|
|
#include "ntuser_private.h"
|
|
|
|
#include "wine/winbase16.h"
|
2010-04-20 13:20:49 +02:00
|
|
|
#include "wine/list.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2001-07-27 21:37:31 +02:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(driver);
|
2022-03-09 15:20:48 +01:00
|
|
|
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
2001-07-27 21:37:31 +02:00
|
|
|
|
2019-06-05 17:18:25 +02:00
|
|
|
struct d3dkmt_adapter
|
|
|
|
{
|
|
|
|
D3DKMT_HANDLE handle; /* Kernel mode graphics adapter handle */
|
|
|
|
struct list entry; /* List entry */
|
|
|
|
};
|
|
|
|
|
2019-06-05 17:18:52 +02:00
|
|
|
struct d3dkmt_device
|
|
|
|
{
|
|
|
|
D3DKMT_HANDLE handle; /* Kernel mode graphics device handle*/
|
|
|
|
struct list entry; /* List entry */
|
|
|
|
};
|
|
|
|
|
2021-11-11 14:13:45 +01:00
|
|
|
static const struct user_driver_funcs lazy_load_driver;
|
2022-03-09 15:20:48 +01:00
|
|
|
static struct user_driver_funcs null_user_driver;
|
2003-08-13 01:50:54 +02:00
|
|
|
|
2019-06-05 17:18:25 +02:00
|
|
|
static struct list d3dkmt_adapters = LIST_INIT( d3dkmt_adapters );
|
2019-06-05 17:18:52 +02:00
|
|
|
static struct list d3dkmt_devices = LIST_INIT( d3dkmt_devices );
|
2019-06-05 17:18:25 +02:00
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
static pthread_mutex_t driver_lock = PTHREAD_MUTEX_INITIALIZER;
|
2022-03-09 15:20:48 +01:00
|
|
|
static WCHAR driver_load_error[80];
|
2013-10-29 12:39:46 +01:00
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_AbortDoc( PHYSDEV dev )
|
2011-03-08 21:36:52 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2011-03-18 12:59:26 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
|
2011-09-07 15:36:58 +02:00
|
|
|
{
|
2021-11-11 14:13:45 +01:00
|
|
|
if (!user_driver->dc_funcs.pCreateCompatibleDC) return TRUE;
|
2021-11-11 14:13:29 +01:00
|
|
|
return user_driver->dc_funcs.pCreateCompatibleDC( NULL, pdev );
|
2011-09-07 15:36:58 +02:00
|
|
|
}
|
|
|
|
|
2021-09-29 14:07:26 +02:00
|
|
|
static BOOL CDECL nulldrv_CreateDC( PHYSDEV *dev, LPCWSTR device, LPCWSTR output,
|
|
|
|
const DEVMODEW *devmode )
|
2011-03-16 21:45:39 +01:00
|
|
|
{
|
|
|
|
assert(0); /* should never be called */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_DeleteDC( PHYSDEV dev )
|
2011-03-16 21:45:39 +01:00
|
|
|
{
|
|
|
|
assert(0); /* should never be called */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_DeleteObject( PHYSDEV dev, HGDIOBJ obj )
|
2011-03-09 21:19:09 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_EndDoc( PHYSDEV dev )
|
2011-03-08 21:36:52 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_EndPage( PHYSDEV dev )
|
2011-03-08 21:36:52 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_EnumFonts( PHYSDEV dev, LOGFONTW *logfont, FONTENUMPROCW proc, LPARAM lParam )
|
2011-03-15 20:42:49 +01:00
|
|
|
{
|
2011-10-19 15:34:21 +02:00
|
|
|
return TRUE;
|
2011-03-15 20:42:49 +01:00
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_ExtEscape( PHYSDEV dev, INT escape, INT in_size, const void *in_data,
|
2011-03-11 12:15:38 +01:00
|
|
|
INT out_size, void *out_data )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_FontIsLinked( PHYSDEV dev )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
|
2012-04-10 16:17:14 +02:00
|
|
|
{
|
|
|
|
return DCB_RESET;
|
|
|
|
}
|
|
|
|
|
2021-08-27 14:51:49 +02:00
|
|
|
static BOOL CDECL nulldrv_GetCharABCWidths( PHYSDEV dev, UINT first, UINT count,
|
|
|
|
WCHAR *chars, ABC *abc )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetCharABCWidthsI( PHYSDEV dev, UINT first, UINT count, WORD *indices, LPABC abc )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-08-26 14:45:15 +02:00
|
|
|
static BOOL CDECL nulldrv_GetCharWidth( PHYSDEV dev, UINT first, UINT count,
|
|
|
|
const WCHAR *chars, INT *buffer )
|
2011-03-15 20:42:49 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetCharWidthInfo( PHYSDEV dev, void *info )
|
2019-04-09 11:32:59 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
2011-03-16 22:04:51 +01:00
|
|
|
{
|
2017-05-18 12:54:45 +02:00
|
|
|
int bpp;
|
|
|
|
|
|
|
|
switch (cap)
|
2011-03-16 22:04:51 +01:00
|
|
|
{
|
2017-05-18 12:54:45 +02:00
|
|
|
case DRIVERVERSION: return 0x4000;
|
|
|
|
case TECHNOLOGY: return DT_RASDISPLAY;
|
2021-09-24 12:56:00 +02:00
|
|
|
case HORZSIZE: return muldiv( NtGdiGetDeviceCaps( dev->hdc, HORZRES ), 254,
|
2021-09-14 21:52:46 +02:00
|
|
|
NtGdiGetDeviceCaps( dev->hdc, LOGPIXELSX ) * 10 );
|
2021-09-24 12:56:00 +02:00
|
|
|
case VERTSIZE: return muldiv( NtGdiGetDeviceCaps( dev->hdc, VERTRES ), 254,
|
2021-09-14 21:52:46 +02:00
|
|
|
NtGdiGetDeviceCaps( dev->hdc, LOGPIXELSY ) * 10 );
|
2021-01-24 05:14:20 +01:00
|
|
|
case HORZRES:
|
|
|
|
{
|
|
|
|
DC *dc = get_nulldrv_dc( dev );
|
2021-12-06 03:16:10 +01:00
|
|
|
RECT rect;
|
2021-09-29 14:08:05 +02:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (dc->display[0])
|
2021-01-24 05:14:20 +01:00
|
|
|
{
|
2021-12-06 03:16:10 +01:00
|
|
|
rect = get_display_rect( dc->display );
|
|
|
|
if (!IsRectEmpty( &rect )) return rect.right - rect.left;
|
2021-01-24 05:14:20 +01:00
|
|
|
}
|
|
|
|
|
2021-12-06 03:16:10 +01:00
|
|
|
ret = get_system_metrics( SM_CXSCREEN );
|
2021-09-29 14:08:05 +02:00
|
|
|
return ret ? ret : 640;
|
2021-01-24 05:14:20 +01:00
|
|
|
}
|
|
|
|
case VERTRES:
|
|
|
|
{
|
|
|
|
DC *dc = get_nulldrv_dc( dev );
|
2021-12-06 03:16:10 +01:00
|
|
|
RECT rect;
|
2021-09-29 14:08:05 +02:00
|
|
|
int ret;
|
|
|
|
|
2021-12-06 03:16:10 +01:00
|
|
|
if (dc->display[0])
|
2021-01-24 05:14:20 +01:00
|
|
|
{
|
2021-12-06 03:16:10 +01:00
|
|
|
rect = get_display_rect( dc->display );
|
|
|
|
if (!IsRectEmpty( &rect )) return rect.bottom - rect.top;
|
2021-01-24 05:14:20 +01:00
|
|
|
}
|
|
|
|
|
2021-12-06 03:16:10 +01:00
|
|
|
ret = get_system_metrics( SM_CYSCREEN );
|
2021-09-29 14:08:05 +02:00
|
|
|
return ret ? ret : 480;
|
2021-01-24 05:14:20 +01:00
|
|
|
}
|
2021-05-31 10:12:44 +02:00
|
|
|
case BITSPIXEL:
|
|
|
|
{
|
2021-12-01 16:02:43 +01:00
|
|
|
UNICODE_STRING display;
|
2021-05-31 10:12:44 +02:00
|
|
|
DEVMODEW devmode;
|
|
|
|
DC *dc;
|
|
|
|
|
2021-12-01 16:02:43 +01:00
|
|
|
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
|
2021-05-31 10:12:44 +02:00
|
|
|
{
|
|
|
|
dc = get_nulldrv_dc( dev );
|
|
|
|
memset( &devmode, 0, sizeof(devmode) );
|
|
|
|
devmode.dmSize = sizeof(devmode);
|
2021-12-01 16:02:43 +01:00
|
|
|
init_unicode_string( &display, dc->display );
|
|
|
|
if (NtUserEnumDisplaySettings( &display, ENUM_CURRENT_SETTINGS, &devmode, 0 ) &&
|
|
|
|
(devmode.dmFields & DM_BITSPERPEL) && devmode.dmBitsPerPel)
|
2021-05-31 10:12:44 +02:00
|
|
|
return devmode.dmBitsPerPel;
|
|
|
|
}
|
|
|
|
return 32;
|
|
|
|
}
|
2017-05-18 12:54:45 +02:00
|
|
|
case PLANES: return 1;
|
|
|
|
case NUMBRUSHES: return -1;
|
|
|
|
case NUMPENS: return -1;
|
|
|
|
case NUMMARKERS: return 0;
|
|
|
|
case NUMFONTS: return 0;
|
|
|
|
case PDEVICESIZE: return 0;
|
|
|
|
case CURVECAPS: return (CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES | CC_WIDE |
|
|
|
|
CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT);
|
|
|
|
case LINECAPS: return (LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
|
|
|
|
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS);
|
|
|
|
case POLYGONALCAPS: return (PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON | PC_SCANLINE |
|
|
|
|
PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS);
|
|
|
|
case TEXTCAPS: return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
|
|
|
|
TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
|
|
|
|
TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
|
|
|
|
case CLIPCAPS: return CP_RECTANGLE;
|
|
|
|
case RASTERCAPS: return (RC_BITBLT | RC_BITMAP64 | RC_GDI20_OUTPUT | RC_DI_BITMAP | RC_DIBTODEV |
|
|
|
|
RC_BIGFONT | RC_STRETCHBLT | RC_FLOODFILL | RC_STRETCHDIB | RC_DEVBITS |
|
2021-09-14 21:52:46 +02:00
|
|
|
(NtGdiGetDeviceCaps( dev->hdc, SIZEPALETTE ) ? RC_PALETTE : 0));
|
2017-05-18 12:54:45 +02:00
|
|
|
case ASPECTX: return 36;
|
|
|
|
case ASPECTY: return 36;
|
2021-09-14 21:52:46 +02:00
|
|
|
case ASPECTXY: return (int)(hypot( NtGdiGetDeviceCaps( dev->hdc, ASPECTX ),
|
|
|
|
NtGdiGetDeviceCaps( dev->hdc, ASPECTY )) + 0.5);
|
2017-05-18 12:54:45 +02:00
|
|
|
case CAPS1: return 0;
|
|
|
|
case SIZEPALETTE: return 0;
|
|
|
|
case NUMRESERVED: return 20;
|
|
|
|
case PHYSICALWIDTH: return 0;
|
|
|
|
case PHYSICALHEIGHT: return 0;
|
|
|
|
case PHYSICALOFFSETX: return 0;
|
|
|
|
case PHYSICALOFFSETY: return 0;
|
|
|
|
case SCALINGFACTORX: return 0;
|
|
|
|
case SCALINGFACTORY: return 0;
|
2021-01-24 05:14:32 +01:00
|
|
|
case VREFRESH:
|
|
|
|
{
|
2021-12-01 16:02:43 +01:00
|
|
|
UNICODE_STRING display;
|
2021-01-24 05:14:32 +01:00
|
|
|
DEVMODEW devmode;
|
|
|
|
DC *dc;
|
|
|
|
|
2021-09-14 21:52:46 +02:00
|
|
|
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) != DT_RASDISPLAY)
|
2021-01-24 05:14:32 +01:00
|
|
|
return 0;
|
|
|
|
|
2021-12-01 16:02:43 +01:00
|
|
|
dc = get_nulldrv_dc( dev );
|
2021-01-24 05:14:32 +01:00
|
|
|
|
2021-12-01 16:02:43 +01:00
|
|
|
memset( &devmode, 0, sizeof(devmode) );
|
|
|
|
devmode.dmSize = sizeof(devmode);
|
|
|
|
init_unicode_string( &display, dc->display );
|
|
|
|
if (NtUserEnumDisplaySettings( &display, ENUM_CURRENT_SETTINGS, &devmode, 0 ) &&
|
|
|
|
devmode.dmDisplayFrequency)
|
|
|
|
return devmode.dmDisplayFrequency;
|
2021-01-24 05:14:32 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2018-08-22 12:56:53 +02:00
|
|
|
case DESKTOPHORZRES:
|
2021-12-02 01:14:12 +01:00
|
|
|
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
|
2018-08-22 12:56:53 +02:00
|
|
|
{
|
2021-12-06 03:15:59 +01:00
|
|
|
RECT rect = get_virtual_screen_rect( 0 );
|
2021-12-02 01:14:12 +01:00
|
|
|
return rect.right - rect.left;
|
2018-08-22 12:56:53 +02:00
|
|
|
}
|
2021-09-14 21:52:46 +02:00
|
|
|
return NtGdiGetDeviceCaps( dev->hdc, HORZRES );
|
2018-08-22 12:56:53 +02:00
|
|
|
case DESKTOPVERTRES:
|
2021-12-02 01:14:12 +01:00
|
|
|
if (NtGdiGetDeviceCaps( dev->hdc, TECHNOLOGY ) == DT_RASDISPLAY)
|
2018-08-22 12:56:53 +02:00
|
|
|
{
|
2021-12-06 03:15:59 +01:00
|
|
|
RECT rect = get_virtual_screen_rect( 0 );
|
2021-12-02 01:14:12 +01:00
|
|
|
return rect.bottom - rect.top;
|
2018-08-22 12:56:53 +02:00
|
|
|
}
|
2021-09-14 21:52:46 +02:00
|
|
|
return NtGdiGetDeviceCaps( dev->hdc, VERTRES );
|
2017-05-18 12:54:45 +02:00
|
|
|
case BLTALIGNMENT: return 0;
|
|
|
|
case SHADEBLENDCAPS: return 0;
|
|
|
|
case COLORMGMTCAPS: return 0;
|
|
|
|
case LOGPIXELSX:
|
2018-04-12 13:25:16 +02:00
|
|
|
case LOGPIXELSY: return get_system_dpi();
|
2017-05-18 12:54:45 +02:00
|
|
|
case NUMCOLORS:
|
2021-09-14 21:52:46 +02:00
|
|
|
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
|
2017-05-18 12:54:45 +02:00
|
|
|
return (bpp > 8) ? -1 : (1 << bpp);
|
|
|
|
case COLORRES:
|
|
|
|
/* The observed correspondence between BITSPIXEL and COLORRES is:
|
|
|
|
* BITSPIXEL: 8 -> COLORRES: 18
|
|
|
|
* BITSPIXEL: 16 -> COLORRES: 16
|
|
|
|
* BITSPIXEL: 24 -> COLORRES: 24
|
|
|
|
* BITSPIXEL: 32 -> COLORRES: 24 */
|
2021-09-14 21:52:46 +02:00
|
|
|
bpp = NtGdiGetDeviceCaps( dev->hdc, BITSPIXEL );
|
2017-05-18 12:54:45 +02:00
|
|
|
return (bpp <= 8) ? 18 : min( 24, bpp );
|
|
|
|
default:
|
|
|
|
FIXME("(%p): unsupported capability %d, will return 0\n", dev->hdc, cap );
|
|
|
|
return 0;
|
2011-03-16 22:04:51 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
2011-03-11 12:33:34 +01:00
|
|
|
{
|
2012-01-06 17:45:16 +01:00
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
2011-03-11 12:33:34 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetFontData( PHYSDEV dev, DWORD table, DWORD offset, LPVOID buffer, DWORD length )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetFontRealizationInfo( PHYSDEV dev, void *info )
|
2015-08-29 18:54:17 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetFontUnicodeRanges( PHYSDEV dev, LPGLYPHSET glyphs )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetGlyphIndices( PHYSDEV dev, LPCWSTR str, INT count, LPWORD indices, DWORD flags )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return GDI_ERROR;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetGlyphOutline( PHYSDEV dev, UINT ch, UINT format, LPGLYPHMETRICS metrics,
|
|
|
|
DWORD size, LPVOID buffer, const MAT2 *mat )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return GDI_ERROR;
|
|
|
|
}
|
|
|
|
|
2021-09-09 14:01:51 +02:00
|
|
|
static BOOL CDECL nulldrv_GetICMProfile( PHYSDEV dev, BOOL allow_default, LPDWORD size, LPWSTR filename )
|
2011-03-11 12:33:34 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetImage( PHYSDEV dev, BITMAPINFO *info, struct gdi_image_bits *bits,
|
|
|
|
struct bitblt_coords *src )
|
2012-05-23 22:26:35 +02:00
|
|
|
{
|
|
|
|
return ERROR_NOT_SUPPORTED;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_GetKerningPairs( PHYSDEV dev, DWORD count, LPKERNINGPAIR pairs )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_GetOutlineTextMetrics( PHYSDEV dev, UINT size, LPOUTLINETEXTMETRICW otm )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD flags )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return DEFAULT_CHARSET;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT *dx )
|
2011-03-15 20:42:49 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT *dx )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name )
|
2011-10-19 21:51:39 +02:00
|
|
|
{
|
2011-10-20 17:14:53 +02:00
|
|
|
INT ret = 0;
|
|
|
|
LOGFONTW font;
|
2016-07-29 16:09:34 +02:00
|
|
|
DC *dc = get_nulldrv_dc( dev );
|
2011-10-20 17:14:53 +02:00
|
|
|
|
2021-09-17 13:44:30 +02:00
|
|
|
if (NtGdiExtGetObjectW( dc->hFont, sizeof(font), &font ))
|
2011-10-20 17:14:53 +02:00
|
|
|
{
|
2020-11-05 10:44:16 +01:00
|
|
|
ret = lstrlenW( font.lfFaceName ) + 1;
|
2011-10-20 17:14:53 +02:00
|
|
|
if (name)
|
|
|
|
{
|
|
|
|
lstrcpynW( name, font.lfFaceName, size );
|
|
|
|
ret = min( size, ret );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
2011-10-19 21:51:39 +02:00
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
|
2011-03-15 20:42:49 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_MoveTo( PHYSDEV dev, INT x, INT y )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_PaintRgn( PHYSDEV dev, HRGN rgn )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
|
2011-03-17 14:54:56 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_PolyPolygon( PHYSDEV dev, const POINT *points, const INT *counts, UINT polygons )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_PolyPolyline( PHYSDEV dev, const POINT *points, const DWORD *counts, DWORD lines )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static DWORD CDECL nulldrv_PutImage( PHYSDEV dev, HRGN clip, BITMAPINFO *info,
|
|
|
|
const struct gdi_image_bits *bits, struct bitblt_coords *src,
|
|
|
|
struct bitblt_coords *dst, DWORD rop )
|
2012-05-23 22:26:35 +02:00
|
|
|
{
|
|
|
|
return ERROR_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_RealizeDefaultPalette( PHYSDEV dev )
|
2011-03-11 18:26:55 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_RealizePalette( PHYSDEV dev, HPALETTE palette, BOOL primary )
|
2011-03-11 18:26:55 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2021-08-23 13:50:47 +02:00
|
|
|
static BOOL CDECL nulldrv_ResetDC( PHYSDEV dev, const DEVMODEW *devmode )
|
2011-03-15 20:17:58 +01:00
|
|
|
{
|
2021-08-23 13:50:47 +02:00
|
|
|
return FALSE;
|
2011-03-15 20:17:58 +01:00
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT ell_width, INT ell_height )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static HBITMAP CDECL nulldrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
|
2011-03-09 21:19:09 +01:00
|
|
|
{
|
|
|
|
return bitmap;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static HBRUSH CDECL nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush, const struct brush_pattern *pattern )
|
2011-03-09 21:19:09 +01:00
|
|
|
{
|
|
|
|
return brush;
|
|
|
|
}
|
|
|
|
|
2020-11-03 11:25:30 +01:00
|
|
|
static HFONT CDECL nulldrv_SelectFont( PHYSDEV dev, HFONT font, UINT *aa_flags )
|
|
|
|
{
|
|
|
|
return font;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static HPEN CDECL nulldrv_SelectPen( PHYSDEV dev, HPEN pen, const struct brush_pattern *pattern )
|
2011-03-09 21:19:09 +01:00
|
|
|
{
|
|
|
|
return pen;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL nulldrv_SetBkColor( PHYSDEV dev, COLORREF color )
|
2011-03-10 21:58:47 +01:00
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static UINT CDECL nulldrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
|
2012-04-25 12:26:44 +02:00
|
|
|
{
|
|
|
|
return DCB_RESET;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
|
2011-03-10 20:42:05 +01:00
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL nulldrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
|
2011-03-10 20:42:05 +01:00
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
|
2011-03-09 16:21:45 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
2011-03-11 12:33:34 +01:00
|
|
|
{
|
2012-01-06 17:45:16 +01:00
|
|
|
SetLastError( ERROR_INVALID_PARAMETER );
|
2011-03-11 12:33:34 +01:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
|
2011-03-08 20:30:03 +01:00
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static COLORREF CDECL nulldrv_SetTextColor( PHYSDEV dev, COLORREF color )
|
2011-03-10 21:58:47 +01:00
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_StartDoc( PHYSDEV dev, const DOCINFOW *info )
|
2011-03-08 21:36:52 +01:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static INT CDECL nulldrv_StartPage( PHYSDEV dev )
|
2011-03-08 21:36:52 +01:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2019-07-06 20:45:50 +02:00
|
|
|
static BOOL CDECL nulldrv_UnrealizePalette( HPALETTE palette )
|
2011-03-16 22:58:07 +01:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2019-10-22 10:38:56 +02:00
|
|
|
static NTSTATUS CDECL nulldrv_D3DKMTCheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc )
|
|
|
|
{
|
|
|
|
return STATUS_PROCEDURE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
static NTSTATUS CDECL nulldrv_D3DKMTSetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc )
|
|
|
|
{
|
|
|
|
return STATUS_PROCEDURE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2011-10-17 20:39:54 +02:00
|
|
|
const struct gdi_dc_funcs null_driver =
|
2011-03-08 19:37:08 +01:00
|
|
|
{
|
2011-03-08 21:36:52 +01:00
|
|
|
nulldrv_AbortDoc, /* pAbortDoc */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_AbortPath, /* pAbortPath */
|
2011-03-18 12:59:26 +01:00
|
|
|
nulldrv_AlphaBlend, /* pAlphaBlend */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_AngleArc, /* pAngleArc */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_Arc, /* pArc */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_ArcTo, /* pArcTo */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_BeginPath, /* pBeginPath */
|
2011-09-14 11:57:45 +02:00
|
|
|
nulldrv_BlendImage, /* pBlendImage */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_Chord, /* pChord */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_CloseFigure, /* pCloseFigure */
|
2011-09-07 15:36:58 +02:00
|
|
|
nulldrv_CreateCompatibleDC, /* pCreateCompatibleDC */
|
2011-03-16 21:45:39 +01:00
|
|
|
nulldrv_CreateDC, /* pCreateDC */
|
|
|
|
nulldrv_DeleteDC, /* pDeleteDC */
|
2011-03-09 21:19:09 +01:00
|
|
|
nulldrv_DeleteObject, /* pDeleteObject */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_Ellipse, /* pEllipse */
|
2011-03-08 21:36:52 +01:00
|
|
|
nulldrv_EndDoc, /* pEndDoc */
|
|
|
|
nulldrv_EndPage, /* pEndPage */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_EndPath, /* pEndPath */
|
2011-10-19 15:37:10 +02:00
|
|
|
nulldrv_EnumFonts, /* pEnumFonts */
|
2011-03-11 12:15:38 +01:00
|
|
|
nulldrv_ExtEscape, /* pExtEscape */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_ExtFloodFill, /* pExtFloodFill */
|
2011-03-15 20:42:49 +01:00
|
|
|
nulldrv_ExtTextOut, /* pExtTextOut */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_FillPath, /* pFillPath */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_FillRgn, /* pFillRgn */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_FontIsLinked, /* pFontIsLinked */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_FrameRgn, /* pFrameRgn */
|
2012-04-10 16:17:14 +02:00
|
|
|
nulldrv_GetBoundsRect, /* pGetBoundsRect */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetCharABCWidths, /* pGetCharABCWidths */
|
|
|
|
nulldrv_GetCharABCWidthsI, /* pGetCharABCWidthsI */
|
2011-03-15 20:42:49 +01:00
|
|
|
nulldrv_GetCharWidth, /* pGetCharWidth */
|
2019-04-09 11:32:59 +02:00
|
|
|
nulldrv_GetCharWidthInfo, /* pGetCharWidthInfo */
|
2011-03-16 22:04:51 +01:00
|
|
|
nulldrv_GetDeviceCaps, /* pGetDeviceCaps */
|
2011-03-11 12:33:34 +01:00
|
|
|
nulldrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetFontData, /* pGetFontData */
|
2015-08-29 18:54:17 +02:00
|
|
|
nulldrv_GetFontRealizationInfo, /* pGetFontRealizationInfo */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetFontUnicodeRanges, /* pGetFontUnicodeRanges */
|
|
|
|
nulldrv_GetGlyphIndices, /* pGetGlyphIndices */
|
|
|
|
nulldrv_GetGlyphOutline, /* pGetGlyphOutline */
|
2011-03-11 12:33:34 +01:00
|
|
|
nulldrv_GetICMProfile, /* pGetICMProfile */
|
2011-07-14 11:30:58 +02:00
|
|
|
nulldrv_GetImage, /* pGetImage */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetKerningPairs, /* pGetKerningPairs */
|
2011-03-11 18:26:55 +01:00
|
|
|
nulldrv_GetNearestColor, /* pGetNearestColor */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetOutlineTextMetrics, /* pGetOutlineTextMetrics */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_GetPixel, /* pGetPixel */
|
2011-03-11 18:26:55 +01:00
|
|
|
nulldrv_GetSystemPaletteEntries, /* pGetSystemPaletteEntries */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetTextCharsetInfo, /* pGetTextCharsetInfo */
|
2011-03-15 20:42:49 +01:00
|
|
|
nulldrv_GetTextExtentExPoint, /* pGetTextExtentExPoint */
|
2011-10-19 21:51:39 +02:00
|
|
|
nulldrv_GetTextExtentExPointI, /* pGetTextExtentExPointI */
|
|
|
|
nulldrv_GetTextFace, /* pGetTextFace */
|
2011-03-15 20:42:49 +01:00
|
|
|
nulldrv_GetTextMetrics, /* pGetTextMetrics */
|
2011-10-31 23:51:38 +01:00
|
|
|
nulldrv_GradientFill, /* pGradientFill */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_InvertRgn, /* pInvertRgn */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_LineTo, /* pLineTo */
|
|
|
|
nulldrv_MoveTo, /* pMoveTo */
|
|
|
|
nulldrv_PaintRgn, /* pPaintRgn */
|
2011-03-17 14:54:56 +01:00
|
|
|
nulldrv_PatBlt, /* pPatBlt */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_Pie, /* pPie */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_PolyBezier, /* pPolyBezier */
|
|
|
|
nulldrv_PolyBezierTo, /* pPolyBezierTo */
|
|
|
|
nulldrv_PolyDraw, /* pPolyDraw */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_PolyPolygon, /* pPolyPolygon */
|
|
|
|
nulldrv_PolyPolyline, /* pPolyPolyline */
|
2011-03-08 21:15:59 +01:00
|
|
|
nulldrv_PolylineTo, /* pPolylineTo */
|
2011-07-14 11:30:58 +02:00
|
|
|
nulldrv_PutImage, /* pPutImage */
|
2011-03-11 18:26:55 +01:00
|
|
|
nulldrv_RealizeDefaultPalette, /* pRealizeDefaultPalette */
|
|
|
|
nulldrv_RealizePalette, /* pRealizePalette */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_Rectangle, /* pRectangle */
|
2011-03-15 20:17:58 +01:00
|
|
|
nulldrv_ResetDC, /* pResetDC */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_RoundRect, /* pRoundRect */
|
2011-03-09 21:19:09 +01:00
|
|
|
nulldrv_SelectBitmap, /* pSelectBitmap */
|
|
|
|
nulldrv_SelectBrush, /* pSelectBrush */
|
|
|
|
nulldrv_SelectFont, /* pSelectFont */
|
|
|
|
nulldrv_SelectPen, /* pSelectPen */
|
2011-03-10 21:58:47 +01:00
|
|
|
nulldrv_SetBkColor, /* pSetBkColor */
|
2012-04-25 12:26:44 +02:00
|
|
|
nulldrv_SetBoundsRect, /* pSetBoundsRect */
|
2011-03-10 20:42:05 +01:00
|
|
|
nulldrv_SetDCBrushColor, /* pSetDCBrushColor */
|
|
|
|
nulldrv_SetDCPenColor, /* pSetDCPenColor */
|
2011-03-16 21:14:24 +01:00
|
|
|
nulldrv_SetDIBitsToDevice, /* pSetDIBitsToDevice */
|
2011-03-09 16:21:45 +01:00
|
|
|
nulldrv_SetDeviceClipping, /* pSetDeviceClipping */
|
2011-03-11 12:33:34 +01:00
|
|
|
nulldrv_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */
|
2011-03-08 20:30:03 +01:00
|
|
|
nulldrv_SetPixel, /* pSetPixel */
|
2011-03-10 21:58:47 +01:00
|
|
|
nulldrv_SetTextColor, /* pSetTextColor */
|
2011-03-08 21:36:52 +01:00
|
|
|
nulldrv_StartDoc, /* pStartDoc */
|
|
|
|
nulldrv_StartPage, /* pStartPage */
|
2011-03-18 12:59:26 +01:00
|
|
|
nulldrv_StretchBlt, /* pStretchBlt */
|
2011-03-18 12:42:56 +01:00
|
|
|
nulldrv_StretchDIBits, /* pStretchDIBits */
|
2011-03-11 20:43:15 +01:00
|
|
|
nulldrv_StrokeAndFillPath, /* pStrokeAndFillPath */
|
|
|
|
nulldrv_StrokePath, /* pStrokePath */
|
2011-03-16 22:58:07 +01:00
|
|
|
nulldrv_UnrealizePalette, /* pUnrealizePalette */
|
2019-10-22 10:38:56 +02:00
|
|
|
nulldrv_D3DKMTCheckVidPnExclusiveOwnership, /* pD3DKMTCheckVidPnExclusiveOwnership */
|
|
|
|
nulldrv_D3DKMTSetVidPnSourceOwner, /* pD3DKMTSetVidPnSourceOwner */
|
2012-05-08 12:16:05 +02:00
|
|
|
|
|
|
|
GDI_PRIORITY_NULL_DRV /* priority */
|
2011-03-08 19:37:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-11-11 14:13:35 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* Null user driver
|
|
|
|
*
|
|
|
|
* These are fallbacks for entry points that are not implemented in the real driver.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_ActivateKeyboardLayout( HKL layout, UINT flags )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_Beep(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT CDECL nulldrv_GetKeyboardLayoutList( INT size, HKL *layouts )
|
|
|
|
{
|
|
|
|
return ~0; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT CDECL nulldrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
|
|
|
|
{
|
|
|
|
return -1; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT CDECL nulldrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
|
|
|
|
{
|
|
|
|
return -1; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT CDECL nulldrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
|
|
|
|
int size, UINT flags, HKL layout )
|
|
|
|
{
|
|
|
|
return -2; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static SHORT CDECL nulldrv_VkKeyScanEx( WCHAR ch, HKL layout )
|
|
|
|
{
|
|
|
|
return -256; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_DestroyCursorIcon( HCURSOR cursor )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetCursor( HCURSOR cursor )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_GetCursorPos( LPPOINT pt )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_SetCursorPos( INT x, INT y )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_ClipCursor( LPCRECT clip )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_UpdateClipboard(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static LONG CDECL nulldrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
|
2021-12-02 01:13:55 +01:00
|
|
|
DWORD flags, LPVOID lparam )
|
2021-11-11 14:13:35 +01:00
|
|
|
{
|
|
|
|
return DISP_CHANGE_FAILED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-30 13:24:28 +01:00
|
|
|
static void CDECL nulldrv_UpdateDisplayDevices( const struct gdi_device_manager *manager,
|
|
|
|
BOOL force, void *param )
|
|
|
|
{
|
2021-12-17 14:57:22 +01:00
|
|
|
manager->add_monitor( NULL, param ); /* use virtual monitor */
|
2021-11-30 13:24:28 +01:00
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:35 +01:00
|
|
|
static BOOL CDECL nulldrv_CreateDesktopWindow( HWND hwnd )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:20:48 +01:00
|
|
|
static BOOL CDECL nodrv_CreateWindow( HWND hwnd )
|
|
|
|
{
|
|
|
|
static int warned;
|
|
|
|
HWND parent = NtUserGetAncestor( hwnd, GA_PARENT );
|
|
|
|
|
|
|
|
/* HWND_MESSAGE windows don't need a graphics driver */
|
|
|
|
if (!parent || parent == get_user_thread_info()->msg_window) return TRUE;
|
|
|
|
if (warned++) return FALSE;
|
|
|
|
|
|
|
|
ERR_(winediag)( "Application tried to create a window, but no driver could be loaded.\n" );
|
|
|
|
if (driver_load_error[0]) ERR_(winediag)( "%s\n", debugstr_w(driver_load_error) );
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:35 +01:00
|
|
|
static BOOL CDECL nulldrv_CreateWindow( HWND hwnd )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_DestroyWindow( HWND hwnd )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_FlashWindowEx( FLASHWINFO *info )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
|
|
|
|
const RECT *top_rect, DWORD flags )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/* helper for kernel32->ntdll timeout format conversion */
|
|
|
|
static inline LARGE_INTEGER *get_nt_timeout( LARGE_INTEGER *time, DWORD timeout )
|
|
|
|
{
|
|
|
|
if (timeout == INFINITE) return NULL;
|
|
|
|
time->QuadPart = (ULONGLONG)timeout * -10000;
|
|
|
|
return time;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HANDLE normalize_std_handle( HANDLE handle )
|
|
|
|
{
|
|
|
|
if (handle == (HANDLE)STD_INPUT_HANDLE)
|
|
|
|
return NtCurrentTeb()->Peb->ProcessParameters->hStdInput;
|
|
|
|
if (handle == (HANDLE)STD_OUTPUT_HANDLE)
|
|
|
|
return NtCurrentTeb()->Peb->ProcessParameters->hStdOutput;
|
|
|
|
if (handle == (HANDLE)STD_ERROR_HANDLE)
|
|
|
|
return NtCurrentTeb()->Peb->ProcessParameters->hStdError;
|
|
|
|
|
|
|
|
return handle;
|
|
|
|
}
|
|
|
|
|
|
|
|
static DWORD CDECL nulldrv_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
|
|
|
|
DWORD mask, DWORD flags )
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
HANDLE hloc[MAXIMUM_WAIT_OBJECTS];
|
|
|
|
LARGE_INTEGER time;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
if (!count && !timeout) return WAIT_TIMEOUT;
|
|
|
|
if (count > MAXIMUM_WAIT_OBJECTS)
|
|
|
|
{
|
|
|
|
SetLastError(ERROR_INVALID_PARAMETER);
|
|
|
|
return WAIT_FAILED;
|
|
|
|
}
|
|
|
|
for (i = 0; i < count; i++) hloc[i] = normalize_std_handle( handles[i] );
|
|
|
|
|
|
|
|
status = NtWaitForMultipleObjects( count, hloc, !(flags & MWMO_WAITALL), !!(flags & MWMO_ALERTABLE),
|
|
|
|
get_nt_timeout( &time, timeout ) );
|
|
|
|
if (HIWORD(status)) /* is it an error code? */
|
|
|
|
{
|
|
|
|
SetLastError( RtlNtStatusToDosError(status) );
|
|
|
|
status = WAIT_FAILED;
|
|
|
|
}
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_ReleaseDC( HWND hwnd, HDC hdc )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_ScrollDC( HDC hdc, INT dx, INT dy, HRGN update )
|
|
|
|
{
|
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
NtGdiGetAppClipBox( hdc, &rect );
|
|
|
|
return NtGdiBitBlt( hdc, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
|
|
|
hdc, rect.left - dx, rect.top - dy, SRCCOPY, 0, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetCapture( HWND hwnd, UINT flags )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetFocus( HWND hwnd )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetParent( HWND hwnd, HWND parent, HWND old_parent )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetWindowStyle( HWND hwnd, INT offset, STYLESTRUCT *style )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_SetWindowText( HWND hwnd, LPCWSTR text )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static UINT CDECL nulldrv_ShowWindow( HWND hwnd, INT cmd, RECT *rect, UINT swp )
|
|
|
|
{
|
|
|
|
return ~0; /* use default implementation */
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
|
|
|
|
const RECT *window_rect )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LRESULT CDECL nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_WindowPosChanging( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|
|
|
const RECT *window_rect, const RECT *client_rect,
|
|
|
|
RECT *visible_rect, struct window_surface **surface )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void CDECL nulldrv_WindowPosChanged( HWND hwnd, HWND insert_after, UINT swp_flags,
|
|
|
|
const RECT *window_rect, const RECT *client_rect,
|
|
|
|
const RECT *visible_rect, const RECT *valid_rects,
|
|
|
|
struct window_surface *surface )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_SystemParametersInfo( UINT action, UINT int_param, void *ptr_param, UINT flags )
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-12-07 15:30:12 +01:00
|
|
|
static const struct vulkan_funcs * CDECL nulldrv_wine_get_vulkan_driver( UINT version )
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2022-03-01 21:59:23 +01:00
|
|
|
static struct opengl_funcs * CDECL nulldrv_wine_get_wgl_driver( UINT version )
|
|
|
|
{
|
|
|
|
return (void *)-1;
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:35 +01:00
|
|
|
static void CDECL nulldrv_ThreadDetach( void )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:20:48 +01:00
|
|
|
static BOOL setup_null_driver(void)
|
|
|
|
{
|
|
|
|
if (user_callbacks)
|
|
|
|
user_callbacks->set_user_driver( &null_user_driver, WINE_GDI_DRIVER_VERSION );
|
|
|
|
else
|
|
|
|
__wine_set_display_driver( &null_user_driver, WINE_GDI_DRIVER_VERSION );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const WCHAR guid_key_prefixW[] =
|
|
|
|
{
|
|
|
|
'\\','R','e','g','i','s','t','r','y',
|
|
|
|
'\\','M','a','c','h','i','n','e',
|
|
|
|
'\\','S','y','s','t','e','m',
|
|
|
|
'\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t',
|
|
|
|
'\\','C','o','n','t','r','o','l',
|
|
|
|
'\\','V','i','d','e','o','\\','{'
|
|
|
|
};
|
|
|
|
static const WCHAR guid_key_suffixW[] = {'}','\\','0','0','0','0'};
|
|
|
|
|
|
|
|
static BOOL load_desktop_driver( HWND hwnd )
|
|
|
|
{
|
|
|
|
WCHAR key[ARRAYSIZE(guid_key_prefixW) + 40 + ARRAYSIZE(guid_key_suffixW)], *ptr;
|
|
|
|
char buf[4096];
|
|
|
|
KEY_VALUE_PARTIAL_INFORMATION *info = (void *)buf;
|
|
|
|
ATOM_BASIC_INFORMATION *abi = (ATOM_BASIC_INFORMATION *)buf;
|
|
|
|
BOOL ret = FALSE;
|
|
|
|
HKEY hkey;
|
|
|
|
DWORD size;
|
|
|
|
UINT guid_atom;
|
|
|
|
|
|
|
|
static const WCHAR prop_nameW[] =
|
|
|
|
{'_','_','w','i','n','e','_','d','i','s','p','l','a','y','_','d','e','v','i','c','e',
|
|
|
|
'_','g','u','i','d',0};
|
|
|
|
|
|
|
|
user_check_not_lock();
|
|
|
|
|
|
|
|
asciiz_to_unicode( driver_load_error, "The explorer process failed to start." ); /* default error */
|
|
|
|
/* wait for graphics driver to be ready */
|
|
|
|
send_message( hwnd, WM_NULL, 0, 0 );
|
|
|
|
|
|
|
|
guid_atom = HandleToULong( NtUserGetProp( hwnd, prop_nameW ));
|
|
|
|
memcpy( key, guid_key_prefixW, sizeof(guid_key_prefixW) );
|
|
|
|
ptr = key + ARRAYSIZE(guid_key_prefixW);
|
|
|
|
if (NtQueryInformationAtom( guid_atom, AtomBasicInformation, buf, sizeof(buf), NULL ))
|
|
|
|
return FALSE;
|
|
|
|
memcpy( ptr, abi->Name, abi->NameLength );
|
|
|
|
ptr += abi->NameLength / sizeof(WCHAR);
|
|
|
|
memcpy( ptr, guid_key_suffixW, sizeof(guid_key_suffixW) );
|
|
|
|
ptr += ARRAY_SIZE(guid_key_suffixW);
|
|
|
|
|
|
|
|
if (!(hkey = reg_open_key( NULL, key, (ptr - key) * sizeof(WCHAR) ))) return FALSE;
|
|
|
|
|
|
|
|
if ((size = query_reg_ascii_value( hkey, "GraphicsDriver", info, sizeof(buf) )))
|
|
|
|
{
|
|
|
|
static const WCHAR nullW[] = {'n','u','l','l',0};
|
|
|
|
TRACE( "trying driver %s\n", debugstr_wn( (const WCHAR *)info->Data,
|
|
|
|
info->DataLength / sizeof(WCHAR) ));
|
|
|
|
if (info->DataLength != sizeof(nullW) || memcmp( info->Data, nullW, sizeof(nullW) ))
|
|
|
|
{
|
|
|
|
void *ret_ptr;
|
|
|
|
ULONG ret_len;
|
|
|
|
ret = KeUserModeCallback( NtUserLoadDriver, info->Data, info->DataLength,
|
|
|
|
&ret_ptr, &ret_len );
|
|
|
|
}
|
|
|
|
else ret = setup_null_driver();
|
|
|
|
}
|
|
|
|
else if ((size = query_reg_ascii_value( hkey, "DriverError", info, sizeof(buf) )))
|
|
|
|
{
|
|
|
|
memcpy( driver_load_error, info->Data, min( info->DataLength, sizeof(driver_load_error) ));
|
|
|
|
driver_load_error[ARRAYSIZE(driver_load_error) - 1] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
NtClose( hkey );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:45 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* Lazy loading user driver
|
|
|
|
*
|
|
|
|
* Initial driver used before another driver is loaded.
|
|
|
|
* Each entry point simply loads the real driver and chains to it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const struct user_driver_funcs *load_driver(void)
|
|
|
|
{
|
2022-03-09 15:20:48 +01:00
|
|
|
USEROBJECTFLAGS flags;
|
|
|
|
HWINSTA winstation;
|
|
|
|
|
|
|
|
if (!load_desktop_driver( get_desktop_window() ) || user_driver == &lazy_load_driver)
|
|
|
|
{
|
|
|
|
winstation = NtUserGetProcessWindowStation();
|
|
|
|
if (!NtUserGetObjectInformation( winstation, UOI_FLAGS, &flags, sizeof(flags), NULL )
|
|
|
|
|| (flags.dwFlags & WSF_VISIBLE))
|
|
|
|
null_user_driver.pCreateWindow = nodrv_CreateWindow;
|
|
|
|
|
|
|
|
setup_null_driver();
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:45 +01:00
|
|
|
return user_driver;
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:20:48 +01:00
|
|
|
/**********************************************************************
|
|
|
|
* get_display_driver
|
|
|
|
*/
|
|
|
|
const struct gdi_dc_funcs *get_display_driver(void)
|
|
|
|
{
|
|
|
|
if (user_driver == &lazy_load_driver) load_driver();
|
|
|
|
return &user_driver->dc_funcs;
|
|
|
|
}
|
|
|
|
|
2021-11-17 12:47:04 +01:00
|
|
|
static BOOL CDECL loaderdrv_ActivateKeyboardLayout( HKL layout, UINT flags )
|
|
|
|
{
|
|
|
|
return load_driver()->pActivateKeyboardLayout( layout, flags );
|
|
|
|
}
|
|
|
|
|
2022-02-14 14:08:05 +01:00
|
|
|
static void CDECL loaderdrv_Beep(void)
|
|
|
|
{
|
|
|
|
load_driver()->pBeep();
|
|
|
|
}
|
|
|
|
|
2021-11-16 12:35:59 +01:00
|
|
|
static INT CDECL loaderdrv_GetKeyNameText( LONG lparam, LPWSTR buffer, INT size )
|
|
|
|
{
|
|
|
|
return load_driver()->pGetKeyNameText( lparam, buffer, size );
|
|
|
|
}
|
|
|
|
|
2021-11-17 12:47:38 +01:00
|
|
|
static UINT CDECL loaderdrv_GetKeyboardLayoutList( INT size, HKL *layouts )
|
|
|
|
{
|
|
|
|
return load_driver()->pGetKeyboardLayoutList( size, layouts );
|
|
|
|
}
|
|
|
|
|
2021-11-16 12:34:17 +01:00
|
|
|
static UINT CDECL loaderdrv_MapVirtualKeyEx( UINT code, UINT type, HKL layout )
|
|
|
|
{
|
|
|
|
return load_driver()->pMapVirtualKeyEx( code, type, layout );
|
|
|
|
}
|
|
|
|
|
2021-11-17 12:46:39 +01:00
|
|
|
static INT CDECL loaderdrv_ToUnicodeEx( UINT virt, UINT scan, const BYTE *state, LPWSTR str,
|
|
|
|
int size, UINT flags, HKL layout )
|
|
|
|
{
|
|
|
|
return load_driver()->pToUnicodeEx( virt, scan, state, str, size, flags, layout );
|
|
|
|
}
|
|
|
|
|
2022-02-24 01:27:57 +01:00
|
|
|
static BOOL CDECL loaderdrv_RegisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
|
|
|
|
{
|
|
|
|
return load_driver()->pRegisterHotKey( hwnd, modifiers, vk );
|
|
|
|
}
|
|
|
|
|
2021-11-17 12:48:13 +01:00
|
|
|
static void CDECL loaderdrv_UnregisterHotKey( HWND hwnd, UINT modifiers, UINT vk )
|
|
|
|
{
|
|
|
|
load_driver()->pUnregisterHotKey( hwnd, modifiers, vk );
|
|
|
|
}
|
|
|
|
|
2021-11-16 12:33:53 +01:00
|
|
|
static SHORT CDECL loaderdrv_VkKeyScanEx( WCHAR ch, HKL layout )
|
|
|
|
{
|
|
|
|
return load_driver()->pVkKeyScanEx( ch, layout );
|
|
|
|
}
|
|
|
|
|
2021-12-02 01:14:35 +01:00
|
|
|
static LONG CDECL loaderdrv_ChangeDisplaySettingsEx( LPCWSTR name, LPDEVMODEW mode, HWND hwnd,
|
|
|
|
DWORD flags, LPVOID lparam )
|
|
|
|
{
|
|
|
|
return load_driver()->pChangeDisplaySettingsEx( name, mode, hwnd, flags, lparam );
|
|
|
|
}
|
|
|
|
|
2021-12-01 16:02:43 +01:00
|
|
|
static BOOL CDECL loaderdrv_EnumDisplaySettingsEx( LPCWSTR name, DWORD num, LPDEVMODEW mode, DWORD flags )
|
|
|
|
{
|
|
|
|
return load_driver()->pEnumDisplaySettingsEx( name, num, mode, flags );
|
|
|
|
}
|
|
|
|
|
2021-12-03 12:55:30 +01:00
|
|
|
static void CDECL loaderdrv_SetCursor( HCURSOR cursor )
|
|
|
|
{
|
|
|
|
load_driver()->pSetCursor( cursor );
|
|
|
|
}
|
|
|
|
|
2022-02-14 14:08:27 +01:00
|
|
|
static BOOL CDECL loaderdrv_GetCursorPos( POINT *pt )
|
|
|
|
{
|
|
|
|
return load_driver()->pGetCursorPos( pt );
|
|
|
|
}
|
|
|
|
|
2022-02-14 14:07:53 +01:00
|
|
|
static BOOL CDECL loaderdrv_SetCursorPos( INT x, INT y )
|
|
|
|
{
|
|
|
|
return load_driver()->pSetCursorPos( x, y );
|
|
|
|
}
|
|
|
|
|
2022-02-14 14:07:25 +01:00
|
|
|
static BOOL CDECL loaderdrv_ClipCursor( const RECT *clip )
|
|
|
|
{
|
|
|
|
return load_driver()->pClipCursor( clip );
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:45 +01:00
|
|
|
static void CDECL loaderdrv_UpdateClipboard(void)
|
|
|
|
{
|
|
|
|
load_driver()->pUpdateClipboard();
|
|
|
|
}
|
|
|
|
|
2021-11-30 13:24:28 +01:00
|
|
|
static void CDECL loaderdrv_UpdateDisplayDevices( const struct gdi_device_manager *manager,
|
|
|
|
BOOL force, void *param )
|
|
|
|
{
|
|
|
|
load_driver()->pUpdateDisplayDevices( manager, force, param );
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:20:48 +01:00
|
|
|
static BOOL CDECL loaderdrv_CreateDesktopWindow( HWND hwnd )
|
|
|
|
{
|
|
|
|
return load_driver()->pCreateDesktopWindow( hwnd );
|
|
|
|
}
|
|
|
|
|
2022-03-14 11:43:55 +01:00
|
|
|
static void CDECL loaderdrv_GetDC( HDC hdc, HWND hwnd, HWND top_win, const RECT *win_rect,
|
|
|
|
const RECT *top_rect, DWORD flags )
|
|
|
|
{
|
|
|
|
load_driver()->pGetDC( hdc, hwnd, top_win, win_rect, top_rect, flags );
|
|
|
|
}
|
|
|
|
|
2022-03-09 15:19:47 +01:00
|
|
|
static void CDECL loaderdrv_FlashWindowEx( FLASHWINFO *info )
|
|
|
|
{
|
|
|
|
load_driver()->pFlashWindowEx( info );
|
|
|
|
}
|
|
|
|
|
2022-03-10 14:33:11 +01:00
|
|
|
static void CDECL loaderdrv_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alpha, DWORD flags )
|
|
|
|
{
|
|
|
|
load_driver()->pSetLayeredWindowAttributes( hwnd, key, alpha, flags );
|
|
|
|
}
|
|
|
|
|
2022-03-10 14:31:41 +01:00
|
|
|
static void CDECL loaderdrv_SetWindowRgn( HWND hwnd, HRGN hrgn, BOOL redraw )
|
|
|
|
{
|
|
|
|
load_driver()->pSetWindowRgn( hwnd, hrgn, redraw );
|
|
|
|
}
|
|
|
|
|
2022-03-10 14:33:27 +01:00
|
|
|
static BOOL CDECL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
|
|
|
|
const RECT *window_rect )
|
|
|
|
{
|
|
|
|
return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect );
|
|
|
|
}
|
|
|
|
|
2021-12-07 15:30:12 +01:00
|
|
|
static const struct vulkan_funcs * CDECL loaderdrv_wine_get_vulkan_driver( UINT version )
|
|
|
|
{
|
|
|
|
return load_driver()->pwine_get_vulkan_driver( version );
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:45 +01:00
|
|
|
static const struct user_driver_funcs lazy_load_driver =
|
|
|
|
{
|
2022-02-14 14:08:05 +01:00
|
|
|
/* keyboard functions */
|
2021-11-17 12:47:04 +01:00
|
|
|
.pActivateKeyboardLayout = loaderdrv_ActivateKeyboardLayout,
|
2022-02-14 14:08:05 +01:00
|
|
|
.pBeep = loaderdrv_Beep,
|
2021-11-16 12:35:59 +01:00
|
|
|
.pGetKeyNameText = loaderdrv_GetKeyNameText,
|
2021-11-17 12:47:38 +01:00
|
|
|
.pGetKeyboardLayoutList = loaderdrv_GetKeyboardLayoutList,
|
2021-11-16 12:34:17 +01:00
|
|
|
.pMapVirtualKeyEx = loaderdrv_MapVirtualKeyEx,
|
2021-11-17 12:46:39 +01:00
|
|
|
.pToUnicodeEx = loaderdrv_ToUnicodeEx,
|
2022-02-24 01:27:57 +01:00
|
|
|
.pRegisterHotKey = loaderdrv_RegisterHotKey,
|
2021-11-17 12:48:13 +01:00
|
|
|
.pUnregisterHotKey = loaderdrv_UnregisterHotKey,
|
2021-11-16 12:33:53 +01:00
|
|
|
.pVkKeyScanEx = loaderdrv_VkKeyScanEx,
|
2022-02-14 14:08:05 +01:00
|
|
|
/* cursor/icon functions */
|
2022-02-22 13:53:11 +01:00
|
|
|
.pDestroyCursorIcon = nulldrv_DestroyCursorIcon,
|
2021-12-03 12:55:30 +01:00
|
|
|
.pSetCursor = loaderdrv_SetCursor,
|
2022-02-14 14:08:27 +01:00
|
|
|
.pGetCursorPos = loaderdrv_GetCursorPos,
|
2022-02-14 14:07:53 +01:00
|
|
|
.pSetCursorPos = loaderdrv_SetCursorPos,
|
2022-02-14 14:07:25 +01:00
|
|
|
.pClipCursor = loaderdrv_ClipCursor,
|
2022-02-14 14:08:05 +01:00
|
|
|
/* clipboard functions */
|
2021-11-11 14:13:45 +01:00
|
|
|
.pUpdateClipboard = loaderdrv_UpdateClipboard,
|
2022-02-14 14:08:05 +01:00
|
|
|
/* display modes */
|
|
|
|
.pChangeDisplaySettingsEx = loaderdrv_ChangeDisplaySettingsEx,
|
|
|
|
.pEnumDisplaySettingsEx = loaderdrv_EnumDisplaySettingsEx,
|
|
|
|
.pUpdateDisplayDevices = loaderdrv_UpdateDisplayDevices,
|
|
|
|
/* windowing functions */
|
2022-03-09 15:20:48 +01:00
|
|
|
.pCreateDesktopWindow = loaderdrv_CreateDesktopWindow,
|
2022-03-09 15:19:47 +01:00
|
|
|
.pFlashWindowEx = loaderdrv_FlashWindowEx,
|
2022-03-14 11:43:55 +01:00
|
|
|
.pGetDC = loaderdrv_GetDC,
|
2022-03-11 14:22:19 +01:00
|
|
|
.pSetCapture = nulldrv_SetCapture,
|
2022-03-10 14:33:11 +01:00
|
|
|
.pSetLayeredWindowAttributes = loaderdrv_SetLayeredWindowAttributes,
|
2022-03-15 14:27:55 +01:00
|
|
|
.pSetParent = nulldrv_SetParent,
|
2022-03-10 14:31:41 +01:00
|
|
|
.pSetWindowRgn = loaderdrv_SetWindowRgn,
|
2022-03-16 15:34:55 +01:00
|
|
|
.pSetWindowStyle = nulldrv_SetWindowStyle,
|
2022-02-15 13:10:38 +01:00
|
|
|
.pMsgWaitForMultipleObjectsEx = nulldrv_MsgWaitForMultipleObjectsEx,
|
2022-03-14 11:43:55 +01:00
|
|
|
.pReleaseDC = nulldrv_ReleaseDC,
|
2021-11-17 12:49:37 +01:00
|
|
|
.pScrollDC = nulldrv_ScrollDC,
|
2022-03-11 14:21:31 +01:00
|
|
|
.pSetFocus = nulldrv_SetFocus,
|
2022-03-10 14:33:27 +01:00
|
|
|
.pUpdateLayeredWindow = loaderdrv_UpdateLayeredWindow,
|
2022-02-25 16:01:15 +01:00
|
|
|
.pWindowMessage = nulldrv_WindowMessage,
|
2022-02-14 14:08:05 +01:00
|
|
|
/* system parameters */
|
2021-12-06 03:15:59 +01:00
|
|
|
.pSystemParametersInfo = nulldrv_SystemParametersInfo,
|
2022-02-14 14:08:05 +01:00
|
|
|
/* vulkan support */
|
2021-12-07 15:30:12 +01:00
|
|
|
.pwine_get_vulkan_driver = loaderdrv_wine_get_vulkan_driver,
|
2022-03-01 21:59:23 +01:00
|
|
|
/* opengl support */
|
|
|
|
.pwine_get_wgl_driver = nulldrv_wine_get_wgl_driver,
|
2022-02-15 13:16:12 +01:00
|
|
|
/* thread management */
|
|
|
|
.pThreadDetach = nulldrv_ThreadDetach,
|
2021-11-11 14:13:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
const struct user_driver_funcs *user_driver = &lazy_load_driver;
|
|
|
|
|
2021-11-11 14:13:29 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* __wine_set_display_driver (win32u.@)
|
|
|
|
*/
|
2021-11-11 14:13:35 +01:00
|
|
|
void CDECL __wine_set_display_driver( struct user_driver_funcs *driver, UINT version )
|
2021-11-11 14:13:29 +01:00
|
|
|
{
|
|
|
|
if (version != WINE_GDI_DRIVER_VERSION)
|
|
|
|
{
|
|
|
|
ERR( "version mismatch, driver wants %u but win32u has %u\n",
|
|
|
|
version, WINE_GDI_DRIVER_VERSION );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2021-11-11 14:13:35 +01:00
|
|
|
#define SET_USER_FUNC(name) \
|
|
|
|
do { if (!driver->p##name) driver->p##name = nulldrv_##name; } while(0)
|
|
|
|
|
|
|
|
SET_USER_FUNC(ActivateKeyboardLayout);
|
|
|
|
SET_USER_FUNC(Beep);
|
|
|
|
SET_USER_FUNC(GetKeyNameText);
|
|
|
|
SET_USER_FUNC(GetKeyboardLayoutList);
|
|
|
|
SET_USER_FUNC(MapVirtualKeyEx);
|
|
|
|
SET_USER_FUNC(RegisterHotKey);
|
|
|
|
SET_USER_FUNC(ToUnicodeEx);
|
|
|
|
SET_USER_FUNC(UnregisterHotKey);
|
|
|
|
SET_USER_FUNC(VkKeyScanEx);
|
|
|
|
SET_USER_FUNC(DestroyCursorIcon);
|
|
|
|
SET_USER_FUNC(SetCursor);
|
|
|
|
SET_USER_FUNC(GetCursorPos);
|
|
|
|
SET_USER_FUNC(SetCursorPos);
|
|
|
|
SET_USER_FUNC(ClipCursor);
|
|
|
|
SET_USER_FUNC(UpdateClipboard);
|
|
|
|
SET_USER_FUNC(ChangeDisplaySettingsEx);
|
|
|
|
SET_USER_FUNC(EnumDisplaySettingsEx);
|
2021-11-30 13:24:28 +01:00
|
|
|
SET_USER_FUNC(UpdateDisplayDevices);
|
2021-11-11 14:13:35 +01:00
|
|
|
SET_USER_FUNC(CreateDesktopWindow);
|
|
|
|
SET_USER_FUNC(CreateWindow);
|
|
|
|
SET_USER_FUNC(DestroyWindow);
|
|
|
|
SET_USER_FUNC(FlashWindowEx);
|
|
|
|
SET_USER_FUNC(GetDC);
|
|
|
|
SET_USER_FUNC(MsgWaitForMultipleObjectsEx);
|
|
|
|
SET_USER_FUNC(ReleaseDC);
|
|
|
|
SET_USER_FUNC(ScrollDC);
|
|
|
|
SET_USER_FUNC(SetCapture);
|
|
|
|
SET_USER_FUNC(SetFocus);
|
|
|
|
SET_USER_FUNC(SetLayeredWindowAttributes);
|
|
|
|
SET_USER_FUNC(SetParent);
|
|
|
|
SET_USER_FUNC(SetWindowRgn);
|
|
|
|
SET_USER_FUNC(SetWindowIcon);
|
|
|
|
SET_USER_FUNC(SetWindowStyle);
|
|
|
|
SET_USER_FUNC(SetWindowText);
|
|
|
|
SET_USER_FUNC(ShowWindow);
|
|
|
|
SET_USER_FUNC(SysCommand);
|
|
|
|
SET_USER_FUNC(UpdateLayeredWindow);
|
|
|
|
SET_USER_FUNC(WindowMessage);
|
|
|
|
SET_USER_FUNC(WindowPosChanging);
|
|
|
|
SET_USER_FUNC(WindowPosChanged);
|
|
|
|
SET_USER_FUNC(SystemParametersInfo);
|
2021-12-07 15:30:12 +01:00
|
|
|
SET_USER_FUNC(wine_get_vulkan_driver);
|
2022-03-01 21:59:23 +01:00
|
|
|
SET_USER_FUNC(wine_get_wgl_driver);
|
2021-11-11 14:13:35 +01:00
|
|
|
SET_USER_FUNC(ThreadDetach);
|
|
|
|
#undef SET_USER_FUNC
|
|
|
|
|
|
|
|
InterlockedExchangePointer( (void **)&user_driver, driver );
|
2021-11-11 14:13:29 +01:00
|
|
|
}
|
|
|
|
|
2004-02-12 03:17:51 +01:00
|
|
|
/******************************************************************************
|
2021-08-13 12:09:34 +02:00
|
|
|
* NtGdiExtEscape (win32u.@)
|
2004-02-12 03:17:51 +01:00
|
|
|
*
|
2005-11-05 11:45:02 +01:00
|
|
|
* Access capabilities of a particular device that are not available through GDI.
|
2004-02-12 03:17:51 +01:00
|
|
|
*/
|
2021-08-13 12:09:34 +02:00
|
|
|
INT WINAPI NtGdiExtEscape( HDC hdc, WCHAR *driver, int driver_id, INT escape, INT input_size,
|
|
|
|
const char *input, INT output_size, char *output )
|
2004-02-12 03:17:51 +01:00
|
|
|
{
|
2012-09-20 21:07:04 +02:00
|
|
|
PHYSDEV physdev;
|
|
|
|
INT ret;
|
2007-09-24 18:23:42 +02:00
|
|
|
DC * dc = get_dc_ptr( hdc );
|
2011-03-11 12:15:38 +01:00
|
|
|
|
2012-09-20 21:07:04 +02:00
|
|
|
if (!dc) return 0;
|
|
|
|
update_dc( dc );
|
|
|
|
physdev = GET_DC_PHYSDEV( dc, pExtEscape );
|
2021-08-13 12:09:34 +02:00
|
|
|
ret = physdev->funcs->pExtEscape( physdev, escape, input_size, input, output_size, output );
|
2012-09-20 21:07:04 +02:00
|
|
|
release_dc_ptr( dc );
|
2004-02-12 03:17:51 +01:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-04-15 19:26:07 +02:00
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDIOpenAdapterFromHdc (win32u.@)
|
2015-04-15 19:26:07 +02:00
|
|
|
*/
|
2021-09-20 13:12:53 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromHdc( D3DKMT_OPENADAPTERFROMHDC *desc )
|
2015-04-15 19:26:07 +02:00
|
|
|
{
|
2021-09-20 13:12:53 +02:00
|
|
|
FIXME( "(%p): stub\n", desc );
|
2015-04-15 19:26:07 +02:00
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDIEscape (win32u.@)
|
2015-04-15 19:26:07 +02:00
|
|
|
*/
|
2021-09-20 13:12:53 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDIEscape( const D3DKMT_ESCAPE *desc )
|
2015-04-15 19:26:07 +02:00
|
|
|
{
|
2021-09-20 13:12:53 +02:00
|
|
|
FIXME( "(%p): stub\n", desc );
|
2015-04-15 19:26:07 +02:00
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
}
|
2019-03-14 09:49:14 +01:00
|
|
|
|
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDICloseAdapter (win32u.@)
|
2019-03-14 09:49:14 +01:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDICloseAdapter( const D3DKMT_CLOSEADAPTER *desc )
|
2019-03-14 09:49:14 +01:00
|
|
|
{
|
2019-06-05 17:18:44 +02:00
|
|
|
NTSTATUS status = STATUS_INVALID_PARAMETER;
|
|
|
|
struct d3dkmt_adapter *adapter;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", desc);
|
|
|
|
|
|
|
|
if (!desc || !desc->hAdapter)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_lock( &driver_lock );
|
2019-06-05 17:18:44 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( adapter, &d3dkmt_adapters, struct d3dkmt_adapter, entry )
|
|
|
|
{
|
|
|
|
if (adapter->handle == desc->hAdapter)
|
|
|
|
{
|
|
|
|
list_remove( &adapter->entry );
|
2021-10-01 01:57:05 +02:00
|
|
|
free( adapter );
|
2019-06-05 17:18:44 +02:00
|
|
|
status = STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_unlock( &driver_lock );
|
2019-06-05 17:18:44 +02:00
|
|
|
|
|
|
|
return status;
|
2019-03-14 09:49:14 +01:00
|
|
|
}
|
2019-06-05 17:18:25 +02:00
|
|
|
|
2021-09-21 17:05:13 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtGdiDdDDIOpenAdapterFromDeviceName (win32u.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromDeviceName( D3DKMT_OPENADAPTERFROMDEVICENAME *desc )
|
|
|
|
{
|
|
|
|
D3DKMT_OPENADAPTERFROMLUID desc_luid;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
FIXME( "desc %p stub.\n", desc );
|
|
|
|
|
|
|
|
if (!desc || !desc->pDeviceName) return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
memset( &desc_luid, 0, sizeof( desc_luid ));
|
|
|
|
if ((status = NtGdiDdDDIOpenAdapterFromLuid( &desc_luid ))) return status;
|
|
|
|
|
|
|
|
desc->AdapterLuid = desc_luid.AdapterLuid;
|
|
|
|
desc->hAdapter = desc_luid.hAdapter;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2021-08-25 14:39:46 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* NtGdiDdDDIOpenAdapterFromLuid (win32u.@)
|
|
|
|
*/
|
|
|
|
NTSTATUS WINAPI NtGdiDdDDIOpenAdapterFromLuid( D3DKMT_OPENADAPTERFROMLUID *desc )
|
|
|
|
{
|
|
|
|
static D3DKMT_HANDLE handle_start = 0;
|
|
|
|
struct d3dkmt_adapter *adapter;
|
|
|
|
|
2021-10-01 01:57:05 +02:00
|
|
|
if (!(adapter = malloc( sizeof( *adapter ) ))) return STATUS_NO_MEMORY;
|
2021-08-25 14:39:46 +02:00
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_lock( &driver_lock );
|
2021-08-25 14:39:46 +02:00
|
|
|
desc->hAdapter = adapter->handle = ++handle_start;
|
|
|
|
list_add_tail( &d3dkmt_adapters, &adapter->entry );
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_unlock( &driver_lock );
|
2021-08-25 14:39:46 +02:00
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2019-06-05 17:18:52 +02:00
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDICreateDevice (win32u.@)
|
2019-06-05 17:18:52 +02:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDICreateDevice( D3DKMT_CREATEDEVICE *desc )
|
2019-06-05 17:18:52 +02:00
|
|
|
{
|
|
|
|
static D3DKMT_HANDLE handle_start = 0;
|
|
|
|
struct d3dkmt_adapter *adapter;
|
|
|
|
struct d3dkmt_device *device;
|
|
|
|
BOOL found = FALSE;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", desc);
|
|
|
|
|
|
|
|
if (!desc)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_lock( &driver_lock );
|
2019-06-05 17:18:52 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( adapter, &d3dkmt_adapters, struct d3dkmt_adapter, entry )
|
|
|
|
{
|
|
|
|
if (adapter->handle == desc->hAdapter)
|
|
|
|
{
|
|
|
|
found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_unlock( &driver_lock );
|
2019-06-05 17:18:52 +02:00
|
|
|
|
|
|
|
if (!found)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
if (desc->Flags.LegacyMode || desc->Flags.RequestVSync || desc->Flags.DisableGpuTimeout)
|
|
|
|
FIXME("Flags unsupported.\n");
|
|
|
|
|
2021-10-01 01:57:05 +02:00
|
|
|
device = calloc( 1, sizeof( *device ) );
|
2019-06-05 17:18:52 +02:00
|
|
|
if (!device)
|
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_lock( &driver_lock );
|
2019-06-05 17:18:52 +02:00
|
|
|
device->handle = ++handle_start;
|
|
|
|
list_add_tail( &d3dkmt_devices, &device->entry );
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_unlock( &driver_lock );
|
2019-06-05 17:18:52 +02:00
|
|
|
|
|
|
|
desc->hDevice = device->handle;
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2019-06-05 17:19:09 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDIDestroyDevice (win32u.@)
|
2019-06-05 17:19:09 +02:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDIDestroyDevice( const D3DKMT_DESTROYDEVICE *desc )
|
2019-06-05 17:19:09 +02:00
|
|
|
{
|
|
|
|
NTSTATUS status = STATUS_INVALID_PARAMETER;
|
2019-10-22 10:38:56 +02:00
|
|
|
D3DKMT_SETVIDPNSOURCEOWNER set_owner_desc;
|
2019-06-05 17:19:09 +02:00
|
|
|
struct d3dkmt_device *device;
|
|
|
|
|
|
|
|
TRACE("(%p)\n", desc);
|
|
|
|
|
|
|
|
if (!desc || !desc->hDevice)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_lock( &driver_lock );
|
2019-06-05 17:19:09 +02:00
|
|
|
LIST_FOR_EACH_ENTRY( device, &d3dkmt_devices, struct d3dkmt_device, entry )
|
|
|
|
{
|
|
|
|
if (device->handle == desc->hDevice)
|
|
|
|
{
|
2019-10-22 10:38:56 +02:00
|
|
|
memset( &set_owner_desc, 0, sizeof(set_owner_desc) );
|
|
|
|
set_owner_desc.hDevice = desc->hDevice;
|
2021-08-25 14:39:45 +02:00
|
|
|
NtGdiDdDDISetVidPnSourceOwner( &set_owner_desc );
|
2019-06-05 17:19:09 +02:00
|
|
|
list_remove( &device->entry );
|
2021-10-01 01:57:05 +02:00
|
|
|
free( device );
|
2019-06-05 17:19:09 +02:00
|
|
|
status = STATUS_SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2021-10-04 16:03:13 +02:00
|
|
|
pthread_mutex_unlock( &driver_lock );
|
2019-06-05 17:19:09 +02:00
|
|
|
|
|
|
|
return status;
|
|
|
|
}
|
2019-08-02 05:34:31 +02:00
|
|
|
|
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDIQueryStatistics (win32u.@)
|
2019-08-02 05:34:31 +02:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDIQueryStatistics( D3DKMT_QUERYSTATISTICS *stats )
|
2019-08-02 05:34:31 +02:00
|
|
|
{
|
|
|
|
FIXME("(%p): stub\n", stats);
|
|
|
|
return STATUS_SUCCESS;
|
|
|
|
}
|
2019-10-22 10:38:56 +02:00
|
|
|
|
2020-01-29 08:34:01 +01:00
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDISetQueuedLimit (win32u.@)
|
2020-01-29 08:34:01 +01:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDISetQueuedLimit( D3DKMT_SETQUEUEDLIMIT *desc )
|
2020-01-29 08:34:01 +01:00
|
|
|
{
|
|
|
|
FIXME( "(%p): stub\n", desc );
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
2019-10-22 10:38:56 +02:00
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDISetVidPnSourceOwner (win32u.@)
|
2019-10-22 10:38:56 +02:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDISetVidPnSourceOwner( const D3DKMT_SETVIDPNSOURCEOWNER *desc )
|
2019-10-22 10:38:56 +02:00
|
|
|
{
|
|
|
|
TRACE("(%p)\n", desc);
|
|
|
|
|
|
|
|
if (!get_display_driver()->pD3DKMTSetVidPnSourceOwner)
|
|
|
|
return STATUS_PROCEDURE_NOT_FOUND;
|
|
|
|
|
|
|
|
if (!desc || !desc->hDevice || (desc->VidPnSourceCount && (!desc->pType || !desc->pVidPnSourceId)))
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
/* Store the VidPN source ownership info in the graphics driver because
|
|
|
|
* the graphics driver needs to change ownership sometimes. For example,
|
|
|
|
* when a new window is moved to a VidPN source with an exclusive owner,
|
|
|
|
* such an exclusive owner will be released before showing the new window */
|
|
|
|
return get_display_driver()->pD3DKMTSetVidPnSourceOwner( desc );
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2021-08-25 14:39:45 +02:00
|
|
|
* NtGdiDdDDICheckVidPnExclusiveOwnership (win32u.@)
|
2019-10-22 10:38:56 +02:00
|
|
|
*/
|
2021-08-25 14:39:45 +02:00
|
|
|
NTSTATUS WINAPI NtGdiDdDDICheckVidPnExclusiveOwnership( const D3DKMT_CHECKVIDPNEXCLUSIVEOWNERSHIP *desc )
|
2019-10-22 10:38:56 +02:00
|
|
|
{
|
|
|
|
TRACE("(%p)\n", desc);
|
|
|
|
|
|
|
|
if (!get_display_driver()->pD3DKMTCheckVidPnExclusiveOwnership)
|
|
|
|
return STATUS_PROCEDURE_NOT_FOUND;
|
|
|
|
|
|
|
|
if (!desc || !desc->hAdapter)
|
|
|
|
return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
return get_display_driver()->pD3DKMTCheckVidPnExclusiveOwnership( desc );
|
|
|
|
}
|