d3drm: Implement IDirect3DRMMeshImpl_GetGroupMaterial.
[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     MFDRV_CreateCompatibleDC,        /* pCreateCompatibleDC */
114     NULL,                            /* pCreateDC */
115     MFDRV_DeleteDC,                  /* pDeleteDC */
116     MFDRV_DeleteObject,              /* pDeleteObject */
117     NULL,                            /* pDescribePixelFormat */
118     NULL,                            /* pDeviceCapabilities */
119     MFDRV_Ellipse,                   /* pEllipse */
120     NULL,                            /* pEndDoc */
121     NULL,                            /* pEndPage */
122     MFDRV_EndPath,                   /* pEndPath */
123     NULL,                            /* pEnumFonts */
124     NULL,                            /* pEnumICMProfiles */
125     MFDRV_ExcludeClipRect,           /* pExcludeClipRect */
126     NULL,                            /* pExtDeviceMode */
127     MFDRV_ExtEscape,                 /* pExtEscape */
128     MFDRV_ExtFloodFill,              /* pExtFloodFill */
129     MFDRV_ExtSelectClipRgn,          /* pExtSelectClipRgn */
130     MFDRV_ExtTextOut,                /* pExtTextOut */
131     MFDRV_FillPath,                  /* pFillPath */
132     MFDRV_FillRgn,                   /* pFillRgn */
133     MFDRV_FlattenPath,               /* pFlattenPath */
134     NULL,                            /* pFontIsLinked */
135     MFDRV_FrameRgn,                  /* pFrameRgn */
136     NULL,                            /* pGdiComment */
137     NULL,                            /* pGdiRealizationInfo */
138     MFDRV_GetBoundsRect,             /* pGetBoundsRect */
139     NULL,                            /* pGetCharABCWidths */
140     NULL,                            /* pGetCharABCWidthsI */
141     NULL,                            /* pGetCharWidth */
142     MFDRV_GetDeviceCaps,             /* pGetDeviceCaps */
143     NULL,                            /* pGetDeviceGammaRamp */
144     NULL,                            /* pGetFontData */
145     NULL,                            /* pGetFontUnicodeRanges */
146     NULL,                            /* pGetGlyphIndices */
147     NULL,                            /* pGetGlyphOutline */
148     NULL,                            /* pGetICMProfile */
149     NULL,                            /* pGetImage */
150     NULL,                            /* pGetKerningPairs */
151     NULL,                            /* pGetNearestColor */
152     NULL,                            /* pGetOutlineTextMetrics */
153     NULL,                            /* pGetPixel */
154     NULL,                            /* pGetPixelFormat */
155     NULL,                            /* pGetSystemPaletteEntries */
156     NULL,                            /* pGetTextCharsetInfo */
157     NULL,                            /* pGetTextExtentExPoint */
158     NULL,                            /* pGetTextExtentExPointI */
159     NULL,                            /* pGetTextFace */
160     NULL,                            /* pGetTextMetrics */
161     NULL,                            /* pGradientFill */
162     MFDRV_IntersectClipRect,         /* pIntersectClipRect */
163     MFDRV_InvertRgn,                 /* pInvertRgn */
164     MFDRV_LineTo,                    /* pLineTo */
165     NULL,                            /* pModifyWorldTransform */
166     MFDRV_MoveTo,                    /* pMoveTo */
167     MFDRV_OffsetClipRgn,             /* pOffsetClipRgn */
168     MFDRV_OffsetViewportOrgEx,       /* pOffsetViewportOrgEx */
169     MFDRV_OffsetWindowOrgEx,         /* pOffsetWindowOrgEx */
170     MFDRV_PaintRgn,                  /* pPaintRgn */
171     MFDRV_PatBlt,                    /* pPatBlt */
172     MFDRV_Pie,                       /* pPie */
173     MFDRV_PolyBezier,                /* pPolyBezier */
174     MFDRV_PolyBezierTo,              /* pPolyBezierTo */
175     NULL,                            /* pPolyDraw */
176     MFDRV_PolyPolygon,               /* pPolyPolygon */
177     NULL,                            /* pPolyPolyline */
178     MFDRV_Polygon,                   /* pPolygon */
179     MFDRV_Polyline,                  /* pPolyline */
180     NULL,                            /* pPolylineTo */
181     NULL,                            /* pPutImage */
182     NULL,                            /* pRealizeDefaultPalette */
183     MFDRV_RealizePalette,            /* pRealizePalette */
184     MFDRV_Rectangle,                 /* pRectangle */
185     NULL,                            /* pResetDC */
186     MFDRV_RestoreDC,                 /* pRestoreDC */
187     MFDRV_RoundRect,                 /* pRoundRect */
188     MFDRV_SaveDC,                    /* pSaveDC */
189     MFDRV_ScaleViewportExtEx,        /* pScaleViewportExtEx */
190     MFDRV_ScaleWindowExtEx,          /* pScaleWindowExtEx */
191     MFDRV_SelectBitmap,              /* pSelectBitmap */
192     MFDRV_SelectBrush,               /* pSelectBrush */
193     MFDRV_SelectClipPath,            /* pSelectClipPath */
194     MFDRV_SelectFont,                /* pSelectFont */
195     MFDRV_SelectPalette,             /* pSelectPalette */
196     MFDRV_SelectPen,                 /* pSelectPen */
197     NULL,                            /* pSetArcDirection */
198     MFDRV_SetBkColor,                /* pSetBkColor */
199     MFDRV_SetBkMode,                 /* pSetBkMode */
200     MFDRV_SetBoundsRect,             /* pSetBoundsRect */
201     MFDRV_SetDCBrushColor,           /* pSetDCBrushColor*/
202     MFDRV_SetDCPenColor,             /* pSetDCPenColor*/
203     MFDRV_SetDIBitsToDevice,         /* pSetDIBitsToDevice */
204     NULL,                            /* pSetDeviceClipping */
205     NULL,                            /* pSetDeviceGammaRamp */
206     NULL,                            /* pSetLayout */
207     MFDRV_SetMapMode,                /* pSetMapMode */
208     MFDRV_SetMapperFlags,            /* pSetMapperFlags */
209     MFDRV_SetPixel,                  /* pSetPixel */
210     NULL,                            /* pSetPixelFormat */
211     MFDRV_SetPolyFillMode,           /* pSetPolyFillMode */
212     MFDRV_SetROP2,                   /* pSetROP2 */
213     MFDRV_SetRelAbs,                 /* pSetRelAbs */
214     MFDRV_SetStretchBltMode,         /* pSetStretchBltMode */
215     MFDRV_SetTextAlign,              /* pSetTextAlign */
216     MFDRV_SetTextCharacterExtra,     /* pSetTextCharacterExtra */
217     MFDRV_SetTextColor,              /* pSetTextColor */
218     MFDRV_SetTextJustification,      /* pSetTextJustification */
219     MFDRV_SetViewportExtEx,          /* pSetViewportExtEx */
220     MFDRV_SetViewportOrgEx,          /* pSetViewportOrgEx */
221     MFDRV_SetWindowExtEx,            /* pSetWindowExtEx */
222     MFDRV_SetWindowOrgEx,            /* pSetWindowOrgEx */
223     NULL,                            /* pSetWorldTransform */
224     NULL,                            /* pStartDoc */
225     NULL,                            /* pStartPage */
226     MFDRV_StretchBlt,                /* pStretchBlt */
227     MFDRV_StretchDIBits,             /* pStretchDIBits */
228     MFDRV_StrokeAndFillPath,         /* pStrokeAndFillPath */
229     MFDRV_StrokePath,                /* pStrokePath */
230     NULL,                            /* pSwapBuffers */
231     NULL,                            /* pUnrealizePalette */
232     MFDRV_WidenPath,                 /* pWidenPath */
233     NULL,                            /* pwglCopyContext */
234     NULL,                            /* pwglCreateContext */
235     NULL,                            /* pwglCreateContextAttribsARB */
236     NULL,                            /* pwglDeleteContext */
237     NULL,                            /* pwglGetProcAddress */
238     NULL,                            /* pwglMakeContextCurrentARB */
239     NULL,                            /* pwglMakeCurrent */
240     NULL,                            /* pwglSetPixelFormatWINE */
241     NULL,                            /* pwglShareLists */
242     NULL,                            /* pwglUseFontBitmapsA */
243     NULL,                            /* pwglUseFontBitmapsW */
244     GDI_PRIORITY_GRAPHICS_DRV        /* priority */
245 };
246
247
248
249 /**********************************************************************
250  *           MFDRV_AllocMetaFile
251  */
252 static DC *MFDRV_AllocMetaFile(void)
253 {
254     DC *dc;
255     METAFILEDRV_PDEVICE *physDev;
256
257     if (!(dc = alloc_dc_ptr( OBJ_METADC ))) return NULL;
258
259     physDev = HeapAlloc(GetProcessHeap(),0,sizeof(*physDev));
260     if (!physDev)
261     {
262         free_dc_ptr( dc );
263         return NULL;
264     }
265     if (!(physDev->mh = HeapAlloc( GetProcessHeap(), 0, sizeof(*physDev->mh) )))
266     {
267         HeapFree( GetProcessHeap(), 0, physDev );
268         free_dc_ptr( dc );
269         return NULL;
270     }
271
272     push_dc_driver( &dc->physDev, &physDev->dev, &MFDRV_Funcs );
273
274     physDev->handles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, HANDLE_LIST_INC * sizeof(physDev->handles[0]));
275     physDev->handles_size = HANDLE_LIST_INC;
276     physDev->cur_handles = 0;
277
278     physDev->hFile = 0;
279
280     physDev->mh->mtHeaderSize   = sizeof(METAHEADER) / sizeof(WORD);
281     physDev->mh->mtVersion      = 0x0300;
282     physDev->mh->mtSize         = physDev->mh->mtHeaderSize;
283     physDev->mh->mtNoObjects    = 0;
284     physDev->mh->mtMaxRecord    = 0;
285     physDev->mh->mtNoParameters = 0;
286
287     SetVirtualResolution( physDev->dev.hdc, 0, 0, 0, 0);
288
289     return dc;
290 }
291
292
293 /**********************************************************************
294  *           MFDRV_CreateCompatibleDC
295  */
296 static BOOL MFDRV_CreateCompatibleDC( PHYSDEV orig, PHYSDEV *pdev )
297 {
298     /* not supported on metafile DCs */
299     return FALSE;
300 }
301
302
303 /**********************************************************************
304  *           MFDRV_DeleteDC
305  */
306 static BOOL MFDRV_DeleteDC( PHYSDEV dev )
307 {
308     METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
309     DWORD index;
310
311     HeapFree( GetProcessHeap(), 0, physDev->mh );
312     for(index = 0; index < physDev->handles_size; index++)
313         if(physDev->handles[index])
314             GDI_hdc_not_using_object(physDev->handles[index], dev->hdc);
315     HeapFree( GetProcessHeap(), 0, physDev->handles );
316     HeapFree( GetProcessHeap(), 0, physDev );
317     return TRUE;
318 }
319
320
321 /**********************************************************************
322  *           CreateMetaFileW   (GDI32.@)
323  *
324  *  Create a new DC and associate it with a metafile. Pass a filename
325  *  to create a disk-based metafile, NULL to create a memory metafile.
326  *
327  * PARAMS
328  *  filename [I] Filename of disk metafile
329  *
330  * RETURNS
331  *  A handle to the metafile DC if successful, NULL on failure.
332  */
333 HDC WINAPI CreateMetaFileW( LPCWSTR filename )
334 {
335     HDC ret;
336     DC *dc;
337     METAFILEDRV_PDEVICE *physDev;
338     HANDLE hFile;
339
340     TRACE("%s\n", debugstr_w(filename) );
341
342     if (!(dc = MFDRV_AllocMetaFile())) return 0;
343     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
344
345     if (filename)  /* disk based metafile */
346     {
347         physDev->mh->mtType = METAFILE_DISK;
348         if ((hFile = CreateFileW(filename, GENERIC_WRITE, 0, NULL,
349                                 CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) {
350             free_dc_ptr( dc );
351             return 0;
352         }
353         if (!WriteFile( hFile, physDev->mh, sizeof(*physDev->mh), NULL,
354                         NULL )) {
355             free_dc_ptr( dc );
356             return 0;
357         }
358         physDev->hFile = hFile;
359
360         /* Grow METAHEADER to include filename */
361         physDev->mh = MF_CreateMetaHeaderDisk(physDev->mh, filename, TRUE);
362     }
363     else  /* memory based metafile */
364         physDev->mh->mtType = METAFILE_MEMORY;
365
366     TRACE("returning %p\n", physDev->dev.hdc);
367     ret = physDev->dev.hdc;
368     release_dc_ptr( dc );
369     return ret;
370 }
371
372 /**********************************************************************
373  *          CreateMetaFileA   (GDI32.@)
374  *
375  * See CreateMetaFileW.
376  */
377 HDC WINAPI CreateMetaFileA(LPCSTR filename)
378 {
379     LPWSTR filenameW;
380     DWORD len;
381     HDC hReturnDC;
382
383     if (!filename) return CreateMetaFileW(NULL);
384
385     len = MultiByteToWideChar( CP_ACP, 0, filename, -1, NULL, 0 );
386     filenameW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
387     MultiByteToWideChar( CP_ACP, 0, filename, -1, filenameW, len );
388
389     hReturnDC = CreateMetaFileW(filenameW);
390
391     HeapFree( GetProcessHeap(), 0, filenameW );
392
393     return hReturnDC;
394 }
395
396
397 /**********************************************************************
398  *          MFDRV_CloseMetaFile
399  */
400 static DC *MFDRV_CloseMetaFile( HDC hdc )
401 {
402     DC *dc;
403     METAFILEDRV_PDEVICE *physDev;
404
405     TRACE("(%p)\n", hdc );
406
407     if (!(dc = get_dc_ptr( hdc ))) return NULL;
408     if (dc->header.type != OBJ_METADC)
409     {
410         release_dc_ptr( dc );
411         return NULL;
412     }
413     if (dc->refcount != 1)
414     {
415         FIXME( "not deleting busy DC %p refcount %u\n", hdc, dc->refcount );
416         release_dc_ptr( dc );
417         return NULL;
418     }
419     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
420
421     /* Construct the end of metafile record - this is documented
422      * in SDK Knowledgebase Q99334.
423      */
424
425     if (!MFDRV_MetaParam0(dc->physDev, META_EOF))
426     {
427         free_dc_ptr( dc );
428         return 0;
429     }
430
431     if (physDev->mh->mtType == METAFILE_DISK)  /* disk based metafile */
432     {
433         if (SetFilePointer(physDev->hFile, 0, NULL, FILE_BEGIN) != 0) {
434             free_dc_ptr( dc );
435             return 0;
436         }
437
438         physDev->mh->mtType = METAFILE_MEMORY; /* This is what windows does */
439         if (!WriteFile(physDev->hFile, physDev->mh, sizeof(*physDev->mh),
440                        NULL, NULL)) {
441             free_dc_ptr( dc );
442             return 0;
443         }
444         CloseHandle(physDev->hFile);
445         physDev->mh->mtType = METAFILE_DISK;
446     }
447
448     return dc;
449 }
450
451 /******************************************************************
452  *           CloseMetaFile   (GDI32.@)
453  *
454  *  Stop recording graphics operations in metafile associated with
455  *  hdc and retrieve metafile.
456  *
457  * PARAMS
458  *  hdc [I] Metafile DC to close 
459  *
460  * RETURNS
461  *  Handle of newly created metafile on success, NULL on failure.
462  */
463 HMETAFILE WINAPI CloseMetaFile(HDC hdc)
464 {
465     HMETAFILE hmf;
466     METAFILEDRV_PDEVICE *physDev;
467     DC *dc = MFDRV_CloseMetaFile(hdc);
468     if (!dc) return 0;
469     physDev = (METAFILEDRV_PDEVICE *)dc->physDev;
470
471     /* Now allocate a global handle for the metafile */
472
473     hmf = MF_Create_HMETAFILE( physDev->mh );
474
475     physDev->mh = NULL;  /* So it won't be deleted */
476     free_dc_ptr( dc );
477     return hmf;
478 }
479
480
481 /******************************************************************
482  *         MFDRV_WriteRecord
483  *
484  * Warning: this function can change the pointer to the metafile header.
485  */
486 BOOL MFDRV_WriteRecord( PHYSDEV dev, METARECORD *mr, DWORD rlen)
487 {
488     DWORD len, size;
489     METAHEADER *mh;
490     METAFILEDRV_PDEVICE *physDev = (METAFILEDRV_PDEVICE *)dev;
491
492     switch(physDev->mh->mtType)
493     {
494     case METAFILE_MEMORY:
495         len = physDev->mh->mtSize * 2 + rlen;
496         /* reallocate memory if needed */
497         size = HeapSize( GetProcessHeap(), 0, physDev->mh );
498         if (len > size)
499         {
500             /*expand size*/
501             size += size / 2 + rlen;
502             mh = HeapReAlloc( GetProcessHeap(), 0, physDev->mh, size);
503             if (!mh) return FALSE;
504             physDev->mh = mh;
505             TRACE("Reallocated metafile: new size is %d\n",size);
506         }
507         memcpy((WORD *)physDev->mh + physDev->mh->mtSize, mr, rlen);
508         break;
509     case METAFILE_DISK:
510         TRACE("Writing record to disk\n");
511         if (!WriteFile(physDev->hFile, mr, rlen, NULL, NULL))
512             return FALSE;
513         break;
514     default:
515         ERR("Unknown metafile type %d\n", physDev->mh->mtType );
516         return FALSE;
517     }
518
519     physDev->mh->mtSize += rlen / 2;
520     physDev->mh->mtMaxRecord = max(physDev->mh->mtMaxRecord, rlen / 2);
521     return TRUE;
522 }
523
524
525 /******************************************************************
526  *         MFDRV_MetaParam0
527  */
528
529 BOOL MFDRV_MetaParam0(PHYSDEV dev, short func)
530 {
531     char buffer[8];
532     METARECORD *mr = (METARECORD *)&buffer;
533
534     mr->rdSize = 3;
535     mr->rdFunction = func;
536     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
537 }
538
539
540 /******************************************************************
541  *         MFDRV_MetaParam1
542  */
543 BOOL MFDRV_MetaParam1(PHYSDEV dev, short func, short param1)
544 {
545     char buffer[8];
546     METARECORD *mr = (METARECORD *)&buffer;
547     WORD *params = mr->rdParm;
548
549     mr->rdSize = 4;
550     mr->rdFunction = func;
551     params[0] = param1;
552     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
553 }
554
555
556 /******************************************************************
557  *         MFDRV_MetaParam2
558  */
559 BOOL MFDRV_MetaParam2(PHYSDEV dev, short func, short param1, short param2)
560 {
561     char buffer[10];
562     METARECORD *mr = (METARECORD *)&buffer;
563     WORD *params = mr->rdParm;
564
565     mr->rdSize = 5;
566     mr->rdFunction = func;
567     params[0] = param2;
568     params[1] = param1;
569     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
570 }
571
572
573 /******************************************************************
574  *         MFDRV_MetaParam4
575  */
576
577 BOOL MFDRV_MetaParam4(PHYSDEV dev, short func, short param1, short param2,
578                       short param3, short param4)
579 {
580     char buffer[14];
581     METARECORD *mr = (METARECORD *)&buffer;
582     WORD *params = mr->rdParm;
583
584     mr->rdSize = 7;
585     mr->rdFunction = func;
586     params[0] = param4;
587     params[1] = param3;
588     params[2] = param2;
589     params[3] = param1;
590     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
591 }
592
593
594 /******************************************************************
595  *         MFDRV_MetaParam6
596  */
597
598 BOOL MFDRV_MetaParam6(PHYSDEV dev, short func, short param1, short param2,
599                       short param3, short param4, short param5, short param6)
600 {
601     char buffer[18];
602     METARECORD *mr = (METARECORD *)&buffer;
603     WORD *params = mr->rdParm;
604
605     mr->rdSize = 9;
606     mr->rdFunction = func;
607     params[0] = param6;
608     params[1] = param5;
609     params[2] = param4;
610     params[3] = param3;
611     params[4] = param2;
612     params[5] = param1;
613     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
614 }
615
616
617 /******************************************************************
618  *         MFDRV_MetaParam8
619  */
620 BOOL MFDRV_MetaParam8(PHYSDEV dev, short func, short param1, short param2,
621                       short param3, short param4, short param5,
622                       short param6, short param7, short param8)
623 {
624     char buffer[22];
625     METARECORD *mr = (METARECORD *)&buffer;
626     WORD *params = mr->rdParm;
627
628     mr->rdSize = 11;
629     mr->rdFunction = func;
630     params[0] = param8;
631     params[1] = param7;
632     params[2] = param6;
633     params[3] = param5;
634     params[4] = param4;
635     params[5] = param3;
636     params[6] = param2;
637     params[7] = param1;
638     return MFDRV_WriteRecord( dev, mr, mr->rdSize * 2);
639 }