How can I intercept print jobs and make a print authentication RRS feed

  • 问题

  • I have a task to authenticate any print jobs(eg. to query job owner's privilege from database) in windows print spooler to decide whether the job is valid to go on to print.

    I have researched windows print architecture for a few days, and intend to intercept print jobs in spooler that applications initiated, for example, copy the SHD and SPL files to an other directory before they are sent to print processors  where jobs are rendered, and then we'll do a authentication by querying database. If the print job owner has the privilege, we copy back the two spooler files, and print process will go on. Conversely, we cancel this job simply by delete the two spooled files.

    But as I know little about the mechanism of Windows Spooler, and have no idea of details like follows:

    1) What's the mechanism of Windows Spool service? Is it something like directory scanner timer(C:\WINDOWS\system32\spool\PRINTERS) runs periodically, and send newly found spooled files to print processors?

    2) What is the time point that between A and B. Where A is the creation time of two spooled files,  and  B is the sending time of two spooled files to  print processor.  

    3) Is there any messages that are sent to windows before or after sending to print processor, where I can write a windows hook to do something?

     If you have other solutions, it is very kind of you to give any instructions! Many Thanks!

    2012年5月11日 8:37