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