Win2003 : Exceptions - The data area passed to a system call is too small

Coordinator
Dec 5, 2010 at 5:46 PM

Occaisionally there is an issue on Win 2003 SP3 where an error message gets logged:-

PrinterQueueWatch.PrintJob: System.ComponentModel.Win32Exception: The data area passed to a system call is too small
   at PrinterQueueWatch.SpoolerStructs.JOB_INFO_2..ctor(IntPtr hPrinter, Int32 dwJobId) in C:\...\PrinterQueueWatch\SpoolerStructs.vb:line 202
   at PrinterQueueWatch.PrintJob.InitJobInfo() in C:\...\PrinterQueueWatch\PrintJob.vb:line 1823

and thereafter

PrinterQueueWatch.PrintJob: System.ComponentModel.Win32Exception: The parameter is incorrect
   at PrinterQueueWatch.SpoolerStructs.JOB_INFO_1..ctor(IntPtr hPrinter, Int32 dwJobId) in C:\...\PrinterQueueWatch\SpoolerStructs.vb:line 66
   at PrinterQueueWatch.PrintJob.InitJobInfo() in C:\...\PrinterQueueWatch\PrintJob.vb:line 1815

Coordinator
Dec 5, 2010 at 5:52 PM

Line 202 is:

If NotGetJob(hPrinter, dwJobId, 2, ptBuf, BytesWritten, BytesWritten)

Then