View previous topic :: View next topic |
Author |
Message |
Rubes_sw Valued Contributor
Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Thu Aug 07, 2003 9:18 pm Post subject: Open Source Project - Printing Administrator |
|
|
I don't know is this could be done. But I could use It. and I know of several people who would buy it.
Say you went to print something, anything. Before the print dialog would comeup or after. You would be prompted for a username and a password. The program would then check your account to see if you had any available credit and if so print. If not then you would have to purchase or request more printing credits.
Could this be done, maybe using some API calls? Ideas?
Nathan |
|
Back to top |
|
|
FreezingFire Admin Team
Joined: 23 Jun 2002 Posts: 3508
|
Posted: Thu Aug 07, 2003 10:02 pm Post subject: |
|
|
I'm sure it could somehow be done, but I'm also sure it would involve a
lot of work. I don't think it would be possible using API calls to catch the
request before the print dialog box without writing some sort of replacement
printing library.
It might be posssible after the document is spooled to check and delete
them if you don't have enough credits.
Sounds like a really interesting idea. If there's any way to do it, I'm in. _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 08, 2003 1:25 am Post subject: |
|
|
Do you want restricting printing of content from your program or everything from the system ?
First one is easy but second one should be possible but needs lot of work i think needs changing token access etc and may also involve using low level APIs.( and i think it needs setting system wide API hooks and discard any API calls to printer without a password which may slow down the system and also crash it if some error occurs)
If i get time i will have a look.
BTW it may be possible reliably only on NT machines ?
Another thought in NT OS , You can disable printing for a particular account and in your program send the command to printer using different credentials - another user acoount with print access - of course the user will not get access to password as you are changing credentials using API inside your app for that particular instance of the app. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 08, 2003 1:58 am Post subject: |
|
|
just found a link you can check this commercial stuff
http://www.printeron.net/solutions.html
IMHO whatever you achieve with the VDS code (except probably the user account stuff) the final hitch is whether you can run your app as a service and hidden from the process list atleast in taskmanager - else user can easily disable it and start printing.
EDIT:
There is a utilty called runas which runs as a service and from that you can run an
app using a different account and supplying the username and password. But
unfortunately it desnot work under Win XP(only NT/2k).
So My thought is as follows:
1.Create 2 user accounts.
Account A has print privileges.
Account B doesnot have and also has no privileges to install a driver etc.
User logs on with account B.
2. Inside the VDS app obtain the token handle for account A by calling the LogonUser API function.Give this token to ImpersonateLoggedOnUser API. Now user B has all print privileges and can print. Once done with the job or his quota is over call RevertToSelf function. This will revert the back the user to account B status. He cannot print anymore.
3. Additionally you can count the number of completed printing jobs using API. This one involves a lot of math. I am always bad at it .
Hope this makes sense.
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 08, 2003 7:45 am Post subject: |
|
|
One simple Idea. Count the number of pages printed from the printer log and deduct it from the credit . Just stop the "Spooler" service once this happens and periodically check if the service is restarted under a timer. If credits are not updated and "Spooler" service is restarted immedaitely stop it. Run this vds app from an account different from the one you give to the user. In winxp fast user switching is possible - so you need not logoff the administrative account and hence the vds app keeps running yet is not visible to the user !!. The limitation is it works only on XP
You can refer to this example to see how to control srevices from VDS app.
http://forum.vdsworld.com/viewtopic.php?t=1819 _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
LOBO Valued Contributor
Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Fri Aug 08, 2003 11:41 am Post subject: |
|
|
CodeScript wrote: | changing credentials using API inside your app for that particular instance of the app. |
CodeScript could you you show an example of how I could use API to send a different username & password. I have a project coming up where I have some locked down users who will need to uninstall a program and then install the new program and I am looking for alternatives to touching each machine to unlock then do the above and then relocking the accounts. Any help would be greatly appreciated.
-Mark |
|
Back to top |
|
|
CodeScript Moderator Team
Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Fri Aug 08, 2003 2:20 pm Post subject: |
|
|
LOBO wrote: | CodeScript wrote: | changing credentials using API inside your app for that particular instance of the app. |
CodeScript could you you show an example of how I could use API to send a different username & password. -Mark |
OK LOBO this demo below shows how. You may also have look at
http://forum.vdsworld.com/viewtopic.php?p=13402 (contents are same)
Nathan
I have updated the VDS services demo example with ImpersonateLoggedOnUser API functiom so that you can use administrator privileges and start the spooler service from the user account by the VDS app.
You need to change the start spooler service settings to manual from automatic so that it doesnot start at startup from the user account. Now you can fully control your user's access to the printers based on the log.
http://codescript.vdsworld.com/VDS5src/Impersonate_user.zip
Regards _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
Back to top |
|
|
Rubes_sw Valued Contributor
Joined: 11 Jun 2001 Posts: 625 Location: Northern Ireland
|
Posted: Fri Aug 08, 2003 3:45 pm Post subject: |
|
|
Thanks, I will look into it...
Nathan |
|
Back to top |
|
|
LOBO Valued Contributor
Joined: 14 Mar 2002 Posts: 241 Location: Wilmington, Delaware, USA
|
Posted: Sat Aug 09, 2003 12:06 am Post subject: |
|
|
Thanks CodeScript
-Mark |
|
Back to top |
|
|
|