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