Added support for building a dll from a .def file for cases where we
[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];
213     HMODULE module;
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" );  /* 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     if (!(module = LoadLibraryA( buffer )))
231     {
232         MESSAGE( "Could not load graphics driver '%s'\n", buffer );
233         return NULL;
234     }
235
236     if (!(display_driver = create_driver( module )))
237     {
238         MESSAGE( "Could not create graphics driver '%s'\n", buffer );
239         FreeLibrary( module );
240         return NULL;
241     }
242
243     display_driver->count++;  /* we don't want to free it */
244     return display_driver;
245 }
246
247
248 /**********************************************************************
249  *           DRIVER_load_driver
250  */
251 const DC_FUNCTIONS *DRIVER_load_driver( LPCWSTR name )
252 {
253     HMODULE module;
254     struct graphics_driver *driver;
255     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
256
257     EnterCriticalSection( &driver_section );
258
259     /* display driver is a special case */
260     if (!strcmpiW( name, displayW ))
261     {
262         driver = load_display_driver();
263         LeaveCriticalSection( &driver_section );
264         return &driver->funcs;
265     }
266
267     if ((module = GetModuleHandleW( name )))
268     {
269         for (driver = first_driver; driver; driver = driver->next)
270         {
271             if (driver->module == module)
272             {
273                 driver->count++;
274                 LeaveCriticalSection( &driver_section );
275                 return &driver->funcs;
276             }
277         }
278     }
279
280     if (!(module = LoadLibraryW( name )))
281     {
282         LeaveCriticalSection( &driver_section );
283         return NULL;
284     }
285
286     if (!(driver = create_driver( module )))
287     {
288         FreeLibrary( module );
289         LeaveCriticalSection( &driver_section );
290         return NULL;
291     }
292
293     TRACE( "loaded driver %p for %s\n", driver, debugstr_w(name) );
294     LeaveCriticalSection( &driver_section );
295     return &driver->funcs;
296 }
297
298
299 /**********************************************************************
300  *           DRIVER_get_driver
301  *
302  * Get a new copy of an existing driver.
303  */
304 const DC_FUNCTIONS *DRIVER_get_driver( const DC_FUNCTIONS *funcs )
305 {
306     struct graphics_driver *driver;
307
308     EnterCriticalSection( &driver_section );
309     for (driver = first_driver; driver; driver = driver->next)
310         if (&driver->funcs == funcs) break;
311     if (!driver) ERR( "driver not found, trouble ahead\n" );
312     driver->count++;
313     LeaveCriticalSection( &driver_section );
314     return funcs;
315 }
316
317
318 /**********************************************************************
319  *           DRIVER_release_driver
320  *
321  * Release a driver by decrementing ref count and freeing it if needed.
322  */
323 void DRIVER_release_driver( const DC_FUNCTIONS *funcs )
324 {
325     struct graphics_driver *driver;
326
327     EnterCriticalSection( &driver_section );
328
329     for (driver = first_driver; driver; driver = driver->next)
330         if (&driver->funcs == funcs) break;
331
332     if (!driver) goto done;
333     if (--driver->count) goto done;
334
335     /* removed last reference, free it */
336     if (driver->next) driver->next->prev = driver->prev;
337     if (driver->prev) driver->prev->next = driver->next;
338     else first_driver = driver->next;
339     if (driver == display_driver) display_driver = NULL;
340
341     FreeLibrary( driver->module );
342     HeapFree( GetProcessHeap(), 0, driver );
343  done:
344     LeaveCriticalSection( &driver_section );
345 }
346
347
348 /*****************************************************************************
349  *      DRIVER_GetDriverName
350  *
351  */
352 BOOL DRIVER_GetDriverName( LPCWSTR device, LPWSTR driver, DWORD size )
353 {
354     static const WCHAR displayW[] = { 'd','i','s','p','l','a','y',0 };
355     static const WCHAR devicesW[] = { 'd','e','v','i','c','e','s',0 };
356     static const WCHAR empty_strW[] = { 0 };
357     WCHAR *p;
358
359     /* display is a special case */
360     if (!strcmpiW( device, displayW ))
361     {
362         lstrcpynW( driver, displayW, size );
363         return TRUE;
364     }
365
366     size = GetProfileStringW(devicesW, device, empty_strW, driver, size);
367     if(!size) {
368         WARN("Unable to find %s in [devices] section of win.ini\n", debugstr_w(device));
369         return FALSE;
370     }
371     p = strchrW(driver, ',');
372     if(!p)
373     {
374         WARN("%s entry in [devices] section of win.ini is malformed.\n", debugstr_w(device));
375         return FALSE;
376     }
377     *p = 0;
378     TRACE("Found %s for %s\n", debugstr_w(driver), debugstr_w(device));
379     return TRUE;
380 }
381
382
383 /***********************************************************************
384  *           GdiConvertToDevmodeW    (GDI32.@)
385  */
386 DEVMODEW * WINAPI GdiConvertToDevmodeW(const DEVMODEA *dmA)
387 {
388     DEVMODEW *dmW;
389     WORD dmW_size;
390
391     dmW_size = dmA->dmSize + CCHDEVICENAME;
392     if (dmA->dmSize >= (char *)dmA->dmFormName - (char *)dmA + CCHFORMNAME)
393         dmW_size += CCHFORMNAME;
394
395     dmW = HeapAlloc(GetProcessHeap(), 0, dmW_size + dmA->dmDriverExtra);
396     if (!dmW) return NULL;
397
398     MultiByteToWideChar(CP_ACP, 0, dmA->dmDeviceName, CCHDEVICENAME,
399                                    dmW->dmDeviceName, CCHDEVICENAME);
400     /* copy slightly more, to avoid long computations */
401     memcpy(&dmW->dmSpecVersion, &dmA->dmSpecVersion, dmA->dmSize - CCHDEVICENAME);
402
403     if (dmA->dmSize >= (char *)dmA->dmFormName - (char *)dmA + CCHFORMNAME)
404     {
405         MultiByteToWideChar(CP_ACP, 0, dmA->dmFormName, CCHFORMNAME,
406                                        dmW->dmFormName, CCHFORMNAME);
407         if (dmA->dmSize > (char *)&dmA->dmLogPixels - (char *)dmA)
408             memcpy(&dmW->dmLogPixels, &dmA->dmLogPixels, dmA->dmSize - ((char *)&dmA->dmLogPixels - (char *)dmA));
409     }
410
411     if (dmA->dmDriverExtra)
412         memcpy((char *)dmW + dmW_size, (char *)dmA + dmA->dmSize, dmA->dmDriverExtra);
413
414     dmW->dmSize = dmW_size;
415
416     return dmW;
417 }
418
419
420 /*****************************************************************************
421  *      @ [GDI32.100]
422  *
423  * This should thunk to 16-bit and simply call the proc with the given args.
424  */
425 INT WINAPI GDI_CallDevInstall16( FARPROC16 lpfnDevInstallProc, HWND hWnd,
426                                  LPSTR lpModelName, LPSTR OldPort, LPSTR NewPort )
427 {
428     FIXME("(%p, %p, %s, %s, %s)\n", lpfnDevInstallProc, hWnd, lpModelName, OldPort, NewPort );
429     return -1;
430 }
431
432 /*****************************************************************************
433  *      @ [GDI32.101]
434  *
435  * This should load the correct driver for lpszDevice and calls this driver's
436  * ExtDeviceModePropSheet proc.
437  *
438  * Note: The driver calls a callback routine for each property sheet page; these
439  * pages are supposed to be filled into the structure pointed to by lpPropSheet.
440  * The layout of this structure is:
441  *
442  * struct
443  * {
444  *   DWORD  nPages;
445  *   DWORD  unknown;
446  *   HPROPSHEETPAGE  pages[10];
447  * };
448  */
449 INT WINAPI GDI_CallExtDeviceModePropSheet16( HWND hWnd, LPCSTR lpszDevice,
450                                              LPCSTR lpszPort, LPVOID lpPropSheet )
451 {
452     FIXME("(%p, %s, %s, %p)\n", hWnd, lpszDevice, lpszPort, lpPropSheet );
453     return -1;
454 }
455
456 /*****************************************************************************
457  *      @ [GDI32.102]
458  *
459  * This should load the correct driver for lpszDevice and calls this driver's
460  * ExtDeviceMode proc.
461  *
462  * FIXME: convert ExtDeviceMode to unicode in the driver interface
463  */
464 INT WINAPI GDI_CallExtDeviceMode16( HWND hwnd,
465                                     LPDEVMODEA lpdmOutput, LPSTR lpszDevice,
466                                     LPSTR lpszPort, LPDEVMODEA lpdmInput,
467                                     LPSTR lpszProfile, DWORD fwMode )
468 {
469     WCHAR deviceW[300];
470     WCHAR bufW[300];
471     char buf[300];
472     HDC hdc;
473     DC *dc;
474     INT ret = -1;
475     INT (*pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);
476
477     TRACE("(%p, %p, %s, %s, %p, %s, %ld)\n",
478           hwnd, lpdmOutput, lpszDevice, lpszPort, lpdmInput, lpszProfile, fwMode );
479
480     if (!lpszDevice) return -1;
481     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
482
483     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
484
485     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
486
487     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
488
489     if ((dc = DC_GetDCPtr( hdc )))
490     {
491         pExtDeviceMode = dc->funcs->pExtDeviceMode;
492         GDI_ReleaseObj( hdc );
493         if (pExtDeviceMode)
494             ret = pExtDeviceMode(buf, hwnd, lpdmOutput, lpszDevice, lpszPort,
495                                             lpdmInput, lpszProfile, fwMode);
496     }
497     DeleteDC( hdc );
498     return ret;
499 }
500
501 /****************************************************************************
502  *      @ [GDI32.103]
503  *
504  * This should load the correct driver for lpszDevice and calls this driver's
505  * AdvancedSetupDialog proc.
506  */
507 INT WINAPI GDI_CallAdvancedSetupDialog16( HWND hwnd, LPSTR lpszDevice,
508                                           LPDEVMODEA devin, LPDEVMODEA devout )
509 {
510     TRACE("(%p, %s, %p, %p)\n", hwnd, lpszDevice, devin, devout );
511     return -1;
512 }
513
514 /*****************************************************************************
515  *      @ [GDI32.104]
516  *
517  * This should load the correct driver for lpszDevice and calls this driver's
518  * DeviceCapabilities proc.
519  *
520  * FIXME: convert DeviceCapabilities to unicode in the driver interface
521  */
522 DWORD WINAPI GDI_CallDeviceCapabilities16( LPCSTR lpszDevice, LPCSTR lpszPort,
523                                            WORD fwCapability, LPSTR lpszOutput,
524                                            LPDEVMODEA lpdm )
525 {
526     WCHAR deviceW[300];
527     WCHAR bufW[300];
528     char buf[300];
529     HDC hdc;
530     DC *dc;
531     INT ret = -1;
532
533     TRACE("(%s, %s, %d, %p, %p)\n", lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm );
534
535     if (!lpszDevice) return -1;
536     if (!MultiByteToWideChar(CP_ACP, 0, lpszDevice, -1, deviceW, 300)) return -1;
537
538     if(!DRIVER_GetDriverName( deviceW, bufW, 300 )) return -1;
539
540     if (!WideCharToMultiByte(CP_ACP, 0, bufW, -1, buf, 300, NULL, NULL)) return -1;
541
542     if (!(hdc = CreateICA( buf, lpszDevice, lpszPort, NULL ))) return -1;
543
544     if ((dc = DC_GetDCPtr( hdc )))
545     {
546         if (dc->funcs->pDeviceCapabilities)
547             ret = dc->funcs->pDeviceCapabilities( buf, lpszDevice, lpszPort,
548                                                   fwCapability, lpszOutput, lpdm );
549         GDI_ReleaseObj( hdc );
550     }
551     DeleteDC( hdc );
552     return ret;
553 }
554
555
556 /************************************************************************
557  *             Escape  [GDI32.@]
558  */
559 INT WINAPI Escape( HDC hdc, INT escape, INT in_count, LPCSTR in_data, LPVOID out_data )
560 {
561     INT ret;
562     POINT *pt;
563
564     switch (escape)
565     {
566     case ABORTDOC:
567         return AbortDoc( hdc );
568
569     case ENDDOC:
570         return EndDoc( hdc );
571
572     case GETPHYSPAGESIZE:
573         pt = out_data;
574         pt->x = GetDeviceCaps( hdc, PHYSICALWIDTH );
575         pt->y = GetDeviceCaps( hdc, PHYSICALHEIGHT );
576         return 1;
577
578     case GETPRINTINGOFFSET:
579         pt = out_data;
580         pt->x = GetDeviceCaps( hdc, PHYSICALOFFSETX );
581         pt->y = GetDeviceCaps( hdc, PHYSICALOFFSETY );
582         return 1;
583
584     case GETSCALINGFACTOR:
585         pt = out_data;
586         pt->x = GetDeviceCaps( hdc, SCALINGFACTORX );
587         pt->y = GetDeviceCaps( hdc, SCALINGFACTORY );
588         return 1;
589
590     case NEWFRAME:
591         return EndPage( hdc );
592
593     case SETABORTPROC:
594         return SetAbortProc( hdc, (ABORTPROC)in_data );
595
596     case STARTDOC:
597         {
598             DOCINFOA doc;
599             char *name = NULL;
600
601             /* in_data may not be 0 terminated so we must copy it */
602             if (in_data)
603             {
604                 name = HeapAlloc( GetProcessHeap(), 0, in_count+1 );
605                 memcpy( name, in_data, in_count );
606                 name[in_count] = 0;
607             }
608             /* out_data is actually a pointer to the DocInfo structure and used as
609              * a second input parameter */
610             if (out_data) doc = *(DOCINFOA *)out_data;
611             else
612             {
613                 doc.cbSize = sizeof(doc);
614                 doc.lpszOutput = NULL;
615                 doc.lpszDatatype = NULL;
616                 doc.fwType = 0;
617             }
618             doc.lpszDocName = name;
619             ret = StartDocA( hdc, &doc );
620             if (name) HeapFree( GetProcessHeap(), 0, name );
621             if (ret > 0) ret = StartPage( hdc );
622             return ret;
623         }
624
625     case QUERYESCSUPPORT:
626         {
627             INT *ptr = (INT *)in_data;
628             if (in_count < sizeof(INT)) return 0;
629             switch(*ptr)
630             {
631             case ABORTDOC:
632             case ENDDOC:
633             case GETPHYSPAGESIZE:
634             case GETPRINTINGOFFSET:
635             case GETSCALINGFACTOR:
636             case NEWFRAME:
637             case QUERYESCSUPPORT:
638             case SETABORTPROC:
639             case STARTDOC:
640                 return TRUE;
641             }
642             break;
643         }
644     }
645
646     /* if not handled internally, pass it to the driver */
647     return ExtEscape( hdc, escape, in_count, in_data, 0, out_data );
648 }
649
650
651 /******************************************************************************
652  *              ExtEscape       [GDI32.@]
653  *
654  * PARAMS
655  *    hdc         [I] Handle to device context
656  *    nEscape     [I] Escape function
657  *    cbInput     [I] Number of bytes in input structure
658  *    lpszInData  [I] Pointer to input structure
659  *    cbOutput    [I] Number of bytes in output structure
660  *    lpszOutData [O] Pointer to output structure
661  *
662  * RETURNS
663  *    Success: >0
664  *    Not implemented: 0
665  *    Failure: <0
666  */
667 INT WINAPI ExtEscape( HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData,
668                       INT cbOutput, LPSTR lpszOutData )
669 {
670     INT ret = 0;
671     DC * dc = DC_GetDCPtr( hdc );
672     if (dc)
673     {
674         if (dc->funcs->pExtEscape)
675             ret = dc->funcs->pExtEscape( dc->physDev, nEscape, cbInput, lpszInData, cbOutput, lpszOutData );
676         GDI_ReleaseObj( hdc );
677     }
678     return ret;
679 }
680
681
682 /*******************************************************************
683  *      DrawEscape [GDI32.@]
684  *
685  *
686  */
687 INT WINAPI DrawEscape(HDC hdc, INT nEscape, INT cbInput, LPCSTR lpszInData)
688 {
689     FIXME("DrawEscape, stub\n");
690     return 0;
691 }