Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate how GDI+ parses short emf header extensions #182

Closed
hughbe opened this issue Dec 15, 2017 · 0 comments
Closed

Investigate how GDI+ parses short emf header extensions #182

hughbe opened this issue Dec 15, 2017 · 0 comments

Comments

@hughbe
Copy link
Contributor

hughbe commented Dec 15, 2017

In test_valid in testemfcodec.c

#if defined(USE_WINDOWS_GDIPLUS)
	BYTE shortMillimetres[] = {
		/* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
		/* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */     0x20, 0x45, 0x4D, 0x46,
		/* Version */       0x00, 0x00, 0x01, 0x00,
		/* Bytes */         0x6C, 0x00, 0x00, 0x00,
		/* Records */       0x02, 0x00, 0x00, 0x00,
		/* Handles */       0x01, 0x00,
		/* Reserved */      0x00, 0x00,
		/* nDescription */  0x00, 0x00, 0x00, 0x00,
		/* offDescription*/ 0x00, 0x00, 0x00, 0x00,
		/* palEntries */    0x00, 0x00, 0x00, 0x00,
		/* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00
	};
#endif
#if defined(USE_WINDOWS_GDIPLUS)
	BYTE noRecords[] = {
		/* EMR_HEADER */    0x01, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00,
		/* Bounds */        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */         0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */     0x20, 0x45, 0x4D, 0x46,
		/* Version */       0x00, 0x00, 0x01, 0x00,
		/* Bytes */         0x70, 0x00, 0x00, 0x00,
		/* Records */       0x02, 0x00, 0x00, 0x00,
		/* Handles */       0x01, 0x00,
		/* Reserved */      0x00, 0x00,
		/* nDescription */  0x00, 0x00, 0x00, 0x00,
		/* offDescription*/ 0x00, 0x00, 0x00, 0x00,
		/* palEntries */    0x00, 0x00, 0x00, 0x00,
		/* Device */        0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */   0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
	};
	BYTE noCbPixelFormat[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00
	};
	BYTE shortCbPixelFormat[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00
	};
	BYTE noOffPixelFormat[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
	};
	BYTE shortOffPixelFormat[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
		/* offPixelFormat */ 0x00, 0x00, 0x00
	};
	BYTE noOpenGL[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
		/* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
	};
	BYTE shortOpenGL[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x78, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
		/* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
		/* bOpenGL */        0x00, 0x00, 0x00
	};
	BYTE noMicrometers[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x80, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
		/* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
		/* bOpenGL */        0x00, 0x00, 0x00, 0x00
	};
	BYTE shortMicrometers[] = {
		/* EMR_HEADER */     0x01, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* Bounds */         0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x5D, 0x00, 0x00, 0x00,
		/* Frame */          0xD2, 0x00, 0x00, 0x00, 0xF0, 0x00, 0x00, 0x00, 0xB1, 0x03, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00,
		/* Signature */      0x20, 0x45, 0x4D, 0x46,
		/* Version */        0x00, 0x00, 0x01, 0x00,
		/* Bytes */          0x80, 0x00, 0x00, 0x00,
		/* Records */        0x02, 0x00, 0x00, 0x00,
		/* Handles */        0x01, 0x00,
		/* Reserved */       0x00, 0x00,
		/* nDescription */   0x00, 0x00, 0x00, 0x00,
		/* offDescription*/  0x00, 0x00, 0x00, 0x00,
		/* palEntries */     0x00, 0x00, 0x00, 0x00,
		/* Device */         0xA0, 0x05, 0x00, 0x00, 0x84, 0x03, 0x00, 0x00,
		/* Millimetres */    0xD8, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
		/* cbPixelFormat */  0x00, 0x00, 0x00, 0x00,
		/* offPixelFormat */ 0x00, 0x00, 0x00, 0x00,
		/* bOpenGL */        0x00, 0x00, 0x00, 0x00,
		/* Micrometers */    0xC0, 0x4B, 0x03, 0x00, 0xD8, 0x41, 0x04
	};
#endif

	// FIXME: GDI+ allows 4 bytes off the size of Millimetres.
#if defined(USE_WINDOWS_GDIPLUS)
	createFileSuccess (shortMillimetres, 14, 20, 50, 18, 750, 216);
#endif
#if defined(USE_WINDOWS_GDIPLUS)
	createFileSuccess (noRecords, 14, 20, 50, 18, 750, 216);
	createFileSuccess (noCbPixelFormat, 14, 20, 50, 18, 750, 216);
	createFileSuccess (shortCbPixelFormat, 14, 20, 50, 18, 750, 216);
	createFileSuccess (noOffPixelFormat, 14, 20, 50, 18, 750, 216);
	createFileSuccess (shortOffPixelFormat, 14, 20, 50, 18, 750, 216);
	createFileSuccess (noOpenGL, 14, 20, 50, 18, 750, 216);
	createFileSuccess (shortOpenGL, 14, 20, 50, 18, 750, 216);
	createFileSuccess (noMicrometers, 14, 20, 50, 18, 750, 216);
	createFileSuccess (shortMicrometers, 14, 20, 50, 18, 750, 216);
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant