From dffac44daac73297821b41a115a943a0a7a713d9 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 22 Jan 2004 15:10:39 +0000 Subject: [PATCH] Patch level : 2.0 672 Files correlati : xvagadll.dll Ricompilazione Demo : [ ] Commento : Correzione stampa registri errata su "HP OfficeJet G Series Printer" git-svn-id: svn://10.65.10.50/trunk@11718 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/oswin32.cpp | 16 +++++++++------- xvaga/xvtextra.cpp | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index 799ea6bea..de9c3e85d 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -157,7 +157,8 @@ void* OsWin32_GetPrinterInfo(int& size, const char* printer) size = ::DocumentProperties(0, hPrinter, name, NULL, NULL, 0); // Determina dimensione DEVMODE if (size > 0) { - pdm = (LPDEVMODE) new char[size]; // Alloca un DEVMODE sufficientemente capiente + pdm = (LPDEVMODE)new char[size]; // Alloca un DEVMODE sufficientemente capiente + memset(pdm, 0, size); ::DocumentProperties(0, hPrinter, name, pdm, NULL, DM_OUT_BUFFER); // Legge DEVMODE } else @@ -197,8 +198,9 @@ bool OsWin32_DrawBitmap(const wxBitmap& bmp, wxDC& dc, const wxRect& dst, const const int nTechno = ::GetDeviceCaps(hDC, TECHNOLOGY); if (nTechno == DT_RASPRINTER) // Sto stampando! { - BITMAPINFO* bi = (BITMAPINFO *) malloc( sizeof( BITMAPINFOHEADER ) + 256 * sizeof(RGBQUAD ) ); - memset(bi, 0, sizeof( BITMAPINFOHEADER ) ); + const size_t bi_size = sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD); + BITMAPINFO* bi = (BITMAPINFO*)malloc(bi_size); + memset(bi, 0, bi_size); BITMAPINFOHEADER& bih = bi->bmiHeader; bih.biSize = sizeof(bih); @@ -707,10 +709,10 @@ BOOL OsWin32_SpoolRow(const char* pData, bAbort = FALSE; iEsc = PASSTHROUGH; if (!Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL)) - { + { bAbort = TRUE; goto MPLCleanUp; - } + } // Call EPSPRINTING if it is supported (that is, if we're on a // PostScript printer) to suppress downloading the pscript header. @@ -718,8 +720,8 @@ BOOL OsWin32_SpoolRow(const char* pData, iEsc = EPSPRINTING; if (Escape(hPrnDC, QUERYESCSUPPORT, sizeof(int), (LPSTR)&iEsc, NULL)) { - iEsc = 1; // 1 == enable PASSTHROUGH (disable pscript header) - Escape(hPrnDC, EPSPRINTING, sizeof(int), (LPSTR)&iEsc, NULL); + iEsc = 1; // 1 == enable PASSTHROUGH (disable pscript header) + Escape(hPrnDC, EPSPRINTING, sizeof(int), (LPSTR)&iEsc, NULL); } diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index 0aa1eff3d..eb5181149 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -34,6 +34,8 @@ void TPRINT_RCD::SetData(void* data, unsigned int nSize) memcpy(m_data, data, nSize); m_size = nSize; } + else + xvt_dm_post_error("Printer info exceeds 16K"); } TPRINT_RCD::TPRINT_RCD() : m_size(0)