2001-07-27 19:37:31 +00:00
|
|
|
/*
|
|
|
|
* Graphics driver management functions
|
|
|
|
*
|
2004-02-12 02:17:51 +00:00
|
|
|
* Copyright 1994 Bob Amstadt
|
|
|
|
* Copyright 1996, 2001 Alexandre Julliard
|
2002-03-09 23:29:33 +00: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 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-07-27 19:37:31 +00:00
|
|
|
*/
|
|
|
|
|
2002-08-31 19:04:14 +00:00
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
2003-09-05 23:08:26 +00:00
|
|
|
#include <stdarg.h>
|
2001-07-27 19:37:31 +00:00
|
|
|
#include <string.h>
|
2005-05-06 19:38:50 +00:00
|
|
|
#include <stdio.h>
|
2003-09-05 23:08:26 +00:00
|
|
|
#include "windef.h"
|
2001-07-27 19:37:31 +00:00
|
|
|
#include "winbase.h"
|
|
|
|
#include "winreg.h"
|
2009-06-05 16:58:55 +00:00
|
|
|
#include "ddrawgdi.h"
|
2009-12-05 10:45:31 +00:00
|
|
|
#include "wine/winbase16.h"
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2004-01-15 00:35:38 +00:00
|
|
|
#include "gdi_private.h"
|
2003-08-12 20:42:18 +00:00
|
|
|
#include "wine/unicode.h"
|
2010-04-20 11:20:49 +00:00
|
|
|
#include "wine/list.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(driver);
|
2001-07-27 19:37:31 +00:00
|
|
|
|
|
|
|
struct graphics_driver
|
|
|
|
{
|
2010-04-20 11:20:49 +00:00
|
|
|
struct list entry;
|
2001-07-27 19:37:31 +00:00
|
|
|
HMODULE module; /* module handle */
|
|
|
|
DC_FUNCTIONS funcs;
|
|
|
|
};
|
|
|
|
|
2010-04-20 11:20:49 +00:00
|
|
|
static struct list drivers = LIST_INIT( drivers );
|
2001-07-27 19:37:31 +00:00
|
|
|
static struct graphics_driver *display_driver;
|
2003-08-12 23:50:54 +00:00
|
|
|
|
|
|
|
static CRITICAL_SECTION driver_section;
|
|
|
|
static CRITICAL_SECTION_DEBUG critsect_debug =
|
|
|
|
{
|
|
|
|
0, 0, &driver_section,
|
|
|
|
{ &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
|
2005-09-09 10:19:44 +00:00
|
|
|
0, 0, { (DWORD_PTR)(__FILE__ ": driver_section") }
|
2003-08-12 23:50:54 +00:00
|
|
|
};
|
|
|
|
static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
|
2001-07-27 19:37:31 +00:00
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* create_driver
|
|
|
|
*
|
|
|
|
* Allocate and fill the driver structure for a given module.
|
|
|
|
*/
|
|
|
|
static struct graphics_driver *create_driver( HMODULE module )
|
|
|
|
{
|
|
|
|
struct graphics_driver *driver;
|
|
|
|
|
|
|
|
if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
|
|
|
|
driver->module = module;
|
|
|
|
|
|
|
|
/* fill the function table */
|
2005-10-31 15:43:10 +00:00
|
|
|
if (module)
|
|
|
|
{
|
2001-07-27 19:37:31 +00:00
|
|
|
#define GET_FUNC(name) driver->funcs.p##name = (void*)GetProcAddress( module, #name )
|
2005-10-31 15:43:10 +00:00
|
|
|
GET_FUNC(AbortDoc);
|
|
|
|
GET_FUNC(AbortPath);
|
|
|
|
GET_FUNC(AlphaBlend);
|
|
|
|
GET_FUNC(AngleArc);
|
|
|
|
GET_FUNC(Arc);
|
|
|
|
GET_FUNC(ArcTo);
|
|
|
|
GET_FUNC(BeginPath);
|
|
|
|
GET_FUNC(BitBlt);
|
|
|
|
GET_FUNC(ChoosePixelFormat);
|
|
|
|
GET_FUNC(Chord);
|
|
|
|
GET_FUNC(CloseFigure);
|
|
|
|
GET_FUNC(CreateBitmap);
|
|
|
|
GET_FUNC(CreateDC);
|
|
|
|
GET_FUNC(CreateDIBSection);
|
|
|
|
GET_FUNC(DeleteBitmap);
|
|
|
|
GET_FUNC(DeleteDC);
|
|
|
|
GET_FUNC(DescribePixelFormat);
|
|
|
|
GET_FUNC(DeviceCapabilities);
|
|
|
|
GET_FUNC(Ellipse);
|
|
|
|
GET_FUNC(EndDoc);
|
|
|
|
GET_FUNC(EndPage);
|
|
|
|
GET_FUNC(EndPath);
|
|
|
|
GET_FUNC(EnumDeviceFonts);
|
2010-10-26 10:40:41 +00:00
|
|
|
GET_FUNC(EnumICMProfiles);
|
2005-10-31 15:43:10 +00:00
|
|
|
GET_FUNC(ExcludeClipRect);
|
|
|
|
GET_FUNC(ExtDeviceMode);
|
|
|
|
GET_FUNC(ExtEscape);
|
|
|
|
GET_FUNC(ExtFloodFill);
|
|
|
|
GET_FUNC(ExtSelectClipRgn);
|
|
|
|
GET_FUNC(ExtTextOut);
|
|
|
|
GET_FUNC(FillPath);
|
|
|
|
GET_FUNC(FillRgn);
|
|
|
|
GET_FUNC(FlattenPath);
|
|
|
|
GET_FUNC(FrameRgn);
|
|
|
|
GET_FUNC(GdiComment);
|
|
|
|
GET_FUNC(GetBitmapBits);
|
|
|
|
GET_FUNC(GetCharWidth);
|
|
|
|
GET_FUNC(GetDIBits);
|
|
|
|
GET_FUNC(GetDeviceCaps);
|
|
|
|
GET_FUNC(GetDeviceGammaRamp);
|
2008-03-05 14:57:21 +00:00
|
|
|
GET_FUNC(GetICMProfile);
|
2005-10-31 15:43:10 +00:00
|
|
|
GET_FUNC(GetNearestColor);
|
|
|
|
GET_FUNC(GetPixel);
|
|
|
|
GET_FUNC(GetPixelFormat);
|
|
|
|
GET_FUNC(GetSystemPaletteEntries);
|
2006-07-12 00:58:35 +00:00
|
|
|
GET_FUNC(GetTextExtentExPoint);
|
2005-10-31 15:43:10 +00:00
|
|
|
GET_FUNC(GetTextMetrics);
|
|
|
|
GET_FUNC(IntersectClipRect);
|
|
|
|
GET_FUNC(InvertRgn);
|
|
|
|
GET_FUNC(LineTo);
|
|
|
|
GET_FUNC(MoveTo);
|
|
|
|
GET_FUNC(ModifyWorldTransform);
|
|
|
|
GET_FUNC(OffsetClipRgn);
|
|
|
|
GET_FUNC(OffsetViewportOrg);
|
|
|
|
GET_FUNC(OffsetWindowOrg);
|
|
|
|
GET_FUNC(PaintRgn);
|
|
|
|
GET_FUNC(PatBlt);
|
|
|
|
GET_FUNC(Pie);
|
|
|
|
GET_FUNC(PolyBezier);
|
|
|
|
GET_FUNC(PolyBezierTo);
|
|
|
|
GET_FUNC(PolyDraw);
|
|
|
|
GET_FUNC(PolyPolygon);
|
|
|
|
GET_FUNC(PolyPolyline);
|
|
|
|
GET_FUNC(Polygon);
|
|
|
|
GET_FUNC(Polyline);
|
|
|
|
GET_FUNC(PolylineTo);
|
|
|
|
GET_FUNC(RealizeDefaultPalette);
|
|
|
|
GET_FUNC(RealizePalette);
|
|
|
|
GET_FUNC(Rectangle);
|
|
|
|
GET_FUNC(ResetDC);
|
|
|
|
GET_FUNC(RestoreDC);
|
|
|
|
GET_FUNC(RoundRect);
|
|
|
|
GET_FUNC(SaveDC);
|
|
|
|
GET_FUNC(ScaleViewportExt);
|
|
|
|
GET_FUNC(ScaleWindowExt);
|
|
|
|
GET_FUNC(SelectBitmap);
|
|
|
|
GET_FUNC(SelectBrush);
|
|
|
|
GET_FUNC(SelectClipPath);
|
|
|
|
GET_FUNC(SelectFont);
|
|
|
|
GET_FUNC(SelectPalette);
|
|
|
|
GET_FUNC(SelectPen);
|
|
|
|
GET_FUNC(SetArcDirection);
|
|
|
|
GET_FUNC(SetBitmapBits);
|
|
|
|
GET_FUNC(SetBkColor);
|
|
|
|
GET_FUNC(SetBkMode);
|
|
|
|
GET_FUNC(SetDCBrushColor);
|
|
|
|
GET_FUNC(SetDCPenColor);
|
|
|
|
GET_FUNC(SetDIBColorTable);
|
|
|
|
GET_FUNC(SetDIBits);
|
|
|
|
GET_FUNC(SetDIBitsToDevice);
|
|
|
|
GET_FUNC(SetDeviceClipping);
|
|
|
|
GET_FUNC(SetDeviceGammaRamp);
|
|
|
|
GET_FUNC(SetMapMode);
|
|
|
|
GET_FUNC(SetMapperFlags);
|
|
|
|
GET_FUNC(SetPixel);
|
|
|
|
GET_FUNC(SetPixelFormat);
|
|
|
|
GET_FUNC(SetPolyFillMode);
|
|
|
|
GET_FUNC(SetROP2);
|
|
|
|
GET_FUNC(SetRelAbs);
|
|
|
|
GET_FUNC(SetStretchBltMode);
|
|
|
|
GET_FUNC(SetTextAlign);
|
|
|
|
GET_FUNC(SetTextCharacterExtra);
|
|
|
|
GET_FUNC(SetTextColor);
|
|
|
|
GET_FUNC(SetTextJustification);
|
|
|
|
GET_FUNC(SetViewportExt);
|
|
|
|
GET_FUNC(SetViewportOrg);
|
|
|
|
GET_FUNC(SetWindowExt);
|
|
|
|
GET_FUNC(SetWindowOrg);
|
|
|
|
GET_FUNC(SetWorldTransform);
|
|
|
|
GET_FUNC(StartDoc);
|
|
|
|
GET_FUNC(StartPage);
|
|
|
|
GET_FUNC(StretchBlt);
|
|
|
|
GET_FUNC(StretchDIBits);
|
|
|
|
GET_FUNC(StrokeAndFillPath);
|
|
|
|
GET_FUNC(StrokePath);
|
|
|
|
GET_FUNC(SwapBuffers);
|
2006-11-17 13:38:11 +00:00
|
|
|
GET_FUNC(UnrealizePalette);
|
2005-10-31 15:43:10 +00:00
|
|
|
GET_FUNC(WidenPath);
|
2006-10-03 17:52:17 +00:00
|
|
|
|
|
|
|
/* OpenGL32 */
|
|
|
|
GET_FUNC(wglCreateContext);
|
2009-11-16 22:24:24 +00:00
|
|
|
GET_FUNC(wglCreateContextAttribsARB);
|
2006-10-16 21:28:33 +00:00
|
|
|
GET_FUNC(wglDeleteContext);
|
2006-10-26 21:11:07 +00:00
|
|
|
GET_FUNC(wglGetProcAddress);
|
2006-11-04 21:23:15 +00:00
|
|
|
GET_FUNC(wglGetPbufferDCARB);
|
2006-10-31 17:29:14 +00:00
|
|
|
GET_FUNC(wglMakeContextCurrentARB);
|
2006-10-03 17:52:17 +00:00
|
|
|
GET_FUNC(wglMakeCurrent);
|
2008-04-22 22:15:15 +00:00
|
|
|
GET_FUNC(wglSetPixelFormatWINE);
|
2006-10-14 20:49:09 +00:00
|
|
|
GET_FUNC(wglShareLists);
|
2006-10-03 19:22:22 +00:00
|
|
|
GET_FUNC(wglUseFontBitmapsA);
|
|
|
|
GET_FUNC(wglUseFontBitmapsW);
|
2001-07-27 19:37:31 +00:00
|
|
|
#undef GET_FUNC
|
2005-10-31 15:43:10 +00:00
|
|
|
}
|
|
|
|
else memset( &driver->funcs, 0, sizeof(driver->funcs) );
|
2001-07-27 19:37:31 +00:00
|
|
|
|
|
|
|
return driver;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
2010-05-06 11:50:30 +00:00
|
|
|
* DRIVER_get_display_driver
|
2001-07-27 19:37:31 +00:00
|
|
|
*
|
|
|
|
* Special case for loading the display driver: get the name from the config file
|
|
|
|
*/
|
2010-05-06 11:50:30 +00:00
|
|
|
const DC_FUNCTIONS *DRIVER_get_display_driver(void)
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2010-05-06 11:48:24 +00:00
|
|
|
struct graphics_driver *driver;
|
2005-05-06 19:38:50 +00:00
|
|
|
char buffer[MAX_PATH], libname[32], *name, *next;
|
2004-07-13 03:53:55 +00:00
|
|
|
HMODULE module = 0;
|
2001-07-27 19:37:31 +00:00
|
|
|
HKEY hkey;
|
|
|
|
|
2010-05-06 11:50:30 +00:00
|
|
|
if (display_driver) return &display_driver->funcs; /* already loaded */
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2005-10-31 15:43:10 +00:00
|
|
|
strcpy( buffer, "x11" ); /* default value */
|
2005-06-20 16:04:32 +00:00
|
|
|
/* @@ Wine registry key: HKCU\Software\Wine\Drivers */
|
|
|
|
if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
|
|
|
DWORD type, count = sizeof(buffer);
|
2005-07-05 11:02:37 +00:00
|
|
|
RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
|
2001-07-27 19:37:31 +00:00
|
|
|
RegCloseKey( hkey );
|
|
|
|
}
|
|
|
|
|
2004-07-13 03:53:55 +00:00
|
|
|
name = buffer;
|
|
|
|
while (name)
|
|
|
|
{
|
|
|
|
next = strchr( name, ',' );
|
|
|
|
if (next) *next++ = 0;
|
|
|
|
|
2005-05-06 19:38:50 +00:00
|
|
|
snprintf( libname, sizeof(libname), "wine%s.drv", name );
|
|
|
|
if ((module = LoadLibraryA( libname )) != 0) break;
|
2004-07-13 03:53:55 +00:00
|
|
|
name = next;
|
|
|
|
}
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2010-05-06 11:48:24 +00:00
|
|
|
if (!(driver = create_driver( module )))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
|
|
|
MESSAGE( "Could not create graphics driver '%s'\n", buffer );
|
|
|
|
FreeLibrary( module );
|
2004-07-13 03:53:55 +00:00
|
|
|
ExitProcess(1);
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
2010-05-06 11:48:24 +00:00
|
|
|
if (InterlockedCompareExchangePointer( (void **)&display_driver, driver, NULL ))
|
|
|
|
{
|
|
|
|
/* somebody beat us to it */
|
|
|
|
FreeLibrary( driver->module );
|
|
|
|
HeapFree( GetProcessHeap(), 0, driver );
|
|
|
|
}
|
2010-05-06 11:50:30 +00:00
|
|
|
return &display_driver->funcs;
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
|
|
|
|
* DRIVER_load_driver
|
|
|
|
*/
|
2003-08-12 20:42:18 +00:00
|
|
|
const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
|
|
|
HMODULE module;
|
2010-05-06 11:48:24 +00:00
|
|
|
struct graphics_driver *driver, *new_driver;
|
2003-08-12 20:42:18 +00:00
|
|
|
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
|
2006-01-03 11:05:54 +00:00
|
|
|
static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
|
2001-07-27 19:37:31 +00:00
|
|
|
|
|
|
|
/* display driver is a special case */
|
2010-05-06 11:50:30 +00:00
|
|
|
if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return DRIVER_get_display_driver();
|
|
|
|
|
2003-08-12 20:42:18 +00:00
|
|
|
if ((module = GetModuleHandleW( name )))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2010-05-06 11:48:24 +00:00
|
|
|
if (display_driver && display_driver->module == module) return &display_driver->funcs;
|
|
|
|
EnterCriticalSection( &driver_section );
|
2010-04-20 11:20:49 +00:00
|
|
|
LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2010-05-06 11:48:24 +00:00
|
|
|
if (driver->module == module) goto done;
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
2010-05-06 11:48:24 +00:00
|
|
|
LeaveCriticalSection( &driver_section );
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 11:48:24 +00:00
|
|
|
if (!(module = LoadLibraryW( name ))) return NULL;
|
|
|
|
|
|
|
|
if (!(new_driver = create_driver( module )))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2010-05-06 11:48:24 +00:00
|
|
|
FreeLibrary( module );
|
2003-02-27 00:11:54 +00:00
|
|
|
return NULL;
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
|
|
|
|
2010-05-06 11:48:24 +00:00
|
|
|
/* check if someone else added it in the meantime */
|
|
|
|
EnterCriticalSection( &driver_section );
|
|
|
|
LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2010-05-06 11:48:24 +00:00
|
|
|
if (driver->module != module) continue;
|
2001-07-27 19:37:31 +00:00
|
|
|
FreeLibrary( module );
|
2010-05-06 11:48:24 +00:00
|
|
|
HeapFree( GetProcessHeap(), 0, new_driver );
|
|
|
|
goto done;
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
2010-05-06 11:48:24 +00:00
|
|
|
driver = new_driver;
|
|
|
|
list_add_head( &drivers, &driver->entry );
|
2003-08-12 20:42:18 +00:00
|
|
|
TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) );
|
2010-05-06 11:48:24 +00:00
|
|
|
done:
|
2003-04-01 00:12:50 +00:00
|
|
|
LeaveCriticalSection( &driver_section );
|
2001-07-27 19:37:31 +00:00
|
|
|
return &driver->funcs;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-03-08 20:36:52 +00:00
|
|
|
static INT CDECL nulldrv_AbortDoc( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-08 19:30:03 +00:00
|
|
|
static BOOL CDECL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-03-08 20:36:52 +00:00
|
|
|
static INT CDECL nulldrv_EndDoc( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT CDECL nulldrv_EndPage( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-03-08 19:30:03 +00:00
|
|
|
static BOOL CDECL nulldrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static COLORREF CDECL nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_MoveTo( PHYSDEV dev, INT x, INT y )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_PaintRgn( PHYSDEV dev, HRGN rgn )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT xstart, INT ystart, INT xend, INT yend )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_PolyPolygon( PHYSDEV dev, const POINT *points, const INT *counts, UINT polygons )
|
|
|
|
{
|
|
|
|
/* FIXME: could be implemented with Polygon */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_PolyPolyline( PHYSDEV dev, const POINT *points, const DWORD *counts, DWORD lines )
|
|
|
|
{
|
|
|
|
/* FIXME: could be implemented with Polyline */
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Polygon( PHYSDEV dev, const POINT *points, INT count )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static BOOL CDECL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
|
|
|
|
INT ell_width, INT ell_height )
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-03-09 15:21:45 +00:00
|
|
|
static void CDECL nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN vis_rgn, HRGN clip_rgn )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-03-08 19:30:03 +00:00
|
|
|
static COLORREF CDECL nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
|
|
|
|
{
|
|
|
|
return color;
|
|
|
|
}
|
|
|
|
|
2011-03-08 20:36:52 +00:00
|
|
|
static INT CDECL nulldrv_StartDoc( PHYSDEV dev, const DOCINFOW *info )
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static INT CDECL nulldrv_StartPage( PHYSDEV dev )
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2011-03-08 18:37:08 +00:00
|
|
|
const DC_FUNCTIONS null_driver =
|
|
|
|
{
|
2011-03-08 20:36:52 +00:00
|
|
|
nulldrv_AbortDoc, /* pAbortDoc */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pAbortPath */
|
|
|
|
NULL, /* pAlphaBlend */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_AngleArc, /* pAngleArc */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_Arc, /* pArc */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_ArcTo, /* pArcTo */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pBeginPath */
|
|
|
|
NULL, /* pBitBlt */
|
|
|
|
NULL, /* pChoosePixelFormat */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_Chord, /* pChord */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pCloseFigure */
|
|
|
|
NULL, /* pCreateBitmap */
|
|
|
|
NULL, /* pCreateDC */
|
|
|
|
NULL, /* pCreateDIBSection */
|
|
|
|
NULL, /* pDeleteBitmap */
|
|
|
|
NULL, /* pDeleteDC */
|
|
|
|
NULL, /* pDeleteObject */
|
|
|
|
NULL, /* pDescribePixelFormat */
|
|
|
|
NULL, /* pDeviceCapabilities */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_Ellipse, /* pEllipse */
|
2011-03-08 20:36:52 +00:00
|
|
|
nulldrv_EndDoc, /* pEndDoc */
|
|
|
|
nulldrv_EndPage, /* pEndPage */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pEndPath */
|
|
|
|
NULL, /* pEnumICMProfiles */
|
|
|
|
NULL, /* pEnumDeviceFonts */
|
2011-03-09 15:21:45 +00:00
|
|
|
nulldrv_ExcludeClipRect, /* pExcludeClipRect */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pExtDeviceMode */
|
|
|
|
NULL, /* pExtEscape */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_ExtFloodFill, /* pExtFloodFill */
|
2011-03-09 15:21:45 +00:00
|
|
|
nulldrv_ExtSelectClipRgn, /* pExtSelectClipRgn */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pExtTextOut */
|
|
|
|
NULL, /* pFillPath */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_FillRgn, /* pFillRgn */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pFlattenPath */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_FrameRgn, /* pFrameRgn */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pGdiComment */
|
|
|
|
NULL, /* pGetBitmapBits */
|
|
|
|
NULL, /* pGetCharWidth */
|
|
|
|
NULL, /* pGetDIBits */
|
|
|
|
NULL, /* pGetDeviceCaps */
|
|
|
|
NULL, /* pGetDeviceGammaRamp */
|
|
|
|
NULL, /* pGetICMProfile */
|
|
|
|
NULL, /* pGetNearestColor */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_GetPixel, /* pGetPixel */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pGetPixelFormat */
|
|
|
|
NULL, /* pGetSystemPaletteEntries */
|
|
|
|
NULL, /* pGetTextExtentExPoint */
|
|
|
|
NULL, /* pGetTextMetrics */
|
2011-03-09 15:21:45 +00:00
|
|
|
nulldrv_IntersectClipRect, /* pIntersectClipRect */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_InvertRgn, /* pInvertRgn */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_LineTo, /* pLineTo */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pModifyWorldTransform */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_MoveTo, /* pMoveTo */
|
2011-03-09 15:21:45 +00:00
|
|
|
nulldrv_OffsetClipRgn, /* pOffsetClipRgn */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pOffsetViewportOrg */
|
|
|
|
NULL, /* pOffsetWindowOrg */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_PaintRgn, /* pPaintRgn */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pPatBlt */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_Pie, /* pPie */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_PolyBezier, /* pPolyBezier */
|
|
|
|
nulldrv_PolyBezierTo, /* pPolyBezierTo */
|
|
|
|
nulldrv_PolyDraw, /* pPolyDraw */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_PolyPolygon, /* pPolyPolygon */
|
|
|
|
nulldrv_PolyPolyline, /* pPolyPolyline */
|
|
|
|
nulldrv_Polygon, /* pPolygon */
|
|
|
|
nulldrv_Polyline, /* pPolyline */
|
2011-03-08 20:15:59 +00:00
|
|
|
nulldrv_PolylineTo, /* pPolylineTo */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pRealizeDefaultPalette */
|
|
|
|
NULL, /* pRealizePalette */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_Rectangle, /* pRectangle */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pResetDC */
|
|
|
|
NULL, /* pRestoreDC */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_RoundRect, /* pRoundRect */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pSaveDC */
|
|
|
|
NULL, /* pScaleViewportExt */
|
|
|
|
NULL, /* pScaleWindowExt */
|
|
|
|
NULL, /* pSelectBitmap */
|
|
|
|
NULL, /* pSelectBrush */
|
|
|
|
NULL, /* pSelectClipPath */
|
|
|
|
NULL, /* pSelectFont */
|
|
|
|
NULL, /* pSelectPalette */
|
|
|
|
NULL, /* pSelectPen */
|
|
|
|
NULL, /* pSetArcDirection */
|
|
|
|
NULL, /* pSetBitmapBits */
|
|
|
|
NULL, /* pSetBkColor */
|
|
|
|
NULL, /* pSetBkMode */
|
|
|
|
NULL, /* pSetDCBrushColor */
|
|
|
|
NULL, /* pSetDCPenColor */
|
|
|
|
NULL, /* pSetDIBColorTable */
|
|
|
|
NULL, /* pSetDIBits */
|
|
|
|
NULL, /* pSetDIBitsToDevice */
|
2011-03-09 15:21:45 +00:00
|
|
|
nulldrv_SetDeviceClipping, /* pSetDeviceClipping */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pSetDeviceGammaRamp */
|
|
|
|
NULL, /* pSetMapMode */
|
|
|
|
NULL, /* pSetMapperFlags */
|
2011-03-08 19:30:03 +00:00
|
|
|
nulldrv_SetPixel, /* pSetPixel */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pSetPixelFormat */
|
|
|
|
NULL, /* pSetPolyFillMode */
|
|
|
|
NULL, /* pSetROP2 */
|
|
|
|
NULL, /* pSetRelAbs */
|
|
|
|
NULL, /* pSetStretchBltMode */
|
|
|
|
NULL, /* pSetTextAlign */
|
|
|
|
NULL, /* pSetTextCharacterExtra */
|
|
|
|
NULL, /* pSetTextColor */
|
|
|
|
NULL, /* pSetTextJustification */
|
|
|
|
NULL, /* pSetViewportExt */
|
|
|
|
NULL, /* pSetViewportOrg */
|
|
|
|
NULL, /* pSetWindowExt */
|
|
|
|
NULL, /* pSetWindowOrg */
|
|
|
|
NULL, /* pSetWorldTransform */
|
2011-03-08 20:36:52 +00:00
|
|
|
nulldrv_StartDoc, /* pStartDoc */
|
|
|
|
nulldrv_StartPage, /* pStartPage */
|
2011-03-08 18:37:08 +00:00
|
|
|
NULL, /* pStretchBlt */
|
|
|
|
NULL, /* pStretchDIBits */
|
|
|
|
NULL, /* pStrokeAndFillPath */
|
|
|
|
NULL, /* pStrokePath */
|
|
|
|
NULL, /* pSwapBuffers */
|
|
|
|
NULL, /* pUnrealizePalette */
|
|
|
|
NULL, /* pWidenPath */
|
|
|
|
NULL, /* pwglCopyContext */
|
|
|
|
NULL, /* pwglCreateContext */
|
|
|
|
NULL, /* pwglCreateContextAttribsARB */
|
|
|
|
NULL, /* pwglDeleteContext */
|
|
|
|
NULL, /* pwglGetProcAddress */
|
|
|
|
NULL, /* pwglGetPbufferDCARB */
|
|
|
|
NULL, /* pwglMakeCurrent */
|
|
|
|
NULL, /* pwglMakeContextCurrentARB */
|
|
|
|
NULL, /* pwglSetPixelFormatWINE */
|
|
|
|
NULL, /* pwglShareLists */
|
|
|
|
NULL, /* pwglUseFontBitmapsA */
|
|
|
|
NULL, /* pwglUseFontBitmapsW */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-07-27 19:37:31 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* DRIVER_GetDriverName
|
|
|
|
*
|
|
|
|
*/
|
2003-08-12 20:42:18 +00:00
|
|
|
BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2003-08-12 20:42:18 +00:00
|
|
|
static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
|
|
|
|
static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 };
|
2006-03-18 18:20:03 +00:00
|
|
|
static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
|
2003-08-12 20:42:18 +00:00
|
|
|
static const WCHAR empty_strW[] = { 0 };
|
|
|
|
WCHAR *p;
|
2003-06-23 20:51:41 +00:00
|
|
|
|
|
|
|
/* display is a special case */
|
2006-03-18 18:20:03 +00:00
|
|
|
if (!strcmpiW( device, displayW ) ||
|
|
|
|
!strcmpiW( device, display1W ))
|
2003-06-23 20:51:41 +00:00
|
|
|
{
|
2003-08-12 20:42:18 +00:00
|
|
|
lstrcpynW( driver, displayW, size );
|
2003-06-23 20:51:41 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-08-12 20:42:18 +00:00
|
|
|
size = GetProfileStringW(devicesW, device, empty_strW, driver, size);
|
2001-07-27 19:37:31 +00:00
|
|
|
if(!size) {
|
2003-08-12 20:42:18 +00:00
|
|
|
WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
|
2001-07-27 19:37:31 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2003-08-12 20:42:18 +00:00
|
|
|
p = strchrW(driver, ',');
|
2001-07-27 19:37:31 +00:00
|
|
|
if(!p)
|
|
|
|
{
|
2003-08-12 20:42:18 +00:00
|
|
|
WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device));
|
2001-07-27 19:37:31 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2003-08-12 20:42:18 +00:00
|
|
|
*p = 0;
|
|
|
|
TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device));
|
2001-07-27 19:37:31 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-08-12 20:42:18 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* GdiConvertToDevmodeW (GDI32.@)
|
|
|
|
*/
|
|
|
|
DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
|
|
|
|
{
|
|
|
|
DEVMODEW *dmW;
|
2007-12-19 03:43:05 +00:00
|
|
|
WORD dmW_size, dmA_size;
|
2003-08-12 20:42:18 +00:00
|
|
|
|
2007-12-19 03:43:05 +00:00
|
|
|
dmA_size = dmA->dmSize;
|
2007-12-20 06:49:59 +00:00
|
|
|
|
|
|
|
/* this is the minimal dmSize that XP accepts */
|
|
|
|
if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
|
|
|
|
return NULL;
|
|
|
|
|
2007-12-19 03:43:05 +00:00
|
|
|
if (dmA_size > sizeof(DEVMODEA))
|
|
|
|
dmA_size = sizeof(DEVMODEA);
|
2007-12-18 12:21:40 +00:00
|
|
|
|
2007-12-19 03:43:05 +00:00
|
|
|
dmW_size = dmA_size + CCHDEVICENAME;
|
|
|
|
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
2003-08-12 20:42:18 +00:00
|
|
|
dmW_size += CCHFORMNAME;
|
|
|
|
|
|
|
|
dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
|
|
|
|
if (!dmW) return NULL;
|
|
|
|
|
2008-06-22 21:22:06 +00:00
|
|
|
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
|
2003-08-12 20:42:18 +00:00
|
|
|
dmW->dmDeviceName, CCHDEVICENAME);
|
|
|
|
/* copy slightly more, to avoid long computations */
|
2007-12-19 03:43:05 +00:00
|
|
|
memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
|
2003-08-12 20:42:18 +00:00
|
|
|
|
2007-12-19 03:43:05 +00:00
|
|
|
if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
|
2003-08-12 20:42:18 +00:00
|
|
|
{
|
2008-06-22 21:22:06 +00:00
|
|
|
if (dmA->dmFields & DM_FORMNAME)
|
|
|
|
MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
|
2003-08-12 20:42:18 +00:00
|
|
|
dmW->dmFormName, CCHFORMNAME);
|
2008-06-22 21:22:06 +00:00
|
|
|
else
|
|
|
|
dmW->dmFormName[0] = 0;
|
|
|
|
|
2007-12-19 03:43:05 +00:00
|
|
|
if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
|
|
|
|
memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
|
2003-08-12 20:42:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (dmA->dmDriverExtra)
|
2007-12-19 03:43:05 +00:00
|
|
|
memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
|
2003-08-12 20:42:18 +00:00
|
|
|
|
|
|
|
dmW->dmSize = dmW_size;
|
|
|
|
|
|
|
|
return dmW;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 19:37:31 +00:00
|
|
|
/*****************************************************************************
|
|
|
|
* @ [GDI32.100]
|
|
|
|
*
|
|
|
|
* This should thunk to 16-bit and simply call the proc with the given args.
|
|
|
|
*/
|
|
|
|
INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
|
|
|
|
LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
|
|
|
|
{
|
2002-11-22 22:16:53 +00:00
|
|
|
FIXME("(%p, %p, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
|
2001-07-27 19:37:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* @ [GDI32.101]
|
|
|
|
*
|
|
|
|
* This should load the correct driver for lpszDevice and calls this driver's
|
2002-05-31 23:06:46 +00:00
|
|
|
* ExtDeviceModePropSheet proc.
|
2001-07-27 19:37:31 +00:00
|
|
|
*
|
2002-05-31 23:06:46 +00:00
|
|
|
* Note: The driver calls a callback routine for each property sheet page; these
|
2001-07-27 19:37:31 +00:00
|
|
|
* pages are supposed to be filled into the structure pointed to by lpPropSheet.
|
|
|
|
* The layout of this structure is:
|
2002-05-31 23:06:46 +00:00
|
|
|
*
|
2001-07-27 19:37:31 +00:00
|
|
|
* struct
|
|
|
|
* {
|
|
|
|
* DWORD nPages;
|
|
|
|
* DWORD unknown;
|
|
|
|
* HPROPSHEETPAGE pages[10];
|
|
|
|
* };
|
|
|
|
*/
|
|
|
|
INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
|
|
|
|
LPCSTR lpszPort, LPVOID lpPropSheet )
|
|
|
|
{
|
2002-11-22 22:16:53 +00:00
|
|
|
FIXME("(%p, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet );
|
2001-07-27 19:37:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* @ [GDI32.102]
|
|
|
|
*
|
2009-02-11 12:35:25 +00:00
|
|
|
* This should load the correct driver for lpszDevice and call this driver's
|
2001-07-27 19:37:31 +00:00
|
|
|
* ExtDeviceMode proc.
|
2003-08-12 20:42:18 +00:00
|
|
|
*
|
|
|
|
* FIXME: convert ExtDeviceMode to unicode in the driver interface
|
2001-07-27 19:37:31 +00:00
|
|
|
*/
|
|
|
|
INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
|
|
|
|
LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
|
|
|
|
LPSTR lpszPort, LPDEVMODEA lpdmInput,
|
|
|
|
LPSTR lpszProfile, DWORD fwMode )
|
|
|
|
{
|
2003-08-12 20:42:18 +00:00
|
|
|
WCHAR deviceW[300];
|
|
|
|
WCHAR bufW[300];
|
2001-07-27 19:37:31 +00:00
|
|
|
char buf[300];
|
|
|
|
HDC hdc;
|
|
|
|
DC *dc;
|
|
|
|
INT ret = -1;
|
|
|
|
|
2006-10-12 20:56:56 +00:00
|
|
|
TRACE("(%p, %p, %s, %s, %p, %s, %d)\n",
|
2001-07-27 19:37:31 +00:00
|
|
|
hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
|
|
|
|
|
2003-08-12 20:42:18 +00:00
|
|
|
if (!lpszDevice) return -1;
|
|
|
|
if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
|
|
|
|
|
|
|
|
if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
|
|
|
|
|
|
|
|
if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2001-07-31 17:25:47 +00:00
|
|
|
if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2007-09-24 16:23:42 +00:00
|
|
|
if ((dc = get_dc_ptr( hdc )))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
2007-09-24 16:23:42 +00:00
|
|
|
if (dc->funcs->pExtDeviceMode)
|
|
|
|
ret = dc->funcs->pExtDeviceMode( buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
|
|
|
|
lpdmInput, lpszProfile, fwMode );
|
|
|
|
release_dc_ptr( dc );
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
|
|
|
DeleteDC( hdc );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* @ [GDI32.103]
|
|
|
|
*
|
|
|
|
* This should load the correct driver for lpszDevice and calls this driver's
|
|
|
|
* AdvancedSetupDialog proc.
|
|
|
|
*/
|
|
|
|
INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
|
|
|
|
LPDEVMODEA devin, LPDEVMODEA devout )
|
|
|
|
{
|
2002-11-22 22:16:53 +00:00
|
|
|
TRACE("(%p, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout );
|
2001-07-27 19:37:31 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************
|
|
|
|
* @ [GDI32.104]
|
|
|
|
*
|
|
|
|
* This should load the correct driver for lpszDevice and calls this driver's
|
|
|
|
* DeviceCapabilities proc.
|
2003-08-12 20:42:18 +00:00
|
|
|
*
|
|
|
|
* FIXME: convert DeviceCapabilities to unicode in the driver interface
|
2001-07-27 19:37:31 +00:00
|
|
|
*/
|
|
|
|
DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
|
|
|
|
WORD fwCapability, LPSTR lpszOutput,
|
|
|
|
LPDEVMODEA lpdm )
|
|
|
|
{
|
2003-08-12 20:42:18 +00:00
|
|
|
WCHAR deviceW[300];
|
|
|
|
WCHAR bufW[300];
|
2001-07-27 19:37:31 +00:00
|
|
|
char buf[300];
|
|
|
|
HDC hdc;
|
|
|
|
DC *dc;
|
|
|
|
INT ret = -1;
|
|
|
|
|
|
|
|
TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
|
|
|
|
|
2003-08-12 20:42:18 +00:00
|
|
|
if (!lpszDevice) return -1;
|
|
|
|
if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
|
|
|
|
|
|
|
|
if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
|
|
|
|
|
|
|
|
if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2001-07-31 17:25:47 +00:00
|
|
|
if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
|
2001-07-27 19:37:31 +00:00
|
|
|
|
2007-09-24 16:23:42 +00:00
|
|
|
if ((dc = get_dc_ptr( hdc )))
|
2001-07-27 19:37:31 +00:00
|
|
|
{
|
|
|
|
if (dc->funcs->pDeviceCapabilities)
|
|
|
|
ret = dc->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
|
|
|
|
fwCapability, lpszOutput, lpdm );
|
2007-09-24 16:23:42 +00:00
|
|
|
release_dc_ptr( dc );
|
2001-07-27 19:37:31 +00:00
|
|
|
}
|
|
|
|
DeleteDC( hdc );
|
|
|
|
return ret;
|
|
|
|
}
|
2004-02-12 02:17:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
/************************************************************************
|
|
|
|
* Escape [GDI32.@]
|
|
|
|
*/
|
|
|
|
INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data )
|
|
|
|
{
|
|
|
|
INT ret;
|
|
|
|
POINT *pt;
|
|
|
|
|
|
|
|
switch (escape)
|
|
|
|
{
|
|
|
|
case ABORTDOC:
|
|
|
|
return AbortDoc( hdc );
|
|
|
|
|
|
|
|
case ENDDOC:
|
|
|
|
return EndDoc( hdc );
|
|
|
|
|
|
|
|
case GETPHYSPAGESIZE:
|
|
|
|
pt = out_data;
|
|
|
|
pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
|
|
|
|
pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case GETPRINTINGOFFSET:
|
|
|
|
pt = out_data;
|
|
|
|
pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
|
|
|
|
pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case GETSCALINGFACTOR:
|
|
|
|
pt = out_data;
|
|
|
|
pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
|
|
|
|
pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
case NEWFRAME:
|
|
|
|
return EndPage( hdc );
|
|
|
|
|
|
|
|
case SETABORTPROC:
|
|
|
|
return SetAbortProc( hdc, (ABORTPROC)in_data );
|
|
|
|
|
|
|
|
case STARTDOC:
|
|
|
|
{
|
|
|
|
DOCINFOA doc;
|
|
|
|
char *name = NULL;
|
|
|
|
|
|
|
|
/* in_data may not be 0 terminated so we must copy it */
|
|
|
|
if (in_data)
|
|
|
|
{
|
|
|
|
name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
|
|
|
|
memcpy( name, in_data, in_count );
|
|
|
|
name[in_count] = 0;
|
|
|
|
}
|
|
|
|
/* out_data is actually a pointer to the DocInfo structure and used as
|
|
|
|
* a second input parameter */
|
|
|
|
if (out_data) doc = *(DOCINFOA *)out_data;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
doc.cbSize = sizeof(doc);
|
|
|
|
doc.lpszOutput = NULL;
|
|
|
|
doc.lpszDatatype = NULL;
|
|
|
|
doc.fwType = 0;
|
|
|
|
}
|
|
|
|
doc.lpszDocName = name;
|
|
|
|
ret = StartDocA( hdc, &doc );
|
2004-12-23 17:06:43 +00:00
|
|
|
HeapFree( GetProcessHeap(), 0, name );
|
2004-02-12 02:17:51 +00:00
|
|
|
if (ret > 0) ret = StartPage( hdc );
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
case QUERYESCSUPPORT:
|
|
|
|
{
|
2004-11-30 21:38:57 +00:00
|
|
|
const INT *ptr = (const INT *)in_data;
|
2004-02-12 02:17:51 +00:00
|
|
|
if (in_count < sizeof(INT)) return 0;
|
|
|
|
switch(*ptr)
|
|
|
|
{
|
|
|
|
case ABORTDOC:
|
|
|
|
case ENDDOC:
|
|
|
|
case GETPHYSPAGESIZE:
|
|
|
|
case GETPRINTINGOFFSET:
|
|
|
|
case GETSCALINGFACTOR:
|
|
|
|
case NEWFRAME:
|
|
|
|
case QUERYESCSUPPORT:
|
|
|
|
case SETABORTPROC:
|
|
|
|
case STARTDOC:
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* if not handled internally, pass it to the driver */
|
|
|
|
return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
* ExtEscape [GDI32.@]
|
|
|
|
*
|
2005-11-05 10:45:02 +00:00
|
|
|
* Access capabilities of a particular device that are not available through GDI.
|
|
|
|
*
|
2004-02-12 02:17:51 +00:00
|
|
|
* PARAMS
|
|
|
|
* hdc [I] Handle to device context
|
|
|
|
* nEscape [I] Escape function
|
|
|
|
* cbInput [I] Number of bytes in input structure
|
|
|
|
* lpszInData [I] Pointer to input structure
|
|
|
|
* cbOutput [I] Number of bytes in output structure
|
|
|
|
* lpszOutData [O] Pointer to output structure
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: >0
|
|
|
|
* Not implemented: 0
|
|
|
|
* Failure: <0
|
|
|
|
*/
|
|
|
|
INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
|
|
|
|
INT cbOutput, LPSTR lpszOutData )
|
|
|
|
{
|
|
|
|
INT ret = 0;
|
2007-09-24 16:23:42 +00:00
|
|
|
DC * dc = get_dc_ptr( hdc );
|
2004-02-12 02:17:51 +00:00
|
|
|
if (dc)
|
|
|
|
{
|
|
|
|
if (dc->funcs->pExtEscape)
|
|
|
|
ret = dc->funcs->pExtEscape( dc->physDev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
|
2007-09-24 16:23:42 +00:00
|
|
|
release_dc_ptr( dc );
|
2004-02-12 02:17:51 +00:00
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* DrawEscape [GDI32.@]
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
INT WINAPI DrawEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData)
|
|
|
|
{
|
|
|
|
FIXME("DrawEscape, stub\n");
|
|
|
|
return 0;
|
|
|
|
}
|
2009-01-25 07:04:25 +00:00
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* NamedEscape [GDI32.@]
|
|
|
|
*/
|
|
|
|
INT WINAPI NamedEscape( HDC hdc, LPCWSTR pDriver, INT nEscape, INT cbInput, LPCSTR lpszInData,
|
|
|
|
INT cbOutput, LPSTR lpszOutData )
|
|
|
|
{
|
|
|
|
FIXME("(%p, %s, %d, %d, %p, %d, %p)\n",
|
|
|
|
hdc, wine_dbgstr_w(pDriver), nEscape, cbInput, lpszInData, cbOutput,
|
|
|
|
lpszOutData);
|
|
|
|
return 0;
|
|
|
|
}
|
2009-06-05 16:58:55 +00:00
|
|
|
|
|
|
|
/*******************************************************************
|
|
|
|
* DdQueryDisplaySettingsUniqueness [GDI32.@]
|
|
|
|
* GdiEntry13 [GDI32.@]
|
|
|
|
*/
|
|
|
|
ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID)
|
|
|
|
{
|
2010-03-26 09:33:21 +00:00
|
|
|
static int warn_once;
|
|
|
|
|
|
|
|
if (!warn_once++)
|
|
|
|
FIXME("stub\n");
|
2009-06-05 16:58:55 +00:00
|
|
|
return 0;
|
|
|
|
}
|