gdi32: Add a global function to retrieve the display driver.
[wine] / dlls / gdi32 / driver.c
1 /*
2  * Graphics driver management functions
3  *
4  * Copyright 1994 Bob Amstadt
5  * Copyright 1996, 2001 Alexandre Julliard
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include "config.h"
23 #include "wine/port.h"
24
25 #include <stdarg.h>
26 #include <string.h>
27 #include <stdio.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winreg.h"
31 #include "ddrawgdi.h"
32 #include "wine/winbase16.h"
33
34 #include "gdi_private.h"
35 #include "wine/unicode.h"
36 #include "wine/list.h"
37 #include "wine/debug.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(driver);
40
41 struct graphics_driver
42 {
43     struct list             entry;
44     HMODULE                 module;  /* module handle */
45     DC_FUNCTIONS            funcs;
46 };
47
48 static struct list drivers = LIST_INIT( drivers );
49 static struct graphics_driver *display_driver;
50
51 static CRITICAL_SECTION driver_section;
52 static CRITICAL_SECTION_DEBUG critsect_debug =
53 {
54     0, 0, &driver_section,
55     { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
56       0, 0, { (DWORD_PTR)(__FILE__ ": driver_section") }
57 };
58 static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
59
60 /**********************************************************************
61  *           create_driver
62  *
63  * Allocate and fill the driver structure for a given module.
64  */
65 static struct graphics_driver *create_driver( HMODULE module )
66 {
67     struct graphics_driver *driver;
68
69     if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
70     driver->module = module;
71
72     /* fill the function table */
73     if (module)
74     {
75 #define GET_FUNC(name) driver->funcs.p##name = (void*)GetProcAddress( module, #name )
76         GET_FUNC(AbortDoc);
77         GET_FUNC(AbortPath);
78         GET_FUNC(AlphaBlend);
79         GET_FUNC(AngleArc);
80         GET_FUNC(Arc);
81         GET_FUNC(ArcTo);
82         GET_FUNC(BeginPath);
83         GET_FUNC(BitBlt);
84         GET_FUNC(ChoosePixelFormat);
85         GET_FUNC(Chord);
86         GET_FUNC(CloseFigure);
87         GET_FUNC(CreateBitmap);
88         GET_FUNC(CreateDC);
89         GET_FUNC(CreateDIBSection);
90         GET_FUNC(DeleteBitmap);
91         GET_FUNC(DeleteDC);
92         GET_FUNC(DescribePixelFormat);
93         GET_FUNC(DeviceCapabilities);
94         GET_FUNC(Ellipse);
95         GET_FUNC(EndDoc);
96         GET_FUNC(EndPage);
97         GET_FUNC(EndPath);
98         GET_FUNC(EnumDeviceFonts);
99         GET_FUNC(ExcludeClipRect);
100         GET_FUNC(ExtDeviceMode);
101         GET_FUNC(ExtEscape);
102         GET_FUNC(ExtFloodFill);
103         GET_FUNC(ExtSelectClipRgn);
104         GET_FUNC(ExtTextOut);
105         GET_FUNC(FillPath);
106         GET_FUNC(FillRgn);
107         GET_FUNC(FlattenPath);
108         GET_FUNC(FrameRgn);
109         GET_FUNC(GdiComment);
110         GET_FUNC(GetBitmapBits);
111         GET_FUNC(GetCharWidth);
112         GET_FUNC(GetDCOrgEx);
113         GET_FUNC(GetDIBColorTable);
114         GET_FUNC(GetDIBits);
115         GET_FUNC(GetDeviceCaps);
116         GET_FUNC(GetDeviceGammaRamp);
117         GET_FUNC(GetICMProfile);
118         GET_FUNC(GetNearestColor);
119         GET_FUNC(GetPixel);
120         GET_FUNC(GetPixelFormat);
121         GET_FUNC(GetSystemPaletteEntries);
122         GET_FUNC(GetTextExtentExPoint);
123         GET_FUNC(GetTextMetrics);
124         GET_FUNC(IntersectClipRect);
125         GET_FUNC(InvertRgn);
126         GET_FUNC(LineTo);
127         GET_FUNC(MoveTo);
128         GET_FUNC(ModifyWorldTransform);
129         GET_FUNC(OffsetClipRgn);
130         GET_FUNC(OffsetViewportOrg);
131         GET_FUNC(OffsetWindowOrg);
132         GET_FUNC(PaintRgn);
133         GET_FUNC(PatBlt);
134         GET_FUNC(Pie);
135         GET_FUNC(PolyBezier);
136         GET_FUNC(PolyBezierTo);
137         GET_FUNC(PolyDraw);
138         GET_FUNC(PolyPolygon);
139         GET_FUNC(PolyPolyline);
140         GET_FUNC(Polygon);
141         GET_FUNC(Polyline);
142         GET_FUNC(PolylineTo);
143         GET_FUNC(RealizeDefaultPalette);
144         GET_FUNC(RealizePalette);
145         GET_FUNC(Rectangle);
146         GET_FUNC(ResetDC);
147         GET_FUNC(RestoreDC);
148         GET_FUNC(RoundRect);
149         GET_FUNC(SaveDC);
150         GET_FUNC(ScaleViewportExt);
151         GET_FUNC(ScaleWindowExt);
152         GET_FUNC(SelectBitmap);
153         GET_FUNC(SelectBrush);
154         GET_FUNC(SelectClipPath);
155         GET_FUNC(SelectFont);
156         GET_FUNC(SelectPalette);
157         GET_FUNC(SelectPen);
158         GET_FUNC(SetArcDirection);
159         GET_FUNC(SetBitmapBits);
160         GET_FUNC(SetBkColor);
161         GET_FUNC(SetBkMode);
162         GET_FUNC(SetDCBrushColor);
163         GET_FUNC(SetDCPenColor);
164         GET_FUNC(SetDIBColorTable);
165         GET_FUNC(SetDIBits);
166         GET_FUNC(SetDIBitsToDevice);
167         GET_FUNC(SetDeviceClipping);
168         GET_FUNC(SetDeviceGammaRamp);
169         GET_FUNC(SetMapMode);
170         GET_FUNC(SetMapperFlags);
171         GET_FUNC(SetPixel);
172         GET_FUNC(SetPixelFormat);
173         GET_FUNC(SetPolyFillMode);
174         GET_FUNC(SetROP2);
175         GET_FUNC(SetRelAbs);
176         GET_FUNC(SetStretchBltMode);
177         GET_FUNC(SetTextAlign);
178         GET_FUNC(SetTextCharacterExtra);
179         GET_FUNC(SetTextColor);
180         GET_FUNC(SetTextJustification);
181         GET_FUNC(SetViewportExt);
182         GET_FUNC(SetViewportOrg);
183         GET_FUNC(SetWindowExt);
184         GET_FUNC(SetWindowOrg);
185         GET_FUNC(SetWorldTransform);
186         GET_FUNC(StartDoc);
187         GET_FUNC(StartPage);
188         GET_FUNC(StretchBlt);
189         GET_FUNC(StretchDIBits);
190         GET_FUNC(StrokeAndFillPath);
191         GET_FUNC(StrokePath);
192         GET_FUNC(SwapBuffers);
193         GET_FUNC(UnrealizePalette);
194         GET_FUNC(WidenPath);
195
196         /* OpenGL32 */
197         GET_FUNC(wglCreateContext);
198         GET_FUNC(wglCreateContextAttribsARB);
199         GET_FUNC(wglDeleteContext);
200         GET_FUNC(wglGetProcAddress);
201         GET_FUNC(wglGetPbufferDCARB);
202         GET_FUNC(wglMakeContextCurrentARB);
203         GET_FUNC(wglMakeCurrent);
204         GET_FUNC(wglSetPixelFormatWINE);
205         GET_FUNC(wglShareLists);
206         GET_FUNC(wglUseFontBitmapsA);
207         GET_FUNC(wglUseFontBitmapsW);
208 #undef GET_FUNC
209     }
210     else memset( &driver->funcs, 0, sizeof(driver->funcs) );
211
212     return driver;
213 }
214
215
216 /**********************************************************************
217  *           DRIVER_get_display_driver
218  *
219  * Special case for loading the display driver: get the name from the config file
220  */
221 const DC_FUNCTIONS *DRIVER_get_display_driver(void)
222 {
223     struct graphics_driver *driver;
224     char buffer[MAX_PATH], libname[32], *name, *next;
225     HMODULE module = 0;
226     HKEY hkey;
227
228     if (display_driver) return &display_driver->funcs;  /* already loaded */
229
230     strcpy( buffer, "x11" );  /* default value */
231     /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
232     if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
233     {
234         DWORD type, count = sizeof(buffer);
235         RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
236         RegCloseKey( hkey );
237     }
238
239     name = buffer;
240     while (name)
241     {
242         next = strchr( name, ',' );
243         if (next) *next++ = 0;
244
245         snprintf( libname, sizeof(libname), "wine%s.drv", name );
246         if ((module = LoadLibraryA( libname )) != 0) break;
247         name = next;
248     }
249
250     if (!(driver = create_driver( module )))
251     {
252         MESSAGE( "Could not create graphics driver '%s'\n", buffer );
253         FreeLibrary( module );
254         ExitProcess(1);
255     }
256     if (InterlockedCompareExchangePointer( (void **)&display_driver, driver, NULL ))
257     {
258         /* somebody beat us to it */
259         FreeLibrary( driver->module );
260         HeapFree( GetProcessHeap(), 0, driver );
261     }
262     return &display_driver->funcs;
263 }
264
265
266 /**********************************************************************
267  *           DRIVER_load_driver
268  */
269 const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
270 {
271     HMODULE module;
272     struct graphics_driver *driver, *new_driver;
273     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
274     static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
275
276     /* display driver is a special case */
277     if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return DRIVER_get_display_driver();
278
279     if ((module = GetModuleHandleW( name )))
280     {
281         if (display_driver && display_driver->module == module) return &display_driver->funcs;
282         EnterCriticalSection( &driver_section );
283         LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
284         {
285             if (driver->module == module) goto done;
286         }
287         LeaveCriticalSection( &driver_section );
288     }
289
290     if (!(module = LoadLibraryW( name ))) return NULL;
291
292     if (!(new_driver = create_driver( module )))
293     {
294         FreeLibrary( module );
295         return NULL;
296     }
297
298     /* check if someone else added it in the meantime */
299     EnterCriticalSection( &driver_section );
300     LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
301     {
302         if (driver->module != module) continue;
303         FreeLibrary( module );
304         HeapFree( GetProcessHeap(), 0, new_driver );
305         goto done;
306     }
307     driver = new_driver;
308     list_add_head( &drivers, &driver->entry );
309     TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) );
310 done:
311     LeaveCriticalSection( &driver_section );
312     return &driver->funcs;
313 }
314
315
316 /*****************************************************************************
317  *      DRIVER_GetDriverName
318  *
319  */
320 BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
321 {
322     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
323     static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 };
324     static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
325     static const WCHAR empty_strW[] = { 0 };
326     WCHAR *p;
327
328     /* display is a special case */
329     if (!strcmpiW( device, displayW ) ||
330         !strcmpiW( device, display1W ))
331     {
332         lstrcpynW( driver, displayW, size );
333         return TRUE;
334     }
335
336     size = GetProfileStringW(devicesW, device, empty_strW, driver, size);
337     if(!size) {
338         WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
339         return FALSE;
340     }
341     p = strchrW(driver, ',');
342     if(!p)
343     {
344         WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device));
345         return FALSE;
346     }
347     *p = 0;
348     TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device));
349     return TRUE;
350 }
351
352
353 /***********************************************************************
354  *           GdiConvertToDevmodeW    (GDI32.@)
355  */
356 DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
357 {
358     DEVMODEW *dmW;
359     WORD dmW_size, dmA_size;
360
361     dmA_size = dmA->dmSize;
362
363     /* this is the minimal dmSize that XP accepts */
364     if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
365         return NULL;
366
367     if (dmA_size > sizeof(DEVMODEA))
368         dmA_size = sizeof(DEVMODEA);
369
370     dmW_size = dmA_size + CCHDEVICENAME;
371     if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
372         dmW_size += CCHFORMNAME;
373
374     dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
375     if (!dmW) return NULL;
376
377     MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
378                                    dmW->dmDeviceName, CCHDEVICENAME);
379     /* copy slightly more, to avoid long computations */
380     memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
381
382     if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
383     {
384         if (dmA->dmFields & DM_FORMNAME)
385             MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
386                                        dmW->dmFormName, CCHFORMNAME);
387         else
388             dmW->dmFormName[0] = 0;
389
390         if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
391             memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
392     }
393
394     if (dmA->dmDriverExtra)
395         memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
396
397     dmW->dmSize = dmW_size;
398
399     return dmW;
400 }
401
402
403 /*****************************************************************************
404  *      @ [GDI32.100]
405  *
406  * This should thunk to 16-bit and simply call the proc with the given args.
407  */
408 INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
409                                  LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
410 {
411     FIXME("(%p, %p, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
412     return -1;
413 }
414
415 /*****************************************************************************
416  *      @ [GDI32.101]
417  *
418  * This should load the correct driver for lpszDevice and calls this driver's
419  * ExtDeviceModePropSheet proc.
420  *
421  * Note: The driver calls a callback routine for each property sheet page; these
422  * pages are supposed to be filled into the structure pointed to by lpPropSheet.
423  * The layout of this structure is:
424  *
425  * struct
426  * {
427  *   DWORD  nPages;
428  *   DWORD  unknown;
429  *   HPROPSHEETPAGE  pages[10];
430  * };
431  */
432 INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
433                                              LPCSTR lpszPort, LPVOID lpPropSheet )
434 {
435     FIXME("(%p, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet );
436     return -1;
437 }
438
439 /*****************************************************************************
440  *      @ [GDI32.102]
441  *
442  * This should load the correct driver for lpszDevice and call this driver's
443  * ExtDeviceMode proc.
444  *
445  * FIXME: convert ExtDeviceMode to unicode in the driver interface
446  */
447 INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
448                                     LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
449                                     LPSTR lpszPort, LPDEVMODEA lpdmInput,
450                                     LPSTR lpszProfile, DWORD fwMode )
451 {
452     WCHAR deviceW[300];
453     WCHAR bufW[300];
454     char buf[300];
455     HDC hdc;
456     DC *dc;
457     INT ret = -1;
458
459     TRACE("(%p, %p, %s, %s, %p, %s, %d)\n",
460           hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
461
462     if (!lpszDevice) return -1;
463     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
464
465     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
466
467     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
468
469     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
470
471     if ((dc = get_dc_ptr( hdc )))
472     {
473         if (dc->funcs->pExtDeviceMode)
474             ret = dc->funcs->pExtDeviceMode( buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
475                                              lpdmInput, lpszProfile, fwMode );
476         release_dc_ptr( dc );
477     }
478     DeleteDC( hdc );
479     return ret;
480 }
481
482 /****************************************************************************
483  *      @ [GDI32.103]
484  *
485  * This should load the correct driver for lpszDevice and calls this driver's
486  * AdvancedSetupDialog proc.
487  */
488 INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
489                                           LPDEVMODEA devin, LPDEVMODEA devout )
490 {
491     TRACE("(%p, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout );
492     return -1;
493 }
494
495 /*****************************************************************************
496  *      @ [GDI32.104]
497  *
498  * This should load the correct driver for lpszDevice and calls this driver's
499  * DeviceCapabilities proc.
500  *
501  * FIXME: convert DeviceCapabilities to unicode in the driver interface
502  */
503 DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
504                                            WORD fwCapability, LPSTR lpszOutput,
505                                            LPDEVMODEA lpdm )
506 {
507     WCHAR deviceW[300];
508     WCHAR bufW[300];
509     char buf[300];
510     HDC hdc;
511     DC *dc;
512     INT ret = -1;
513
514     TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
515
516     if (!lpszDevice) return -1;
517     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
518
519     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
520
521     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
522
523     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
524
525     if ((dc = get_dc_ptr( hdc )))
526     {
527         if (dc->funcs->pDeviceCapabilities)
528             ret = dc->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
529                                                   fwCapability, lpszOutput, lpdm );
530         release_dc_ptr( dc );
531     }
532     DeleteDC( hdc );
533     return ret;
534 }
535
536
537 /************************************************************************
538  *             Escape  [GDI32.@]
539  */
540 INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data )
541 {
542     INT ret;
543     POINT *pt;
544
545     switch (escape)
546     {
547     case ABORTDOC:
548         return AbortDoc( hdc );
549
550     case ENDDOC:
551         return EndDoc( hdc );
552
553     case GETPHYSPAGESIZE:
554         pt = out_data;
555         pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
556         pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
557         return 1;
558
559     case GETPRINTINGOFFSET:
560         pt = out_data;
561         pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
562         pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
563         return 1;
564
565     case GETSCALINGFACTOR:
566         pt = out_data;
567         pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
568         pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
569         return 1;
570
571     case NEWFRAME:
572         return EndPage( hdc );
573
574     case SETABORTPROC:
575         return SetAbortProc( hdc, (ABORTPROC)in_data );
576
577     case STARTDOC:
578         {
579             DOCINFOA doc;
580             char *name = NULL;
581
582             /* in_data may not be 0 terminated so we must copy it */
583             if (in_data)
584             {
585                 name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
586                 memcpy( name, in_data, in_count );
587                 name[in_count] = 0;
588             }
589             /* out_data is actually a pointer to the DocInfo structure and used as
590              * a second input parameter */
591             if (out_data) doc = *(DOCINFOA *)out_data;
592             else
593             {
594                 doc.cbSize = sizeof(doc);
595                 doc.lpszOutput = NULL;
596                 doc.lpszDatatype = NULL;
597                 doc.fwType = 0;
598             }
599             doc.lpszDocName = name;
600             ret = StartDocA( hdc, &doc );
601             HeapFree( GetProcessHeap(), 0, name );
602             if (ret > 0) ret = StartPage( hdc );
603             return ret;
604         }
605
606     case QUERYESCSUPPORT:
607         {
608             const INT *ptr = (const INT *)in_data;
609             if (in_count < sizeof(INT)) return 0;
610             switch(*ptr)
611             {
612             case ABORTDOC:
613             case ENDDOC:
614             case GETPHYSPAGESIZE:
615             case GETPRINTINGOFFSET:
616             case GETSCALINGFACTOR:
617             case NEWFRAME:
618             case QUERYESCSUPPORT:
619             case SETABORTPROC:
620             case STARTDOC:
621                 return TRUE;
622             }
623             break;
624         }
625     }
626
627     /* if not handled internally, pass it to the driver */
628     return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
629 }
630
631
632 /******************************************************************************
633  *              ExtEscape       [GDI32.@]
634  *
635  * Access capabilities of a particular device that are not available through GDI.
636  *
637  * PARAMS
638  *    hdc         [I] Handle to device context
639  *    nEscape     [I] Escape function
640  *    cbInput     [I] Number of bytes in input structure
641  *    lpszInData  [I] Pointer to input structure
642  *    cbOutput    [I] Number of bytes in output structure
643  *    lpszOutData [O] Pointer to output structure
644  *
645  * RETURNS
646  *    Success: >0
647  *    Not implemented: 0
648  *    Failure: <0
649  */
650 INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
651                       INT cbOutput, LPSTR lpszOutData )
652 {
653     INT ret = 0;
654     DC * dc = get_dc_ptr( hdc );
655     if (dc)
656     {
657         if (dc->funcs->pExtEscape)
658             ret = dc->funcs->pExtEscape( dc->physDev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
659         release_dc_ptr( dc );
660     }
661     return ret;
662 }
663
664
665 /*******************************************************************
666  *      DrawEscape [GDI32.@]
667  *
668  *
669  */
670 INT WINAPI DrawEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData)
671 {
672     FIXME("DrawEscape, stub\n");
673     return 0;
674 }
675
676 /*******************************************************************
677  *      NamedEscape [GDI32.@]
678  */
679 INT WINAPI NamedEscape( HDC hdc, LPCWSTR pDriver, INT nEscape, INT cbInput, LPCSTR lpszInData,
680                         INT cbOutput, LPSTR lpszOutData )
681 {
682     FIXME("(%p, %s, %d, %d, %p, %d, %p)\n",
683           hdc, wine_dbgstr_w(pDriver), nEscape, cbInput, lpszInData, cbOutput,
684           lpszOutData);
685     return 0;
686 }
687
688 /*******************************************************************
689  *      DdQueryDisplaySettingsUniqueness [GDI32.@]
690  *      GdiEntry13                       [GDI32.@]
691  */
692 ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID)
693 {
694     static int warn_once;
695
696     if (!warn_once++)
697         FIXME("stub\n");
698     return 0;
699 }