/**
@file uemf_print.c
@brief Functions for printing EMF records
*/
/*
File: uemf_print.c
Version: 0.0.21
Date: 26-JAN-2016
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
Copyright: 2016 David Mathog and California Institute of Technology (Caltech)
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h> /* for offsetof() macro */
#include <string.h>
#include "uemf.h"
#include "upmf_print.h"
#include "uemf_safe.h"
//! \cond
#define UNUSED(x) (void)(x)
/* This bit of code is used all over the place, so reduce it to a DEFINITION */
#define IF_MEM_UNSAFE_PRINT_AND_RETURN(A,B,C) if(IS_MEM_UNSAFE(A,B,C)){printf(" record corruption HERE\n"); return; }
/* one needed prototype */
//! \endcond
/**
\brief calculate a CRC32 value for record
\returns CRC32 value calculated for record
\param record pointer to the first byte
\param Size number of bytes in the record
Code based on example crc32b here:
*/
uint32_t i, j;
crc = 0xFFFFFFFF;
for(i=0;i<Size;i++){ // over all bytes
for (j = 0; j < 8; j++) { // over all bits
}
}
return ~crc;
}
/**
\brief Print some number of hex bytes
\param buf pointer to the first byte
\param num number of bytes
*/
}
}
/* **********************************************************************************************
These functions print standard objects used in the EMR records.
The low level ones do not append EOL.
*********************************************************************************************** */
/**
\brief Print a U_COLORREF object.
\param color U_COLORREF object
*/
void colorref_print(
){
}
/**
\brief Print a U_RGBQUAD object.
\param color U_RGBQUAD object
*/
void rgbquad_print(
){
}
/**
\brief Print rect and rectl objects from Upper Left and Lower Right corner points.
\param rect U_RECTL object
*/
void rectl_print(
){
}
/**
\brief Print a U_SIZEL object.
\param sz U_SizeL object
*/
void sizel_print(
){
}
/**
\brief Print a U_POINTL object
\param pt U_POINTL object
*/
void pointl_print(
){
}
/**
\brief Print a pointer to a U_POINT16 object
\param pt pointer to a U_POINT16 object
Warning - WMF data may contain unaligned U_POINT16, do not call
this routine with a pointer to such data!
*/
void point16_print(
){
}
/**
\brief Print a U_LCS_GAMMA object
\param lg U_LCS_GAMMA object
*/
void lcs_gamma_print(
){
}
/**
\brief Print a U_LCS_GAMMARGB object
\param lgr U_LCS_GAMMARGB object
*/
void lcs_gammargb_print(
){
}
/**
\brief Print a U_TRIVERTEX object.
\param tv U_TRIVERTEX object.
*/
void trivertex_print(
){
}
/**
\brief Print a U_GRADIENT3 object.
\param g3 U_GRADIENT3 object.
*/
void gradient3_print(
){
}
/**
\brief Print a U_GRADIENT4 object.
\param g4 U_GRADIENT4 object.
*/
void gradient4_print(
){
}
/**
\brief Print a U_LOGBRUSH object.
\param lb U_LOGBRUSH object.
*/
void logbrush_print(
){
}
/**
\brief Print a U_XFORM object.
\param xform U_XFORM object
*/
void xform_print(
){
}
/**
\brief Print a U_CIEXYZ object
\param ciexyz U_CIEXYZ object
*/
void ciexyz_print(
){
}
/**
\brief Print a U_CIEXYZTRIPLE object
\param cie3 U_CIEXYZTRIPLE object
*/
void ciexyztriple_print(
){
printf("} ");
}
/**
\brief Print a U_LOGCOLORSPACEA object.
\param lcsa U_LOGCOLORSPACEA object
*/
void logcolorspacea_print(
){
}
/**
\brief Print a U_LOGCOLORSPACEW object.
\param lcsa U_LOGCOLORSPACEW object
*/
void logcolorspacew_print(
){
char *string;
}
/**
\brief Print a U_PANOSE object.
\param panose U_PANOSE object
*/
void panose_print(
){
}
/**
\brief Print a U_LOGFONT object.
\param lf U_LOGFONT object
*/
void logfont_print(
){
char *string;
}
/**
\brief Print a U_LOGFONT_PANOSE object.
\return U_LOGFONT_PANOSE object
*/
void logfont_panose_print(
){
char *string;
}
/**
\brief Print a pointer to U_BITMAPINFOHEADER object.
This may be called indirectly from WMF _print routines, where problems could occur
if the data was passed as the struct or a pointer to the struct, as the struct may not
be aligned in memory.
\returns Actual number of color table entries.
\param Bmih pointer to a U_BITMAPINFOHEADER object
*/
const char *Bmih
){
/* DIB from a WMF may not be properly aligned on a 4 byte boundary, will be aligned on a 2 byte boundary */
memcpy(&utmp4, Bmih + offsetof(U_BITMAPINFOHEADER,biCompression), 4); printf("biCompression:%u " ,utmp4 );
memcpy(&utmp4, Bmih + offsetof(U_BITMAPINFOHEADER,biSizeImage), 4); printf("biSizeImage:%u " ,utmp4 );
memcpy(&tmp4, Bmih + offsetof(U_BITMAPINFOHEADER,biXPelsPerMeter), 4); printf("biXPelsPerMeter:%d " ,tmp4 );
memcpy(&tmp4, Bmih + offsetof(U_BITMAPINFOHEADER,biYPelsPerMeter), 4); printf("biYPelsPerMeter:%d " ,tmp4 );
memcpy(&utmp4, Bmih + offsetof(U_BITMAPINFOHEADER,biClrImportant), 4); printf("biClrImportant:%u " ,utmp4 );
return(RealColors);
}
/**
\brief Print a Pointer to a U_BITMAPINFO object.
\param Bmi Pointer to a U_BITMAPINFO object
\param blimit Pointer to the first byte after after this record
This may be called from WMF _print routines, where problems could occur
if the data was passed as the struct or a pointer to the struct, as the struct may not
be aligned in memory.
*/
void bitmapinfo_print(
const char *Bmi,
const char *blimit
){
int i,k;
int ClrUsed;
printf("BmiHeader: ");
IF_MEM_UNSAFE_PRINT_AND_RETURN(Bmi, offsetof(U_BITMAPINFO,bmiHeader) + sizeof(U_BITMAPINFOHEADER), blimit);
if(ClrUsed){
IF_MEM_UNSAFE_PRINT_AND_RETURN(Bmi, offsetof(U_BITMAPINFO,bmiColors) + ClrUsed*sizeof(U_RGBQUAD), blimit);
}
}
}
/**
\brief Print a U_BLEND object.
\param blend a U_BLEND object
*/
void blend_print(
){
}
/**
\brief Print a pointer to a U_EXTLOGPEN object.
\param elp PU_EXTLOGPEN object
*/
void extlogpen_print(
){
unsigned int i;
if(elp->elpNumEntries){
printf("elpStyleEntry:");
for(i=0;i<elp->elpNumEntries;i++){
}
}
}
/**
\brief Print a U_LOGPEN object.
\param lp U_LOGPEN object
*/
void logpen_print(
){
}
/**
\brief Print a U_LOGPLTNTRY object.
\param lpny Ignore U_LOGPLTNTRY object.
*/
void logpltntry_print(
){
}
/**
\brief Print a pointer to a U_LOGPALETTE object.
\param lp Pointer to a U_LOGPALETTE object.
*/
void logpalette_print(
){
int i;
if(lp->palNumEntries){
for(i=0;i<lp->palNumEntries;i++){
}
}
}
/**
\brief Print a U_RGNDATAHEADER object.
\param rdh U_RGNDATAHEADER object
*/
void rgndataheader_print(
){
}
/**
\brief Print a pointer to a U_RGNDATA object.
\param rd pointer to a U_RGNDATA object.
\param limit pointer that sets upper limit for data examination
*/
void rgndata_print(
const char *blimit
){
unsigned int i;
}
}
}
/**
\brief Print a U_COLORADJUSTMENT object.
\param ca U_COLORADJUSTMENT object.
*/
void coloradjustment_print(
){
}
/**
\brief Print a U_PIXELFORMATDESCRIPTOR object.
\param pfd U_PIXELFORMATDESCRIPTOR object
*/
){
}
/**
\brief Print a Pointer to a U_EMRTEXT record
\param emt Pointer to a U_EMRTEXT record
\param record Pointer to the start of the record which contains this U_ERMTEXT
\param blimit Pointer to the first byte after after this record
\param type 0 for 8 bit character, anything else for 16
*/
void emrtext_print(
const char *emt,
const char *record,
const char *blimit,
int type
){
unsigned int i,off;
char *string;
// constant part
if(!type){
}
else {
}
}
}
printf("Dx:");
}
}
// hide these from Doxygen
//! @cond
/* **********************************************************************************************
These functions contain shared code used by various U_EMR*_print functions. These should NEVER be called
by end user code and to further that end prototypes are NOT provided and they are hidden from Doxygen.
These are (mostly) ordered by U_EMR_* index number.
The exceptions:
void core3_print(const char *name, const char *label, const char *contents)
void core7_print(const char *name, const char *field1, const char *field2, const char *contents)
void core8_print(const char *name, const char *contents, int type)
*********************************************************************************************** */
// Functions with the same form starting with U_EMRPOLYBEZIER_print
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Points: ");
}
printf("\n");
}
// Functions with the same form starting with U_EMRPOLYPOLYLINE_print
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Counts: ");
}
printf("\n");
printf(" Points: ");
}
printf("\n");
}
// Functions with the same form starting with U_EMRSETMAPMODE_print
/* access violation is impossible for these because there are no counts or offsets */
printf(" record corruption HERE\n");
return;
}
}
}
else {
}
}
// Functions taking a single U_RECT or U_RECTL, starting with U_EMRELLIPSE_print, also U_EMRFILLPATH_print,
printf(" record corruption HERE\n");
return;
}
}
// Functions with the same form starting with U_EMRPOLYBEZIER16_print
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Points: ");
}
printf("\n");
}
// Records with the same form starting with U_EMRSETWINDOWEXTEX_print
// CAREFUL, in the _set equivalents all functions with two uint32_t values are mapped here, and member names differ, consequently
// print routines must supply the names of the two arguments. These cannot be null. If the second one is
// empty the values are printed as a pair {x,y}, otherwise each is printed with its own label on a separate line.
printf(" record corruption HERE\n");
return;
}
if(*field2){
}
else {
}
}
// For U_EMREXTTEXTOUTA and U_EMREXTTEXTOUTW, type=0 for the first one
printf(" emrtext: ");
printf("\n");
}
// Functions that take a rect and a pair of points, starting with U_EMRARC_print
printf(" record corruption HERE\n");
return;
}
}
// Functions with the same form starting with U_EMRPOLYPOLYLINE16_print
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Counts: ");
}
printf("\n");
printf(" Points: ");
}
printf("\n");
}
// Functions with the same form starting with U_EMRINVERTRGN_print and U_EMRPAINTRGN_print,
printf(" record corruption HERE\n");
return;
}
printf(" RegionData:");
printf("\n");
}
// common code for U_EMRCREATEMONOBRUSH_print and U_EMRCREATEDIBPATTERNBRUSHPT_print,
printf(" record corruption HERE\n");
return;
}
printf(" bitmap:");
printf("\n");
}
}
// common code for U_EMRALPHABLEND_print and U_EMRTRANSPARENTBLT_print,
printf(" record corruption HERE\n");
return;
}
printf(" bitmap:");
printf("\n");
}
}
//! @endcond
/* **********************************************************************************************
These are the core EMR functions, each creates a particular type of record.
All return these records via a char* pointer, which is NULL if the call failed.
They are listed in order by the corresponding U_EMR_* index number.
*********************************************************************************************** */
/**
\brief Print a pointer to a U_EMR_whatever record which has not been implemented.
\param name name of this type of record
\param contents pointer to a buffer holding all EMR records
*/
printf(" Not Implemented!\n");
}
// U_EMRHEADER 1
/**
\brief Print a pointer to a U_EMR_HEADER record.
\param contents pointer to a buffer holding all EMR records
*/
char *string;
int p1len;
printf(" record corruption HERE\n");
return;
}
if(pEmr->offDescription){
IF_MEM_UNSAFE_PRINT_AND_RETURN(contents, pEmr->offDescription + pEmr->nDescription*2*sizeof(char), blimit);
string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription), pEmr->nDescription, NULL);
string = U_Utf16leToUtf8((uint16_t *)((char *) pEmr + pEmr->offDescription + p1len), pEmr->nDescription, NULL);
}
){
if(pEmr->cbPixelFormat){
printf(" PFD:");
IF_MEM_UNSAFE_PRINT_AND_RETURN(contents, pEmr->offPixelFormat + sizeof(U_PIXELFORMATDESCRIPTOR), blimit);
printf("\n");
}
){
}
}
}
// U_EMRPOLYBEZIER 2
/**
\brief Print a pointer to a U_EMR_POLYBEZIER record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYGON 3
/**
\brief Print a pointer to a U_EMR_POLYGON record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYLINE 4
/**
\brief Print a pointer to a U_EMR_POLYLINE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYBEZIERTO 5
/**
\brief Print a pointer to a U_EMR_POLYBEZIERTO record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYLINETO 6
/**
\brief Print a pointer to a U_EMR_POLYLINETO record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYPOLYLINE 7
/**
\brief Print a pointer to a U_EMR_POLYPOLYLINE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYPOLYGON 8
/**
\brief Print a pointer to a U_EMR_POLYPOLYGON record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETWINDOWEXTEX 9
/**
\brief Print a pointer to a U_EMR_SETWINDOWEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETWINDOWORGEX 10
/**
\brief Print a pointer to a U_EMR_SETWINDOWORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETVIEWPORTEXTEX 11
/**
\brief Print a pointer to a U_EMR_SETVIEWPORTEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETVIEWPORTORGEX 12
/**
\brief Print a pointer to a U_EMR_SETVIEWPORTORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETBRUSHORGEX 13
/**
\brief Print a pointer to a U_EMR_SETBRUSHORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREOF 14
/**
\brief Print a pointer to a U_EMR_EOF record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
if(pEmr->cbPalEntries){
printf(" PE:");
printf("\n");
}
}
// U_EMRSETPIXELV 15
/**
\brief Print a pointer to a U_EMR_SETPIXELV record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRSETMAPPERFLAGS 16
/**
\brief Print a pointer to a U_EMR_SETMAPPERFLAGS record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRSETMAPMODE 17
/**
\brief Print a pointer to a U_EMR_SETMAPMODE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETBKMODE 18
/**
\brief Print a pointer to a U_EMR_SETBKMODE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETPOLYFILLMODE 19
/**
\brief Print a pointer to a U_EMR_SETPOLYFILLMODE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETROP2 20
/**
\brief Print a pointer to a U_EMR_SETROP2 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETSTRETCHBLTMODE 21
/**
\brief Print a pointer to a U_EMR_SETSTRETCHBLTMODE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETTEXTALIGN 22
/**
\brief Print a pointer to a U_EMR_SETTEXTALIGN record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETCOLORADJUSTMENT 23
/**
\brief Print a pointer to a U_EMR_SETCOLORADJUSTMENT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" ColorAdjustment:");
printf("\n");
}
// U_EMRSETTEXTCOLOR 24
/**
\brief Print a pointer to a U_EMR_SETTEXTCOLOR record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETBKCOLOR 25
/**
\brief Print a pointer to a U_EMR_SETBKCOLOR record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMROFFSETCLIPRGN 26
/**
\brief Print a pointer to a U_EMR_OFFSETCLIPRGN record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRMOVETOEX 27
/**
\brief Print a pointer to a U_EMR_MOVETOEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETMETARGN 28
/**
\brief Print a pointer to a U_EMR_SETMETARGN record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREXCLUDECLIPRECT 29
/**
\brief Print a pointer to a U_EMR_EXCLUDECLIPRECT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRINTERSECTCLIPRECT 30
/**
\brief Print a pointer to a U_EMR_INTERSECTCLIPRECT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSCALEVIEWPORTEXTEX 31
/**
\brief Print a pointer to a U_EMR_SCALEVIEWPORTEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSCALEWINDOWEXTEX 32
/**
\brief Print a pointer to a U_EMR_SCALEWINDOWEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSAVEDC 33
/**
\brief Print a pointer to a U_EMR_SAVEDC record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRRESTOREDC 34
/**
\brief Print a pointer to a U_EMR_RESTOREDC record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETWORLDTRANSFORM 35
/**
\brief Print a pointer to a U_EMR_SETWORLDTRANSFORM record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" xform:");
printf("\n");
}
// U_EMRMODIFYWORLDTRANSFORM 36
/**
\brief Print a pointer to a U_EMR_MODIFYWORLDTRANSFORM record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" xform:");
printf("\n");
}
// U_EMRSELECTOBJECT 37
/**
\brief Print a pointer to a U_EMR_SELECTOBJECT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
else {
}
}
// U_EMRCREATEPEN 38
/**
\brief Print a pointer to a U_EMR_CREATEPEN record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRCREATEBRUSHINDIRECT 39
/**
\brief Print a pointer to a U_EMR_CREATEBRUSHINDIRECT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRDELETEOBJECT 40
/**
\brief Print a pointer to a U_EMR_DELETEOBJECT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRANGLEARC 41
/**
\brief Print a pointer to a U_EMR_ANGLEARC record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRELLIPSE 42
/**
\brief Print a pointer to a U_EMR_ELLIPSE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRRECTANGLE 43
/**
\brief Print a pointer to a U_EMR_RECTANGLE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRROUNDRECT 44
/**
\brief Print a pointer to a U_EMR_ROUNDRECT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRARC 45
/**
\brief Print a pointer to a U_EMR_ARC record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRCHORD 46
/**
\brief Print a pointer to a U_EMR_CHORD record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPIE 47
/**
\brief Print a pointer to a U_EMR_PIE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSELECTPALETTE 48
/**
\brief Print a pointer to a U_EMR_SELECTPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRCREATEPALETTE 49
/**
\brief Print a pointer to a U_EMR_CREATEPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRSETPALETTEENTRIES 50
/**
\brief Print a pointer to a U_EMR_SETPALETTEENTRIES record.
\param contents pointer to a buffer holding all EMR records
*/
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" PLTEntries:");
}
printf("\n");
}
}
// U_EMRRESIZEPALETTE 51
/**
\brief Print a pointer to a U_EMR_RESIZEPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRREALIZEPALETTE 52
/**
\brief Print a pointer to a U_EMR_REALIZEPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREXTFLOODFILL 53
/**
\brief Print a pointer to a U_EMR_EXTFLOODFILL record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRLINETO 54
/**
\brief Print a pointer to a U_EMR_LINETO record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRARCTO 55
/**
\brief Print a pointer to a U_EMR_ARCTO record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYDRAW 56
/**
\brief Print a pointer to a U_EMR_POLYDRAW record.
\param contents pointer to a buffer holding all EMR records
*/
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Points: ");
printf(" [%d]:",i);
}
printf("\n");
printf(" Types: ");
}
printf("\n");
}
// U_EMRSETARCDIRECTION 57
/**
\brief Print a pointer to a U_EMR_SETARCDIRECTION record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETMITERLIMIT 58
/**
\brief Print a pointer to a U_EMR_SETMITERLIMIT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRBEGINPATH 59
/**
\brief Print a pointer to a U_EMR_BEGINPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRENDPATH 60
/**
\brief Print a pointer to a U_EMR_ENDPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRCLOSEFIGURE 61
/**
\brief Print a pointer to a U_EMR_CLOSEFIGURE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRFILLPATH 62
/**
\brief Print a pointer to a U_EMR_FILLPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSTROKEANDFILLPATH 63
/**
\brief Print a pointer to a U_EMR_STROKEANDFILLPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSTROKEPATH 64
/**
\brief Print a pointer to a U_EMR_STROKEPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRFLATTENPATH 65
/**
\brief Print a pointer to a U_EMR_FLATTENPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRWIDENPATH 66
/**
\brief Print a pointer to a U_EMR_WIDENPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSELECTCLIPPATH 67
/**
\brief Print a pointer to a U_EMR_SELECTCLIPPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRABORTPATH 68
/**
\brief Print a pointer to a U_EMR_ABORTPATH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRUNDEF69 69
// U_EMRCOMMENT 70 Comment (any binary data, interpretation is program specific)
/**
\brief Print a pointer to a U_EMR_COMMENT record.
\param contents pointer to a location in memory holding the comment record
\param off offset in bytes to the first byte in this record (needed for EMF+ record printing)
EMF+ records, if any, are stored in EMF comment records.
*/
char *string;
char *src;
int recsize;
static int recnum=0;
printf(" record corruption HERE\n");
return;
}
/* There are several different types of comments */
if(cbData >= 4){
/* Since the comment is just a big bag of bytes the emf endian code cannot safely touch
any of its payload. This is the only record type with that limitation. So the record
may appear at this stage with the wrong endianness. Try to determine
what the contents are even if more byte swapping is required. */
if( cIdent == U_EMR_COMMENT_PUBLIC ){
printf(" cIdent: Public\n");
cbData -= 8;
}
else if(cIdent == U_EMR_COMMENT_SPOOL ){
printf(" cIdent: Spool\n");
cbData -= 8;
}
else if(cIdent == U_EMR_COMMENT_EMFPLUSRECORD){
printf(" cIdent: EMF+\n");
while(loff < cbData + 12){ // EMF+ records may not fill the entire comment, cbData value includes cIdent, but not U_EMR or cbData
if(recsize==0){ break; }
else if(recsize<0){
printf(" record corruption HERE\n");
return;
}
recnum++;
}
return;
}
else {
printf(" cIdent: not (Public or Spool or EMF+)\n");
}
}
if(cbData){ // The data may not be printable, but try it just in case
}
}
// U_EMRFILLRGN 71
/**
\brief Print a pointer to a U_EMR_FILLRGN record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
const char *minptr = MAKE_MIN_PTR(((const char *) &pEmr->RgnData + pEmr->cbRgnData + sizeof(U_RGNDATAHEADER)),blimit);
}
// U_EMRFRAMERGN 72
/**
\brief Print a pointer to a U_EMR_FRAMERGN record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRINVERTRGN 73
/**
\brief Print a pointer to a U_EMR_INVERTRGN record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPAINTRGN 74
/**
\brief Print a pointer to a U_EMR_PAINTRGN record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREXTSELECTCLIPRGN 75
/**
\brief Print a pointer to a U_EMR_EXTSELECTCLIPRGN record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" RegionData: none (Clip region becomes NULL)\n");
}
else {
}
}
// U_EMRBITBLT 76
/**
\brief Print a pointer to a U_EMR_BITBLT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" bitmap: ");
printf("\n");
}
}
// U_EMRSTRETCHBLT 77
/**
\brief Print a pointer to a U_EMR_STRETCHBLT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" bitmap: ");
printf("\n");
}
}
// U_EMRMASKBLT 78
/**
\brief Print a pointer to a U_EMR_MASKBLT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" Src bitmap: ");
printf("\n");
}
printf(" Mask bitmap: ");
printf("\n");
}
}
// U_EMRPLGBLT 79
/**
\brief Print a pointer to a U_EMR_PLGBLT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" Src bitmap: ");
printf("\n");
}
printf(" Mask bitmap: ");
printf("\n");
}
}
// U_EMRSETDIBITSTODEVICE 80
/**
\brief Print a pointer to a U_EMRSETDIBITSTODEVICE record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" Src bitmap: ");
printf("\n");
}
}
// U_EMRSTRETCHDIBITS 81
/**
\brief Print a pointer to a U_EMR_STRETCHDIBITS record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" Src bitmap: ");
printf("\n");
}
}
// U_EMREXTCREATEFONTINDIRECTW_print 82
/**
\brief Print a pointer to a U_EMR_EXTCREATEFONTINDIRECTW record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" Font: ");
}
else { // holds logfont or logfontExDv. The latter isn't supported but it starts with logfont, so use that
}
printf("\n");
}
// U_EMREXTTEXTOUTA 83
/**
\brief Print a pointer to a U_EMR_EXTTEXTOUTA record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREXTTEXTOUTW 84
/**
\brief Print a pointer to a U_EMR_EXTTEXTOUTW record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYBEZIER16 85
/**
\brief Print a pointer to a U_EMR_POLYBEZIER16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYGON16 86
/**
\brief Print a pointer to a U_EMR_POLYGON16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYLINE16 87
/**
\brief Print a pointer to a U_EMR_POLYLINE16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYBEZIERTO16 88
/**
\brief Print a pointer to a U_EMR_POLYBEZIERTO16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYLINETO16 89
/**
\brief Print a pointer to a U_EMR_POLYLINETO16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYPOLYLINE16 90
/**
\brief Print a pointer to a U_EMR_POLYPOLYLINE16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYPOLYGON16 91
/**
\brief Print a pointer to a U_EMR_POLYPOLYGON16 record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRPOLYDRAW16 92
/**
\brief Print a pointer to a U_EMR_POLYDRAW16 record.
\param contents pointer to a buffer holding all EMR records
*/
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Points: ");
printf(" [%d]:",i);
}
printf("\n");
printf(" Types: ");
}
printf("\n");
}
// U_EMRCREATEMONOBRUSH 93
/**
\brief Print a pointer to a U_EMR_CREATEMONOBRUSH record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRCREATEDIBPATTERNBRUSHPT_print 94
/**
\brief Print a pointer to a U_EMR_CREATEDIBPATTERNBRUSHPT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMREXTCREATEPEN 95
/**
\brief Print a pointer to a U_EMR_EXTCREATEPEN record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
printf(" bitmap: ");
printf("\n");
}
}
// U_EMRPOLYTEXTOUTA 96 NOT IMPLEMENTED, denigrated after Windows NT
#define U_EMRPOLYTEXTOUTA_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRPOLYTEXTOUTA",A) //!< Not implemented.
// U_EMRPOLYTEXTOUTW 97 NOT IMPLEMENTED, denigrated after Windows NT
#define U_EMRPOLYTEXTOUTW_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRPOLYTEXTOUTW",A) //!< Not implemented.
// U_EMRSETICMMODE 98
/**
\brief Print a pointer to a U_EMR_SETICMMODE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRCREATECOLORSPACE 99
/**
\brief Print a pointer to a U_EMR_CREATECOLORSPACE record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRSETCOLORSPACE 100
/**
\brief Print a pointer to a U_EMR_SETCOLORSPACE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRDELETECOLORSPACE 101
/**
\brief Print a pointer to a U_EMR_DELETECOLORSPACE record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRGLSRECORD 102 Not implemented
// U_EMRGLSBOUNDEDRECORD 103 Not implemented
#define U_EMRGLSBOUNDEDRECORD_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRGLSBOUNDEDRECORD",A) //!< Not implemented.
// U_EMRPIXELFORMAT 104
/**
\brief Print a pointer to a U_EMR_PIXELFORMAT record.
\param contents pointer to a buffer holding all EMR records
*/
printf(" record corruption HERE\n");
return;
}
}
// U_EMRDRAWESCAPE 105 Not implemented
#define U_EMRDRAWESCAPE_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRDRAWESCAPE",A) //!< Not implemented.
// U_EMREXTESCAPE 106 Not implemented
// U_EMRUNDEF107 107 Not implemented
// U_EMRSMALLTEXTOUT 108
/**
\brief Print a pointer to a U_EMR_SMALLTEXTOUT record.
\param contents pointer to a buffer holding all EMR records
*/
int roff;
char *string;
printf(" record corruption HERE\n");
return;
}
}
}
else {
}
}
// U_EMRFORCEUFIMAPPING 109 Not implemented
#define U_EMRFORCEUFIMAPPING_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRFORCEUFIMAPPING",A) //!< Not implemented.
// U_EMRNAMEDESCAPE 110 Not implemented
#define U_EMRNAMEDESCAPE_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRNAMEDESCAPE",A) //!< Not implemented.
// U_EMRCOLORCORRECTPALETTE 111 Not implemented
#define U_EMRCOLORCORRECTPALETTE_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRCOLORCORRECTPALETTE",A) //!< Not implemented.
// U_EMRSETICMPROFILEA 112 Not implemented
#define U_EMRSETICMPROFILEA_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRSETICMPROFILEA",A) //!< Not implemented.
// U_EMRSETICMPROFILEW 113 Not implemented
#define U_EMRSETICMPROFILEW_print(A) U_EMRNOTIMPLEMENTED_print("U_EMRSETICMPROFILEW",A) //!< Not implemented.
// U_EMRALPHABLEND 114
/**
\brief Print a pointer to a U_EMR_ALPHABLEND record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRSETLAYOUT 115
/**
\brief Print a pointer to a U_EMR_SETLAYOUT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRTRANSPARENTBLT 116
/**
\brief Print a pointer to a U_EMR_TRANSPARENTBLT record.
\param contents pointer to a buffer holding all EMR records
*/
}
// U_EMRUNDEF117 117 Not implemented
// U_EMRGRADIENTFILL 118
/**
\brief Print a pointer to a U_EMR_GRADIENTFILL record.
\param contents pointer to a buffer holding all EMR records
*/
unsigned int i;
printf(" record corruption HERE\n");
return;
}
contents += sizeof(U_EMRGRADIENTFILL);
printf(" TriVert: ");
}
printf("\n");
}
printf(" GradObj: ");
}
}
}
}
else { printf("invalid ulMode value!"); }
printf("\n");
}
}
// U_EMRSETLINKEDUFIS 119 Not implemented
#define U_EMRSETLINKEDUFIS_print(A) U_EMRNOTIMPLEMENTED_print("U_EMR_SETLINKEDUFIS",A) //!< Not implemented.
// U_EMRSETTEXTJUSTIFICATION120 Not implemented (denigrated)
#define U_EMRSETTEXTJUSTIFICATION_print(A) U_EMRNOTIMPLEMENTED_print("U_EMR_SETTEXTJUSTIFICATION",A) //!< Not implemented.
// U_EMRCOLORMATCHTOTARGETW 121 Not implemented
#define U_EMRCOLORMATCHTOTARGETW_print(A) U_EMRNOTIMPLEMENTED_print("U_EMR_COLORMATCHTOTARGETW",A) //!< Not implemented.
// U_EMRCREATECOLORSPACEW 122
/**
\brief Print a pointer to a U_EMR_CREATECOLORSPACEW record.
\param contents pointer to a buffer holding all EMR records
*/
unsigned int i;
printf(" record corruption HERE\n");
return;
}
printf(" Data(hexvalues):");
}
}
printf("\n");
}
/**
\brief Print any record in an emf
\returns record length for a normal record, 0 for EMREOF, -1 for a bad record
\param contents pointer to a buffer holding all EMR records
\param blimit pointer to the byte after the last byte in the buffer holding all EMR records
\param recnum number of this record in contents
\param off offset to this record in contents
*/
/* Check that COMMON data in record can be touched without an access violation. If it cannot be
this is either a corrupt EMF or one engineered to cause a buffer overflow. Pointer math
could wrap so check both sides of the range.
*/
#if U_BYTE_SWAP
//This is a Big Endian machine, EMF crc values must be calculated on Little Endian form
if(!swapbuf)return(-1);
#else
#endif
printf("%-30srecord:%5d type:%-4d offset:%8d rsize:%8d crc32:%8.8X\n",
/* print the record header before checking further.
Note if this is a corrupt record, but continue anyway.
The _print routines will stop at the actual problem and print another corrupt message.
*/
if(!U_emf_record_safe(record)){printf("WARNING: Corrupt record. Emitting fields above the problem.\n");}
{
} //end of switch
return(nSize);
}
#ifdef __cplusplus
}
#endif