2016-03-08 16:18 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
* contrib/hbwin/hbwin.ch
+ added macros with printer status errors
* contrib/hbwin/wapi_wingdi.c
* contrib/hbwin/win_prn1.c
* contrib/hbwin/win_prn2.c
* contrib/hbwin/win_prn3.c
* clear pointers and memory buffers passed to windows printer functions
* removed repeated definition
This commit is contained in:
@@ -10,6 +10,17 @@
|
||||
* Change, ! Fix, % Optimization, + Addition, - Removal, ; Comment
|
||||
*/
|
||||
|
||||
2016-03-08 16:18 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbwin/hbwin.ch
|
||||
+ added macros with printer status errors
|
||||
|
||||
* contrib/hbwin/wapi_wingdi.c
|
||||
* contrib/hbwin/win_prn1.c
|
||||
* contrib/hbwin/win_prn2.c
|
||||
* contrib/hbwin/win_prn3.c
|
||||
* clear pointers and memory buffers passed to windows printer functions
|
||||
* removed repeated definition
|
||||
|
||||
2016-03-08 16:01 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl)
|
||||
* contrib/hbmzip/mzip.c
|
||||
! fixed memory leak
|
||||
|
||||
@@ -774,4 +774,32 @@
|
||||
#define HB_RPC_S_UNKNOWN_PRINCIPAL 1332
|
||||
#define HB_RPC_S_TIMEOUT 1460
|
||||
|
||||
/* win_PrinterStatus() return values */
|
||||
#define HB_WIN_PRINTER_STATUS_ERROR ( -1 )
|
||||
#define WIN_PRINTER_STATUS_PAUSED 0x00000001
|
||||
#define WIN_PRINTER_STATUS_ERROR 0x00000002
|
||||
#define WIN_PRINTER_STATUS_PENDING_DELETION 0x00000004
|
||||
#define WIN_PRINTER_STATUS_PAPER_JAM 0x00000008
|
||||
#define WIN_PRINTER_STATUS_PAPER_OUT 0x00000010
|
||||
#define WIN_PRINTER_STATUS_MANUAL_FEED 0x00000020
|
||||
#define WIN_PRINTER_STATUS_PAPER_PROBLEM 0x00000040
|
||||
#define WIN_PRINTER_STATUS_OFFLINE 0x00000080
|
||||
#define WIN_PRINTER_STATUS_IO_ACTIVE 0x00000100
|
||||
#define WIN_PRINTER_STATUS_BUSY 0x00000200
|
||||
#define WIN_PRINTER_STATUS_PRINTING 0x00000400
|
||||
#define WIN_PRINTER_STATUS_OUTPUT_BIN_FULL 0x00000800
|
||||
#define WIN_PRINTER_STATUS_NOT_AVAILABLE 0x00001000
|
||||
#define WIN_PRINTER_STATUS_WAITING 0x00002000
|
||||
#define WIN_PRINTER_STATUS_PROCESSING 0x00004000
|
||||
#define WIN_PRINTER_STATUS_INITIALIZING 0x00008000
|
||||
#define WIN_PRINTER_STATUS_WARMING_UP 0x00010000
|
||||
#define WIN_PRINTER_STATUS_TONER_LOW 0x00020000
|
||||
#define WIN_PRINTER_STATUS_NO_TONER 0x00040000
|
||||
#define WIN_PRINTER_STATUS_PAGE_PUNT 0x00080000
|
||||
#define WIN_PRINTER_STATUS_USER_INTERVENTION 0x00100000
|
||||
#define WIN_PRINTER_STATUS_OUT_OF_MEMORY 0x00200000
|
||||
#define WIN_PRINTER_STATUS_DOOR_OPEN 0x00400000
|
||||
#define WIN_PRINTER_STATUS_SERVER_UNKNOWN 0x00800000
|
||||
#define WIN_PRINTER_STATUS_POWER_SAVE 0x01000000
|
||||
|
||||
#endif /* HBWIN_CH_ */
|
||||
|
||||
@@ -288,7 +288,7 @@ HB_FUNC( __WAPI_DEVMODE_NEW )
|
||||
|
||||
if( lSize > 0 )
|
||||
{
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrab( lSize );
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrabz( lSize );
|
||||
|
||||
if( DocumentProperties( 0, hPrinter, ( LPTSTR ) lpDeviceName, pDevMode, pDevMode, DM_OUT_BUFFER ) == IDOK )
|
||||
hbwapi_ret_PDEVMODE( pDevMode );
|
||||
|
||||
@@ -387,7 +387,7 @@ HB_FUNC( WIN_SETDOCUMENTPROPERTIES )
|
||||
|
||||
if( lSize > 0 )
|
||||
{
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrab( lSize );
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrabz( lSize );
|
||||
|
||||
if( DocumentProperties( 0, hPrinter, ( LPTSTR ) lpDeviceName, pDevMode, pDevMode, DM_OUT_BUFFER ) == IDOK )
|
||||
{
|
||||
@@ -494,7 +494,7 @@ HB_FUNC( WIN_GETDOCUMENTPROPERTIES )
|
||||
|
||||
if( lSize > 0 )
|
||||
{
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrab( lSize );
|
||||
PDEVMODE pDevMode = ( PDEVMODE ) hb_xgrabz( lSize );
|
||||
|
||||
if( DocumentProperties( 0, hPrinter, ( LPTSTR ) lpDeviceName, pDevMode, pDevMode, DM_OUT_BUFFER ) == IDOK )
|
||||
{
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
#include "hbapifs.h"
|
||||
#include "hbapiitm.h"
|
||||
|
||||
#include "hbwin.ch"
|
||||
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
#include <winspool.h>
|
||||
#endif
|
||||
@@ -90,7 +92,7 @@ HB_FUNC( WIN_PRINTEREXISTS )
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_5 * pPrinterEnumBak;
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( EnumPrinters( _ENUMPRN_FLAGS_, NULL, 5, ( LPBYTE ) pPrinterEnum, dwNeeded, &dwNeeded, &dwReturned ) )
|
||||
{
|
||||
@@ -182,7 +184,7 @@ static void hb_GetDefaultPrinter( PHB_ITEM pPrinterName )
|
||||
EnumPrinters( PRINTER_ENUM_DEFAULT, NULL, 2, NULL, 0, &dwNeeded, &dwReturned );
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( EnumPrinters( PRINTER_ENUM_DEFAULT, NULL, 2, ( LPBYTE ) pPrinterInfo, dwNeeded, &dwNeeded, &dwReturned ) && dwReturned )
|
||||
HB_ITEMPUTSTR( pPrinterName, pPrinterInfo->pPrinterName );
|
||||
@@ -213,7 +215,7 @@ static HB_BOOL hb_GetJobs( HANDLE hPrinter, JOB_INFO_2 ** ppJobInfo, DWORD * pdw
|
||||
GetPrinter( hPrinter, 2, NULL, 0, &dwNeeded );
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
DWORD dwUsed = 0;
|
||||
|
||||
if( GetPrinter( hPrinter, 2, ( LPBYTE ) pPrinterInfo, dwNeeded, &dwUsed ) )
|
||||
@@ -223,7 +225,7 @@ static HB_BOOL hb_GetJobs( HANDLE hPrinter, JOB_INFO_2 ** ppJobInfo, DWORD * pdw
|
||||
EnumJobs( hPrinter, 0, pPrinterInfo->cJobs, 2, NULL, 0, &dwNeeded, &dwReturned );
|
||||
if( dwNeeded )
|
||||
{
|
||||
JOB_INFO_2 * pJobInfo = ( JOB_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
JOB_INFO_2 * pJobInfo = ( JOB_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( EnumJobs( hPrinter, 0, dwReturned, 2, ( LPBYTE ) pJobInfo, dwNeeded, &dwUsed, &dwReturned ) )
|
||||
{
|
||||
@@ -244,7 +246,7 @@ static HB_BOOL hb_GetJobs( HANDLE hPrinter, JOB_INFO_2 ** ppJobInfo, DWORD * pdw
|
||||
|
||||
HB_FUNC( WIN_PRINTERSTATUS )
|
||||
{
|
||||
long nStatus = -1;
|
||||
long nStatus = HB_WIN_PRINTER_STATUS_ERROR;
|
||||
|
||||
#if ! defined( HB_OS_WIN_CE )
|
||||
PHB_ITEM pPrinterName = hb_itemParam( 1 );
|
||||
@@ -265,7 +267,7 @@ HB_FUNC( WIN_PRINTERSTATUS )
|
||||
GetPrinter( hPrinter, 2, NULL, 0, &dwNeeded );
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_2 * pPrinterInfo = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( GetPrinter( hPrinter, 2, ( LPBYTE ) pPrinterInfo, dwNeeded, &dwNeeded ) )
|
||||
nStatus = ( long ) pPrinterInfo->Status;
|
||||
@@ -275,7 +277,7 @@ HB_FUNC( WIN_PRINTERSTATUS )
|
||||
|
||||
if( nStatus == 0 )
|
||||
{
|
||||
JOB_INFO_2 * pJobs;
|
||||
JOB_INFO_2 * pJobs = NULL;
|
||||
DWORD dwJobs = 0;
|
||||
|
||||
if( hb_GetJobs( hPrinter, &pJobs, &dwJobs ) )
|
||||
@@ -323,7 +325,7 @@ HB_FUNC( WIN_PRINTERPORTTONAME )
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_5 * pPrinterEnumBak;
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( EnumPrinters( _ENUMPRN_FLAGS_, NULL, 5, ( LPBYTE ) pPrinterEnum, dwNeeded, &dwNeeded, &dwReturned ) )
|
||||
{
|
||||
@@ -525,17 +527,6 @@ HB_FUNC( WIN_PRINTDATARAW )
|
||||
hb_retns( nResult );
|
||||
}
|
||||
|
||||
|
||||
/* Positions for win_printerList() array */
|
||||
|
||||
#define HB_WINPRN_NAME 1
|
||||
#define HB_WINPRN_PORT 2
|
||||
#define HB_WINPRN_TYPE 3
|
||||
#define HB_WINPRN_DRIVER 4
|
||||
#define HB_WINPRN_SHARE 5
|
||||
#define HB_WINPRN_SERVER 6
|
||||
#define HB_WINPRN_LEN_ 6
|
||||
|
||||
HB_FUNC( WIN_PRINTERLIST )
|
||||
{
|
||||
PHB_ITEM pPrinterArray = hb_itemArrayNew( 0 );
|
||||
@@ -549,7 +540,7 @@ HB_FUNC( WIN_PRINTERLIST )
|
||||
if( dwNeeded )
|
||||
{
|
||||
PRINTER_INFO_5 * pPrinterEnumBak;
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_5 * pPrinterEnum = pPrinterEnumBak = ( PRINTER_INFO_5 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( EnumPrinters( _ENUMPRN_FLAGS_, NULL, 5, ( LPBYTE ) pPrinterEnum, dwNeeded, &dwNeeded, &dwReturned ) )
|
||||
{
|
||||
@@ -575,7 +566,7 @@ HB_FUNC( WIN_PRINTERLIST )
|
||||
HB_ARRAYSETSTR( pTempItem, HB_WINPRN_NAME, pPrinterEnum->pPrinterName );
|
||||
|
||||
{
|
||||
PRINTER_INFO_2 * pPrinterInfo2 = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
PRINTER_INFO_2 * pPrinterInfo2 = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
if( GetPrinter( hPrinter, 2, ( LPBYTE ) pPrinterInfo2, dwNeeded, &dwNeeded ) )
|
||||
{
|
||||
|
||||
@@ -83,7 +83,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName )
|
||||
}
|
||||
|
||||
/* Allocate enough space for PRINTER_INFO_2. */
|
||||
ppi2 = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
ppi2 = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
/* The second GetPrinter() will fill in all the current information
|
||||
so that all you have to do is modify what you are interested in. */
|
||||
@@ -162,7 +162,7 @@ static HB_BOOL hb_SetDefaultPrinter( LPCTSTR lpPrinterName )
|
||||
}
|
||||
|
||||
/* Allocate enough space for PRINTER_INFO_2. */
|
||||
ppi2 = ( PRINTER_INFO_2 * ) hb_xgrab( dwNeeded );
|
||||
ppi2 = ( PRINTER_INFO_2 * ) hb_xgrabz( dwNeeded );
|
||||
|
||||
/* The second GetPrinter() fills in all the current
|
||||
information. */
|
||||
|
||||
Reference in New Issue
Block a user