Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Escape() function. |
| 3 | * |
| 4 | * Copyright 1994 Bob Amstadt |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 5 | */ |
Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 6 | |
Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 7 | #include <stdio.h> |
Marcus Meissner | 04c3e1d | 1999-02-19 10:37:02 +0000 | [diff] [blame^] | 8 | #include "wingdi.h" |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 9 | #include "gdi.h" |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 10 | #include "heap.h" |
| 11 | #include "ldt.h" |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 12 | #include "dc.h" |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 13 | #include <debug.h> |
| 14 | |
Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 15 | |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 16 | INT16 WINAPI Escape16( HDC16 hdc, INT16 nEscape, INT16 cbInput, |
| 17 | SEGPTR lpszInData, SEGPTR lpvOutData ) |
Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 18 | { |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 19 | DC * dc = DC_GetDCPtr( hdc ); |
| 20 | if (!dc || !dc->funcs->pEscape) return 0; |
Alexandre Julliard | 0e270f4 | 1996-08-24 18:26:35 +0000 | [diff] [blame] | 21 | return dc->funcs->pEscape( dc, nEscape, cbInput, lpszInData, lpvOutData ); |
Alexandre Julliard | 490a27e | 1994-06-08 13:57:50 +0000 | [diff] [blame] | 22 | } |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 23 | |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 24 | INT32 WINAPI Escape32( HDC32 hdc, INT32 nEscape, INT32 cbInput, |
François Gouget | 241c730 | 1998-10-28 10:47:09 +0000 | [diff] [blame] | 25 | LPCSTR lpszInData, LPVOID lpvOutData ) |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 26 | { |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 27 | DC *dc = DC_GetDCPtr( hdc ); |
| 28 | SEGPTR segin,segout; |
| 29 | INT32 ret; |
| 30 | |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 31 | if (!dc || !dc->funcs->pEscape) return 0; |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 32 | segin = (SEGPTR)lpszInData; |
| 33 | segout = (SEGPTR)lpvOutData; |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 34 | switch (nEscape) { |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 35 | /* Escape(hdc,QUERYESCSUPPORT,LPINT32,NULL) */ |
| 36 | case QUERYESCSUPPORT: { |
| 37 | LPINT16 x = (LPINT16)SEGPTR_NEW(INT16); |
| 38 | *x = *(INT32*)lpszInData; |
| 39 | segin = SEGPTR_GET(x); |
| 40 | break; |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 41 | } |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 42 | |
| 43 | /* Escape(hdc,GETSCALINGFACTOR,NULL,LPPOINT32) */ |
| 44 | /* Escape(hdc,GETPHYSPAGESIZE,NULL,LPPOINT32) */ |
| 45 | /* Escape(hdc,GETPRINTINGOFFSET,NULL,LPPOINT32) */ |
| 46 | |
| 47 | case GETSCALINGFACTOR: |
| 48 | case GETPHYSPAGESIZE: |
| 49 | case GETPRINTINGOFFSET: |
| 50 | segout = SEGPTR_GET(SEGPTR_NEW(POINT16)); |
| 51 | break; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 52 | |
| 53 | /* Escape(hdc,GETTECHNOLOGY,NULL,LPSTR); */ |
| 54 | |
| 55 | case GETTECHNOLOGY: { |
| 56 | segout = SEGPTR_GET(SEGPTR_ALLOC(200)); /* enough I hope */ |
| 57 | break; |
| 58 | |
| 59 | } |
| 60 | |
| 61 | /* Escape(hdc,ENABLEPAIRKERNING,LPINT16,LPINT16); */ |
| 62 | |
| 63 | case ENABLEPAIRKERNING: { |
| 64 | LPINT16 enab = SEGPTR_NEW(INT16); |
| 65 | segout = SEGPTR_GET(SEGPTR_NEW(INT16)); |
| 66 | segin = SEGPTR_GET(enab); |
| 67 | *enab = *(INT32*)lpszInData; |
| 68 | break; |
| 69 | } |
| 70 | |
| 71 | /* Escape(hdc,GETFACENAME,NULL,LPSTR); */ |
| 72 | |
| 73 | case GETFACENAME: { |
| 74 | segout = SEGPTR_GET(SEGPTR_ALLOC(200)); |
| 75 | break; |
| 76 | } |
Huw D M Davies | 6fafe9e | 1998-11-01 14:06:04 +0000 | [diff] [blame] | 77 | |
| 78 | /* Escape(hdc,STARTDOC,LPSTR,NULL); */ |
| 79 | |
| 80 | case STARTDOC: /* string may not be \0 terminated */ |
| 81 | if(lpszInData) { |
| 82 | char *cp = SEGPTR_ALLOC(cbInput); |
| 83 | memcpy(cp, lpszInData, cbInput); |
| 84 | segin = SEGPTR_GET(cp); |
| 85 | } else |
| 86 | segin = 0; |
| 87 | break; |
| 88 | |
| 89 | default: |
| 90 | break; |
| 91 | |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 92 | } |
Huw D M Davies | 6fafe9e | 1998-11-01 14:06:04 +0000 | [diff] [blame] | 93 | |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 94 | ret = dc->funcs->pEscape( dc, nEscape, cbInput, segin, segout ); |
Huw D M Davies | 6fafe9e | 1998-11-01 14:06:04 +0000 | [diff] [blame] | 95 | |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 96 | switch(nEscape) { |
| 97 | case QUERYESCSUPPORT: |
| 98 | if (ret) |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 99 | TRACE(driver,"target DC implements Escape %d\n",nEscape); |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 100 | SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); |
| 101 | break; |
| 102 | case GETSCALINGFACTOR: |
| 103 | case GETPRINTINGOFFSET: |
| 104 | case GETPHYSPAGESIZE: { |
| 105 | LPPOINT16 x = (LPPOINT16)PTR_SEG_TO_LIN(segout); |
| 106 | CONV_POINT16TO32(x,(LPPOINT32)lpvOutData); |
| 107 | SEGPTR_FREE(x); |
| 108 | break; |
| 109 | } |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 110 | case GETTECHNOLOGY: { |
| 111 | LPSTR x=PTR_SEG_TO_LIN(segout); |
| 112 | lstrcpy32A(lpvOutData,x); |
| 113 | SEGPTR_FREE(x); |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 114 | break; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 115 | } |
| 116 | case ENABLEPAIRKERNING: { |
| 117 | LPINT16 enab = (LPINT16)PTR_SEG_TO_LIN(segout); |
| 118 | |
| 119 | *(LPINT32)lpvOutData = *enab; |
| 120 | SEGPTR_FREE(enab); |
| 121 | SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); |
Alexandre Julliard | e658d82 | 1997-11-30 17:45:40 +0000 | [diff] [blame] | 122 | break; |
Alexandre Julliard | 491502b | 1997-11-01 19:08:16 +0000 | [diff] [blame] | 123 | } |
| 124 | case GETFACENAME: { |
| 125 | LPSTR x = (LPSTR)PTR_SEG_TO_LIN(segout); |
| 126 | lstrcpy32A(lpvOutData,x); |
| 127 | SEGPTR_FREE(x); |
| 128 | break; |
| 129 | } |
Huw D M Davies | 6fafe9e | 1998-11-01 14:06:04 +0000 | [diff] [blame] | 130 | case STARTDOC: |
| 131 | SEGPTR_FREE(PTR_SEG_TO_LIN(segin)); |
| 132 | break; |
| 133 | |
Alexandre Julliard | 3db94ef | 1997-09-28 17:43:24 +0000 | [diff] [blame] | 134 | default: |
| 135 | break; |
| 136 | } |
| 137 | return ret; |
| 138 | } |
| 139 | |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 140 | /****************************************************************************** |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 141 | * ExtEscape [GDI32.95] |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 142 | * |
| 143 | * PARAMS |
| 144 | * hdc [I] Handle to device context |
| 145 | * nEscape [I] Escape function |
| 146 | * cbInput [I] Number of bytes in input structure |
| 147 | * lpszInData [I] Pointer to input structure |
| 148 | * cbOutput [I] Number of bytes in output structure |
| 149 | * lpszOutData [O] Pointer to output structure |
| 150 | * |
| 151 | * RETURNS |
| 152 | * Success: >0 |
| 153 | * Not implemented: 0 |
| 154 | * Failure: <0 |
| 155 | */ |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 156 | INT32 WINAPI ExtEscape( HDC32 hdc, INT32 nEscape, INT32 cbInput, |
| 157 | LPCSTR lpszInData, INT32 cbOutput, LPSTR lpszOutData ) |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 158 | { |
| 159 | FIXME(driver,"(0x%04x,0x%x,%d,%s,%d,%p):stub\n", |
| 160 | hdc,nEscape,cbInput,debugstr_a(lpszInData),cbOutput,lpszOutData); |
| 161 | return 0; |
Alexandre Julliard | 01d6346 | 1997-01-20 19:43:45 +0000 | [diff] [blame] | 162 | } |
Alexandre Julliard | d30dfd2 | 1998-09-27 18:28:36 +0000 | [diff] [blame] | 163 | |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 164 | /******************************************************************* |
| 165 | * DrawEscape [GDI32.74] |
| 166 | * |
| 167 | * |
| 168 | */ |
Alexandre Julliard | 8da12c4 | 1999-01-17 16:55:11 +0000 | [diff] [blame] | 169 | INT32 WINAPI DrawEscape(HDC32 hdc, INT32 nEscape, INT32 cbInput, LPCSTR lpszInData) |
Paul Quinn | 1beaae5 | 1998-12-15 15:38:36 +0000 | [diff] [blame] | 170 | { |
| 171 | FIXME(gdi, "DrawEscape, stub\n"); |
| 172 | return 0; |
| 173 | } |