Hi~,
I'm newbie in ms-windows and VC programming. :)
I should develop NT service program that prohibit user's printing any
documents.
I tested SetPrinter() and I found a problem.
Using SetPrinter() can't control network printer that attached in
other machine.
('Access denied' error is displayed when calling OpenPrinter() using
DesiredAccess set to PRINTER_ALL_ACCESS)
So I should find another method.
I want to block all printers installed in local machine(local printer
and network printer). But for the network shared printer, another
computer should can print using this network shared printer.
(Only a computer that my program is installed should be influenced by
my program)
Q.1 Can I hook printing event or job or print spooler?
(I think GetJob() also can't filter user's printing job...)
I posted this question to many newsgroups or forums but I didn't get
suitable answer(may be impossible??...)
Now, I'm testing Customized Print Processor using genprint.dll from
ddk.
I built and copy it to C:\WINNT\system32\spool\drivers\w32x86.
And I made its installation program.
int main()
{
...
nResult = GetPrintProcessorDirectory(...,processorPath,...);
_tcscat(processorPath, _T("\\genprint.dll"));
nResult = AddPrintProcessor(
NULL, // server name
NULL, // environment name
processorPath,//processorPath, // path
"My Processor" // ----> what string should I use??
);
}
It returns error string("The specified module could not be found.").
Q.2 Which string should I use in pPrintProcessorName field? and
processorPath string(C:\WINNT\system32\spool\drivers\w32x86\genprint.dll)
is right?
Q.3 If I success AddPrintProcessor(), how can I change Print Processor
to "My Processor" from "WinPrint" of existing printer?
Q.4 I can't change Print Processor property of network printer
manually(Print Processor button is disabled).
That means, using customized print processor also can't control
printing network printer?
Thanks in advance.
And I hope you can understand my poor english :)