From: BlackMizi on 9 Dec 2009 09:13 Are You using the save devmode - code 4 both dll's? On 13 Okt., 14:33, Bob <bs...(a)yahoo.com> wrote: > Hi everyone, > > I'm writing a PSCRIPT5 unidriver to be included in a printing auditing > system. The required feature is I need to insert current user's name, > host name and printing application (exe) into the PS stream for further > processing. > > The driver should be usable both as a local printer and as a network > shared printer. The challenging part is that the client user may use a > different account to connect to the shared printer. So I cannot simply > write a graphics plugin to call GetUserName and insert the result in > IPrintOemPS::Command(Some commercial printer driver actually did this, btw). > > My solution is to extend OEMDEV, putting the username into private > DEVMODE at UI plugin during IPrintOemUI::DevMode MERGE call and let > graphics plugin to do the output at the server end. > > It works perfectly except one thing: user who prints printer test page > is not identified correctly. Further investigation shows this: > 1. The UI plugin actually captures the user's name into DEVMODE. > 2. The DEVMODE from UI plugin is not received by graphics plugin. I > looked into IPrintOemPS::DevMode calls and found the DEVMODE received is > not the one from UI, but the one kept in client's DevModePerUser > registry. Since I did not store user name into DEVMODE, graphics plugin > received null string. > 3. If I delete the DevModePerUser key from client registry, the DEVMODE > received will be the "Default DevMode" from server's HKLM registry. > 4. I rewrite IPrintOemUI::CommonUIProp to save user's name into DEVMODE > so system will keep it into registry, it temporarily solves the test > page problem. But later I find a bigger problem: if a user at the server > uses "Printer->Properties->Advanced->Printing Defaults" to create > default DEVMODE (with his user account inside), and a client user > deletes "DevModePerUser" key from client registry, then all the test > page printed will be credited to server's account. And I do not have a > way to differentiate "Printing Preferences..." and "Printing Defaults" > button. > > I wonder what the test page did and why it does not use the standard way > to obtain DEVMODE. Is it by design and is there any walk rounds? > > Thanks for reading that long. > > Bob
|
Pages: 1 Prev: Signing driver for virtual com port Next: WinUSB device path |