Hi everybody,

I'm writing a script file in order to get the print queues, but when I call the 
function EnumJobsA at the first time in order to know what is the size that I need to 
allocate for the buffer the function return the value 538976288 and when I try to 
allocate this value in a buffer variable the system abbend the script and return the 
error message "Out of memory!".

Any ideas?

Thanks a lot for your attention.

Edson Alvarenga



---- this is my script file ---------------------------------------------------------

use Win32::API;
use strict;

my $printer_name = 'nt_xerox';
my $OpenPrinter;
$OpenPrinter ||= Win32::API->new( 'winspool.drv','OpenPrinter',
                 [qw( P L P )],'N') or return;
my $printer_handle = ' ' x 4;
$OpenPrinter->Call( $printer_name, $printer_handle, undef);

my ($pcbSizeRequired, $pcbBytesReturned, $pl_bytes_needed, $sizeof_ji1_struct,
    $info_structs, $ji1structs, $long, $EnumJobs);
        
$pcbSizeRequired  = ' ' x 4; # Reserve space for LONG
$pcbBytesReturned = ' ' x 4; # Reserve space for LONG

$EnumJobs ||= Win32::API->new('winspool.drv','EnumJobsA',[qw( L P P P P P P P )],'L'); 

$EnumJobs->Call($printer_name, 0, 255, 1, $info_structs, 1, $pcbSizeRequired, 
                $pcbBytesReturned ); 

$pl_bytes_needed = unpack('L',$pcbSizeRequired);
print "Bytes Needed=$pl_bytes_needed\n\n";

$info_structs = ' ' x $pl_bytes_needed;

---- cut here -----------------------------------------------------------------------

Reply via email to