Network Printers - Handle is invalid

Jul 16, 2012 at 10:14 PM
Edited Jul 17, 2012 at 10:16 AM

Hi Duncan,

First of all, thanks for this great and useful project. I am currently using this tool to control the spooling order of a xerox printer thats is no longer supported by the company. The reason for monitoring the spooling is because of flaws in their drivers that cause document to print out in incorrect order.

The code from the current changeset works beautifully with the printer installed as a local printer. However when attempting to monitor this same printer as a network printer i am receiving a "handle is invalid" error. The error occurs in the PrinterChangeChangeNotificationThread class in the DecodePrinterChangeInformation method at line 350. I am assuming it has something to do with the SafeWaitHandle being invalid(?), but i could be completely wrong.

Anyway, i have tried to change the the API to use long types instead of Int32 and various variants of the API from Google but still without any luck. Have you or anyone else managed to get it to work with network printers? if so i would be greatful if you could share the code to resolve this issue i am having.

Kind Regards

Mo Patel

Aug 27, 2012 at 11:38 AM

I think it may be that the memory space needed to put the spooler reply into is invalid - i.e. it is returning a pointer but that pointer is relative to the server machine not the client machine?  I'll try and rig up a test case to see.

Aug 27, 2012 at 11:39 AM

Or if it is 64 bit windows it may be because of this issue: to which I have no idea...