gdi32: Don't allow Get/SetDeviceGammaRamp on DIBs or memory DCs.
This commit is contained in:
parent
bf718448f3
commit
56331e2a9a
|
@ -417,6 +417,15 @@ static INT dibdrv_DescribePixelFormat( PHYSDEV dev, INT fmt, UINT size, PIXELFOR
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* dibdrv_GetDeviceGammaRamp
|
||||||
|
*/
|
||||||
|
static BOOL dibdrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* dibdrv_GetPixelFormat
|
* dibdrv_GetPixelFormat
|
||||||
*/
|
*/
|
||||||
|
@ -426,6 +435,15 @@ static INT dibdrv_GetPixelFormat( PHYSDEV dev )
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* dibdrv_SetDeviceGammaRamp
|
||||||
|
*/
|
||||||
|
static BOOL dibdrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* dibdrv_SetPixelFormat
|
* dibdrv_SetPixelFormat
|
||||||
*/
|
*/
|
||||||
|
@ -598,7 +616,7 @@ const struct gdi_dc_funcs dib_driver =
|
||||||
NULL, /* pGetCharABCWidthsI */
|
NULL, /* pGetCharABCWidthsI */
|
||||||
NULL, /* pGetCharWidth */
|
NULL, /* pGetCharWidth */
|
||||||
NULL, /* pGetDeviceCaps */
|
NULL, /* pGetDeviceCaps */
|
||||||
NULL, /* pGetDeviceGammaRamp */
|
dibdrv_GetDeviceGammaRamp, /* pGetDeviceGammaRamp */
|
||||||
NULL, /* pGetFontData */
|
NULL, /* pGetFontData */
|
||||||
NULL, /* pGetFontUnicodeRanges */
|
NULL, /* pGetFontUnicodeRanges */
|
||||||
NULL, /* pGetGlyphIndices */
|
NULL, /* pGetGlyphIndices */
|
||||||
|
@ -660,7 +678,7 @@ const struct gdi_dc_funcs dib_driver =
|
||||||
dibdrv_SetDIBColorTable, /* pSetDIBColorTable */
|
dibdrv_SetDIBColorTable, /* pSetDIBColorTable */
|
||||||
NULL, /* pSetDIBitsToDevice */
|
NULL, /* pSetDIBitsToDevice */
|
||||||
dibdrv_SetDeviceClipping, /* pSetDeviceClipping */
|
dibdrv_SetDeviceClipping, /* pSetDeviceClipping */
|
||||||
NULL, /* pSetDeviceGammaRamp */
|
dibdrv_SetDeviceGammaRamp, /* pSetDeviceGammaRamp */
|
||||||
NULL, /* pSetLayout */
|
NULL, /* pSetLayout */
|
||||||
NULL, /* pSetMapMode */
|
NULL, /* pSetMapMode */
|
||||||
NULL, /* pSetMapperFlags */
|
NULL, /* pSetMapperFlags */
|
||||||
|
|
|
@ -355,6 +355,7 @@ static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
|
||||||
|
|
||||||
static BOOL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
static BOOL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
||||||
{
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,6 +588,7 @@ static DWORD nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
|
||||||
|
|
||||||
static BOOL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
static BOOL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
|
||||||
{
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,22 +305,39 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
|
||||||
DESKTOPVERTRES,
|
DESKTOPVERTRES,
|
||||||
DESKTOPHORZRES,
|
DESKTOPHORZRES,
|
||||||
BLTALIGNMENT,
|
BLTALIGNMENT,
|
||||||
SHADEBLENDCAPS,
|
SHADEBLENDCAPS
|
||||||
COLORMGMTCAPS
|
|
||||||
};
|
};
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
WORD ramp[3][256];
|
||||||
|
BOOL ret;
|
||||||
|
|
||||||
if (GetObjectType( hdc ) == OBJ_METADC)
|
if (GetObjectType( hdc ) == OBJ_METADC)
|
||||||
|
{
|
||||||
for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
|
for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
|
||||||
ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
|
ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
|
||||||
"wrong caps on %s for %u: %u\n", descr, caps[i],
|
"wrong caps on %s for %u: %u\n", descr, caps[i],
|
||||||
GetDeviceCaps( hdc, caps[i] ) );
|
GetDeviceCaps( hdc, caps[i] ) );
|
||||||
|
|
||||||
|
SetLastError( 0xdeadbeef );
|
||||||
|
ret = GetDeviceGammaRamp( hdc, &ramp );
|
||||||
|
ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
|
||||||
|
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
|
||||||
|
"wrong error %u on %s\n", GetLastError(), descr );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
|
for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
|
||||||
ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
|
ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
|
||||||
"mismatched caps on %s for %u: %u/%u\n", descr, caps[i],
|
"mismatched caps on %s for %u: %u/%u\n", descr, caps[i],
|
||||||
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
|
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
|
||||||
|
|
||||||
|
SetLastError( 0xdeadbeef );
|
||||||
|
ret = GetDeviceGammaRamp( hdc, &ramp );
|
||||||
|
ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
|
||||||
|
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
|
||||||
|
"wrong error %u on %s\n", GetLastError(), descr );
|
||||||
|
}
|
||||||
|
|
||||||
if (GetObjectType( hdc ) == OBJ_MEMDC)
|
if (GetObjectType( hdc ) == OBJ_MEMDC)
|
||||||
{
|
{
|
||||||
char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
|
char buffer[sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD)];
|
||||||
|
@ -342,6 +359,12 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr )
|
||||||
"mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
|
"mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
|
||||||
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
|
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
|
||||||
|
|
||||||
|
SetLastError( 0xdeadbeef );
|
||||||
|
ret = GetDeviceGammaRamp( hdc, &ramp );
|
||||||
|
ok( !ret, "GetDeviceGammaRamp succeeded on %s\n", descr );
|
||||||
|
ok( GetLastError() == ERROR_INVALID_PARAMETER || broken(GetLastError() == 0xdeadbeef), /* nt4 */
|
||||||
|
"wrong error %u on %s\n", GetLastError(), descr );
|
||||||
|
|
||||||
SelectObject( hdc, old );
|
SelectObject( hdc, old );
|
||||||
DeleteObject( dib );
|
DeleteObject( dib );
|
||||||
}
|
}
|
||||||
|
|
|
@ -424,6 +424,11 @@ static BOOL X11DRV_XF86VM_SetGammaRamp(LPDDGAMMARAMP ramp)
|
||||||
*/
|
*/
|
||||||
BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp)
|
BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp)
|
||||||
{
|
{
|
||||||
|
if (GetObjectType( dev->hdc ) == OBJ_MEMDC)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
#ifdef SONAME_LIBXXF86VM
|
#ifdef SONAME_LIBXXF86VM
|
||||||
return X11DRV_XF86VM_GetGammaRamp(ramp);
|
return X11DRV_XF86VM_GetGammaRamp(ramp);
|
||||||
#else
|
#else
|
||||||
|
@ -440,6 +445,11 @@ BOOL X11DRV_GetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp)
|
||||||
*/
|
*/
|
||||||
BOOL X11DRV_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp)
|
BOOL X11DRV_SetDeviceGammaRamp(PHYSDEV dev, LPVOID ramp)
|
||||||
{
|
{
|
||||||
|
if (GetObjectType( dev->hdc ) == OBJ_MEMDC)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_INVALID_PARAMETER );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
#ifdef SONAME_LIBXXF86VM
|
#ifdef SONAME_LIBXXF86VM
|
||||||
return X11DRV_XF86VM_SetGammaRamp(ramp);
|
return X11DRV_XF86VM_SetGammaRamp(ramp);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue