uemf_print.c revision 06517eb74772b7c18a8ab8d703405646d9ec05d3
/**
@file uemf_print.c
@brief Functions for printing EMF records
*/
/*
File: uemf_print.c
Version: 0.0.18
Date: 25-MAR-2015
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
Copyright: 2015 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 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
*/
void U_EMRHEADER_print(const char *contents){
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
*/
void U_EMRPOLYBEZIER_print(const char *contents){
}
// U_EMRPOLYGON 3
/**
\brief Print a pointer to a U_EMR_POLYGON record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYGON_print(const char *contents){
}
// U_EMRPOLYLINE 4
/**
\brief Print a pointer to a U_EMR_POLYLINE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYLINE_print(const char *contents){
}
// U_EMRPOLYBEZIERTO 5
/**
\brief Print a pointer to a U_EMR_POLYBEZIERTO record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYBEZIERTO_print(const char *contents){
}
// U_EMRPOLYLINETO 6
/**
\brief Print a pointer to a U_EMR_POLYLINETO record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYLINETO_print(const char *contents){
}
// U_EMRPOLYPOLYLINE 7
/**
\brief Print a pointer to a U_EMR_POLYPOLYLINE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYPOLYLINE_print(const char *contents){
}
// U_EMRPOLYPOLYGON 8
/**
\brief Print a pointer to a U_EMR_POLYPOLYGON record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYPOLYGON_print(const char *contents){
}
// U_EMRSETWINDOWEXTEX 9
/**
\brief Print a pointer to a U_EMR_SETWINDOWEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETWINDOWEXTEX_print(const char *contents){
}
// U_EMRSETWINDOWORGEX 10
/**
\brief Print a pointer to a U_EMR_SETWINDOWORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETWINDOWORGEX_print(const char *contents){
}
// U_EMRSETVIEWPORTEXTEX 11
/**
\brief Print a pointer to a U_EMR_SETVIEWPORTEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETVIEWPORTEXTEX_print(const char *contents){
}
// U_EMRSETVIEWPORTORGEX 12
/**
\brief Print a pointer to a U_EMR_SETVIEWPORTORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETVIEWPORTORGEX_print(const char *contents){
}
// U_EMRSETBRUSHORGEX 13
/**
\brief Print a pointer to a U_EMR_SETBRUSHORGEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETBRUSHORGEX_print(const char *contents){
}
// U_EMREOF 14
/**
\brief Print a pointer to a U_EMR_EOF record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREOF_print(const char *contents){
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
*/
void U_EMRSETPIXELV_print(const char *contents){
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
*/
void U_EMRSETMAPPERFLAGS_print(const char *contents){
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
*/
void U_EMRSETMAPMODE_print(const char *contents){
}
// U_EMRSETBKMODE 18
/**
\brief Print a pointer to a U_EMR_SETBKMODE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETBKMODE_print(const char *contents){
}
// U_EMRSETPOLYFILLMODE 19
/**
\brief Print a pointer to a U_EMR_SETPOLYFILLMODE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETPOLYFILLMODE_print(const char *contents){
}
// U_EMRSETROP2 20
/**
\brief Print a pointer to a U_EMR_SETROP2 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETROP2_print(const char *contents){
}
// U_EMRSETSTRETCHBLTMODE 21
/**
\brief Print a pointer to a U_EMR_SETSTRETCHBLTMODE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETSTRETCHBLTMODE_print(const char *contents){
}
// U_EMRSETTEXTALIGN 22
/**
\brief Print a pointer to a U_EMR_SETTEXTALIGN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETTEXTALIGN_print(const char *contents){
}
// U_EMRSETCOLORADJUSTMENT 23
/**
\brief Print a pointer to a U_EMR_SETCOLORADJUSTMENT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETCOLORADJUSTMENT_print(const char *contents){
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
*/
void U_EMRSETTEXTCOLOR_print(const char *contents){
}
// U_EMRSETBKCOLOR 25
/**
\brief Print a pointer to a U_EMR_SETBKCOLOR record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETBKCOLOR_print(const char *contents){
}
// U_EMROFFSETCLIPRGN 26
/**
\brief Print a pointer to a U_EMR_OFFSETCLIPRGN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMROFFSETCLIPRGN_print(const char *contents){
}
// U_EMRMOVETOEX 27
/**
\brief Print a pointer to a U_EMR_MOVETOEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRMOVETOEX_print(const char *contents){
}
// U_EMRSETMETARGN 28
/**
\brief Print a pointer to a U_EMR_SETMETARGN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETMETARGN_print(const char *contents){
}
// U_EMREXCLUDECLIPRECT 29
/**
\brief Print a pointer to a U_EMR_EXCLUDECLIPRECT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREXCLUDECLIPRECT_print(const char *contents){
}
// U_EMRINTERSECTCLIPRECT 30
/**
\brief Print a pointer to a U_EMR_INTERSECTCLIPRECT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRINTERSECTCLIPRECT_print(const char *contents){
}
// U_EMRSCALEVIEWPORTEXTEX 31
/**
\brief Print a pointer to a U_EMR_SCALEVIEWPORTEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSCALEVIEWPORTEXTEX_print(const char *contents){
}
// U_EMRSCALEWINDOWEXTEX 32
/**
\brief Print a pointer to a U_EMR_SCALEWINDOWEXTEX record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSCALEWINDOWEXTEX_print(const char *contents){
}
// U_EMRSAVEDC 33
/**
\brief Print a pointer to a U_EMR_SAVEDC record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSAVEDC_print(const char *contents){
}
// U_EMRRESTOREDC 34
/**
\brief Print a pointer to a U_EMR_RESTOREDC record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRRESTOREDC_print(const char *contents){
}
// U_EMRSETWORLDTRANSFORM 35
/**
\brief Print a pointer to a U_EMR_SETWORLDTRANSFORM record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETWORLDTRANSFORM_print(const char *contents){
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
*/
void U_EMRMODIFYWORLDTRANSFORM_print(const char *contents){
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
*/
void U_EMRSELECTOBJECT_print(const char *contents){
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
*/
void U_EMRCREATEPEN_print(const char *contents){
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
*/
void U_EMRCREATEBRUSHINDIRECT_print(const char *contents){
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
*/
void U_EMRDELETEOBJECT_print(const char *contents){
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
*/
void U_EMRANGLEARC_print(const char *contents){
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
*/
void U_EMRELLIPSE_print(const char *contents){
}
// U_EMRRECTANGLE 43
/**
\brief Print a pointer to a U_EMR_RECTANGLE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRRECTANGLE_print(const char *contents){
}
// U_EMRROUNDRECT 44
/**
\brief Print a pointer to a U_EMR_ROUNDRECT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRROUNDRECT_print(const char *contents){
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
*/
void U_EMRARC_print(const char *contents){
}
// U_EMRCHORD 46
/**
\brief Print a pointer to a U_EMR_CHORD record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRCHORD_print(const char *contents){
}
// U_EMRPIE 47
/**
\brief Print a pointer to a U_EMR_PIE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPIE_print(const char *contents){
}
// U_EMRSELECTPALETTE 48
/**
\brief Print a pointer to a U_EMR_SELECTPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSELECTPALETTE_print(const char *contents){
}
// U_EMRCREATEPALETTE 49
/**
\brief Print a pointer to a U_EMR_CREATEPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRCREATEPALETTE_print(const char *contents){
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
*/
void U_EMRSETPALETTEENTRIES_print(const char *contents){
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
*/
void U_EMRRESIZEPALETTE_print(const char *contents){
}
// U_EMRREALIZEPALETTE 52
/**
\brief Print a pointer to a U_EMR_REALIZEPALETTE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRREALIZEPALETTE_print(const char *contents){
}
// U_EMREXTFLOODFILL 53
/**
\brief Print a pointer to a U_EMR_EXTFLOODFILL record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREXTFLOODFILL_print(const char *contents){
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
*/
void U_EMRLINETO_print(const char *contents){
}
// U_EMRARCTO 55
/**
\brief Print a pointer to a U_EMR_ARCTO record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRARCTO_print(const char *contents){
}
// U_EMRPOLYDRAW 56
/**
\brief Print a pointer to a U_EMR_POLYDRAW record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYDRAW_print(const char *contents){
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
*/
void U_EMRSETARCDIRECTION_print(const char *contents){
}
// U_EMRSETMITERLIMIT 58
/**
\brief Print a pointer to a U_EMR_SETMITERLIMIT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETMITERLIMIT_print(const char *contents){
}
// U_EMRBEGINPATH 59
/**
\brief Print a pointer to a U_EMR_BEGINPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRBEGINPATH_print(const char *contents){
}
// U_EMRENDPATH 60
/**
\brief Print a pointer to a U_EMR_ENDPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRENDPATH_print(const char *contents){
}
// U_EMRCLOSEFIGURE 61
/**
\brief Print a pointer to a U_EMR_CLOSEFIGURE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRCLOSEFIGURE_print(const char *contents){
}
// U_EMRFILLPATH 62
/**
\brief Print a pointer to a U_EMR_FILLPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRFILLPATH_print(const char *contents){
}
// U_EMRSTROKEANDFILLPATH 63
/**
\brief Print a pointer to a U_EMR_STROKEANDFILLPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSTROKEANDFILLPATH_print(const char *contents){
}
// U_EMRSTROKEPATH 64
/**
\brief Print a pointer to a U_EMR_STROKEPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSTROKEPATH_print(const char *contents){
}
// U_EMRFLATTENPATH 65
/**
\brief Print a pointer to a U_EMR_FLATTENPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRFLATTENPATH_print(const char *contents){
}
// U_EMRWIDENPATH 66
/**
\brief Print a pointer to a U_EMR_WIDENPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRWIDENPATH_print(const char *contents){
}
// U_EMRSELECTCLIPPATH 67
/**
\brief Print a pointer to a U_EMR_SELECTCLIPPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSELECTCLIPPATH_print(const char *contents){
}
// U_EMRABORTPATH 68
/**
\brief Print a pointer to a U_EMR_ABORTPATH record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRABORTPATH_print(const char *contents){
}
// 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
*/
void U_EMRFILLRGN_print(const char *contents){
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
*/
void U_EMRFRAMERGN_print(const char *contents){
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
*/
void U_EMRINVERTRGN_print(const char *contents){
}
// U_EMRPAINTRGN 74
/**
\brief Print a pointer to a U_EMR_PAINTRGN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPAINTRGN_print(const char *contents){
}
// U_EMREXTSELECTCLIPRGN 75
/**
\brief Print a pointer to a U_EMR_EXTSELECTCLIPRGN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREXTSELECTCLIPRGN_print(const char *contents){
printf(" record corruption HERE\n");
return;
}
}
// U_EMRBITBLT 76
/**
\brief Print a pointer to a U_EMR_BITBLT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRBITBLT_print(const char *contents){
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
*/
void U_EMRSTRETCHBLT_print(const char *contents){
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
*/
void U_EMRMASKBLT_print(const char *contents){
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
*/
void U_EMRPLGBLT_print(const char *contents){
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
*/
void U_EMRSETDIBITSTODEVICE_print(const char *contents){
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
*/
void U_EMRSTRETCHDIBITS_print(const char *contents){
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
*/
void U_EMREXTCREATEFONTINDIRECTW_print(const char *contents){
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
*/
void U_EMREXTTEXTOUTA_print(const char *contents){
}
// U_EMREXTTEXTOUTW 84
/**
\brief Print a pointer to a U_EMR_EXTTEXTOUTW record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREXTTEXTOUTW_print(const char *contents){
}
// U_EMRPOLYBEZIER16 85
/**
\brief Print a pointer to a U_EMR_POLYBEZIER16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYBEZIER16_print(const char *contents){
}
// U_EMRPOLYGON16 86
/**
\brief Print a pointer to a U_EMR_POLYGON16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYGON16_print(const char *contents){
}
// U_EMRPOLYLINE16 87
/**
\brief Print a pointer to a U_EMR_POLYLINE16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYLINE16_print(const char *contents){
}
// U_EMRPOLYBEZIERTO16 88
/**
\brief Print a pointer to a U_EMR_POLYBEZIERTO16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYBEZIERTO16_print(const char *contents){
}
// U_EMRPOLYLINETO16 89
/**
\brief Print a pointer to a U_EMR_POLYLINETO16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYLINETO16_print(const char *contents){
}
// U_EMRPOLYPOLYLINE16 90
/**
\brief Print a pointer to a U_EMR_POLYPOLYLINE16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYPOLYLINE16_print(const char *contents){
}
// U_EMRPOLYPOLYGON16 91
/**
\brief Print a pointer to a U_EMR_POLYPOLYGON16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYPOLYGON16_print(const char *contents){
}
// U_EMRPOLYDRAW16 92
/**
\brief Print a pointer to a U_EMR_POLYDRAW16 record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRPOLYDRAW16_print(const char *contents){
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
*/
void U_EMRCREATEMONOBRUSH_print(const char *contents){
}
// U_EMRCREATEDIBPATTERNBRUSHPT_print 94
/**
\brief Print a pointer to a U_EMR_CREATEDIBPATTERNBRUSHPT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRCREATEDIBPATTERNBRUSHPT_print(const char *contents){
}
// U_EMREXTCREATEPEN 95
/**
\brief Print a pointer to a U_EMR_EXTCREATEPEN record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMREXTCREATEPEN_print(const char *contents){
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
*/
void U_EMRSETICMMODE_print(const char *contents){
}
// U_EMRCREATECOLORSPACE 99
/**
\brief Print a pointer to a U_EMR_CREATECOLORSPACE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRCREATECOLORSPACE_print(const char *contents){
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
*/
void U_EMRSETCOLORSPACE_print(const char *contents){
}
// U_EMRDELETECOLORSPACE 101
/**
\brief Print a pointer to a U_EMR_DELETECOLORSPACE record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRDELETECOLORSPACE_print(const char *contents){
}
// 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
*/
void U_EMRPIXELFORMAT_print(const char *contents){
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
*/
void U_EMRSMALLTEXTOUT_print(const char *contents){
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
*/
void U_EMRALPHABLEND_print(const char *contents){
}
// U_EMRSETLAYOUT 115
/**
\brief Print a pointer to a U_EMR_SETLAYOUT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRSETLAYOUT_print(const char *contents){
}
// U_EMRTRANSPARENTBLT 116
/**
\brief Print a pointer to a U_EMR_TRANSPARENTBLT record.
\param contents pointer to a buffer holding all EMR records
*/
void U_EMRTRANSPARENTBLT_print(const char *contents){
}
// 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
*/
void U_EMRGRADIENTFILL_print(const char *contents){
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
*/
void U_EMRCREATECOLORSPACEW_print(const char *contents){
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.
*/
printf("%-30srecord:%5d type:%-4d offset:%8d rsize:%8d\n",U_emr_names(iType),recnum,iType,(int) off,nSize);
/* 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