"Fossies" - the Fresh Open Source Software Archive

Member "libgdiplus-6.0.2/tests/testemfcodec.c" (31 Jul 2019, 65002 Bytes) of package /linux/misc/mono-sources/libgdiplus/libgdiplus-6.0.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #ifdef WIN32
    2 #ifndef __cplusplus
    3 #error Please compile with a C++ compiler.
    4 #endif
    5 #endif
    6 
    7 #if defined(USE_WINDOWS_GDIPLUS)
    8 #include <Windows.h>
    9 #include <GdiPlus.h>
   10 
   11 #pragma comment(lib, "gdiplus.lib")
   12 #else
   13 #include <GdiPlusFlat.h>
   14 #endif
   15 
   16 #if defined(USE_WINDOWS_GDIPLUS)
   17 using namespace Gdiplus;
   18 using namespace DllExports;
   19 #endif
   20 
   21 #include <assert.h>
   22 #include <stdio.h>
   23 #include <stdlib.h>
   24 #include "testhelpers.h"
   25 
   26 static const char *file = "temp_asset.emf";
   27 static WCHAR wFile[] = {'t', 'e', 'm', 'p', '_', 'a', 's', 's', 'e', 't', '.', 'e', 'm', 'f', 0};
   28 GpImage *image;
   29 
   30 #define createFile(buffer, expectedStatus) \
   31 { \
   32     GpStatus status; \
   33     FILE *f = fopen (file, "wb+"); \
   34     assert (f); \
   35     fwrite ((void *) buffer, sizeof (BYTE), sizeof (buffer), f); \
   36     fclose (f); \
   37  \
   38     status = GdipLoadImageFromFile (wFile, &image); \
   39     assertEqualInt (status, expectedStatus); \
   40 }
   41 
   42 #define createFileSuccess(buffer, x, y, width, height, dimensionWidth, dimensionHeight) \
   43 { \
   44     createFile (buffer, Ok); \
   45     verifyMetafile (image, emfRawFormat, x, y, width, height, dimensionWidth, dimensionHeight) \
   46     GdipDisposeImage (image); \
   47 }
   48 
   49 static void test_valid ()
   50 {
   51     BYTE simpleHeader[] = {
   52         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
   53         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
   54         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
   55         /* Signature */     0x20, 0x45, 0x4D, 0x46,
   56         /* Version */       0x00, 0x00, 0x01, 0x00,
   57         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
   58         /* Records */       0x02, 0x00, 0x00, 0x00,
   59         /* Handles */       0x01, 0x00,
   60         /* Reserved */      0x00, 0x00,
   61         /* nDescription */  0x00, 0x00, 0x00, 0x00,
   62         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
   63         /* palEntries */    0x00, 0x00, 0x00, 0x00,
   64         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
   65         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
   66 
   67         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
   68     };
   69     BYTE headerExtension1[] = {
   70         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
   71         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
   72         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
   73         /* Signature */      0x20, 0x45, 0x4D, 0x46,
   74         /* Version */        0x00, 0x00, 0x01, 0x00,
   75         /* Bytes */          0x78, 0x00, 0x00, 0x00,
   76         /* Records */        0x02, 0x00, 0x00, 0x00,
   77         /* Handles */        0x01, 0x00,
   78         /* Reserved */       0x00, 0x00,
   79         /* nDescription */   0x00, 0x00, 0x00, 0x00,
   80         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
   81         /* palEntries */     0x00, 0x00, 0x00, 0x00,
   82         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
   83         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
   84         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
   85         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
   86         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
   87 
   88         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
   89     };
   90     BYTE headerExtension2[] = {
   91         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
   92         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
   93         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
   94         /* Signature */      0x20, 0x45, 0x4D, 0x46,
   95         /* Version */        0x00, 0x00, 0x01, 0x00,
   96         /* Bytes */          0x80, 0x00, 0x00, 0x00,
   97         /* Records */        0x02, 0x00, 0x00, 0x00,
   98         /* Handles */        0x01, 0x00,
   99         /* Reserved */       0x00, 0x00,
  100         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  101         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  102         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  103         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  104         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  105         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  106         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  107         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
  108         /* Micrometers */    0xC0, 0x4B, 0x03, 0x00, 0xD8, 0x41, 0x04, 0x00,
  109 
  110         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  111     };
  112     BYTE zeroHeaderSize[] = {
  113         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  114         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  115         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  116         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  117         /* Version */       0x00, 0x00, 0x01, 0x00,
  118         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  119         /* Records */       0x02, 0x00, 0x00, 0x00,
  120         /* Handles */       0x01, 0x00,
  121         /* Reserved */      0x00, 0x00,
  122         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  123         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  124         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  125         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  126         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  127 
  128         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  129     };
  130     BYTE smallHeaderSize[] = {
  131         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00,
  132         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  133         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  134         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  135         /* Version */       0x00, 0x00, 0x01, 0x00,
  136         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  137         /* Records */       0x02, 0x00, 0x00, 0x00,
  138         /* Handles */       0x01, 0x00,
  139         /* Reserved */      0x00, 0x00,
  140         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  141         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  142         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  143         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  144         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  145 
  146         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  147     };
  148     BYTE zeroBoundsWidth[] = {
  149         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  150         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  151         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  152         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  153         /* Version */       0x00, 0x00, 0x01, 0x00,
  154         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  155         /* Records */       0x02, 0x00, 0x00, 0x00,
  156         /* Handles */       0x01, 0x00,
  157         /* Reserved */      0x00, 0x00,
  158         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  159         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  160         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  161         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  162         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  163 
  164         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  165     };
  166     BYTE zeroBoundsHeight[] = {
  167         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  168         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  169         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  170         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  171         /* Version */       0x00, 0x00, 0x01, 0x00,
  172         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  173         /* Records */       0x02, 0x00, 0x00, 0x00,
  174         /* Handles */       0x01, 0x00,
  175         /* Reserved */      0x00, 0x00,
  176         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  177         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  178         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  179         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  180         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  181 
  182         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  183     };
  184     BYTE negativeWidth[] = {
  185         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  186         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  187         /* Frame */         0xB1, 0x03, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xD2, 0x00, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  188         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  189         /* Version */       0x00, 0x00, 0x01, 0x00,
  190         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  191         /* Records */       0x02, 0x00, 0x00, 0x00,
  192         /* Handles */       0x01, 0x00,
  193         /* Reserved */      0x00, 0x00,
  194         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  195         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  196         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  197         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  198         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  199 
  200         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  201     };
  202     BYTE zeroFrameWidth[] = {
  203         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  204         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  205         /* Frame */         0x00, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  206         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  207         /* Version */       0x00, 0x00, 0x01, 0x00,
  208         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  209         /* Records */       0x02, 0x00, 0x00, 0x00,
  210         /* Handles */       0x01, 0x00,
  211         /* Reserved */      0x00, 0x00,
  212         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  213         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  214         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  215         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  216         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  217 
  218         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  219     };
  220     BYTE zeroFrameHeight[] = {
  221         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  222         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  223         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  224         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  225         /* Version */       0x00, 0x00, 0x01, 0x00,
  226         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  227         /* Records */       0x02, 0x00, 0x00, 0x00,
  228         /* Handles */       0x01, 0x00,
  229         /* Reserved */      0x00, 0x00,
  230         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  231         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  232         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  233         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  234         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  235 
  236         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  237     };
  238     BYTE zeroVersion[] = {
  239         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  240         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  241         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  242         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  243         /* Version */       0x00, 0x00, 0x00, 0x00,
  244         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  245         /* Records */       0x02, 0x00, 0x00, 0x00,
  246         /* Handles */       0x01, 0x00,
  247         /* Reserved */      0x00, 0x00,
  248         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  249         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  250         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  251         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  252         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  253 
  254         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  255     };
  256     BYTE bytesEqualToHeaderSize[] = {
  257         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  258         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  259         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  260         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  261         /* Version */       0x00, 0x00, 0x01, 0x00,
  262         /* Bytes */         0x58, 0x00, 0x00, 0x00,
  263         /* Records */       0x02, 0x00, 0x00, 0x00,
  264         /* Handles */       0x01, 0x00,
  265         /* Reserved */      0x00, 0x00,
  266         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  267         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  268         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  269         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  270         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  271     };
  272     BYTE largeRecords[] = {
  273         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  274         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  275         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  276         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  277         /* Version */       0x00, 0x00, 0x01, 0x00,
  278         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  279         /* Records */       0xFF, 0xFF, 0xFF, 0xFF,
  280         /* Handles */       0x01, 0x00,
  281         /* Reserved */      0x00, 0x00,
  282         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  283         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  284         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  285         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  286         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  287 
  288         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  289     };
  290     BYTE largeHandles[] = {
  291         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  292         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  293         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  294         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  295         /* Version */       0x00, 0x00, 0x01, 0x00,
  296         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  297         /* Records */       0x02, 0x00, 0x00, 0x00,
  298         /* Handles */       0xFF, 0xFF,
  299         /* Reserved */      0x00, 0x00,
  300         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  301         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  302         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  303         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  304         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  305 
  306         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  307     };
  308     BYTE nonZeroReserved[] = {
  309         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  310         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  311         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  312         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  313         /* Version */       0x00, 0x00, 0x01, 0x00,
  314         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  315         /* Records */       0x02, 0x00, 0x00, 0x00,
  316         /* Handles */       0x01, 0x00,
  317         /* Reserved */      0xFF, 0xFF,
  318         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  319         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  320         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  321         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  322         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  323 
  324         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  325     };
  326     BYTE invalidDescription[] = {
  327         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  328         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  329         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  330         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  331         /* Version */       0x00, 0x00, 0x01, 0x00,
  332         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  333         /* Records */       0x02, 0x00, 0x00, 0x00,
  334         /* Handles */       0x01, 0x00,
  335         /* Reserved */      0x00, 0x00,
  336         /* nDescription */  0x6D, 0x00, 0x00, 0x00,
  337         /* offDescription*/ 0xFF, 0xFF, 0xFF, 0xFF,
  338         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  339         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  340         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  341 
  342         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  343     };
  344     BYTE invalidPalEntries[] = {
  345         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  346         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  347         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  348         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  349         /* Version */       0x00, 0x00, 0x01, 0x00,
  350         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  351         /* Records */       0x02, 0x00, 0x00, 0x00,
  352         /* Handles */       0x01, 0x00,
  353         /* Reserved */      0x00, 0x00,
  354         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  355         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  356         /* palEntries */    0xFF, 0xFF, 0xFF, 0xFF,
  357         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  358         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  359 
  360         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  361     };
  362     BYTE shortMillimetres[] = {
  363         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  364         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  365         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  366         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  367         /* Version */       0x00, 0x00, 0x01, 0x00,
  368         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  369         /* Records */       0x02, 0x00, 0x00, 0x00,
  370         /* Handles */       0x01, 0x00,
  371         /* Reserved */      0x00, 0x00,
  372         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  373         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  374         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  375         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  376         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00
  377     };
  378     BYTE invalidPixelFormat[] = {
  379         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  380         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  381         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  382         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  383         /* Version */        0x00, 0x00, 0x01, 0x00,
  384         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  385         /* Records */        0x02, 0x00, 0x00, 0x00,
  386         /* Handles */        0x01, 0x00,
  387         /* Reserved */       0x00, 0x00,
  388         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  389         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  390         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  391         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  392         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  393         /* cbPixelFormat */  0x6D, 0x00, 0x00, 0x00,
  394         /* offPixelFormat */ 0xFF, 0xFF, 0xFF, 0xFF,
  395         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
  396 
  397         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  398     };
  399     BYTE invalidOpenGL[] = {
  400         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  401         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  402         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  403         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  404         /* Version */        0x00, 0x00, 0x01, 0x00,
  405         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  406         /* Records */        0x02, 0x00, 0x00, 0x00,
  407         /* Handles */        0x01, 0x00,
  408         /* Reserved */       0x00, 0x00,
  409         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  410         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  411         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  412         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  413         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  414         /* cbPixelFormat */  0x6D, 0x00, 0x00, 0x00,
  415         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  416         /* bOpenGL */        0xFF, 0xFF, 0xFF, 0xFF,
  417 
  418         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  419     };
  420     BYTE zeroMicrometresWidth[] = {
  421         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  422         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  423         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  424         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  425         /* Version */        0x00, 0x00, 0x01, 0x00,
  426         /* Bytes */          0x80, 0x00, 0x00, 0x00,
  427         /* Records */        0x02, 0x00, 0x00, 0x00,
  428         /* Handles */        0x01, 0x00,
  429         /* Reserved */       0x00, 0x00,
  430         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  431         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  432         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  433         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  434         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  435         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  436         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  437         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
  438         /* Micrometers */    0x00, 0x00, 0x00, 0x00, 0xD8, 0x41, 0x04, 0x00,
  439 
  440         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  441     };
  442     BYTE zeroMicrometresHeight[] = {
  443         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  444         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  445         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  446         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  447         /* Version */        0x00, 0x00, 0x01, 0x00,
  448         /* Bytes */          0x80, 0x00, 0x00, 0x00,
  449         /* Records */        0x02, 0x00, 0x00, 0x00,
  450         /* Handles */        0x01, 0x00,
  451         /* Reserved */       0x00, 0x00,
  452         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  453         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  454         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  455         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  456         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  457         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  458         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  459         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
  460         /* Micrometers */    0xC0, 0x4B, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
  461 
  462         /* EMR_EOF */        0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  463     };
  464     BYTE noRecords[] = {
  465         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  466         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  467         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  468         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  469         /* Version */       0x00, 0x00, 0x01, 0x00,
  470         /* Bytes */         0x70, 0x00, 0x00, 0x00,
  471         /* Records */       0x02, 0x00, 0x00, 0x00,
  472         /* Handles */       0x01, 0x00,
  473         /* Reserved */      0x00, 0x00,
  474         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  475         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  476         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  477         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  478         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  479     };
  480     BYTE noCbPixelFormat[] = {
  481         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  482         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  483         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  484         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  485         /* Version */        0x00, 0x00, 0x01, 0x00,
  486         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  487         /* Records */        0x02, 0x00, 0x00, 0x00,
  488         /* Handles */        0x01, 0x00,
  489         /* Reserved */       0x00, 0x00,
  490         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  491         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  492         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  493         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  494         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  495     };
  496     BYTE shortCbPixelFormat[] = {
  497         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  498         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  499         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  500         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  501         /* Version */        0x00, 0x00, 0x01, 0x00,
  502         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  503         /* Records */        0x02, 0x00, 0x00, 0x00,
  504         /* Handles */        0x01, 0x00,
  505         /* Reserved */       0x00, 0x00,
  506         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  507         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  508         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  509         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  510         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  511         /* cbPixelFormat */  0x00, 0x00, 0x00
  512     };
  513     BYTE noOffPixelFormat[] = {
  514         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  515         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  516         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  517         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  518         /* Version */        0x00, 0x00, 0x01, 0x00,
  519         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  520         /* Records */        0x02, 0x00, 0x00, 0x00,
  521         /* Handles */        0x01, 0x00,
  522         /* Reserved */       0x00, 0x00,
  523         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  524         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  525         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  526         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  527         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  528         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  529     };
  530     BYTE shortOffPixelFormat[] = {
  531         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  532         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  533         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  534         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  535         /* Version */        0x00, 0x00, 0x01, 0x00,
  536         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  537         /* Records */        0x02, 0x00, 0x00, 0x00,
  538         /* Handles */        0x01, 0x00,
  539         /* Reserved */       0x00, 0x00,
  540         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  541         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  542         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  543         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  544         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  545         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  546         /* offPixelFormat */ 0x00, 0x00, 0x00
  547     };
  548     BYTE noOpenGL[] = {
  549         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  550         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  551         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  552         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  553         /* Version */        0x00, 0x00, 0x01, 0x00,
  554         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  555         /* Records */        0x02, 0x00, 0x00, 0x00,
  556         /* Handles */        0x01, 0x00,
  557         /* Reserved */       0x00, 0x00,
  558         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  559         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  560         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  561         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  562         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  563         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  564         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  565     };
  566     BYTE shortOpenGL[] = {
  567         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
  568         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  569         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  570         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  571         /* Version */        0x00, 0x00, 0x01, 0x00,
  572         /* Bytes */          0x78, 0x00, 0x00, 0x00,
  573         /* Records */        0x02, 0x00, 0x00, 0x00,
  574         /* Handles */        0x01, 0x00,
  575         /* Reserved */       0x00, 0x00,
  576         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  577         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  578         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  579         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  580         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  581         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  582         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  583         /* bOpenGL */        0x00, 0x00, 0x00
  584     };
  585     BYTE noMicrometers[] = {
  586         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  587         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  588         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  589         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  590         /* Version */        0x00, 0x00, 0x01, 0x00,
  591         /* Bytes */          0x80, 0x00, 0x00, 0x00,
  592         /* Records */        0x02, 0x00, 0x00, 0x00,
  593         /* Handles */        0x01, 0x00,
  594         /* Reserved */       0x00, 0x00,
  595         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  596         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  597         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  598         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  599         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  600         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  601         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  602         /* bOpenGL */        0x00, 0x00, 0x00, 0x00
  603     };
  604     BYTE shortMicrometers[] = {
  605         /* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  606         /* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  607         /* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  608         /* Signature */      0x20, 0x45, 0x4D, 0x46,
  609         /* Version */        0x00, 0x00, 0x01, 0x00,
  610         /* Bytes */          0x80, 0x00, 0x00, 0x00,
  611         /* Records */        0x02, 0x00, 0x00, 0x00,
  612         /* Handles */        0x01, 0x00,
  613         /* Reserved */       0x00, 0x00,
  614         /* nDescription */   0x00, 0x00, 0x00, 0x00,
  615         /* offDescription*/  0x00, 0x00, 0x00, 0x00,
  616         /* palEntries */     0x00, 0x00, 0x00, 0x00,
  617         /* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  618         /* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  619         /* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
  620         /* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
  621         /* bOpenGL */        0x00, 0x00, 0x00, 0x00,
  622         /* Micrometers */    0xC0, 0x4B, 0x03, 0x00, 0xD8, 0x41, 0x04
  623     };
  624     BYTE tooLargeFileSize[] = {
  625         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  626         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  627         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  628         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  629         /* Version */       0x00, 0x00, 0x01, 0x00,
  630         /* Bytes */         0x00, 0x01, 0x00, 0x00,
  631         /* Records */       0x02, 0x00, 0x00, 0x00,
  632         /* Handles */       0x01, 0x00,
  633         /* Reserved */      0x00, 0x00,
  634         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  635         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  636         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  637         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  638         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  639 
  640         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  641     };
  642 
  643     createFileSuccess (simpleHeader, 14, 20, 50, 18, 750, 216);
  644     createFileSuccess (headerExtension1, 14, 20, 50, 18, 750, 216);
  645     createFileSuccess (headerExtension2, 14, 20, 50, 18, 750, 216);
  646     createFileSuccess (zeroHeaderSize, 14, 20, 50, 18, 750, 216);
  647     createFileSuccess (smallHeaderSize, 14, 20, 50, 18, 750, 216);
  648     createFileSuccess (zeroBoundsWidth, 14, 20, 50, 18, 750, 216);
  649     createFileSuccess (zeroBoundsHeight, 14, 20, 50, 18, 750, 216);
  650     createFileSuccess (negativeWidth, 63, 20, -48, 18, -720, 216);
  651     createFileSuccess (zeroFrameWidth, 0, 20, 1, 18, 15, 216);
  652     createFileSuccess (zeroFrameHeight, 14, 0, 50, 1, 750, 12);
  653     createFileSuccess (zeroVersion, 14, 20, 50, 18, 750, 216);
  654     createFileSuccess (bytesEqualToHeaderSize, 14, 20, 50, 18, 750, 216);
  655     createFileSuccess (largeRecords, 14, 20, 50, 18, 750, 216);
  656     createFileSuccess (largeHandles, 14, 20, 50, 18, 750, 216);
  657     createFileSuccess (nonZeroReserved, 14, 20, 50, 18, 750, 216);
  658     createFileSuccess (invalidDescription, 14, 20, 50, 18, 750, 216);
  659     createFileSuccess (invalidPalEntries, 14, 20, 50, 18, 750, 216);
  660     createFileSuccess (shortMillimetres, 14, 20, 50, 18, 750, 216);
  661     createFileSuccess (invalidPixelFormat, 14, 20, 50, 18, 750, 216);
  662     createFileSuccess (invalidOpenGL, 14, 20, 50, 18, 750, 216);
  663     createFileSuccess (zeroMicrometresWidth, 14, 20, 50, 18, 750, 216);
  664     createFileSuccess (zeroMicrometresHeight, 14, 20, 50, 18, 750, 216);
  665     createFileSuccess (noRecords, 14, 20, 50, 18, 750, 216);
  666     createFileSuccess (noCbPixelFormat, 14, 20, 50, 18, 750, 216);
  667     createFileSuccess (shortCbPixelFormat, 14, 20, 50, 18, 750, 216);
  668     createFileSuccess (noOffPixelFormat, 14, 20, 50, 18, 750, 216);
  669     createFileSuccess (shortOffPixelFormat, 14, 20, 50, 18, 750, 216);
  670     createFileSuccess (noOpenGL, 14, 20, 50, 18, 750, 216);
  671     createFileSuccess (shortOpenGL, 14, 20, 50, 18, 750, 216);
  672     createFileSuccess (noMicrometers, 14, 20, 50, 18, 750, 216);
  673     createFileSuccess (shortMicrometers, 14, 20, 50, 18, 750, 216);
  674     createFileSuccess (tooLargeFileSize, 14, 20, 50, 18, 750, 216);
  675 }
  676 
  677 static void test_invalidHeader()
  678 {
  679     BYTE shortType[] = {
  680         /* EMR_HEADER */ 0x01, 0x00, 0x00
  681     };
  682     BYTE noSize[] = {
  683         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00
  684     };
  685     BYTE shortSize[] = {
  686         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00
  687     };
  688     BYTE noBounds[] = {
  689         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00
  690     };
  691     BYTE shortBounds[] = {
  692         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  693         /* Bounds */     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00
  694     };
  695     BYTE noFrame[] = {
  696         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  697         /* Bounds */     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00
  698     };
  699     BYTE shortFrame[] = {
  700         /* EMR_HEADER */ 0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  701         /* Bounds */     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  702         /* Frame */      0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00
  703     };
  704     BYTE noSignature[] = {
  705         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  706         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  707         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00
  708     };
  709     BYTE shortSignature[] = {
  710         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  711         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  712         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  713         /* Signature */     0x20, 0x45, 0x4D
  714     };
  715     BYTE noVersion[] = {
  716         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  717         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  718         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  719         /* Signature */     0x20, 0x45, 0x4D, 0x46
  720     };
  721     BYTE shortVersion[] = {
  722         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  723         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  724         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  725         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  726         /* Version */       0x00, 0x00, 0x01
  727     };
  728     BYTE noBytes[] = {
  729         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  730         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  731         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  732         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  733         /* Version */       0x00, 0x00, 0x01, 0x00
  734     };
  735     BYTE shortBytes[] = {
  736         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  737         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  738         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  739         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  740         /* Version */       0x00, 0x00, 0x01, 0x00,
  741         /* Bytes */         0x6C, 0x00, 0x00
  742     };
  743     BYTE noRecords[] = {
  744         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  745         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  746         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  747         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  748         /* Version */       0x00, 0x00, 0x01, 0x00,
  749         /* Bytes */         0x6C, 0x00, 0x00, 0x00
  750     };
  751     BYTE shortRecords[] = {
  752         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  753         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  754         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  755         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  756         /* Version */       0x00, 0x00, 0x01, 0x00,
  757         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  758         /* Records */       0x02, 0x00, 0x00
  759     };
  760     BYTE noHandles[] = {
  761         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  762         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  763         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  764         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  765         /* Version */       0x00, 0x00, 0x01, 0x00,
  766         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  767         /* Records */       0x02, 0x00, 0x00, 0x00
  768     };
  769     BYTE shortHandles[] = {
  770         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  771         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  772         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  773         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  774         /* Version */       0x00, 0x00, 0x01, 0x00,
  775         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  776         /* Records */       0x02, 0x00, 0x00, 0x00,
  777         /* Handles */       0x01
  778     };
  779     BYTE noReserved[] = {
  780         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  781         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  782         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  783         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  784         /* Version */       0x00, 0x00, 0x01, 0x00,
  785         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  786         /* Records */       0x02, 0x00, 0x00, 0x00,
  787         /* Handles */       0x01, 0x00
  788     };
  789     BYTE shortReserved[] = {
  790         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  791         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  792         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  793         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  794         /* Version */       0x00, 0x00, 0x01, 0x00,
  795         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  796         /* Records */       0x02, 0x00, 0x00, 0x00,
  797         /* Handles */       0x01, 0x00,
  798         /* Reserved */      0x00
  799     };
  800     BYTE noNDescription[] = {
  801         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  802         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  803         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  804         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  805         /* Version */       0x00, 0x00, 0x01, 0x00,
  806         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  807         /* Records */       0x02, 0x00, 0x00, 0x00,
  808         /* Handles */       0x01, 0x00,
  809         /* Reserved */      0x00, 0x00,
  810         /* nDescription */  0x00, 0x00, 0x00, 0x00
  811     };
  812     BYTE shortNDescription[] = {
  813         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  814         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  815         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  816         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  817         /* Version */       0x00, 0x00, 0x01, 0x00,
  818         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  819         /* Records */       0x02, 0x00, 0x00, 0x00,
  820         /* Handles */       0x01, 0x00,
  821         /* Reserved */      0x00, 0x00,
  822         /* nDescription */  0x00, 0x00, 0x00
  823     };
  824     BYTE noOffDescription[] = {
  825         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  826         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  827         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  828         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  829         /* Version */       0x00, 0x00, 0x01, 0x00,
  830         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  831         /* Records */       0x02, 0x00, 0x00, 0x00,
  832         /* Handles */       0x01, 0x00,
  833         /* Reserved */      0x00, 0x00,
  834         /* nDescription */  0x00, 0x00, 0x00, 0x00
  835     };
  836     BYTE shortOffDescription[] = {
  837         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  838         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  839         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  840         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  841         /* Version */       0x00, 0x00, 0x01, 0x00,
  842         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  843         /* Records */       0x02, 0x00, 0x00, 0x00,
  844         /* Handles */       0x01, 0x00,
  845         /* Reserved */      0x00, 0x00,
  846         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  847         /* offDescription*/ 0x00, 0x00, 0x00
  848     };
  849     BYTE noPalEntries[] = {
  850         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  851         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  852         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  853         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  854         /* Version */       0x00, 0x00, 0x01, 0x00,
  855         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  856         /* Records */       0x02, 0x00, 0x00, 0x00,
  857         /* Handles */       0x01, 0x00,
  858         /* Reserved */      0x00, 0x00,
  859         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  860         /* offDescription*/ 0x00, 0x00, 0x00, 0x00
  861     };
  862     BYTE shortPalEntries[] = {
  863         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  864         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  865         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  866         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  867         /* Version */       0x00, 0x00, 0x01, 0x00,
  868         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  869         /* Records */       0x02, 0x00, 0x00, 0x00,
  870         /* Handles */       0x01, 0x00,
  871         /* Reserved */      0x00, 0x00,
  872         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  873         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  874         /* palEntries */    0x00, 0x00, 0x00
  875     };
  876     BYTE noDevice[] = {
  877         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  878         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  879         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  880         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  881         /* Version */       0x00, 0x00, 0x01, 0x00,
  882         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  883         /* Records */       0x02, 0x00, 0x00, 0x00,
  884         /* Handles */       0x01, 0x00,
  885         /* Reserved */      0x00, 0x00,
  886         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  887         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  888         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  889     };
  890     BYTE shortDevice[] = {
  891         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  892         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  893         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  894         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  895         /* Version */       0x00, 0x00, 0x01, 0x00,
  896         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  897         /* Records */       0x02, 0x00, 0x00, 0x00,
  898         /* Handles */       0x01, 0x00,
  899         /* Reserved */      0x00, 0x00,
  900         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  901         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  902         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  903         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00
  904     };
  905     BYTE noMillimetres[] = {
  906         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  907         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  908         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  909         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  910         /* Version */       0x00, 0x00, 0x01, 0x00,
  911         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  912         /* Records */       0x02, 0x00, 0x00, 0x00,
  913         /* Handles */       0x01, 0x00,
  914         /* Reserved */      0x00, 0x00,
  915         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  916         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  917         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  918         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00
  919     };
  920 
  921     createFile (shortType, OutOfMemory);
  922     createFile (noSize, OutOfMemory);
  923     createFile (shortSize, OutOfMemory);
  924     createFile (noBounds, OutOfMemory);
  925     createFile (shortBounds, OutOfMemory);
  926     createFile (noFrame, OutOfMemory);
  927     createFile (shortFrame, OutOfMemory);
  928     createFile (noSignature, OutOfMemory);
  929     createFile (shortSignature, OutOfMemory);
  930     createFile (noVersion, OutOfMemory);
  931     createFile (shortVersion, OutOfMemory);
  932     createFile (noBytes, OutOfMemory);
  933     createFile (shortBytes, OutOfMemory);
  934     createFile (noRecords, OutOfMemory);
  935     createFile (shortRecords, OutOfMemory);
  936     createFile (noHandles, OutOfMemory);
  937     createFile (shortHandles, OutOfMemory);
  938     createFile (noReserved, OutOfMemory);
  939     createFile (shortReserved, OutOfMemory);
  940     createFile (noNDescription, OutOfMemory);
  941     createFile (shortNDescription, OutOfMemory);
  942     createFile (noOffDescription, OutOfMemory);
  943     createFile (shortOffDescription, OutOfMemory);
  944     createFile (noPalEntries, OutOfMemory);
  945     createFile (shortPalEntries, OutOfMemory);
  946     createFile (noDevice, OutOfMemory);
  947     createFile (shortDevice, OutOfMemory);
  948     createFile (noMillimetres, OutOfMemory);
  949     createFile (shortDevice, OutOfMemory);
  950 }
  951 
  952 static void test_invalidData ()
  953 {
  954     BYTE invalidType[] = {
  955         /* EMR_HEADER */    0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  956         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  957         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  958         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  959         /* Version */       0x00, 0x00, 0x01, 0x00,
  960         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  961         /* Records */       0x02, 0x00, 0x00, 0x00,
  962         /* Handles */       0x01, 0x00,
  963         /* Reserved */      0x00, 0x00,
  964         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  965         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  966         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  967         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  968         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  969 
  970         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  971     };
  972     BYTE largeHeaderSize[] = {
  973         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0xCD, 0x00, 0x00, 0x00,
  974         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  975         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
  976         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  977         /* Version */       0x00, 0x00, 0x01, 0x00,
  978         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  979         /* Records */       0x02, 0x00, 0x00, 0x00,
  980         /* Handles */       0x01, 0x00,
  981         /* Reserved */      0x00, 0x00,
  982         /* nDescription */  0x00, 0x00, 0x00, 0x00,
  983         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
  984         /* palEntries */    0x00, 0x00, 0x00, 0x00,
  985         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
  986         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
  987 
  988         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
  989     };
  990     BYTE negativeHeight[] = {
  991         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
  992         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
  993         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00,
  994         /* Signature */     0x20, 0x45, 0x4D, 0x46,
  995         /* Version */       0x00, 0x00, 0x01, 0x00,
  996         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
  997         /* Records */       0x02, 0x00, 0x00, 0x00,
  998         /* Handles */       0x01, 0x00,
  999         /* Reserved */      0x00, 0x00,
 1000         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1001         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1002         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1003         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1004         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1005 
 1006         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1007     };
 1008     BYTE invalidSignature[] = {
 1009         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1010         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1011         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1012         /* Signature */     0x00, 0x45, 0x4D, 0x46,
 1013         /* Version */       0x00, 0x00, 0x01, 0x00,
 1014         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1015         /* Records */       0x02, 0x00, 0x00, 0x00,
 1016         /* Handles */       0x01, 0x00,
 1017         /* Reserved */      0x00, 0x00,
 1018         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1019         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1020         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1021         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1022         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1023 
 1024         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1025     };
 1026     BYTE zeroBytes[] = {
 1027         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1028         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1029         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1030         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1031         /* Version */       0x00, 0x00, 0x01, 0x00,
 1032         /* Bytes */         0x00, 0x00, 0x00, 0x00,
 1033         /* Records */       0x02, 0x00, 0x00, 0x00,
 1034         /* Handles */       0x01, 0x00,
 1035         /* Reserved */      0x00, 0x00,
 1036         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1037         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1038         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1039         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1040         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1041 
 1042         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1043     };
 1044     BYTE bytesSmallerThanHeaderSize[] = {
 1045         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1046         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1047         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1048         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1049         /* Version */       0x00, 0x00, 0x01, 0x00,
 1050         /* Bytes */         0x54, 0x00, 0x00, 0x00,
 1051         /* Records */       0x02, 0x00, 0x00, 0x00,
 1052         /* Handles */       0x01, 0x00,
 1053         /* Reserved */      0x00, 0x00,
 1054         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1055         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1056         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1057         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1058         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1059 
 1060         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1061     };
 1062     BYTE bytesNotDivisibleBy4[] = {
 1063         /* EMR_HEADER */    0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1064         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1065         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1066         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1067         /* Version */       0x00, 0x00, 0x01, 0x00,
 1068         /* Bytes */         0x6E, 0x00, 0x00, 0x00,
 1069         /* Records */       0x02, 0x00, 0x00, 0x00,
 1070         /* Handles */       0x01, 0x00,
 1071         /* Reserved */      0x00, 0x00,
 1072         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1073         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1074         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1075         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1076         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1077 
 1078         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1079     };
 1080     BYTE zeroRecords[] = {
 1081         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1082         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1083         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1084         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1085         /* Version */       0x00, 0x00, 0x01, 0x00,
 1086         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1087         /* Records */       0x00, 0x00, 0x00, 0x00,
 1088         /* Handles */       0x01, 0x00,
 1089         /* Reserved */      0x00, 0x00,
 1090         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1091         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1092         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1093         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1094         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1095 
 1096         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1097     };
 1098     BYTE oneRecord[] = {
 1099         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1100         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1101         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1102         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1103         /* Version */       0x00, 0x00, 0x01, 0x00,
 1104         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1105         /* Records */       0x01, 0x00, 0x00, 0x00,
 1106         /* Handles */       0x01, 0x00,
 1107         /* Reserved */      0x00, 0x00,
 1108         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1109         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1110         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1111         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1112         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1113 
 1114         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1115     };
 1116     BYTE zeroHandles[] = {
 1117         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1118         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1119         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1120         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1121         /* Version */       0x00, 0x00, 0x01, 0x00,
 1122         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1123         /* Records */       0x02, 0x00, 0x00, 0x00,
 1124         /* Handles */       0x00, 0x00,
 1125         /* Reserved */      0x00, 0x00,
 1126         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1127         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1128         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1129         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1130         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1131 
 1132         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1133     };
 1134     BYTE zeroDeviceWidth[] = {
 1135         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1136         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1137         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1138         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1139         /* Version */       0x00, 0x00, 0x01, 0x00,
 1140         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1141         /* Records */       0x02, 0x00, 0x00, 0x00,
 1142         /* Handles */       0x01, 0x00,
 1143         /* Reserved */      0x00, 0x00,
 1144         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1145         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1146         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1147         /* Device */        0x00, 0x00, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1148         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1149 
 1150         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1151     };
 1152     BYTE zeroDeviceHeight[] = {
 1153         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1154         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1155         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1156         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1157         /* Version */       0x00, 0x00, 0x01, 0x00,
 1158         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1159         /* Records */       0x02, 0x00, 0x00, 0x00,
 1160         /* Handles */       0x01, 0x00,
 1161         /* Reserved */      0x00, 0x00,
 1162         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1163         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1164         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1165         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 1166         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1167 
 1168         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1169     };
 1170     BYTE zeroMillimetresWidth[] = {
 1171         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1172         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1173         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1174         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1175         /* Version */       0x00, 0x00, 0x01, 0x00,
 1176         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1177         /* Records */       0x02, 0x00, 0x00, 0x00,
 1178         /* Handles */       0x00, 0x00,
 1179         /* Reserved */      0x00, 0x00,
 1180         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1181         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1182         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1183         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1184         /* Millimetres */   0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
 1185 
 1186         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1187     };
 1188     BYTE zeroMillimetresHeight[] = {
 1189         /* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
 1190         /* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
 1191         /* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
 1192         /* Signature */     0x20, 0x45, 0x4D, 0x46,
 1193         /* Version */       0x00, 0x00, 0x01, 0x00,
 1194         /* Bytes */         0x6C, 0x00, 0x00, 0x00,
 1195         /* Records */       0x02, 0x00, 0x00, 0x00,
 1196         /* Handles */       0x00, 0x00,
 1197         /* Reserved */      0x00, 0x00,
 1198         /* nDescription */  0x00, 0x00, 0x00, 0x00,
 1199         /* offDescription*/ 0x00, 0x00, 0x00, 0x00,
 1200         /* palEntries */    0x00, 0x00, 0x00, 0x00,
 1201         /* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
 1202         /* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 1203 
 1204         /* EMR_EOF */       0x0E, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
 1205     };
 1206 
 1207     createFile (invalidType, OutOfMemory);
 1208     createFile (largeHeaderSize, OutOfMemory);
 1209     createFile (negativeHeight, OutOfMemory);
 1210     createFile (invalidSignature, OutOfMemory);
 1211     createFile (zeroBytes, OutOfMemory);
 1212     createFile (bytesSmallerThanHeaderSize, OutOfMemory);
 1213     createFile (bytesNotDivisibleBy4, OutOfMemory);
 1214     createFile (zeroRecords, OutOfMemory);
 1215     createFile (oneRecord, OutOfMemory);
 1216     createFile (zeroHandles, OutOfMemory);
 1217     createFile (zeroDeviceWidth, OutOfMemory);
 1218     createFile (zeroDeviceHeight, OutOfMemory);
 1219     createFile (zeroMillimetresWidth, OutOfMemory);
 1220     createFile (zeroMillimetresHeight, OutOfMemory);
 1221 }
 1222 
 1223 int
 1224 main (int argc, char**argv)
 1225 {
 1226     STARTUP;
 1227 
 1228     test_valid ();
 1229     test_invalidHeader ();
 1230     test_invalidData ();
 1231 
 1232     deleteFile (file);
 1233 
 1234     SHUTDOWN;
 1235     return 0;
 1236 }