FindFirstPrinterChangeNotification() fail!
-
Iuse Administrator to Logged on My widnow xp. I enum the share printer connected in the network. I use openprinters() to open the printer ,it success. I get the printer handle. then I use FindFirstPrinterChangeNotification() to Monitor the printer ,it fail ,the Error code is 5(ERROR_ACCESS_DENIED). but if Use the domain user to logged on my window xp(just like: domain1\\user1), all is good . why? what different between of administrator(local) and domain1\\user1(domain)? how to fix it? thanks! my code like this: hPrinterNotification = FindFirstPrinterChangeNotification( ThreadParam.hPrinter, PRINTER_CHANGE_DELETE_JOB, 0, &NotificationOptions); if (hPrinterNotification == INVALID_HANDLE_VALUE) { CString strE; strE.Format ("FindFirstPrinterChangeNotification failed! Error code = %d",GetLastError()); return 0; } -- modified at 21:47 Monday 27th February, 2006
-
Iuse Administrator to Logged on My widnow xp. I enum the share printer connected in the network. I use openprinters() to open the printer ,it success. I get the printer handle. then I use FindFirstPrinterChangeNotification() to Monitor the printer ,it fail ,the Error code is 5(ERROR_ACCESS_DENIED). but if Use the domain user to logged on my window xp(just like: domain1\\user1), all is good . why? what different between of administrator(local) and domain1\\user1(domain)? how to fix it? thanks! my code like this: hPrinterNotification = FindFirstPrinterChangeNotification( ThreadParam.hPrinter, PRINTER_CHANGE_DELETE_JOB, 0, &NotificationOptions); if (hPrinterNotification == INVALID_HANDLE_VALUE) { CString strE; strE.Format ("FindFirstPrinterChangeNotification failed! Error code = %d",GetLastError()); return 0; } -- modified at 21:47 Monday 27th February, 2006
Your local administrator account does not necessarily have privileges on the network. It is possible to enumerate network resources without having necessary permission to access or utilize those resources. So, you can enumerate the printers, but when you try to open one, you fail from the local administrator account. Your domain account obviously has network printer privileges. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
-
Your local administrator account does not necessarily have privileges on the network. It is possible to enumerate network resources without having necessary permission to access or utilize those resources. So, you can enumerate the printers, but when you try to open one, you fail from the local administrator account. Your domain account obviously has network printer privileges. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
-
Blake Miller: can you tell how to open one from the local administrator account? thanks! cococut
The same way you open the other ones, but you have to be granted access permission form the owner of the object, in this case the printer. In other words, a network administrator needs to grant the MachineName\Administrator account privileges to modify the printer. Also, you could try different access permission request, instead of ALL_ACCESS try something like 'read' access rights on the OpenPrinter command, that might work, since you are perhaps not trying to change anything. Most people seem to go for ALL_ACCESS when they only want to query a device. Opening for read only access often works where 'all access' or 'write access' requests fail. You could post the code for your OpenPrinter command and me or someone here could try to help you out. People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks