omikron1 has asked for the wisdom of the Perl Monks concerning the following question:
which I packed it into $printer_info_2 variable as :typedef struct _PRINTER_INFO_2 { LPTSTR pServerName; LPTSTR pPrinterName; LPTSTR pShareName; LPTSTR pPortName; LPTSTR pDriverName; LPTSTR pComment; LPTSTR pLocation; LPDEVMODE pDevMode; LPTSTR pSepFile; LPTSTR pPrintProcessor; LPTSTR pDatatype; LPTSTR pParameters; PSECURITY_DESCRIPTOR pSecurityDescriptor; DWORD Attributes; DWORD Priority; DWORD DefaultPriority; DWORD StartTime; DWORD UntilTime; DWORD Status; DWORD cJobs; DWORD AveragePPM; } PRINTER_INFO_2, *PPRINTER_INFO_2;
then I load and call the function :$a="\0"; $printer_info_2=pack('PPPPPPPPPPPPPLLLLLLLL',$a,$a,$a,$a,$a,$a,$a,$a,$ +a,$a,$a,$a,$a,0,0,0,0,0,0,0,0);
and then unpack as :$GetPrinter=new Win32::API('winspool.drv','GetPrinterA','NNPNP','N'); $GetPrinter->Call($handle,2,$printer_info_2,10000,$bytesgot);
@a=unpack('P32P32P32P32P32P32P32P32P32P32P32P32P32LLLLLLLL',$printer_i +nfo_2);
So this raises the question:\\http://192.168.4.98\Lexmark T4 \\http://192.168.4.98\Lexmark http://192.168.4.98 . 1 6 8 . 4 Lexmark T430 T 4 3 0 http:/ comments go here g o h e r e comments go here g o h e r \\http://192.168.4.98\Lexmark comments go here g o h e WinPrint i n t comments g RAW W WinPrint i n t co RAW W WinPrint i n t € \ \ h t t p 2128 1 0 1380 1380 0 0 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Packing a c structure when using the win32api
by vkon (Curate) on Apr 14, 2006 at 11:01 UTC | |
|
Re: Packing a c structure when using the win32api
by omikron1 (Initiate) on Apr 15, 2006 at 12:08 UTC |