jscript: Get rid of num_set_nan hack.
[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 <assert.h>
26 #include <stdarg.h>
27 #include <string.h>
28 #include <stdio.h>
29 #include "windef.h"
30 #include "winbase.h"
31 #include "winreg.h"
32 #include "ddrawgdi.h"
33 #include "wine/winbase16.h"
34
35 #include "gdi_private.h"
36 #include "wine/unicode.h"
37 #include "wine/list.h"
38 #include "wine/debug.h"
39
40 WINE_DEFAULT_DEBUG_CHANNEL(driver);
41
42 struct graphics_driver
43 {
44     struct list                entry;
45     HMODULE                    module;  /* module handle */
46     const struct gdi_dc_funcs *funcs;
47 };
48
49 static struct list drivers = LIST_INIT( drivers );
50 static struct graphics_driver *display_driver;
51
52 const struct gdi_dc_funcs *font_driver = NULL;
53
54 static CRITICAL_SECTION driver_section;
55 static CRITICAL_SECTION_DEBUG critsect_debug =
56 {
57     0, 0, &driver_section,
58     { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList },
59       0, 0, { (DWORD_PTR)(__FILE__ ": driver_section") }
60 };
61 static CRITICAL_SECTION driver_section = { &critsect_debug, -1, 0, 0, 0, 0 };
62
63 /**********************************************************************
64  *           create_driver
65  *
66  * Allocate and fill the driver structure for a given module.
67  */
68 static struct graphics_driver *create_driver( HMODULE module )
69 {
70     static const struct gdi_dc_funcs empty_funcs;
71     const struct gdi_dc_funcs *funcs = NULL;
72     struct graphics_driver *driver;
73
74     if (!(driver = HeapAlloc( GetProcessHeap(), 0, sizeof(*driver)))) return NULL;
75     driver->module = module;
76
77     if (module)
78     {
79         const struct gdi_dc_funcs * (CDECL *wine_get_gdi_driver)( unsigned int version );
80
81         if ((wine_get_gdi_driver = (void *)GetProcAddress( module, "wine_get_gdi_driver" )))
82             funcs = wine_get_gdi_driver( WINE_GDI_DRIVER_VERSION );
83     }
84     if (!funcs) funcs = &empty_funcs;
85     driver->funcs = funcs;
86     return driver;
87 }
88
89
90 /**********************************************************************
91  *           get_display_driver
92  *
93  * Special case for loading the display driver: get the name from the config file
94  */
95 static const struct gdi_dc_funcs *get_display_driver(void)
96 {
97     struct graphics_driver *driver;
98     char buffer[MAX_PATH], libname[32], *name, *next;
99     HMODULE module = 0;
100     HKEY hkey;
101
102     if (display_driver) return display_driver->funcs;  /* already loaded */
103
104     strcpy( buffer, "x11" );  /* default value */
105     /* @@ Wine registry key: HKCU\Software\Wine\Drivers */
106     if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Drivers", &hkey ))
107     {
108         DWORD type, count = sizeof(buffer);
109         RegQueryValueExA( hkey, "Graphics", 0, &type, (LPBYTE) buffer, &count );
110         RegCloseKey( hkey );
111     }
112
113     name = buffer;
114     while (name)
115     {
116         next = strchr( name, ',' );
117         if (next) *next++ = 0;
118
119         snprintf( libname, sizeof(libname), "wine%s.drv", name );
120         if ((module = LoadLibraryA( libname )) != 0) break;
121         name = next;
122     }
123
124     if (!(driver = create_driver( module )))
125     {
126         MESSAGE( "Could not create graphics driver '%s'\n", buffer );
127         FreeLibrary( module );
128         ExitProcess(1);
129     }
130     if (InterlockedCompareExchangePointer( (void **)&display_driver, driver, NULL ))
131     {
132         /* somebody beat us to it */
133         FreeLibrary( driver->module );
134         HeapFree( GetProcessHeap(), 0, driver );
135     }
136     return display_driver->funcs;
137 }
138
139
140 /**********************************************************************
141  *           DRIVER_load_driver
142  */
143 const struct gdi_dc_funcs *DRIVER_load_driver( LPCWSTR name )
144 {
145     HMODULE module;
146     struct graphics_driver *driver, *new_driver;
147     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
148     static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
149
150     /* display driver is a special case */
151     if (!strcmpiW( name, displayW ) || !strcmpiW( name, display1W )) return get_display_driver();
152
153     if ((module = GetModuleHandleW( name )))
154     {
155         if (display_driver && display_driver->module == module) return display_driver->funcs;
156         EnterCriticalSection( &driver_section );
157         LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
158         {
159             if (driver->module == module) goto done;
160         }
161         LeaveCriticalSection( &driver_section );
162     }
163
164     if (!(module = LoadLibraryW( name ))) return NULL;
165
166     if (!(new_driver = create_driver( module )))
167     {
168         FreeLibrary( module );
169         return NULL;
170     }
171
172     /* check if someone else added it in the meantime */
173     EnterCriticalSection( &driver_section );
174     LIST_FOR_EACH_ENTRY( driver, &drivers, struct graphics_driver, entry )
175     {
176         if (driver->module != module) continue;
177         FreeLibrary( module );
178         HeapFree( GetProcessHeap(), 0, new_driver );
179         goto done;
180     }
181     driver = new_driver;
182     list_add_head( &drivers, &driver->entry );
183     TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) );
184 done:
185     LeaveCriticalSection( &driver_section );
186     return driver->funcs;
187 }
188
189
190 static INT nulldrv_AbortDoc( PHYSDEV dev )
191 {
192     return 0;
193 }
194
195 static BOOL nulldrv_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
196                          INT xstart, INT ystart, INT xend, INT yend )
197 {
198     return TRUE;
199 }
200
201 static INT nulldrv_ChoosePixelFormat( PHYSDEV dev, const PIXELFORMATDESCRIPTOR *descr )
202 {
203     return 0;
204 }
205
206 static BOOL nulldrv_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
207                            INT xstart, INT ystart, INT xend, INT yend )
208 {
209     return TRUE;
210 }
211
212 static BOOL nulldrv_CreateBitmap( PHYSDEV dev, HBITMAP bitmap )
213 {
214     return TRUE;
215 }
216
217 static BOOL nulldrv_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
218 {
219     if (!display_driver || !display_driver->funcs->pCreateCompatibleDC) return TRUE;
220     return display_driver->funcs->pCreateCompatibleDC( NULL, pdev );
221 }
222
223 static BOOL nulldrv_CreateDC( PHYSDEV *dev, LPCWSTR driver, LPCWSTR device,
224                               LPCWSTR output, const DEVMODEW *devmode )
225 {
226     assert(0);  /* should never be called */
227     return FALSE;
228 }
229
230 static BOOL nulldrv_DeleteBitmap( HBITMAP bitmap )
231 {
232     return TRUE;
233 }
234
235 static BOOL nulldrv_DeleteDC( PHYSDEV dev )
236 {
237     assert(0);  /* should never be called */
238     return TRUE;
239 }
240
241 static BOOL nulldrv_DeleteObject( PHYSDEV dev, HGDIOBJ obj )
242 {
243     return TRUE;
244 }
245
246 static INT nulldrv_DescribePixelFormat( PHYSDEV dev, INT format, UINT size, PIXELFORMATDESCRIPTOR * descr )
247 {
248     return 0;
249 }
250
251 static DWORD nulldrv_DeviceCapabilities( LPSTR buffer, LPCSTR device, LPCSTR port,
252                                          WORD cap, LPSTR output, DEVMODEA *devmode )
253 {
254     return -1;
255 }
256
257 static BOOL nulldrv_Ellipse( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
258 {
259     return TRUE;
260 }
261
262 static INT nulldrv_EndDoc( PHYSDEV dev )
263 {
264     return 0;
265 }
266
267 static INT nulldrv_EndPage( PHYSDEV dev )
268 {
269     return 0;
270 }
271
272 static BOOL nulldrv_EnumFonts( PHYSDEV dev, LOGFONTW *logfont, FONTENUMPROCW proc, LPARAM lParam )
273 {
274     return TRUE;
275 }
276
277 static INT nulldrv_EnumICMProfiles( PHYSDEV dev, ICMENUMPROCW func, LPARAM lparam )
278 {
279     return -1;
280 }
281
282 static INT nulldrv_ExtDeviceMode( LPSTR buffer, HWND hwnd, DEVMODEA *output, LPSTR device,
283                                   LPSTR port, DEVMODEA *input, LPSTR profile, DWORD mode )
284 {
285     return -1;
286 }
287
288 static INT nulldrv_ExtEscape( PHYSDEV dev, INT escape, INT in_size, const void *in_data,
289                                     INT out_size, void *out_data )
290 {
291     return 0;
292 }
293
294 static BOOL nulldrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT type )
295 {
296     return TRUE;
297 }
298
299 static BOOL nulldrv_FontIsLinked( PHYSDEV dev )
300 {
301     return FALSE;
302 }
303
304 static BOOL nulldrv_GdiComment( PHYSDEV dev, UINT size, const BYTE *data )
305 {
306     return FALSE;
307 }
308
309 static BOOL nulldrv_GdiRealizationInfo( PHYSDEV dev, void *info )
310 {
311     return FALSE;
312 }
313
314 static UINT nulldrv_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
315 {
316     return DCB_RESET;
317 }
318
319 static BOOL nulldrv_GetCharABCWidths( PHYSDEV dev, UINT first, UINT last, LPABC abc )
320 {
321     return FALSE;
322 }
323
324 static BOOL nulldrv_GetCharABCWidthsI( PHYSDEV dev, UINT first, UINT count, WORD *indices, LPABC abc )
325 {
326     return FALSE;
327 }
328
329 static BOOL nulldrv_GetCharWidth( PHYSDEV dev, UINT first, UINT last, INT *buffer )
330 {
331     return FALSE;
332 }
333
334 static INT nulldrv_GetDeviceCaps( PHYSDEV dev, INT cap )
335 {
336     switch (cap)  /* return meaningful values for some entries */
337     {
338     case HORZRES:     return 640;
339     case VERTRES:     return 480;
340     case BITSPIXEL:   return 1;
341     case PLANES:      return 1;
342     case NUMCOLORS:   return 2;
343     case ASPECTX:     return 36;
344     case ASPECTY:     return 36;
345     case ASPECTXY:    return 51;
346     case LOGPIXELSX:  return 72;
347     case LOGPIXELSY:  return 72;
348     case SIZEPALETTE: return 2;
349     case TEXTCAPS:    return (TC_OP_CHARACTER | TC_OP_STROKE | TC_CP_STROKE |
350                               TC_CR_ANY | TC_SF_X_YINDEP | TC_SA_DOUBLE | TC_SA_INTEGER |
351                               TC_SA_CONTIN | TC_UA_ABLE | TC_SO_ABLE | TC_RA_ABLE | TC_VA_ABLE);
352     default:          return 0;
353     }
354 }
355
356 static BOOL nulldrv_GetDeviceGammaRamp( PHYSDEV dev, void *ramp )
357 {
358     SetLastError( ERROR_INVALID_PARAMETER );
359     return FALSE;
360 }
361
362 static DWORD nulldrv_GetFontData( PHYSDEV dev, DWORD table, DWORD offset, LPVOID buffer, DWORD length )
363 {
364     return FALSE;
365 }
366
367 static DWORD nulldrv_GetFontUnicodeRanges( PHYSDEV dev, LPGLYPHSET glyphs )
368 {
369     return 0;
370 }
371
372 static DWORD nulldrv_GetGlyphIndices( PHYSDEV dev, LPCWSTR str, INT count, LPWORD indices, DWORD flags )
373 {
374     return GDI_ERROR;
375 }
376
377 static DWORD nulldrv_GetGlyphOutline( PHYSDEV dev, UINT ch, UINT format, LPGLYPHMETRICS metrics,
378                                       DWORD size, LPVOID buffer, const MAT2 *mat )
379 {
380     return GDI_ERROR;
381 }
382
383 static BOOL nulldrv_GetICMProfile( PHYSDEV dev, LPDWORD size, LPWSTR filename )
384 {
385     return FALSE;
386 }
387
388 static DWORD nulldrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
389                                struct gdi_image_bits *bits, struct bitblt_coords *src )
390 {
391     return ERROR_NOT_SUPPORTED;
392 }
393
394 static DWORD nulldrv_GetKerningPairs( PHYSDEV dev, DWORD count, LPKERNINGPAIR pairs )
395 {
396     return 0;
397 }
398
399 static UINT nulldrv_GetOutlineTextMetrics( PHYSDEV dev, UINT size, LPOUTLINETEXTMETRICW otm )
400 {
401     return 0;
402 }
403
404 static INT nulldrv_GetPixelFormat( PHYSDEV dev )
405 {
406     return 0;
407 }
408
409 static UINT nulldrv_GetSystemPaletteEntries( PHYSDEV dev, UINT start, UINT count, PALETTEENTRY *entries )
410 {
411     return 0;
412 }
413
414 static UINT nulldrv_GetTextCharsetInfo( PHYSDEV dev, LPFONTSIGNATURE fs, DWORD flags )
415 {
416     return DEFAULT_CHARSET;
417 }
418
419 static BOOL nulldrv_GetTextExtentExPoint( PHYSDEV dev, LPCWSTR str, INT count, INT max_ext,
420                                           INT *fit, INT *dx, SIZE *size )
421 {
422     return FALSE;
423 }
424
425 static BOOL nulldrv_GetTextExtentExPointI( PHYSDEV dev, const WORD *indices, INT count, INT max_ext,
426                                            INT *fit, INT *dx, SIZE *size )
427 {
428     return FALSE;
429 }
430
431 static INT nulldrv_GetTextFace( PHYSDEV dev, INT size, LPWSTR name )
432 {
433     INT ret = 0;
434     LOGFONTW font;
435     HFONT hfont = GetCurrentObject( dev->hdc, OBJ_FONT );
436
437     if (GetObjectW( hfont, sizeof(font), &font ))
438     {
439         ret = strlenW( font.lfFaceName ) + 1;
440         if (name)
441         {
442             lstrcpynW( name, font.lfFaceName, size );
443             ret = min( size, ret );
444         }
445     }
446     return ret;
447 }
448
449 static BOOL nulldrv_GetTextMetrics( PHYSDEV dev, TEXTMETRICW *metrics )
450 {
451     return FALSE;
452 }
453
454 static BOOL nulldrv_LineTo( PHYSDEV dev, INT x, INT y )
455 {
456     return TRUE;
457 }
458
459 static BOOL nulldrv_MoveTo( PHYSDEV dev, INT x, INT y )
460 {
461     return TRUE;
462 }
463
464 static BOOL nulldrv_PaintRgn( PHYSDEV dev, HRGN rgn )
465 {
466     return TRUE;
467 }
468
469 static BOOL nulldrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop )
470 {
471     return TRUE;
472 }
473
474 static BOOL nulldrv_Pie( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
475                          INT xstart, INT ystart, INT xend, INT yend )
476 {
477     return TRUE;
478 }
479
480 static BOOL nulldrv_PolyPolygon( PHYSDEV dev, const POINT *points, const INT *counts, UINT polygons )
481 {
482     return TRUE;
483 }
484
485 static BOOL nulldrv_PolyPolyline( PHYSDEV dev, const POINT *points, const DWORD *counts, DWORD lines )
486 {
487     return TRUE;
488 }
489
490 static BOOL nulldrv_Polygon( PHYSDEV dev, const POINT *points, INT count )
491 {
492     INT counts[1] = { count };
493
494     return PolyPolygon( dev->hdc, points, counts, 1 );
495 }
496
497 static BOOL nulldrv_Polyline( PHYSDEV dev, const POINT *points, INT count )
498 {
499     DWORD counts[1] = { count };
500
501     if (count < 0) return FALSE;
502     return PolyPolyline( dev->hdc, points, counts, 1 );
503 }
504
505 static DWORD nulldrv_PutImage( PHYSDEV dev, HBITMAP hbitmap, HRGN clip, BITMAPINFO *info,
506                                const struct gdi_image_bits *bits, struct bitblt_coords *src,
507                                struct bitblt_coords *dst, DWORD rop )
508 {
509     return ERROR_SUCCESS;
510 }
511
512 static UINT nulldrv_RealizeDefaultPalette( PHYSDEV dev )
513 {
514     return 0;
515 }
516
517 static UINT nulldrv_RealizePalette( PHYSDEV dev, HPALETTE palette, BOOL primary )
518 {
519     return 0;
520 }
521
522 static BOOL nulldrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom )
523 {
524     return TRUE;
525 }
526
527 static HDC nulldrv_ResetDC( PHYSDEV dev, const DEVMODEW *devmode )
528 {
529     return 0;
530 }
531
532 static BOOL nulldrv_RoundRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom,
533                                INT ell_width, INT ell_height )
534 {
535     return TRUE;
536 }
537
538 static HBITMAP nulldrv_SelectBitmap( PHYSDEV dev, HBITMAP bitmap )
539 {
540     return bitmap;
541 }
542
543 static HBRUSH nulldrv_SelectBrush( PHYSDEV dev, HBRUSH brush, const struct brush_pattern *pattern )
544 {
545     return brush;
546 }
547
548 static HFONT nulldrv_SelectFont( PHYSDEV dev, HFONT font )
549 {
550     return 0;
551 }
552
553 static HPALETTE nulldrv_SelectPalette( PHYSDEV dev, HPALETTE palette, BOOL bkgnd )
554 {
555     return palette;
556 }
557
558 static HPEN nulldrv_SelectPen( PHYSDEV dev, HPEN pen, const struct brush_pattern *pattern )
559 {
560     return pen;
561 }
562
563 static INT nulldrv_SetArcDirection( PHYSDEV dev, INT dir )
564 {
565     return dir;
566 }
567
568 static COLORREF nulldrv_SetBkColor( PHYSDEV dev, COLORREF color )
569 {
570     return color;
571 }
572
573 static INT nulldrv_SetBkMode( PHYSDEV dev, INT mode )
574 {
575     return mode;
576 }
577
578 static UINT nulldrv_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
579 {
580     return DCB_RESET;
581 }
582
583 static COLORREF nulldrv_SetDCBrushColor( PHYSDEV dev, COLORREF color )
584 {
585     return color;
586 }
587
588 static COLORREF nulldrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
589 {
590     return color;
591 }
592
593 static void nulldrv_SetDeviceClipping( PHYSDEV dev, HRGN rgn )
594 {
595 }
596
597 static DWORD nulldrv_SetLayout( PHYSDEV dev, DWORD layout )
598 {
599     return layout;
600 }
601
602 static BOOL nulldrv_SetDeviceGammaRamp( PHYSDEV dev, void *ramp )
603 {
604     SetLastError( ERROR_INVALID_PARAMETER );
605     return FALSE;
606 }
607
608 static DWORD nulldrv_SetMapperFlags( PHYSDEV dev, DWORD flags )
609 {
610     return flags;
611 }
612
613 static COLORREF nulldrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color )
614 {
615     return color;
616 }
617
618 static BOOL nulldrv_SetPixelFormat( PHYSDEV dev, INT format, const PIXELFORMATDESCRIPTOR *descr )
619 {
620     return FALSE;
621 }
622
623 static INT nulldrv_SetPolyFillMode( PHYSDEV dev, INT mode )
624 {
625     return mode;
626 }
627
628 static INT nulldrv_SetROP2( PHYSDEV dev, INT rop )
629 {
630     return rop;
631 }
632
633 static INT nulldrv_SetRelAbs( PHYSDEV dev, INT mode )
634 {
635     return mode;
636 }
637
638 static INT nulldrv_SetStretchBltMode( PHYSDEV dev, INT mode )
639 {
640     return mode;
641 }
642
643 static UINT nulldrv_SetTextAlign( PHYSDEV dev, UINT align )
644 {
645     return align;
646 }
647
648 static INT nulldrv_SetTextCharacterExtra( PHYSDEV dev, INT extra )
649 {
650     return extra;
651 }
652
653 static COLORREF nulldrv_SetTextColor( PHYSDEV dev, COLORREF color )
654 {
655     return color;
656 }
657
658 static BOOL nulldrv_SetTextJustification( PHYSDEV dev, INT extra, INT breaks )
659 {
660     return TRUE;
661 }
662
663 static INT nulldrv_StartDoc( PHYSDEV dev, const DOCINFOW *info )
664 {
665     return 0;
666 }
667
668 static INT nulldrv_StartPage( PHYSDEV dev )
669 {
670     return 1;
671 }
672
673 static BOOL nulldrv_SwapBuffers( PHYSDEV dev )
674 {
675     return TRUE;
676 }
677
678 static BOOL nulldrv_UnrealizePalette( HPALETTE palette )
679 {
680     return FALSE;
681 }
682
683 static BOOL nulldrv_wglCopyContext( HGLRC ctx_src, HGLRC ctx_dst, UINT mask )
684 {
685     return FALSE;
686 }
687
688 static HGLRC nulldrv_wglCreateContext( PHYSDEV dev )
689 {
690     return 0;
691 }
692
693 static HGLRC nulldrv_wglCreateContextAttribsARB( PHYSDEV dev, HGLRC share_ctx, const int *attribs )
694 {
695     return 0;
696 }
697
698 static BOOL nulldrv_wglDeleteContext( HGLRC ctx )
699 {
700     return FALSE;
701 }
702
703 static PROC nulldrv_wglGetProcAddress( LPCSTR name )
704 {
705     return NULL;
706 }
707
708 static BOOL nulldrv_wglMakeCurrent( PHYSDEV dev, HGLRC ctx )
709 {
710     return FALSE;
711 }
712
713 static BOOL nulldrv_wglMakeContextCurrentARB( PHYSDEV dev_draw, PHYSDEV dev_read, HGLRC ctx )
714 {
715     return FALSE;
716 }
717
718 static BOOL nulldrv_wglSetPixelFormatWINE( PHYSDEV dev, INT format, const PIXELFORMATDESCRIPTOR *descr )
719 {
720     return FALSE;
721 }
722
723 static BOOL nulldrv_wglShareLists( HGLRC ctx1, HGLRC ctx2 )
724 {
725     return FALSE;
726 }
727
728 static BOOL nulldrv_wglUseFontBitmapsA( PHYSDEV dev, DWORD start, DWORD count, DWORD base )
729 {
730     return FALSE;
731 }
732
733 static BOOL nulldrv_wglUseFontBitmapsW( PHYSDEV dev, DWORD start, DWORD count, DWORD base )
734 {
735     return FALSE;
736 }
737
738 const struct gdi_dc_funcs null_driver =
739 {
740     nulldrv_AbortDoc,                   /* pAbortDoc */
741     nulldrv_AbortPath,                  /* pAbortPath */
742     nulldrv_AlphaBlend,                 /* pAlphaBlend */
743     nulldrv_AngleArc,                   /* pAngleArc */
744     nulldrv_Arc,                        /* pArc */
745     nulldrv_ArcTo,                      /* pArcTo */
746     nulldrv_BeginPath,                  /* pBeginPath */
747     nulldrv_BlendImage,                 /* pBlendImage */
748     nulldrv_ChoosePixelFormat,          /* pChoosePixelFormat */
749     nulldrv_Chord,                      /* pChord */
750     nulldrv_CloseFigure,                /* pCloseFigure */
751     nulldrv_CreateBitmap,               /* pCreateBitmap */
752     nulldrv_CreateCompatibleDC,         /* pCreateCompatibleDC */
753     nulldrv_CreateDC,                   /* pCreateDC */
754     nulldrv_DeleteBitmap,               /* pDeleteBitmap */
755     nulldrv_DeleteDC,                   /* pDeleteDC */
756     nulldrv_DeleteObject,               /* pDeleteObject */
757     nulldrv_DescribePixelFormat,        /* pDescribePixelFormat */
758     nulldrv_DeviceCapabilities,         /* pDeviceCapabilities */
759     nulldrv_Ellipse,                    /* pEllipse */
760     nulldrv_EndDoc,                     /* pEndDoc */
761     nulldrv_EndPage,                    /* pEndPage */
762     nulldrv_EndPath,                    /* pEndPath */
763     nulldrv_EnumFonts,                  /* pEnumFonts */
764     nulldrv_EnumICMProfiles,            /* pEnumICMProfiles */
765     nulldrv_ExcludeClipRect,            /* pExcludeClipRect */
766     nulldrv_ExtDeviceMode,              /* pExtDeviceMode */
767     nulldrv_ExtEscape,                  /* pExtEscape */
768     nulldrv_ExtFloodFill,               /* pExtFloodFill */
769     nulldrv_ExtSelectClipRgn,           /* pExtSelectClipRgn */
770     nulldrv_ExtTextOut,                 /* pExtTextOut */
771     nulldrv_FillPath,                   /* pFillPath */
772     nulldrv_FillRgn,                    /* pFillRgn */
773     nulldrv_FlattenPath,                /* pFlattenPath */
774     nulldrv_FontIsLinked,               /* pFontIsLinked */
775     nulldrv_FrameRgn,                   /* pFrameRgn */
776     nulldrv_GdiComment,                 /* pGdiComment */
777     nulldrv_GdiRealizationInfo,         /* pGdiRealizationInfo */
778     nulldrv_GetBoundsRect,              /* pGetBoundsRect */
779     nulldrv_GetCharABCWidths,           /* pGetCharABCWidths */
780     nulldrv_GetCharABCWidthsI,          /* pGetCharABCWidthsI */
781     nulldrv_GetCharWidth,               /* pGetCharWidth */
782     nulldrv_GetDeviceCaps,              /* pGetDeviceCaps */
783     nulldrv_GetDeviceGammaRamp,         /* pGetDeviceGammaRamp */
784     nulldrv_GetFontData,                /* pGetFontData */
785     nulldrv_GetFontUnicodeRanges,       /* pGetFontUnicodeRanges */
786     nulldrv_GetGlyphIndices,            /* pGetGlyphIndices */
787     nulldrv_GetGlyphOutline,            /* pGetGlyphOutline */
788     nulldrv_GetICMProfile,              /* pGetICMProfile */
789     nulldrv_GetImage,                   /* pGetImage */
790     nulldrv_GetKerningPairs,            /* pGetKerningPairs */
791     nulldrv_GetNearestColor,            /* pGetNearestColor */
792     nulldrv_GetOutlineTextMetrics,      /* pGetOutlineTextMetrics */
793     nulldrv_GetPixel,                   /* pGetPixel */
794     nulldrv_GetPixelFormat,             /* pGetPixelFormat */
795     nulldrv_GetSystemPaletteEntries,    /* pGetSystemPaletteEntries */
796     nulldrv_GetTextCharsetInfo,         /* pGetTextCharsetInfo */
797     nulldrv_GetTextExtentExPoint,       /* pGetTextExtentExPoint */
798     nulldrv_GetTextExtentExPointI,      /* pGetTextExtentExPointI */
799     nulldrv_GetTextFace,                /* pGetTextFace */
800     nulldrv_GetTextMetrics,             /* pGetTextMetrics */
801     nulldrv_GradientFill,               /* pGradientFill */
802     nulldrv_IntersectClipRect,          /* pIntersectClipRect */
803     nulldrv_InvertRgn,                  /* pInvertRgn */
804     nulldrv_LineTo,                     /* pLineTo */
805     nulldrv_ModifyWorldTransform,       /* pModifyWorldTransform */
806     nulldrv_MoveTo,                     /* pMoveTo */
807     nulldrv_OffsetClipRgn,              /* pOffsetClipRgn */
808     nulldrv_OffsetViewportOrgEx,        /* pOffsetViewportOrg */
809     nulldrv_OffsetWindowOrgEx,          /* pOffsetWindowOrg */
810     nulldrv_PaintRgn,                   /* pPaintRgn */
811     nulldrv_PatBlt,                     /* pPatBlt */
812     nulldrv_Pie,                        /* pPie */
813     nulldrv_PolyBezier,                 /* pPolyBezier */
814     nulldrv_PolyBezierTo,               /* pPolyBezierTo */
815     nulldrv_PolyDraw,                   /* pPolyDraw */
816     nulldrv_PolyPolygon,                /* pPolyPolygon */
817     nulldrv_PolyPolyline,               /* pPolyPolyline */
818     nulldrv_Polygon,                    /* pPolygon */
819     nulldrv_Polyline,                   /* pPolyline */
820     nulldrv_PolylineTo,                 /* pPolylineTo */
821     nulldrv_PutImage,                   /* pPutImage */
822     nulldrv_RealizeDefaultPalette,      /* pRealizeDefaultPalette */
823     nulldrv_RealizePalette,             /* pRealizePalette */
824     nulldrv_Rectangle,                  /* pRectangle */
825     nulldrv_ResetDC,                    /* pResetDC */
826     nulldrv_RestoreDC,                  /* pRestoreDC */
827     nulldrv_RoundRect,                  /* pRoundRect */
828     nulldrv_SaveDC,                     /* pSaveDC */
829     nulldrv_ScaleViewportExtEx,         /* pScaleViewportExt */
830     nulldrv_ScaleWindowExtEx,           /* pScaleWindowExt */
831     nulldrv_SelectBitmap,               /* pSelectBitmap */
832     nulldrv_SelectBrush,                /* pSelectBrush */
833     nulldrv_SelectClipPath,             /* pSelectClipPath */
834     nulldrv_SelectFont,                 /* pSelectFont */
835     nulldrv_SelectPalette,              /* pSelectPalette */
836     nulldrv_SelectPen,                  /* pSelectPen */
837     nulldrv_SetArcDirection,            /* pSetArcDirection */
838     nulldrv_SetBkColor,                 /* pSetBkColor */
839     nulldrv_SetBkMode,                  /* pSetBkMode */
840     nulldrv_SetBoundsRect,              /* pSetBoundsRect */
841     nulldrv_SetDCBrushColor,            /* pSetDCBrushColor */
842     nulldrv_SetDCPenColor,              /* pSetDCPenColor */
843     nulldrv_SetDIBitsToDevice,          /* pSetDIBitsToDevice */
844     nulldrv_SetDeviceClipping,          /* pSetDeviceClipping */
845     nulldrv_SetDeviceGammaRamp,         /* pSetDeviceGammaRamp */
846     nulldrv_SetLayout,                  /* pSetLayout */
847     nulldrv_SetMapMode,                 /* pSetMapMode */
848     nulldrv_SetMapperFlags,             /* pSetMapperFlags */
849     nulldrv_SetPixel,                   /* pSetPixel */
850     nulldrv_SetPixelFormat,             /* pSetPixelFormat */
851     nulldrv_SetPolyFillMode,            /* pSetPolyFillMode */
852     nulldrv_SetROP2,                    /* pSetROP2 */
853     nulldrv_SetRelAbs,                  /* pSetRelAbs */
854     nulldrv_SetStretchBltMode,          /* pSetStretchBltMode */
855     nulldrv_SetTextAlign,               /* pSetTextAlign */
856     nulldrv_SetTextCharacterExtra,      /* pSetTextCharacterExtra */
857     nulldrv_SetTextColor,               /* pSetTextColor */
858     nulldrv_SetTextJustification,       /* pSetTextJustification */
859     nulldrv_SetViewportExtEx,           /* pSetViewportExt */
860     nulldrv_SetViewportOrgEx,           /* pSetViewportOrg */
861     nulldrv_SetWindowExtEx,             /* pSetWindowExt */
862     nulldrv_SetWindowOrgEx,             /* pSetWindowOrg */
863     nulldrv_SetWorldTransform,          /* pSetWorldTransform */
864     nulldrv_StartDoc,                   /* pStartDoc */
865     nulldrv_StartPage,                  /* pStartPage */
866     nulldrv_StretchBlt,                 /* pStretchBlt */
867     nulldrv_StretchDIBits,              /* pStretchDIBits */
868     nulldrv_StrokeAndFillPath,          /* pStrokeAndFillPath */
869     nulldrv_StrokePath,                 /* pStrokePath */
870     nulldrv_SwapBuffers,                /* pSwapBuffers */
871     nulldrv_UnrealizePalette,           /* pUnrealizePalette */
872     nulldrv_WidenPath,                  /* pWidenPath */
873     nulldrv_wglCopyContext,             /* pwglCopyContext */
874     nulldrv_wglCreateContext,           /* pwglCreateContext */
875     nulldrv_wglCreateContextAttribsARB, /* pwglCreateContextAttribsARB */
876     nulldrv_wglDeleteContext,           /* pwglDeleteContext */
877     nulldrv_wglGetProcAddress,          /* pwglGetProcAddress */
878     nulldrv_wglMakeContextCurrentARB,   /* pwglMakeContextCurrentARB */
879     nulldrv_wglMakeCurrent,             /* pwglMakeCurrent */
880     nulldrv_wglSetPixelFormatWINE,      /* pwglSetPixelFormatWINE */
881     nulldrv_wglShareLists,              /* pwglShareLists */
882     nulldrv_wglUseFontBitmapsA,         /* pwglUseFontBitmapsA */
883     nulldrv_wglUseFontBitmapsW,         /* pwglUseFontBitmapsW */
884
885     GDI_PRIORITY_NULL_DRV               /* priority */
886 };
887
888
889 /*****************************************************************************
890  *      DRIVER_GetDriverName
891  *
892  */
893 BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
894 {
895     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
896     static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 };
897     static const WCHAR display1W[] = {'\\','\\','.','\\','D','I','S','P','L','A','Y','1',0};
898     static const WCHAR empty_strW[] = { 0 };
899     WCHAR *p;
900
901     /* display is a special case */
902     if (!strcmpiW( device, displayW ) ||
903         !strcmpiW( device, display1W ))
904     {
905         lstrcpynW( driver, displayW, size );
906         return TRUE;
907     }
908
909     size = GetProfileStringW(devicesW, device, empty_strW, driver, size);
910     if(!size) {
911         WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
912         return FALSE;
913     }
914     p = strchrW(driver, ',');
915     if(!p)
916     {
917         WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device));
918         return FALSE;
919     }
920     *p = 0;
921     TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device));
922     return TRUE;
923 }
924
925
926 /***********************************************************************
927  *           GdiConvertToDevmodeW    (GDI32.@)
928  */
929 DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
930 {
931     DEVMODEW *dmW;
932     WORD dmW_size, dmA_size;
933
934     dmA_size = dmA->dmSize;
935
936     /* this is the minimal dmSize that XP accepts */
937     if (dmA_size < FIELD_OFFSET(DEVMODEA, dmFields))
938         return NULL;
939
940     if (dmA_size > sizeof(DEVMODEA))
941         dmA_size = sizeof(DEVMODEA);
942
943     dmW_size = dmA_size + CCHDEVICENAME;
944     if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
945         dmW_size += CCHFORMNAME;
946
947     dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
948     if (!dmW) return NULL;
949
950     MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmDeviceName, -1,
951                                    dmW->dmDeviceName, CCHDEVICENAME);
952     /* copy slightly more, to avoid long computations */
953     memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA_size - CCHDEVICENAME);
954
955     if (dmA_size >= FIELD_OFFSET(DEVMODEA, dmFormName) + CCHFORMNAME)
956     {
957         if (dmA->dmFields & DM_FORMNAME)
958             MultiByteToWideChar(CP_ACP, 0, (const char*) dmA->dmFormName, -1,
959                                        dmW->dmFormName, CCHFORMNAME);
960         else
961             dmW->dmFormName[0] = 0;
962
963         if (dmA_size > FIELD_OFFSET(DEVMODEA, dmLogPixels))
964             memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA_size - FIELD_OFFSET(DEVMODEA, dmLogPixels));
965     }
966
967     if (dmA->dmDriverExtra)
968         memcpy((char *)dmW + dmW_size, (const char *)dmA + dmA_size, dmA->dmDriverExtra);
969
970     dmW->dmSize = dmW_size;
971
972     return dmW;
973 }
974
975
976 /*****************************************************************************
977  *      @ [GDI32.100]
978  *
979  * This should thunk to 16-bit and simply call the proc with the given args.
980  */
981 INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
982                                  LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
983 {
984     FIXME("(%p, %p, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
985     return -1;
986 }
987
988 /*****************************************************************************
989  *      @ [GDI32.101]
990  *
991  * This should load the correct driver for lpszDevice and calls this driver's
992  * ExtDeviceModePropSheet proc.
993  *
994  * Note: The driver calls a callback routine for each property sheet page; these
995  * pages are supposed to be filled into the structure pointed to by lpPropSheet.
996  * The layout of this structure is:
997  *
998  * struct
999  * {
1000  *   DWORD  nPages;
1001  *   DWORD  unknown;
1002  *   HPROPSHEETPAGE  pages[10];
1003  * };
1004  */
1005 INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
1006                                              LPCSTR lpszPort, LPVOID lpPropSheet )
1007 {
1008     FIXME("(%p, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet );
1009     return -1;
1010 }
1011
1012 /*****************************************************************************
1013  *      @ [GDI32.102]
1014  *
1015  * This should load the correct driver for lpszDevice and call this driver's
1016  * ExtDeviceMode proc.
1017  *
1018  * FIXME: convert ExtDeviceMode to unicode in the driver interface
1019  */
1020 INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
1021                                     LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
1022                                     LPSTR lpszPort, LPDEVMODEA lpdmInput,
1023                                     LPSTR lpszProfile, DWORD fwMode )
1024 {
1025     WCHAR deviceW[300];
1026     WCHAR bufW[300];
1027     char buf[300];
1028     HDC hdc;
1029     DC *dc;
1030     INT ret = -1;
1031
1032     TRACE("(%p, %p, %s, %s, %p, %s, %d)\n",
1033           hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
1034
1035     if (!lpszDevice) return -1;
1036     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
1037
1038     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
1039
1040     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
1041
1042     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
1043
1044     if ((dc = get_dc_ptr( hdc )))
1045     {
1046         PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtDeviceMode );
1047         ret = physdev->funcs->pExtDeviceMode( buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
1048                                               lpdmInput, lpszProfile, fwMode );
1049         release_dc_ptr( dc );
1050     }
1051     DeleteDC( hdc );
1052     return ret;
1053 }
1054
1055 /****************************************************************************
1056  *      @ [GDI32.103]
1057  *
1058  * This should load the correct driver for lpszDevice and calls this driver's
1059  * AdvancedSetupDialog proc.
1060  */
1061 INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
1062                                           LPDEVMODEA devin, LPDEVMODEA devout )
1063 {
1064     TRACE("(%p, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout );
1065     return -1;
1066 }
1067
1068 /*****************************************************************************
1069  *      @ [GDI32.104]
1070  *
1071  * This should load the correct driver for lpszDevice and calls this driver's
1072  * DeviceCapabilities proc.
1073  *
1074  * FIXME: convert DeviceCapabilities to unicode in the driver interface
1075  */
1076 DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
1077                                            WORD fwCapability, LPSTR lpszOutput,
1078                                            LPDEVMODEA lpdm )
1079 {
1080     WCHAR deviceW[300];
1081     WCHAR bufW[300];
1082     char buf[300];
1083     HDC hdc;
1084     DC *dc;
1085     INT ret = -1;
1086
1087     TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
1088
1089     if (!lpszDevice) return -1;
1090     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
1091
1092     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
1093
1094     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
1095
1096     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
1097
1098     if ((dc = get_dc_ptr( hdc )))
1099     {
1100         PHYSDEV physdev = GET_DC_PHYSDEV( dc, pDeviceCapabilities );
1101         ret = physdev->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
1102                                                    fwCapability, lpszOutput, lpdm );
1103         release_dc_ptr( dc );
1104     }
1105     DeleteDC( hdc );
1106     return ret;
1107 }
1108
1109
1110 /************************************************************************
1111  *             Escape  [GDI32.@]
1112  */
1113 INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data )
1114 {
1115     INT ret;
1116     POINT *pt;
1117
1118     switch (escape)
1119     {
1120     case ABORTDOC:
1121         return AbortDoc( hdc );
1122
1123     case ENDDOC:
1124         return EndDoc( hdc );
1125
1126     case GETPHYSPAGESIZE:
1127         pt = out_data;
1128         pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
1129         pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
1130         return 1;
1131
1132     case GETPRINTINGOFFSET:
1133         pt = out_data;
1134         pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
1135         pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
1136         return 1;
1137
1138     case GETSCALINGFACTOR:
1139         pt = out_data;
1140         pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
1141         pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
1142         return 1;
1143
1144     case NEWFRAME:
1145         return EndPage( hdc );
1146
1147     case SETABORTPROC:
1148         return SetAbortProc( hdc, (ABORTPROC)in_data );
1149
1150     case STARTDOC:
1151         {
1152             DOCINFOA doc;
1153             char *name = NULL;
1154
1155             /* in_data may not be 0 terminated so we must copy it */
1156             if (in_data)
1157             {
1158                 name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
1159                 memcpy( name, in_data, in_count );
1160                 name[in_count] = 0;
1161             }
1162             /* out_data is actually a pointer to the DocInfo structure and used as
1163              * a second input parameter */
1164             if (out_data) doc = *(DOCINFOA *)out_data;
1165             else
1166             {
1167                 doc.cbSize = sizeof(doc);
1168                 doc.lpszOutput = NULL;
1169                 doc.lpszDatatype = NULL;
1170                 doc.fwType = 0;
1171             }
1172             doc.lpszDocName = name;
1173             ret = StartDocA( hdc, &doc );
1174             HeapFree( GetProcessHeap(), 0, name );
1175             if (ret > 0) ret = StartPage( hdc );
1176             return ret;
1177         }
1178
1179     case QUERYESCSUPPORT:
1180         {
1181             const INT *ptr = (const INT *)in_data;
1182             if (in_count < sizeof(INT)) return 0;
1183             switch(*ptr)
1184             {
1185             case ABORTDOC:
1186             case ENDDOC:
1187             case GETPHYSPAGESIZE:
1188             case GETPRINTINGOFFSET:
1189             case GETSCALINGFACTOR:
1190             case NEWFRAME:
1191             case QUERYESCSUPPORT:
1192             case SETABORTPROC:
1193             case STARTDOC:
1194                 return TRUE;
1195             }
1196             break;
1197         }
1198     }
1199
1200     /* if not handled internally, pass it to the driver */
1201     return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
1202 }
1203
1204
1205 /******************************************************************************
1206  *              ExtEscape       [GDI32.@]
1207  *
1208  * Access capabilities of a particular device that are not available through GDI.
1209  *
1210  * PARAMS
1211  *    hdc         [I] Handle to device context
1212  *    nEscape     [I] Escape function
1213  *    cbInput     [I] Number of bytes in input structure
1214  *    lpszInData  [I] Pointer to input structure
1215  *    cbOutput    [I] Number of bytes in output structure
1216  *    lpszOutData [O] Pointer to output structure
1217  *
1218  * RETURNS
1219  *    Success: >0
1220  *    Not implemented: 0
1221  *    Failure: <0
1222  */
1223 INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
1224                       INT cbOutput, LPSTR lpszOutData )
1225 {
1226     INT ret = 0;
1227     DC * dc = get_dc_ptr( hdc );
1228
1229     if (dc)
1230     {
1231         PHYSDEV physdev = GET_DC_PHYSDEV( dc, pExtEscape );
1232         update_dc( dc );
1233         ret = physdev->funcs->pExtEscape( physdev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
1234         release_dc_ptr( dc );
1235     }
1236     return ret;
1237 }
1238
1239
1240 /*******************************************************************
1241  *      DrawEscape [GDI32.@]
1242  *
1243  *
1244  */
1245 INT WINAPI DrawEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData)
1246 {
1247     FIXME("DrawEscape, stub\n");
1248     return 0;
1249 }
1250
1251 /*******************************************************************
1252  *      NamedEscape [GDI32.@]
1253  */
1254 INT WINAPI NamedEscape( HDC hdc, LPCWSTR pDriver, INT nEscape, INT cbInput, LPCSTR lpszInData,
1255                         INT cbOutput, LPSTR lpszOutData )
1256 {
1257     FIXME("(%p, %s, %d, %d, %p, %d, %p)\n",
1258           hdc, wine_dbgstr_w(pDriver), nEscape, cbInput, lpszInData, cbOutput,
1259           lpszOutData);
1260     return 0;
1261 }
1262
1263 /*******************************************************************
1264  *      DdQueryDisplaySettingsUniqueness [GDI32.@]
1265  *      GdiEntry13                       [GDI32.@]
1266  */
1267 ULONG WINAPI DdQueryDisplaySettingsUniqueness(VOID)
1268 {
1269     static int warn_once;
1270
1271     if (!warn_once++)
1272         FIXME("stub\n");
1273     return 0;
1274 }