wininet: Fixed grouping security error flags.
[wine] / dlls / gdi32 / mfdrv / init.c
1 /*
2  * Metafile driver initialisation functions
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #include <stdarg.h>
22 #include <string.h>
23
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winnls.h"
27 #include "gdi_private.h"
28 #include "mfdrv/metafiledrv.h"
29 #include "wine/debug.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(metafile);
32
33 static BOOL MFDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev );
34 static BOOL MFDRV_DeleteDC( PHYSDEV dev );
35
36
37 /**********************************************************************
38  *           MFDRV_ExtEscape
39  */
40 static INT MFDRV_ExtEscape( PHYSDEV dev, INT nEscape, INT cbInput, LPCVOID in_data,
41                             INT cbOutput, LPVOID out_data )
42 {
43     METARECORD *mr;
44     DWORD len;
45     INT ret;
46
47     if (cbOutput) return 0;  /* escapes that require output cannot work in metafiles */
48
49     len = sizeof(*mr) + sizeof(WORD) + ((cbInput + 1) & ~1);
50     mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
51     mr->rdSize = len / 2;
52     mr->rdFunction = META_ESCAPE;
53     mr->rdParm[0] = nEscape;
54     mr->rdParm[1] = cbInput;
55     memcpy(&(mr->rdParm[2]), in_data, cbInput);
56     ret = MFDRV_WriteRecord( dev, mr, len);
57     HeapFree(GetProcessHeap(), 0, mr);
58     return ret;
59 }
60
61
62 /******************************************************************
63  *         MFDRV_GetBoundsRect
64  */
65 static UINT MFDRV_GetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
66 {
67     return 0;
68 }
69
70
71 /******************************************************************
72  *         MFDRV_SetBoundsRect
73  */
74 static UINT MFDRV_SetBoundsRect( PHYSDEV dev, RECT *rect, UINT flags )
75 {
76     return 0;
77 }
78
79
80 /******************************************************************
81  *         MFDRV_GetDeviceCaps
82  *
83  *A very simple implementation that returns DT_METAFILE
84  */
85 static INT MFDRV_GetDeviceCaps(PHYSDEV dev, INT cap)
86 {
87     switch(cap)
88     {
89     case TECHNOLOGY:
90         return DT_METAFILE;
91     case TEXTCAPS:
92         return 0;
93     default:
94         TRACE(" unsupported capability %d, will return 0\n", cap );
95     }
96     return 0;
97 }
98
99
100 static const struct gdi_dc_funcs MFDRV_Funcs =
101 {
102     NULL,                            /* pAbortDoc */
103     MFDRV_AbortPath,                 /* pAbortPath */
104     NULL,                            /* pAlphaBlend */
105     NULL,                            /* pAngleArc */
106     MFDRV_Arc,                       /* pArc */
107     NULL,                            /* pArcTo */
108     MFDRV_BeginPath,                 /* pBeginPath */
109     NULL,                            /* pBlendImage */
110     NULL,                            /* pChoosePixelFormat */
111     MFDRV_Chord,                     /* pChord */
112     MFDRV_CloseFigure,               /* pCloseFigure */
113     NULL,                            /* pCreateBitmap */
114     MFDRV_CreateCompatibleDC,        /* pCreateCompatibleDC */
115     NULL,                            /* pCreateDC */
116     NULL,                            /* pDeleteBitmap */
117     MFDRV_DeleteDC,                  /* pDeleteDC */
118     MFDRV_DeleteObject,              /* pDeleteObject */
119     NULL,                            /* pDescribePixelFormat */
120     NULL,                            /* pDeviceCapabilities */
121     MFDRV_Ellipse,                   /* pEllipse */
122     NULL,                            /* pEndDoc */
123     NULL,                            /* pEndPage */
124     MFDRV_EndPath,                   /* pEndPath */
125     NULL,                            /* pEnumFonts */
126     NULL,                            /* pEnumICMProfiles */
127     MFDRV_ExcludeClipRect,           /* pExcludeClipRect */
128     NULL,                            /* pExtDeviceMode */
129     MFDRV_ExtEscape,                 /* pExtEscape */
130     MFDRV_ExtFloodFill,              /* pExtFloodFill */
131     MFDRV_ExtSelectClipRgn,          /* pExtSelectClipRgn */
132     MFDRV_ExtTextOut,                /* pExtTextOut */
133     MFDRV_FillPath,                  /* pFillPath */
134     MFDRV_FillRgn,                   /* pFillRgn */
135     MFDRV_FlattenPath,               /* pFlattenPath */
136     NULL,                            /* pFontIsLinked */
137     MFDRV_FrameRgn,                  /* pFrameRgn */
138     NULL,                            /* pGdiComment */
139     NULL,                            /* pGdiRealizationInfo */
140     MFDRV_GetBoundsRect,             /* pGetBoundsRect */
141     NULL,                            /* pGetCharABCWidths */
142     NULL,                            /* pGetCharABCWidthsI */
143     NULL,                            /* pGetCharWidth */
144     MFDRV_GetDeviceCaps,             /* pGetDeviceCaps */
145     NULL,                            /* pGetDeviceGammaRamp */
146     NULL,                            /* pGetFontData */
147     NULL,                            /* pGetFontUnicodeRanges */
148     NULL,                            /* pGetGlyphIndices */
149     NULL,                            /* pGetGlyphOutline */
150     NULL,                            /* pGetICMProfile */
151     NULL,                            /* pGetImage */
152     NULL,                            /* pGetKerningPairs */
153     NULL,                            /* pGetNearestColor */
154     NULL,                            /* pGetOutlineTextMetrics */
155     NULL,                            /* pGetPixel */
156     NULL,                            /* pGetPixelFormat */
157     NULL,                            /* pGetSystemPaletteEntries */
158     NULL,                            /* pGetTextCharsetInfo */
159     NULL,                            /* pGetTextExtentExPoint */
160     NULL,                            /* pGetTextExtentExPointI */
161     NULL,                            /* pGetTextFace */
162     NULL,                            /* pGetTextMetrics */
163     NULL,                            /* pGradientFill */
164     MFDRV_IntersectClipRect,         /* pIntersectClipRect */
165     MFDRV_InvertRgn,                 /* pInvertRgn */
166     MFDRV_LineTo,                    /* pLineTo */
167     NULL,                            /* pModifyWorldTransform */
168     MFDRV_MoveTo,                    /* pMoveTo */
169     MFDRV_OffsetClipRgn,             /* pOffsetClipRgn */
170     MFDRV_OffsetViewportOrgEx,       /* pOffsetViewportOrgEx */
171     MFDRV_OffsetWindowOrgEx,         /* pOffsetWindowOrgEx */
172     MFDRV_PaintRgn,                  /* pPaintRgn */
173     MFDRV_PatBlt,                    /* pPatBlt */
174     MFDRV_Pie,                       /* pPie */
175     MFDRV_PolyBezier,                /* pPolyBezier */
176     MFDRV_PolyBezierTo,              /* pPolyBezierTo */
177     NULL,                            /* pPolyDraw */
178     MFDRV_PolyPolygon,               /* pPolyPolygon */
179     NULL,                            /* pPolyPolyline */
180     MFDRV_Polygon,                   /* pPolygon */
181     MFDRV_Polyline,                  /* pPolyline */
182     NULL,                            /* pPolylineTo */
183     NULL,                            /* pPutImage */
184     NULL,                            /* pRealizeDefaultPalette */
185     MFDRV_RealizePalette,            /* pRealizePalette */
186     MFDRV_Rectangle,                 /* pRectangle */
187     NULL,                            /* pResetDC */
188     MFDRV_RestoreDC,                 /* pRestoreDC */
189     MFDRV_RoundRect,                 /* pRoundRect */
190     MFDRV_SaveDC,                    /* pSaveDC */
191     MFDRV_ScaleViewportExtEx,        /* pScaleViewportExtEx */
192     MFDRV_ScaleWindowExtEx,          /* pScaleWindowExtEx */
193     MFDRV_SelectBitmap,              /* pSelectBitmap */
194     MFDRV_SelectBrush,               /* pSelectBrush */
195     MFDRV_SelectClipPath,            /* pSelectClipPath */
196     MFDRV_SelectFont,                /* pSelectFont */
197     MFDRV_SelectPalette,             /* pSelectPalette */
198     MFDRV_SelectPen,                 /* pSelectPen */
199     NULL,                            /* pSetArcDirection */
200     MFDRV_SetBkColor,                /* pSetBkColor */
201     MFDRV_SetBkMode,                 /* pSetBkMode */
202     MFDRV_SetBoundsRect,             /* pSetBoundsRect */
203     MFDRV_SetDCBrushColor,           /* pSetDCBrushColor*/
204     MFDRV_SetDCPenColor,             /* pSetDCPenColor*/
205     MFDRV_SetDIBitsToDevice,         /* pSetDIBitsToDevice */
206     NULL,                            /* pSetDeviceClipping */
207     NULL,                            /* pSetDeviceGammaRamp */
208     NULL,                            /* pSetLayout */
209     MFDRV_SetMapMode,                /* pSetMapMode */
210     MFDRV_SetMapperFlags,            /* pSetMapperFlags */
211     MFDRV_SetPixel,                  /* pSetPixel */
212     NULL,                            /* pSetPixelFormat */
213     MFDRV_SetPolyFillMode,           /* pSetPolyFillMode */
214     MFDRV_SetROP2,                   /* pSetROP2 */
215     MFDRV_SetRelAbs,                 /* pSetRelAbs */
216     MFDRV_SetStretchBltMode,         /* pSetStretchBltMode */
217     MFDRV_SetTextAlign,              /* pSetTextAlign */
218     MFDRV_SetTextCharacterExtra,     /* pSetTextCharacterExtra */
219     MFDRV_SetTextColor,              /* pSetTextColor */
220     MFDRV_SetTextJustification,      /* pSetTextJustification */
221     MFDRV_SetViewportExtEx,          /* pSetViewportExtEx */
222     MFDRV_SetViewportOrgEx,          /* pSetViewportOrgEx */
223     MFDRV_SetWindowExtEx,            /* pSetWindowExtEx */
224     MFDRV_SetWindowOrgEx,            /* pSetWindowOrgEx */
225     NULL,                            /* pSetWorldTransform */
226     NULL,                            /* pStartDoc */
227     NULL,                            /* pStartPage */
228     MFDRV_StretchBlt,                /* pStretchBlt */
229     MFDRV_StretchDIBits,             /* pStretchDIBits */
230     MFDRV_StrokeAndFillPath,         /* pStrokeAndFillPath */
231     MFDRV_StrokePath,                /* pStrokePath */
232     NULL,                            /* pSwapBuffers */
233     NULL,                            /* pUnrealizePalette */
234     MFDRV_WidenPath,                 /* pWidenPath */
235     NULL,                            /* pwglCopyContext */
236     NULL,                            /* pwglCreateContext */
237     NULL,                            /* pwglCreateContextAttribsARB */
238     NULL,                            /* pwglDeleteContext */
239     NULL,                            /* pwglGetProcAddress */
240     NULL,                            /* pwglMakeContextCurrentARB */
241     NULL,                            /* pwglMakeCurrent */
242     NULL,                            /* pwglSetPixelFormatWINE */
243     NULL,                            /* pwglShareLists */
244     NULL,                            /* pwglUseFontBitmapsA */
245     NULL,                            /* pwglUseFontBitmapsW */
246     GDI_PRIORITY_GRAPHICS_DRV        /* priority */
247 };
248
249
250
251 /**********************************************************************
252  *           MFDRV_AllocMetaFile
253  */
254 static DC *MFDRV_AllocMetaFile(void)
255 {
256     DC *dc;
257     METAFILEDRV_PDEVICE *physDev;
258
259     if (!(dc = alloc_dc_ptr( OBJ_METADC ))) return NULL;
260
261     physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
262     if (!physDev)
263     {
264         free_dc_ptr( dc );
265         return NULL;
266     }
267     if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) )))
268     {
269         HeapFree( GetProcessHeap(), 0, physDev );
270         free_dc_ptr( dc );
271         return NULL;
272     }
273
274     push_dc_driver( &dc->physDev, &physDev->dev, &MFDRV_Funcs );
275
276     physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
277     physDev->handles_size = HANDLE_LIST_INC;
278     physDev->cur_handles = 0;
279
280     physDev->hFile = 0;
281
282     physDev->mh->mtHeaderSize   = sizeof(METAHEADER) / sizeof(WORD);
283     physDev->mh->mtVersion      = 0x0300;
284     physDev->mh->mtSize         = physDev->mh->mtHeaderSize;
285     physDev->mh->mtNoObjects    = 0;
286     physDev->mh->mtMaxRecord    = 0;
287     physDev->mh->mtNoParameters = 0;
288
289     SetVirtualResolution( physDev->dev.hdc, 0, 0, 0, 0);
290
291     return dc;
292 }
293
294
295 /**********************************************************************
296  *           MFDRV_CreateCompatibleDC
297  */
298 static BOOL MFDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
299 {
300     /* not supported on metafile DCs */
301     return FALSE;
302 }
303
304
305 /**********************************************************************
306  *           MFDRV_DeleteDC
307  */
308 static BOOL MFDRV_DeleteDC( PHYSDEV dev )
309 {
310     METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
311     DWORD index;
312
313     HeapFree( GetProcessHeap(), 0, physDev->mh );
314     for(index = 0; index < physDev->handles_size; index++)
315         if(physDev->handles[index])
316             GDI_hdc_not_using_object(physDev->handles[index], dev->hdc);
317     HeapFree( GetProcessHeap(), 0, physDev->handles );
318     HeapFree( GetProcessHeap(), 0, physDev );
319     return TRUE;
320 }
321
322
323 /**********************************************************************
324  *           CreateMetaFileW   (GDI32.@)
325  *
326  *  Create a new DC and associate it with a metafile. Pass a filename
327  *  to create a disk-based metafile, NULL to create a memory metafile.
328  *
329  * PARAMS
330  *  filename [I] Filename of disk metafile
331  *
332  * RETURNS
333  *  A handle to the metafile DC if successful, NULL on failure.
334  */
335 HDC WINAPI CreateMetaFileW( LPCWSTR filename )
336 {
337     HDC ret;
338     DC *dc;
339     METAFILEDRV_PDEVICE *physDev;
340     HANDLE hFile;
341
342     TRACE("%s\n", debugstr_w(filename) );
343
344     if (!(dc = MFDRV_AllocMetaFile())) return 0;
345     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
346
347     if (filename)  /* disk based metafile */
348     {
349         physDev->mh->mtType = METAFILE_DISK;
350         if ((hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL,
351                                 CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
352             free_dc_ptr( dc );
353             return 0;
354         }
355         if (!WriteFile( hFile, physDev->mh, sizeof(*physDev->mh), NULL,
356                         NULL )) {
357             free_dc_ptr( dc );
358             return 0;
359         }
360         physDev->hFile = hFile;
361
362         /* Grow METAHEADER to include filename */
363         physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename, TRUE);
364     }
365     else  /* memory based metafile */
366         physDev->mh->mtType = METAFILE_MEMORY;
367
368     TRACE("returning %p\n", physDev->dev.hdc);
369     ret = physDev->dev.hdc;
370     release_dc_ptr( dc );
371     return ret;
372 }
373
374 /**********************************************************************
375  *          CreateMetaFileA   (GDI32.@)
376  *
377  * See CreateMetaFileW.
378  */
379 HDC WINAPI CreateMetaFileA(LPCSTR filename)
380 {
381     LPWSTR filenameW;
382     DWORD len;
383     HDC hReturnDC;
384
385     if (!filename) return CreateMetaFileW(NULL);
386
387     len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
388     filenameW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
389     MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len );
390
391     hReturnDC = CreateMetaFileW(filenameW);
392
393     HeapFree( GetProcessHeap(), 0, filenameW );
394
395     return hReturnDC;
396 }
397
398
399 /**********************************************************************
400  *          MFDRV_CloseMetaFile
401  */
402 static DC *MFDRV_CloseMetaFile( HDC hdc )
403 {
404     DC *dc;
405     METAFILEDRV_PDEVICE *physDev;
406
407     TRACE("(%p)\n", hdc );
408
409     if (!(dc = get_dc_ptr( hdc ))) return NULL;
410     if (dc->header.type != OBJ_METADC)
411     {
412         release_dc_ptr( dc );
413         return NULL;
414     }
415     if (dc->refcount != 1)
416     {
417         FIXME( "not deleting busy DC %p refcount %u\n", hdc, dc->refcount );
418         release_dc_ptr( dc );
419         return NULL;
420     }
421     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
422
423     /* Construct the end of metafile record - this is documented
424      * in SDK Knowledgebase Q99334.
425      */
426
427     if (!MFDRV_MetaParam0(dc->physDev, META_EOF))
428     {
429         free_dc_ptr( dc );
430         return 0;
431     }
432
433     if (physDev->mh->mtType == METAFILE_DISK)  /* disk based metafile */
434     {
435         if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) {
436             free_dc_ptr( dc );
437             return 0;
438         }
439
440         physDev->mh->mtType = METAFILE_MEMORY; /* This is what windows does */
441         if (!WriteFile(physDev->hFile, physDev->mh, sizeof(*physDev->mh),
442                        NULL, NULL)) {
443             free_dc_ptr( dc );
444             return 0;
445         }
446         CloseHandle(physDev->hFile);
447         physDev->mh->mtType = METAFILE_DISK;
448     }
449
450     return dc;
451 }
452
453 /******************************************************************
454  *           CloseMetaFile   (GDI32.@)
455  *
456  *  Stop recording graphics operations in metafile associated with
457  *  hdc and retrieve metafile.
458  *
459  * PARAMS
460  *  hdc [I] Metafile DC to close 
461  *
462  * RETURNS
463  *  Handle of newly created metafile on success, NULL on failure.
464  */
465 HMETAFILE WINAPI CloseMetaFile(HDC hdc)
466 {
467     HMETAFILE hmf;
468     METAFILEDRV_PDEVICE *physDev;
469     DC *dc = MFDRV_CloseMetaFile(hdc);
470     if (!dc) return 0;
471     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
472
473     /* Now allocate a global handle for the metafile */
474
475     hmf = MF_Create_HMETAFILE( physDev->mh );
476
477     physDev->mh = NULL;  /* So it won't be deleted */
478     free_dc_ptr( dc );
479     return hmf;
480 }
481
482
483 /******************************************************************
484  *         MFDRV_WriteRecord
485  *
486  * Warning: this function can change the pointer to the metafile header.
487  */
488 BOOL MFDRV_WriteRecord( PHYSDEV dev, METARECORD *mr, DWORD rlen)
489 {
490     DWORD len, size;
491     METAHEADER *mh;
492     METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
493
494     switch(physDev->mh->mtType)
495     {
496     case METAFILE_MEMORY:
497         len = physDev->mh->mtSize * 2 + rlen;
498         /* reallocate memory if needed */
499         size = HeapSize( GetProcessHeap(), 0, physDev->mh );
500         if (len > size)
501         {
502             /*expand size*/
503             size += size / 2 + rlen;
504             mh = HeapReAlloc( GetProcessHeap(), 0, physDev->mh, size);
505             if (!mh) return FALSE;
506             physDev->mh = mh;
507             TRACE("Reallocated metafile: new size is %d\n",size);
508         }
509         memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen);
510         break;
511     case METAFILE_DISK:
512         TRACE("Writing record to disk\n");
513         if (!WriteFile(physDev->hFile, mr, rlen, NULL, NULL))
514             return FALSE;
515         break;
516     default:
517         ERR("Unknown metafile type %d\n", physDev->mh->mtType );
518         return FALSE;
519     }
520
521     physDev->mh->mtSize += rlen / 2;
522     physDev->mh->mtMaxRecord = max(physDev->mh->mtMaxRecord, rlen / 2);
523     return TRUE;
524 }
525
526
527 /******************************************************************
528  *         MFDRV_MetaParam0
529  */
530
531 BOOL MFDRV_MetaParam0(PHYSDEV dev, short func)
532 {
533     char buffer[8];
534     METARECORD *mr = (METARECORD *)&buffer;
535
536     mr->rdSize = 3;
537     mr->rdFunction = func;
538     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
539 }
540
541
542 /******************************************************************
543  *         MFDRV_MetaParam1
544  */
545 BOOL MFDRV_MetaParam1(PHYSDEV dev, short func, short param1)
546 {
547     char buffer[8];
548     METARECORD *mr = (METARECORD *)&buffer;
549     WORD *params = mr->rdParm;
550
551     mr->rdSize = 4;
552     mr->rdFunction = func;
553     params[0] = param1;
554     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
555 }
556
557
558 /******************************************************************
559  *         MFDRV_MetaParam2
560  */
561 BOOL MFDRV_MetaParam2(PHYSDEV dev, short func, short param1, short param2)
562 {
563     char buffer[10];
564     METARECORD *mr = (METARECORD *)&buffer;
565     WORD *params = mr->rdParm;
566
567     mr->rdSize = 5;
568     mr->rdFunction = func;
569     params[0] = param2;
570     params[1] = param1;
571     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
572 }
573
574
575 /******************************************************************
576  *         MFDRV_MetaParam4
577  */
578
579 BOOL MFDRV_MetaParam4(PHYSDEV dev, short func, short param1, short param2,
580                       short param3, short param4)
581 {
582     char buffer[14];
583     METARECORD *mr = (METARECORD *)&buffer;
584     WORD *params = mr->rdParm;
585
586     mr->rdSize = 7;
587     mr->rdFunction = func;
588     params[0] = param4;
589     params[1] = param3;
590     params[2] = param2;
591     params[3] = param1;
592     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
593 }
594
595
596 /******************************************************************
597  *         MFDRV_MetaParam6
598  */
599
600 BOOL MFDRV_MetaParam6(PHYSDEV dev, short func, short param1, short param2,
601                       short param3, short param4, short param5, short param6)
602 {
603     char buffer[18];
604     METARECORD *mr = (METARECORD *)&buffer;
605     WORD *params = mr->rdParm;
606
607     mr->rdSize = 9;
608     mr->rdFunction = func;
609     params[0] = param6;
610     params[1] = param5;
611     params[2] = param4;
612     params[3] = param3;
613     params[4] = param2;
614     params[5] = param1;
615     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
616 }
617
618
619 /******************************************************************
620  *         MFDRV_MetaParam8
621  */
622 BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
623                       short param3, short param4, short param5,
624                       short param6, short param7, short param8)
625 {
626     char buffer[22];
627     METARECORD *mr = (METARECORD *)&buffer;
628     WORD *params = mr->rdParm;
629
630     mr->rdSize = 11;
631     mr->rdFunction = func;
632     params[0] = param8;
633     params[1] = param7;
634     params[2] = param6;
635     params[3] = param5;
636     params[4] = param4;
637     params[5] = param3;
638     params[6] = param2;
639     params[7] = param1;
640     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
641 }