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